diff --git a/2025/docs/en/0x02_2025-What_are_Application_Security_Risks.md b/2025/docs/en/0x02_2025-What_are_Application_Security_Risks.md index df1e9d066..e38da3d57 100644 --- a/2025/docs/en/0x02_2025-What_are_Application_Security_Risks.md +++ b/2025/docs/en/0x02_2025-What_are_Application_Security_Risks.md @@ -40,7 +40,7 @@ Vectors dynamic by situation picture - By Application exposure (by environment + By Application exposure (by environment) Avg Weighted Exploit diff --git a/node_modules/.bin/esparse b/node_modules/.bin/esparse new file mode 120000 index 000000000..7423b18b2 --- /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 000000000..16069effb --- /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 000000000..9dbd010d4 --- /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 000000000..217f37981 --- /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/markdown-it b/node_modules/.bin/markdown-it new file mode 120000 index 000000000..894bcdb61 --- /dev/null +++ b/node_modules/.bin/markdown-it @@ -0,0 +1 @@ +../markdown-it/bin/markdown-it.js \ No newline at end of file diff --git a/node_modules/.bin/markdownlint b/node_modules/.bin/markdownlint new file mode 120000 index 000000000..f2b1093a6 --- /dev/null +++ b/node_modules/.bin/markdownlint @@ -0,0 +1 @@ +../markdownlint-cli/markdownlint.js \ No newline at end of file diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp new file mode 120000 index 000000000..017896ceb --- /dev/null +++ b/node_modules/.bin/mkdirp @@ -0,0 +1 @@ +../mkdirp/bin/cmd.js \ No newline at end of file diff --git a/node_modules/.bin/rc b/node_modules/.bin/rc new file mode 120000 index 000000000..48b3cda74 --- /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/resolve b/node_modules/.bin/resolve new file mode 120000 index 000000000..b6afda6c7 --- /dev/null +++ b/node_modules/.bin/resolve @@ -0,0 +1 @@ +../resolve/bin/resolve \ No newline at end of file diff --git a/node_modules/.bin/rimraf b/node_modules/.bin/rimraf new file mode 120000 index 000000000..4cd49a49d --- /dev/null +++ b/node_modules/.bin/rimraf @@ -0,0 +1 @@ +../rimraf/bin.js \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver new file mode 120000 index 000000000..317eb293d --- /dev/null +++ b/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver \ No newline at end of file diff --git a/node_modules/.bin/textlint b/node_modules/.bin/textlint new file mode 120000 index 000000000..79026c194 --- /dev/null +++ b/node_modules/.bin/textlint @@ -0,0 +1 @@ +../textlint/bin/textlint.js \ No newline at end of file diff --git a/node_modules/.bin/textlint-formatter b/node_modules/.bin/textlint-formatter new file mode 120000 index 000000000..6d7bea9b9 --- /dev/null +++ b/node_modules/.bin/textlint-formatter @@ -0,0 +1 @@ +../@textlint/linter-formatter/bin/cmd.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 000000000..26579ea78 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,3973 @@ +{ + "name": "owasptop10", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/@azu/format-text": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@azu/format-text/-/format-text-1.0.2.tgz", + "integrity": "sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==", + "dev": true + }, + "node_modules/@azu/style-format": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@azu/style-format/-/style-format-1.0.1.tgz", + "integrity": "sha512-AHcTojlNBdD/3/KxIKlg8sxIWHfOtQszLvOpagLTO+bjC3u7SAszu1lf//u7JJC50aUSH+BVWDD/KvaA6Gfn5g==", + "dev": true, + "dependencies": { + "@azu/format-text": "^1.0.1" + } + }, + "node_modules/@textlint/ast-node-types": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.4.3.tgz", + "integrity": "sha512-qi2jjgO6Tn3KNPGnm6B7p6QTEPvY95NFsIAaJuwbulur8iJUEenp1OnoUfiDaC/g2WPPEFkcfXpmnu8XEMFo2A==", + "dev": true + }, + "node_modules/@textlint/ast-tester": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@textlint/ast-tester/-/ast-tester-2.3.5.tgz", + "integrity": "sha512-sbw0Edx22/Fa9fwObpus5KyhCnGKhyP1tU7flA7kwTi9EqQq2KFztz1c/QQWpgqymbdSPWg7HpAvGf4ru4FDZg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/ast-traverse": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@textlint/ast-traverse/-/ast-traverse-2.3.5.tgz", + "integrity": "sha512-yo1gIoXDx2bNs1JjC9viRxJpErNsfPtzb585KcVwWxxWmu3tXlT2iz13iKdjj5FMYPJe/PORe7lYqymkSUZ7kg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/feature-flag": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/feature-flag/-/feature-flag-3.3.5.tgz", + "integrity": "sha512-S4JhbDQGu1Sutnvqs96nwxqwaErHrL49/QQDR8i/YNsINlurfKJbmktotb+w+qzeSibDibKzB8feOMVBXmO9Ww==", + "dev": true, + "dependencies": { + "map-like": "^2.0.0" + } + }, + "node_modules/@textlint/fixer-formatter": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/fixer-formatter/-/fixer-formatter-3.3.5.tgz", + "integrity": "sha512-FHfOQLvJV88vgAI9wwbAjtffo4ZtAW0bV8xkC3dY2DdVyo+7Tnhz0l2XPw2VFmyzpeHx9Slqw8nEv46YEs4JaQ==", + "dev": true, + "dependencies": { + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "debug": "^4.3.1", + "diff": "^4.0.2", + "is-file": "^1.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1" + } + }, + "node_modules/@textlint/get-config-base-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@textlint/get-config-base-dir/-/get-config-base-dir-2.0.0.tgz", + "integrity": "sha512-J3cG1pl2llYD4ZaZMe0qVgVaHT8RvT+/SW1FHQ8HRceNalMM9O0Y8iIgtl4GGOx4vMghoIPKFVLASw8P8bJ3ZA==", + "dev": true + }, + "node_modules/@textlint/kernel": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@textlint/kernel/-/kernel-3.4.5.tgz", + "integrity": "sha512-KGeOq4mbjPe3okDtPw7mbnTX/wP66ndmRKAoOz8gOKDIDRlH8nOG/av6k6xbVhdMk9+ZnomqU8jSSYwTZHzAnA==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-tester": "^2.3.5", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/source-code-fixer": "^3.4.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "map-like": "^2.0.0", + "structured-source": "^3.0.2" + } + }, + "node_modules/@textlint/linter-formatter": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-3.3.5.tgz", + "integrity": "sha512-ujQwgGGK4nVYRuNeW8zDyxax2Z8FTRips5f3VBhWpJaR7hlqdh1iNahul8iJ+1JbfXiHm+51a01myoqGGh1ENA==", + "dev": true, + "dependencies": { + "@azu/format-text": "^1.0.1", + "@azu/style-format": "^1.0.0", + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "concat-stream": "^1.6.2", + "debug": "^4.3.1", + "is-file": "^1.0.0", + "js-yaml": "^3.14.1", + "optionator": "^0.9.1", + "pluralize": "^2.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "table": "^3.8.3", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1", + "xml-escape": "^1.1.0" + }, + "bin": { + "textlint-formatter": "bin/cmd.js" + } + }, + "node_modules/@textlint/markdown-to-ast": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-6.3.5.tgz", + "integrity": "sha512-DjVEy61klC8OjQYP+iIukI95pjCM58jhpE046apqGWLo6JQSatfscJlcxmbRivfTQSVsa00RF2ciUFBmw3bobg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "debug": "^4.3.1", + "remark-frontmatter": "^1.3.3", + "remark-parse": "^5.0.0", + "structured-source": "^3.0.2", + "traverse": "^0.6.6", + "unified": "^6.2.0" + } + }, + "node_modules/@textlint/module-interop": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-1.2.5.tgz", + "integrity": "sha512-+yEluCSbj6oxk9ENFojVcSxURvXOg7AU3vBiVHPjPEShaqbzZZ6tcut6gbDcIYhEDUkegZGmGwyfOe+wNABhKw==", + "dev": true + }, + "node_modules/@textlint/regexp-string-matcher": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@textlint/regexp-string-matcher/-/regexp-string-matcher-1.1.1.tgz", + "integrity": "sha512-rrNUCKGKYBrZALotSF8D5A8xD05VHX6kxv0BP805Ig2M73Ha6LK+de31+ZocGm4CO+sikVFYyMCPPJhp7bCXcw==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0", + "execall": "^2.0.0", + "lodash.sortby": "^4.7.0", + "lodash.uniq": "^4.5.0", + "lodash.uniqwith": "^4.5.0", + "to-regex": "^3.0.2" + } + }, + "node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@textlint/source-code-fixer": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@textlint/source-code-fixer/-/source-code-fixer-3.4.5.tgz", + "integrity": "sha512-YUcBg6zs7H5ycLwWdfv5LHWlBx7iBAQL6vHY2uPw8AMPYgzU6/f91NGBU/QR7/FVw0e7v9zMngcRN1hMOxpFCw==", + "dev": true, + "dependencies": { + "@textlint/types": "^1.5.5", + "debug": "^4.3.1" + } + }, + "node_modules/@textlint/text-to-ast": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/text-to-ast/-/text-to-ast-3.3.5.tgz", + "integrity": "sha512-+1+Kj7wuQHgc43RowVN/KWz3/aevk2RHARX8/p9Y+pE25HRJ36KZo1PLSYYx82NnWpvZTXB3QONWiAukdv6jBg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/textlint-plugin-markdown": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/@textlint/textlint-plugin-markdown/-/textlint-plugin-markdown-5.3.5.tgz", + "integrity": "sha512-x1/DJa+6wsR4LwkL+JA5OdEoZ/PhxtkKb20IqHTsLwQIeDL4aNWT6GrAk0HKTOomzsyNrUBuvzYiCy/f75LtBw==", + "dev": true, + "dependencies": { + "@textlint/markdown-to-ast": "^6.3.5" + } + }, + "node_modules/@textlint/textlint-plugin-text": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@textlint/textlint-plugin-text/-/textlint-plugin-text-4.3.5.tgz", + "integrity": "sha512-ygjzswWrzlCiNNCy1+WF0oI8tNCk+1fS/nJEtG7DHuTVvE0OTn4MdWJXOD8sd+ZffXr+uFmEqMisHo06+RpQCg==", + "dev": true, + "dependencies": { + "@textlint/text-to-ast": "^3.3.5" + } + }, + "node_modules/@textlint/types": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@textlint/types/-/types-1.5.5.tgz", + "integrity": "sha512-80P6fcqgsG9bP6JgR6W/E/oIx+71pplaicYCvvB4vMIeGk0OnWls4Q21kCpDYmq/C/ABtZ/Gy/Ov/8ExQPeQ7A==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/utils": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@textlint/utils/-/utils-1.2.5.tgz", + "integrity": "sha512-2vgz4x3tKK+R9N0OlOovJClRCHubxZi86ki218cvRVpoU9pPrHwkwZud+rjItDl2xFBj7Gujww7c0W1wyytWVQ==", + "dev": true + }, + "node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "dev": true + }, + "node_modules/ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha512-I/bSHSNEcFFqXLf91nchoNB9D1Kie3QKcWdchYUaoIg1+1bdWDkdfdlvdIOJbi9U8xR0y+MWc5D+won9v95WlQ==", + "dev": true, + "dependencies": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "node_modules/ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha512-vuBv+fm2s6cqUyey2A7qYcvsik+GMDJsw8BARP2sDE76cqmaZVarsvHf7Vx6VJ0Xk8gLl+u3MoAPf6gKzJefeA==", + "dev": true, + "peerDependencies": { + "ajv": ">=4.10.0" + } + }, + "node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/bail": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/boundary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", + "integrity": "sha512-AaLhxHwYVh55iOTJncV3DE5o7RakEUSSj64XXEWRTiIhlp7aDI8qR0vY/k8Uw0Z234VjZi/iG/WxfrvqYPUCww==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/chalk/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/character-entities": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/clone-regexp": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", + "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", + "dev": true, + "dependencies": { + "is-regexp": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/collapse-white-space": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz", + "integrity": "sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "engines": [ + "node >= 0.8" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-equal": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.2.tgz", + "integrity": "sha512-5tdhKF6DbU7iIzrIOa1AOUt39ZRm13cmL1cGEh//aqR8x9+tNfbywRf0n5FD/18OKMdo7DNEtrX2t22ZAkI+eg==", + "dev": true, + "dependencies": { + "is-arguments": "^1.1.1", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.5.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/entities": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", + "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz", + "integrity": "sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execall": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/execall/-/execall-2.0.0.tgz", + "integrity": "sha512-0FU2hZ5Hh6iQnarpRtQurM/aAvp3RIbfvgLHrcqJYzhXyV2KFruhuChf9NC6waAhiUR7FFtlugkI4p7f2Fqlow==", + "dev": true, + "dependencies": { + "clone-regexp": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fault": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", + "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", + "dev": true, + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "dependencies": { + "flat-cache": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "dependencies": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-accessor-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz", + "integrity": "sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-alphabetical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", + "dev": true, + "dependencies": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-arguments": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz", + "integrity": "sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-descriptor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.3.tgz", + "integrity": "sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^1.0.1", + "is-data-descriptor": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-file/-/is-file-1.0.0.tgz", + "integrity": "sha512-ZGMuc+xA8mRnrXtmtf2l/EkIW2zaD2LSBWlaOVEF6yH4RTndHob65V4SwWWdtGKVthQfXPVKsXqw4TDUjbVxVQ==", + "dev": true + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-hexadecimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regexp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", + "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==", + "dev": true + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-whitespace-character": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", + "integrity": "sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-word-character": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.4.tgz", + "integrity": "sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "node_modules/json-stable-stringify": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz", + "integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "dev": true + }, + "node_modules/lodash.differencewith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.differencewith/-/lodash.differencewith-4.5.0.tgz", + "integrity": "sha512-/8JFjydAS+4bQuo3CpLMBv7WxGFyk7/etOAsrQUCu0a9QVDemxv0YQ0rFyeZvqlUD314SERfNlgnlqqHmaQ0Cg==", + "dev": true + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", + "dev": true + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, + "node_modules/lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha512-mmPrW0Fh2fxOzdBbFv4g1m6pR72haFLPJ2G5SJEELf1y+iaQrDG6cWCPjy54RHYbZAt7X+ls690Kw62AdWXBzQ==", + "dev": true, + "dependencies": { + "chalk": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-like": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-like/-/map-like-2.0.0.tgz", + "integrity": "sha512-CbgcN622YzXC+k9oUroBSPFVX4in/w66mab/zpvSfFeUezSGD8C13c2RetyM1eo1jkp3sKrzvmf2HFEp5QOdZA==", + "dev": true + }, + "node_modules/markdown-escapes": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz", + "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/markdown-it": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.0.2.tgz", + "integrity": "sha512-4Lkvjbv2kK+moL9TbeV+6/NHx+1Q+R/NIdUlFlkqkkzUcTod4uiyTJRiBidKR9qXSdkNFkgv+AELY8KN9vSgVA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "~2.0.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/markdownlint": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.22.0.tgz", + "integrity": "sha512-J4B+iMc12pOdp/wfYi03W2qfAfEyiZzq3qvQh/8vOMNU8vXYY6Jg440EY7dWTBCqROhb1i4nAn3BTByJ5kdx1w==", + "dev": true, + "dependencies": { + "markdown-it": "12.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/markdownlint-cli": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.26.0.tgz", + "integrity": "sha512-biLfeGNZG9nw0yJbtFBzRlew2/P5w7JSseKwolSox3zejs7dLpGvPgqbC+iqJnqqGWcWLtXaXh8bBEKWmfl10A==", + "dev": true, + "dependencies": { + "commander": "~6.2.1", + "deep-extend": "~0.6.0", + "get-stdin": "~8.0.0", + "glob": "~7.1.6", + "ignore": "~5.1.8", + "js-yaml": "~3.14.1", + "jsonc-parser": "~3.0.0", + "lodash.differencewith": "~4.5.0", + "lodash.flatten": "~4.4.0", + "markdownlint": "~0.22.0", + "markdownlint-rule-helpers": "~0.13.0", + "minimatch": "~3.0.4", + "minimist": "~1.2.5", + "rc": "~1.2.8" + }, + "bin": { + "markdownlint": "markdownlint.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/markdownlint-rule-helpers": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.13.0.tgz", + "integrity": "sha512-rRY0itbcHG4e+ntz0bbY3AIceSJMKS0TafEMgEtKVHRZ54/JUSy6/4ypCL618RlJvYRej+xMLxX5nkJqIeTZaQ==", + "dev": true + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "node_modules/mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", + "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/parse-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "dev": true, + "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" + } + }, + "node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "dev": true, + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-glob-pattern": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-to-glob-pattern/-/path-to-glob-pattern-1.0.2.tgz", + "integrity": "sha512-ryF65N5MBB9XOjE5mMOi+0bMrh1F0ORQmqDSSERvv5zD62Cfc5QC6rK1AR1xuDIG1I091CkNENblbteWy1bXgw==", + "dev": true + }, + "node_modules/path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pluralize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-2.0.0.tgz", + "integrity": "sha512-TqNZzQCD4S42De9IfnnBvILN7HAW7riLqsCyp8lgjXeysyPlX5HhqKAcJHHHb9XskE4/a+7VGC9zzx8Ls0jOAw==", + "dev": true + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc-config-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-3.0.0.tgz", + "integrity": "sha512-bwfUSB37TWkHfP+PPjb/x8BUjChFmmBK44JMfVnU7paisWqZl/o5k7ttCH+EQLnrbn2Aq8Fo1LAsyUiz+WF4CQ==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.1", + "require-from-string": "^2.0.2" + } + }, + "node_modules/read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", + "dev": true, + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "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" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "dependencies": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/remark-frontmatter": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.3.tgz", + "integrity": "sha512-fM5eZPBvu2pVNoq3ZPW22q+5Ativ1oLozq2qYt9I2oNyxiUd/tDl0iLLntEVAegpZIslPWg1brhcP1VsaSVUag==", + "dev": true, + "dependencies": { + "fault": "^1.0.1", + "xtend": "^4.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", + "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "dev": true, + "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" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha512-vuNYXC7gG7IeVNBC1xUllqCcZKRbJoSPOBhnTEcAIiKCsbuef6zO3F0Rve3isPMMoNoQRWjQwbAgAjHUHniyEA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg==", + "dev": true, + "dependencies": { + "ret": "~0.1.10" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha512-up04hB2hR92PgjpyU3y/eg91yIBILyjVY26NvvciY3EVVPjybkMszMpXQ9QAkcS3I5rtJBDLoTxxg+qvW8c7rw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.23", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz", + "integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==", + "dev": true + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/state-toggle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", + "integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "dev": true, + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/structured-source": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-3.0.2.tgz", + "integrity": "sha512-Ap7JHfKgmH40SUjumqyKTHYHNZ8GvGQskP34ks0ElHCDEig+bYGpmXVksxPSrgcY9rkJqhVMzfeg5GIpZelfpQ==", + "dev": true, + "dependencies": { + "boundary": "^1.0.1" + } + }, + "node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha512-RZuzIOtzFbprLCE0AXhkI0Xi42ZJLZhCC+qkwuMLf/Vjz3maWpA8gz1qMdbmNoI9cOROT2Am/DxeRyXenrL11g==", + "dev": true, + "dependencies": { + "ajv": "^4.7.0", + "ajv-keywords": "^1.0.0", + "chalk": "^1.1.1", + "lodash": "^4.0.0", + "slice-ansi": "0.0.4", + "string-width": "^2.0.0" + } + }, + "node_modules/table/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/textlint": { + "version": "11.9.1", + "resolved": "https://registry.npmjs.org/textlint/-/textlint-11.9.1.tgz", + "integrity": "sha512-7eC76od8ILhLl3O10h1rd0QxlVaQkR1nqTD7PrszrlGGe8mXS2VNaOXEiAm8PPUMQBdjB5n8/cpeZ+AbDJdNTw==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/fixer-formatter": "^3.3.5", + "@textlint/kernel": "^3.4.5", + "@textlint/linter-formatter": "^3.3.5", + "@textlint/module-interop": "^1.2.5", + "@textlint/textlint-plugin-markdown": "^5.3.5", + "@textlint/textlint-plugin-text": "^4.3.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "file-entry-cache": "^5.0.1", + "get-stdin": "^5.0.1", + "glob": "^7.1.7", + "is-file": "^1.0.0", + "log-symbols": "^1.0.2", + "map-like": "^2.0.0", + "md5": "^2.3.0", + "mkdirp": "^0.5.0", + "optionator": "^0.9.1", + "path-to-glob-pattern": "^1.0.2", + "rc-config-loader": "^3.0.0", + "read-pkg": "^1.1.0", + "read-pkg-up": "^3.0.0", + "structured-source": "^3.0.2", + "try-resolve": "^1.0.1", + "unique-concat": "^0.2.2" + }, + "bin": { + "textlint": "bin/textlint.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/textlint-filter-rule-comments": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/textlint-filter-rule-comments/-/textlint-filter-rule-comments-1.3.0.tgz", + "integrity": "sha512-kSk/XcZYKYe4sb44XhYAYPeMFtqKJIMtcju/jwyZxpkn8gRuRMZ4+rB0wJmGRrD0c8tx3hHDAH1JY9ccahMKcA==", + "dev": true + }, + "node_modules/textlint-filter-rule-whitelist": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/textlint-filter-rule-whitelist/-/textlint-filter-rule-whitelist-2.0.0.tgz", + "integrity": "sha512-6FBQJZWq2UO1UoX1Z/t3e9vRmQbOF1Z9xRsOUnEzAsd+dGiMrbByE+vaj9SSkLaFzXREIqtg5Widd7ZPF5GOIg==", + "deprecated": "Use textlint-filter-rule-allowlist instead of it: https://github.com/textlint/textlint-filter-rule-allowlist/pull/9", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.0.2", + "@textlint/get-config-base-dir": "^2.0.0", + "@textlint/regexp-string-matcher": "^1.0.2", + "rc-config-loader": "^2.0.1" + }, + "peerDependencies": { + "textlint": ">= 9.0.0" + } + }, + "node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-2.0.5.tgz", + "integrity": "sha512-T464K2MQlnNWOblUDIglpFhyN+zYJq7jSlL++/N0hUkcmIXeNFumwXFVdtf8qhUGohn4RYQ0wdi74R575I44PQ==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.0", + "object-assign": "^4.1.0", + "object-keys": "^1.0.12", + "path-exists": "^3.0.0", + "require-from-string": "^2.0.2" + } + }, + "node_modules/textlint-rule-helper": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/textlint-rule-helper/-/textlint-rule-helper-2.5.0.tgz", + "integrity": "sha512-QIbFPtyqLy0g5BJn8mryk9iHzGYicNaFIpLFPiEnb4RXxrEGeQ2W2aARQ9yEXLIAqo+OwK4ndWBAWkbgJEPzTQ==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^15.2.1", + "structured-source": "^4.0.0", + "unist-util-visit": "^2.0.3" + } + }, + "node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types": { + "version": "15.5.2", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-15.5.2.tgz", + "integrity": "sha512-fCaOxoup5LIyBEo7R1oYWE7V4bSX0KQeHh66twon9e9usaLE3ijgF8QjYsR6joCssdeCHVd0wHm7ppsEyTr6vg==", + "dev": true + }, + "node_modules/textlint-rule-helper/node_modules/boundary": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", + "integrity": "sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==", + "dev": true + }, + "node_modules/textlint-rule-helper/node_modules/structured-source": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-4.0.0.tgz", + "integrity": "sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==", + "dev": true, + "dependencies": { + "boundary": "^2.0.0" + } + }, + "node_modules/textlint-rule-terminology": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/textlint-rule-terminology/-/textlint-rule-terminology-2.1.6.tgz", + "integrity": "sha512-3OdV/0DE8RpIYcshz+5wFaDwNYIlqfsBA8TODgNd68T339rn+K69ak5hoXUBSSuTousbAbCFDPqTILG20os44A==", + "dev": true, + "dependencies": { + "lodash": "^4.17.15", + "strip-json-comments": "^3.0.1", + "textlint-rule-helper": "^2.1.1" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/textlint-rule-terminology/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/textlint/node_modules/get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "dependencies": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/traverse": { + "version": "0.6.11", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.11.tgz", + "integrity": "sha512-vxXDZg8/+p3gblxB6BhhG5yWVn1kGRlaL8O78UDXc3wRnPizB5g83dcvWV1jpDMIPnjZjOFuxlMmE82XJ4407w==", + "dev": true, + "dependencies": { + "gopd": "^1.2.0", + "typedarray.prototype.slice": "^1.0.5", + "which-typed-array": "^1.1.18" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==", + "deprecated": "Use String.prototype.trim() instead", + "dev": true + }, + "node_modules/trim-trailing-lines": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.4.tgz", + "integrity": "sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/try-resolve": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", + "integrity": "sha512-yHeaPjCBzVaXwWl5IMUapTaTC2rn/eBYg2fsG2L+CvJd+ttFbk0ylDnpTO3wVhosmE1tQEvcebbBeKLCwScQSQ==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "dev": true + }, + "node_modules/typedarray.prototype.slice": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typedarray.prototype.slice/-/typedarray.prototype.slice-1.0.5.tgz", + "integrity": "sha512-q7QNVDGTdl702bVFiI5eY4l/HkgCM6at9KhcFbgUAzezHFbOVy4+0O/lCjsABEQwbZPravVfBIiBVGo89yzHFg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "math-intrinsics": "^1.1.0", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-offset": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unherit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", + "integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==", + "dev": true, + "dependencies": { + "inherits": "^2.0.0", + "xtend": "^4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", + "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "dev": true, + "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" + } + }, + "node_modules/unique-concat": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/unique-concat/-/unique-concat-0.2.2.tgz", + "integrity": "sha512-nFT3frbsvTa9rrc71FJApPqXF8oIhVHbX3IWgObQi1mF7WrW48Ys70daL7o4evZUtmUf6Qn6WK0LbHhyO0hpXw==", + "dev": true + }, + "node_modules/unist-util-is": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz", + "integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove-position": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz", + "integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==", + "dev": true, + "dependencies": { + "unist-util-visit": "^1.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove-position/node_modules/unist-util-is": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", + "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "dev": true + }, + "node_modules/unist-util-remove-position/node_modules/unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "dependencies": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "dev": true, + "dependencies": { + "unist-util-is": "^3.0.0" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", + "dev": true + }, + "node_modules/unist-util-visit": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vfile": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", + "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + }, + "node_modules/vfile-location": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz", + "integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", + "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "dev": true, + "dependencies": { + "unist-util-stringify-position": "^1.1.1" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", + "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "dependencies": { + "mkdirp": "^0.5.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==", + "dev": true + }, + "node_modules/xml-escape": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz", + "integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==", + "dev": true + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + } + } +} diff --git a/node_modules/@azu/format-text/README.md b/node_modules/@azu/format-text/README.md new file mode 100644 index 000000000..85727e34d --- /dev/null +++ b/node_modules/@azu/format-text/README.md @@ -0,0 +1,23 @@ +## @azu/format-text + +String formatting library inspired from Python + +Fork of [azer/format-text](https://github.com/azer/format-text "azer/format-text: String formatting library inspired from Python") + +### Install + +```bash +$ npm install @azu/format-text +``` + +### Usage + +```js +format = require('@azu/format-text') + +format('Hello {0}. The weather is currently {1}°.', 'Kitty', '67') +// => Hello Kitty. The weather is currently 67°. + +format('Hello {name}, The weather is currently {degree}°', { name:'Kitty', degree: 67 }) +// => Hello Kitty. The weather is currently 67°. +``` \ No newline at end of file diff --git a/node_modules/@azu/format-text/index.js b/node_modules/@azu/format-text/index.js new file mode 100644 index 000000000..2116910da --- /dev/null +++ b/node_modules/@azu/format-text/index.js @@ -0,0 +1,31 @@ +module.exports = format; + +function format(text) { + var context; + + if (typeof arguments[1] == 'object' && arguments[1]) { + context = arguments[1]; + } else { + context = Array.prototype.slice.call(arguments, 1); + } + + return String(text).replace(/\{?\{([^{}]+)}}?/g, replace(context)); +}; + +function replace (context, nil){ + return function (tag, name) { + if (tag.substring(0, 2) == '{{' && tag.substring(tag.length - 2) == '}}') { + return '{' + name + '}'; + } + + if (!context.hasOwnProperty(name)) { + return tag; + } + + if (typeof context[name] == 'function') { + return context[name](); + } + + return context[name]; + } +} diff --git a/node_modules/@azu/format-text/package.json b/node_modules/@azu/format-text/package.json new file mode 100644 index 000000000..f20a4c77b --- /dev/null +++ b/node_modules/@azu/format-text/package.json @@ -0,0 +1,21 @@ +{ + "name": "@azu/format-text", + "version": "1.0.2", + "description": "String formatting library inspired from Python", + "main": "index.js", + "scripts": { + "test": "mocha test.js" + }, + "files": [ + "index.js" + ], + "devDependencies": { + "mocha": "^10.2.0" + }, + "repository": { + "url": "git@github.com:azu/format-text.git", + "type": "git" + }, + "author": "azu", + "license": "BSD-3-Clause" +} diff --git a/node_modules/@azu/style-format/LICENSE b/node_modules/@azu/style-format/LICENSE new file mode 100644 index 000000000..8c450ad6a --- /dev/null +++ b/node_modules/@azu/style-format/LICENSE @@ -0,0 +1,13 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2016 azu + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/node_modules/@azu/style-format/README.md b/node_modules/@azu/style-format/README.md new file mode 100644 index 000000000..cbbaeb3b3 --- /dev/null +++ b/node_modules/@azu/style-format/README.md @@ -0,0 +1,30 @@ +## style-format + +Library to easily style texts with string formatting. +It's based on [ansi-codes](http://github.com/azer/ansi-codes) and [format-text](http://github.com/azu/format-text) + +## Install + +```bash +$ npm install @azu/style-format +``` + +## Usage + +```js +format('{blue} hello {green} world') +// => hello world + +format('{bold}{red} span {yellow} eggs {reset}') +// => span eggs +``` + +## Reference + +See [ansi-codes](http://github.com/azer/ansi-codes) for reference. + +## License + +MIT + +Original is [style-format](http://github.com/azer/style-format). diff --git a/node_modules/@azu/style-format/ansi-codes.js b/node_modules/@azu/style-format/ansi-codes.js new file mode 100644 index 000000000..75a42c4f7 --- /dev/null +++ b/node_modules/@azu/style-format/ansi-codes.js @@ -0,0 +1,52 @@ +// LICENSE : MIT +module.exports = { + reset : "\033[0m", + bold : "\033[1m", + italic : "\033[3m", + blink : "\033[5m", + underline : "\033[4m", + underlineOff : "\033[24m", + inverse : "\033[7m", + inverseOff : "\033[27m", + strikethrough : "\033[9m", + strikethroughOff : "\033[29m", + + def : "\033[39m", + white : "\033[37m", + black : "\033[30m", + grey : "\x1B[90m", + red : "\033[31m", + green : "\033[32m", + blue : "\033[34m", + yellow : "\033[33m", + magenta : "\033[35m", + cyan : "\033[36m", + + defBg : "\033[49m", + whiteBg : "\033[47m", + blackBg : "\033[40m", + redBg : "\033[41m", + greenBg : "\033[42m", + blueBg : "\033[44m", + yellowBg : "\033[43m", + magentaBg : "\033[45m", + cyanBg : "\033[46m", + + brightBlack : "\033[90m", + brightRed : "\033[91m", + brightGreen : "\033[92m", + brightYellow : "\033[93m", + brightBlue : "\033[94m", + brightMagenta : "\033[95m", + brightCyan : "\033[96m", + brightWhite : "\033[97m", + + brightBlackBg : "\033[100m", + brightRedBg : "\033[101m", + brightGreenBg : "\033[102m", + brightYellowBg : "\033[103m", + brightBlueBg : "\033[104m", + brightMagentaBg : "\033[105m", + brightCyanBg : "\033[106m", + brightWhiteBg : "\033[107m" +} \ No newline at end of file diff --git a/node_modules/@azu/style-format/index.js b/node_modules/@azu/style-format/index.js new file mode 100644 index 000000000..9dc017c32 --- /dev/null +++ b/node_modules/@azu/style-format/index.js @@ -0,0 +1,8 @@ +var format = require("@azu/format-text"); +var ansi = require("./ansi-codes"); + +module.exports = styleFormat; + +function styleFormat (text) { + return format(text, ansi); +} diff --git a/node_modules/@azu/style-format/package.json b/node_modules/@azu/style-format/package.json new file mode 100644 index 000000000..4f25d596a --- /dev/null +++ b/node_modules/@azu/style-format/package.json @@ -0,0 +1,27 @@ +{ + "name": "@azu/style-format", + "version": "1.0.1", + "description": "Library to easily style texts with string formatting", + "main": "index.js", + "dependencies": { + "@azu/format-text": "^1.0.1" + }, + "keywords": [ + "style", + "text", + "format" + ], + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js", + "ansi-codes.js" + ], + "repository": { + "url": "git@github.com:azu/style-format.git", + "type": "git" + }, + "author": "azu", + "license": "WTFPL" +} diff --git a/node_modules/@textlint/ast-node-types/CHANGELOG.md b/node_modules/@textlint/ast-node-types/CHANGELOG.md new file mode 100644 index 000000000..dfffdaad0 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/CHANGELOG.md @@ -0,0 +1,386 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [4.4.3](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.4.2...@textlint/ast-node-types@4.4.3) (2021-05-08) + +**Note:** Version bump only for package @textlint/ast-node-types + + + + + + +## [4.4.2](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.4.1...@textlint/ast-node-types@4.4.2) (2021-03-19) + + +### Chores + +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [4.4.1](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.4...@textlint/ast-node-types@4.4.1) (2021-01-22) + + +### Bug Fixes + +* **ast-node-types:** deprecated "ReferenceDef" type ([#701](https://github.com/textlint/textlint/issues/701)) ([a088520](https://github.com/textlint/textlint/commit/a088520)) + + +### Chores + +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [4.4.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.4...@textlint/ast-node-types@4.4.0) (2021-01-22) + + +### Bug Fixes + +* **ast-node-types:** deprecated "ReferenceDef" type ([#701](https://github.com/textlint/textlint/issues/701)) ([a088520](https://github.com/textlint/textlint/commit/a088520)) + + +### Chores + +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [4.3.5](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.4...@textlint/ast-node-types@4.3.5) (2020-12-22) + + +### Bug Fixes + +* **ast-node-types:** deprecated "ReferenceDef" type ([#701](https://github.com/textlint/textlint/issues/701)) ([a088520](https://github.com/textlint/textlint/commit/a088520)) + + +### Chores + +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [4.3.4](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.3...@textlint/ast-node-types@4.3.4) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [4.3.3](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.2...@textlint/ast-node-types@4.3.3) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [4.3.2](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.1...@textlint/ast-node-types@4.3.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [4.3.1](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.3.0...@textlint/ast-node-types@4.3.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [4.3.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.2.5...@textlint/ast-node-types@4.3.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [4.2.5](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.2.4...@textlint/ast-node-types@4.2.5) (2019-10-14) + + +### Tests + +* **ast-node-types:** fix type error ([9a678c5](https://github.com/textlint/textlint/commit/9a678c5)) + + + + + + +## [4.2.4](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.2.2...@textlint/ast-node-types@4.2.4) (2019-07-20) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [4.2.3](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.2.2...@textlint/ast-node-types@4.2.3) (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [4.2.2](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.2.1...@textlint/ast-node-types@4.2.2) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + +### Styles + +* apply prettier ([925a5a5](https://github.com/textlint/textlint/commit/925a5a5)) + + + + + + +## [4.2.1](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.2.0...@textlint/ast-node-types@4.2.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/ast-node-types + + + + + + +# [4.2.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.1.0...@textlint/ast-node-types@4.2.0) (2019-01-03) + + +### Documentation + +* **rule:** add Type name and Node Type mapping table ([5ace9d1](https://github.com/textlint/textlint/commit/5ace9d1)) + + +### Features + +* **ast-node-types:** add `*Exit` type as constant value ([7106f5d](https://github.com/textlint/textlint/commit/7106f5d)) +* **ast-node-types:** add `TypeofTxtNode` type function ([69bc1ea](https://github.com/textlint/textlint/commit/69bc1ea)) + + +### Tests + +* **ast-note-types:** fix tests ([e708b7c](https://github.com/textlint/textlint/commit/e708b7c)) + + + + + + +# [4.1.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.0.3...@textlint/ast-node-types@4.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Code Refactoring + +* **types:** move type definition for rule to [@textlint](https://github.com/textlint)/types ([9be6e16](https://github.com/textlint/textlint/commit/9be6e16)) + + + + + +## [4.0.3](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.0.2...@textlint/ast-node-types@4.0.3) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + +### Code Refactoring + +* **kernel:** separate linter and fixer descriptor ([b5bc8bd](https://github.com/textlint/textlint/commit/b5bc8bd)) + + + + + +## [4.0.2](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.0.1...@textlint/ast-node-types@4.0.2) (2018-03-25) + + +### Chores + +* **test:** use `ts-node-test-register` for TypeScript testing ([be746d8](https://github.com/textlint/textlint/commit/be746d8)), closes [#451](https://github.com/textlint/textlint/issues/451) + + + + + +## [4.0.1](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@4.0.0...@textlint/ast-node-types@4.0.1) (2018-01-18) + + + + +**Note:** Version bump only for package @textlint/ast-node-types + + +# [4.0.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@3.0.1...@textlint/ast-node-types@4.0.0) (2017-12-31) + + +### Chores + +* **ast-node-types:** Make ASTNodeTypes enum ([8ae3e67](https://github.com/textlint/textlint/commit/8ae3e67)) + + +### BREAKING CHANGES + +* **ast-node-types:** TypeScript need to user it as enum + + + + + +## [3.0.1](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@3.0.0...@textlint/ast-node-types@3.0.1) (2017-12-25) + + +### Bug Fixes + +* **monorepo:** fix TypeScript module resolution in monorepo ([d5df499](https://github.com/textlint/textlint/commit/d5df499)) + + + + + +# [3.0.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@3.0.0-next.0...@textlint/ast-node-types@3.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package @textlint/ast-node-types + + +# [3.0.0-next.0](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@2.0.0...@textlint/ast-node-types@3.0.0-next.0) (2017-12-15) + + +### Bug Fixes + +* **ast-node-types:** Make TxtNode non-weak type ([#382](https://github.com/textlint/textlint/issues/382)) ([81c0145](https://github.com/textlint/textlint/commit/81c0145)) + + + + + +## [1.1.2](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@1.1.1...@textlint/ast-node-types@1.1.2) (2017-05-05) + + +### Bug Fixes + +* **docs:** README ([dd98f5c](https://github.com/textlint/textlint/commit/dd98f5c)) + + + + + +## [1.1.1](https://github.com/textlint/textlint/compare/@textlint/ast-node-types@1.1.0...@textlint/ast-node-types@1.1.1) (2017-05-05) + + + + + +# 1.1.0 (2017-05-05) + + +### Features + +* **ast-node-types:** add ast-node-types ([2ba6583](https://github.com/textlint/textlint/commit/2ba6583)) +* **packages:** add [@textlint](https://github.com/textlint)/ast-node-types package ([66fb289](https://github.com/textlint/textlint/commit/66fb289)) diff --git a/node_modules/@textlint/ast-node-types/LICENSE b/node_modules/@textlint/ast-node-types/LICENSE new file mode 100644 index 000000000..fca71ec20 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-present azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/ast-node-types/README.md b/node_modules/@textlint/ast-node-types/README.md new file mode 100644 index 000000000..a0e4d8a8f --- /dev/null +++ b/node_modules/@textlint/ast-node-types/README.md @@ -0,0 +1,65 @@ +# @textlint/ast-node-types + +The definition for textlint AST Node types. + +This module for parse plugin. + + +For more details, see [TxtNode document](https://github.com/textlint/textlint/blob/master/docs/txtnode.md). + +## Installation + + npm install @textlint/ast-node-types + +## Usage + +```js +import { ASTNodeTypes } from "@textlint/ast-node-types"; +console.log(ASTNodeTypes.Document); // => string +``` + +### Type interface for TxtNode + +This library include type interface of [TxtNode](https://github.com/textlint/textlint/blob/master/docs/txtnode.md). +TypeScript user can use it as type of TxtNode. + +```ts +// type interface +import { TxtNode } from "@textlint/ast-node-types"; + +``` + + +## For parser creator + +Please use it for creating your textlint-plugin parser. + +Use it by + +- textlint internal +- `@textlint/text-to-ast` +- `@textlint/markdown-to-ast` + +## Versioning + +- major: Breaking Change +- minor: Adding new type +- patch: Fixing issues + +## Tests + + npm test + +## Contributing + +If you want to new type for AST, Please file issue :) + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.d.ts b/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.d.ts new file mode 100644 index 000000000..93aebc731 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.d.ts @@ -0,0 +1,9 @@ +import { ASTNodeTypes, TxtNode, TxtParentNode, TxtTextNode } from "./index"; +/** + * Return TxtNode type of ASTNodeTypes | string + * + * @example + * ``` + * type NodeType = TxtNodeTypeOfNode; + */ +export declare type TypeofTxtNode = T extends ASTNodeTypes.Document ? TxtParentNode : T extends ASTNodeTypes.DocumentExit ? TxtParentNode : T extends ASTNodeTypes.Paragraph ? TxtParentNode : T extends ASTNodeTypes.ParagraphExit ? TxtParentNode : T extends ASTNodeTypes.BlockQuote ? TxtParentNode : T extends ASTNodeTypes.BlockQuoteExit ? TxtParentNode : T extends ASTNodeTypes.List ? TxtParentNode : T extends ASTNodeTypes.ListExit ? TxtParentNode : T extends ASTNodeTypes.ListItem ? TxtParentNode : T extends ASTNodeTypes.ListItemExit ? TxtParentNode : T extends ASTNodeTypes.Header ? TxtParentNode : T extends ASTNodeTypes.HeaderExit ? TxtParentNode : T extends ASTNodeTypes.CodeBlock ? TxtParentNode : T extends ASTNodeTypes.CodeBlockExit ? TxtParentNode : T extends ASTNodeTypes.HtmlBlock ? TxtParentNode : T extends ASTNodeTypes.HtmlBlockExit ? TxtParentNode : T extends ASTNodeTypes.Link ? TxtParentNode : T extends ASTNodeTypes.LinkExit ? TxtParentNode : T extends ASTNodeTypes.Delete ? TxtParentNode : T extends ASTNodeTypes.DeleteExit ? TxtParentNode : T extends ASTNodeTypes.Emphasis ? TxtParentNode : T extends ASTNodeTypes.EmphasisExit ? TxtParentNode : T extends ASTNodeTypes.Strong ? TxtParentNode : T extends ASTNodeTypes.StrongExit ? TxtParentNode : T extends ASTNodeTypes.Break ? TxtNode : T extends ASTNodeTypes.BreakExit ? TxtNode : T extends ASTNodeTypes.Image ? TxtNode : T extends ASTNodeTypes.ImageExit ? TxtNode : T extends ASTNodeTypes.HorizontalRule ? TxtNode : T extends ASTNodeTypes.HorizontalRuleExit ? TxtNode : T extends ASTNodeTypes.Comment ? TxtTextNode : T extends ASTNodeTypes.CommentExit ? TxtTextNode : T extends ASTNodeTypes.Str ? TxtTextNode : T extends ASTNodeTypes.StrExit ? TxtTextNode : T extends ASTNodeTypes.Code ? TxtTextNode : T extends ASTNodeTypes.CodeExit ? TxtTextNode : T extends ASTNodeTypes.Html ? TxtTextNode : T extends ASTNodeTypes.HtmlExit ? TxtTextNode : any; diff --git a/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.js b/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.js new file mode 100644 index 000000000..df77dd741 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=TypeofTxtNode.js.map \ No newline at end of file diff --git a/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.js.map b/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.js.map new file mode 100644 index 000000000..8c7eff295 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/module/TypeofTxtNode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TypeofTxtNode.js","sourceRoot":"","sources":["../src/TypeofTxtNode.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@textlint/ast-node-types/module/index.d.ts b/node_modules/@textlint/ast-node-types/module/index.d.ts new file mode 100644 index 000000000..0fb352a3e --- /dev/null +++ b/node_modules/@textlint/ast-node-types/module/index.d.ts @@ -0,0 +1,116 @@ +/** + * AST Node types list on TxtNode. + * Constant value of types + * @see https://github.com/textlint/textlint/blob/master/docs/txtnode.md + */ +import { TypeofTxtNode } from "./TypeofTxtNode"; +export declare enum ASTNodeTypes { + Document = "Document", + DocumentExit = "Document:exit", + Paragraph = "Paragraph", + ParagraphExit = "Paragraph:exit", + BlockQuote = "BlockQuote", + BlockQuoteExit = "BlockQuote:exit", + ListItem = "ListItem", + ListItemExit = "ListItem:exit", + List = "List", + ListExit = "List:exit", + Header = "Header", + HeaderExit = "Header:exit", + CodeBlock = "CodeBlock", + CodeBlockExit = "CodeBlock:exit", + HtmlBlock = "HtmlBlock", + HtmlBlockExit = "HtmlBlock:exit", + HorizontalRule = "HorizontalRule", + HorizontalRuleExit = "HorizontalRule:exit", + Comment = "Comment", + CommentExit = "Comment:exit", + /** + * @deprecated + */ + ReferenceDef = "ReferenceDef", + /** + * @deprecated + */ + ReferenceDefExit = "ReferenceDef:exit", + Str = "Str", + StrExit = "Str:exit", + Break = "Break", + BreakExit = "Break:exit", + Emphasis = "Emphasis", + EmphasisExit = "Emphasis:exit", + Strong = "Strong", + StrongExit = "Strong:exit", + Html = "Html", + HtmlExit = "Html:exit", + Link = "Link", + LinkExit = "Link:exit", + Image = "Image", + ImageExit = "Image:exit", + Code = "Code", + CodeExit = "Code:exit", + Delete = "Delete", + DeleteExit = "Delete:exit" +} +/** + * Key of ASTNodeTypes or any string + * For example, TxtNodeType is "Document". + */ +export declare type TxtNodeType = keyof typeof ASTNodeTypes | string; +/** + * Type utility for TxtNodeType + * Return TxtNode interface for the TxtNodeTYpe + */ +export { TypeofTxtNode }; +/** + * Any TxtNode types + */ +export declare type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode; +/** + * Basic TxtNode + * Probably, Real TxtNode implementation has more properties. + */ +export interface TxtNode { + type: TxtNodeType; + raw: string; + range: TextNodeRange; + loc: TxtNodeLineLocation; + parent?: TxtNode; + [index: string]: any; +} +/** + * Location + */ +export interface TxtNodeLineLocation { + start: TxtNodePosition; + end: TxtNodePosition; +} +/** + * Position's line start with 1. + * Position's column start with 0. + * This is for compatibility with JavaScript AST. + * https://gist.github.com/azu/8866b2cb9b7a933e01fe + */ +export interface TxtNodePosition { + line: number; + column: number; +} +/** + * Range start with 0 + */ +export declare type TextNodeRange = [number, number]; +/** + * Text Node. + * Text Node has inline value. + * For example, `Str` Node is an TxtTextNode. + */ +export interface TxtTextNode extends TxtNode { + value: string; +} +/** + * Parent Node. + * Parent Node has children that are consist of TxtNode or TxtTextNode + */ +export interface TxtParentNode extends TxtNode { + children: Array; +} diff --git a/node_modules/@textlint/ast-node-types/module/index.js b/node_modules/@textlint/ast-node-types/module/index.js new file mode 100644 index 000000000..8eeea0199 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/module/index.js @@ -0,0 +1,53 @@ +// MIT © 2017 azu +"use strict"; +export var ASTNodeTypes; +(function (ASTNodeTypes) { + ASTNodeTypes["Document"] = "Document"; + ASTNodeTypes["DocumentExit"] = "Document:exit"; + ASTNodeTypes["Paragraph"] = "Paragraph"; + ASTNodeTypes["ParagraphExit"] = "Paragraph:exit"; + ASTNodeTypes["BlockQuote"] = "BlockQuote"; + ASTNodeTypes["BlockQuoteExit"] = "BlockQuote:exit"; + ASTNodeTypes["ListItem"] = "ListItem"; + ASTNodeTypes["ListItemExit"] = "ListItem:exit"; + ASTNodeTypes["List"] = "List"; + ASTNodeTypes["ListExit"] = "List:exit"; + ASTNodeTypes["Header"] = "Header"; + ASTNodeTypes["HeaderExit"] = "Header:exit"; + ASTNodeTypes["CodeBlock"] = "CodeBlock"; + ASTNodeTypes["CodeBlockExit"] = "CodeBlock:exit"; + ASTNodeTypes["HtmlBlock"] = "HtmlBlock"; + ASTNodeTypes["HtmlBlockExit"] = "HtmlBlock:exit"; + ASTNodeTypes["HorizontalRule"] = "HorizontalRule"; + ASTNodeTypes["HorizontalRuleExit"] = "HorizontalRule:exit"; + ASTNodeTypes["Comment"] = "Comment"; + ASTNodeTypes["CommentExit"] = "Comment:exit"; + /** + * @deprecated + */ + ASTNodeTypes["ReferenceDef"] = "ReferenceDef"; + /** + * @deprecated + */ + ASTNodeTypes["ReferenceDefExit"] = "ReferenceDef:exit"; + // inline + ASTNodeTypes["Str"] = "Str"; + ASTNodeTypes["StrExit"] = "Str:exit"; + ASTNodeTypes["Break"] = "Break"; + ASTNodeTypes["BreakExit"] = "Break:exit"; + ASTNodeTypes["Emphasis"] = "Emphasis"; + ASTNodeTypes["EmphasisExit"] = "Emphasis:exit"; + ASTNodeTypes["Strong"] = "Strong"; + ASTNodeTypes["StrongExit"] = "Strong:exit"; + ASTNodeTypes["Html"] = "Html"; + ASTNodeTypes["HtmlExit"] = "Html:exit"; + ASTNodeTypes["Link"] = "Link"; + ASTNodeTypes["LinkExit"] = "Link:exit"; + ASTNodeTypes["Image"] = "Image"; + ASTNodeTypes["ImageExit"] = "Image:exit"; + ASTNodeTypes["Code"] = "Code"; + ASTNodeTypes["CodeExit"] = "Code:exit"; + ASTNodeTypes["Delete"] = "Delete"; + ASTNodeTypes["DeleteExit"] = "Delete:exit"; +})(ASTNodeTypes || (ASTNodeTypes = {})); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/ast-node-types/module/index.js.map b/node_modules/@textlint/ast-node-types/module/index.js.map new file mode 100644 index 000000000..400f4346c --- /dev/null +++ b/node_modules/@textlint/ast-node-types/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,YAAY,CAAC;AASb,MAAM,CAAN,IAAY,YAgDX;AAhDD,WAAY,YAAY;IACpB,qCAAqB,CAAA;IACrB,8CAA8B,CAAA;IAC9B,uCAAuB,CAAA;IACvB,gDAAgC,CAAA;IAChC,yCAAyB,CAAA;IACzB,kDAAkC,CAAA;IAClC,qCAAqB,CAAA;IACrB,8CAA8B,CAAA;IAC9B,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,iCAAiB,CAAA;IACjB,0CAA0B,CAAA;IAC1B,uCAAuB,CAAA;IACvB,gDAAgC,CAAA;IAChC,uCAAuB,CAAA;IACvB,gDAAgC,CAAA;IAChC,iDAAiC,CAAA;IACjC,0DAA0C,CAAA;IAC1C,mCAAmB,CAAA;IACnB,4CAA4B,CAAA;IAC5B;;OAEG;IACH,6CAA6B,CAAA;IAC7B;;OAEG;IACH,sDAAsC,CAAA;IACtC,SAAS;IACT,2BAAW,CAAA;IACX,oCAAoB,CAAA;IACpB,+BAAe,CAAA;IACf,wCAAwB,CAAA;IACxB,qCAAqB,CAAA;IACrB,8CAA8B,CAAA;IAC9B,iCAAiB,CAAA;IACjB,0CAA0B,CAAA;IAC1B,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,+BAAe,CAAA;IACf,wCAAwB,CAAA;IACxB,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,iCAAiB,CAAA;IACjB,0CAA0B,CAAA;AAC9B,CAAC,EAhDW,YAAY,KAAZ,YAAY,QAgDvB"} \ No newline at end of file diff --git a/node_modules/@textlint/ast-node-types/package.json b/node_modules/@textlint/ast-node-types/package.json new file mode 100644 index 000000000..10074a80e --- /dev/null +++ b/node_modules/@textlint/ast-node-types/package.json @@ -0,0 +1,38 @@ +{ + "name": "@textlint/ast-node-types", + "version": "4.4.3", + "description": "textlint AST node type definition.", + "keywords": [ + "textlint" + ], + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "./lib/index.js", + "module": "./module/index.js", + "types": "./lib/index.d.ts", + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run build", + "test": "mocha \"test/**/*.{js,ts}\"" + }, + "devDependencies": { + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "~4.0.2" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/ast-node-types/src/TypeofTxtNode.ts b/node_modules/@textlint/ast-node-types/src/TypeofTxtNode.ts new file mode 100644 index 000000000..d819563a9 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/src/TypeofTxtNode.ts @@ -0,0 +1,91 @@ +import { ASTNodeTypes, TxtNode, TxtParentNode, TxtTextNode } from "./index"; +/** + * Return TxtNode type of ASTNodeTypes | string + * + * @example + * ``` + * type NodeType = TxtNodeTypeOfNode; + */ +export type TypeofTxtNode = + // Root + T extends ASTNodeTypes.Document + ? TxtParentNode + : T extends ASTNodeTypes.DocumentExit + ? TxtParentNode // Paragraph Str. + : T extends ASTNodeTypes.Paragraph + ? TxtParentNode + : T extends ASTNodeTypes.ParagraphExit + ? TxtParentNode // > Str + : T extends ASTNodeTypes.BlockQuote + ? TxtParentNode + : T extends ASTNodeTypes.BlockQuoteExit + ? TxtParentNode // - item + : T extends ASTNodeTypes.List + ? TxtParentNode + : T extends ASTNodeTypes.ListExit + ? TxtParentNode // - item + : T extends ASTNodeTypes.ListItem + ? TxtParentNode + : T extends ASTNodeTypes.ListItemExit + ? TxtParentNode // # Str + : T extends ASTNodeTypes.Header + ? TxtParentNode + : T extends ASTNodeTypes.HeaderExit + ? TxtParentNode + : /* ``` + * code + * ``` + */ + T extends ASTNodeTypes.CodeBlock + ? TxtParentNode + : T extends ASTNodeTypes.CodeBlockExit + ? TxtParentNode //
\n
+ : T extends ASTNodeTypes.HtmlBlock + ? TxtParentNode + : T extends ASTNodeTypes.HtmlBlockExit + ? TxtParentNode // [link](https://example.com) + : T extends ASTNodeTypes.Link + ? TxtParentNode + : T extends ASTNodeTypes.LinkExit + ? TxtParentNode // ~~Str~~ + : T extends ASTNodeTypes.Delete + ? TxtParentNode + : T extends ASTNodeTypes.DeleteExit + ? TxtParentNode // *Str* + : T extends ASTNodeTypes.Emphasis + ? TxtParentNode + : T extends ASTNodeTypes.EmphasisExit + ? TxtParentNode // __Str__ + : T extends ASTNodeTypes.Strong + ? TxtParentNode + : T extends ASTNodeTypes.StrongExit + ? TxtParentNode // Str + : T extends ASTNodeTypes.Break + ? TxtNode + : T extends ASTNodeTypes.BreakExit + ? TxtNode // ![alt](https://example.com/img) + : T extends ASTNodeTypes.Image + ? TxtNode + : T extends ASTNodeTypes.ImageExit + ? TxtNode // ---- + : T extends ASTNodeTypes.HorizontalRule + ? TxtNode + : T extends ASTNodeTypes.HorizontalRuleExit + ? TxtNode // + : T extends ASTNodeTypes.Comment + ? TxtTextNode + : T extends ASTNodeTypes.CommentExit + ? TxtTextNode // Str + : T extends ASTNodeTypes.Str + ? TxtTextNode + : T extends ASTNodeTypes.StrExit + ? TxtTextNode // `code` + : T extends ASTNodeTypes.Code + ? TxtTextNode + : T extends ASTNodeTypes.CodeExit + ? TxtTextNode // Str + : T extends ASTNodeTypes.Html + ? TxtTextNode + : T extends ASTNodeTypes.HtmlExit + ? TxtTextNode + : any; diff --git a/node_modules/@textlint/ast-node-types/src/index.ts b/node_modules/@textlint/ast-node-types/src/index.ts new file mode 100644 index 000000000..5c6a0fe61 --- /dev/null +++ b/node_modules/@textlint/ast-node-types/src/index.ts @@ -0,0 +1,134 @@ +// MIT © 2017 azu +"use strict"; + +/** + * AST Node types list on TxtNode. + * Constant value of types + * @see https://github.com/textlint/textlint/blob/master/docs/txtnode.md + */ +import { TypeofTxtNode } from "./TypeofTxtNode"; + +export enum ASTNodeTypes { + Document = "Document", + DocumentExit = "Document:exit", + Paragraph = "Paragraph", + ParagraphExit = "Paragraph:exit", + BlockQuote = "BlockQuote", + BlockQuoteExit = "BlockQuote:exit", + ListItem = "ListItem", + ListItemExit = "ListItem:exit", + List = "List", + ListExit = "List:exit", + Header = "Header", + HeaderExit = "Header:exit", + CodeBlock = "CodeBlock", + CodeBlockExit = "CodeBlock:exit", + HtmlBlock = "HtmlBlock", + HtmlBlockExit = "HtmlBlock:exit", + HorizontalRule = "HorizontalRule", + HorizontalRuleExit = "HorizontalRule:exit", + Comment = "Comment", + CommentExit = "Comment:exit", + /** + * @deprecated + */ + ReferenceDef = "ReferenceDef", + /** + * @deprecated + */ + ReferenceDefExit = "ReferenceDef:exit", + // inline + Str = "Str", + StrExit = "Str:exit", + Break = "Break", // well-known Hard Break + BreakExit = "Break:exit", // well-known Hard Break + Emphasis = "Emphasis", + EmphasisExit = "Emphasis:exit", + Strong = "Strong", + StrongExit = "Strong:exit", + Html = "Html", + HtmlExit = "Html:exit", + Link = "Link", + LinkExit = "Link:exit", + Image = "Image", + ImageExit = "Image:exit", + Code = "Code", + CodeExit = "Code:exit", + Delete = "Delete", + DeleteExit = "Delete:exit" +} + +/** + * Key of ASTNodeTypes or any string + * For example, TxtNodeType is "Document". + */ +export type TxtNodeType = keyof typeof ASTNodeTypes | string; + +/** + * Type utility for TxtNodeType + * Return TxtNode interface for the TxtNodeTYpe + */ +export { TypeofTxtNode }; + +/** + * Any TxtNode types + */ +export type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode; + +/** + * Basic TxtNode + * Probably, Real TxtNode implementation has more properties. + */ +export interface TxtNode { + type: TxtNodeType; + raw: string; + range: TextNodeRange; + loc: TxtNodeLineLocation; + // parent is runtime information + // Not need in AST + // For example, top Root Node like `Document` has not parent. + parent?: TxtNode; + + [index: string]: any; +} + +/** + * Location + */ +export interface TxtNodeLineLocation { + start: TxtNodePosition; + end: TxtNodePosition; +} + +/** + * Position's line start with 1. + * Position's column start with 0. + * This is for compatibility with JavaScript AST. + * https://gist.github.com/azu/8866b2cb9b7a933e01fe + */ +export interface TxtNodePosition { + line: number; // start with 1 + column: number; // start with 0 +} + +/** + * Range start with 0 + */ +export type TextNodeRange = [number, number]; + +/** + * Text Node. + * Text Node has inline value. + * For example, `Str` Node is an TxtTextNode. + */ +export interface TxtTextNode extends TxtNode { + value: string; +} + +/** + * Parent Node. + * Parent Node has children that are consist of TxtNode or TxtTextNode + */ +export interface TxtParentNode extends TxtNode { + children: Array; +} diff --git a/node_modules/@textlint/ast-tester/CHANGELOG.md b/node_modules/@textlint/ast-tester/CHANGELOG.md new file mode 100644 index 000000000..3a3701e09 --- /dev/null +++ b/node_modules/@textlint/ast-tester/CHANGELOG.md @@ -0,0 +1,424 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [2.3.5](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.3.4...@textlint/ast-tester@2.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/ast-tester + + + + + +## [2.3.4](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.3.3...@textlint/ast-tester@2.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/ast-tester + + + + + + +## [2.3.3](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.3.2...@textlint/ast-tester@2.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [2.3.2](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.3.1...@textlint/ast-tester@2.3.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [2.3.1](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.4...@textlint/ast-tester@2.3.1) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [2.3.0](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.4...@textlint/ast-tester@2.3.0) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [2.2.5](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.4...@textlint/ast-tester@2.2.5) (2020-12-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [2.2.4](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.3...@textlint/ast-tester@2.2.4) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [2.2.3](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.2...@textlint/ast-tester@2.2.3) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [2.2.2](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.1...@textlint/ast-tester@2.2.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [2.2.1](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.2.0...@textlint/ast-tester@2.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [2.2.0](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.6...@textlint/ast-tester@2.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [2.1.6](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.5...@textlint/ast-tester@2.1.6) (2019-10-14) + +**Note:** Version bump only for package @textlint/ast-tester + + + + + + +## [2.1.5](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.3...@textlint/ast-tester@2.1.5) (2019-07-20) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [2.1.4](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.3...@textlint/ast-tester@2.1.4) (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [2.1.3](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.2...@textlint/ast-tester@2.1.3) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [2.1.2](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.1...@textlint/ast-tester@2.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/ast-tester + + + + + + +## [2.1.1](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.1.0...@textlint/ast-tester@2.1.1) (2019-01-03) + + +### Chores + +* **ast-tester:** remove "noEmit" option ([85642be](https://github.com/textlint/textlint/commit/85642be)) +* **ast-tester:** rename index file to index.ts ([5149101](https://github.com/textlint/textlint/commit/5149101)) + + +### Code Refactoring + +* **ast-tester:** Convert to TypeScript ([2bb1247](https://github.com/textlint/textlint/commit/2bb1247)), closes [#567](https://github.com/textlint/textlint/issues/567) + + + + + + +# [2.1.0](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.0.8...@textlint/ast-tester@2.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + + + + +## [2.0.8](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.0.7...@textlint/ast-tester@2.0.8) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + + + + +## [2.0.7](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.0.6...@textlint/ast-tester@2.0.7) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/ast-tester + + +## [2.0.6](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.0.5...@textlint/ast-tester@2.0.6) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/ast-tester + + +## [2.0.5](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.0.4...@textlint/ast-tester@2.0.5) (2018-03-25) + + + + +**Note:** Version bump only for package @textlint/ast-tester + + +## [2.0.4](https://github.com/textlint/textlint/compare/@textlint/ast-tester@2.0.3...@textlint/ast-tester@2.0.4) (2018-01-27) + + + + +**Note:** Version bump only for package @textlint/ast-tester + + +## 2.0.3 (2018-01-18) + + +### Bug Fixes + +* **ast-tester:** add `publishConfig` ([e7a150b](https://github.com/textlint/textlint/commit/e7a150b)) + + + + + +## [2.0.2](https://github.com/textlint/textlint/compare/textlint-ast-test@2.0.1...textlint-ast-test@2.0.2) (2018-01-12) + + + + +**Note:** Version bump only for package textlint-ast-test + + +## [2.0.1](https://github.com/textlint/textlint/compare/textlint-ast-test@2.0.0...textlint-ast-test@2.0.1) (2017-12-25) + + + + +**Note:** Version bump only for package textlint-ast-test + + +# [2.0.0](https://github.com/textlint/textlint/compare/textlint-ast-test@2.0.0-next.0...textlint-ast-test@2.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-ast-test + + +# 2.0.0-next.0 (2017-12-15) + + +### Bug Fixes + +* **npm:** add files ([2d709e6](https://github.com/textlint/textlint/commit/2d709e6)) +* **npm:** fix repo info ([7bd1c0b](https://github.com/textlint/textlint/commit/7bd1c0b)) diff --git a/node_modules/@textlint/ast-tester/LICENSE b/node_modules/@textlint/ast-tester/LICENSE new file mode 100644 index 000000000..ffd6b4aa2 --- /dev/null +++ b/node_modules/@textlint/ast-tester/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/ast-tester/README.md b/node_modules/@textlint/ast-tester/README.md new file mode 100644 index 000000000..82b0f50e7 --- /dev/null +++ b/node_modules/@textlint/ast-tester/README.md @@ -0,0 +1,48 @@ +# @textlint/ast-tester + +Compliance tests for [textlint](https://github.com/textlint/textlint "textlint")'s AST(Abstract Syntax Tree). + +It check compliance of AST at minimum. + +- [textlint/txtnode.md at master · textlint/textlint](https://github.com/textlint/textlint/blob/master/docs/txtnode.md "textlint/txtnode.md at master · textlint/textlint") + +If you have created [Processor](https://github.com/textlint/textlint/blob/master/docs/plugin.md "Processor") plugin for textlint, you can use it for testing the plugin. + +## Installation + + npm install -D @textlint/ast-tester + +## Usage + +### `test(textlintAST): void` + +if the AST is invalid, then throw Error + +### `isTxtAST(textlintAST): boolean` + +if the AST is valid, then return `true`. + +```js +import {test, isTxtAST} from "@textlint/ast-tester"; +import yourParse from "your-parser"; +// recommenced: test much pattern test +const AST = yourParse("This is text"); +test(AST);// if the AST is invalid, then throw Error + +isTxtAST(AST);// true or false +``` +## Tests + + npm test + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/@textlint/ast-tester/module/index.d.ts b/node_modules/@textlint/ast-tester/module/index.d.ts new file mode 100644 index 000000000..2c2898e35 --- /dev/null +++ b/node_modules/@textlint/ast-tester/module/index.d.ts @@ -0,0 +1,3 @@ +import { TxtNode } from "@textlint/ast-node-types"; +export declare function isTxtAST(node: any): node is TxtNode; +export declare function test(node: any): void; diff --git a/node_modules/@textlint/ast-tester/module/index.js b/node_modules/@textlint/ast-tester/module/index.js new file mode 100644 index 000000000..90c2db2d9 --- /dev/null +++ b/node_modules/@textlint/ast-tester/module/index.js @@ -0,0 +1,81 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; +import { test as UnistTest } from "./unist-test"; +export function isTxtAST(node) { + try { + test(node); + } + catch (error) { + return false; + } + return true; +} +export function test(node) { + // test unist that is weak. + UnistTest(node); + assert.strictEqual(typeof node, "object"); + assert.strictEqual(typeof node.type, "string"); + assert.ok(node.type.length >= 1); + assert.doesNotThrow(function () { + JSON.parse(JSON.stringify(node)); + }); + // children + if (node.children !== null && node.children !== undefined) { + assert.ok(Array.isArray(node.children)); + node.children.forEach(test); + } + // value + if (node.value !== null && node.value !== undefined) { + assert.strictEqual(typeof node.value, "string"); + } + // raw + assert.ok(node.raw !== null && node.raw !== undefined); + assert.strictEqual(typeof node.raw, "string"); + // loc + var loc = node.loc; + assert.ok(loc !== null && loc !== undefined); + assert.strictEqual(typeof loc, "object"); + var start = loc.start; + var end = loc.end; + if (start !== null && start !== undefined) { + assert.strictEqual(typeof start, "object"); + if (start.line !== null && start.line !== undefined) { + assert.strictEqual(typeof start.line, "number"); + assert.ok(start.line >= 0); // allow `0` for `null`. + } + if (start.column !== null && start.column !== undefined) { + assert.strictEqual(typeof start.column, "number"); + assert.ok(start.column >= 0); // allow `0` for `null`. + } + if (start.offset !== null && start.offset !== undefined) { + assert.strictEqual(typeof start.offset, "number"); + assert.ok(start.offset >= 0); + } + } + if (end !== null && end !== undefined) { + assert.strictEqual(typeof end, "object"); + if (end.line !== null && end.line !== undefined) { + assert.strictEqual(typeof end.line, "number"); + assert.ok(end.line >= 0); // allow `0` for `null`. + } + if (end.column !== null && end.column !== undefined) { + assert.strictEqual(typeof end.column, "number"); + assert.ok(end.column >= 0); // allow `0` for `null`. + } + if (end.offset !== null && end.offset !== undefined) { + assert.strictEqual(typeof end.offset, "number"); + assert.ok(end.offset >= 0); + } + } + // range + var range = node.range; + assert.ok(range !== null && range !== undefined); + assert.ok(Array.isArray(range)); + range.forEach(function (index) { + assert.strictEqual(typeof index, "number"); + assert.ok(index >= 0); + }); + assert.ok(range[0] <= range[1]); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/ast-tester/module/index.js.map b/node_modules/@textlint/ast-tester/module/index.js.map new file mode 100644 index 000000000..135088c8c --- /dev/null +++ b/node_modules/@textlint/ast-tester/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,UAAU,QAAQ,CAAC,IAAS;IAC9B,IAAI;QACA,IAAI,CAAC,IAAI,CAAC,CAAC;KACd;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAS;IAC1B,2BAA2B;IAC3B,SAAS,CAAC,IAAI,CAAC,CAAC;IAChB,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAEjC,MAAM,CAAC,YAAY,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,WAAW;IACX,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;QACvD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC/B;IAED,QAAQ;IACR,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;QACjD,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACnD;IACD,MAAM;IACN,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IACvD,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC9C,MAAM;IACN,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC;IAC7C,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,IAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACxB,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IACpB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACvC,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC;QAE3C,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YACjD,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAChD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;SACvD;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;YACrD,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAClD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;SACzD;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;YACrD,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAClD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;SAChC;KACJ;IAED,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;QACnC,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;QAEzC,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;YAC7C,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;SACrD;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;YACjD,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAChD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;SACvD;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;YACjD,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAChD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;SAC9B;KACJ;IACD,QAAQ;IACR,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAChC,KAAK,CAAC,OAAO,CAAC,UAAU,KAAa;QACjC,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/ast-tester/module/unist-test.d.ts b/node_modules/@textlint/ast-tester/module/unist-test.d.ts new file mode 100644 index 000000000..3991e35a2 --- /dev/null +++ b/node_modules/@textlint/ast-tester/module/unist-test.d.ts @@ -0,0 +1,2 @@ +export declare function isUnist(node: any): boolean; +export declare function test(node: any): void; diff --git a/node_modules/@textlint/ast-tester/module/unist-test.js b/node_modules/@textlint/ast-tester/module/unist-test.js new file mode 100644 index 000000000..770b1c694 --- /dev/null +++ b/node_modules/@textlint/ast-tester/module/unist-test.js @@ -0,0 +1,73 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; +// https://github.com/wooorm/unist +export function isUnist(node) { + try { + test(node); + } + catch (error) { + return false; + } + return true; +} +export function test(node) { + assert.strictEqual(typeof node, "object"); + assert.strictEqual(typeof node.type, "string"); + assert.ok(node.type.length >= 1); + assert.doesNotThrow(function () { + JSON.parse(JSON.stringify(node)); + }); + if (node.children !== null && node.children !== undefined) { + assert.ok(Array.isArray(node.children)); + node.children.forEach(test); + } + if (node.value !== null && node.value !== undefined) { + assert.strictEqual(typeof node.value, "string"); + } + var position = node.position; + if (position !== null && position !== undefined) { + assert.strictEqual(typeof position, "object"); + var start = position.start; + var indent = position.indent; + var end = position.end; + if (start !== null && start !== undefined) { + assert.strictEqual(typeof start, "object"); + if (start.line !== null && start.line !== undefined) { + assert.strictEqual(typeof start.line, "number"); + assert.ok(start.line >= 0); // allow `0` for `null`. + } + if (start.column !== null && start.column !== undefined) { + assert.strictEqual(typeof start.column, "number"); + assert.ok(start.column >= 0); // allow `0` for `null`. + } + if (start.offset !== null && start.offset !== undefined) { + assert.strictEqual(typeof start.offset, "number"); + assert.ok(start.offset >= 0); + } + } + if (end !== null && end !== undefined) { + assert.strictEqual(typeof end, "object"); + if (end.line !== null && end.line !== undefined) { + assert.strictEqual(typeof end.line, "number"); + assert.ok(end.line >= 0); // allow `0` for `null`. + } + if (end.column !== null && end.column !== undefined) { + assert.strictEqual(typeof end.column, "number"); + assert.ok(end.column >= 0); // allow `0` for `null`. + } + if (end.offset !== null && end.offset !== undefined) { + assert.strictEqual(typeof end.offset, "number"); + assert.ok(end.offset >= 0); + } + } + if (indent !== null && indent !== undefined) { + assert.ok(Array.isArray(indent)); + indent.forEach(function (indentation) { + assert.strictEqual(typeof indentation, "number"); + assert.ok(indentation >= 0); + }); + } + } +} +//# sourceMappingURL=unist-test.js.map \ No newline at end of file diff --git a/node_modules/@textlint/ast-tester/module/unist-test.js.map b/node_modules/@textlint/ast-tester/module/unist-test.js.map new file mode 100644 index 000000000..0d54fd7f7 --- /dev/null +++ b/node_modules/@textlint/ast-tester/module/unist-test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unist-test.js","sourceRoot":"","sources":["../src/unist-test.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,kCAAkC;AAClC,MAAM,UAAU,OAAO,CAAC,IAAS;IAC7B,IAAI;QACA,IAAI,CAAC,IAAI,CAAC,CAAC;KACd;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAS;IAC1B,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAEjC,MAAM,CAAC,YAAY,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;QACvD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC/B;IAED,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;QACjD,MAAM,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACnD;IAED,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC7C,MAAM,CAAC,WAAW,CAAC,OAAO,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE9C,IAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC7B,IAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,IAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QAEzB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;YACvC,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC;YAE3C,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;gBACjD,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAChD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;aACvD;YAED,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;gBACrD,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAClD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;aACzD;YAED,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;gBACrD,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAClD,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;aAChC;SACJ;QAED,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;YACnC,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;YAEzC,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;gBAC7C,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC9C,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;aACrD;YAED,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;gBACjD,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAChD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB;aACvD;YAED,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;gBACjD,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAChD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;aAC9B;SACJ;QAED,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE;YACzC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAEjC,MAAM,CAAC,OAAO,CAAC,UAAU,WAAmB;gBACxC,MAAM,CAAC,WAAW,CAAC,OAAO,WAAW,EAAE,QAAQ,CAAC,CAAC;gBACjD,MAAM,CAAC,EAAE,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;SACN;KACJ;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/ast-tester/package.json b/node_modules/@textlint/ast-tester/package.json new file mode 100644 index 000000000..c34e64d9e --- /dev/null +++ b/node_modules/@textlint/ast-tester/package.json @@ -0,0 +1,59 @@ +{ + "name": "@textlint/ast-tester", + "version": "2.3.5", + "description": "Compliance tests for textlint's AST(Abstract Syntax Tree).", + "keywords": [ + "ast", + "suite", + "test", + "testing", + "textlint" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/ast-tester", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "module": "./module/index.js", + "types": "lib/index.d.ts", + "directories": { + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "email": "azuciao@gmail.com", + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/ast-tester/src/index.ts b/node_modules/@textlint/ast-tester/src/index.ts new file mode 100644 index 000000000..71341319c --- /dev/null +++ b/node_modules/@textlint/ast-tester/src/index.ts @@ -0,0 +1,92 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; +import { TxtNode } from "@textlint/ast-node-types"; +import { test as UnistTest } from "./unist-test"; + +export function isTxtAST(node: any): node is TxtNode { + try { + test(node); + } catch (error) { + return false; + } + return true; +} + +export function test(node: any) { + // test unist that is weak. + UnistTest(node); + assert.strictEqual(typeof node, "object"); + assert.strictEqual(typeof node.type, "string"); + assert.ok(node.type.length >= 1); + + assert.doesNotThrow(function () { + JSON.parse(JSON.stringify(node)); + }); + + // children + if (node.children !== null && node.children !== undefined) { + assert.ok(Array.isArray(node.children)); + node.children.forEach(test); + } + + // value + if (node.value !== null && node.value !== undefined) { + assert.strictEqual(typeof node.value, "string"); + } + // raw + assert.ok(node.raw !== null && node.raw !== undefined); + assert.strictEqual(typeof node.raw, "string"); + // loc + const loc = node.loc; + assert.ok(loc !== null && loc !== undefined); + assert.strictEqual(typeof loc, "object"); + const start = loc.start; + const end = loc.end; + if (start !== null && start !== undefined) { + assert.strictEqual(typeof start, "object"); + + if (start.line !== null && start.line !== undefined) { + assert.strictEqual(typeof start.line, "number"); + assert.ok(start.line >= 0); // allow `0` for `null`. + } + + if (start.column !== null && start.column !== undefined) { + assert.strictEqual(typeof start.column, "number"); + assert.ok(start.column >= 0); // allow `0` for `null`. + } + + if (start.offset !== null && start.offset !== undefined) { + assert.strictEqual(typeof start.offset, "number"); + assert.ok(start.offset >= 0); + } + } + + if (end !== null && end !== undefined) { + assert.strictEqual(typeof end, "object"); + + if (end.line !== null && end.line !== undefined) { + assert.strictEqual(typeof end.line, "number"); + assert.ok(end.line >= 0); // allow `0` for `null`. + } + + if (end.column !== null && end.column !== undefined) { + assert.strictEqual(typeof end.column, "number"); + assert.ok(end.column >= 0); // allow `0` for `null`. + } + + if (end.offset !== null && end.offset !== undefined) { + assert.strictEqual(typeof end.offset, "number"); + assert.ok(end.offset >= 0); + } + } + // range + const range = node.range; + assert.ok(range !== null && range !== undefined); + assert.ok(Array.isArray(range)); + range.forEach(function (index: number) { + assert.strictEqual(typeof index, "number"); + assert.ok(index >= 0); + }); + assert.ok(range[0] <= range[1]); +} diff --git a/node_modules/@textlint/ast-tester/src/unist-test.ts b/node_modules/@textlint/ast-tester/src/unist-test.ts new file mode 100644 index 000000000..2900bb10c --- /dev/null +++ b/node_modules/@textlint/ast-tester/src/unist-test.ts @@ -0,0 +1,88 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; + +// https://github.com/wooorm/unist +export function isUnist(node: any): boolean { + try { + test(node); + } catch (error) { + return false; + } + return true; +} + +export function test(node: any) { + assert.strictEqual(typeof node, "object"); + assert.strictEqual(typeof node.type, "string"); + assert.ok(node.type.length >= 1); + + assert.doesNotThrow(function () { + JSON.parse(JSON.stringify(node)); + }); + + if (node.children !== null && node.children !== undefined) { + assert.ok(Array.isArray(node.children)); + node.children.forEach(test); + } + + if (node.value !== null && node.value !== undefined) { + assert.strictEqual(typeof node.value, "string"); + } + + const position = node.position; + if (position !== null && position !== undefined) { + assert.strictEqual(typeof position, "object"); + + const start = position.start; + const indent = position.indent; + const end = position.end; + + if (start !== null && start !== undefined) { + assert.strictEqual(typeof start, "object"); + + if (start.line !== null && start.line !== undefined) { + assert.strictEqual(typeof start.line, "number"); + assert.ok(start.line >= 0); // allow `0` for `null`. + } + + if (start.column !== null && start.column !== undefined) { + assert.strictEqual(typeof start.column, "number"); + assert.ok(start.column >= 0); // allow `0` for `null`. + } + + if (start.offset !== null && start.offset !== undefined) { + assert.strictEqual(typeof start.offset, "number"); + assert.ok(start.offset >= 0); + } + } + + if (end !== null && end !== undefined) { + assert.strictEqual(typeof end, "object"); + + if (end.line !== null && end.line !== undefined) { + assert.strictEqual(typeof end.line, "number"); + assert.ok(end.line >= 0); // allow `0` for `null`. + } + + if (end.column !== null && end.column !== undefined) { + assert.strictEqual(typeof end.column, "number"); + assert.ok(end.column >= 0); // allow `0` for `null`. + } + + if (end.offset !== null && end.offset !== undefined) { + assert.strictEqual(typeof end.offset, "number"); + assert.ok(end.offset >= 0); + } + } + + if (indent !== null && indent !== undefined) { + assert.ok(Array.isArray(indent)); + + indent.forEach(function (indentation: number) { + assert.strictEqual(typeof indentation, "number"); + assert.ok(indentation >= 0); + }); + } + } +} diff --git a/node_modules/@textlint/ast-traverse/CHANGELOG.md b/node_modules/@textlint/ast-traverse/CHANGELOG.md new file mode 100644 index 000000000..63548b8d3 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/CHANGELOG.md @@ -0,0 +1,474 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [2.3.5](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.3.4...@textlint/ast-traverse@2.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + +## [2.3.4](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.3.3...@textlint/ast-traverse@2.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + + +## [2.3.3](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.3.2...@textlint/ast-traverse@2.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [2.3.2](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.3.1...@textlint/ast-traverse@2.3.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [2.3.1](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.5...@textlint/ast-traverse@2.3.1) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [2.3.0](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.5...@textlint/ast-traverse@2.3.0) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [2.2.6](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.5...@textlint/ast-traverse@2.2.6) (2020-12-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [2.2.5](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.4...@textlint/ast-traverse@2.2.5) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [2.2.4](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.3...@textlint/ast-traverse@2.2.4) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [2.2.3](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.2...@textlint/ast-traverse@2.2.3) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [2.2.2](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.1...@textlint/ast-traverse@2.2.2) (2020-07-24) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + + +## [2.2.1](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.2.0...@textlint/ast-traverse@2.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [2.2.0](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.7...@textlint/ast-traverse@2.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [2.1.7](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.6...@textlint/ast-traverse@2.1.7) (2020-02-07) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + + +## [2.1.6](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.5...@textlint/ast-traverse@2.1.6) (2019-10-14) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + + +## [2.1.5](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.3...@textlint/ast-traverse@2.1.5) (2019-07-20) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [2.1.4](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.3...@textlint/ast-traverse@2.1.4) (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [2.1.3](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.2...@textlint/ast-traverse@2.1.3) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [2.1.2](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.1...@textlint/ast-traverse@2.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + + +## [2.1.1](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.1.0...@textlint/ast-traverse@2.1.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/ast-traverse + + + + + + +# [2.1.0](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.0.9...@textlint/ast-traverse@2.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + + + + +## [2.0.9](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.0.8...@textlint/ast-traverse@2.0.9) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + +### Code Refactoring + +* **kernel:** separate linter and fixer descriptor ([b5bc8bd](https://github.com/textlint/textlint/commit/b5bc8bd)) +* **typescript:** update to TypeScript 2.8 ([f7b2b08](https://github.com/textlint/textlint/commit/f7b2b08)) + + + + + +## [2.0.8](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.0.7...@textlint/ast-traverse@2.0.8) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/ast-traverse + + +## [2.0.7](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.0.6...@textlint/ast-traverse@2.0.7) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/ast-traverse + + +## [2.0.6](https://github.com/textlint/textlint/compare/@textlint/ast-traverse@2.0.5...@textlint/ast-traverse@2.0.6) (2018-03-25) + + +### Chores + +* **test:** use `ts-node-test-register` for TypeScript testing ([be746d8](https://github.com/textlint/textlint/commit/be746d8)), closes [#451](https://github.com/textlint/textlint/issues/451) + + + + + +## 2.0.5 (2018-01-27) + + +### Bug Fixes + +* **ast-traverse:** add `publishConfig` ([2ceeb99](https://github.com/textlint/textlint/commit/2ceeb99)) + + +### Code Refactoring + +* **txt-ast-traverse:** move to [@textlint](https://github.com/textlint)/ast-traverse ([7629a50](https://github.com/textlint/textlint/commit/7629a50)) + + + + + +## [2.0.4](https://github.com/textlint/textlint/compare/txt-ast-traverse@2.0.3...txt-ast-traverse@2.0.4) (2018-01-18) + + + + +**Note:** Version bump only for package txt-ast-traverse + + +## [2.0.3](https://github.com/textlint/textlint/compare/txt-ast-traverse@2.0.2...txt-ast-traverse@2.0.3) (2018-01-12) + + + + +**Note:** Version bump only for package txt-ast-traverse + + +## [2.0.2](https://github.com/textlint/textlint/compare/txt-ast-traverse@2.0.1...txt-ast-traverse@2.0.2) (2017-12-31) + + + + +**Note:** Version bump only for package txt-ast-traverse + + +## [2.0.1](https://github.com/textlint/textlint/compare/txt-ast-traverse@2.0.0...txt-ast-traverse@2.0.1) (2017-12-25) + + +### Bug Fixes + +* **monorepo:** fix TypeScript module resolution in monorepo ([d5df499](https://github.com/textlint/textlint/commit/d5df499)) +* **txt-ast-traverse:** fix test scripts ([a78f99b](https://github.com/textlint/textlint/commit/a78f99b)) +* **txt-ast-traverse:** fix txt-ast-traverse test reference ([190723b](https://github.com/textlint/textlint/commit/190723b)) + + + + + +# [2.0.0](https://github.com/textlint/textlint/compare/txt-ast-traverse@2.0.0-next.0...txt-ast-traverse@2.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package txt-ast-traverse + + +# 2.0.0-next.0 (2017-12-15) + + +### Features + +* **traverse:** implement #parents and #current ([79c473e](https://github.com/textlint/textlint/commit/79c473e)) diff --git a/node_modules/@textlint/ast-traverse/LICENSE b/node_modules/@textlint/ast-traverse/LICENSE new file mode 100644 index 000000000..c7add0598 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Includes Estraverse +Copyright (C) 2012-2013 Yusuke Suzuki +https://github.com/estools/estraverse/blob/master/LICENSE.BSD diff --git a/node_modules/@textlint/ast-traverse/README.md b/node_modules/@textlint/ast-traverse/README.md new file mode 100644 index 000000000..33210c755 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/README.md @@ -0,0 +1,254 @@ +# @textlint/ast-traverse + +@textlint/ast-traverse provide traversal functions for [TxtAST](https://github.com/textlint/textlint/blob/master/docs/txtnode.md "TxtAST"). + +This traverse function is a fork of [estraverse](https://github.com/estools/estraverse "Estraverse") for [@textlint/markdown-to-ast](https://github.com/textlint/textlint/tree/master/packages/@textlint/markdown-to-ast/ "textlint/markdown-to-ast"). + +This library is a part of [textlint/textlint](https://github.com/textlint/textlint "textlint/textlint"). + +## Installation + +``` +npm install @textlint/ast-traverse +``` + +## Usage + +```js +var parse = require("@textlint/markdown-to-ast").parse, + Syntax = require("@textlint/markdown-to-ast").Syntax; +var traverse = require("@textlint/ast-traverse").traverse, + VisitorOption = require("@textlint/ast-traverse").VisitorOption; +var AST = parse("# Header\nHello*world*"); +traverse(AST, { + enter(node) { + console.log("enter", node.type); + if (node.type === Syntax.Strong) { + return VisitorOption.Skip; + } + }, + leave(node) { + console.log("leave", node.type); + } +}); +``` + +Traversal rule is the same with [Estraverse](https://github.com/estools/estraverse "Estraverse"). + +## Example + +Markdown: + +```markdown +Hello *world* +``` + +AST: + +```json +{ + "start_line": 1, + "start_column": 1, + "end_line": 0, + "children": [ + { + "start_line": 1, + "start_column": 1, + "end_line": 0, + "inline_content": [ + { + "c": "Hello", + "raw": "Hello", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "type": "Str" + }, + { + "c": " ", + "raw": " ", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "type": "Str" + }, + { + "c": [ + { + "c": "world", + "raw": "world", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "type": "Str" + } + ], + "raw": "*world*", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 6, + 13 + ], + "type": "Emphasis" + } + ], + "children": [], + "raw": "Hello *world*", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "type": "Paragraph" + } + ], + "raw": "Hello *world*", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "type": "Document" +} +``` + +Traversal all from Root(Document node): + +``` +[enter, Syntax.Document], +// # Header +[enter, Syntax.Header], +[enter, Syntax.Str], +[leave, Syntax.Str], +[leave, Syntax.Header], +// => Paragraph +[enter, Syntax.Paragraph], +[enter, Syntax.Str], +[leave, Syntax.Str], +// *world* +[enter, Syntax.Emphasis], +[enter, Syntax.Str], +[leave, Syntax.Str], +[leave, Syntax.Emphasis], +// <= Paragraph +[leave, Syntax.Paragraph], +// End +[leave, Syntax.Document] +``` + +## NOTE + +You want to set property on Node. + +Bad example: + +```js +var TraverseController = require("@textlint/ast-traverse").Controller; +var controller = new TraverseController(); +controller.traverse(ast, { + enter: function (node, parent) { + node.parent = parent;// it cause a circular reference! + // do something + something(node); + } +}); +``` + +`node.parent = parent;` cause a circular reference! + +Correct example: + +```js +var TraverseController = require("@textlint/ast-traverse").Controller; +var controller = new TraverseController(); +controller.traverse(ast, { + enter: function (node, parent) { + // set property as non-enumerable value + Object.defineProperty(node, "parent", { + value: parent + }); + // do something + something(node); + } +}); +``` + + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT + +and + +Includes [Estraverse](https://github.com/estools/estraverse "Estraverse") + + Copyright (C) 2012-2013 Yusuke Suzuki + https://github.com/estools/estraverse/blob/master/LICENSE.BSD diff --git a/node_modules/@textlint/ast-traverse/module/index.d.ts b/node_modules/@textlint/ast-traverse/module/index.d.ts new file mode 100644 index 000000000..8ed100acc --- /dev/null +++ b/node_modules/@textlint/ast-traverse/module/index.d.ts @@ -0,0 +1,42 @@ +import { AnyTxtNode, TxtNode, TxtParentNode } from "@textlint/ast-node-types"; +export declare class TxtElement { + node: AnyTxtNode | null; + constructor(node: AnyTxtNode | null); +} +declare const VisitorOption: { + Break: {}; + Skip: {}; +}; +declare class Controller { + private __worklist; + private __leavelist; + private __current; + private __willStartTraverse; + private __execute; + /** + * Gets parent nodes of current node. + * The parent nodes are returned in order from the closest parent to the outer ones. + * Current node is {@link current}. + * @returns {Array} + * @public + */ + parents(): TxtNode[]; + /** + * Gets current node during traverse. + * @returns {TxtNode|null} + * @public + */ + current(): TxtNode | null; + /** + * Traverse AST with visitor + * @param {TxtParentNode} root + * @param {Visitor} visitor + */ + traverse(root: TxtParentNode, visitor: Visitor): void; +} +export interface Visitor { + enter?(node: TxtNode, parent?: TxtParentNode): any | void; + leave?(node: TxtNode, parent?: TxtParentNode): any | void; +} +declare function traverse(root: TxtParentNode, visitor: Visitor): void; +export { Controller, traverse, VisitorOption }; diff --git a/node_modules/@textlint/ast-traverse/module/index.js b/node_modules/@textlint/ast-traverse/module/index.js new file mode 100644 index 000000000..fa5372220 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/module/index.js @@ -0,0 +1,163 @@ +// LICENSE : MIT +"use strict"; +/** + * is TxtNode? + */ +function isNode(node) { + if (node == null) { + return false; + } + return typeof node === "object" && (typeof node.type === "string" || typeof node.t === "string"); +} +var TxtElement = /** @class */ (function () { + function TxtElement(node) { + this.node = node; + } + return TxtElement; +}()); +export { TxtElement }; +var BREAK = {}; +var SKIP = {}; +var VisitorOption = { + Break: BREAK, + Skip: SKIP +}; +var Controller = /** @class */ (function () { + function Controller() { + } + Controller.prototype.__willStartTraverse = function () { + this.__current = null; + this.__worklist = []; + this.__leavelist = []; + }; + Controller.prototype.__execute = function (callback, element) { + var result = undefined; + var previous = this.__current; + this.__current = element; + if (callback) { + var parentNode = this.__leavelist[this.__leavelist.length - 1].node; + // ignore null element + if (!element.node) { + return; + } + result = callback.call(this, element.node, parentNode); + } + this.__current = previous; + return result; + }; + /** + * Gets parent nodes of current node. + * The parent nodes are returned in order from the closest parent to the outer ones. + * Current node is {@link current}. + * @returns {Array} + * @public + */ + Controller.prototype.parents = function () { + var i, iz; + // first node is sentinel + var result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + var txtElement = this.__leavelist[i]; + var node = txtElement.node; + if (node) { + result.push(node); + } + } + return result; + }; + /** + * Gets current node during traverse. + * @returns {TxtNode|null} + * @public + */ + Controller.prototype.current = function () { + if (!this.__current) { + return null; + } + return this.__current.node; + }; + /** + * Traverse AST with visitor + * @param {TxtParentNode} root + * @param {Visitor} visitor + */ + Controller.prototype.traverse = function (root, visitor) { + // Note: This is based https://github.com/estools/estraverse + // Avoid recursive call by design + var ret; + this.__willStartTraverse(); + // Stop object + var sentinel = new TxtElement(null); + // reference + var worklist = this.__worklist; + var leavelist = this.__leavelist; + // initialize + worklist.push(new TxtElement(root)); + leavelist.push(new TxtElement(null)); + while (worklist.length) { + var element = worklist.pop(); + if (element === undefined) { + continue; + } + if (element === sentinel) { + element = leavelist.pop(); + if (element === undefined) { + continue; + } + ret = this.__execute(visitor.leave, element); + if (ret === BREAK) { + return; + } + continue; + } + if (element.node) { + ret = this.__execute(visitor.enter, element); + if (ret === BREAK) { + return; + } + worklist.push(sentinel); + leavelist.push(element); + if (ret === SKIP) { + continue; + } + var node = element.node; + var candidates = Object.keys(node); + var current = candidates.length; + while ((current -= 1) >= 0) { + var key = candidates[current]; + var candidate = node[key]; + if (!candidate) { + continue; + } + if (Array.isArray(candidate)) { + var current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isNode(candidate[current2])) { + element = new TxtElement(candidate[current2]); + } + else { + continue; + } + if (element) { + worklist.push(element); + } + } + } + else if (isNode(candidate)) { + worklist.push(new TxtElement(candidate)); + } + } + } + } + }; + return Controller; +}()); +function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); +} +export { Controller, traverse, VisitorOption }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/ast-traverse/module/index.js.map b/node_modules/@textlint/ast-traverse/module/index.js.map new file mode 100644 index 000000000..83e6232d5 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb;;GAEG;AACH,SAAS,MAAM,CAAC,IAAS;IACrB,IAAI,IAAI,IAAI,IAAI,EAAE;QACd,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;AACrG,CAAC;AAED;IACI,oBAAmB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAClD,iBAAC;AAAD,CAAC,AAFD,IAEC;;AAED,IAAM,KAAK,GAAG,EAAE,CAAC;AACjB,IAAM,IAAI,GAAG,EAAE,CAAC;AAChB,IAAM,aAAa,GAAG;IAClB,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,IAAI;CACb,CAAC;AAEF;IAAA;IAwJA,CAAC;IAnJW,wCAAmB,GAA3B;QACI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAEO,8BAAS,GAAjB,UACI,QAA6F,EAC7F,OAAmB;QAEnB,IAAI,MAAM,GAAG,SAAS,CAAC;QAEvB,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC;QACzB,IAAI,QAAQ,EAAE;YACV,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAqB,CAAC;YACvF,sBAAsB;YACtB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;gBACf,OAAO;aACV;YACD,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;SAC1D;QACD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACH,4BAAO,GAAP;QACI,IAAI,CAAC,EAAE,EAAE,CAAC;QACV,yBAAyB;QACzB,IAAM,MAAM,GAAc,EAAE,CAAC;QAC7B,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACnD,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACvC,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;YAC7B,IAAI,IAAI,EAAE;gBACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACrB;SACJ;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,4BAAO,GAAP;QACI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,OAAO,IAAI,CAAC;SACf;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,6BAAQ,GAAR,UAAS,IAAmB,EAAE,OAAgB;QAC1C,4DAA4D;QAC5D,iCAAiC;QACjC,IAAI,GAAG,CAAC;QACR,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAE3B,cAAc;QACd,IAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAEtC,YAAY;QACZ,IAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnC,aAAa;QACb,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACpC,SAAS,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAErC,OAAO,QAAQ,CAAC,MAAM,EAAE;YACpB,IAAI,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;YAC7B,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,SAAS;aACZ;YACD,IAAI,OAAO,KAAK,QAAQ,EAAE;gBACtB,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC;gBAC1B,IAAI,OAAO,KAAK,SAAS,EAAE;oBACvB,SAAS;iBACZ;gBACD,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAE7C,IAAI,GAAG,KAAK,KAAK,EAAE;oBACf,OAAO;iBACV;gBACD,SAAS;aACZ;YAED,IAAI,OAAO,CAAC,IAAI,EAAE;gBACd,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAE7C,IAAI,GAAG,KAAK,KAAK,EAAE;oBACf,OAAO;iBACV;gBAED,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAExB,IAAI,GAAG,KAAK,IAAI,EAAE;oBACd,SAAS;iBACZ;gBAED,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBAC1B,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAErC,IAAI,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC;gBAChC,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;oBACxB,IAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;oBAChC,IAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;oBAC5B,IAAI,CAAC,SAAS,EAAE;wBACZ,SAAS;qBACZ;oBAED,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;wBAC1B,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC;wBAChC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;4BACzB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;gCACtB,SAAS;6BACZ;4BACD,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE;gCAC7B,OAAO,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;6BACjD;iCAAM;gCACH,SAAS;6BACZ;4BACD,IAAI,OAAO,EAAE;gCACT,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;6BAC1B;yBACJ;qBACJ;yBAAM,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE;wBAC1B,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;qBAC5C;iBACJ;aACJ;SACJ;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAxJD,IAwJC;AAQD,SAAS,QAAQ,CAAC,IAAmB,EAAE,OAAgB;IACnD,IAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IACpC,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/ast-traverse/package.json b/node_modules/@textlint/ast-traverse/package.json new file mode 100644 index 000000000..781848003 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/package.json @@ -0,0 +1,56 @@ +{ + "name": "@textlint/ast-traverse", + "version": "2.3.5", + "description": "TxtNode traverse library", + "keywords": [ + "AST", + "traverse" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/ast-traverse", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "./lib/index.js", + "module": "./module/index.js", + "types": "./lib/index.d.ts", + "directories": { + "test": "test/" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + }, + "devDependencies": { + "@textlint/markdown-to-ast": "^6.3.5", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "~4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/ast-traverse/src/index.ts b/node_modules/@textlint/ast-traverse/src/index.ts new file mode 100644 index 000000000..f5c937b60 --- /dev/null +++ b/node_modules/@textlint/ast-traverse/src/index.ts @@ -0,0 +1,191 @@ +// LICENSE : MIT +"use strict"; +import { AnyTxtNode, TxtNode, TxtParentNode } from "@textlint/ast-node-types"; + +/** + * is TxtNode? + */ +function isNode(node: any): node is TxtNode { + if (node == null) { + return false; + } + return typeof node === "object" && (typeof node.type === "string" || typeof node.t === "string"); +} + +export class TxtElement { + constructor(public node: AnyTxtNode | null) {} +} + +const BREAK = {}; +const SKIP = {}; +const VisitorOption = { + Break: BREAK, + Skip: SKIP +}; + +class Controller { + private __worklist!: TxtElement[]; + private __leavelist!: TxtElement[]; + private __current!: null | TxtElement; + + private __willStartTraverse() { + this.__current = null; + this.__worklist = []; + this.__leavelist = []; + } + + private __execute( + callback: ((this: Controller, current: AnyTxtNode, parent: TxtParentNode) => any) | undefined, + element: TxtElement + ) { + let result = undefined; + + const previous = this.__current; + this.__current = element; + if (callback) { + const parentNode = this.__leavelist[this.__leavelist.length - 1].node as TxtParentNode; + // ignore null element + if (!element.node) { + return; + } + result = callback.call(this, element.node, parentNode); + } + this.__current = previous; + + return result; + } + + /** + * Gets parent nodes of current node. + * The parent nodes are returned in order from the closest parent to the outer ones. + * Current node is {@link current}. + * @returns {Array} + * @public + */ + parents(): TxtNode[] { + let i, iz; + // first node is sentinel + const result: TxtNode[] = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + const txtElement = this.__leavelist[i]; + const node = txtElement.node; + if (node) { + result.push(node); + } + } + return result; + } + + /** + * Gets current node during traverse. + * @returns {TxtNode|null} + * @public + */ + current(): TxtNode | null { + if (!this.__current) { + return null; + } + return this.__current.node; + } + + /** + * Traverse AST with visitor + * @param {TxtParentNode} root + * @param {Visitor} visitor + */ + traverse(root: TxtParentNode, visitor: Visitor) { + // Note: This is based https://github.com/estools/estraverse + // Avoid recursive call by design + let ret; + this.__willStartTraverse(); + + // Stop object + const sentinel = new TxtElement(null); + + // reference + const worklist = this.__worklist; + const leavelist = this.__leavelist; + + // initialize + worklist.push(new TxtElement(root)); + leavelist.push(new TxtElement(null)); + + while (worklist.length) { + let element = worklist.pop(); + if (element === undefined) { + continue; + } + if (element === sentinel) { + element = leavelist.pop(); + if (element === undefined) { + continue; + } + ret = this.__execute(visitor.leave, element); + + if (ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + ret = this.__execute(visitor.enter, element); + + if (ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (ret === SKIP) { + continue; + } + + const node = element.node; + const candidates = Object.keys(node); + + let current = candidates.length; + while ((current -= 1) >= 0) { + const key = candidates[current]; + const candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + let current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isNode(candidate[current2])) { + element = new TxtElement(candidate[current2]); + } else { + continue; + } + if (element) { + worklist.push(element); + } + } + } else if (isNode(candidate)) { + worklist.push(new TxtElement(candidate)); + } + } + } + } + } +} + +export interface Visitor { + enter?(node: TxtNode, parent?: TxtParentNode): any | void; + + leave?(node: TxtNode, parent?: TxtParentNode): any | void; +} + +function traverse(root: TxtParentNode, visitor: Visitor) { + const controller = new Controller(); + return controller.traverse(root, visitor); +} + +export { Controller, traverse, VisitorOption }; diff --git a/node_modules/@textlint/feature-flag/CHANGELOG.md b/node_modules/@textlint/feature-flag/CHANGELOG.md new file mode 100644 index 000000000..a4f363cc3 --- /dev/null +++ b/node_modules/@textlint/feature-flag/CHANGELOG.md @@ -0,0 +1,403 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.3.5](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.3.4...@textlint/feature-flag@3.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/feature-flag + + + + + +## [3.3.4](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.3.3...@textlint/feature-flag@3.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/feature-flag + + + + + + +## [3.3.3](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.3.2...@textlint/feature-flag@3.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [3.3.2](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.3.1...@textlint/feature-flag@3.3.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [3.3.1](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.4...@textlint/feature-flag@3.3.1) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [3.3.0](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.4...@textlint/feature-flag@3.3.0) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [3.2.5](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.4...@textlint/feature-flag@3.2.5) (2020-12-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [3.2.4](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.3...@textlint/feature-flag@3.2.4) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [3.2.3](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.2...@textlint/feature-flag@3.2.3) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [3.2.2](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.1...@textlint/feature-flag@3.2.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [3.2.1](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.2.0...@textlint/feature-flag@3.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [3.2.0](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.6...@textlint/feature-flag@3.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [3.1.6](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.4...@textlint/feature-flag@3.1.6) (2020-01-07) + + +### Bug Fixes + +* **@textlint/feature-flag:** fix build config ([308835a](https://github.com/textlint/textlint/commit/308835a)) + + +### Tests + +* **@textlint/feature-flag:** fix import path ([ec9110a](https://github.com/textlint/textlint/commit/ec9110a)) + + + + + + +## [3.1.5](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.4...@textlint/feature-flag@3.1.5) (2019-11-03) + + +### Bug Fixes + +* **@textlint/feature-flag:** fix build config ([308835a](https://github.com/textlint/textlint/commit/308835a)) + + +### Tests + +* **@textlint/feature-flag:** fix import path ([ec9110a](https://github.com/textlint/textlint/commit/ec9110a)) + + + + + + +## [3.1.4](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.3...@textlint/feature-flag@3.1.4) (2019-10-14) + +**Note:** Version bump only for package @textlint/feature-flag + + + + + + +## [3.1.3](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.2...@textlint/feature-flag@3.1.3) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [3.1.2](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.1...@textlint/feature-flag@3.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/feature-flag + + + + + + +## [3.1.1](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.1.0...@textlint/feature-flag@3.1.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/feature-flag + + + + + + +# [3.1.0](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.5...@textlint/feature-flag@3.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + + + + +## [3.0.5](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.4...@textlint/feature-flag@3.0.5) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + + + + +## [3.0.4](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.3...@textlint/feature-flag@3.0.4) (2018-01-18) + + + + +**Note:** Version bump only for package @textlint/feature-flag + + +## [3.0.3](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.2...@textlint/feature-flag@3.0.3) (2018-01-12) + + + + +**Note:** Version bump only for package @textlint/feature-flag + + +## [3.0.2](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.1...@textlint/feature-flag@3.0.2) (2017-12-31) + + +### Bug Fixes + +* **feature-flag:** Update MapLile@2 ([5b261f0](https://github.com/textlint/textlint/commit/5b261f0)) + + + + + +## [3.0.1](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.0...@textlint/feature-flag@3.0.1) (2017-12-25) + + + + +**Note:** Version bump only for package @textlint/feature-flag + + +# [3.0.0](https://github.com/textlint/textlint/compare/@textlint/feature-flag@3.0.0-next.0...@textlint/feature-flag@3.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package @textlint/feature-flag + + +# [3.0.0-next.0](https://github.com/textlint/textlint/compare/@textlint/feature-flag@2.0.0...@textlint/feature-flag@3.0.0-next.0) (2017-12-15) + + + + +**Note:** Version bump only for package @textlint/feature-flag + + +## 1.0.1 (2017-05-18) diff --git a/node_modules/@textlint/feature-flag/LICENSE b/node_modules/@textlint/feature-flag/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/@textlint/feature-flag/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/feature-flag/README.md b/node_modules/@textlint/feature-flag/README.md new file mode 100644 index 000000000..caaf892ba --- /dev/null +++ b/node_modules/@textlint/feature-flag/README.md @@ -0,0 +1,65 @@ +# @textlint/feature-flag + +textlint internal feature flag manager. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/feature-flag + +## Usage + +```js +import { coreFlags, isFeatureEnabled, setFeature } from "@textlint/feature-flag"; +// core flag +assert.ok(coreFlags.runningCLI === false); +assert.ok(coreFlags.runningTester === false); // default loose +coreFlags.runningCLI = true; +coreFlags.runningTester = true; +coreFlags.experimental = true; +assert.ok(coreFlags.runningCLI === true); +assert.ok(coreFlags.runningTester === true); +assert.ok(coreFlags.experimental === true); +// feature-flag +try{ + isFeatureEnabled("test") +}catch(error){ + // default strict +} +setFeature("test", true); +assert.ok(isFeatureEnabled("test") === true); + +``` + + +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/feature-flag/module/index.d.ts b/node_modules/@textlint/feature-flag/module/index.d.ts new file mode 100644 index 000000000..8e7bebaf6 --- /dev/null +++ b/node_modules/@textlint/feature-flag/module/index.d.ts @@ -0,0 +1,38 @@ +/** + * IT IS FOR TESTING + */ +export declare const resetFlags: () => void; +/** + * set feature flag + * @param {string} flagName + * @param {boolean} status + */ +export declare const setFeature: (flagName: string, status: boolean) => void; +/** + * If the feature flag of `flagName` is enabled, return true. + * @param {string} flagName + * @param {boolean=false} [loose] + * @returns {boolean} + */ +export declare const isFeatureEnabled: (flagName: string, { loose }?: { + loose?: boolean | undefined; +}) => boolean; +/** + * Core flags + * @type {{experimental, experimental, runningCLI, runningCLI, runningTester, runningTester}} + */ +export declare const coreFlags: { + experimental: boolean; + runningCLI: boolean; + runningTester: boolean; +}; +/** + * if current is not experimental, throw error message. + * @param message + */ +export declare function throwWithoutExperimental(message: string): void; +/** + * if current is in testing, throw error message. + * @param {string} message + */ +export declare function throwIfTesting(message: string): void; diff --git a/node_modules/@textlint/feature-flag/module/index.js b/node_modules/@textlint/feature-flag/module/index.js new file mode 100644 index 000000000..4170a2ca7 --- /dev/null +++ b/node_modules/@textlint/feature-flag/module/index.js @@ -0,0 +1,98 @@ +// MIT © 2017 azu +"use strict"; +import { MapLike } from "map-like"; +var flagMap = new MapLike(); +/** + * IT IS FOR TESTING + */ +export var resetFlags = function () { + flagMap.clear(); +}; +/** + * set feature flag + * @param {string} flagName + * @param {boolean} status + */ +export var setFeature = function (flagName, status) { + flagMap.set(flagName, status); +}; +/** + * If the feature flag of `flagName` is enabled, return true. + * @param {string} flagName + * @param {boolean=false} [loose] + * @returns {boolean} + */ +export var isFeatureEnabled = function (flagName, _a) { + var _b = _a === void 0 ? {} : _a, _c = _b.loose, loose = _c === void 0 ? false : _c; + if (!flagMap.has(flagName)) { + if (loose) { + // loose-mode, return false + return false; + } + else { + throw new Error("@textlint/feature-flag:Error: " + flagName + " is not defined."); + } + } + var status = flagMap.get(flagName); + if (typeof status !== "boolean") { + throw new Error("flag should be boolean, but it is :" + status); + } + return status; +}; +// == CORE Flags +// if run textlint --experimental, set experimental true by default +if (typeof process !== "undefined" && Array.isArray(process.argv) && process.argv.indexOf("--experimental") !== -1) { + setFeature("core.experimental", true); +} +/** + * Core flags + * @type {{experimental, experimental, runningCLI, runningCLI, runningTester, runningTester}} + */ +export var coreFlags = { + // Experimental + get experimental() { + return isFeatureEnabled("core.experimental", { + loose: true + }); + }, + set experimental(status) { + setFeature("core.experimental", status); + }, + // CLI + get runningCLI() { + return isFeatureEnabled("core.runningCLI", { + loose: true + }); + }, + set runningCLI(status) { + setFeature("core.runningCLI", status); + }, + // textlint-tester + get runningTester() { + return isFeatureEnabled("core.runningTester", { + loose: true + }); + }, + set runningTester(status) { + setFeature("core.runningTester", status); + } +}; +/** + * if current is not experimental, throw error message. + * @param message + */ +export function throwWithoutExperimental(message) { + if (coreFlags.runningCLI && !coreFlags.experimental) { + throw Error(message); + } +} +/** + * if current is in testing, throw error message. + * @param {string} message + */ +export function throwIfTesting(message) { + if (coreFlags.runningTester) { + throw Error(message); + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/feature-flag/module/index.js.map b/node_modules/@textlint/feature-flag/module/index.js.map new file mode 100644 index 000000000..d8e9189d9 --- /dev/null +++ b/node_modules/@textlint/feature-flag/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,YAAY,CAAC;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,IAAM,OAAO,GAAG,IAAI,OAAO,EAAmB,CAAC;AAC/C;;GAEG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG;IACtB,OAAO,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC,CAAC;AACF;;;;GAIG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,QAAgB,EAAE,MAAe;IACxD,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC;AACF;;;;;GAKG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,QAAgB,EAAE,EAAsB;QAAtB,qBAAoB,EAAE,KAAA,EAApB,aAAa,EAAb,KAAK,mBAAG,KAAK,KAAA;IAC9D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACxB,IAAI,KAAK,EAAE;YACP,2BAA2B;YAC3B,OAAO,KAAK,CAAC;SAChB;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,mCAAiC,QAAQ,qBAAkB,CAAC,CAAC;SAChF;KACJ;IACD,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,OAAO,MAAM,KAAK,SAAS,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,wCAAsC,MAAQ,CAAC,CAAC;KACnE;IACD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,gBAAgB;AAChB,mEAAmE;AACnE,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE;IAChH,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;CACzC;AACD;;;GAGG;AACH,MAAM,CAAC,IAAM,SAAS,GAAG;IACrB,eAAe;IACf,IAAI,YAAY;QACZ,OAAO,gBAAgB,CAAC,mBAAmB,EAAE;YACzC,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;IACD,IAAI,YAAY,CAAC,MAAe;QAC5B,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM;IACN,IAAI,UAAU;QACV,OAAO,gBAAgB,CAAC,iBAAiB,EAAE;YACvC,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;IACD,IAAI,UAAU,CAAC,MAAe;QAC1B,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,kBAAkB;IAClB,IAAI,aAAa;QACb,OAAO,gBAAgB,CAAC,oBAAoB,EAAE;YAC1C,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;IACD,IAAI,aAAa,CAAC,MAAM;QACpB,UAAU,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACpD,IAAI,SAAS,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE;QACjD,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;KACxB;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC1C,IAAI,SAAS,CAAC,aAAa,EAAE;QACzB,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;KACxB;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/feature-flag/package.json b/node_modules/@textlint/feature-flag/package.json new file mode 100644 index 000000000..0be250353 --- /dev/null +++ b/node_modules/@textlint/feature-flag/package.json @@ -0,0 +1,51 @@ +{ + "name": "@textlint/feature-flag", + "version": "3.3.5", + "description": "textlint internal feature flag manager.", + "keywords": [ + "textlint" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/feature-flag/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "type": "lib/index.d.ts", + "main": "lib/index.js", + "module": "./module/index.js", + "directories": { + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -b --watch" + }, + "dependencies": { + "map-like": "^2.0.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/feature-flag/src/index.ts b/node_modules/@textlint/feature-flag/src/index.ts new file mode 100644 index 000000000..6db077b75 --- /dev/null +++ b/node_modules/@textlint/feature-flag/src/index.ts @@ -0,0 +1,99 @@ +// MIT © 2017 azu +"use strict"; +import { MapLike } from "map-like"; + +const flagMap = new MapLike(); +/** + * IT IS FOR TESTING + */ +export const resetFlags = () => { + flagMap.clear(); +}; +/** + * set feature flag + * @param {string} flagName + * @param {boolean} status + */ +export const setFeature = (flagName: string, status: boolean) => { + flagMap.set(flagName, status); +}; +/** + * If the feature flag of `flagName` is enabled, return true. + * @param {string} flagName + * @param {boolean=false} [loose] + * @returns {boolean} + */ +export const isFeatureEnabled = (flagName: string, { loose = false } = {}): boolean => { + if (!flagMap.has(flagName)) { + if (loose) { + // loose-mode, return false + return false; + } else { + throw new Error(`@textlint/feature-flag:Error: ${flagName} is not defined.`); + } + } + const status = flagMap.get(flagName); + if (typeof status !== "boolean") { + throw new Error(`flag should be boolean, but it is :${status}`); + } + return status; +}; + +// == CORE Flags +// if run textlint --experimental, set experimental true by default +if (typeof process !== "undefined" && Array.isArray(process.argv) && process.argv.indexOf("--experimental") !== -1) { + setFeature("core.experimental", true); +} +/** + * Core flags + * @type {{experimental, experimental, runningCLI, runningCLI, runningTester, runningTester}} + */ +export const coreFlags = { + // Experimental + get experimental() { + return isFeatureEnabled("core.experimental", { + loose: true + }); + }, + set experimental(status: boolean) { + setFeature("core.experimental", status); + }, + // CLI + get runningCLI() { + return isFeatureEnabled("core.runningCLI", { + loose: true + }); + }, + set runningCLI(status: boolean) { + setFeature("core.runningCLI", status); + }, + // textlint-tester + get runningTester() { + return isFeatureEnabled("core.runningTester", { + loose: true + }); + }, + set runningTester(status) { + setFeature("core.runningTester", status); + } +}; + +/** + * if current is not experimental, throw error message. + * @param message + */ +export function throwWithoutExperimental(message: string) { + if (coreFlags.runningCLI && !coreFlags.experimental) { + throw Error(message); + } +} + +/** + * if current is in testing, throw error message. + * @param {string} message + */ +export function throwIfTesting(message: string) { + if (coreFlags.runningTester) { + throw Error(message); + } +} diff --git a/node_modules/@textlint/fixer-formatter/CHANGELOG.md b/node_modules/@textlint/fixer-formatter/CHANGELOG.md new file mode 100644 index 000000000..449ad1e96 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/CHANGELOG.md @@ -0,0 +1,599 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.3.5](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.3.4...@textlint/fixer-formatter@3.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + +## [3.3.4](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.3.3...@textlint/fixer-formatter@3.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.3.3](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.3.2...@textlint/fixer-formatter@3.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [3.3.2](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.3.1...@textlint/fixer-formatter@3.3.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [3.3.1](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.5...@textlint/fixer-formatter@3.3.1) (2021-01-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [3.3.0](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.5...@textlint/fixer-formatter@3.3.0) (2021-01-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [3.2.6](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.5...@textlint/fixer-formatter@3.2.6) (2020-12-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [3.2.5](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.4...@textlint/fixer-formatter@3.2.5) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [3.2.4](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.3...@textlint/fixer-formatter@3.2.4) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [3.2.3](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.2...@textlint/fixer-formatter@3.2.3) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [3.2.2](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.1...@textlint/fixer-formatter@3.2.2) (2020-07-24) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.2.1](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.2.0...@textlint/fixer-formatter@3.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [3.2.0](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.13...@textlint/fixer-formatter@3.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [3.1.13](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.12...@textlint/fixer-formatter@3.1.13) (2020-02-07) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.1.12](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.11...@textlint/fixer-formatter@3.1.12) (2020-01-08) + + +### Tests + +* **fixer-formatter:** use strip-ansi for --no-color ([ddc53b2](https://github.com/textlint/textlint/commit/ddc53b2)) + + + + + + +## [3.1.11](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.9...@textlint/fixer-formatter@3.1.11) (2020-01-07) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.1.10](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.9...@textlint/fixer-formatter@3.1.10) (2019-11-03) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.1.9](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.8...@textlint/fixer-formatter@3.1.9) (2019-10-14) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.1.8](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.5...@textlint/fixer-formatter@3.1.8) (2019-07-20) + + +### Chores + +* **deps:** update diff library ([#608](https://github.com/textlint/textlint/issues/608)) ([893d57c](https://github.com/textlint/textlint/commit/893d57c)) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) +* use [@textlint](https://github.com/textlint)/module-interop instead of interop-require ([10d34a6](https://github.com/textlint/textlint/commit/10d34a6)) + + + + + + +## [3.1.7](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.5...@textlint/fixer-formatter@3.1.7) (2019-07-13) + + +### Chores + +* **deps:** update diff library ([#608](https://github.com/textlint/textlint/issues/608)) ([893d57c](https://github.com/textlint/textlint/commit/893d57c)) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [3.1.6](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.5...@textlint/fixer-formatter@3.1.6) (2019-07-04) + + +### Chores + +* **deps:** update diff library ([#608](https://github.com/textlint/textlint/issues/608)) ([893d57c](https://github.com/textlint/textlint/commit/893d57c)) + + + + + + +## [3.1.5](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.4...@textlint/fixer-formatter@3.1.5) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [3.1.4](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.3...@textlint/fixer-formatter@3.1.4) (2019-04-30) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.1.3](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.2...@textlint/fixer-formatter@3.1.3) (2019-02-10) + + +### Bug Fixes + +* **textlint:** add reasonable debug log ([3931810](https://github.com/textlint/textlint/commit/3931810)) + + + + + + +## [3.1.2](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.1...@textlint/fixer-formatter@3.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +## [3.1.1](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.1.0...@textlint/fixer-formatter@3.1.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/fixer-formatter + + + + + + +# [3.1.0](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.9...@textlint/fixer-formatter@3.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Code Refactoring + +* **fixer-formatter:** use [@textlint](https://github.com/textlint)/types instead of [@textlint](https://github.com/textlint)/kernel ([ef96a80](https://github.com/textlint/textlint/commit/ef96a80)) + + +### Styles + +* **eslint:** apply eslint to all files ([6a9573f](https://github.com/textlint/textlint/commit/6a9573f)) +* **prettier:** format style by prettier ([19a2901](https://github.com/textlint/textlint/commit/19a2901)) + + + + + +## [3.0.9](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.8...@textlint/fixer-formatter@3.0.9) (2018-12-24) + + + + +**Note:** Version bump only for package @textlint/fixer-formatter + + +## [3.0.8](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.7...@textlint/fixer-formatter@3.0.8) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + +### Code Refactoring + +* **kernel:** separate linter and fixer descriptor ([b5bc8bd](https://github.com/textlint/textlint/commit/b5bc8bd)) + + + + + +## [3.0.7](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.6...@textlint/fixer-formatter@3.0.7) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/fixer-formatter + + +## [3.0.6](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.5...@textlint/fixer-formatter@3.0.6) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/fixer-formatter + + +## [3.0.5](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.4...@textlint/fixer-formatter@3.0.5) (2018-03-25) + + +### Chores + +* **test:** use `ts-node-test-register` for TypeScript testing ([be746d8](https://github.com/textlint/textlint/commit/be746d8)), closes [#451](https://github.com/textlint/textlint/issues/451) + + + + + +## [3.0.4](https://github.com/textlint/textlint/compare/@textlint/fixer-formatter@3.0.3...@textlint/fixer-formatter@3.0.4) (2018-01-27) + + + + +**Note:** Version bump only for package @textlint/fixer-formatter + + +## 3.0.3 (2018-01-18) + + +### Bug Fixes + +* **fixer-formatter:** add `publishConfig` ([3e89e3c](https://github.com/textlint/textlint/commit/3e89e3c)) + + + + + +## [3.0.2](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@3.0.1...textlint-fixer-formatter@3.0.2) (2018-01-12) + + + + +**Note:** Version bump only for package textlint-fixer-formatter + + +# [3.0.0](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@2.1.0...textlint-fixer-formatter@3.0.0) (2017-12-31) + + +### Chores + +* **fixer-formatter:** rename `getFormatterList` to `getFixerFormatterList` ([75420c3](https://github.com/textlint/textlint/commit/75420c3)) + + +### BREAKING CHANGES + +* **fixer-formatter:** `getFormatterList` method is renamed. + + + + + +# [2.1.0](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@2.0.1...textlint-fixer-formatter@2.1.0) (2017-12-25) + + +### Features + +* **textlint-fixer-formatter:** add getFormatterList function ([8de3fef](https://github.com/textlint/textlint/commit/8de3fef)) + + + + + +## [2.0.1](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@2.0.0...textlint-fixer-formatter@2.0.1) (2017-12-19) + + + + +**Note:** Version bump only for package textlint-fixer-formatter + + +# [2.0.0](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@2.0.0-next.2...textlint-fixer-formatter@2.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-fixer-formatter + + +# [2.0.0-next.2](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@2.0.0-next.1...textlint-fixer-formatter@2.0.0-next.2) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-fixer-formatter + + +# [2.0.0-next.1](https://github.com/textlint/textlint/compare/textlint-fixer-formatter@2.0.0-next.0...textlint-fixer-formatter@2.0.0-next.1) (2017-12-17) + + + + +**Note:** Version bump only for package textlint-fixer-formatter + + +# 2.0.0-next.0 (2017-12-15) + + +### Bug Fixes + +* **textlint-fixer-formatter:** change files path ([68c6d0f](https://github.com/textlint/textlint/commit/68c6d0f)) +* **textlint-fixer-formatter:** Fill missing dependencies ([9ded710](https://github.com/textlint/textlint/commit/9ded710)) +* **textlint-fixer-formatter:** use paths ([734806f](https://github.com/textlint/textlint/commit/734806f)) diff --git a/node_modules/@textlint/fixer-formatter/LICENSE b/node_modules/@textlint/fixer-formatter/LICENSE new file mode 100644 index 000000000..fca71ec20 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-present azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/fixer-formatter/README.md b/node_modules/@textlint/fixer-formatter/README.md new file mode 100644 index 000000000..cea4d5812 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/README.md @@ -0,0 +1,19 @@ +# @textlint/fixer-formatter + +textlint output formatter for fixer + +## Installation + + npm install @textlint/fixer-formatter + +## Usage + +- [ ] TBD + +## Tests + + npm test + +## License + +MIT diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/compats.d.ts b/node_modules/@textlint/fixer-formatter/module/formatters/compats.d.ts new file mode 100644 index 000000000..014933f7f --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/compats.d.ts @@ -0,0 +1,2 @@ +import type { TextlintFixResult } from "@textlint/types"; +export declare function format(results: TextlintFixResult[]): string; diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/compats.js b/node_modules/@textlint/fixer-formatter/module/formatters/compats.js new file mode 100644 index 000000000..cb78d5328 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/compats.js @@ -0,0 +1,33 @@ +// LICENSE : MIT +"use strict"; +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + else { + return "Warning"; + } +} +export function format(results) { + var output = ""; + var total = 0; + results.forEach(function (result) { + var messages = result.applyingMessages; + total += messages.length; + messages.forEach(function (message) { + output += "Fixed✔ "; + output += result.filePath + ": "; + output += "line " + (message.line || 0); + output += ", col " + (message.column || 0); + output += ", " + getMessageType(message); + output += " - " + message.message; + output += message.ruleId ? " (" + message.ruleId + ")" : ""; + output += "\n"; + }); + }); + if (total > 0) { + output += "\n\nFixed " + total + " problem" + (total !== 1 ? "s" : ""); + } + return output; +} +//# sourceMappingURL=compats.js.map \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/compats.js.map b/node_modules/@textlint/fixer-formatter/module/formatters/compats.js.map new file mode 100644 index 000000000..67698240a --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/compats.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compats.js","sourceRoot":"","sources":["../../src/formatters/compats.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,SAAS,cAAc,CAAC,OAAY;IAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzC,OAAO,OAAO,CAAC;KAClB;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAA4B;IAC/C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;QACnB,IAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACzC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC;QAEzB,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAO;YACrB,MAAM,IAAI,SAAS,CAAC;YACpB,MAAM,IAAO,MAAM,CAAC,QAAQ,OAAI,CAAC;YACjC,MAAM,IAAI,WAAQ,OAAO,CAAC,IAAI,IAAI,CAAC,CAAE,CAAC;YACtC,MAAM,IAAI,YAAS,OAAO,CAAC,MAAM,IAAI,CAAC,CAAE,CAAC;YACzC,MAAM,IAAI,OAAK,cAAc,CAAC,OAAO,CAAG,CAAC;YACzC,MAAM,IAAI,QAAM,OAAO,CAAC,OAAS,CAAC;YAClC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAK,OAAO,CAAC,MAAM,MAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,IAAI,eAAa,KAAK,iBAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAE,CAAC;KACnE;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/diff.d.ts b/node_modules/@textlint/fixer-formatter/module/formatters/diff.d.ts new file mode 100644 index 000000000..6aa0506b5 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/diff.d.ts @@ -0,0 +1,2 @@ +import type { TextlintFixResult } from "@textlint/types"; +export default function (results: TextlintFixResult[], options: any): any; diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/diff.js b/node_modules/@textlint/fixer-formatter/module/formatters/diff.js new file mode 100644 index 000000000..af3b1cbe5 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/diff.js @@ -0,0 +1,128 @@ +"use strict"; +var fs = require("fs"); +var isFile = require("is-file"); +var jsdiff = require("diff"); +var chalk = require("chalk"); +var stripAnsi = require("strip-ansi"); +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {number} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return count === 1 ? word : word + "s"; +} +function isModified(part) { + if (!part) { + return false; + } + return typeof part === "object" && (part.removed || part.added); +} +function addMarkEachLine(mark, text) { + if (text.length === 0) { + return "\n"; + } + var lines = text.split("\n"); + var markedLines = lines + .filter(function (line) { return line.length > 0; }) + .map(function (line) { + return mark + line; + }); + return markedLines.join("\n") + "\n"; +} +export default function (results, options) { + // default: true + var useColor = options.color !== undefined ? options.color : true; + var output = "\n"; + var totalFixed = 0; + var errors = 0; + var summaryColor = "yellow"; + var greenColor = "green"; + results.forEach(function (result) { + var filePath = result.filePath; + var messages = result.applyingMessages; + // still error count + var remainingMessages = result.remainingMessages; + errors += remainingMessages.length; + totalFixed += messages.length; + if (messages.length === 0) { + return; + } + if (!isFile(filePath)) { + return; + } + output += chalk.underline(result.filePath) + "\n"; + var originalContent = fs.readFileSync(filePath, "utf-8"); + var diff = jsdiff.diffLines(originalContent, result.output); + diff.forEach(function (part, index) { + var prevLine = diff[index - 1]; + var nextLine = diff[index + 1]; + if (!isModified(part) && part.count > 1) { + var greyColor = "grey"; + /* + + first line + .... + */ + if (isModified(prevLine)) { + var lines = part.value.split("\n"); + output += chalk[greyColor](lines[0]) + "\n"; + } + output += chalk[greyColor]("..."); + if (isModified(nextLine)) { + var lines = part.value.split("\n"); + output += chalk[greyColor](lines[lines.length - 1]) + "\n"; + } + /* + ... + last line + + */ + return; + } + // green for additions, red for deletions + // grey for common parts + var lineColor; + var diffMark = ""; + if (part.added) { + lineColor = "green"; + diffMark = "+ "; + } + else if (part.removed) { + lineColor = "red"; + diffMark = "- "; + } + else { + lineColor = "grey"; + diffMark = ""; + } + output += chalk[lineColor](addMarkEachLine(diffMark, part.value)); + }); + output += "\n\n"; + }); + if (totalFixed > 0) { + output += chalk[greenColor].bold([ + // http://www.fileformat.info/info/unicode/char/2714/index.htm + "✔ Fixed ", + totalFixed, + pluralize(" problem", totalFixed), + "\n" + ].join("")); + } + if (errors > 0) { + output += chalk[summaryColor].bold([ + // http://www.fileformat.info/info/unicode/char/2716/index.htm + "✖ Remaining ", + errors, + pluralize(" problem", errors), + "\n" + ].join("")); + } + var finalOutput = totalFixed > 0 ? output : ""; + if (!useColor) { + return stripAnsi(finalOutput); + } + return finalOutput; +} +//# sourceMappingURL=diff.js.map \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/diff.js.map b/node_modules/@textlint/fixer-formatter/module/formatters/diff.js.map new file mode 100644 index 000000000..90289cbf6 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/diff.js.map @@ -0,0 +1 @@ +{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/formatters/diff.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa;IAC1C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAI,IAAI,MAAG,CAAC;AAC3C,CAAC;AAED,SAAS,UAAU,CAAC,IAAS;IACzB,IAAI,CAAC,IAAI,EAAE;QACP,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,IAAS;IAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACnB,OAAO,IAAI,CAAC;KACf;IACD,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAM,WAAW,GAAG,KAAK;SACpB,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,IAAI,CAAC,MAAM,GAAG,CAAC,EAAf,CAAe,CAAC;SACzC,GAAG,CAAC,UAAC,IAAY;QACd,OAAO,IAAI,GAAG,IAAI,CAAC;IACvB,CAAC,CAAC,CAAC;IACP,OAAU,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAI,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,OAAO,WAAW,OAA4B,EAAE,OAAY;IAC/D,gBAAgB;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,IAAM,UAAU,GAAG,OAAO,CAAC;IAE3B,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,IAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACzC,oBAAoB;QACpB,IAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;QACnC,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC;QAC9B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;YACnB,OAAO;SACV;QACD,MAAM,IAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAI,CAAC;QAElD,IAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC3D,IAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAE9D,IAAI,CAAC,OAAO,CAAC,UAAU,IAAS,EAAE,KAAa;YAC3C,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACjC,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE;gBACrC,IAAM,SAAS,GAAG,MAAM,CAAC;gBACzB;;;;mBAIG;gBACH,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;oBACtB,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACrC,MAAM,IAAO,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAI,CAAC;iBAC/C;gBACD,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;oBACtB,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACrC,MAAM,IAAO,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAI,CAAC;iBAC9D;gBACD;;;;mBAIG;gBACH,OAAO;aACV;YACD,yCAAyC;YACzC,wBAAwB;YACxB,IAAI,SAAS,CAAC;YACd,IAAI,QAAQ,GAAG,EAAE,CAAC;YAClB,IAAI,IAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,OAAO,CAAC;gBACpB,QAAQ,GAAG,IAAI,CAAC;aACnB;iBAAM,IAAI,IAAI,CAAC,OAAO,EAAE;gBACrB,SAAS,GAAG,KAAK,CAAC;gBAClB,QAAQ,GAAG,IAAI,CAAC;aACnB;iBAAM;gBACH,SAAS,GAAG,MAAM,CAAC;gBACnB,QAAQ,GAAG,EAAE,CAAC;aACjB;YACD,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,MAAM,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,GAAG,CAAC,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAC5B;YACI,8DAA8D;YAC9D,UAAU;YACV,UAAU;YACV,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;YACjC,IAAI;SACP,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,CAAC;KACL;IAED,IAAI,MAAM,GAAG,CAAC,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAC9B;YACI,8DAA8D;YAC9D,cAAc;YACd,MAAM;YACN,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;YAC7B,IAAI;SACP,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,CAAC;KACL;IAED,IAAM,WAAW,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC;KACjC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/json.d.ts b/node_modules/@textlint/fixer-formatter/module/formatters/json.d.ts new file mode 100644 index 000000000..f3622500e --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/json.d.ts @@ -0,0 +1,2 @@ +import type { TextlintFixResult } from "@textlint/types"; +export default function (results: TextlintFixResult[]): string; diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/json.js b/node_modules/@textlint/fixer-formatter/module/formatters/json.js new file mode 100644 index 000000000..10606ecf9 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/json.js @@ -0,0 +1,6 @@ +// LICENSE : MIT +"use strict"; +export default function (results) { + return JSON.stringify(results); +} +//# sourceMappingURL=json.js.map \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/json.js.map b/node_modules/@textlint/fixer-formatter/module/formatters/json.js.map new file mode 100644 index 000000000..62a93328e --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/json.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,MAAM,CAAC,OAAO,WAAW,OAA4B;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/stylish.d.ts b/node_modules/@textlint/fixer-formatter/module/formatters/stylish.d.ts new file mode 100644 index 000000000..6aa0506b5 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/stylish.d.ts @@ -0,0 +1,2 @@ +import type { TextlintFixResult } from "@textlint/types"; +export default function (results: TextlintFixResult[], options: any): any; diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/stylish.js b/node_modules/@textlint/fixer-formatter/module/formatters/stylish.js new file mode 100644 index 000000000..8ec622ff4 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/stylish.js @@ -0,0 +1,88 @@ +"use strict"; +var chalk = require("chalk"); +var table = require("text-table"); +var widthOfString = require("string-width"); +var stripAnsi = require("strip-ansi"); +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {number} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return count === 1 ? word : word + "s"; +} +export default function (results, options) { + // default: true + var useColor = options.color !== undefined ? options.color : true; + var output = "\n"; + var totalFixed = 0; + var errors = 0; + var summaryColor = "yellow"; + var greenColor = "green"; + results.forEach(function (result) { + if (!result.applyingMessages || !result.remainingMessages) { + return; + } + var messages = result.applyingMessages; + // still error count + var remainingMessages = result.remainingMessages; + errors += remainingMessages.length; + if (messages.length === 0) { + return; + } + output += chalk.underline(result.filePath) + "\n"; + output += table(messages.map(function (message) { + // fixable + totalFixed++; + var messageType = chalk[greenColor].bold("\u2714 "); + return [ + "", + message.line || 0, + message.column || 0, + messageType, + message.message.replace(/\.$/, ""), + chalk.gray(message.ruleId || "") + ]; + }), { + align: ["", "r", "l"], + stringLength: function (str) { + var lines = chalk.stripColor(str).split("\n"); + return Math.max.apply(null, lines.map(function (line) { + return widthOfString(line); + })); + } + }) + .split("\n") + .map(function (el) { + return el.replace(/(\d+)\s+(\d+)/, function (_m, p1, p2) { + return chalk.gray(p1 + ":" + p2); + }); + }) + .join("\n") + "\n\n"; + }); + if (totalFixed > 0) { + output += chalk[greenColor].bold([ + // http://www.fileformat.info/info/unicode/char/2714/index.htm + "\u2714 Fixed ", + totalFixed, + pluralize(" problem", totalFixed), + "\n" + ].join("")); + } + if (errors > 0) { + output += chalk[summaryColor].bold([ + // http://www.fileformat.info/info/unicode/char/2716/index.htm + "\u2716 Remaining ", + errors, + pluralize(" problem", errors), + "\n" + ].join("")); + } + var finalOutput = totalFixed > 0 ? output : ""; + if (!useColor) { + return stripAnsi(finalOutput); + } + return finalOutput; +} +//# sourceMappingURL=stylish.js.map \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/formatters/stylish.js.map b/node_modules/@textlint/fixer-formatter/module/formatters/stylish.js.map new file mode 100644 index 000000000..0d1cf5bd2 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/formatters/stylish.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stylish.js","sourceRoot":"","sources":["../../src/formatters/stylish.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACpC,IAAM,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC9C,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAExC;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa;IAC1C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAI,IAAI,MAAG,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,OAAO,WAAW,OAA4B,EAAE,OAAY;IAC/D,gBAAgB;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,IAAM,UAAU,GAAG,OAAO,CAAC;IAE3B,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;YACvD,OAAO;SACV;QACD,IAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACzC,oBAAoB;QACpB,IAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;QACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,OAAO;SACV;QACD,MAAM,IAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAI,CAAC;QAElD,MAAM,IAAO,KAAK,CACd,QAAQ,CAAC,GAAG,CAAC,UAAU,OAAO;YAC1B,UAAU;YACV,UAAU,EAAE,CAAC;YACb,IAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAEtD,OAAO;gBACH,EAAE;gBACF,OAAO,CAAC,IAAI,IAAI,CAAC;gBACjB,OAAO,CAAC,MAAM,IAAI,CAAC;gBACnB,WAAW;gBACX,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;gBAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;aACnC,CAAC;QACN,CAAC,CAAC,EACF;YACI,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC;YACrB,YAAY,EAAE,UAAC,GAAW;gBACtB,IAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAChD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CACjB,IAAI,EACJ,KAAK,CAAC,GAAG,CAAC,UAAU,IAAY;oBAC5B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC,CAAC,CACL,CAAC;YACN,CAAC;SACJ,CACJ;aACI,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,UAAU,EAAU;YACrB,OAAO,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE;gBACnD,OAAO,KAAK,CAAC,IAAI,CAAI,EAAE,SAAI,EAAI,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,SAAM,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,GAAG,CAAC,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAC5B;YACI,8DAA8D;YAC9D,eAAe;YACf,UAAU;YACV,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;YACjC,IAAI;SACP,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,CAAC;KACL;IAED,IAAI,MAAM,GAAG,CAAC,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAC9B;YACI,8DAA8D;YAC9D,mBAAmB;YACnB,MAAM;YACN,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;YAC7B,IAAI;SACP,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,CAAC;KACL;IAED,IAAM,WAAW,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC;KACjC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/index.d.ts b/node_modules/@textlint/fixer-formatter/module/index.d.ts new file mode 100644 index 000000000..84a9b11ba --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/index.d.ts @@ -0,0 +1,10 @@ +import type { TextlintFixResult } from "@textlint/types"; +export declare type FormatterConfig = { + color?: boolean; + formatterName: string; +}; +export declare function createFormatter(formatterConfig: FormatterConfig): (results: TextlintFixResult[]) => string; +export interface FixerFormatterDetail { + name: string; +} +export declare function getFixerFormatterList(): FixerFormatterDetail[]; diff --git a/node_modules/@textlint/fixer-formatter/module/index.js b/node_modules/@textlint/fixer-formatter/module/index.js new file mode 100644 index 000000000..84b9aa706 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/index.js @@ -0,0 +1,55 @@ +// LICENSE : MIT +"use strict"; +import { moduleInterop } from "@textlint/module-interop"; +var fs = require("fs"); +var path = require("path"); +var tryResolve = require("try-resolve"); +var isFile = require("is-file"); +var debug = require("debug")("textlint:textfix-formatter"); +export function createFormatter(formatterConfig) { + var formatterName = formatterConfig.formatterName; + debug("formatterName: " + formatterName); + var formatter; + var formatterPath; + if (fs.existsSync(formatterName)) { + formatterPath = formatterName; + } + else if (fs.existsSync(path.resolve(process.cwd(), formatterName))) { + formatterPath = path.resolve(process.cwd(), formatterName); + } + else { + if (isFile(path.join(__dirname, "formatters/", formatterName) + ".js")) { + formatterPath = path.join(__dirname, "formatters/", formatterName) + ".js"; + } + else if (isFile(path.join(__dirname, "formatters/", formatterName) + ".ts")) { + formatterPath = path.join(__dirname, "formatters/", formatterName) + ".ts"; + } + else { + var pkgPath = tryResolve("textlint-formatter-" + formatterName) || tryResolve(formatterName); + if (pkgPath) { + formatterPath = pkgPath; + } + } + } + try { + formatter = moduleInterop(require(formatterPath)); + } + catch (ex) { + throw new Error("Could not find formatter " + formatterName + "\nSee https://github.com/textlint/textlint/issues/148\n" + ex); + } + debug("use formatter: " + formatterPath); + return function (results) { + return formatter(results, formatterConfig); + }; +} +export function getFixerFormatterList() { + return fs + .readdirSync(path.join(__dirname, "formatters")) + .filter(function (file) { + return path.extname(file) === ".js"; + }) + .map(function (file) { + return { name: path.basename(file, ".js") }; + }); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/module/index.js.map b/node_modules/@textlint/fixer-formatter/module/index.js.map new file mode 100644 index 000000000..8d54082bf --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE1C,IAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,CAAC;AAI7D,MAAM,UAAU,eAAe,CAAC,eAAgC;IAC5D,IAAM,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;IACpD,KAAK,CAAC,oBAAkB,aAAe,CAAC,CAAC;IACzC,IAAI,SAAqF,CAAC;IAC1F,IAAI,aAAa,CAAC;IAClB,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QAC9B,aAAa,GAAG,aAAa,CAAC;KACjC;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC,EAAE;QAClE,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;KAC9D;SAAM;QACH,IAAI,MAAM,CAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC,EAAE;YACpE,aAAa,GAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC;SAC9E;aAAM,IAAI,MAAM,CAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC,EAAE;YAC3E,aAAa,GAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC;SAC9E;aAAM;YACH,IAAM,OAAO,GAAG,UAAU,CAAC,wBAAsB,aAAe,CAAC,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/F,IAAI,OAAO,EAAE;gBACT,aAAa,GAAG,OAAO,CAAC;aAC3B;SACJ;KACJ;IACD,IAAI;QACA,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KACrD;IAAC,OAAO,EAAE,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,8BAA4B,aAAa,+DAE/D,EAAI,CAAC,CAAC;KACH;IACD,KAAK,CAAC,oBAAkB,aAAe,CAAC,CAAC;IACzC,OAAO,UAAU,OAA4B;QACzC,OAAO,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC;AACN,CAAC;AAMD,MAAM,UAAU,qBAAqB;IACjC,OAAO,EAAE;SACJ,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;SAC/C,MAAM,CAAC,UAAC,IAAY;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC;IACxC,CAAC,CAAC;SACD,GAAG,CAAC,UAAC,IAAY;QACd,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/fixer-formatter/package.json b/node_modules/@textlint/fixer-formatter/package.json new file mode 100644 index 000000000..8bd1ee7ae --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/package.json @@ -0,0 +1,64 @@ +{ + "name": "@textlint/fixer-formatter", + "version": "3.3.5", + "description": "textlint output formatter for fixer", + "keywords": [ + "AST", + "lint", + "linting", + "markdown", + "plugable", + "text", + "textlint" + ], + "homepage": "https://github.com/textlint/textlint#readme", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run build", + "test": "mocha \"test/**/*.{js,ts}\"" + }, + "dependencies": { + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "debug": "^4.3.1", + "diff": "^4.0.2", + "is-file": "^1.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "~4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/fixer-formatter/src/formatters/compats.ts b/node_modules/@textlint/fixer-formatter/src/formatters/compats.ts new file mode 100644 index 000000000..9ac6fbfce --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/src/formatters/compats.ts @@ -0,0 +1,37 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintFixResult } from "@textlint/types"; +function getMessageType(message: any) { + if (message.fatal || message.severity === 2) { + return "Error"; + } else { + return "Warning"; + } +} + +export function format(results: TextlintFixResult[]) { + let output = ""; + let total = 0; + + results.forEach((result) => { + const messages = result.applyingMessages; + total += messages.length; + + messages.forEach((message) => { + output += "Fixed✔ "; + output += `${result.filePath}: `; + output += `line ${message.line || 0}`; + output += `, col ${message.column || 0}`; + output += `, ${getMessageType(message)}`; + output += ` - ${message.message}`; + output += message.ruleId ? ` (${message.ruleId})` : ""; + output += "\n"; + }); + }); + + if (total > 0) { + output += `\n\nFixed ${total} problem${total !== 1 ? "s" : ""}`; + } + + return output; +} diff --git a/node_modules/@textlint/fixer-formatter/src/formatters/diff.ts b/node_modules/@textlint/fixer-formatter/src/formatters/diff.ts new file mode 100644 index 000000000..039285776 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/src/formatters/diff.ts @@ -0,0 +1,139 @@ +"use strict"; +import type { TextlintFixResult } from "@textlint/types"; +const fs = require("fs"); +const isFile = require("is-file"); +const jsdiff = require("diff"); +const chalk = require("chalk"); +const stripAnsi = require("strip-ansi"); +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {number} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word: string, count: number): string { + return count === 1 ? word : `${word}s`; +} + +function isModified(part: any) { + if (!part) { + return false; + } + return typeof part === "object" && (part.removed || part.added); +} + +function addMarkEachLine(mark: string, text: any) { + if (text.length === 0) { + return "\n"; + } + const lines = text.split("\n"); + const markedLines = lines + .filter((line: string) => line.length > 0) + .map((line: string) => { + return mark + line; + }); + return `${markedLines.join("\n")}\n`; +} + +export default function (results: TextlintFixResult[], options: any) { + // default: true + const useColor = options.color !== undefined ? options.color : true; + let output = "\n"; + let totalFixed = 0; + let errors = 0; + const summaryColor = "yellow"; + const greenColor = "green"; + + results.forEach(function (result) { + const filePath = result.filePath; + const messages = result.applyingMessages; + // still error count + const remainingMessages = result.remainingMessages; + errors += remainingMessages.length; + totalFixed += messages.length; + if (messages.length === 0) { + return; + } + if (!isFile(filePath)) { + return; + } + output += `${chalk.underline(result.filePath)}\n`; + + const originalContent = fs.readFileSync(filePath, "utf-8"); + const diff = jsdiff.diffLines(originalContent, result.output); + + diff.forEach(function (part: any, index: number) { + const prevLine = diff[index - 1]; + const nextLine = diff[index + 1]; + if (!isModified(part) && part.count > 1) { + const greyColor = "grey"; + /* + + first line + .... + */ + if (isModified(prevLine)) { + const lines = part.value.split("\n"); + output += `${chalk[greyColor](lines[0])}\n`; + } + output += chalk[greyColor]("..."); + if (isModified(nextLine)) { + const lines = part.value.split("\n"); + output += `${chalk[greyColor](lines[lines.length - 1])}\n`; + } + /* + ... + last line + + */ + return; + } + // green for additions, red for deletions + // grey for common parts + let lineColor; + let diffMark = ""; + if (part.added) { + lineColor = "green"; + diffMark = "+ "; + } else if (part.removed) { + lineColor = "red"; + diffMark = "- "; + } else { + lineColor = "grey"; + diffMark = ""; + } + output += chalk[lineColor](addMarkEachLine(diffMark, part.value)); + }); + output += "\n\n"; + }); + + if (totalFixed > 0) { + output += chalk[greenColor].bold( + [ + // http://www.fileformat.info/info/unicode/char/2714/index.htm + "✔ Fixed ", + totalFixed, + pluralize(" problem", totalFixed), + "\n" + ].join("") + ); + } + + if (errors > 0) { + output += chalk[summaryColor].bold( + [ + // http://www.fileformat.info/info/unicode/char/2716/index.htm + "✖ Remaining ", + errors, + pluralize(" problem", errors), + "\n" + ].join("") + ); + } + + const finalOutput = totalFixed > 0 ? output : ""; + if (!useColor) { + return stripAnsi(finalOutput); + } + return finalOutput; +} diff --git a/node_modules/@textlint/fixer-formatter/src/formatters/json.ts b/node_modules/@textlint/fixer-formatter/src/formatters/json.ts new file mode 100644 index 000000000..246435d60 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/src/formatters/json.ts @@ -0,0 +1,6 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintFixResult } from "@textlint/types"; +export default function (results: TextlintFixResult[]) { + return JSON.stringify(results); +} diff --git a/node_modules/@textlint/fixer-formatter/src/formatters/stylish.ts b/node_modules/@textlint/fixer-formatter/src/formatters/stylish.ts new file mode 100644 index 000000000..9fce6cf59 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/src/formatters/stylish.ts @@ -0,0 +1,107 @@ +"use strict"; +import type { TextlintFixResult } from "@textlint/types"; + +const chalk = require("chalk"); +const table = require("text-table"); +const widthOfString = require("string-width"); +const stripAnsi = require("strip-ansi"); + +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {number} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word: string, count: number): string { + return count === 1 ? word : `${word}s`; +} + +export default function (results: TextlintFixResult[], options: any) { + // default: true + const useColor = options.color !== undefined ? options.color : true; + let output = "\n"; + let totalFixed = 0; + let errors = 0; + const summaryColor = "yellow"; + const greenColor = "green"; + + results.forEach(function (result) { + if (!result.applyingMessages || !result.remainingMessages) { + return; + } + const messages = result.applyingMessages; + // still error count + const remainingMessages = result.remainingMessages; + errors += remainingMessages.length; + if (messages.length === 0) { + return; + } + output += `${chalk.underline(result.filePath)}\n`; + + output += `${table( + messages.map(function (message) { + // fixable + totalFixed++; + const messageType = chalk[greenColor].bold("\u2714 "); + + return [ + "", + message.line || 0, + message.column || 0, + messageType, + message.message.replace(/\.$/, ""), + chalk.gray(message.ruleId || "") + ]; + }), + { + align: ["", "r", "l"], + stringLength: (str: string) => { + const lines = chalk.stripColor(str).split("\n"); + return Math.max.apply( + null, + lines.map(function (line: string) { + return widthOfString(line); + }) + ); + } + } + ) + .split("\n") + .map(function (el: string) { + return el.replace(/(\d+)\s+(\d+)/, function (_m, p1, p2) { + return chalk.gray(`${p1}:${p2}`); + }); + }) + .join("\n")}\n\n`; + }); + + if (totalFixed > 0) { + output += chalk[greenColor].bold( + [ + // http://www.fileformat.info/info/unicode/char/2714/index.htm + "\u2714 Fixed ", + totalFixed, + pluralize(" problem", totalFixed), + "\n" + ].join("") + ); + } + + if (errors > 0) { + output += chalk[summaryColor].bold( + [ + // http://www.fileformat.info/info/unicode/char/2716/index.htm + "\u2716 Remaining ", + errors, + pluralize(" problem", errors), + "\n" + ].join("") + ); + } + + const finalOutput = totalFixed > 0 ? output : ""; + if (!useColor) { + return stripAnsi(finalOutput); + } + return finalOutput; +} diff --git a/node_modules/@textlint/fixer-formatter/src/index.ts b/node_modules/@textlint/fixer-formatter/src/index.ts new file mode 100644 index 000000000..d06592e67 --- /dev/null +++ b/node_modules/@textlint/fixer-formatter/src/index.ts @@ -0,0 +1,63 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintFixResult } from "@textlint/types"; + +import { moduleInterop } from "@textlint/module-interop"; + +const fs = require("fs"); +const path = require("path"); +const tryResolve = require("try-resolve"); + +const isFile = require("is-file"); +const debug = require("debug")("textlint:textfix-formatter"); + +export type FormatterConfig = { color?: boolean; formatterName: string }; + +export function createFormatter(formatterConfig: FormatterConfig) { + const formatterName = formatterConfig.formatterName; + debug(`formatterName: ${formatterName}`); + let formatter: (results: TextlintFixResult[], formatterConfig: FormatterConfig) => string; + let formatterPath; + if (fs.existsSync(formatterName)) { + formatterPath = formatterName; + } else if (fs.existsSync(path.resolve(process.cwd(), formatterName))) { + formatterPath = path.resolve(process.cwd(), formatterName); + } else { + if (isFile(`${path.join(__dirname, "formatters/", formatterName)}.js`)) { + formatterPath = `${path.join(__dirname, "formatters/", formatterName)}.js`; + } else if (isFile(`${path.join(__dirname, "formatters/", formatterName)}.ts`)) { + formatterPath = `${path.join(__dirname, "formatters/", formatterName)}.ts`; + } else { + const pkgPath = tryResolve(`textlint-formatter-${formatterName}`) || tryResolve(formatterName); + if (pkgPath) { + formatterPath = pkgPath; + } + } + } + try { + formatter = moduleInterop(require(formatterPath)); + } catch (ex) { + throw new Error(`Could not find formatter ${formatterName} +See https://github.com/textlint/textlint/issues/148 +${ex}`); + } + debug(`use formatter: ${formatterPath}`); + return function (results: TextlintFixResult[]) { + return formatter(results, formatterConfig); + }; +} + +export interface FixerFormatterDetail { + name: string; +} + +export function getFixerFormatterList(): FixerFormatterDetail[] { + return fs + .readdirSync(path.join(__dirname, "formatters")) + .filter((file: string) => { + return path.extname(file) === ".js"; + }) + .map((file: string) => { + return { name: path.basename(file, ".js") }; + }); +} diff --git a/node_modules/@textlint/get-config-base-dir/LICENSE b/node_modules/@textlint/get-config-base-dir/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/@textlint/get-config-base-dir/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/get-config-base-dir/README.md b/node_modules/@textlint/get-config-base-dir/README.md new file mode 100644 index 000000000..48e9f5ba0 --- /dev/null +++ b/node_modules/@textlint/get-config-base-dir/README.md @@ -0,0 +1,62 @@ +# @textlint/get-config-base-dir [![Build Status](https://travis-ci.org/textlint/get-config-base-dir.svg?branch=master)](https://travis-ci.org/textlint/get-config-base-dir) + +`Context#getConfigBaseDir` ponyfill for textlint ^8.x.x + +Historically, `Context#getConfigBaseDir` is added in textlint 9.0.0. + +- [RuleContext API](https://github.com/textlint/textlint/blob/master/docs/rule.md#rulecontext-api "RuleContext API") +- + +## Behavior + +This ponyfill provide backward compatibility for textlint 8.x.x. + +- If you use textlint^9.0.0, use native Context#getConfigBaseDir. +- If you use textlint < 9.0.0, fallback method + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/get-config-base-dir + +## Usage + +```js +import { getConfigBaseDir } from "@textlint/get-config-base-dir" +const report = (context) => { + const textlintRcDir = getConfigBaseDir(context); +} +``` + + +## Changelog + +See [Releases page](https://github.com/textlint/get-config-base-dir/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/textlint/get-config-base-dir/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/get-config-base-dir/package.json b/node_modules/@textlint/get-config-base-dir/package.json new file mode 100644 index 000000000..2eb03ed09 --- /dev/null +++ b/node_modules/@textlint/get-config-base-dir/package.json @@ -0,0 +1,62 @@ +{ + "directories": { + "lib": "lib", + "test": "test" + }, + "author": "azu", + "license": "MIT", + "files": [ + "bin/", + "lib/", + "src/" + ], + "name": "@textlint/get-config-base-dir", + "version": "2.0.0", + "description": "Context#getConfigBaseDir ponyfill for textlint ^8.x.x", + "main": "lib/get-config-base-dir.js", + "scripts": { + "prettier": "prettier --write '**/*.{js,jsx,ts,tsx,css}'", + "precommit": "lint-staged", + "postcommit": "git reset", + "test": "mocha test", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", + "watch": "babel src --out-dir lib --watch --source-maps", + "prepublish": "npm run --if-present build" + }, + "keywords": [ + "textlint", + "ponyfill" + ], + "repository": { + "type": "git", + "url": "https://github.com/textlint/get-config-base-dir.git" + }, + "bugs": { + "url": "https://github.com/textlint/get-config-base-dir/issues" + }, + "homepage": "https://github.com/textlint/get-config-base-dir", + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-preset-jsdoc-to-assert": "^4.0.0", + "babel-preset-power-assert": "^1.0.0", + "babel-register": "^6.26.0", + "cross-env": "^5.1.1", + "husky": "^0.14.3", + "lint-staged": "^6.0.0", + "mocha": "^4.0.1", + "power-assert": "^1.4.4", + "prettier": "^1.8.2", + "textlint": "^9.1.1" + }, + "prettier": { + "printWidth": 120, + "tabWidth": 4 + }, + "lint-staged": { + "*.{js,jsx,ts,tsx,css}": [ + "prettier --write", + "git add" + ] + } +} diff --git a/node_modules/@textlint/get-config-base-dir/src/get-config-base-dir.js b/node_modules/@textlint/get-config-base-dir/src/get-config-base-dir.js new file mode 100644 index 000000000..52e1ea191 --- /dev/null +++ b/node_modules/@textlint/get-config-base-dir/src/get-config-base-dir.js @@ -0,0 +1,21 @@ +// MIT © 2017 azu +"use strict"; +const path = require("path"); +/** + * Get config base dir from Context. + * If you use textlint^9.0.0, use native Context#getConfigBaseDir. + * If you use textlint < 9.0.0, fallback method + * @see https://github.com/textlint/textlint/releases/tag/textlint%409.0.0 + * @param {*} context + * @returns {string|undefined} + */ +export const getConfigBaseDir = context => { + if (typeof context.getConfigBaseDir === "function") { + return context.getConfigBaseDir(); + } + // Old fallback that use deprecated `config` value + // https://github.com/textlint/textlint/issues/294 + const textlintRcFilePath = context.config ? context.config.configFile : null; + // .textlinrc directory + return textlintRcFilePath ? path.dirname(textlintRcFilePath) : undefined; +}; diff --git a/node_modules/@textlint/kernel/CHANGELOG.md b/node_modules/@textlint/kernel/CHANGELOG.md new file mode 100644 index 000000000..d15cc8715 --- /dev/null +++ b/node_modules/@textlint/kernel/CHANGELOG.md @@ -0,0 +1,737 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.4.5](https://github.com/textlint/textlint/compare/@textlint/kernel@3.4.4...@textlint/kernel@3.4.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/kernel + + + + + +## [3.4.4](https://github.com/textlint/textlint/compare/@textlint/kernel@3.4.3...@textlint/kernel@3.4.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/kernel + + + + + + +## [3.4.3](https://github.com/textlint/textlint/compare/@textlint/kernel@3.4.2...@textlint/kernel@3.4.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [3.4.2](https://github.com/textlint/textlint/compare/@textlint/kernel@3.4.1...@textlint/kernel@3.4.2) (2021-02-06) + + +### Bug Fixes + +* **kernel:** fix `configBaseDir()` return correct base dir ([#742](https://github.com/textlint/textlint/issues/742)) ([8ae2dc1](https://github.com/textlint/textlint/commit/8ae2dc1)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [3.4.1](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.6...@textlint/kernel@3.4.1) (2021-01-22) + + +### Bug Fixes + +* **@textlint/kernel:** fix [@ts-expect-error](https://github.com/ts-expect-error) issue ([d58d79e](https://github.com/textlint/textlint/commit/d58d79e)) +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) +* **textlint:** textlint can't apply adjacent fixes ([#732](https://github.com/textlint/textlint/issues/732)) ([9ce71eb](https://github.com/textlint/textlint/commit/9ce71eb)) +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [3.4.0](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.6...@textlint/kernel@3.4.0) (2021-01-22) + + +### Bug Fixes + +* **@textlint/kernel:** fix [@ts-expect-error](https://github.com/ts-expect-error) issue ([d58d79e](https://github.com/textlint/textlint/commit/d58d79e)) +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) +* **textlint:** textlint can't apply adjacent fixes ([#732](https://github.com/textlint/textlint/issues/732)) ([9ce71eb](https://github.com/textlint/textlint/commit/9ce71eb)) +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [3.3.7](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.6...@textlint/kernel@3.3.7) (2020-12-22) + + +### Bug Fixes + +* **@textlint/kernel:** fix [@ts-expect-error](https://github.com/ts-expect-error) issue ([d58d79e](https://github.com/textlint/textlint/commit/d58d79e)) +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) +* **textlint:** textlint can't apply adjacent fixes ([#732](https://github.com/textlint/textlint/issues/732)) ([9ce71eb](https://github.com/textlint/textlint/commit/9ce71eb)) +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [3.3.6](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.5...@textlint/kernel@3.3.6) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [3.3.5](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.4...@textlint/kernel@3.3.5) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [3.3.4](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.3...@textlint/kernel@3.3.4) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [3.3.3](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.2...@textlint/kernel@3.3.3) (2020-07-24) + +**Note:** Version bump only for package @textlint/kernel + + + + + + +## [3.3.2](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.1...@textlint/kernel@3.3.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** down to deep-equal@2 ([70a4263](https://github.com/textlint/textlint/commit/70a4263)) + + + + + + +## [3.3.1](https://github.com/textlint/textlint/compare/@textlint/kernel@3.3.0...@textlint/kernel@3.3.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [3.3.0](https://github.com/textlint/textlint/compare/@textlint/kernel@3.2.1...@textlint/kernel@3.3.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [3.2.1](https://github.com/textlint/textlint/compare/@textlint/kernel@3.2.0...@textlint/kernel@3.2.1) (2020-02-07) + + +### Code Refactoring + +* **kernel:** use promise instead of bluebird ([c5eb768](https://github.com/textlint/textlint/commit/c5eb768)) + + + + + + +# [3.2.0](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.9...@textlint/kernel@3.2.0) (2020-01-07) + + +### Features + +* **kernel): support `prePrecess(:** { text, ast }` return value ([16301d7](https://github.com/textlint/textlint/commit/16301d7)) + + +### Tests + +* **kernel:** update dummyText ([1a88f98](https://github.com/textlint/textlint/commit/1a88f98)) + + + + + + +## [3.1.10](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.9...@textlint/kernel@3.1.10) (2019-11-03) + +**Note:** Version bump only for package @textlint/kernel + + + + + + +## [3.1.9](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.8...@textlint/kernel@3.1.9) (2019-10-14) + +**Note:** Version bump only for package @textlint/kernel + + + + + + +## [3.1.8](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.6...@textlint/kernel@3.1.8) (2019-07-20) + + +### Code Refactoring + +* **kernel:** remove object-assign ([24eed59](https://github.com/textlint/textlint/commit/24eed59)) +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [3.1.7](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.6...@textlint/kernel@3.1.7) (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [3.1.6](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.5...@textlint/kernel@3.1.6) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [3.1.5](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.4...@textlint/kernel@3.1.5) (2019-04-30) + + +### Bug Fixes + +* **test:** fix integration tests ([24422ad](https://github.com/textlint/textlint/commit/24422ad)) + + +### Code Refactoring + +* **textlint:** move normalization logic to [@textlint](https://github.com/textlint)/types ([9930809](https://github.com/textlint/textlint/commit/9930809)) + + + + + + +## [3.1.4](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.3...@textlint/kernel@3.1.4) (2019-02-10) + + +### Bug Fixes + +* **textlint:** fix regression for ignoreReport ([8d1c195](https://github.com/textlint/textlint/commit/8d1c195)), closes [#586](https://github.com/textlint/textlint/issues/586) [#586](https://github.com/textlint/textlint/issues/586) + + + + + + +## [3.1.3](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.2...@textlint/kernel@3.1.3) (2019-02-10) + + +### Bug Fixes + +* **textlint:** add reasonable debug log ([3931810](https://github.com/textlint/textlint/commit/3931810)) + + + + + + +## [3.1.2](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.1...@textlint/kernel@3.1.2) (2019-01-03) + + +### Bug Fixes + +* **textlint:** fix internal typing ([e2fde6c](https://github.com/textlint/textlint/commit/e2fde6c)) + + + + + + +## [3.1.1](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.0...@textlint/kernel@3.1.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/kernel + + + + + + +# [3.1.0](https://github.com/textlint/textlint/compare/@textlint/kernel@3.0.1...@textlint/kernel@3.1.0) (2019-01-01) + + +### Bug Fixes + +* **kernel:** fix type error ([214c287](https://github.com/textlint/textlint/commit/214c287)) +* **kernel:** refer to TextlintRuleContextReportFunctionArgs ([27e6968](https://github.com/textlint/textlint/commit/27e6968)) +* **types:** fix name of type definition ([67d9c49](https://github.com/textlint/textlint/commit/67d9c49)) + + +### Chores + +* **deps:** update eslint deps ([5bf2d38](https://github.com/textlint/textlint/commit/5bf2d38)) +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Code Refactoring + +* **kernel:** move report()/shouldIgnore() definition to types ([601ce3a](https://github.com/textlint/textlint/commit/601ce3a)) +* **kernel:** remove SeverityLevel.ts from kernel ([88a306c](https://github.com/textlint/textlint/commit/88a306c)) +* **types:** move type definition for rule to [@textlint](https://github.com/textlint)/types ([9be6e16](https://github.com/textlint/textlint/commit/9be6e16)) + + +### Documentation + +* **types:** Update README ([ab1e2ba](https://github.com/textlint/textlint/commit/ab1e2ba)) + + +### Features + +* **types:** Move TextlintResult/TextlintMessage type to [@textlint](https://github.com/textlint)/types ([b2a03a1](https://github.com/textlint/textlint/commit/b2a03a1)) + + +### Styles + +* **prettier:** format style by prettier ([19a2901](https://github.com/textlint/textlint/commit/19a2901)) + + +### Tests + +* **deps:** update no-todo rule reference ([6cecc88](https://github.com/textlint/textlint/commit/6cecc88)) +* **types:** Move SourceCode test to types ([ec61d65](https://github.com/textlint/textlint/commit/ec61d65)) + + + + + +## [3.0.1](https://github.com/textlint/textlint/compare/@textlint/kernel@3.0.0...@textlint/kernel@3.0.1) (2018-12-24) + + +### Bug Fixes + +* **kernel:** fix applyFix order on Node.js 11 ([714a90c](https://github.com/textlint/textlint/commit/714a90c)) + + + + + +# [3.0.0](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.9...@textlint/kernel@3.0.0) (2018-07-22) + + +### Bug Fixes + +* **kernel:** kernel use TextlintrcDescriptor ([efd89c2](https://github.com/textlint/textlint/commit/efd89c2)) +* **kernel:** make rule and plugin's option value {} by default ([b7aa63d](https://github.com/textlint/textlint/commit/b7aa63d)) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) +* remove [@textlint](https://github.com/textlint)/textlintrc-descriptor ([3613e1f](https://github.com/textlint/textlint/commit/3613e1f)) +* **kernel:** add comment ([582d0d6](https://github.com/textlint/textlint/commit/582d0d6)) +* **kernel:** add Processor validation ([86ed609](https://github.com/textlint/textlint/commit/86ed609)) +* **kernel:** fix test title ([4eeeff8](https://github.com/textlint/textlint/commit/4eeeff8)) +* **kernel:** support instance availableExtensions() method ([b821fc5](https://github.com/textlint/textlint/commit/b821fc5)) +* **textlint:** make static availableExtensions() optional ([d471637](https://github.com/textlint/textlint/commit/d471637)) +* **textlint:** use shallowMerge ([95d056d](https://github.com/textlint/textlint/commit/95d056d)) + + +### Code Refactoring + +* **kernel:** merge textlintrc-descriptor to kernel ([3c01067](https://github.com/textlint/textlint/commit/3c01067)) +* **kernel:** remove TextlintRuleDescriptorType ([a5b0f30](https://github.com/textlint/textlint/commit/a5b0f30)) +* **kernel:** Replace Object.freeze directly with factory function ([c43580b](https://github.com/textlint/textlint/commit/c43580b)) +* **kernel:** separate linter and fixer descriptor ([b5bc8bd](https://github.com/textlint/textlint/commit/b5bc8bd)) +* **kernel:** use textlintrc-descriptor instead of rule-creator-helper ([f0eb4bf](https://github.com/textlint/textlint/commit/f0eb4bf)) +* **textlintrc-descriptor:** Introduce textlintrc-descriptor ([6177794](https://github.com/textlint/textlint/commit/6177794)) +* **typescript:** update to TypeScript 2.8 ([f7b2b08](https://github.com/textlint/textlint/commit/f7b2b08)) + + +### Features + +* **kernel:** Freeze Context ([7fc9ec8](https://github.com/textlint/textlint/commit/7fc9ec8)), closes [#508](https://github.com/textlint/textlint/issues/508) [#508](https://github.com/textlint/textlint/issues/508) +* **textlint:** support availableExtensions() instance method in plugin ([a7cd053](https://github.com/textlint/textlint/commit/a7cd053)) + + +### Tests + +* **kernel:** Add missing Readonly ([c5313c8](https://github.com/textlint/textlint/commit/c5313c8)) +* **kernel:** add plugin's option tests ([f362257](https://github.com/textlint/textlint/commit/f362257)) +* **textlint:** add tests for object-to-kernel-format ([5fbb22d](https://github.com/textlint/textlint/commit/5fbb22d)) + + +### BREAKING CHANGES + +* **kernel:** Previously, textlint pass `true` to rule and plugin as default value of option. +This commit change the default value to `{}` (empty object). + +fix https://github.com/textlint/textlint/issues/535 + + + + + +## [2.0.9](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.8...@textlint/kernel@2.0.9) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/kernel + + +## [2.0.8](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.7...@textlint/kernel@2.0.8) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/kernel + + +## [2.0.7](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.6...@textlint/kernel@2.0.7) (2018-03-25) + + +### Chores + +* **test:** use `ts-node-test-register` for TypeScript testing ([be746d8](https://github.com/textlint/textlint/commit/be746d8)), closes [#451](https://github.com/textlint/textlint/issues/451) + + + + + +## [2.0.6](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.5...@textlint/kernel@2.0.6) (2018-01-27) + + +### Code Refactoring + +* **ast-traverse:** update usage of [@textlint](https://github.com/textlint)/ast-traverse ([133ab5a](https://github.com/textlint/textlint/commit/133ab5a)) +* **plugin-markdown:** update usage of [@textlint](https://github.com/textlint)/textlint-plugin-markdown ([d34ee08](https://github.com/textlint/textlint/commit/d34ee08)) + + + + + +## [2.0.5](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.4...@textlint/kernel@2.0.5) (2018-01-18) + + + + +**Note:** Version bump only for package @textlint/kernel + + +## [2.0.4](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.3...@textlint/kernel@2.0.4) (2018-01-12) + + +### Bug Fixes + +* **kernel:** fix return type of `SourceCode#getSource` ([1b55894](https://github.com/textlint/textlint/commit/1b55894)) +* **kernel:** pass the file path to preProcess() that is on FixerProcessor ([#458](https://github.com/textlint/textlint/issues/458)) ([5b947aa](https://github.com/textlint/textlint/commit/5b947aa)) + + + + + +## [2.0.2](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.1...@textlint/kernel@2.0.2) (2017-12-25) + + +### Bug Fixes + +* **kernel:** fix import path ([02d98fe](https://github.com/textlint/textlint/commit/02d98fe)) +* **monorepo:** fix TypeScript module resolution in monorepo ([d5df499](https://github.com/textlint/textlint/commit/d5df499)) + + + + + +## [2.0.1](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.0...@textlint/kernel@2.0.1) (2017-12-19) + + + + +**Note:** Version bump only for package @textlint/kernel + + +# [2.0.0](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.0-next.2...@textlint/kernel@2.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package @textlint/kernel + + +# [2.0.0-next.2](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.0-next.1...@textlint/kernel@2.0.0-next.2) (2017-12-18) + + + + +**Note:** Version bump only for package @textlint/kernel + + +# [2.0.0-next.1](https://github.com/textlint/textlint/compare/@textlint/kernel@2.0.0-next.0...@textlint/kernel@2.0.0-next.1) (2017-12-17) + + + + +**Note:** Version bump only for package @textlint/kernel + + +# [2.0.0-next.0](https://github.com/textlint/textlint/compare/@textlint/kernel@1.0.3...@textlint/kernel@2.0.0-next.0) (2017-12-15) + + +### Bug Fixes + +* **textlint:** fix kernel test ([#374](https://github.com/textlint/textlint/issues/374)) ([d6953cc](https://github.com/textlint/textlint/commit/d6953cc)) +* **textlint-fixer-formatter:** use paths ([734806f](https://github.com/textlint/textlint/commit/734806f)) + + + + + +## [1.0.3](https://github.com/textlint/textlint/compare/@textlint/kernel@1.0.2...@textlint/kernel@1.0.3) (2017-11-05) + + +### Bug Fixes + +* **textlint:** support scoped preset module ([#329](https://github.com/textlint/textlint/issues/329)) ([a2c8f6b](https://github.com/textlint/textlint/commit/a2c8f6b)) + + + + + +## [1.0.2](https://github.com/textlint/textlint/compare/@textlint/kernel@1.0.1...@textlint/kernel@1.0.2) (2017-11-03) + + + + +**Note:** Version bump only for package @textlint/kernel + + +# [1.0.0](https://github.com/textlint/textlint/compare/@textlint/kernel@1.0.0-beta.0...@textlint/kernel@1.0.0) (2017-10-28) + + + + +**Note:** Version bump only for package @textlint/kernel + + +## [0.2.1](https://github.com/textlint/textlint/compare/@textlint/kernel@0.2.0...@textlint/kernel@0.2.1) (2017-05-21) + + + + + +# [0.2.0](https://github.com/textlint/textlint/compare/@textlint/kernel@0.1.0...@textlint/kernel@0.2.0) (2017-05-21) + + +### Features + +* **textlint-kernel:** add `configBaseDir` option (#295) ([85dad8a](https://github.com/textlint/textlint/commit/85dad8a)) + + + + + +# 0.1.0 (2017-05-18) + + +### Features + +* **textlint-kernel:** Add [@textlint](https://github.com/textlint)/kernel (#292) ([30473c3](https://github.com/textlint/textlint/commit/30473c3)) diff --git a/node_modules/@textlint/kernel/LICENSE b/node_modules/@textlint/kernel/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/@textlint/kernel/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/kernel/README.md b/node_modules/@textlint/kernel/README.md new file mode 100644 index 000000000..7fdb4fae3 --- /dev/null +++ b/node_modules/@textlint/kernel/README.md @@ -0,0 +1,105 @@ +# @textlint/kernel + +textlint kernel is core logic by pure JavaScript. + +This module is a low layer of textlint. + +No plugin, No rule, No filter rule by default. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/kernel + +## Usage + +```js +import { TextlintKernel } from "@textlint/kernel"; +const kernel = new TextlintKernel(); +const options = { + filePath: "/path/to/file.md", + ext: ".md", + plugins: [ + { + pluginId: "markdown", + plugin: require("@textlint/textlint-plugin-markdown") + } + ], + rules: [ + { + ruleId: "no-todo", + rule: require("textlint-rule-no-todo").default + } + ] +}; +kernel.lintText("TODO: text", options).then(result => { + assert.ok(typeof result.filePath === "string"); + assert.ok(result.messages.length === 1); +}); +``` + +Notes: Preset is a collection of Rules. +Currently, `presets` option does not exist. + +## Type Interface + +`@textlint/kernel` export core types of textlint. + +If you use TypeScript, this types help you. + +```ts +// Types +import { + TextlintResult, + TextlintFixResult, + TextlintFixCommand, + TextlintMessage, + // Kernel rule/filter/plugin format + TextlintKernelRule, + TextlintKernelFilterRule, + TextlintKernelPlugin, + // textlint rule interface + TextlintRuleCreator, + TextlintRuleOptions, + // textlint filter rule interface + TextlintFilterRuleCreator, + TextlintFilterRuleOptions, + // textlint plugin interface + TextlintPluginCreator, + TextlintPluginOptions, + TextlintPluginProcessor, + TextlintPluginProcessorConstructor +} from "@textlint/kernel"; +``` + +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.d.ts b/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.d.ts new file mode 100644 index 000000000..dbc6e9b3f --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.d.ts @@ -0,0 +1,59 @@ +import type { TextlintRuleSeverityLevel, TextlintFilterRuleContextArgs, TextlintFilterRuleContext } from "@textlint/types"; +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +import { TextlintRuleErrorImpl } from "./TextlintRuleErrorImpl"; +export declare class TextlintFilterRuleContextImpl implements TextlintFilterRuleContext { + private _ruleId; + private _ignoreReport; + private _sourceCode; + private _configBaseDir?; + private _severityLevel; + constructor(args: TextlintFilterRuleContextArgs); + /** + * Rule id + * @returns {string} + */ + get id(): string; + get severity(): TextlintRuleSeverityLevel; + /** + * Node's type values + * @type {TextLintNodeType} + */ + get Syntax(): typeof ASTNodeTypes; + /** + * CustomError object + * @type {RuleError} + */ + get RuleError(): typeof TextlintRuleErrorImpl; + shouldIgnore: (range: [number, number], optional?: {}) => void; + /** + * Not use + * @returns {() => void} + */ + get report(): () => never; + /** + * get file path current processing. + */ + getFilePath: () => string | undefined; + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource: (node?: TxtNode | undefined, beforeCount?: number | undefined, afterCount?: number | undefined) => string; + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + getConfigBaseDir: () => string | undefined; +} diff --git a/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.js b/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.js new file mode 100644 index 000000000..1b781388c --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.js @@ -0,0 +1,106 @@ +import * as assert from "assert"; +import { TextlintRuleErrorImpl } from "./TextlintRuleErrorImpl"; +var TextlintFilterRuleContextImpl = /** @class */ (function () { + function TextlintFilterRuleContextImpl(args) { + var _this = this; + this.shouldIgnore = function (range, optional) { + if (optional === void 0) { optional = {}; } + assert.ok(Array.isArray(range) && typeof range[0] === "number" && typeof range[1] === "number", "shouldIgnore([number, number]); accept range."); + _this._ignoreReport({ ruleId: _this._ruleId, range: range, optional: optional }); + }; + /** + * get file path current processing. + */ + this.getFilePath = function () { + return _this._sourceCode.getFilePath(); + }; + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + this.getSource = function (node, beforeCount, afterCount) { + return _this._sourceCode.getSource(node, beforeCount, afterCount); + }; + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + this.getConfigBaseDir = function () { + return _this._configBaseDir; + }; + this._ruleId = args.ruleId; + this._sourceCode = args.sourceCode; + this._ignoreReport = args.ignoreReport; + this._configBaseDir = args.configBaseDir; + this._severityLevel = args.severityLevel; + Object.freeze(this); + } + Object.defineProperty(TextlintFilterRuleContextImpl.prototype, "id", { + /** + * Rule id + * @returns {string} + */ + get: function () { + return this._ruleId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleContextImpl.prototype, "severity", { + get: function () { + return this._severityLevel; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleContextImpl.prototype, "Syntax", { + /** + * Node's type values + * @type {TextLintNodeType} + */ + get: function () { + return this._sourceCode.getSyntax(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleContextImpl.prototype, "RuleError", { + /** + * CustomError object + * @type {RuleError} + */ + get: function () { + return TextlintRuleErrorImpl; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleContextImpl.prototype, "report", { + /** + * Not use + * @returns {() => void} + */ + get: function () { + return function () { + throw new Error("Filter rule can not report"); + }; + }, + enumerable: false, + configurable: true + }); + return TextlintFilterRuleContextImpl; +}()); +export { TextlintFilterRuleContextImpl }; +//# sourceMappingURL=TextlintFilterRuleContextImpl.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.js.map b/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.js.map new file mode 100644 index 000000000..13bab91d3 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintFilterRuleContextImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintFilterRuleContextImpl.js","sourceRoot":"","sources":["../../src/context/TextlintFilterRuleContextImpl.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;IAOI,uCAAY,IAAmC;QAA/C,iBAOC;QA8BD,iBAAY,GAAG,UAAC,KAAuB,EAAE,QAAa;YAAb,yBAAA,EAAA,aAAa;YAClD,MAAM,CAAC,EAAE,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EACpF,+CAA+C,CAClD,CAAC;YACF,KAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,KAAI,CAAC,OAAO,EAAE,KAAK,OAAA,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC;QAYF;;WAEG;QACH,gBAAW,GAAG;YACV,OAAO,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAC1C,CAAC,CAAC;QAEF;;;;;;WAMG;QACH,cAAS,GAAG,UAAC,IAAc,EAAE,WAAoB,EAAE,UAAmB;YAClE,OAAO,KAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QACrE,CAAC,CAAC;QAEF;;;;;;;;;;;;WAYG;QACH,qBAAgB,GAAG;YACf,OAAO,KAAI,CAAC,cAAc,CAAC;QAC/B,CAAC,CAAC;QAvFE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAMD,sBAAI,6CAAE;QAJN;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC;QACxB,CAAC;;;OAAA;IAED,sBAAI,mDAAQ;aAAZ;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAMD,sBAAI,iDAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QACxC,CAAC;;;OAAA;IAMD,sBAAI,oDAAS;QAJb;;;WAGG;aACH;YACI,OAAO,qBAAqB,CAAC;QACjC,CAAC;;;OAAA;IAcD,sBAAI,iDAAM;QAJV;;;WAGG;aACH;YACI,OAAO;gBACH,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAClD,CAAC,CAAC;QACN,CAAC;;;OAAA;IAoCL,oCAAC;AAAD,CAAC,AAhGD,IAgGC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.d.ts b/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.d.ts new file mode 100644 index 000000000..b1f5d8142 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.d.ts @@ -0,0 +1,113 @@ +import { TxtNode } from "@textlint/ast-node-types"; +import type { TextlintRuleContextFixCommandGenerator, TextlintSourceCodeRange } from "@textlint/types"; +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +export declare class TextlintRuleContextFixCommandGeneratorImpl implements TextlintRuleContextFixCommandGenerator { + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfter(node: TxtNode, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfterRange(range: TextlintSourceCodeRange, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBefore(node: TxtNode, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBeforeRange(range: TextlintSourceCodeRange, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceText(node: TxtNode, text: string): { + range: import("@textlint/ast-node-types").TextNodeRange; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceTextRange(range: TextlintSourceCodeRange, text: string): { + range: TextlintSourceCodeRange; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + remove(node: TxtNode): { + range: import("@textlint/ast-node-types").TextNodeRange; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + removeRange(range: TextlintSourceCodeRange): { + range: TextlintSourceCodeRange; + text: string; + isAbsolute: boolean; + }; +} diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.js b/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.js new file mode 100644 index 000000000..71fc6e4e0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.js @@ -0,0 +1,139 @@ +import * as assert from "assert"; +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAt(index, text) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text: text, + isAbsolute: false + }; +} +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAtAbsolute(index, text) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text: text, + isAbsolute: true + }; +} +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +var TextlintRuleContextFixCommandGeneratorImpl = /** @class */ (function () { + function TextlintRuleContextFixCommandGeneratorImpl() { + } + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.insertTextAfter = function (node, text) { + return insertTextAtAbsolute(node.range[1], text); + }; + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.insertTextAfterRange = function (range, text) { + return insertTextAt(range[1], text); + }; + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.insertTextBefore = function (node, text) { + return insertTextAtAbsolute(node.range[0], text); + }; + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.insertTextBeforeRange = function (range, text) { + return insertTextAt(range[0], text); + }; + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.replaceText = function (node, text) { + return { + range: node.range, + text: text, + isAbsolute: true + }; + }; + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.replaceTextRange = function (range, text) { + return { + range: range, + text: text, + isAbsolute: false + }; + }; + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.remove = function (node) { + return this.replaceText(node, ""); + }; + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + TextlintRuleContextFixCommandGeneratorImpl.prototype.removeRange = function (range) { + return this.replaceTextRange(range, ""); + }; + return TextlintRuleContextFixCommandGeneratorImpl; +}()); +export { TextlintRuleContextFixCommandGeneratorImpl }; +//# sourceMappingURL=TextlintRuleContextFixCommandGeneratorImpl.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.js.map b/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.js.map new file mode 100644 index 000000000..2751ddd59 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleContextFixCommandGeneratorImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintRuleContextFixCommandGeneratorImpl.js","sourceRoot":"","sources":["../../src/context/TextlintRuleContextFixCommandGeneratorImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAIjC;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,KAAa,EAAE,IAAY;IAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvC,OAAO;QACH,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACrB,IAAI,MAAA;QACJ,UAAU,EAAE,KAAK;KACpB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,KAAa,EAAE,IAAY;IACrD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvC,OAAO;QACH,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACrB,IAAI,MAAA;QACJ,UAAU,EAAE,IAAI;KACnB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH;IAAA;IAsGA,CAAC;IArGG;;;;;;OAMG;IACH,oEAAe,GAAf,UAAgB,IAAa,EAAE,IAAY;QACvC,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;OAQG;IACH,yEAAoB,GAApB,UAAqB,KAA8B,EAAE,IAAY;QAC7D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,qEAAgB,GAAhB,UAAiB,IAAa,EAAE,IAAY;QACxC,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;OAQG;IACH,0EAAqB,GAArB,UAAsB,KAA8B,EAAE,IAAY;QAC9D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,gEAAW,GAAX,UAAY,IAAa,EAAE,IAAY;QACnC,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,MAAA;YACJ,UAAU,EAAE,IAAI;SACnB,CAAC;IACN,CAAC;IAED;;;;;;;;OAQG;IACH,qEAAgB,GAAhB,UAAiB,KAA8B,EAAE,IAAY;QACzD,OAAO;YACH,KAAK,OAAA;YACL,IAAI,MAAA;YACJ,UAAU,EAAE,KAAK;SACpB,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACH,2DAAM,GAAN,UAAO,IAAa;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,gEAAW,GAAX,UAAY,KAA8B;QACtC,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IACL,iDAAC;AAAD,CAAC,AAtGD,IAsGC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.d.ts b/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.d.ts new file mode 100644 index 000000000..8cf6e8bcd --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.d.ts @@ -0,0 +1,66 @@ +import { TextlintRuleContext, TextlintRuleContextArgs, TextlintRuleError, TextlintRuleReportedObject, TextlintRuleSeverityLevel } from "@textlint/types"; +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +import { TextlintRuleContextFixCommandGeneratorImpl } from "./TextlintRuleContextFixCommandGeneratorImpl"; +import { TextlintRuleErrorImpl } from "./TextlintRuleErrorImpl"; +export declare class TextlintRuleContextImpl implements TextlintRuleContext { + private _ruleId; + private _sourceCode; + private _report; + private _configBaseDir?; + private _severityLevel; + constructor(args: TextlintRuleContextArgs); + /** + * Rule id + * @returns {string} + */ + get id(): string; + /** + * severity level + */ + get severity(): TextlintRuleSeverityLevel; + /** + * Node's type values + * @type {ASTNodeTypes} + */ + get Syntax(): typeof ASTNodeTypes; + /** + * CustomError object + * @type {RuleError} + */ + get RuleError(): typeof TextlintRuleErrorImpl; + /** + * Rule fixer command object + * @type {RuleFixer} + */ + get fixer(): TextlintRuleContextFixCommandGeneratorImpl; + /** + * report function that is called in a rule + */ + report: (node: TxtNode, ruleError: TextlintRuleError | TextlintRuleReportedObject, _shouldNotUsed?: any) => void; + /** + * get file path current processing. + */ + getFilePath: () => string | undefined; + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource: (node?: TxtNode | undefined, beforeCount?: number | undefined, afterCount?: number | undefined) => string; + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + getConfigBaseDir: () => string | undefined; +} diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.js b/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.js new file mode 100644 index 000000000..3b3ee217f --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.js @@ -0,0 +1,122 @@ +import assert from "assert"; +import { TextlintRuleContextFixCommandGeneratorImpl } from "./TextlintRuleContextFixCommandGeneratorImpl"; +import { TextlintRuleSeverityLevelKeys } from "./TextlintRuleSeverityLevelKeys"; +import { TextlintRuleErrorImpl } from "./TextlintRuleErrorImpl"; +var ruleFixer = new TextlintRuleContextFixCommandGeneratorImpl(); +var TextlintRuleContextImpl = /** @class */ (function () { + function TextlintRuleContextImpl(args) { + var _this = this; + /** + * report function that is called in a rule + */ + this.report = function (node, ruleError, _shouldNotUsed) { + assert.ok(!(node instanceof TextlintRuleErrorImpl), "1st argument should be node. Usage: `report(node, ruleError);`"); + assert.ok(_shouldNotUsed === undefined, "3rd argument should not be used. Usage: `report(node, ruleError);`"); + if (ruleError instanceof TextlintRuleErrorImpl) { + // severity come from `.textlintrc` option like `{ "" : { serverity: "warning" } } ` + _this._report({ ruleId: _this._ruleId, node: node, severity: _this._severityLevel, ruleError: ruleError }); + } + else { + var ruleReportedObject = ruleError; + // severity come from report arguments like `report(node, { severity: 1 })` + var level = ruleReportedObject.severity || TextlintRuleSeverityLevelKeys.error; + _this._report({ ruleId: _this._ruleId, node: node, severity: level, ruleError: ruleReportedObject }); + } + }; + /** + * get file path current processing. + */ + this.getFilePath = function () { + return _this._sourceCode.getFilePath(); + }; + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + this.getSource = function (node, beforeCount, afterCount) { + return _this._sourceCode.getSource(node, beforeCount, afterCount); + }; + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + this.getConfigBaseDir = function () { + return _this._configBaseDir; + }; + this._ruleId = args.ruleId; + this._sourceCode = args.sourceCode; + this._report = args.report; + this._configBaseDir = args.configBaseDir; + this._severityLevel = args.severityLevel; + Object.freeze(this); + } + Object.defineProperty(TextlintRuleContextImpl.prototype, "id", { + /** + * Rule id + * @returns {string} + */ + get: function () { + return this._ruleId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleContextImpl.prototype, "severity", { + /** + * severity level + */ + get: function () { + return this._severityLevel; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleContextImpl.prototype, "Syntax", { + /** + * Node's type values + * @type {ASTNodeTypes} + */ + get: function () { + return this._sourceCode.getSyntax(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleContextImpl.prototype, "RuleError", { + /** + * CustomError object + * @type {RuleError} + */ + get: function () { + return TextlintRuleErrorImpl; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleContextImpl.prototype, "fixer", { + /** + * Rule fixer command object + * @type {RuleFixer} + */ + get: function () { + return ruleFixer; + }, + enumerable: false, + configurable: true + }); + return TextlintRuleContextImpl; +}()); +export { TextlintRuleContextImpl }; +//# sourceMappingURL=TextlintRuleContextImpl.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.js.map b/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.js.map new file mode 100644 index 000000000..f01f56b99 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleContextImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintRuleContextImpl.js","sourceRoot":"","sources":["../../src/context/TextlintRuleContextImpl.ts"],"names":[],"mappings":"AAUA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,0CAA0C,EAAE,MAAM,8CAA8C,CAAC;AAC1G,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,IAAM,SAAS,GAAG,IAAI,0CAA0C,EAAE,CAAC;AAEnE;IAOI,iCAAY,IAA6B;QAAzC,iBAOC;QAyCD;;WAEG;QACH,WAAM,GAAG,UAAC,IAAa,EAAE,SAAyD,EAAE,cAAoB;YACpG,MAAM,CAAC,EAAE,CACL,CAAC,CAAC,IAAI,YAAY,qBAAqB,CAAC,EACxC,gEAAgE,CACnE,CAAC;YACF,MAAM,CAAC,EAAE,CAAC,cAAc,KAAK,SAAS,EAAE,oEAAoE,CAAC,CAAC;YAC9G,IAAI,SAAS,YAAY,qBAAqB,EAAE;gBAC5C,+FAA+F;gBAC/F,KAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAI,CAAC,OAAO,EAAE,IAAI,MAAA,EAAE,QAAQ,EAAE,KAAI,CAAC,cAAc,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;aAC1F;iBAAM;gBACH,IAAM,kBAAkB,GAA+B,SAAS,CAAC;gBACjE,2EAA2E;gBAC3E,IAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,IAAI,6BAA6B,CAAC,KAAK,CAAC;gBACjF,KAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAI,CAAC,OAAO,EAAE,IAAI,MAAA,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;aAChG;QACL,CAAC,CAAC;QAEF;;WAEG;QACH,gBAAW,GAAG;YACV,OAAO,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAC1C,CAAC,CAAC;QAEF;;;;;;WAMG;QACH,cAAS,GAAG,UAAC,IAAc,EAAE,WAAoB,EAAE,UAAmB;YAClE,OAAO,KAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QACrE,CAAC,CAAC;QAEF;;;;;;;;;;;;WAYG;QACH,qBAAgB,GAAG;YACf,OAAO,KAAI,CAAC,cAAc,CAAC;QAC/B,CAAC,CAAC;QApGE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAMD,sBAAI,uCAAE;QAJN;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC;QACxB,CAAC;;;OAAA;IAKD,sBAAI,6CAAQ;QAHZ;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAMD,sBAAI,2CAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QACxC,CAAC;;;OAAA;IAMD,sBAAI,8CAAS;QAJb;;;WAGG;aACH;YACI,OAAO,qBAAqB,CAAC;QACjC,CAAC;;;OAAA;IAMD,sBAAI,0CAAK;QAJT;;;WAGG;aACH;YACI,OAAO,SAAS,CAAC;QACrB,CAAC;;;OAAA;IAwDL,8BAAC;AAAD,CAAC,AA7GD,IA6GC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.d.ts b/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.d.ts new file mode 100644 index 000000000..606775dc4 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.d.ts @@ -0,0 +1,17 @@ +import type { TextlintRuleContextFixCommand, TextlintRuleErrorPadding, TextlintRuleError } from "@textlint/types"; +export declare class TextlintRuleErrorImpl implements TextlintRuleError { + message: string; + line?: number; + column?: number; + index?: number; + fix?: TextlintRuleContextFixCommand; + /** + * RuleError is like Error object. + * It's used for adding to TextlintResult. + * @param message error message should start with lowercase letter + * @param [paddingLocation] - the object has padding {line, column} for actual error reason + * @constructor + */ + constructor(message: string, paddingLocation?: number | TextlintRuleErrorPadding); + toString(): string; +} diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.js b/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.js new file mode 100644 index 000000000..b007f58cc --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.js @@ -0,0 +1,53 @@ +// LICENSE : MIT +"use strict"; +var TextlintRuleErrorImpl = /** @class */ (function () { + /** + * RuleError is like Error object. + * It's used for adding to TextlintResult. + * @param message error message should start with lowercase letter + * @param [paddingLocation] - the object has padding {line, column} for actual error reason + * @constructor + */ + function TextlintRuleErrorImpl(message, paddingLocation) { + this.message = message; + if (typeof paddingLocation === "object") { + /** + * padding lineNumber + * @type {number} + */ + this.line = paddingLocation.line; + /** + * padding column + * @type {number} + */ + this.column = paddingLocation.column; + /** + * padding index + * @type {number} + */ + this.index = paddingLocation.index; + /** + * fixCommand object + * @type {TextlintRuleContextFixCommand} + */ + this.fix = paddingLocation.fix; + } + else if (typeof paddingLocation === "number") { + // this is deprecated + // should pass padding as object. + this.column = paddingLocation; + } + } + TextlintRuleErrorImpl.prototype.toString = function () { + return JSON.stringify({ + message: this.message, + line: this.line, + column: this.column, + index: this.index, + fix: this.fix + }); + }; + return TextlintRuleErrorImpl; +}()); +export { TextlintRuleErrorImpl }; +//# sourceMappingURL=TextlintRuleErrorImpl.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.js.map b/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.js.map new file mode 100644 index 000000000..5f99fbfc3 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleErrorImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintRuleErrorImpl.js","sourceRoot":"","sources":["../../src/context/TextlintRuleErrorImpl.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAIb;IAOI;;;;;;OAMG;IACH,+BAAY,OAAe,EAAE,eAAmD;QAC5E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;YACrC;;;eAGG;YACH,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;YACjC;;;eAGG;YACH,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;YACrC;;;eAGG;YACH,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC;YACnC;;;eAGG;YACH,IAAI,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;SAClC;aAAM,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;YAC5C,qBAAqB;YACrB,iCAAiC;YACjC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;SACjC;IACL,CAAC;IAED,wCAAQ,GAAR;QACI,OAAO,IAAI,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;IACP,CAAC;IACL,4BAAC;AAAD,CAAC,AArDD,IAqDC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.d.ts b/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.d.ts new file mode 100644 index 000000000..c8feb444c --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.d.ts @@ -0,0 +1,7 @@ +import type { TextlintRuleSeverityLevel } from "@textlint/types"; +/** + * Keys of TextlintRuleSeverityLevel + */ +export declare const TextlintRuleSeverityLevelKeys: { + [index: string]: TextlintRuleSeverityLevel; +}; diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.js b/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.js new file mode 100644 index 000000000..fa0258db9 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.js @@ -0,0 +1,10 @@ +/** + * Keys of TextlintRuleSeverityLevel + */ +export var TextlintRuleSeverityLevelKeys = { + none: 0, + info: 0, + warning: 1, + error: 2 +}; +//# sourceMappingURL=TextlintRuleSeverityLevelKeys.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.js.map b/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.js.map new file mode 100644 index 000000000..d6e3c613a --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintRuleSeverityLevelKeys.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintRuleSeverityLevelKeys.js","sourceRoot":"","sources":["../../src/context/TextlintRuleSeverityLevelKeys.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,IAAM,6BAA6B,GAEtC;IACA,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;CACX,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.d.ts b/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.d.ts new file mode 100644 index 000000000..0b3521e87 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.d.ts @@ -0,0 +1,57 @@ +import type { TextlintSourceCode, TextlintSourceCodeArgs, TextlintSourceCodeLocation, TextlintSourceCodePosition, TextlintSourceCodeRange } from "@textlint/types"; +import { AnyTxtNode, ASTNodeTypes } from "@textlint/ast-node-types"; +/** + * This class represent of source code. + */ +export declare class TextlintSourceCodeImpl implements TextlintSourceCode { + hasBOM: boolean; + text: string; + ast: AnyTxtNode; + filePath: string | undefined; + ext: string; + private _structuredSource; + /** + * @param {string} text + * @param {Object} ast + * @param {string} ext + * @param {string} [filePath] + */ + constructor({ text, ast, ext, filePath }: TextlintSourceCodeArgs); + /** + * @returns {ASTNodeTypes} + */ + getSyntax(): typeof ASTNodeTypes; + /** + * get filePath + * @returns {string|undefined} + */ + getFilePath(): string | undefined; + /** + * Gets the source code for the given node. + * @param {AnyTxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource(node?: AnyTxtNode, beforeCount?: number, afterCount?: number): string; + /** + * @param {TextlintSourceCodeLocation} loc - location indicator. + * @return {[ number, number ]} range. + */ + locationToRange(loc: TextlintSourceCodeLocation): TextlintSourceCodeRange; + /** + * @param {[ number, number ]} range - pair of indice. + * @return {TextlintSourceCodeLocation} location. + */ + rangeToLocation(range: TextlintSourceCodeRange): TextlintSourceCodeLocation; + /** + * @param {Position} pos - position indicator. + * @return {number} index. + */ + positionToIndex(pos: TextlintSourceCodePosition): number; + /** + * @param {number} index - index to the source code. + * @return {Position} position. + */ + indexToPosition(index: number): TextlintSourceCodePosition; +} diff --git a/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.js b/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.js new file mode 100644 index 000000000..eff78db1e --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.js @@ -0,0 +1,110 @@ +import { ASTNodeTypes } from "@textlint/ast-node-types"; +import * as assert from "assert"; +import StructuredSource from "structured-source"; +/** + * Validates that the given AST has the required information. + * @param {AnyTxtNode} [ast] The Program node of the AST to check. + * @throws {Error} If the AST doesn't contain the correct information. + * @returns {void} + * @private + */ +function validate(ast) { + if (!ast.loc) { + throw new Error("AST is missing location information."); + } + if (!ast.range) { + throw new Error("AST is missing range information"); + } +} +/** + * This class represent of source code. + */ +var TextlintSourceCodeImpl = /** @class */ (function () { + /** + * @param {string} text + * @param {Object} ast + * @param {string} ext + * @param {string} [filePath] + */ + function TextlintSourceCodeImpl(_a) { + var _b = _a.text, text = _b === void 0 ? "" : _b, ast = _a.ast, ext = _a.ext, filePath = _a.filePath; + validate(ast); + assert.ok(ext || filePath, "should be set either of fileExt or filePath."); + this.hasBOM = text.charCodeAt(0) === 0xfeff; + this.text = this.hasBOM ? text.slice(1) : text; + /** + * @type StructuredSource + */ + this._structuredSource = new StructuredSource(this.text); + this.ast = ast; + this.filePath = filePath; + /** + * fileType .md .txt ... + * @type {string} + */ + this.ext = ext; + } + /** + * @returns {ASTNodeTypes} + */ + TextlintSourceCodeImpl.prototype.getSyntax = function () { + return ASTNodeTypes; + }; + /** + * get filePath + * @returns {string|undefined} + */ + TextlintSourceCodeImpl.prototype.getFilePath = function () { + return this.filePath; + }; + /** + * Gets the source code for the given node. + * @param {AnyTxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + TextlintSourceCodeImpl.prototype.getSource = function (node, beforeCount, afterCount) { + var currentText = this.text; + if (node) { + var start = Math.max(node.range[0] - (beforeCount || 0), 0); + var end = node.range[1] + (afterCount || 0); + return currentText.slice(start, end); + } + else { + return currentText; + } + }; + // StructuredSource wrapper + /** + * @param {TextlintSourceCodeLocation} loc - location indicator. + * @return {[ number, number ]} range. + */ + TextlintSourceCodeImpl.prototype.locationToRange = function (loc) { + return this._structuredSource.locationToRange(loc); + }; + /** + * @param {[ number, number ]} range - pair of indice. + * @return {TextlintSourceCodeLocation} location. + */ + TextlintSourceCodeImpl.prototype.rangeToLocation = function (range) { + return this._structuredSource.rangeToLocation(range); + }; + /** + * @param {Position} pos - position indicator. + * @return {number} index. + */ + TextlintSourceCodeImpl.prototype.positionToIndex = function (pos) { + return this._structuredSource.positionToIndex(pos); + }; + /** + * @param {number} index - index to the source code. + * @return {Position} position. + */ + TextlintSourceCodeImpl.prototype.indexToPosition = function (index) { + return this._structuredSource.indexToPosition(index); + }; + return TextlintSourceCodeImpl; +}()); +export { TextlintSourceCodeImpl }; +//# sourceMappingURL=TextlintSourceCodeImpl.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.js.map b/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.js.map new file mode 100644 index 000000000..a1b2c8fa9 --- /dev/null +++ b/node_modules/@textlint/kernel/module/context/TextlintSourceCodeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintSourceCodeImpl.js","sourceRoot":"","sources":["../../src/context/TextlintSourceCodeImpl.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AAEjD;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,GAAe;IAC7B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;KAC3D;IAED,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACvD;AACL,CAAC;AAED;;GAEG;AACH;IASI;;;;;OAKG;IACH,gCAAY,EAAyD;YAAvD,YAAS,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,GAAG,SAAA,EAAE,GAAG,SAAA,EAAE,QAAQ,cAAA;QACvC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,QAAQ,EAAE,8CAA8C,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/C;;WAEG;QACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB;;;WAGG;QACH,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,0CAAS,GAAT;QACI,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,4CAAW,GAAX;QACI,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,0CAAS,GAAT,UAAU,IAAiB,EAAE,WAAoB,EAAE,UAAmB;QAClE,IAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9B,IAAI,IAAI,EAAE;YACN,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9D,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;YAC9C,OAAO,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SACxC;aAAM;YACH,OAAO,WAAW,CAAC;SACtB;IACL,CAAC;IAED,2BAA2B;IAC3B;;;OAGG;IACH,gDAAe,GAAf,UAAgB,GAA+B;QAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,gDAAe,GAAf,UAAgB,KAA8B;QAC1C,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,gDAAe,GAAf,UAAgB,GAA+B;QAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,gDAAe,GAAf,UAAgB,KAAa;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IACL,6BAAC;AAAD,CAAC,AAlGD,IAkGC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/core/source-location.d.ts b/node_modules/@textlint/kernel/module/core/source-location.d.ts new file mode 100644 index 000000000..a9c72cfda --- /dev/null +++ b/node_modules/@textlint/kernel/module/core/source-location.d.ts @@ -0,0 +1,25 @@ +import type { TextlintMessageFixCommand, TextlintRuleContextReportFunctionArgs, TextlintRuleError, TextlintSourceCode } from "@textlint/types"; +export interface ReportMessage { + ruleId: string; + node: any; + severity: number; + ruleError: TextlintRuleError; +} +export default class SourceLocation { + private source; + constructor(source: TextlintSourceCode); + /** + * adjust node's location with error's padding location. + */ + adjust(reportArgs: TextlintRuleContextReportFunctionArgs): { + line: number; + column: number; + fix?: TextlintMessageFixCommand; + }; + private toAbsoluteLocation; + /** + * Adjust `fix` command range + * if `fix.isAbsolute` is not absolute position, adjust the position from the `node`. + */ + private toAbsolutePositionFix; +} diff --git a/node_modules/@textlint/kernel/module/core/source-location.js b/node_modules/@textlint/kernel/module/core/source-location.js new file mode 100644 index 000000000..bdafb07b3 --- /dev/null +++ b/node_modules/@textlint/kernel/module/core/source-location.js @@ -0,0 +1,145 @@ +import assert from "assert"; +import { throwIfTesting } from "@textlint/feature-flag"; +var SourceLocation = /** @class */ (function () { + function SourceLocation(source) { + this.source = source; + } + /** + * adjust node's location with error's padding location. + */ + SourceLocation.prototype.adjust = function (reportArgs) { + var node = reportArgs.node, ruleError = reportArgs.ruleError, ruleId = reportArgs.ruleId; + var errorPrefix = "[" + ruleId + "]" || ""; + var padding = ruleError; + /* + FIXME: It is old and un-document way + new RuleError("message", index); + */ + var _backwardCompatibleIndexValue; + if (typeof padding === "number") { + _backwardCompatibleIndexValue = padding; + throwIfTesting(errorPrefix + " This is un-document way:\nreport(node, new RuleError(\"message\", index);\n\nPlease use { index }: \n\nreport(node, new RuleError(\"message\", {\n index: paddingLineColumn\n});\n"); + } + // when running from textlint-tester, assert + if (padding.line === undefined && padding.column !== undefined) { + // FIXME: Backward compatible <= textlint.5.5 + throwIfTesting(errorPrefix + " Have to use a sets with \"line\" and \"column\".\nSee FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/line-column-or-index.md \n\nreport(node, new RuleError(\"message\", {\n line: paddingLineNumber,\n column: paddingLineColumn\n});\n\nOR use \"index\" property insteadof only \"column\".\n\nreport(node, new RuleError(\"message\", {\n index: paddingLineColumn\n});\n"); + } + // When either one of {column, line} or {index} is not used, throw error + if ((padding.line !== undefined || padding.column !== undefined) && padding.index !== undefined) { + // Introduced textlint 5.6 + // https://github.com/textlint/textlint/releases/tag/5.6.0 + // Always throw Error + throw new Error(errorPrefix + " Have to use one of {line, column} or {index}.\nYou should use either one:\n\nuse \"line\" and \"column\" property\n\nreport(node, new RuleError(\"message\", {\n line: paddingLineNumber,\n column: paddingLineColumn\n});\n\nOR \n\nuse \"index\" property\n\nreport(node, new RuleError(\"message\", {\n index: paddingIndexValue\n});\n"); + } + var adjustedLoc = this.toAbsoluteLocation(node, padding, _backwardCompatibleIndexValue); + var adjustedFix = this.toAbsolutePositionFix(node, padding); + /* + { + line, + column + fix? + } + */ + return Object.assign({}, adjustedLoc, adjustedFix); + }; + SourceLocation.prototype.toAbsoluteLocation = function (node, padding, _paddingIndex) { + var nodeRange = node.range; + var line = node.loc.start.line; + var column = node.loc.start.column; + // when use {index} + if (padding.index !== undefined || _paddingIndex !== undefined) { + var startNodeIndex = nodeRange[0]; + var paddingIndex = _paddingIndex || padding.index; + var position = this.source.indexToPosition(startNodeIndex + paddingIndex); + return { + column: position.column, + line: position.line + }; + } + // when use {line, column} + if (padding.line !== undefined && padding.column !== undefined) { + if (padding.line > 0) { + var addedLine = line + padding.line; + // when report with padding {line, column}, message.column should be 0 + padding.column. + // In other word, padding line > 0 and message.column start with 0. + if (padding.column > 0) { + return { + line: addedLine, + column: padding.column + }; + } + else { + return { + line: addedLine, + column: column + }; + } + } + } + // when use { line } only + if (padding.line !== undefined && padding.line > 0) { + var addedLine = line + padding.line; + return { + line: addedLine, + column: column + }; + } + // when use { column } only + // FIXME: backward compatible @ un-document + // Remove next version 6? + /* + new RuleError({ + column: index + }); + */ + if (padding.column !== undefined && padding.column > 0) { + var addedColumn = column + padding.column; + return { + line: line, + column: addedColumn + }; + } + return { + column: column, + line: line + }; + }; + /** + * Adjust `fix` command range + * if `fix.isAbsolute` is not absolute position, adjust the position from the `node`. + */ + SourceLocation.prototype.toAbsolutePositionFix = function (node, ruleErrorObject) { + var nodeRange = node.range; + // if not found `fix`, return empty object + if (ruleErrorObject.fix === undefined) { + return {}; + } + assert.ok(typeof ruleErrorObject.fix === "object", "fix should be FixCommand object"); + // if absolute position return self + if (ruleErrorObject.fix.isAbsolute) { + return { + // remove other property that is not related `fix` + // the return object will be merged by `Object.assign` + fix: { + range: ruleErrorObject.fix.range, + text: ruleErrorObject.fix.text + } + }; + } + // if relative position return adjusted position + return { + // fix(command) is relative from node's range + fix: { + range: [ + nodeRange[0] + ruleErrorObject.fix.range[0], + nodeRange[0] + ruleErrorObject.fix.range[1] + ], + text: ruleErrorObject.fix.text + } + }; + }; + return SourceLocation; +}()); +export default SourceLocation; +//# sourceMappingURL=source-location.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/core/source-location.js.map b/node_modules/@textlint/kernel/module/core/source-location.js.map new file mode 100644 index 000000000..2bc32ff3f --- /dev/null +++ b/node_modules/@textlint/kernel/module/core/source-location.js.map @@ -0,0 +1 @@ +{"version":3,"file":"source-location.js","sourceRoot":"","sources":["../../src/core/source-location.ts"],"names":[],"mappings":"AAQA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AASxD;IAGI,wBAAY,MAA0B;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,+BAAM,GAAN,UACI,UAAiD;QAEzC,IAAA,IAAI,GAAwB,UAAU,KAAlC,EAAE,SAAS,GAAa,UAAU,UAAvB,EAAE,MAAM,GAAK,UAAU,OAAf,CAAgB;QAC/C,IAAM,WAAW,GAAG,MAAI,MAAM,MAAG,IAAI,EAAE,CAAC;QACxC,IAAM,OAAO,GAAG,SAAS,CAAC;QAC1B;;;WAGG;QACH,IAAI,6BAA6B,CAAC;QAClC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC7B,6BAA6B,GAAG,OAAO,CAAC;YACxC,cAAc,CAAI,WAAW,2LAQxC,CAAC,CAAC;SACM;QACD,4CAA4C;QAC5C,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;YAC5D,6CAA6C;YAC7C,cAAc,CAAI,WAAW,uZAaxC,CAAC,CAAC;SACM;QAED,wEAAwE;QACxE,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE;YAC7F,0BAA0B;YAC1B,0DAA0D;YAC1D,qBAAqB;YACrB,MAAM,IAAI,KAAK,CAAI,WAAW,yVAiBzC,CAAC,CAAC;SACM;QAED,IAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,6BAA6B,CAAC,CAAC;QAC1F,IAAM,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9D;;;;;;WAMG;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,WAAW,CAIhD,CAAC;IACN,CAAC;IAEO,2CAAkB,GAA1B,UAA2B,IAAS,EAAE,OAAiC,EAAE,aAAsB;QAC3F,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC,IAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;QAErC,mBAAmB;QACnB,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,EAAE;YAC5D,IAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACpC,IAAM,YAAY,GAAG,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC;YACpD,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,GAAG,YAAY,CAAC,CAAC;YAC5E,OAAO;gBACH,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;aACtB,CAAC;SACL;QACD,0BAA0B;QAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;YAC5D,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE;gBAClB,IAAM,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACtC,wFAAwF;gBACxF,mEAAmE;gBACnE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;oBACpB,OAAO;wBACH,IAAI,EAAE,SAAS;wBACf,MAAM,EAAE,OAAO,CAAC,MAAM;qBACzB,CAAC;iBACL;qBAAM;oBACH,OAAO;wBACH,IAAI,EAAE,SAAS;wBACf,MAAM,QAAA;qBACT,CAAC;iBACL;aACJ;SACJ;QACD,yBAAyB;QACzB,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE;YAChD,IAAM,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACtC,OAAO;gBACH,IAAI,EAAE,SAAS;gBACf,MAAM,QAAA;aACT,CAAC;SACL;QACD,2BAA2B;QAC3B,2CAA2C;QAC3C,yBAAyB;QACzB;;;;WAIG;QACH,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACpD,IAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC5C,OAAO;gBACH,IAAI,MAAA;gBACJ,MAAM,EAAE,WAAW;aACtB,CAAC;SACL;QAED,OAAO;YACH,MAAM,QAAA;YACN,IAAI,MAAA;SACP,CAAC;IACN,CAAC;IAED;;;OAGG;IACK,8CAAqB,GAA7B,UAA8B,IAAa,EAAE,eAAkC;QAC3E,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,0CAA0C;QAC1C,IAAI,eAAe,CAAC,GAAG,KAAK,SAAS,EAAE;YACnC,OAAO,EAAE,CAAC;SACb;QACD,MAAM,CAAC,EAAE,CAAC,OAAO,eAAe,CAAC,GAAG,KAAK,QAAQ,EAAE,iCAAiC,CAAC,CAAC;QACtF,mCAAmC;QACnC,IAAI,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE;YAChC,OAAO;gBACH,kDAAkD;gBAClD,sDAAsD;gBACtD,GAAG,EAAE;oBACD,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK;oBAChC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC,IAAI;iBACjC;aACJ,CAAC;SACL;QACD,gDAAgD;QAChD,OAAO;YACH,6CAA6C;YAC7C,GAAG,EAAE;gBACD,KAAK,EAAE;oBACH,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;oBAC3C,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;iBACrC;gBACV,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC,IAAI;aACjC;SACJ,CAAC;IACN,CAAC;IACL,qBAAC;AAAD,CAAC,AA/LD,IA+LC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/Descriptor.d.ts b/node_modules/@textlint/kernel/module/descriptor/Descriptor.d.ts new file mode 100644 index 000000000..21c698b91 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/Descriptor.d.ts @@ -0,0 +1,5 @@ +export interface Descriptor { + id: string; + equals(target: this): boolean; + toKernel(): T; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/Descriptor.js b/node_modules/@textlint/kernel/module/descriptor/Descriptor.js new file mode 100644 index 000000000..87ccede8d --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/Descriptor.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Descriptor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/Descriptor.js.map b/node_modules/@textlint/kernel/module/descriptor/Descriptor.js.map new file mode 100644 index 000000000..6271b5a40 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/Descriptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../src/descriptor/Descriptor.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.d.ts b/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.d.ts new file mode 100644 index 000000000..0e89396a6 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.d.ts @@ -0,0 +1,9 @@ +import { Descriptor } from "./Descriptor"; +/** + * Remove duplicated descriptor + * For example, A1 equals to A2 + * [A1, B, A2] + * => filter + * [A1, B] + */ +export declare const filterDuplicateDescriptor: >(descriptors: T[]) => T[]; diff --git a/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.js b/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.js new file mode 100644 index 000000000..01eb9a164 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.js @@ -0,0 +1,20 @@ +/** + * Remove duplicated descriptor + * For example, A1 equals to A2 + * [A1, B, A2] + * => filter + * [A1, B] + */ +export var filterDuplicateDescriptor = function (descriptors) { + var newDescriptorList = []; + descriptors.forEach(function (descriptor) { + var existsDescriptor = newDescriptorList.some(function (existDescriptor) { + return existDescriptor.equals(descriptor); + }); + if (!existsDescriptor) { + newDescriptorList.push(descriptor); + } + }); + return newDescriptorList; +}; +//# sourceMappingURL=DescriptorUtil.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.js.map b/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.js.map new file mode 100644 index 000000000..4da56c043 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/DescriptorUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DescriptorUtil.js","sourceRoot":"","sources":["../../src/descriptor/DescriptorUtil.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAA4B,WAAgB;IACjF,IAAM,iBAAiB,GAAQ,EAAE,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QAC3B,IAAM,gBAAgB,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAC,eAAe;YAC5D,OAAO,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,EAAE;YACnB,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACtC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC7B,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.d.ts b/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.d.ts new file mode 100644 index 000000000..6388b466e --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.d.ts @@ -0,0 +1,7 @@ +import { TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +import { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +import { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +export declare const createTextlintRuleDescriptors: (rules: TextlintKernelRule[]) => TextlintRuleDescriptors; +export declare const createTextlintFilterRuleDescriptors: (rules: TextlintKernelFilterRule[]) => TextlintFilterRuleDescriptors; +export declare const createTextlintPluginDescriptors: (rules: TextlintKernelPlugin[]) => TextlintPluginDescriptors; diff --git a/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.js b/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.js new file mode 100644 index 000000000..c3d8af197 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.js @@ -0,0 +1,28 @@ +// LICENSE : MIT +"use strict"; +import { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +import { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +import { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +import { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; +import { hasFixer } from "./rule-creator-helper"; +import { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; +export var createTextlintRuleDescriptors = function (rules) { + var ruleOrFixableRuleDescriptorList = rules.map(function (rule) { + if (hasFixer(rule.rule)) { + return new TextlintFixableRuleDescriptor(rule); + } + else { + return new TextlintLintableRuleDescriptor(rule); + } + }); + return new TextlintRuleDescriptors(ruleOrFixableRuleDescriptorList); +}; +export var createTextlintFilterRuleDescriptors = function (rules) { + return new TextlintFilterRuleDescriptors(rules.map(function (rule) { return new TextlintFilterRuleDescriptor(rule); })); +}; +export var createTextlintPluginDescriptors = function (rules) { + return new TextlintPluginDescriptors(rules.map(function (rule) { return new TextlintPluginDescriptor(rule); })); +}; +//# sourceMappingURL=DescriptorsFactory.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.js.map b/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.js.map new file mode 100644 index 000000000..ef028a395 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/DescriptorsFactory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DescriptorsFactory.js","sourceRoot":"","sources":["../../src/descriptor/DescriptorsFactory.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAC,IAAM,6BAA6B,GAAG,UAAC,KAA2B;IACrE,IAAM,+BAA+B,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;QACnD,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO,IAAI,6BAA6B,CAAC,IAAI,CAAC,CAAC;SAClD;aAAM;YACH,OAAO,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC;SACnD;IACL,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,uBAAuB,CAAC,+BAA+B,CAAC,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,mCAAmC,GAAG,UAAC,KAAiC;IACjF,OAAO,IAAI,6BAA6B,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,4BAA4B,CAAC,IAAI,CAAC,EAAtC,CAAsC,CAAC,CAAC,CAAC;AAC1G,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,+BAA+B,GAAG,UAAC,KAA6B;IACzE,OAAO,IAAI,yBAAyB,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,wBAAwB,CAAC,IAAI,CAAC,EAAlC,CAAkC,CAAC,CAAC,CAAC;AAClG,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.d.ts new file mode 100644 index 000000000..eb5eb27ab --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.d.ts @@ -0,0 +1,33 @@ +import { TextlintKernelFilterRule } from "../textlint-kernel-interface"; +import { Descriptor } from "./Descriptor"; +import type { TextlintFilterRuleOptions, TextlintFilterRuleReporter } from "@textlint/types"; +/** + * Textlint Rule Descriptor. + * It handle RuleCreator and RuleOption. + */ +export declare class TextlintFilterRuleDescriptor implements Descriptor { + private kernelFilterRule; + constructor(kernelFilterRule: TextlintKernelFilterRule); + get id(): string; + get rule(): TextlintFilterRuleReporter; + /** + * Return true if this rule is enabled. + */ + get enabled(): boolean; + /** + * Return filter function + * You should check hasLiner before call this. + */ + get filter(): TextlintFilterRuleReporter; + /** + * Return normalized rule option object. + * If the rule have not option, return `true` by default. + */ + get normalizedOptions(): TextlintFilterRuleOptions; + get rawOptions(): undefined | boolean | TextlintFilterRuleOptions; + /** + * Return true if descriptor is same + */ + equals(descriptor: this): boolean; + toKernel(): TextlintKernelFilterRule; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.js b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.js new file mode 100644 index 000000000..9d2d198d0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.js @@ -0,0 +1,88 @@ +// LICENSE : MIT +"use strict"; +import { getFilter } from "./rule-creator-helper"; +import deepEqual from "deep-equal"; +/** + * Textlint Rule Descriptor. + * It handle RuleCreator and RuleOption. + */ +var TextlintFilterRuleDescriptor = /** @class */ (function () { + function TextlintFilterRuleDescriptor(kernelFilterRule) { + this.kernelFilterRule = kernelFilterRule; + } + Object.defineProperty(TextlintFilterRuleDescriptor.prototype, "id", { + get: function () { + return this.kernelFilterRule.ruleId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleDescriptor.prototype, "rule", { + get: function () { + return this.kernelFilterRule.rule; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleDescriptor.prototype, "enabled", { + /** + * Return true if this rule is enabled. + */ + get: function () { + return this.rawOptions !== false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleDescriptor.prototype, "filter", { + /** + * Return filter function + * You should check hasLiner before call this. + */ + get: function () { + return getFilter(this.rule); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleDescriptor.prototype, "normalizedOptions", { + /** + * Return normalized rule option object. + * If the rule have not option, return `true` by default. + */ + get: function () { + // default: { ruleName: true } + var DefaultRuleConfigValue = {}; + if (typeof this.kernelFilterRule.options === "boolean" || this.kernelFilterRule.options === undefined) { + return DefaultRuleConfigValue; + } + else { + return this.kernelFilterRule.options; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleDescriptor.prototype, "rawOptions", { + get: function () { + return this.kernelFilterRule.options; + }, + enumerable: false, + configurable: true + }); + /** + * Return true if descriptor is same + */ + TextlintFilterRuleDescriptor.prototype.equals = function (descriptor) { + return (this.rule === descriptor.rule && + deepEqual(this.normalizedOptions, descriptor.normalizedOptions, { + strict: true + })); + }; + TextlintFilterRuleDescriptor.prototype.toKernel = function () { + return this.kernelFilterRule; + }; + return TextlintFilterRuleDescriptor; +}()); +export { TextlintFilterRuleDescriptor }; +//# sourceMappingURL=TextlintFilterRuleDescriptor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.js.map new file mode 100644 index 000000000..a621281d9 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintFilterRuleDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/TextlintFilterRuleDescriptor.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC;;;GAGG;AACH;IACI,sCAAoB,gBAA0C;QAA1C,qBAAgB,GAAhB,gBAAgB,CAA0B;IAAG,CAAC;IAElE,sBAAI,4CAAE;aAAN;YACI,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QACxC,CAAC;;;OAAA;IAED,sBAAI,8CAAI;aAAR;YACI,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;QACtC,CAAC;;;OAAA;IAKD,sBAAI,iDAAO;QAHX;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC;QACrC,CAAC;;;OAAA;IAMD,sBAAI,gDAAM;QAJV;;;WAGG;aACH;YACI,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;;;OAAA;IAMD,sBAAI,2DAAiB;QAJrB;;;WAGG;aACH;YACI,8BAA8B;YAC9B,IAAM,sBAAsB,GAAG,EAAE,CAAC;YAClC,IAAI,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,KAAK,SAAS,EAAE;gBACnG,OAAO,sBAAsB,CAAC;aACjC;iBAAM;gBACH,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;aACxC;QACL,CAAC;;;OAAA;IAED,sBAAI,oDAAU;aAAd;YACI,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;QACzC,CAAC;;;OAAA;IAED;;OAEG;IACH,6CAAM,GAAN,UAAO,UAAgB;QACnB,OAAO,CACH,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;YAC7B,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAAE;gBAC5D,MAAM,EAAE,IAAI;aACf,CAAC,CACL,CAAC;IACN,CAAC;IAED,+CAAQ,GAAR;QACI,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IACL,mCAAC;AAAD,CAAC,AA3DD,IA2DC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.d.ts new file mode 100644 index 000000000..29ef65dd5 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.d.ts @@ -0,0 +1,26 @@ +import { TextlintKernelFilterRule } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +/** + * The collection class of TextlintFilterRuleDescriptor + */ +export declare class TextlintFilterRuleDescriptors { + private ruleDescriptorList; + constructor(ruleDescriptorList?: TextlintFilterRuleDescriptor[]); + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + toKernelFilterRulesFormat(): Array; + /** + * Return enabled descriptors + */ + get descriptors(): TextlintFilterRuleDescriptor[]; + /** + * Return all descriptors that include disabled descriptors + */ + get allDescriptors(): TextlintFilterRuleDescriptor[]; + /** + * filter duplicated descriptors + */ + withoutDuplicated(): TextlintFilterRuleDescriptors; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.js b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.js new file mode 100644 index 000000000..b3a893212 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.js @@ -0,0 +1,54 @@ +// LICENSE : MIT +"use strict"; +import { filterDuplicateDescriptor } from "./DescriptorUtil"; +/** + * The collection class of TextlintFilterRuleDescriptor + */ +var TextlintFilterRuleDescriptors = /** @class */ (function () { + function TextlintFilterRuleDescriptors(ruleDescriptorList) { + if (ruleDescriptorList === void 0) { ruleDescriptorList = []; } + this.ruleDescriptorList = ruleDescriptorList; + } + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + TextlintFilterRuleDescriptors.prototype.toKernelFilterRulesFormat = function () { + return this.withoutDuplicated().descriptors.map(function (descriptor) { + return descriptor.toKernel(); + }); + }; + Object.defineProperty(TextlintFilterRuleDescriptors.prototype, "descriptors", { + /** + * Return enabled descriptors + */ + get: function () { + return this.ruleDescriptorList.filter(function (descriptor) { + return descriptor.enabled; + }); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintFilterRuleDescriptors.prototype, "allDescriptors", { + /** + * Return all descriptors that include disabled descriptors + */ + get: function () { + return this.ruleDescriptorList; + }, + enumerable: false, + configurable: true + }); + /** + * filter duplicated descriptors + */ + TextlintFilterRuleDescriptors.prototype.withoutDuplicated = function () { + // remove last duplicated item + var newDescriptorList = filterDuplicateDescriptor(this.ruleDescriptorList); + return new TextlintFilterRuleDescriptors(newDescriptorList); + }; + return TextlintFilterRuleDescriptors; +}()); +export { TextlintFilterRuleDescriptors }; +//# sourceMappingURL=TextlintFilterRuleDescriptors.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.js.map new file mode 100644 index 000000000..4ffc6f26f --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFilterRuleDescriptors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintFilterRuleDescriptors.js","sourceRoot":"","sources":["../../src/descriptor/TextlintFilterRuleDescriptors.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;GAEG;AACH;IACI,uCAAoB,kBAAuD;QAAvD,mCAAA,EAAA,uBAAuD;QAAvD,uBAAkB,GAAlB,kBAAkB,CAAqC;IAAG,CAAC;IAE/E;;;OAGG;IACH,iEAAyB,GAAzB;QACI,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,UAAC,UAAU;YACvD,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;IAKD,sBAAI,sDAAW;QAHf;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,UAAC,UAAU;gBAC7C,OAAO,UAAU,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,CAAC;QACP,CAAC;;;OAAA;IAKD,sBAAI,yDAAc;QAHlB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACnC,CAAC;;;OAAA;IAED;;OAEG;IACH,yDAAiB,GAAjB;QACI,8BAA8B;QAC9B,IAAM,iBAAiB,GAAG,yBAAyB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC7E,OAAO,IAAI,6BAA6B,CAAC,iBAAiB,CAAC,CAAC;IAChE,CAAC;IACL,oCAAC;AAAD,CAAC,AArCD,IAqCC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.d.ts new file mode 100644 index 000000000..52fecef1e --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.d.ts @@ -0,0 +1,14 @@ +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import type { TextlintRuleReporter } from "@textlint/types"; +/** + * Textlint Fixable Rule Descriptor. + * It is inherit **Rule** Descriptor and add fixer() method. + * It handle RuleCreator and RuleOption. + */ +export declare class TextlintFixableRuleDescriptor extends TextlintLintableRuleDescriptor { + /** + * Return fixer function + * You should check hasFixer before call this. + */ + get fixer(): TextlintRuleReporter; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.js b/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.js new file mode 100644 index 000000000..9ae4f3611 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.js @@ -0,0 +1,42 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { getFixer } from "./rule-creator-helper"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +/** + * Textlint Fixable Rule Descriptor. + * It is inherit **Rule** Descriptor and add fixer() method. + * It handle RuleCreator and RuleOption. + */ +var TextlintFixableRuleDescriptor = /** @class */ (function (_super) { + __extends(TextlintFixableRuleDescriptor, _super); + function TextlintFixableRuleDescriptor() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(TextlintFixableRuleDescriptor.prototype, "fixer", { + /** + * Return fixer function + * You should check hasFixer before call this. + */ + get: function () { + return getFixer(this.rule); + }, + enumerable: false, + configurable: true + }); + return TextlintFixableRuleDescriptor; +}(TextlintLintableRuleDescriptor)); +export { TextlintFixableRuleDescriptor }; +//# sourceMappingURL=TextlintFixableRuleDescriptor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.js.map new file mode 100644 index 000000000..65d603ea2 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintFixableRuleDescriptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintFixableRuleDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/TextlintFixableRuleDescriptor.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAGlF;;;;GAIG;AACH;IAAmD,iDAA8B;IAAjF;;IAQA,CAAC;IAHG,sBAAI,gDAAK;QAJT;;;WAGG;aACH;YACI,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;;;OAAA;IACL,oCAAC;AAAD,CAAC,AARD,CAAmD,8BAA8B,GAQhF"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.d.ts new file mode 100644 index 000000000..2449b9dee --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.d.ts @@ -0,0 +1,38 @@ +import { TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule } from "../textlint-kernel-interface"; +import { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +import { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +import { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +import { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; +export interface TextlintKernelDescriptorArgs { + rules: TextlintKernelRule[]; + filterRules: TextlintKernelFilterRule[]; + plugins: TextlintKernelPlugin[]; +} +export declare class TextlintKernelDescriptor { + private args; + rule: TextlintRuleDescriptors; + filterRule: TextlintFilterRuleDescriptors; + plugin: TextlintPluginDescriptors; + constructor(args: TextlintKernelDescriptorArgs); + /** + * Return available extensions of plugins + */ + get availableExtensions(): string[]; + /** + * Merge constructor args and partialArgs + * It shallow merge partialArgs. + * It means that overwrite root properties by partialArgs. + */ + shallowMerge(partialArgs: Partial): TextlintKernelDescriptor; + /** + * find PluginDescriptor with extension. + * This is forward match. + * + * If following config of textlint, this method prefer to select MarkdownA for markdown. + * + * { + * "plugins": [MarkdownA, MarkdownB] + * } + */ + findPluginDescriptorWithExt(ext: string): TextlintPluginDescriptor | undefined; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.js b/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.js new file mode 100644 index 000000000..31b3e28ca --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.js @@ -0,0 +1,54 @@ +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +import { createTextlintFilterRuleDescriptors, createTextlintPluginDescriptors, createTextlintRuleDescriptors } from "./DescriptorsFactory"; +var TextlintKernelDescriptor = /** @class */ (function () { + function TextlintKernelDescriptor(args) { + this.args = args; + this.rule = createTextlintRuleDescriptors(args.rules); + this.filterRule = createTextlintFilterRuleDescriptors(args.filterRules); + this.plugin = createTextlintPluginDescriptors(args.plugins); + } + Object.defineProperty(TextlintKernelDescriptor.prototype, "availableExtensions", { + /** + * Return available extensions of plugins + */ + get: function () { + return this.plugin.availableExtensions; + }, + enumerable: false, + configurable: true + }); + /** + * Merge constructor args and partialArgs + * It shallow merge partialArgs. + * It means that overwrite root properties by partialArgs. + */ + TextlintKernelDescriptor.prototype.shallowMerge = function (partialArgs) { + return new TextlintKernelDescriptor(__assign(__assign({}, this.args), partialArgs)); + }; + /** + * find PluginDescriptor with extension. + * This is forward match. + * + * If following config of textlint, this method prefer to select MarkdownA for markdown. + * + * { + * "plugins": [MarkdownA, MarkdownB] + * } + */ + TextlintKernelDescriptor.prototype.findPluginDescriptorWithExt = function (ext) { + return this.plugin.findPluginDescriptorWithExt(ext); + }; + return TextlintKernelDescriptor; +}()); +export { TextlintKernelDescriptor }; +//# sourceMappingURL=TextlintKernelDescriptor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.js.map new file mode 100644 index 000000000..1e27248b6 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintKernelDescriptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintKernelDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/TextlintKernelDescriptor.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,OAAO,EACH,mCAAmC,EACnC,+BAA+B,EAC/B,6BAA6B,EAChC,MAAM,sBAAsB,CAAC;AAS9B;IAKI,kCAAoB,IAAkC;QAAlC,SAAI,GAAJ,IAAI,CAA8B;QAClD,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,UAAU,GAAG,mCAAmC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxE,IAAI,CAAC,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAKD,sBAAI,yDAAmB;QAHvB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;QAC3C,CAAC;;;OAAA;IAED;;;;OAIG;IACH,+CAAY,GAAZ,UAAa,WAAkD;QAC3D,OAAO,IAAI,wBAAwB,uBAC5B,IAAI,CAAC,IAAI,GACT,WAAW,EAChB,CAAC;IACP,CAAC;IAED;;;;;;;;;OASG;IACH,8DAA2B,GAA3B,UAA4B,GAAW;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;IACL,+BAAC;AAAD,CAAC,AA3CD,IA2CC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.d.ts new file mode 100644 index 000000000..21d0d5b3e --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.d.ts @@ -0,0 +1,35 @@ +import { TextlintKernelRule } from "../textlint-kernel-interface"; +import type { TextlintRuleModule, TextlintRuleOptions, TextlintRuleReporter } from "@textlint/types"; +/** + * Textlint Rule Descriptor. + * It handle RuleCreator and RuleOption. + */ +export declare class TextlintLintableRuleDescriptor { + private textlintKernelRule; + constructor(textlintKernelRule: TextlintKernelRule); + get id(): string; + /** + * Rule module-self + */ + get rule(): TextlintRuleModule; + /** + * Return true if this rule is enabled. + */ + get enabled(): boolean; + /** + * Return linter function + * You should check hasLiner before call this. + */ + get linter(): TextlintRuleReporter; + /** + * Return normalized rule option object. + * If the rule have not option, return `true` by default. + */ + get normalizedOptions(): TextlintRuleOptions; + get rawOptions(): boolean | undefined | TextlintRuleOptions; + /** + * Return true if descriptor is same + */ + equals(descriptor: TextlintLintableRuleDescriptor): boolean; + toKernel(): TextlintKernelRule; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.js b/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.js new file mode 100644 index 000000000..8fad860b6 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.js @@ -0,0 +1,92 @@ +// LICENSE : MIT +"use strict"; +import { assertRuleShape, getLinter } from "./rule-creator-helper"; +import deepEqual from "deep-equal"; +/** + * Textlint Rule Descriptor. + * It handle RuleCreator and RuleOption. + */ +var TextlintLintableRuleDescriptor = /** @class */ (function () { + function TextlintLintableRuleDescriptor(textlintKernelRule) { + this.textlintKernelRule = textlintKernelRule; + assertRuleShape(textlintKernelRule.rule, textlintKernelRule.ruleId); + } + Object.defineProperty(TextlintLintableRuleDescriptor.prototype, "id", { + get: function () { + return this.textlintKernelRule.ruleId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintLintableRuleDescriptor.prototype, "rule", { + /** + * Rule module-self + */ + get: function () { + return this.textlintKernelRule.rule; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintLintableRuleDescriptor.prototype, "enabled", { + /** + * Return true if this rule is enabled. + */ + get: function () { + return this.rawOptions !== false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintLintableRuleDescriptor.prototype, "linter", { + /** + * Return linter function + * You should check hasLiner before call this. + */ + get: function () { + return getLinter(this.rule); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintLintableRuleDescriptor.prototype, "normalizedOptions", { + /** + * Return normalized rule option object. + * If the rule have not option, return `true` by default. + */ + get: function () { + // default: { ruleName: true } + var DefaultRuleConfigValue = {}; + if (typeof this.textlintKernelRule.options === "boolean" || this.textlintKernelRule.options === undefined) { + return DefaultRuleConfigValue; + } + else { + return this.textlintKernelRule.options; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintLintableRuleDescriptor.prototype, "rawOptions", { + get: function () { + return this.textlintKernelRule.options; + }, + enumerable: false, + configurable: true + }); + /** + * Return true if descriptor is same + */ + TextlintLintableRuleDescriptor.prototype.equals = function (descriptor) { + return (this.rule === descriptor.rule && + deepEqual(this.normalizedOptions, descriptor.normalizedOptions, { + strict: true + })); + }; + TextlintLintableRuleDescriptor.prototype.toKernel = function () { + return this.textlintKernelRule; + }; + return TextlintLintableRuleDescriptor; +}()); +export { TextlintLintableRuleDescriptor }; +//# sourceMappingURL=TextlintLintableRuleDescriptor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.js.map new file mode 100644 index 000000000..1f7331bea --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintLintableRuleDescriptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintLintableRuleDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/TextlintLintableRuleDescriptor.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC;;;GAGG;AACH;IACI,wCAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtD,eAAe,CAAC,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;IAED,sBAAI,8CAAE;aAAN;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC;QAC1C,CAAC;;;OAAA;IAKD,sBAAI,gDAAI;QAHR;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;QACxC,CAAC;;;OAAA;IAKD,sBAAI,mDAAO;QAHX;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC;QACrC,CAAC;;;OAAA;IAMD,sBAAI,kDAAM;QAJV;;;WAGG;aACH;YACI,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;;;OAAA;IAMD,sBAAI,6DAAiB;QAJrB;;;WAGG;aACH;YACI,8BAA8B;YAC9B,IAAM,sBAAsB,GAAG,EAAE,CAAC;YAClC,IAAI,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,KAAK,SAAS,EAAE;gBACvG,OAAO,sBAAsB,CAAC;aACjC;iBAAM;gBACH,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;aAC1C;QACL,CAAC;;;OAAA;IAED,sBAAI,sDAAU;aAAd;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;QAC3C,CAAC;;;OAAA;IAED;;OAEG;IACH,+CAAM,GAAN,UAAO,UAA0C;QAC7C,OAAO,CACH,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;YAC7B,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAAE;gBAC5D,MAAM,EAAE,IAAI;aACf,CAAC,CACL,CAAC;IACN,CAAC;IAED,iDAAQ,GAAR;QACI,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IACL,qCAAC;AAAD,CAAC,AAhED,IAgEC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.d.ts new file mode 100644 index 000000000..1235bdb11 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.d.ts @@ -0,0 +1,24 @@ +import { TextlintKernelPlugin } from "../textlint-kernel-interface"; +import { Descriptor } from "./Descriptor"; +import type { TextlintPluginOptions, TextlintPluginProcessor } from "@textlint/types"; +/** + * Textlint Plugin Descriptor + */ +export declare class TextlintPluginDescriptor implements Descriptor { + private plugin; + processor: TextlintPluginProcessor; + constructor(plugin: TextlintKernelPlugin); + get id(): string; + /** + * Return true if this rule is enabled. + */ + get enabled(): boolean; + /** + * Return available extension of this plugin + */ + get availableExtensions(): string[]; + get normalizedOptions(): TextlintPluginOptions; + get rawOptions(): boolean | TextlintPluginOptions | undefined; + toKernel(): TextlintKernelPlugin; + equals(target: this): boolean; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.js b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.js new file mode 100644 index 000000000..6a5f29975 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.js @@ -0,0 +1,91 @@ +"use strict"; +import deepEqual from "deep-equal"; +/** + * Get instance/static `availableExtensions()` from TextlintPluginProcessor + */ +var getAvailableExtensions = function (pluginProcessor) { + if (typeof pluginProcessor.availableExtensions === "function") { + return pluginProcessor.availableExtensions(); + } + // It is compatible for textlint@10<= + // Recommended: `availableExtensions()` should be defined as instance method. + // https://github.com/textlint/textlint/issues/531 + var PluginProcessorConstructor = pluginProcessor.constructor; + if (typeof PluginProcessorConstructor.availableExtensions === "function") { + return PluginProcessorConstructor.availableExtensions(); + } + throw new Error("Plugin(" + pluginProcessor + ") should implement availableExtensions() method"); +}; +/** + * Textlint Plugin Descriptor + */ +var TextlintPluginDescriptor = /** @class */ (function () { + function TextlintPluginDescriptor(plugin) { + this.plugin = plugin; + this.plugin = plugin; + if (!this.plugin.plugin.Processor) { + throw new Error("Plugin should have Processor property.\nmodule.exports = {\n Processor: class Processor{ ... }\n}\n"); + } + this.processor = new plugin.plugin.Processor(this.normalizedOptions); + } + Object.defineProperty(TextlintPluginDescriptor.prototype, "id", { + get: function () { + return this.plugin.pluginId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintPluginDescriptor.prototype, "enabled", { + /** + * Return true if this rule is enabled. + */ + get: function () { + return this.rawOptions !== false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintPluginDescriptor.prototype, "availableExtensions", { + /** + * Return available extension of this plugin + */ + get: function () { + return getAvailableExtensions(this.processor); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintPluginDescriptor.prototype, "normalizedOptions", { + get: function () { + // default: { ruleName: true } + var DefaultPluginOption = {}; + if (typeof this.plugin.options === "boolean" || this.plugin.options === undefined) { + return DefaultPluginOption; + } + else { + return this.plugin.options; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintPluginDescriptor.prototype, "rawOptions", { + get: function () { + return this.plugin.options; + }, + enumerable: false, + configurable: true + }); + TextlintPluginDescriptor.prototype.toKernel = function () { + return this.plugin; + }; + TextlintPluginDescriptor.prototype.equals = function (target) { + return (this.plugin.plugin === target.plugin.plugin && + deepEqual(this.plugin.options, target.plugin.options, { + strict: true + })); + }; + return TextlintPluginDescriptor; +}()); +export { TextlintPluginDescriptor }; +//# sourceMappingURL=TextlintPluginDescriptor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.js.map new file mode 100644 index 000000000..9f4a66e15 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintPluginDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/TextlintPluginDescriptor.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAQb,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,IAAM,sBAAsB,GAAG,UAAC,eAAwC;IACpE,IAAI,OAAO,eAAe,CAAC,mBAAmB,KAAK,UAAU,EAAE;QAC3D,OAAO,eAAe,CAAC,mBAAmB,EAAE,CAAC;KAChD;IACD,qCAAqC;IACrC,6EAA6E;IAC7E,kDAAkD;IAClD,IAAM,0BAA0B,GAAG,eAAe,CAAC,WAAiD,CAAC;IACrG,IAAI,OAAO,0BAA0B,CAAC,mBAAmB,KAAK,UAAU,EAAE;QACtE,OAAO,0BAA0B,CAAC,mBAAmB,EAAE,CAAC;KAC3D;IACD,MAAM,IAAI,KAAK,CAAC,YAAU,eAAe,oDAAiD,CAAC,CAAC;AAChG,CAAC,CAAC;AAEF;;GAEG;AACH;IAGI,kCAAoB,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,sGAI3B,CAAC,CAAC;SACM;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACzE,CAAC;IAED,sBAAI,wCAAE;aAAN;YACI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChC,CAAC;;;OAAA;IAKD,sBAAI,6CAAO;QAHX;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC;QACrC,CAAC;;;OAAA;IAKD,sBAAI,yDAAmB;QAHvB;;WAEG;aACH;YACI,OAAO,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC;;;OAAA;IAED,sBAAI,uDAAiB;aAArB;YACI,8BAA8B;YAC9B,IAAM,mBAAmB,GAAG,EAAE,CAAC;YAC/B,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC/E,OAAO,mBAAmB,CAAC;aAC9B;iBAAM;gBACH,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;aAC9B;QACL,CAAC;;;OAAA;IAED,sBAAI,gDAAU;aAAd;YACI,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;;;OAAA;IAED,2CAAQ,GAAR;QACI,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,yCAAM,GAAN,UAAO,MAAY;QACf,OAAO,CACH,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM;YAC3C,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;gBAClD,MAAM,EAAE,IAAI;aACf,CAAC,CACL,CAAC;IACN,CAAC;IACL,+BAAC;AAAD,CAAC,AA3DD,IA2DC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.d.ts new file mode 100644 index 000000000..927e15798 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.d.ts @@ -0,0 +1,36 @@ +import { TextlintKernelPlugin } from "../textlint-kernel-interface"; +import { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; +/** + * Collection class of TextlintPluginDescriptor + */ +export declare class TextlintPluginDescriptors { + private pluginDescriptorList; + constructor(pluginDescriptorList?: TextlintPluginDescriptor[]); + /** + * Return enabled descriptors + */ + get descriptors(): TextlintPluginDescriptor[]; + /** + * Return all descriptors that include disabled descriptors + */ + get allDescriptors(): TextlintPluginDescriptor[]; + /** + * Return available extensions + * It is not includes disabled plugin's extensions. + */ + get availableExtensions(): string[]; + /** + * find PluginDescriptor with extension. + * This is forward match. + */ + findPluginDescriptorWithExt(ext: string): TextlintPluginDescriptor | undefined; + /** + * filter duplicated descriptors + */ + withoutDuplicated(): TextlintPluginDescriptors; + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + toKernelPluginsFormat(): TextlintKernelPlugin[]; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.js b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.js new file mode 100644 index 000000000..cc3da1d47 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.js @@ -0,0 +1,74 @@ +"use strict"; +import { filterDuplicateDescriptor } from "./DescriptorUtil"; +/** + * Collection class of TextlintPluginDescriptor + */ +var TextlintPluginDescriptors = /** @class */ (function () { + function TextlintPluginDescriptors(pluginDescriptorList) { + if (pluginDescriptorList === void 0) { pluginDescriptorList = []; } + this.pluginDescriptorList = pluginDescriptorList; + } + Object.defineProperty(TextlintPluginDescriptors.prototype, "descriptors", { + /** + * Return enabled descriptors + */ + get: function () { + return this.pluginDescriptorList.filter(function (descriptor) { + return descriptor.enabled; + }); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintPluginDescriptors.prototype, "allDescriptors", { + /** + * Return all descriptors that include disabled descriptors + */ + get: function () { + return this.pluginDescriptorList; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintPluginDescriptors.prototype, "availableExtensions", { + /** + * Return available extensions + * It is not includes disabled plugin's extensions. + */ + get: function () { + return this.descriptors.reduce(function (extensions, descriptor) { + return extensions.concat(descriptor.availableExtensions); + }, []); + }, + enumerable: false, + configurable: true + }); + /** + * find PluginDescriptor with extension. + * This is forward match. + */ + TextlintPluginDescriptors.prototype.findPluginDescriptorWithExt = function (ext) { + return this.descriptors.find(function (descriptor) { + return descriptor.availableExtensions.includes(ext); + }); + }; + /** + * filter duplicated descriptors + */ + TextlintPluginDescriptors.prototype.withoutDuplicated = function () { + var newDescriptorList = filterDuplicateDescriptor(this.pluginDescriptorList); + return new TextlintPluginDescriptors(newDescriptorList); + }; + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + TextlintPluginDescriptors.prototype.toKernelPluginsFormat = function () { + return this.descriptors.map(function (descriptor) { + return descriptor.toKernel(); + }); + }; + return TextlintPluginDescriptors; +}()); +export { TextlintPluginDescriptors }; +//# sourceMappingURL=TextlintPluginDescriptors.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.js.map new file mode 100644 index 000000000..1a3e8f9cd --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintPluginDescriptors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintPluginDescriptors.js","sourceRoot":"","sources":["../../src/descriptor/TextlintPluginDescriptors.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;GAEG;AACH;IACI,mCAAoB,oBAAqD;QAArD,qCAAA,EAAA,yBAAqD;QAArD,yBAAoB,GAApB,oBAAoB,CAAiC;IAAG,CAAC;IAK7E,sBAAI,kDAAW;QAHf;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,UAAC,UAAU;gBAC/C,OAAO,UAAU,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,CAAC;QACP,CAAC;;;OAAA;IAKD,sBAAI,qDAAc;QAHlB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACrC,CAAC;;;OAAA;IAMD,sBAAI,0DAAmB;QAJvB;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAC,UAAU,EAAE,UAAU;gBAClD,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;YAC7D,CAAC,EAAE,EAAc,CAAC,CAAC;QACvB,CAAC;;;OAAA;IAED;;;OAGG;IACH,+DAA2B,GAA3B,UAA4B,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAC,UAAU;YACpC,OAAO,UAAU,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,qDAAiB,GAAjB;QACI,IAAM,iBAAiB,GAAG,yBAAyB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC/E,OAAO,IAAI,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACH,yDAAqB,GAArB;QACI,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAC,UAAU;YACnC,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;IACL,gCAAC;AAAD,CAAC,AAxDD,IAwDC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.d.ts b/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.d.ts new file mode 100644 index 000000000..bb8cd1897 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.d.ts @@ -0,0 +1,36 @@ +import { TextlintKernelRule } from "../textlint-kernel-interface"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; +export declare type TextlintRuleAllRuleDescriptor = TextlintLintableRuleDescriptor | TextlintFixableRuleDescriptor; +/** + * The collection class of TextlintRuleDescriptor + */ +export declare class TextlintRuleDescriptors { + private ruleDescriptorList; + constructor(ruleDescriptorList?: TextlintRuleAllRuleDescriptor[]); + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + toKernelRulesFormat(): Array; + /** + * Return enabled lintable descriptors + */ + get lintableDescriptors(): TextlintLintableRuleDescriptor[]; + /** + * Return enabled fixable descriptors + */ + get fixableDescriptors(): TextlintFixableRuleDescriptor[]; + /** + * Return enabled descriptors + */ + get descriptors(): TextlintRuleAllRuleDescriptor[]; + /** + * Return all descriptors that include disabled descriptors + */ + get allDescriptors(): TextlintRuleAllRuleDescriptor[]; + /** + * filter duplicated descriptors + */ + withoutDuplicated(): TextlintRuleDescriptors; +} diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.js b/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.js new file mode 100644 index 000000000..054663d9f --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.js @@ -0,0 +1,78 @@ +// LICENSE : MIT +"use strict"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import { filterDuplicateDescriptor } from "./DescriptorUtil"; +import { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; +/** + * The collection class of TextlintRuleDescriptor + */ +var TextlintRuleDescriptors = /** @class */ (function () { + function TextlintRuleDescriptors(ruleDescriptorList) { + if (ruleDescriptorList === void 0) { ruleDescriptorList = []; } + this.ruleDescriptorList = ruleDescriptorList; + } + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + TextlintRuleDescriptors.prototype.toKernelRulesFormat = function () { + return this.withoutDuplicated().lintableDescriptors.map(function (descriptor) { + return descriptor.toKernel(); + }); + }; + Object.defineProperty(TextlintRuleDescriptors.prototype, "lintableDescriptors", { + /** + * Return enabled lintable descriptors + */ + get: function () { + return this.descriptors.filter(function (descriptor) { + // fixable is also lintable + return descriptor instanceof TextlintLintableRuleDescriptor; + }); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleDescriptors.prototype, "fixableDescriptors", { + /** + * Return enabled fixable descriptors + */ + get: function () { + return this.descriptors.filter(function (descriptor) { + return descriptor instanceof TextlintFixableRuleDescriptor; + }); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleDescriptors.prototype, "descriptors", { + /** + * Return enabled descriptors + */ + get: function () { + return this.ruleDescriptorList.filter(function (descriptor) { return descriptor.enabled; }); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextlintRuleDescriptors.prototype, "allDescriptors", { + /** + * Return all descriptors that include disabled descriptors + */ + get: function () { + return this.ruleDescriptorList; + }, + enumerable: false, + configurable: true + }); + /** + * filter duplicated descriptors + */ + TextlintRuleDescriptors.prototype.withoutDuplicated = function () { + var newDescriptorList = filterDuplicateDescriptor(this.ruleDescriptorList); + return new TextlintRuleDescriptors(newDescriptorList); + }; + return TextlintRuleDescriptors; +}()); +export { TextlintRuleDescriptors }; +//# sourceMappingURL=TextlintRuleDescriptors.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.js.map b/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.js.map new file mode 100644 index 000000000..4d0570c12 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/TextlintRuleDescriptors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintRuleDescriptors.js","sourceRoot":"","sources":["../../src/descriptor/TextlintRuleDescriptors.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAIhF;;GAEG;AACH;IACI,iCAAoB,kBAAwD;QAAxD,mCAAA,EAAA,uBAAwD;QAAxD,uBAAkB,GAAlB,kBAAkB,CAAsC;IAAG,CAAC;IAEhF;;;OAGG;IACH,qDAAmB,GAAnB;QACI,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,UAAC,UAAU;YAC/D,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;IAKD,sBAAI,wDAAmB;QAHvB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAC,UAAU;gBACtC,2BAA2B;gBAC3B,OAAO,UAAU,YAAY,8BAA8B,CAAC;YAChE,CAAC,CAAC,CAAC;QACP,CAAC;;;OAAA;IAKD,sBAAI,uDAAkB;QAHtB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAC,UAAU;gBACtC,OAAO,UAAU,YAAY,6BAA6B,CAAC;YAC/D,CAAC,CAAoC,CAAC;QAC1C,CAAC;;;OAAA;IAKD,sBAAI,gDAAW;QAHf;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,UAAC,UAAU,IAAK,OAAA,UAAU,CAAC,OAAO,EAAlB,CAAkB,CAAC,CAAC;QAC9E,CAAC;;;OAAA;IAKD,sBAAI,mDAAc;QAHlB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACnC,CAAC;;;OAAA;IAED;;OAEG;IACH,mDAAiB,GAAjB;QACI,IAAM,iBAAiB,GAAG,yBAAyB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC7E,OAAO,IAAI,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,CAAC;IACL,8BAAC;AAAD,CAAC,AArDD,IAqDC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/index.d.ts b/node_modules/@textlint/kernel/module/descriptor/index.d.ts new file mode 100644 index 000000000..0cf4035ec --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/index.d.ts @@ -0,0 +1,8 @@ +export { TextlintKernelDescriptor } from "./TextlintKernelDescriptor"; +export { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +export { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +export { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; +export { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +export { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +export { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +export { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; diff --git a/node_modules/@textlint/kernel/module/descriptor/index.js b/node_modules/@textlint/kernel/module/descriptor/index.js new file mode 100644 index 000000000..8c046aecc --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/index.js @@ -0,0 +1,9 @@ +export { TextlintKernelDescriptor } from "./TextlintKernelDescriptor"; +export { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +export { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +export { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; +export { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +export { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +export { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +export { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/index.js.map b/node_modules/@textlint/kernel/module/descriptor/index.js.map new file mode 100644 index 000000000..401911e87 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/descriptor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.d.ts b/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.js b/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.js new file mode 100644 index 000000000..c04e94db6 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=plugin-creator-helper.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.js.map b/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.js.map new file mode 100644 index 000000000..5ee19eee0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/plugin-creator-helper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-creator-helper.js","sourceRoot":"","sources":["../../src/descriptor/plugin-creator-helper.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.d.ts b/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.d.ts new file mode 100644 index 000000000..cc396a3fd --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.d.ts @@ -0,0 +1,51 @@ +import type { TextlintFilterRuleReporter, TextlintRuleReporter } from "@textlint/types"; +/** + * detect that ruleCreator has linter function + * @param {*} ruleCreator + * @returns {boolean} + */ +export declare function hasLinter(ruleCreator: any): boolean; +/** + * get linter function from ruleCreator + * if not found, throw error + * @param {Function|Object|any} ruleCreator + * @returns {Function} linter function + * @throws + */ +export declare function getLinter(ruleCreator: Function | object | any): TextlintRuleReporter; +/** + * detect that ruleCreator has fixer function + * @param {*} ruleCreator + * @returns {boolean} + */ +export declare function hasFixer(ruleCreator: any): boolean; +/** + * get fixer function from ruleCreator + * if not found, throw error + * @param {Function|Object|any} ruleCreator + * @returns {Function} fixer function + * @throws + */ +export declare function getFixer(ruleCreator: Function | object | any): TextlintRuleReporter; +/** + * RuleModule should has either linter or fixer. + * @param {*} ruleCreator + * @returns {boolean} + **/ +export declare function isRuleModule(ruleCreator: any): boolean; +/** + * Validate rule module. + * if invalid throw error + * @param {*} ruleModule + * @param {string} [key] + * @throws + */ +export declare function assertRuleShape(ruleModule: any, key?: string): void; +/** + * get linter function from ruleCreator + * if not found, throw error + * @param {*} ruleCreator + * @returns {Function} linter function + * @throws + */ +export declare function getFilter(ruleCreator: any): TextlintFilterRuleReporter; diff --git a/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.js b/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.js new file mode 100644 index 000000000..2790183eb --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.js @@ -0,0 +1,98 @@ +/** + * detect that ruleCreator has linter function + * @param {*} ruleCreator + * @returns {boolean} + */ +export function hasLinter(ruleCreator) { + if (typeof ruleCreator.linter === "function") { + return true; + } + if (typeof ruleCreator === "function") { + return true; + } + return false; +} +/** + * get linter function from ruleCreator + * if not found, throw error + * @param {Function|Object|any} ruleCreator + * @returns {Function} linter function + * @throws + */ +export function getLinter(ruleCreator) { + if (typeof ruleCreator.linter === "function") { + return ruleCreator.linter; + } + if (typeof ruleCreator === "function") { + return ruleCreator; + } + throw new Error("Not found linter function in the ruleCreator"); +} +/** + * detect that ruleCreator has fixer function + * @param {*} ruleCreator + * @returns {boolean} + */ +export function hasFixer(ruleCreator) { + return typeof ruleCreator.fixer === "function" && hasLinter(ruleCreator); +} +/** + * get fixer function from ruleCreator + * if not found, throw error + * @param {Function|Object|any} ruleCreator + * @returns {Function} fixer function + * @throws + */ +export function getFixer(ruleCreator) { + if (!hasLinter(ruleCreator)) { + throw new Error("fixer module should have also linter function."); + } + if (hasFixer(ruleCreator)) { + return ruleCreator.fixer; + } + throw new Error("Not found fixer function in the ruleCreator"); +} +/** + * RuleModule should has either linter or fixer. + * @param {*} ruleCreator + * @returns {boolean} + **/ +export function isRuleModule(ruleCreator) { + return hasLinter(ruleCreator) || hasFixer(ruleCreator); +} +/** + * Validate rule module. + * if invalid throw error + * @param {*} ruleModule + * @param {string} [key] + * @throws + */ +export function assertRuleShape(ruleModule, key) { + if (key === void 0) { key = ""; } + if (ruleModule === undefined) { + throw new Error("Definition of rule '" + key + "' was not found."); + } + /* + Check old rule function + module.exports = function(context){ + + } + */ + if (!isRuleModule(ruleModule)) { + throw new Error("Definition of rule '" + key + "' was not rule module.\nRule should export function:\nmodule.exports = function(context){\n // Your rule\n};"); + } +} +/** + * get linter function from ruleCreator + * if not found, throw error + * @param {*} ruleCreator + * @returns {Function} linter function + * @throws + */ +export function getFilter(ruleCreator) { + if (typeof ruleCreator === "function") { + return ruleCreator; + } + throw new Error("Not found filter function in the ruleCreator"); +} +//# sourceMappingURL=rule-creator-helper.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.js.map b/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.js.map new file mode 100644 index 000000000..c62708700 --- /dev/null +++ b/node_modules/@textlint/kernel/module/descriptor/rule-creator-helper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rule-creator-helper.js","sourceRoot":"","sources":["../../src/descriptor/rule-creator-helper.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,WAAgB;IACtC,IAAI,OAAO,WAAW,CAAC,MAAM,KAAK,UAAU,EAAE;QAC1C,OAAO,IAAI,CAAC;KACf;IACD,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;QACnC,OAAO,IAAI,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,WAAoC;IAC1D,IAAI,OAAO,WAAW,CAAC,MAAM,KAAK,UAAU,EAAE;QAC1C,OAAO,WAAW,CAAC,MAAM,CAAC;KAC7B;IACD,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;QACnC,OAAO,WAAW,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,WAAgB;IACrC,OAAO,OAAO,WAAW,CAAC,KAAK,KAAK,UAAU,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,WAAoC;IACzD,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;KACrE;IACD,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;QACvB,OAAO,WAAW,CAAC,KAAK,CAAC;KAC5B;IACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACnE,CAAC;AAED;;;;IAII;AACJ,MAAM,UAAU,YAAY,CAAC,WAAgB;IACzC,OAAO,SAAS,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,UAAe,EAAE,GAAgB;IAAhB,oBAAA,EAAA,QAAgB;IAC7D,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,yBAAuB,GAAG,qBAAkB,CAAC,CAAC;KACjE;IACD;;;;;MAKE;IACF,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,yBAAuB,GAAG,oHAI/C,CAAC,CAAC;KACA;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,WAAgB;IACtC,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;QACnC,OAAO,WAAW,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AACpE,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/fixer/fixer-processor.d.ts b/node_modules/@textlint/kernel/module/fixer/fixer-processor.d.ts new file mode 100644 index 000000000..e8e08f4c8 --- /dev/null +++ b/node_modules/@textlint/kernel/module/fixer/fixer-processor.d.ts @@ -0,0 +1,30 @@ +import type { TextlintFixResult, TextlintPluginProcessor, TextlintSourceCode } from "@textlint/types"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import MessageProcessManager from "../messages/MessageProcessManager"; +import { TextlintFilterRuleDescriptors, TextlintRuleDescriptors } from "../descriptor"; +export interface FixerProcessorProcessArgs { + config: TextlintKernelConstructorOptions; + configBaseDir?: string; + ruleDescriptors: TextlintRuleDescriptors; + filterRules: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; +} +export default class FixerProcessor { + private processor; + private messageProcessManager; + /** + * @param {Processor} processor + * @param {MessageProcessManager} messageProcessManager + */ + constructor(processor: TextlintPluginProcessor, messageProcessManager: MessageProcessManager); + /** + * Run fixer process + * @param {Config} config + * @param {string} [configBaseDir] + * @param {TextlintKernelRule[]} [rules] + * @param {TextlintKernelFilterRule[]} [filterRules] + * @param {SourceCode} sourceCode + * @returns {Promise.} + */ + process({ config, configBaseDir, ruleDescriptors, filterRules, sourceCode }: FixerProcessorProcessArgs): Promise; +} diff --git a/node_modules/@textlint/kernel/module/fixer/fixer-processor.js b/node_modules/@textlint/kernel/module/fixer/fixer-processor.js new file mode 100644 index 000000000..62c5ad80b --- /dev/null +++ b/node_modules/@textlint/kernel/module/fixer/fixer-processor.js @@ -0,0 +1,109 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; +import FixerTask from "../task/fixer-task"; +import TaskRunner from "../task/task-runner"; +import { TextlintSourceCodeImpl } from "../context/TextlintSourceCodeImpl"; +import { isTxtAST } from "@textlint/ast-tester"; +import _debug from "debug"; +import { applyFixesToSourceCode } from "@textlint/source-code-fixer"; +var debug = _debug("textlint:fixer-processor"); +var FixerProcessor = /** @class */ (function () { + /** + * @param {Processor} processor + * @param {MessageProcessManager} messageProcessManager + */ + function FixerProcessor(processor, messageProcessManager) { + this.processor = processor; + this.messageProcessManager = messageProcessManager; + } + /** + * Run fixer process + * @param {Config} config + * @param {string} [configBaseDir] + * @param {TextlintKernelRule[]} [rules] + * @param {TextlintKernelFilterRule[]} [filterRules] + * @param {SourceCode} sourceCode + * @returns {Promise.} + */ + FixerProcessor.prototype.process = function (_a) { + var _this = this; + var config = _a.config, configBaseDir = _a.configBaseDir, ruleDescriptors = _a.ruleDescriptors, filterRules = _a.filterRules, sourceCode = _a.sourceCode; + assert.ok(sourceCode); + var _b = this.processor.processor(sourceCode.ext), preProcess = _b.preProcess, postProcess = _b.postProcess; + // messages + var resultFilePath = sourceCode.filePath; + // applied fixing messages + // Revert = Sequentially apply applied message to applied output + // SourceCodeFixer.sequentiallyApplyFixes(fixedOutput, result.applyingMessages); + var applyingMessages = []; + // not applied fixing messages + var remainingMessages = []; + // original means original for applyingMessages and remainingMessages + // pre-applyingMessages + remainingMessages + var originalMessages = []; + var fixerProcessList = ruleDescriptors.fixableDescriptors.map(function (ruleDescriptor) { + return function (sourceText) { + // create new SourceCode object + var preProcessResult = preProcess(sourceText, sourceCode.filePath); + var isPluginReturnAnAST = isTxtAST(preProcessResult); + var textForAST = isPluginReturnAnAST ? sourceText : preProcessResult.text; + var ast = isPluginReturnAnAST ? preProcessResult : preProcessResult.ast; + var newSourceCode = new TextlintSourceCodeImpl({ + text: textForAST, + ast: ast, + filePath: resultFilePath, + ext: sourceCode.ext + }); + // create new Task + var task = new FixerTask({ + config: config, + fixableRuleDescriptor: ruleDescriptor, + filterRuleDescriptors: filterRules, + sourceCode: newSourceCode, + configBaseDir: configBaseDir + }); + return TaskRunner.process(task).then(function (messages) { + var result = postProcess(messages, sourceCode.filePath); + var filteredResult = { + messages: _this.messageProcessManager.process(result.messages), + filePath: result.filePath ? result.filePath : "" + }; + // TODO: should be removed resultFilePath + resultFilePath = filteredResult.filePath; + var applied = applyFixesToSourceCode(newSourceCode, filteredResult.messages); + // add messages + Array.prototype.push.apply(applyingMessages, applied.applyingMessages); + Array.prototype.push.apply(remainingMessages, applied.remainingMessages); + Array.prototype.push.apply(originalMessages, applied.messages); + // if not fixed, still use current sourceText + if (!applied.fixed) { + return sourceText; + } + // if fixed, use fixed text at next + return applied.output; + }); + }; + }); + var promiseTask = fixerProcessList.reduce(function (promise, fixerProcess) { + return promise.then(function (sourceText) { + return fixerProcess(sourceText); + }); + }, Promise.resolve(sourceCode.text)); + return promiseTask.then(function (output) { + debug("Finish Processing: " + resultFilePath); + debug("applyingMessages: " + applyingMessages.length); + debug("remainingMessages: " + remainingMessages.length); + return { + filePath: resultFilePath ? resultFilePath : "", + output: output, + messages: originalMessages, + applyingMessages: applyingMessages, + remainingMessages: remainingMessages + }; + }); + }; + return FixerProcessor; +}()); +export default FixerProcessor; +//# sourceMappingURL=fixer-processor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/fixer/fixer-processor.js.map b/node_modules/@textlint/kernel/module/fixer/fixer-processor.js.map new file mode 100644 index 000000000..388b5b404 --- /dev/null +++ b/node_modules/@textlint/kernel/module/fixer/fixer-processor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixer-processor.js","sourceRoot":"","sources":["../../src/fixer/fixer-processor.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAI7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,IAAM,KAAK,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAUjD;IAII;;;OAGG;IACH,wBAAY,SAAkC,EAAE,qBAA4C;QACxF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACvD,CAAC;IAED;;;;;;;;OAQG;IACH,gCAAO,GAAP,UAAQ,EAMoB;QAN5B,iBAmFC;YAlFG,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,eAAe,qBAAA,EACf,WAAW,iBAAA,EACX,UAAU,gBAAA;QAEV,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QAChB,IAAA,KAA8B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAApE,UAAU,gBAAA,EAAE,WAAW,iBAA6C,CAAC;QAC7E,WAAW;QACX,IAAI,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;QACzC,0BAA0B;QAC1B,gEAAgE;QAChE,gFAAgF;QAChF,IAAM,gBAAgB,GAAsB,EAAE,CAAC;QAC/C,8BAA8B;QAC9B,IAAM,iBAAiB,GAAsB,EAAE,CAAC;QAChD,qEAAqE;QACrE,2CAA2C;QAC3C,IAAM,gBAAgB,GAAsB,EAAE,CAAC;QAC/C,IAAM,gBAAgB,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAC,cAAc;YAC3E,OAAO,UAAC,UAAkB;gBACtB,+BAA+B;gBAC/B,IAAM,gBAAgB,GAAG,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACrE,IAAM,mBAAmB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;gBACvD,IAAM,UAAU,GAAG,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBAC5E,IAAM,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC;gBAC1E,IAAM,aAAa,GAAG,IAAI,sBAAsB,CAAC;oBAC7C,IAAI,EAAE,UAAU;oBAChB,GAAG,KAAA;oBACH,QAAQ,EAAE,cAAc;oBACxB,GAAG,EAAE,UAAU,CAAC,GAAG;iBACtB,CAAC,CAAC;gBACH,kBAAkB;gBAClB,IAAM,IAAI,GAAG,IAAI,SAAS,CAAC;oBACvB,MAAM,QAAA;oBACN,qBAAqB,EAAE,cAAc;oBACrC,qBAAqB,EAAE,WAAW;oBAClC,UAAU,EAAE,aAAa;oBACzB,aAAa,eAAA;iBAChB,CAAC,CAAC;gBAEH,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAC,QAAQ;oBAC1C,IAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;oBAC1D,IAAM,cAAc,GAAG;wBACnB,QAAQ,EAAE,KAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;wBAC7D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAU,UAAU,CAAC,GAAG,MAAG;qBAC5E,CAAC;oBACF,yCAAyC;oBACzC,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC;oBACzC,IAAM,OAAO,GAAG,sBAAsB,CAAC,aAAa,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;oBAC/E,eAAe;oBACf,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;oBACvE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;oBACzE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC/D,6CAA6C;oBAC7C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;wBAChB,OAAO,UAAU,CAAC;qBACrB;oBACD,mCAAmC;oBACnC,OAAO,OAAO,CAAC,MAAM,CAAC;gBAC1B,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,IAAM,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,UAAC,OAAO,EAAE,YAAY;YAC9D,OAAO,OAAO,CAAC,IAAI,CAAC,UAAC,UAAU;gBAC3B,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACP,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAErC,OAAO,WAAW,CAAC,IAAI,CAAC,UAAC,MAAM;YAC3B,KAAK,CAAC,wBAAsB,cAAgB,CAAC,CAAC;YAC9C,KAAK,CAAC,uBAAqB,gBAAgB,CAAC,MAAQ,CAAC,CAAC;YACtD,KAAK,CAAC,wBAAsB,iBAAiB,CAAC,MAAQ,CAAC,CAAC;YACxD,OAAO;gBACH,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAU,UAAU,CAAC,GAAG,MAAG;gBACvE,MAAM,QAAA;gBACN,QAAQ,EAAE,gBAAgB;gBAC1B,gBAAgB,kBAAA;gBAChB,iBAAiB,mBAAA;aACpB,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IACL,qBAAC;AAAD,CAAC,AA1GD,IA0GC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/fixer/rule-fixer.d.ts b/node_modules/@textlint/kernel/module/fixer/rule-fixer.d.ts new file mode 100644 index 000000000..b7b66a3b8 --- /dev/null +++ b/node_modules/@textlint/kernel/module/fixer/rule-fixer.d.ts @@ -0,0 +1,122 @@ +import { TxtNode } from "@textlint/ast-node-types"; +import type { TextlintSourceCodeRange } from "@textlint/types"; +/** + * Fix Command object has `range` and `text`. + * `IntermediateFixCommand` has also `isAbsolute` flag value. + */ +export interface IntermediateFixCommand { + text: string; + range: number[]; + isAbsolute: boolean; +} +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +export default class RuleFixer { + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfter(node: TxtNode, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfterRange(range: TextlintSourceCodeRange, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBefore(node: TxtNode, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBeforeRange(range: TextlintSourceCodeRange, text: string): { + range: number[]; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceText(node: TxtNode, text: string): { + range: import("@textlint/ast-node-types").TextNodeRange; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceTextRange(range: TextlintSourceCodeRange, text: string): { + range: TextlintSourceCodeRange; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + remove(node: TxtNode): { + range: import("@textlint/ast-node-types").TextNodeRange; + text: string; + isAbsolute: boolean; + }; + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + removeRange(range: TextlintSourceCodeRange): { + range: TextlintSourceCodeRange; + text: string; + isAbsolute: boolean; + }; +} diff --git a/node_modules/@textlint/kernel/module/fixer/rule-fixer.js b/node_modules/@textlint/kernel/module/fixer/rule-fixer.js new file mode 100644 index 000000000..a25542f52 --- /dev/null +++ b/node_modules/@textlint/kernel/module/fixer/rule-fixer.js @@ -0,0 +1,139 @@ +import * as assert from "assert"; +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAt(index, text) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text: text, + isAbsolute: false + }; +} +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAtAbsolute(index, text) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text: text, + isAbsolute: true + }; +} +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +var RuleFixer = /** @class */ (function () { + function RuleFixer() { + } + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.insertTextAfter = function (node, text) { + return insertTextAtAbsolute(node.range[1], text); + }; + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.insertTextAfterRange = function (range, text) { + return insertTextAt(range[1], text); + }; + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.insertTextBefore = function (node, text) { + return insertTextAtAbsolute(node.range[0], text); + }; + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.insertTextBeforeRange = function (range, text) { + return insertTextAt(range[0], text); + }; + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.replaceText = function (node, text) { + return { + range: node.range, + text: text, + isAbsolute: true + }; + }; + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.replaceTextRange = function (range, text) { + return { + range: range, + text: text, + isAbsolute: false + }; + }; + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.remove = function (node) { + return this.replaceText(node, ""); + }; + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + RuleFixer.prototype.removeRange = function (range) { + return this.replaceTextRange(range, ""); + }; + return RuleFixer; +}()); +export default RuleFixer; +//# sourceMappingURL=rule-fixer.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/fixer/rule-fixer.js.map b/node_modules/@textlint/kernel/module/fixer/rule-fixer.js.map new file mode 100644 index 000000000..0d90ddd24 --- /dev/null +++ b/node_modules/@textlint/kernel/module/fixer/rule-fixer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rule-fixer.js","sourceRoot":"","sources":["../../src/fixer/rule-fixer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAcjC;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,KAAa,EAAE,IAAY;IAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvC,OAAO;QACH,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACrB,IAAI,MAAA;QACJ,UAAU,EAAE,KAAK;KACpB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,KAAa,EAAE,IAAY;IACrD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvC,OAAO;QACH,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACrB,IAAI,MAAA;QACJ,UAAU,EAAE,IAAI;KACnB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH;IAAA;IAsGA,CAAC;IArGG;;;;;;OAMG;IACH,mCAAe,GAAf,UAAgB,IAAa,EAAE,IAAY;QACvC,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;OAQG;IACH,wCAAoB,GAApB,UAAqB,KAA8B,EAAE,IAAY;QAC7D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,oCAAgB,GAAhB,UAAiB,IAAa,EAAE,IAAY;QACxC,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;OAQG;IACH,yCAAqB,GAArB,UAAsB,KAA8B,EAAE,IAAY;QAC9D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,+BAAW,GAAX,UAAY,IAAa,EAAE,IAAY;QACnC,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,MAAA;YACJ,UAAU,EAAE,IAAI;SACnB,CAAC;IACN,CAAC;IAED;;;;;;;;OAQG;IACH,oCAAgB,GAAhB,UAAiB,KAA8B,EAAE,IAAY;QACzD,OAAO;YACH,KAAK,OAAA;YACL,IAAI,MAAA;YACJ,UAAU,EAAE,KAAK;SACpB,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACH,0BAAM,GAAN,UAAO,IAAa;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,+BAAW,GAAX,UAAY,KAA8B;QACtC,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IACL,gBAAC;AAAD,CAAC,AAtGD,IAsGC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/index.d.ts b/node_modules/@textlint/kernel/module/index.d.ts new file mode 100644 index 000000000..fd5e891a5 --- /dev/null +++ b/node_modules/@textlint/kernel/module/index.d.ts @@ -0,0 +1,14 @@ +export { TextlintKernel } from "./textlint-kernel"; +export * from "./descriptor/index"; +export { TextlintKernelRule, TextlintKernelFilterRule, TextlintKernelPlugin } from "./textlint-kernel-interface"; +/** + * Types of textlint lint/fix result + */ +export type { TextlintResult, TextlintFixResult, TextlintMessageFixCommand, TextlintMessage } from "@textlint/types"; +/** + * @deprecated These types will removed in the future. Use @textlint/types instead of it + * If you use these types in your rule, you should use @textlint/types for your rule. + * Related changes: https://github.com/textlint/textlint/pull/562 + */ +export type { TextlintRuleReporter, TextlintRuleModule, TextlintRuleOptions, TextlintRuleSeverityLevel, TextlintFilterRuleReporter, TextlintFilterRuleOptions, TextlintPluginCreator, TextlintPluginOptions, TextlintPluginProcessor, TextlintPluginProcessorConstructor } from "@textlint/types"; +export { TextlintRuleSeverityLevelKeys } from "./context/TextlintRuleSeverityLevelKeys"; diff --git a/node_modules/@textlint/kernel/module/index.js b/node_modules/@textlint/kernel/module/index.js new file mode 100644 index 000000000..fa02d71d7 --- /dev/null +++ b/node_modules/@textlint/kernel/module/index.js @@ -0,0 +1,7 @@ +// Kernel +export { TextlintKernel } from "./textlint-kernel"; +// Kernel Descriptor +export * from "./descriptor/index"; +// TextlintRuleSeverityLevel Key +export { TextlintRuleSeverityLevelKeys } from "./context/TextlintRuleSeverityLevelKeys"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/index.js.map b/node_modules/@textlint/kernel/module/index.js.map new file mode 100644 index 000000000..ce488eb31 --- /dev/null +++ b/node_modules/@textlint/kernel/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,oBAAoB;AACpB,cAAc,oBAAoB,CAAC;AA4BnC,gCAAgC;AAChC,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/linter/linter-processor.d.ts b/node_modules/@textlint/kernel/module/linter/linter-processor.d.ts new file mode 100644 index 000000000..b38d72a66 --- /dev/null +++ b/node_modules/@textlint/kernel/module/linter/linter-processor.d.ts @@ -0,0 +1,24 @@ +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import MessageProcessManager from "../messages/MessageProcessManager"; +import { TextlintFilterRuleDescriptors, TextlintRuleDescriptors } from "../descriptor"; +import type { TextlintSourceCode, TextlintPluginProcessor, TextlintResult } from "@textlint/types"; +export interface LinterProcessorArgs { + config: TextlintKernelConstructorOptions; + configBaseDir?: string; + ruleDescriptors: TextlintRuleDescriptors; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; +} +export default class LinterProcessor { + private processor; + private messageProcessManager; + /** + * @param {Processor} processor + * @param {MessageProcessManager} messageProcessManager + */ + constructor(processor: TextlintPluginProcessor, messageProcessManager: MessageProcessManager); + /** + * Run linter process + */ + process({ config, configBaseDir, ruleDescriptors, filterRuleDescriptors, sourceCode }: LinterProcessorArgs): Promise; +} diff --git a/node_modules/@textlint/kernel/module/linter/linter-processor.js b/node_modules/@textlint/kernel/module/linter/linter-processor.js new file mode 100644 index 000000000..0ddd436d0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/linter/linter-processor.js @@ -0,0 +1,43 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; +import LinterTask from "../task/linter-task"; +import TaskRunner from "../task/task-runner"; +var LinterProcessor = /** @class */ (function () { + /** + * @param {Processor} processor + * @param {MessageProcessManager} messageProcessManager + */ + function LinterProcessor(processor, messageProcessManager) { + this.processor = processor; + this.messageProcessManager = messageProcessManager; + } + /** + * Run linter process + */ + LinterProcessor.prototype.process = function (_a) { + var _this = this; + var config = _a.config, configBaseDir = _a.configBaseDir, ruleDescriptors = _a.ruleDescriptors, filterRuleDescriptors = _a.filterRuleDescriptors, sourceCode = _a.sourceCode; + var _b = this.processor.processor(sourceCode.ext), preProcess = _b.preProcess, postProcess = _b.postProcess; + assert.ok(typeof preProcess === "function" && typeof postProcess === "function", "processor should implement {preProcess, postProcess}"); + var task = new LinterTask({ + config: config, + ruleDescriptors: ruleDescriptors, + filterRuleDescriptors: filterRuleDescriptors, + sourceCode: sourceCode, + configBaseDir: configBaseDir + }); + return TaskRunner.process(task).then(function (messages) { + var result = postProcess(messages, sourceCode.filePath); + result.messages = _this.messageProcessManager.process(result.messages); + if (result.filePath == null) { + result.filePath = ""; + } + assert.ok(result.filePath && result.messages.length >= 0, "postProcess should return { messages, filePath } "); + return result; + }); + }; + return LinterProcessor; +}()); +export default LinterProcessor; +//# sourceMappingURL=linter-processor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/linter/linter-processor.js.map b/node_modules/@textlint/kernel/module/linter/linter-processor.js.map new file mode 100644 index 000000000..a97334892 --- /dev/null +++ b/node_modules/@textlint/kernel/module/linter/linter-processor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"linter-processor.js","sourceRoot":"","sources":["../../src/linter/linter-processor.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAe7C;IAII;;;OAGG;IACH,yBAAY,SAAkC,EAAE,qBAA4C;QACxF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,iCAAO,GAAP,UAAQ,EAMc;QANtB,iBA+BC;YA9BG,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,eAAe,qBAAA,EACf,qBAAqB,2BAAA,EACrB,UAAU,gBAAA;QAEJ,IAAA,KAA8B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAApE,UAAU,gBAAA,EAAE,WAAW,iBAA6C,CAAC;QAC7E,MAAM,CAAC,EAAE,CACL,OAAO,UAAU,KAAK,UAAU,IAAI,OAAO,WAAW,KAAK,UAAU,EACrE,sDAAsD,CACzD,CAAC;QACF,IAAM,IAAI,GAAG,IAAI,UAAU,CAAC;YACxB,MAAM,QAAA;YACN,eAAe,EAAE,eAAe;YAChC,qBAAqB,EAAE,qBAAqB;YAC5C,UAAU,YAAA;YACV,aAAa,eAAA;SAChB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAC,QAAQ;YAC1C,IAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC1D,MAAM,CAAC,QAAQ,GAAG,KAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtE,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE;gBACzB,MAAM,CAAC,QAAQ,GAAG,YAAU,UAAU,CAAC,GAAG,MAAG,CAAC;aACjD;YACD,MAAM,CAAC,EAAE,CACL,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAC9C,mDAAmD,CACtD,CAAC;YACF,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,sBAAC;AAAD,CAAC,AAhDD,IAgDC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/MessageProcessManager.d.ts b/node_modules/@textlint/kernel/module/messages/MessageProcessManager.d.ts new file mode 100644 index 000000000..ae65e58e0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/MessageProcessManager.d.ts @@ -0,0 +1,20 @@ +import { IgnoreReportedMessage, LintReportedMessage } from "../task/textlint-core-task"; +import type { TextlintMessage } from "@textlint/types"; +export declare type PreMessageProcessor = (messages: Array) => Array; +export declare type MessageProcessor = (messages: TextlintMessage[]) => TextlintMessage[]; +export default class MessageProcessManager { + private _preProcessors; + private _processors; + /** + * Preprossor + */ + constructor(preProcessors: PreMessageProcessor[]); + add(messageProcessor: MessageProcessor): void; + remove(process: MessageProcessor): void; + /** + * process `messages` with registered processes + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ + process(messages: Array): TextlintMessage[]; +} diff --git a/node_modules/@textlint/kernel/module/messages/MessageProcessManager.js b/node_modules/@textlint/kernel/module/messages/MessageProcessManager.js new file mode 100644 index 000000000..f44d6a99f --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/MessageProcessManager.js @@ -0,0 +1,43 @@ +// LICENSE : MIT +"use strict"; +var MessageProcessManager = /** @class */ (function () { + /** + * Preprossor + */ + function MessageProcessManager(preProcessors) { + this._preProcessors = preProcessors || []; + this._processors = []; + } + MessageProcessManager.prototype.add = function (messageProcessor) { + this._processors.push(messageProcessor); + }; + MessageProcessManager.prototype.remove = function (process) { + var index = this._processors.indexOf(process); + if (index !== -1) { + this._processors.splice(index, 1); + } + }; + /** + * process `messages` with registered processes + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ + MessageProcessManager.prototype.process = function (messages) { + var originalMessages = messages; + if (this._preProcessors.length === 0) { + throw new Error("pre process should be > 0"); + } + var preProcessedMesssages = this._preProcessors.reduce(function (messages, filter) { + return filter(messages); + }, originalMessages); + if (this._processors.length === 0) { + return preProcessedMesssages; + } + return this._processors.reduce(function (messages, filter) { + return filter(messages); + }, preProcessedMesssages); + }; + return MessageProcessManager; +}()); +export default MessageProcessManager; +//# sourceMappingURL=MessageProcessManager.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/MessageProcessManager.js.map b/node_modules/@textlint/kernel/module/messages/MessageProcessManager.js.map new file mode 100644 index 000000000..3f2f7d213 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/MessageProcessManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageProcessManager.js","sourceRoot":"","sources":["../../src/messages/MessageProcessManager.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AASb;IAII;;OAEG;IACH,+BAAY,aAAoC;QAC5C,IAAI,CAAC,cAAc,GAAG,aAAa,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,mCAAG,GAAH,UAAI,gBAAkC;QAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IAED,sCAAM,GAAN,UAAO,OAAyB;QAC5B,IAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACrC;IACL,CAAC;IAED;;;;OAIG;IACH,uCAAO,GAAP,UAAQ,QAA4D;QAChE,IAAM,gBAAgB,GAAG,QAAQ,CAAC;QAClC,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;QACD,IAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,UAAC,QAAQ,EAAE,MAAM;YACtE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC,EAAE,gBAAgB,CAAsB,CAAC;QAC1C,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,OAAO,qBAAqB,CAAC;SAChC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAC,QAAQ,EAAE,MAAM;YAC5C,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAC9B,CAAC;IACL,4BAAC;AAAD,CAAC,AA3CD,IA2CC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.d.ts b/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.d.ts new file mode 100644 index 000000000..d718330db --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.d.ts @@ -0,0 +1,7 @@ +import type { TextlintMessage } from "@textlint/types"; +/** + * filter duplicated messages + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} filtered messages + */ +export default function filterDuplicatedMessages(messages?: TextlintMessage[]): TextlintMessage[]; diff --git a/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.js b/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.js new file mode 100644 index 000000000..19b1338e0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.js @@ -0,0 +1,26 @@ +// LICENSE : MIT +"use strict"; +/** + * @param {TextlintMessage} aMessage + * @param {TextlintMessage} bMessage + */ +var isEqualMessage = function (aMessage, bMessage) { + return (aMessage.index === bMessage.index && + aMessage.severity === bMessage.severity && + aMessage.message === bMessage.message); +}; +/** + * filter duplicated messages + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} filtered messages + */ +export default function filterDuplicatedMessages(messages) { + if (messages === void 0) { messages = []; } + return messages.filter(function (message, index) { + var restMessages = messages.slice(index + 1); + return !restMessages.some(function (restMessage) { + return isEqualMessage(message, restMessage); + }); + }); +} +//# sourceMappingURL=filter-duplicated-process.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.js.map b/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.js.map new file mode 100644 index 000000000..a0d0a0f60 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-duplicated-process.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter-duplicated-process.js","sourceRoot":"","sources":["../../src/messages/filter-duplicated-process.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb;;;GAGG;AACH,IAAM,cAAc,GAAG,UAAC,QAAyB,EAAE,QAAyB;IACxE,OAAO,CACH,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK;QACjC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;QACvC,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO,CACxC,CAAC;AACN,CAAC,CAAC;AACF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,QAAgC;IAAhC,yBAAA,EAAA,aAAgC;IAC7E,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAC,OAAO,EAAE,KAAK;QAClC,IAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC/C,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,UAAC,WAAW;YAClC,OAAO,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/filter-ignored-process.d.ts b/node_modules/@textlint/kernel/module/messages/filter-ignored-process.d.ts new file mode 100644 index 000000000..0f7317454 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-ignored-process.d.ts @@ -0,0 +1,7 @@ +import { IgnoreReportedMessage, LintReportedMessage } from "../task/textlint-core-task"; +/** + * filter messages by ignore messages + * @param {Object[]} messages + * @returns {Object[]} filtered messages + */ +export default function filterMessages(messages?: ReadonlyArray): LintReportedMessage[]; diff --git a/node_modules/@textlint/kernel/module/messages/filter-ignored-process.js b/node_modules/@textlint/kernel/module/messages/filter-ignored-process.js new file mode 100644 index 000000000..75a3014c3 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-ignored-process.js @@ -0,0 +1,43 @@ +// LICENSE : MIT +"use strict"; +import MessageType from "../shared/type/MessageType"; +/** + * the `index` is in the `range` and return true. + * @param {Number} index + * @param {Number[]} range + * @returns {boolean} + */ +var isContainedRange = function (index, range) { + var start = range[0], end = range[1]; + return start <= index && index <= end; +}; +/** + * filter messages by ignore messages + * @param {Object[]} messages + * @returns {Object[]} filtered messages + */ +export default function filterMessages(messages) { + if (messages === void 0) { messages = []; } + var lintingMessages = messages.filter(function (message) { + return message.type === MessageType.lint; + }); + var ignoreMessages = messages.filter(function (message) { + return message.type === MessageType.ignore; + }); + // if match, reject the message + return lintingMessages.filter(function (message) { + return !ignoreMessages.some(function (ignoreMessage) { + var isInIgnoringRange = isContainedRange(message.index, ignoreMessage.range); + if (isInIgnoringRange && ignoreMessage.ignoringRuleId) { + // "*" is wildcard that match any rule + if (ignoreMessage.ignoringRuleId === "*") { + return true; + } + // compare normalized key path + return message.ruleId === ignoreMessage.ignoringRuleId; + } + return isInIgnoringRange; + }); + }); +} +//# sourceMappingURL=filter-ignored-process.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/filter-ignored-process.js.map b/node_modules/@textlint/kernel/module/messages/filter-ignored-process.js.map new file mode 100644 index 000000000..0d4a1bcd7 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-ignored-process.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter-ignored-process.js","sourceRoot":"","sources":["../../src/messages/filter-ignored-process.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAGrD;;;;;GAKG;AACH,IAAM,gBAAgB,GAAG,UAAC,KAAa,EAAE,KAAuB;IACrD,IAAA,KAAK,GAAS,KAAK,GAAd,EAAE,GAAG,GAAI,KAAK,GAAT,CAAU;IAC3B,OAAO,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC;AAC1C,CAAC,CAAC;AACF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAyE;IAAzE,yBAAA,EAAA,aAAyE;IAC5G,IAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAC,OAAO;QAC5C,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC;IAC7C,CAAC,CAA0B,CAAC;IAC5B,IAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAC,OAAO;QAC3C,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM,CAAC;IAC/C,CAAC,CAA4B,CAAC;IAC9B,+BAA+B;IAC/B,OAAO,eAAe,CAAC,MAAM,CAAC,UAAC,OAAO;QAClC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAC,aAAa;YACtC,IAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;YAC/E,IAAI,iBAAiB,IAAI,aAAa,CAAC,cAAc,EAAE;gBACnD,sCAAsC;gBACtC,IAAI,aAAa,CAAC,cAAc,KAAK,GAAG,EAAE;oBACtC,OAAO,IAAI,CAAC;iBACf;gBACD,8BAA8B;gBAC9B,OAAO,OAAO,CAAC,MAAM,KAAK,aAAa,CAAC,cAAc,CAAC;aAC1D;YACD,OAAO,iBAAiB,CAAC;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/filter-severity-process.d.ts b/node_modules/@textlint/kernel/module/messages/filter-severity-process.d.ts new file mode 100644 index 000000000..809d3a2c2 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-severity-process.d.ts @@ -0,0 +1,20 @@ +import type { TextlintMessage } from "@textlint/types"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +/** + * Filter messages by their severity. + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} filtered messages + */ +export declare function filterWarningMessages(messages?: TextlintMessage[]): TextlintMessage[]; +/** + * Pass through all messages. + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ +export declare function through(messages?: T[]): T[]; +/** + * Create message filter by config.quiet. + * @param {Config} config + * @returns {Function} filter function for messages + */ +export default function createSeverityFilter(config: TextlintKernelConstructorOptions): (messages: TextlintMessage[]) => TextlintMessage[]; diff --git a/node_modules/@textlint/kernel/module/messages/filter-severity-process.js b/node_modules/@textlint/kernel/module/messages/filter-severity-process.js new file mode 100644 index 000000000..993cb5276 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-severity-process.js @@ -0,0 +1,37 @@ +// LICENSE : MIT +"use strict"; +import { TextlintRuleSeverityLevelKeys } from "../context/TextlintRuleSeverityLevelKeys"; +/** + * Filter messages by their severity. + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} filtered messages + */ +export function filterWarningMessages(messages) { + if (messages === void 0) { messages = []; } + return messages.filter(function (message) { + return message.severity === TextlintRuleSeverityLevelKeys.error; + }); +} +/** + * Pass through all messages. + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ +export function through(messages) { + if (messages === void 0) { messages = []; } + return messages; +} +/** + * Create message filter by config.quiet. + * @param {Config} config + * @returns {Function} filter function for messages + */ +export default function createSeverityFilter(config) { + if (config.quiet) { + return filterWarningMessages; + } + else { + return through; + } +} +//# sourceMappingURL=filter-severity-process.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/filter-severity-process.js.map b/node_modules/@textlint/kernel/module/messages/filter-severity-process.js.map new file mode 100644 index 000000000..b7f536177 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/filter-severity-process.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter-severity-process.js","sourceRoot":"","sources":["../../src/messages/filter-severity-process.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgC;IAAhC,yBAAA,EAAA,aAAgC;IAClE,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAC,OAAO;QAC3B,OAAO,OAAO,CAAC,QAAQ,KAAK,6BAA6B,CAAC,KAAK,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAI,QAAkB;IAAlB,yBAAA,EAAA,aAAkB;IACzC,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CACxC,MAAwC;IAExC,IAAI,MAAM,CAAC,KAAK,EAAE;QACd,OAAO,qBAAqB,CAAC;KAChC;SAAM;QACH,OAAO,OAAO,CAAC;KAClB;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/sort-messages-process.d.ts b/node_modules/@textlint/kernel/module/messages/sort-messages-process.d.ts new file mode 100644 index 000000000..cd5913507 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/sort-messages-process.d.ts @@ -0,0 +1,7 @@ +import type { TextlintMessage } from "@textlint/types"; +/** + * sort messages by line and column + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ +export default function sortByLineColumn(messages: TextlintMessage[]): TextlintMessage[]; diff --git a/node_modules/@textlint/kernel/module/messages/sort-messages-process.js b/node_modules/@textlint/kernel/module/messages/sort-messages-process.js new file mode 100644 index 000000000..ebb8b770c --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/sort-messages-process.js @@ -0,0 +1,20 @@ +// LICENSE : MIT +"use strict"; +/** + * sort messages by line and column + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ +export default function sortByLineColumn(messages) { + // sort by line and column + return messages.sort(function (a, b) { + var lineDiff = a.line - b.line; + if (lineDiff === 0) { + return a.column - b.column; + } + else { + return lineDiff; + } + }); +} +//# sourceMappingURL=sort-messages-process.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/messages/sort-messages-process.js.map b/node_modules/@textlint/kernel/module/messages/sort-messages-process.js.map new file mode 100644 index 000000000..30c0f5f39 --- /dev/null +++ b/node_modules/@textlint/kernel/module/messages/sort-messages-process.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sort-messages-process.js","sourceRoot":"","sources":["../../src/messages/sort-messages-process.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,QAA2B;IAChE,0BAA0B;IAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,IAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACjC,IAAI,QAAQ,KAAK,CAAC,EAAE;YAChB,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;SAC9B;aAAM;YACH,OAAO,QAAQ,CAAC;SACnB;IACL,CAAC,CAAC,CAAC;AACP,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/shared/rule-severity.d.ts b/node_modules/@textlint/kernel/module/shared/rule-severity.d.ts new file mode 100644 index 000000000..37ba24a45 --- /dev/null +++ b/node_modules/@textlint/kernel/module/shared/rule-severity.d.ts @@ -0,0 +1,7 @@ +import type { TextlintRuleOptions, TextlintRuleSeverityLevel } from "@textlint/types"; +/** + * get severity level from ruleConfig. + * @param {Object|boolean|undefined} ruleConfig + * @returns {number} + */ +export declare function getSeverity(ruleConfig?: TextlintRuleOptions): TextlintRuleSeverityLevel; diff --git a/node_modules/@textlint/kernel/module/shared/rule-severity.js b/node_modules/@textlint/kernel/module/shared/rule-severity.js new file mode 100644 index 000000000..fd3033e82 --- /dev/null +++ b/node_modules/@textlint/kernel/module/shared/rule-severity.js @@ -0,0 +1,32 @@ +// LICENSE : MIT +"use strict"; +import { TextlintRuleSeverityLevelKeys } from "../context/TextlintRuleSeverityLevelKeys"; +var isSeverityLevelValue = function (type) { + if (type === undefined) { + throw new Error("Please set following value to severity:\n\"rule-key\": {\n \"severity\": \"\"\n}"); + } + return true; +}; +/** + * get severity level from ruleConfig. + * @param {Object|boolean|undefined} ruleConfig + * @returns {number} + */ +export function getSeverity(ruleConfig) { + if (ruleConfig === undefined) { + return TextlintRuleSeverityLevelKeys.error; + } + // rule: + if (typeof ruleConfig === "boolean") { + return ruleConfig ? TextlintRuleSeverityLevelKeys.error : TextlintRuleSeverityLevelKeys.none; + } + if (ruleConfig.severity) { + var severityValue = TextlintRuleSeverityLevelKeys[ruleConfig.severity]; + if (!isSeverityLevelValue(severityValue)) { + throw new Error("Please set following value to severity:\n\"rule-key\": {\n \"severity\": \"\"\n}"); + } + return severityValue; + } + return TextlintRuleSeverityLevelKeys.error; +} +//# sourceMappingURL=rule-severity.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/shared/rule-severity.js.map b/node_modules/@textlint/kernel/module/shared/rule-severity.js.map new file mode 100644 index 000000000..7bef3814f --- /dev/null +++ b/node_modules/@textlint/kernel/module/shared/rule-severity.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rule-severity.js","sourceRoot":"","sources":["../../src/shared/rule-severity.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,IAAM,oBAAoB,GAAG,UAAC,IAAS;IACnC,IAAI,IAAI,KAAK,SAAS,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,oGAGtB,CAAC,CAAC;KACC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAAgC;IACxD,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,OAAO,6BAA6B,CAAC,KAAK,CAAC;KAC9C;IACD,oBAAoB;IACpB,IAAI,OAAO,UAAU,KAAK,SAAS,EAAE;QACjC,OAAO,UAAU,CAAC,CAAC,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC,6BAA6B,CAAC,IAAI,CAAC;KAChG;IACD,IAAI,UAAU,CAAC,QAAQ,EAAE;QACrB,IAAM,aAAa,GAAG,6BAA6B,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACzE,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,oGAG1B,CAAC,CAAC;SACK;QACD,OAAO,aAAa,CAAC;KACxB;IACD,OAAO,6BAA6B,CAAC,KAAK,CAAC;AAC/C,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/shared/type/MessageType.d.ts b/node_modules/@textlint/kernel/module/shared/type/MessageType.d.ts new file mode 100644 index 000000000..5da8abb11 --- /dev/null +++ b/node_modules/@textlint/kernel/module/shared/type/MessageType.d.ts @@ -0,0 +1,10 @@ +declare const _default: { + lint: string; + ignore: string; +}; +/** + * TextLintMessage type + * @typedef {Object} MessageType + * @type {{lint: string, ignore: string}} + */ +export default _default; diff --git a/node_modules/@textlint/kernel/module/shared/type/MessageType.js b/node_modules/@textlint/kernel/module/shared/type/MessageType.js new file mode 100644 index 000000000..605d76eb7 --- /dev/null +++ b/node_modules/@textlint/kernel/module/shared/type/MessageType.js @@ -0,0 +1,12 @@ +/** + * TextLintMessage type + * @typedef {Object} MessageType + * @type {{lint: string, ignore: string}} + */ +export default { + // Linting(also include Fix) Message Type + lint: "lint", + // Ignoring Message Type + ignore: "ignore" +}; +//# sourceMappingURL=MessageType.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/shared/type/MessageType.js.map b/node_modules/@textlint/kernel/module/shared/type/MessageType.js.map new file mode 100644 index 000000000..79acdeaee --- /dev/null +++ b/node_modules/@textlint/kernel/module/shared/type/MessageType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageType.js","sourceRoot":"","sources":["../../../src/shared/type/MessageType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAe;IACX,yCAAyC;IACzC,IAAI,EAAE,MAAM;IACZ,wBAAwB;IACxB,MAAM,EAAE,QAAQ;CACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/fixer-task.d.ts b/node_modules/@textlint/kernel/module/task/fixer-task.d.ts new file mode 100644 index 000000000..7bf7b9cf7 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/fixer-task.d.ts @@ -0,0 +1,21 @@ +import CoreTask from "./textlint-core-task"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptors, TextlintFixableRuleDescriptor } from "../descriptor"; +import type { TextlintSourceCode } from "@textlint/types"; +export interface TextLintCoreTaskArgs { + config: TextlintKernelConstructorOptions; + fixableRuleDescriptor: TextlintFixableRuleDescriptor; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; +} +export default class TextLintCoreTask extends CoreTask { + config: TextlintKernelConstructorOptions; + fixableRuleDescriptor: TextlintFixableRuleDescriptor; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; + constructor({ config, configBaseDir, fixableRuleDescriptor, filterRuleDescriptors, sourceCode }: TextLintCoreTaskArgs); + start(): void; + private _setupRules; +} diff --git a/node_modules/@textlint/kernel/module/task/fixer-task.js b/node_modules/@textlint/kernel/module/task/fixer-task.js new file mode 100644 index 000000000..948693322 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/fixer-task.js @@ -0,0 +1,70 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import CoreTask from "./textlint-core-task"; +import { getSeverity } from "../shared/rule-severity"; +import { TextlintFilterRuleContextImpl } from "../context/TextlintFilterRuleContextImpl"; +import { TextlintRuleContextImpl } from "../context/TextlintRuleContextImpl"; +import _debug from "debug"; +var debug = _debug("textlint:TextLintCoreTask"); +var TextLintCoreTask = /** @class */ (function (_super) { + __extends(TextLintCoreTask, _super); + function TextLintCoreTask(_a) { + var config = _a.config, configBaseDir = _a.configBaseDir, fixableRuleDescriptor = _a.fixableRuleDescriptor, filterRuleDescriptors = _a.filterRuleDescriptors, sourceCode = _a.sourceCode; + var _this = _super.call(this) || this; + _this.config = config; + _this.configBaseDir = configBaseDir; + _this.fixableRuleDescriptor = fixableRuleDescriptor; + _this.filterRuleDescriptors = filterRuleDescriptors; + _this.sourceCode = sourceCode; + _this._setupRules(); + return _this; + } + TextLintCoreTask.prototype.start = function () { + this.startTraverser(this.sourceCode); + }; + TextLintCoreTask.prototype._setupRules = function () { + var _this = this; + // rule + var sourceCode = this.sourceCode; + var report = this.createReporter(sourceCode); + var ignoreReport = this.createShouldIgnore(); + // setup "rules" field by using a single fixerRule + debug("fixerRule", this.fixableRuleDescriptor); + var ruleContext = new TextlintRuleContextImpl({ + ruleId: this.fixableRuleDescriptor.id, + severityLevel: getSeverity(this.fixableRuleDescriptor.normalizedOptions), + sourceCode: sourceCode, + report: report, + configBaseDir: this.configBaseDir + }); + this.tryToAddListenRule(this.fixableRuleDescriptor.fixer, ruleContext, this.fixableRuleDescriptor.normalizedOptions); + // setup "filters" field + debug("filterRules", this.filterRuleDescriptors); + this.filterRuleDescriptors.descriptors.forEach(function (filterRuleDescriptor) { + var ruleContext = new TextlintFilterRuleContextImpl({ + ruleId: filterRuleDescriptor.id, + severityLevel: getSeverity(filterRuleDescriptor.normalizedOptions), + sourceCode: sourceCode, + ignoreReport: ignoreReport, + configBaseDir: _this.configBaseDir + }); + _this.tryToAddListenRule(filterRuleDescriptor.filter, ruleContext, filterRuleDescriptor.normalizedOptions); + }); + }; + return TextLintCoreTask; +}(CoreTask)); +export default TextLintCoreTask; +//# sourceMappingURL=fixer-task.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/fixer-task.js.map b/node_modules/@textlint/kernel/module/task/fixer-task.js.map new file mode 100644 index 000000000..318101e3a --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/fixer-task.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixer-task.js","sourceRoot":"","sources":["../../src/task/fixer-task.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,MAAM,MAAM,OAAO,CAAC;AAE3B,IAAM,KAAK,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAUlD;IAA8C,oCAAQ;IAOlD,0BAAY,EAMW;YALnB,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,qBAAqB,2BAAA,EACrB,qBAAqB,2BAAA,EACrB,UAAU,gBAAA;QALd,YAOI,iBAAO,SAOV;QANG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,KAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,KAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAI,CAAC,WAAW,EAAE,CAAC;;IACvB,CAAC;IAED,gCAAK,GAAL;QACI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,sCAAW,GAAnB;QAAA,iBA+BC;QA9BG,OAAO;QACP,IAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAM,YAAY,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC/C,kDAAkD;QAClD,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC/C,IAAM,WAAW,GAAG,IAAI,uBAAuB,CAAC;YAC5C,MAAM,EAAE,IAAI,CAAC,qBAAqB,CAAC,EAAE;YACrC,aAAa,EAAE,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAC;YACxE,UAAU,YAAA;YACV,MAAM,QAAA;YACN,aAAa,EAAE,IAAI,CAAC,aAAa;SACpC,CAAC,CAAC;QACH,IAAI,CAAC,kBAAkB,CACnB,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAChC,WAAW,EACX,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAC/C,CAAC;QACF,wBAAwB;QACxB,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACjD,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,oBAAoB;YAChE,IAAM,WAAW,GAAG,IAAI,6BAA6B,CAAC;gBAClD,MAAM,EAAE,oBAAoB,CAAC,EAAE;gBAC/B,aAAa,EAAE,WAAW,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;gBAClE,UAAU,YAAA;gBACV,YAAY,cAAA;gBACZ,aAAa,EAAE,KAAI,CAAC,aAAa;aACpC,CAAC,CAAC;YACH,KAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,EAAE,WAAW,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAC9G,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AA3DD,CAA8C,QAAQ,GA2DrD"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/linter-task.d.ts b/node_modules/@textlint/kernel/module/task/linter-task.d.ts new file mode 100644 index 000000000..3b13ebffd --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/linter-task.d.ts @@ -0,0 +1,21 @@ +import CoreTask from "./textlint-core-task"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptors, TextlintRuleDescriptors } from "../descriptor"; +import type { TextlintSourceCode } from "@textlint/types"; +export interface TextLintCoreTaskArgs { + config: TextlintKernelConstructorOptions; + ruleDescriptors: TextlintRuleDescriptors; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; +} +export default class TextLintCoreTask extends CoreTask { + config: TextlintKernelConstructorOptions; + ruleDescriptors: TextlintRuleDescriptors; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; + constructor({ config, configBaseDir, ruleDescriptors, filterRuleDescriptors: filterRuleDescriptors, sourceCode }: TextLintCoreTaskArgs); + start(): void; + private _setupRules; +} diff --git a/node_modules/@textlint/kernel/module/task/linter-task.js b/node_modules/@textlint/kernel/module/task/linter-task.js new file mode 100644 index 000000000..99b3ae03e --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/linter-task.js @@ -0,0 +1,71 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import CoreTask from "./textlint-core-task"; +import { getSeverity } from "../shared/rule-severity"; +import { TextlintRuleContextImpl } from "../context/TextlintRuleContextImpl"; +import { TextlintFilterRuleContextImpl } from "../context/TextlintFilterRuleContextImpl"; +var TextLintCoreTask = /** @class */ (function (_super) { + __extends(TextLintCoreTask, _super); + function TextLintCoreTask(_a) { + var config = _a.config, configBaseDir = _a.configBaseDir, ruleDescriptors = _a.ruleDescriptors, filterRuleDescriptors = _a.filterRuleDescriptors, sourceCode = _a.sourceCode; + var _this = _super.call(this) || this; + _this.config = config; + _this.configBaseDir = configBaseDir; + _this.ruleDescriptors = ruleDescriptors; + _this.filterRuleDescriptors = filterRuleDescriptors; + _this.sourceCode = sourceCode; + _this._setupRules(); + return _this; + } + TextLintCoreTask.prototype.start = function () { + this.startTraverser(this.sourceCode); + }; + TextLintCoreTask.prototype._setupRules = function () { + var _this = this; + // rule + var sourceCode = this.sourceCode; + var report = this.createReporter(sourceCode); + var ignoreReport = this.createShouldIgnore(); + // setup "rules" field + // filter duplicated rules for improving experience + // see https://github.com/textlint/textlint/issues/219 + this.ruleDescriptors.lintableDescriptors.forEach(function (ruleDescriptor) { + var ruleOptions = ruleDescriptor.normalizedOptions; + var ruleContext = new TextlintRuleContextImpl({ + ruleId: ruleDescriptor.id, + severityLevel: getSeverity(ruleOptions), + sourceCode: sourceCode, + report: report, + configBaseDir: _this.configBaseDir + }); + _this.tryToAddListenRule(ruleDescriptor.linter, ruleContext, ruleOptions); + }); + // setup "filters" field + this.filterRuleDescriptors.descriptors.forEach(function (filterDescriptor) { + var ruleContext = new TextlintFilterRuleContextImpl({ + ruleId: filterDescriptor.id, + sourceCode: sourceCode, + ignoreReport: ignoreReport, + configBaseDir: _this.configBaseDir, + severityLevel: getSeverity(filterDescriptor.normalizedOptions) + }); + _this.tryToAddListenRule(filterDescriptor.filter, ruleContext, filterDescriptor.normalizedOptions); + }); + }; + return TextLintCoreTask; +}(CoreTask)); +export default TextLintCoreTask; +//# sourceMappingURL=linter-task.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/linter-task.js.map b/node_modules/@textlint/kernel/module/task/linter-task.js.map new file mode 100644 index 000000000..5bc5b376e --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/linter-task.js.map @@ -0,0 +1 @@ +{"version":3,"file":"linter-task.js","sourceRoot":"","sources":["../../src/task/linter-task.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAUzF;IAA8C,oCAAQ;IAOlD,0BAAY,EAMW;YALnB,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,eAAe,qBAAA,EACQ,qBAAqB,2BAAA,EAC5C,UAAU,gBAAA;QALd,YAOI,iBAAO,SAOV;QANG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,KAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAI,CAAC,WAAW,EAAE,CAAC;;IACvB,CAAC;IAED,gCAAK,GAAL;QACI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,sCAAW,GAAnB;QAAA,iBA8BC;QA7BG,OAAO;QACP,IAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAM,YAAY,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC/C,sBAAsB;QACtB,mDAAmD;QACnD,sDAAsD;QACtD,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,UAAC,cAAc;YAC5D,IAAM,WAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC;YACrD,IAAM,WAAW,GAAG,IAAI,uBAAuB,CAAC;gBAC5C,MAAM,EAAE,cAAc,CAAC,EAAE;gBACzB,aAAa,EAAE,WAAW,CAAC,WAAW,CAAC;gBACvC,UAAU,YAAA;gBACV,MAAM,QAAA;gBACN,aAAa,EAAE,KAAI,CAAC,aAAa;aACpC,CAAC,CAAC;YACH,KAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;QACH,wBAAwB;QACxB,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,gBAAgB;YAC5D,IAAM,WAAW,GAAG,IAAI,6BAA6B,CAAC;gBAClD,MAAM,EAAE,gBAAgB,CAAC,EAAE;gBAC3B,UAAU,YAAA;gBACV,YAAY,cAAA;gBACZ,aAAa,EAAE,KAAI,CAAC,aAAa;gBACjC,aAAa,EAAE,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;aACjE,CAAC,CAAC;YACH,KAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QACtG,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AA1DD,CAA8C,QAAQ,GA0DrD"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/promise-event-emitter.d.ts b/node_modules/@textlint/kernel/module/task/promise-event-emitter.d.ts new file mode 100644 index 000000000..32fa973b8 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/promise-event-emitter.d.ts @@ -0,0 +1,9 @@ +/// +import { EventEmitter } from "events"; +export declare class PromiseEventEmitter { + private events; + constructor(); + listenerCount(type: string | symbol): number; + on(event: string, listener: (...args: any[]) => void): EventEmitter; + emit(event: string, ...args: Array): Promise>; +} diff --git a/node_modules/@textlint/kernel/module/task/promise-event-emitter.js b/node_modules/@textlint/kernel/module/task/promise-event-emitter.js new file mode 100644 index 000000000..4fa90ecb8 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/promise-event-emitter.js @@ -0,0 +1,31 @@ +// MIT © 2017 azu +// MIT © 2017 59naga +// https://github.com/59naga/carrack +"use strict"; +import { EventEmitter } from "events"; +var PromiseEventEmitter = /** @class */ (function () { + function PromiseEventEmitter() { + this.events = new EventEmitter(); + this.events.setMaxListeners(0); + } + PromiseEventEmitter.prototype.listenerCount = function (type) { + return this.events.listenerCount(type); + }; + PromiseEventEmitter.prototype.on = function (event, listener) { + return this.events.on(event, listener); + }; + PromiseEventEmitter.prototype.emit = function (event) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var promises = []; + this.events.listeners(event).forEach(function (listener) { + promises.push(listener.apply(void 0, args)); + }); + return Promise.all(promises); + }; + return PromiseEventEmitter; +}()); +export { PromiseEventEmitter }; +//# sourceMappingURL=promise-event-emitter.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/promise-event-emitter.js.map b/node_modules/@textlint/kernel/module/task/promise-event-emitter.js.map new file mode 100644 index 000000000..e3a4fff48 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/promise-event-emitter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"promise-event-emitter.js","sourceRoot":"","sources":["../../src/task/promise-event-emitter.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,oBAAoB;AACpB,oCAAoC;AACpC,YAAY,CAAC;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;IAGI;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,2CAAa,GAAb,UAAc,IAAqB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,gCAAE,GAAF,UAAG,KAAa,EAAE,QAAkC;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,kCAAI,GAAJ,UAAK,KAAa;QAAE,cAAmB;aAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;YAAnB,6BAAmB;;QACnC,IAAM,QAAQ,GAAyB,EAAE,CAAC;QAE1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,QAAQ;YAC1C,QAAQ,CAAC,IAAI,CAAC,QAAQ,eAAI,IAAI,EAAE,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACL,0BAAC;AAAD,CAAC,AAzBD,IAyBC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/task-runner.d.ts b/node_modules/@textlint/kernel/module/task/task-runner.d.ts new file mode 100644 index 000000000..0b93ec0b1 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/task-runner.d.ts @@ -0,0 +1,9 @@ +import { default as TextLintCoreTask, IgnoreReportedMessage, LintReportedMessage } from "./textlint-core-task"; +export default class TaskRunner { + /** + * Task and return promise + * @param {TextLintCoreTask} task + * @returns {Promise} + */ + static process(task: TextLintCoreTask): Promise>; +} diff --git a/node_modules/@textlint/kernel/module/task/task-runner.js b/node_modules/@textlint/kernel/module/task/task-runner.js new file mode 100644 index 000000000..f4ecada64 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/task-runner.js @@ -0,0 +1,31 @@ +// LICENSE : MIT +"use strict"; +import CoreTask from "./textlint-core-task"; +var TaskRunner = /** @class */ (function () { + function TaskRunner() { + } + /** + * Task and return promise + * @param {TextLintCoreTask} task + * @returns {Promise} + */ + TaskRunner.process = function (task) { + return new Promise(function (resolve, reject) { + var messages = []; + task.on(CoreTask.events.message, function (message) { + messages.push(message); + }); + task.on(CoreTask.events.error, function (error) { + reject(error); + }); + task.on(CoreTask.events.complete, function () { + task.removeAllListeners(); + resolve(messages); + }); + task.start(); + }); + }; + return TaskRunner; +}()); +export default TaskRunner; +//# sourceMappingURL=task-runner.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/task-runner.js.map b/node_modules/@textlint/kernel/module/task/task-runner.js.map new file mode 100644 index 000000000..bd4cbe64e --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/task-runner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"task-runner.js","sourceRoot":"","sources":["../../src/task/task-runner.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,QAIN,MAAM,sBAAsB,CAAC;AAE9B;IAAA;IAsBA,CAAC;IArBG;;;;OAIG;IACI,kBAAO,GAAd,UAAe,IAAsB;QACjC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC/B,IAAM,QAAQ,GAAuD,EAAE,CAAC;YACxE,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,UAAC,OAAO;gBACrC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,UAAC,KAAK;gBACjC,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC9B,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,iBAAC;AAAD,CAAC,AAtBD,IAsBC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/textlint-core-task.d.ts b/node_modules/@textlint/kernel/module/task/textlint-core-task.d.ts new file mode 100644 index 000000000..34b226203 --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/textlint-core-task.d.ts @@ -0,0 +1,59 @@ +/// +import MessageType from "../shared/type/MessageType"; +import { EventEmitter } from "events"; +import type { TextlintFilterRuleContext, TextlintFilterRuleOptions, TextlintFilterRuleReporter, TextlintFilterRuleShouldIgnoreFunction, TextlintMessageFixCommand, TextlintRuleContext, TextlintRuleContextReportFunction, TextlintRuleOptions, TextlintRuleReporter, TextlintSourceCode } from "@textlint/types"; +export interface IgnoreReportedMessage { + ruleId: string; + type: typeof MessageType.ignore; + range: [number, number]; + ignoringRuleId: string; +} +export interface LintReportedMessage { + type: typeof MessageType.lint; + ruleId: string; + message: string; + index: number; + line: number; + column: number; + severity: number; + fix?: TextlintMessageFixCommand; +} +/** + * CoreTask receive AST and prepare, traverse AST, emit nodeType event! + * You can observe task and receive "message" event that is TextLintMessage. + */ +export default abstract class TextLintCoreTask extends EventEmitter { + private ruleTypeEmitter; + static get events(): { + start: string; + message: string; + complete: string; + error: string; + }; + constructor(); + abstract start(): void; + createShouldIgnore(): TextlintFilterRuleShouldIgnoreFunction; + createReporter(sourceCode: TextlintSourceCode): TextlintRuleContextReportFunction; + /** + * start process and emitting events. + * You can listen message by `task.on("message", message => {})` + * @param {SourceCode} sourceCode + */ + startTraverser(sourceCode: TextlintSourceCode): void; + /** + * try to get rule object + */ + tryToGetRuleObject(ruleCreator: TextlintRuleReporter, ruleContext: Readonly, ruleOptions?: TextlintRuleOptions): import("@textlint/types").TextlintRuleReportHandler; + /** + * try to get filter rule object + */ + tryToGetFilterRuleObject(ruleCreator: TextlintFilterRuleReporter, ruleContext: Readonly, ruleOptions?: TextlintFilterRuleOptions): import("@textlint/types").TextlintFilterRuleReportHandler; + /** + * add all the node types as listeners of the rule + * @param {Function} ruleCreator + * @param {Readonly|Readonly} ruleContext + * @param {Object|boolean|undefined} ruleOptions + * @returns {Object} + */ + tryToAddListenRule(ruleCreator: TextlintRuleReporter | TextlintFilterRuleReporter, ruleContext: Readonly | Readonly, ruleOptions?: TextlintRuleOptions | TextlintFilterRuleOptions): void; +} diff --git a/node_modules/@textlint/kernel/module/task/textlint-core-task.js b/node_modules/@textlint/kernel/module/task/textlint-core-task.js new file mode 100644 index 000000000..21ec4e23f --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/textlint-core-task.js @@ -0,0 +1,195 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { TextlintRuleErrorImpl } from "../context/TextlintRuleErrorImpl"; +import { PromiseEventEmitter } from "./promise-event-emitter"; +import SourceLocation from "../core/source-location"; +import timing from "../util/timing"; +import MessageType from "../shared/type/MessageType"; +import { EventEmitter } from "events"; +import * as assert from "assert"; +import { normalizeTextlintKeyPath } from "@textlint/utils"; +import { TextlintRuleContextImpl } from "../context/TextlintRuleContextImpl"; +import _debug from "debug"; +import { Controller as TraverseController } from "@textlint/ast-traverse"; +var traverseController = new TraverseController(); +var debug = _debug("textlint:core-task"); +var RuleTypeEmitter = /** @class */ (function (_super) { + __extends(RuleTypeEmitter, _super); + function RuleTypeEmitter() { + return _super !== null && _super.apply(this, arguments) || this; + } + return RuleTypeEmitter; +}(PromiseEventEmitter)); +/** + * CoreTask receive AST and prepare, traverse AST, emit nodeType event! + * You can observe task and receive "message" event that is TextLintMessage. + */ +var TextLintCoreTask = /** @class */ (function (_super) { + __extends(TextLintCoreTask, _super); + function TextLintCoreTask() { + var _this = _super.call(this) || this; + _this.ruleTypeEmitter = new RuleTypeEmitter(); + return _this; + } + Object.defineProperty(TextLintCoreTask, "events", { + get: function () { + return { + // receive start event + start: "start", + // receive message from each rules + message: "message", + // receive complete event + complete: "complete", + // receive error event + error: "error" + }; + }, + enumerable: false, + configurable: true + }); + TextLintCoreTask.prototype.createShouldIgnore = function () { + var _this = this; + var shouldIgnore = function (args) { + var ruleId = args.ruleId, range = args.range, optional = args.optional; + assert.ok(typeof range[0] !== "undefined" && typeof range[1] !== "undefined" && range[0] >= 0 && range[1] >= 0, "ignoreRange should have actual range: " + range); + // FIXME: should have index, loc + // should be compatible with LintReportedMessage? + var message = { + type: MessageType.ignore, + ruleId: ruleId, + range: range, + // ignoring target ruleId - default: filter all messages + // This ruleId should be normalized, because the user can report any value + ignoringRuleId: optional.ruleId ? normalizeTextlintKeyPath(optional.ruleId) : "*" + }; + _this.emit(TextLintCoreTask.events.message, message); + }; + return shouldIgnore; + }; + TextLintCoreTask.prototype.createReporter = function (sourceCode) { + var _this = this; + var sourceLocation = new SourceLocation(sourceCode); + /** + * push new RuleError to results + * @param {ReportMessage} reportArgs + */ + var reportFunction = function (reportArgs) { + var ruleId = reportArgs.ruleId, severity = reportArgs.severity, ruleError = reportArgs.ruleError; + debug("%s pushReport %s", ruleId, ruleError); + var _a = sourceLocation.adjust(reportArgs), line = _a.line, column = _a.column, fix = _a.fix; + var index = sourceCode.positionToIndex({ line: line, column: column }); + // add TextLintMessage + var message = { + type: MessageType.lint, + ruleId: ruleId, + message: ruleError.message, + index: index, + // See https://github.com/textlint/textlint/blob/master/typing/textlint.d.ts + line: line, + column: column + 1, + severity: severity, + fix: fix !== undefined ? fix : undefined + }; + if (!(ruleError instanceof TextlintRuleErrorImpl)) { + // FIXME: RuleReportedObject should be removed + // `error` is a any data. + var data = ruleError; + message.data = data; + } + _this.emit(TextLintCoreTask.events.message, message); + }; + return reportFunction; + }; + /** + * start process and emitting events. + * You can listen message by `task.on("message", message => {})` + * @param {SourceCode} sourceCode + */ + TextLintCoreTask.prototype.startTraverser = function (sourceCode) { + var _this = this; + this.emit(TextLintCoreTask.events.start); + var promiseQueue = []; + var ruleTypeEmitter = this.ruleTypeEmitter; + traverseController.traverse(sourceCode.ast, { + enter: function (node, parent) { + var type = node.type; + Object.defineProperty(node, "parent", { value: parent }); + if (ruleTypeEmitter.listenerCount(type) > 0) { + var promise = ruleTypeEmitter.emit(type, node); + promiseQueue.push(promise); + } + }, + leave: function (node) { + var type = node.type + ":exit"; + if (ruleTypeEmitter.listenerCount(type) > 0) { + var promise = ruleTypeEmitter.emit(type, node); + promiseQueue.push(promise); + } + } + }); + Promise.all(promiseQueue) + .then(function () { + _this.emit(TextLintCoreTask.events.complete); + }) + .catch(function (error) { + _this.emit(TextLintCoreTask.events.error, error); + }); + }; + /** + * try to get rule object + */ + TextLintCoreTask.prototype.tryToGetRuleObject = function (ruleCreator, ruleContext, ruleOptions) { + try { + return ruleCreator(ruleContext, ruleOptions); + } + catch (error) { + error.message = "Error while loading rule '" + ruleContext.id + "': " + error.message; + throw error; + } + }; + /** + * try to get filter rule object + */ + TextLintCoreTask.prototype.tryToGetFilterRuleObject = function (ruleCreator, ruleContext, ruleOptions) { + try { + return ruleCreator(ruleContext, ruleOptions); + } + catch (error) { + error.message = "Error while loading filter rule '" + ruleContext.id + "': " + error.message; + throw error; + } + }; + /** + * add all the node types as listeners of the rule + * @param {Function} ruleCreator + * @param {Readonly|Readonly} ruleContext + * @param {Object|boolean|undefined} ruleOptions + * @returns {Object} + */ + TextLintCoreTask.prototype.tryToAddListenRule = function (ruleCreator, ruleContext, ruleOptions) { + var _this = this; + var ruleObject = ruleContext instanceof TextlintRuleContextImpl + ? this.tryToGetRuleObject(ruleCreator, ruleContext, ruleOptions) + : this.tryToGetFilterRuleObject(ruleCreator, ruleContext, ruleOptions); + var types = Object.keys(ruleObject); + types.forEach(function (nodeType) { + _this.ruleTypeEmitter.on(nodeType, timing.enabled ? timing.time(ruleContext.id, ruleObject[nodeType]) : ruleObject[nodeType]); + }); + }; + return TextLintCoreTask; +}(EventEmitter)); +export default TextLintCoreTask; +//# sourceMappingURL=textlint-core-task.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/task/textlint-core-task.js.map b/node_modules/@textlint/kernel/module/task/textlint-core-task.js.map new file mode 100644 index 000000000..bd0f290ae --- /dev/null +++ b/node_modules/@textlint/kernel/module/task/textlint-core-task.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-core-task.js","sourceRoot":"","sources":["../../src/task/textlint-core-task.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAgBjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,IAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AACpD,IAAM,KAAK,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAE3C;IAA8B,mCAAmB;IAAjD;;IAAmD,CAAC;IAAD,sBAAC;AAAD,CAAC,AAApD,CAA8B,mBAAmB,GAAG;AA4BpD;;;GAGG;AACH;IAAuD,oCAAY;IAgB/D;QAAA,YACI,iBAAO,SAEV;QADG,KAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;;IACjD,CAAC;IAhBD,sBAAW,0BAAM;aAAjB;YACI,OAAO;gBACH,sBAAsB;gBACtB,KAAK,EAAE,OAAO;gBACd,kCAAkC;gBAClC,OAAO,EAAE,SAAS;gBAClB,yBAAyB;gBACzB,QAAQ,EAAE,UAAU;gBACpB,sBAAsB;gBACtB,KAAK,EAAE,OAAO;aACjB,CAAC;QACN,CAAC;;;OAAA;IASD,6CAAkB,GAAlB;QAAA,iBAoBC;QAnBG,IAAM,YAAY,GAAG,UAAC,IAAgD;YAC1D,IAAA,MAAM,GAAsB,IAAI,OAA1B,EAAE,KAAK,GAAe,IAAI,MAAnB,EAAE,QAAQ,GAAK,IAAI,SAAT,CAAU;YACzC,MAAM,CAAC,EAAE,CACL,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EACpG,wCAAwC,GAAG,KAAK,CACnD,CAAC;YACF,gCAAgC;YAChC,iDAAiD;YACjD,IAAM,OAAO,GAA0B;gBACnC,IAAI,EAAE,WAAW,CAAC,MAAM;gBACxB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,KAAK;gBACZ,wDAAwD;gBACxD,0EAA0E;gBAC1E,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;aACpF,CAAC;YACF,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,OAAO,YAAY,CAAC;IACxB,CAAC;IAED,yCAAc,GAAd,UAAe,UAA8B;QAA7C,iBAgCC;QA/BG,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;QACtD;;;WAGG;QACH,IAAM,cAAc,GAAG,UAAC,UAAiD;YAC7D,IAAA,MAAM,GAA0B,UAAU,OAApC,EAAE,QAAQ,GAAgB,UAAU,SAA1B,EAAE,SAAS,GAAK,UAAU,UAAf,CAAgB;YACnD,KAAK,CAAC,kBAAkB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YACvC,IAAA,KAAwB,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,EAAvD,IAAI,UAAA,EAAE,MAAM,YAAA,EAAE,GAAG,SAAsC,CAAC;YAChE,IAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;YAC3D,sBAAsB;YACtB,IAAM,OAAO,GAAwB;gBACjC,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,SAAS,CAAC,OAAO;gBAC1B,KAAK,OAAA;gBACL,4EAA4E;gBAC5E,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,MAAM,GAAG,CAAC;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;aAC3C,CAAC;YACF,IAAI,CAAC,CAAC,SAAS,YAAY,qBAAqB,CAAC,EAAE;gBAC/C,8CAA8C;gBAC9C,yBAAyB;gBACzB,IAAM,IAAI,GAAG,SAAS,CAAC;gBACtB,OAAe,CAAC,IAAI,GAAG,IAAI,CAAC;aAChC;YACD,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,yCAAc,GAAd,UAAe,UAA8B;QAA7C,iBA4BC;QA3BG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,IAAM,YAAY,GAAgC,EAAE,CAAC;QACrD,IAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC7C,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAoB,EAAE;YACzD,KAAK,EAAL,UAAM,IAAgB,EAAE,MAAmB;gBACvC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBACvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;gBACzD,IAAI,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACzC,IAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBACjD,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBAC9B;YACL,CAAC;YACD,KAAK,EAAL,UAAM,IAAgB;gBAClB,IAAM,IAAI,GAAM,IAAI,CAAC,IAAI,UAAO,CAAC;gBACjC,IAAI,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACzC,IAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBACjD,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBAC9B;YACL,CAAC;SACJ,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;aACpB,IAAI,CAAC;YACF,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACT,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACX,CAAC;IAED;;OAEG;IACH,6CAAkB,GAAlB,UACI,WAAiC,EACjC,WAA0C,EAC1C,WAAiC;QAEjC,IAAI;YACA,OAAO,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;SAChD;QAAC,OAAO,KAAK,EAAE;YACZ,KAAK,CAAC,OAAO,GAAG,+BAA6B,WAAW,CAAC,EAAE,WAAM,KAAK,CAAC,OAAS,CAAC;YACjF,MAAM,KAAK,CAAC;SACf;IACL,CAAC;IAED;;OAEG;IACH,mDAAwB,GAAxB,UACI,WAAuC,EACvC,WAAgD,EAChD,WAAuC;QAEvC,IAAI;YACA,OAAO,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;SAChD;QAAC,OAAO,KAAK,EAAE;YACZ,KAAK,CAAC,OAAO,GAAG,sCAAoC,WAAW,CAAC,EAAE,WAAM,KAAK,CAAC,OAAS,CAAC;YACxF,MAAM,KAAK,CAAC;SACf;IACL,CAAC;IAED;;;;;;OAMG;IACH,6CAAkB,GAAlB,UACI,WAA8D,EAC9D,WAAgF,EAChF,WAA6D;QAHjE,iBAwBC;QAnBG,IAAM,UAAU,GACZ,WAAW,YAAY,uBAAuB;YAC1C,CAAC,CAAC,IAAI,CAAC,kBAAkB,CACnB,WAAmC,EACnC,WAA4C,EAC5C,WAAW,CACd;YACH,CAAC,CAAC,IAAI,CAAC,wBAAwB,CACzB,WAAyC,EACzC,WAAkD,EAClD,WAAW,CACd,CAAC;QACZ,IAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtC,KAAK,CAAC,OAAO,CAAC,UAAC,QAAQ;YACnB,KAAI,CAAC,eAAe,CAAC,EAAE,CACnB,QAAQ,EACR,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAE,CACzG,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AAlLD,CAAuD,YAAY,GAkLlE"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/textlint-kernel-interface.d.ts b/node_modules/@textlint/kernel/module/textlint-kernel-interface.d.ts new file mode 100644 index 000000000..dda32e5af --- /dev/null +++ b/node_modules/@textlint/kernel/module/textlint-kernel-interface.d.ts @@ -0,0 +1,45 @@ +import type { TextlintFilterRuleOptions, TextlintFilterRuleReporter, TextlintPluginCreator, TextlintPluginOptions, TextlintRuleModule, TextlintRuleOptions } from "@textlint/types"; +export interface TextlintKernelConstructorOptions { + /** + * Suppress messages of severity:warning and severity:info + */ + quiet?: boolean; +} +export interface TextlintConfigObject { + rulePaths?: string[]; + extensions?: string[]; + formatterName?: string; + plugins?: string[]; + rulesBaseDirectory?: string; + configFile?: string; + disabledRules?: string[]; + presets?: string[]; + rulesConfig?: Object; + /** + * quite options + */ + quiet?: boolean; +} +export interface TextlintKernelPlugin { + pluginId: string; + plugin: TextlintPluginCreator; + options?: TextlintPluginOptions | boolean; +} +export interface TextlintKernelRule { + ruleId: string; + rule: TextlintRuleModule; + options?: TextlintRuleOptions | boolean; +} +export interface TextlintKernelFilterRule { + ruleId: string; + rule: TextlintFilterRuleReporter; + options?: TextlintFilterRuleOptions | boolean; +} +export interface TextlintKernelOptions { + ext: string; + filePath?: string; + plugins?: TextlintKernelPlugin[]; + rules?: TextlintKernelRule[]; + filterRules?: TextlintKernelFilterRule[]; + configBaseDir?: string; +} diff --git a/node_modules/@textlint/kernel/module/textlint-kernel-interface.js b/node_modules/@textlint/kernel/module/textlint-kernel-interface.js new file mode 100644 index 000000000..d27faa4ce --- /dev/null +++ b/node_modules/@textlint/kernel/module/textlint-kernel-interface.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=textlint-kernel-interface.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/textlint-kernel-interface.js.map b/node_modules/@textlint/kernel/module/textlint-kernel-interface.js.map new file mode 100644 index 000000000..68c5cc211 --- /dev/null +++ b/node_modules/@textlint/kernel/module/textlint-kernel-interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-kernel-interface.js","sourceRoot":"","sources":["../src/textlint-kernel-interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/textlint-kernel.d.ts b/node_modules/@textlint/kernel/module/textlint-kernel.d.ts new file mode 100644 index 000000000..ea84eadea --- /dev/null +++ b/node_modules/@textlint/kernel/module/textlint-kernel.d.ts @@ -0,0 +1,57 @@ +import { TextlintKernelConstructorOptions, TextlintKernelOptions } from "./textlint-kernel-interface"; +import type { TextlintFixResult, TextlintResult } from "@textlint/types"; +/** + * TextlintKernel is core logic written by pure JavaScript. + * + * Pass + * + * - config + * - plugins + * - rules + * - filterRules + * - messageProcessor + * + */ +export declare class TextlintKernel { + private readonly config; + private readonly messageProcessManager; + /** + * @param config + */ + constructor(config?: TextlintKernelConstructorOptions); + /** + * lint text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text + * @param {Object} options linting options + * @returns {Promise.} + */ + lintText(text: string, options: TextlintKernelOptions): Promise; + /** + * fix texts and return fix result object + * @param {string} text + * @param {Object} options lint options + * @returns {Promise.} + */ + fixText(text: string, options: TextlintKernelOptions): Promise; + /** + * process text in parallel for Rules and return {Promise.} + * In other word, parallel flow process. + * @param {*} processor + * @param {string} text + * @param {Object} options + * @returns {Promise.} + * @private + */ + private _parallelProcess; + /** + * process text in series for Rules and return {Promise.} + * In other word, sequence flow process. + * @param {*} processor + * @param {string} text + * @param {TextlintKernelOptions} options + * @returns {Promise.} + * @private + */ + private _sequenceProcess; +} diff --git a/node_modules/@textlint/kernel/module/textlint-kernel.js b/node_modules/@textlint/kernel/module/textlint-kernel.js new file mode 100644 index 000000000..4f64fec60 --- /dev/null +++ b/node_modules/@textlint/kernel/module/textlint-kernel.js @@ -0,0 +1,196 @@ +// MIT © 2017- azu +import * as assert from "assert"; +// sequence +import FixerProcessor from "./fixer/fixer-processor"; +// parallel +import LinterProcessor from "./linter/linter-processor"; +// message process manager +import MessageProcessManager from "./messages/MessageProcessManager"; +import filterIgnoredProcess from "./messages/filter-ignored-process"; +import filterDuplicatedProcess from "./messages/filter-duplicated-process"; +import filterSeverityProcess from "./messages/filter-severity-process"; +import sortMessageProcess from "./messages/sort-messages-process"; +import { TextlintKernelDescriptor } from "./descriptor"; +import { TextlintSourceCodeImpl } from "./context/TextlintSourceCodeImpl"; +import { isTxtAST } from "@textlint/ast-tester"; +import _debug from "debug"; +var debug = _debug("textlint:kernel"); +/** + * add fileName to trailing of error message + * @param {string|undefined} fileName + * @param {string} message + * @returns {string} + */ +function addingAtFileNameToError(fileName, message) { + if (!fileName) { + return message; + } + return message + "\nat " + fileName; +} +/** + * TextlintKernel is core logic written by pure JavaScript. + * + * Pass + * + * - config + * - plugins + * - rules + * - filterRules + * - messageProcessor + * + */ +var TextlintKernel = /** @class */ (function () { + /** + * @param config + */ + function TextlintKernel(config) { + if (config === void 0) { config = {}; } + // this.config often is undefined. + this.config = config; + // Initialize Message Processor + // Now, It it built-in process only + // filter `shouldIgnore()` results + this.messageProcessManager = new MessageProcessManager([filterIgnoredProcess]); + // filter duplicated messages + this.messageProcessManager.add(filterDuplicatedProcess); + // filter by severity + this.messageProcessManager.add(filterSeverityProcess(this.config)); + this.messageProcessManager.add(sortMessageProcess); + } + /** + * lint text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text + * @param {Object} options linting options + * @returns {Promise.} + */ + TextlintKernel.prototype.lintText = function (text, options) { + var _this = this; + return Promise.resolve().then(function () { + var descriptor = new TextlintKernelDescriptor({ + rules: options.rules || [], + filterRules: options.filterRules || [], + plugins: options.plugins || [] + }); + return _this._parallelProcess({ + descriptor: descriptor, + text: text, + options: options + }); + }); + }; + /** + * fix texts and return fix result object + * @param {string} text + * @param {Object} options lint options + * @returns {Promise.} + */ + TextlintKernel.prototype.fixText = function (text, options) { + var _this = this; + return Promise.resolve().then(function () { + var descriptor = new TextlintKernelDescriptor({ + rules: options.rules || [], + filterRules: options.filterRules || [], + plugins: options.plugins || [] + }); + return _this._sequenceProcess({ + descriptor: descriptor, + options: options, + text: text + }); + }); + }; + /** + * process text in parallel for Rules and return {Promise.} + * In other word, parallel flow process. + * @param {*} processor + * @param {string} text + * @param {Object} options + * @returns {Promise.} + * @private + */ + TextlintKernel.prototype._parallelProcess = function (_a) { + var descriptor = _a.descriptor, text = _a.text, options = _a.options; + var ext = options.ext, filePath = options.filePath, configBaseDir = options.configBaseDir; + var plugin = descriptor.findPluginDescriptorWithExt(ext); + debug("available extensions: %o", descriptor.availableExtensions); + if (plugin === undefined) { + throw new Error("Not found available plugin for " + ext); + } + debug("use plugin: %s", plugin.id); + var processor = plugin.processor; + var _b = processor.processor(ext), preProcess = _b.preProcess, postProcess = _b.postProcess; + assert.ok(typeof preProcess === "function" && typeof postProcess === "function", "processor should implements {preProcess, postProcess}"); + var preProcessResult = preProcess(text, filePath); + var isPluginReturnAnAST = isTxtAST(preProcessResult); + var textForAST = isPluginReturnAnAST ? text : preProcessResult.text; + var ast = isPluginReturnAnAST ? preProcessResult : preProcessResult.ast; + var sourceCode = new TextlintSourceCodeImpl({ + text: textForAST, + ast: ast, + ext: ext, + filePath: filePath + }); + var linterProcessor = new LinterProcessor(processor, this.messageProcessManager); + return linterProcessor + .process({ + config: this.config, + ruleDescriptors: descriptor.rule, + filterRuleDescriptors: descriptor.filterRule, + sourceCode: sourceCode, + configBaseDir: configBaseDir + }) + .catch(function (error) { + error.message = addingAtFileNameToError(filePath, error.message); + return Promise.reject(error); + }); + }; + /** + * process text in series for Rules and return {Promise.} + * In other word, sequence flow process. + * @param {*} processor + * @param {string} text + * @param {TextlintKernelOptions} options + * @returns {Promise.} + * @private + */ + TextlintKernel.prototype._sequenceProcess = function (_a) { + var descriptor = _a.descriptor, text = _a.text, options = _a.options; + var ext = options.ext, filePath = options.filePath, configBaseDir = options.configBaseDir; + var plugin = descriptor.findPluginDescriptorWithExt(ext); + debug("available extensions: %o", descriptor.availableExtensions); + if (plugin === undefined) { + throw new Error("Not found available plugin for " + ext); + } + debug("use plugin: %s", plugin.id); + var processor = plugin.processor; + var _b = processor.processor(ext), preProcess = _b.preProcess, postProcess = _b.postProcess; + assert.ok(typeof preProcess === "function" && typeof postProcess === "function", "processor should implements {preProcess, postProcess}"); + var preProcessResult = preProcess(text, filePath); + var isPluginReturnAnAST = isTxtAST(preProcessResult); + var textForAST = isPluginReturnAnAST ? text : preProcessResult.text; + var ast = isPluginReturnAnAST ? preProcessResult : preProcessResult.ast; + var sourceCode = new TextlintSourceCodeImpl({ + text: textForAST, + ast: ast, + ext: ext, + filePath: filePath + }); + var fixerProcessor = new FixerProcessor(processor, this.messageProcessManager); + return fixerProcessor + .process({ + config: this.config, + ruleDescriptors: descriptor.rule, + filterRules: descriptor.filterRule, + sourceCode: sourceCode, + configBaseDir: configBaseDir + }) + .catch(function (error) { + error.message = addingAtFileNameToError(filePath, error.message); + return Promise.reject(error); + }); + }; + return TextlintKernel; +}()); +export { TextlintKernel }; +//# sourceMappingURL=textlint-kernel.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/textlint-kernel.js.map b/node_modules/@textlint/kernel/module/textlint-kernel.js.map new file mode 100644 index 000000000..50f9a4fd7 --- /dev/null +++ b/node_modules/@textlint/kernel/module/textlint-kernel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-kernel.js","sourceRoot":"","sources":["../src/textlint-kernel.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,WAAW;AACX,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,WAAW;AACX,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,0BAA0B;AAC1B,OAAO,qBAAqB,MAAM,kCAAkC,CAAC;AACrE,OAAO,oBAAoB,MAAM,mCAAmC,CAAC;AACrE,OAAO,uBAAuB,MAAM,sCAAsC,CAAC;AAC3E,OAAO,qBAAqB,MAAM,oCAAoC,CAAC;AACvE,OAAO,kBAAkB,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,MAAM,MAAM,OAAO,CAAC;AAE3B,IAAM,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAExC;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,QAA4B,EAAE,OAAe;IAC1E,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,OAAO,CAAC;KAClB;IACD,OAAU,OAAO,aAChB,QAAU,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;GAWG;AACH;IAII;;OAEG;IACH,wBAAY,MAA6C;QAA7C,uBAAA,EAAA,WAA6C;QACrD,kCAAkC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,+BAA+B;QAC/B,mCAAmC;QACnC,kCAAkC;QAClC,IAAI,CAAC,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC/E,6BAA6B;QAC7B,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACxD,qBAAqB;QACrB,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;OAMG;IACH,iCAAQ,GAAR,UAAS,IAAY,EAAE,OAA8B;QAArD,iBAaC;QAZG,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;YAC1B,IAAM,UAAU,GAAG,IAAI,wBAAwB,CAAC;gBAC5C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;gBAC1B,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;gBACtC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;aACjC,CAAC,CAAC;YACH,OAAO,KAAI,CAAC,gBAAgB,CAAC;gBACzB,UAAU,YAAA;gBACV,IAAI,MAAA;gBACJ,OAAO,SAAA;aACV,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,gCAAO,GAAP,UAAQ,IAAY,EAAE,OAA8B;QAApD,iBAaC;QAZG,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;YAC1B,IAAM,UAAU,GAAG,IAAI,wBAAwB,CAAC;gBAC5C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;gBAC1B,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;gBACtC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;aACjC,CAAC,CAAC;YACH,OAAO,KAAI,CAAC,gBAAgB,CAAC;gBACzB,UAAU,YAAA;gBACV,OAAO,SAAA;gBACP,IAAI,MAAA;aACP,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACK,yCAAgB,GAAxB,UAAyB,EAQxB;YAPG,UAAU,gBAAA,EACV,IAAI,UAAA,EACJ,OAAO,aAAA;QAMC,IAAA,GAAG,GAA8B,OAAO,IAArC,EAAE,QAAQ,GAAoB,OAAO,SAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;QACjD,IAAM,MAAM,GAAG,UAAU,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;QAC3D,KAAK,CAAC,0BAA0B,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,IAAI,MAAM,KAAK,SAAS,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,oCAAkC,GAAK,CAAC,CAAC;SAC5D;QACD,KAAK,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QACnC,IAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAC7B,IAAA,KAA8B,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,EAApD,UAAU,gBAAA,EAAE,WAAW,iBAA6B,CAAC;QAC7D,MAAM,CAAC,EAAE,CACL,OAAO,UAAU,KAAK,UAAU,IAAI,OAAO,WAAW,KAAK,UAAU,EACrE,uDAAuD,CAC1D,CAAC;QACF,IAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpD,IAAM,mBAAmB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAM,UAAU,GAAG,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC;QACtE,IAAM,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC;QAC1E,IAAM,UAAU,GAAG,IAAI,sBAAsB,CAAC;YAC1C,IAAI,EAAE,UAAU;YAChB,GAAG,KAAA;YACH,GAAG,KAAA;YACH,QAAQ,UAAA;SACX,CAAC,CAAC;QACH,IAAM,eAAe,GAAG,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACnF,OAAO,eAAe;aACjB,OAAO,CAAC;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,eAAe,EAAE,UAAU,CAAC,IAAI;YAChC,qBAAqB,EAAE,UAAU,CAAC,UAAU;YAC5C,UAAU,YAAA;YACV,aAAa,eAAA;SAChB,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACT,KAAK,CAAC,OAAO,GAAG,uBAAuB,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACX,CAAC;IAED;;;;;;;;OAQG;IACK,yCAAgB,GAAxB,UAAyB,EAQxB;YAPG,UAAU,gBAAA,EACV,IAAI,UAAA,EACJ,OAAO,aAAA;QAMC,IAAA,GAAG,GAA8B,OAAO,IAArC,EAAE,QAAQ,GAAoB,OAAO,SAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;QACjD,IAAM,MAAM,GAAG,UAAU,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;QAC3D,KAAK,CAAC,0BAA0B,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,IAAI,MAAM,KAAK,SAAS,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,oCAAkC,GAAK,CAAC,CAAC;SAC5D;QACD,KAAK,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QACnC,IAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAC7B,IAAA,KAA8B,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,EAApD,UAAU,gBAAA,EAAE,WAAW,iBAA6B,CAAC;QAC7D,MAAM,CAAC,EAAE,CACL,OAAO,UAAU,KAAK,UAAU,IAAI,OAAO,WAAW,KAAK,UAAU,EACrE,uDAAuD,CAC1D,CAAC;QACF,IAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpD,IAAM,mBAAmB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAM,UAAU,GAAG,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC;QACtE,IAAM,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC;QAC1E,IAAM,UAAU,GAAG,IAAI,sBAAsB,CAAC;YAC1C,IAAI,EAAE,UAAU;YAChB,GAAG,KAAA;YACH,GAAG,KAAA;YACH,QAAQ,UAAA;SACX,CAAC,CAAC;QACH,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACjF,OAAO,cAAc;aAChB,OAAO,CAAC;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,eAAe,EAAE,UAAU,CAAC,IAAI;YAChC,WAAW,EAAE,UAAU,CAAC,UAAU;YAClC,UAAU,YAAA;YACV,aAAa,eAAA;SAChB,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACT,KAAK,CAAC,OAAO,GAAG,uBAAuB,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACX,CAAC;IACL,qBAAC;AAAD,CAAC,AA/KD,IA+KC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/util/logger.d.ts b/node_modules/@textlint/kernel/module/util/logger.d.ts new file mode 100644 index 000000000..eccef48f0 --- /dev/null +++ b/node_modules/@textlint/kernel/module/util/logger.d.ts @@ -0,0 +1,10 @@ +/** + * Logger Utils class + * Use this instead of `console.log` + * Main purpose for helping linting. + */ +export default class Logger { + static log(...message: Array): void; + static warn(...message: Array): void; + static error(...message: Array): void; +} diff --git a/node_modules/@textlint/kernel/module/util/logger.js b/node_modules/@textlint/kernel/module/util/logger.js new file mode 100644 index 000000000..34212a9dd --- /dev/null +++ b/node_modules/@textlint/kernel/module/util/logger.js @@ -0,0 +1,36 @@ +// LICENSE : MIT +"use strict"; +/* eslint-disable no-console */ +/** + * Logger Utils class + * Use this instead of `console.log` + * Main purpose for helping linting. + */ +var Logger = /** @class */ (function () { + function Logger() { + } + Logger.log = function () { + var message = []; + for (var _i = 0; _i < arguments.length; _i++) { + message[_i] = arguments[_i]; + } + console.log.apply(console, message); + }; + Logger.warn = function () { + var message = []; + for (var _i = 0; _i < arguments.length; _i++) { + message[_i] = arguments[_i]; + } + console.warn.apply(console, message); + }; + Logger.error = function () { + var message = []; + for (var _i = 0; _i < arguments.length; _i++) { + message[_i] = arguments[_i]; + } + console.error.apply(console, message); + }; + return Logger; +}()); +export default Logger; +//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/util/logger.js.map b/node_modules/@textlint/kernel/module/util/logger.js.map new file mode 100644 index 000000000..f6dc713ca --- /dev/null +++ b/node_modules/@textlint/kernel/module/util/logger.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,+BAA+B;AAE/B;;;;GAIG;AACH;IAAA;IAYA,CAAC;IAXU,UAAG,GAAV;QAAW,iBAAsB;aAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;YAAtB,4BAAsB;;QAC7B,OAAO,CAAC,GAAG,OAAX,OAAO,EAAQ,OAAO,EAAE;IAC5B,CAAC;IAEM,WAAI,GAAX;QAAY,iBAAsB;aAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;YAAtB,4BAAsB;;QAC9B,OAAO,CAAC,IAAI,OAAZ,OAAO,EAAS,OAAO,EAAE;IAC7B,CAAC;IAEM,YAAK,GAAZ;QAAa,iBAAsB;aAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;YAAtB,4BAAsB;;QAC/B,OAAO,CAAC,KAAK,OAAb,OAAO,EAAU,OAAO,EAAE;IAC9B,CAAC;IACL,aAAC;AAAD,CAAC,AAZD,IAYC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/util/timing.d.ts b/node_modules/@textlint/kernel/module/util/timing.d.ts new file mode 100644 index 000000000..bdd0bfdd8 --- /dev/null +++ b/node_modules/@textlint/kernel/module/util/timing.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + time: (key: string, fn: Function) => () => void; + enabled: boolean; +}; +export default _default; diff --git a/node_modules/@textlint/kernel/module/util/timing.js b/node_modules/@textlint/kernel/module/util/timing.js new file mode 100644 index 000000000..e8bea114b --- /dev/null +++ b/node_modules/@textlint/kernel/module/util/timing.js @@ -0,0 +1,116 @@ +/** + * @fileoverview Tracks performance of individual rules. + * @author Brandon Mills + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; +import Logger from "./logger"; +/* istanbul ignore next */ +/** + * Align the string to left + * @param {string} str string to evaluate + * @param {int} len length of the string + * @param {string} [ch] delimiter character + * @returns {string} modified string + * @private + */ +function alignLeft(str, len, ch) { + return str + new Array(len - str.length + 1).join(ch || " "); +} +/* istanbul ignore next */ +/** + * Align the string to right + * @param {string} str string to evaluate + * @param {int} len length of the string + * @param {string} [ch] delimiter character + * @returns {string} modified string + * @private + */ +function alignRight(str, len, ch) { + return new Array(len - str.length + 1).join(ch || " ") + str; +} +var enabled = Boolean(process.env.TIMING); +var HEADERS = ["Rule", "Time (ms)", "Relative"]; +var ALIGN = [alignLeft, alignRight, alignRight]; +/* istanbul ignore next */ +/** + * display the data + * @param {object} data Data object to be displayed + * @returns {string} modified string + * @private + */ +function display(data) { + var total = 0; + var rows = Object.keys(data) + .map(function (key) { + var time = data[key]; + total += time; + return [key, time]; + }) + .sort(function (a, b) { + return b[1] - a[1]; + }) + .slice(0, 10); + rows.forEach(function (row) { + row.push(((row[1] * 100) / total).toFixed(1) + "%"); + row[1] = row[1].toFixed(3); + }); + rows.unshift(HEADERS); + var widths = []; + rows.forEach(function (row) { + for (var i = 0; i < row.length; i++) { + var n = row[i].length; + if (!widths[i] || n > widths[i]) { + widths[i] = n; + } + } + }); + var table = rows.map(function (row) { + return row + .map(function (cell, index) { + return ALIGN[index](cell, widths[index]); + }) + .join(" | "); + }); + table.splice(1, 0, widths + .map(function (w, index) { + if (index !== 0 && index !== widths.length - 1) { + w++; + } + return ALIGN[index](":", w + 1, "-"); + }) + .join("|")); + Logger.log(table.join("\n")); +} +/* istanbul ignore next */ +export default (function () { + var data = Object.create(null); + /** + * Time the run + * @param {*} key key from the data object + * @param {Function} fn function to be called + * @returns {Function} function to be executed + * @private + */ + function time(key, fn) { + if (typeof data[key] === "undefined") { + data[key] = 0; + } + return function () { + var t = process.hrtime(); + fn.apply(null, Array.prototype.slice.call(arguments)); + t = process.hrtime(t); + data[key] += t[0] * 1e3 + t[1] / 1e6; + }; + } + if (enabled) { + process.on("exit", function () { + display(data); + }); + } + return { + time: time, + enabled: enabled + }; +})(); +//# sourceMappingURL=timing.js.map \ No newline at end of file diff --git a/node_modules/@textlint/kernel/module/util/timing.js.map b/node_modules/@textlint/kernel/module/util/timing.js.map new file mode 100644 index 000000000..c0bc2cb87 --- /dev/null +++ b/node_modules/@textlint/kernel/module/util/timing.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../src/util/timing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,CAAC;AACb,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,0BAA0B;AAC1B;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,GAAW,EAAE,GAAW,EAAE,EAAW;IACpD,OAAO,GAAG,GAAG,IAAI,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC;AACjE,CAAC;AAED,0BAA0B;AAC1B;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,GAAW,EAAE,GAAW,EAAE,EAAW;IACrD,OAAO,IAAI,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC;AACjE,CAAC;AAED,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAE5C,IAAM,OAAO,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAClD,IAAM,KAAK,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAElD,0BAA0B;AAC1B;;;;;GAKG;AACH,SAAS,OAAO,CAAC,IAAS;IACtB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,GAAG,CAAC,UAAU,GAAG;QACd,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,KAAK,IAAI,IAAI,CAAC;QACd,OAAO,CAAC,GAAG,EAAE,IAAI,CAAQ,CAAC;IAC9B,CAAC,CAAC;SACD,IAAI,CAAC,UAAU,CAAmB,EAAE,CAAmB;QACpD,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAElB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAQ;QAC3B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QACpD,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB,IAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACjC,IAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE;gBAC7B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aACjB;SACJ;IACL,CAAC,CAAC,CAAC;IAEH,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG;QAChC,OAAO,GAAG;aACL,GAAG,CAAC,UAAU,IAAS,EAAE,KAAa;YACnC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC;aACD,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,MAAM,CACR,CAAC,EACD,CAAC,EACD,MAAM;SACD,GAAG,CAAC,UAAU,CAAC,EAAE,KAAK;QACnB,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5C,CAAC,EAAE,CAAC;SACP;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CACjB,CAAC;IAEF,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,0BAA0B;AAC1B,eAAe,CAAC;IACZ,IAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;;;OAMG;IACH,SAAS,IAAI,CAAC,GAAW,EAAE,EAAY;QACnC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,WAAW,EAAE;YAClC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACjB;QAED,OAAO;YACH,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YACzB,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YACtD,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACzC,CAAC,CAAC;IACN,CAAC;IAED,IAAI,OAAO,EAAE;QACT,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;KACN;IAED,OAAO;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,OAAO;KACnB,CAAC;AACN,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/kernel/package.json b/node_modules/@textlint/kernel/package.json new file mode 100644 index 000000000..914adea90 --- /dev/null +++ b/node_modules/@textlint/kernel/package.json @@ -0,0 +1,68 @@ +{ + "name": "@textlint/kernel", + "version": "3.4.5", + "description": "textlint kernel is core logic by pure JavaScript.", + "keywords": [ + "textlint" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/textlint-kernel/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "module": "./module/index.js", + "typings": "lib/index.d.ts", + "directories": { + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.{js,ts}\"", + "test:build": "tsc -b test" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-tester": "^2.3.5", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/source-code-fixer": "^3.4.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "map-like": "^2.0.0", + "structured-source": "^3.0.2" + }, + "devDependencies": { + "@textlint/markdown-to-ast": "^6.3.5", + "@types/debug": "^4.1.5", + "@types/deep-equal": "^1.0.1", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "@types/structured-source": "^3.0.0", + "cpx": "^1.5.0", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "npm-run-all": "^4.1.5", + "rimraf": "^3.0.2", + "shelljs": "^0.8.4", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "~4.0.2" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/kernel/src/context/TextlintFilterRuleContextImpl.ts b/node_modules/@textlint/kernel/src/context/TextlintFilterRuleContextImpl.ts new file mode 100644 index 000000000..cdc8b8751 --- /dev/null +++ b/node_modules/@textlint/kernel/src/context/TextlintFilterRuleContextImpl.ts @@ -0,0 +1,108 @@ +import type { + TextlintFilterRuleShouldIgnoreFunction, + TextlintRuleSeverityLevel, + TextlintSourceCode, + TextlintFilterRuleContextArgs, + TextlintFilterRuleContext +} from "@textlint/types"; +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +import * as assert from "assert"; +import { TextlintRuleErrorImpl } from "./TextlintRuleErrorImpl"; + +export class TextlintFilterRuleContextImpl implements TextlintFilterRuleContext { + private _ruleId: string; + private _ignoreReport: TextlintFilterRuleShouldIgnoreFunction; + private _sourceCode: TextlintSourceCode; + private _configBaseDir?: string; + private _severityLevel: TextlintRuleSeverityLevel; + + constructor(args: TextlintFilterRuleContextArgs) { + this._ruleId = args.ruleId; + this._sourceCode = args.sourceCode; + this._ignoreReport = args.ignoreReport; + this._configBaseDir = args.configBaseDir; + this._severityLevel = args.severityLevel; + Object.freeze(this); + } + + /** + * Rule id + * @returns {string} + */ + get id() { + return this._ruleId; + } + + get severity() { + return this._severityLevel; + } + + /** + * Node's type values + * @type {TextLintNodeType} + */ + get Syntax(): typeof ASTNodeTypes { + return this._sourceCode.getSyntax(); + } + + /** + * CustomError object + * @type {RuleError} + */ + get RuleError() { + return TextlintRuleErrorImpl; + } + + shouldIgnore = (range: [number, number], optional = {}) => { + assert.ok( + Array.isArray(range) && typeof range[0] === "number" && typeof range[1] === "number", + "shouldIgnore([number, number]); accept range." + ); + this._ignoreReport({ ruleId: this._ruleId, range, optional }); + }; + + /** + * Not use + * @returns {() => void} + */ + get report() { + return () => { + throw new Error("Filter rule can not report"); + }; + } + + /** + * get file path current processing. + */ + getFilePath = () => { + return this._sourceCode.getFilePath(); + }; + + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource = (node?: TxtNode, beforeCount?: number, afterCount?: number): string => { + return this._sourceCode.getSource(node, beforeCount, afterCount); + }; + + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + getConfigBaseDir = () => { + return this._configBaseDir; + }; +} diff --git a/node_modules/@textlint/kernel/src/context/TextlintRuleContextFixCommandGeneratorImpl.ts b/node_modules/@textlint/kernel/src/context/TextlintRuleContextFixCommandGeneratorImpl.ts new file mode 100644 index 000000000..7497f23ef --- /dev/null +++ b/node_modules/@textlint/kernel/src/context/TextlintRuleContextFixCommandGeneratorImpl.ts @@ -0,0 +1,146 @@ +import * as assert from "assert"; +import { TxtNode } from "@textlint/ast-node-types"; +import type { TextlintRuleContextFixCommandGenerator, TextlintSourceCodeRange } from "@textlint/types"; + +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAt(index: number, text: string) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text, + isAbsolute: false + }; +} + +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAtAbsolute(index: number, text: string) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text, + isAbsolute: true + }; +} + +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +export class TextlintRuleContextFixCommandGeneratorImpl implements TextlintRuleContextFixCommandGenerator { + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfter(node: TxtNode, text: string) { + return insertTextAtAbsolute(node.range[1], text); + } + + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfterRange(range: TextlintSourceCodeRange, text: string) { + return insertTextAt(range[1], text); + } + + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBefore(node: TxtNode, text: string) { + return insertTextAtAbsolute(node.range[0], text); + } + + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBeforeRange(range: TextlintSourceCodeRange, text: string) { + return insertTextAt(range[0], text); + } + + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceText(node: TxtNode, text: string) { + return { + range: node.range, + text, + isAbsolute: true + }; + } + + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceTextRange(range: TextlintSourceCodeRange, text: string) { + return { + range, + text, + isAbsolute: false + }; + } + + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + remove(node: TxtNode) { + return this.replaceText(node, ""); + } + + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + removeRange(range: TextlintSourceCodeRange) { + return this.replaceTextRange(range, ""); + } +} diff --git a/node_modules/@textlint/kernel/src/context/TextlintRuleContextImpl.ts b/node_modules/@textlint/kernel/src/context/TextlintRuleContextImpl.ts new file mode 100644 index 000000000..075eb112d --- /dev/null +++ b/node_modules/@textlint/kernel/src/context/TextlintRuleContextImpl.ts @@ -0,0 +1,127 @@ +import { + TextlintRuleContext, + TextlintRuleContextArgs, + TextlintRuleContextReportFunction, + TextlintRuleError, + TextlintRuleReportedObject, + TextlintRuleSeverityLevel, + TextlintSourceCode +} from "@textlint/types"; +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +import assert from "assert"; +import { TextlintRuleContextFixCommandGeneratorImpl } from "./TextlintRuleContextFixCommandGeneratorImpl"; +import { TextlintRuleSeverityLevelKeys } from "./TextlintRuleSeverityLevelKeys"; +import { TextlintRuleErrorImpl } from "./TextlintRuleErrorImpl"; + +const ruleFixer = new TextlintRuleContextFixCommandGeneratorImpl(); + +export class TextlintRuleContextImpl implements TextlintRuleContext { + private _ruleId: string; + private _sourceCode: TextlintSourceCode; + private _report: TextlintRuleContextReportFunction; + private _configBaseDir?: string; + private _severityLevel: TextlintRuleSeverityLevel; + + constructor(args: TextlintRuleContextArgs) { + this._ruleId = args.ruleId; + this._sourceCode = args.sourceCode; + this._report = args.report; + this._configBaseDir = args.configBaseDir; + this._severityLevel = args.severityLevel; + Object.freeze(this); + } + + /** + * Rule id + * @returns {string} + */ + get id() { + return this._ruleId; + } + + /** + * severity level + */ + get severity(): TextlintRuleSeverityLevel { + return this._severityLevel; + } + + /** + * Node's type values + * @type {ASTNodeTypes} + */ + get Syntax(): typeof ASTNodeTypes { + return this._sourceCode.getSyntax(); + } + + /** + * CustomError object + * @type {RuleError} + */ + get RuleError() { + return TextlintRuleErrorImpl; + } + + /** + * Rule fixer command object + * @type {RuleFixer} + */ + get fixer() { + return ruleFixer; + } + + /** + * report function that is called in a rule + */ + report = (node: TxtNode, ruleError: TextlintRuleError | TextlintRuleReportedObject, _shouldNotUsed?: any) => { + assert.ok( + !(node instanceof TextlintRuleErrorImpl), + "1st argument should be node. Usage: `report(node, ruleError);`" + ); + assert.ok(_shouldNotUsed === undefined, "3rd argument should not be used. Usage: `report(node, ruleError);`"); + if (ruleError instanceof TextlintRuleErrorImpl) { + // severity come from `.textlintrc` option like `{ "" : { serverity: "warning" } } ` + this._report({ ruleId: this._ruleId, node, severity: this._severityLevel, ruleError }); + } else { + const ruleReportedObject: TextlintRuleReportedObject = ruleError; + // severity come from report arguments like `report(node, { severity: 1 })` + const level = ruleReportedObject.severity || TextlintRuleSeverityLevelKeys.error; + this._report({ ruleId: this._ruleId, node, severity: level, ruleError: ruleReportedObject }); + } + }; + + /** + * get file path current processing. + */ + getFilePath = () => { + return this._sourceCode.getFilePath(); + }; + + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource = (node?: TxtNode, beforeCount?: number, afterCount?: number): string => { + return this._sourceCode.getSource(node, beforeCount, afterCount); + }; + + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + getConfigBaseDir = () => { + return this._configBaseDir; + }; +} diff --git a/node_modules/@textlint/kernel/src/context/TextlintRuleErrorImpl.ts b/node_modules/@textlint/kernel/src/context/TextlintRuleErrorImpl.ts new file mode 100644 index 000000000..d398c33d8 --- /dev/null +++ b/node_modules/@textlint/kernel/src/context/TextlintRuleErrorImpl.ts @@ -0,0 +1,59 @@ +// LICENSE : MIT +"use strict"; + +import type { TextlintRuleContextFixCommand, TextlintRuleErrorPadding, TextlintRuleError } from "@textlint/types"; + +export class TextlintRuleErrorImpl implements TextlintRuleError { + public message: string; + public line?: number; + public column?: number; + public index?: number; + public fix?: TextlintRuleContextFixCommand; + + /** + * RuleError is like Error object. + * It's used for adding to TextlintResult. + * @param message error message should start with lowercase letter + * @param [paddingLocation] - the object has padding {line, column} for actual error reason + * @constructor + */ + constructor(message: string, paddingLocation?: number | TextlintRuleErrorPadding) { + this.message = message; + if (typeof paddingLocation === "object") { + /** + * padding lineNumber + * @type {number} + */ + this.line = paddingLocation.line; + /** + * padding column + * @type {number} + */ + this.column = paddingLocation.column; + /** + * padding index + * @type {number} + */ + this.index = paddingLocation.index; + /** + * fixCommand object + * @type {TextlintRuleContextFixCommand} + */ + this.fix = paddingLocation.fix; + } else if (typeof paddingLocation === "number") { + // this is deprecated + // should pass padding as object. + this.column = paddingLocation; + } + } + + toString() { + return JSON.stringify({ + message: this.message, + line: this.line, + column: this.column, + index: this.index, + fix: this.fix + }); + } +} diff --git a/node_modules/@textlint/kernel/src/context/TextlintRuleSeverityLevelKeys.ts b/node_modules/@textlint/kernel/src/context/TextlintRuleSeverityLevelKeys.ts new file mode 100644 index 000000000..55efb18a6 --- /dev/null +++ b/node_modules/@textlint/kernel/src/context/TextlintRuleSeverityLevelKeys.ts @@ -0,0 +1,13 @@ +import type { TextlintRuleSeverityLevel } from "@textlint/types"; + +/** + * Keys of TextlintRuleSeverityLevel + */ +export const TextlintRuleSeverityLevelKeys: { + [index: string]: TextlintRuleSeverityLevel; +} = { + none: 0, + info: 0, + warning: 1, + error: 2 +}; diff --git a/node_modules/@textlint/kernel/src/context/TextlintSourceCodeImpl.ts b/node_modules/@textlint/kernel/src/context/TextlintSourceCodeImpl.ts new file mode 100644 index 000000000..ebb80479b --- /dev/null +++ b/node_modules/@textlint/kernel/src/context/TextlintSourceCodeImpl.ts @@ -0,0 +1,130 @@ +import type { + TextlintSourceCode, + TextlintSourceCodeArgs, + TextlintSourceCodeLocation, + TextlintSourceCodePosition, + TextlintSourceCodeRange +} from "@textlint/types"; +import { AnyTxtNode, ASTNodeTypes } from "@textlint/ast-node-types"; +import * as assert from "assert"; +import StructuredSource from "structured-source"; + +/** + * Validates that the given AST has the required information. + * @param {AnyTxtNode} [ast] The Program node of the AST to check. + * @throws {Error} If the AST doesn't contain the correct information. + * @returns {void} + * @private + */ +function validate(ast: AnyTxtNode) { + if (!ast.loc) { + throw new Error("AST is missing location information."); + } + + if (!ast.range) { + throw new Error("AST is missing range information"); + } +} + +/** + * This class represent of source code. + */ +export class TextlintSourceCodeImpl implements TextlintSourceCode { + hasBOM: boolean; + text: string; + ast: AnyTxtNode; + filePath: string | undefined; + ext: string; + + private _structuredSource: any; + + /** + * @param {string} text + * @param {Object} ast + * @param {string} ext + * @param {string} [filePath] + */ + constructor({ text = "", ast, ext, filePath }: TextlintSourceCodeArgs) { + validate(ast); + assert.ok(ext || filePath, "should be set either of fileExt or filePath."); + this.hasBOM = text.charCodeAt(0) === 0xfeff; + this.text = this.hasBOM ? text.slice(1) : text; + /** + * @type StructuredSource + */ + this._structuredSource = new StructuredSource(this.text); + this.ast = ast; + this.filePath = filePath; + /** + * fileType .md .txt ... + * @type {string} + */ + this.ext = ext; + } + + /** + * @returns {ASTNodeTypes} + */ + getSyntax() { + return ASTNodeTypes; + } + + /** + * get filePath + * @returns {string|undefined} + */ + getFilePath() { + return this.filePath; + } + + /** + * Gets the source code for the given node. + * @param {AnyTxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource(node?: AnyTxtNode, beforeCount?: number, afterCount?: number): string { + const currentText = this.text; + if (node) { + const start = Math.max(node.range[0] - (beforeCount || 0), 0); + const end = node.range[1] + (afterCount || 0); + return currentText.slice(start, end); + } else { + return currentText; + } + } + + // StructuredSource wrapper + /** + * @param {TextlintSourceCodeLocation} loc - location indicator. + * @return {[ number, number ]} range. + */ + locationToRange(loc: TextlintSourceCodeLocation): TextlintSourceCodeRange { + return this._structuredSource.locationToRange(loc); + } + + /** + * @param {[ number, number ]} range - pair of indice. + * @return {TextlintSourceCodeLocation} location. + */ + rangeToLocation(range: TextlintSourceCodeRange): TextlintSourceCodeLocation { + return this._structuredSource.rangeToLocation(range); + } + + /** + * @param {Position} pos - position indicator. + * @return {number} index. + */ + positionToIndex(pos: TextlintSourceCodePosition): number { + return this._structuredSource.positionToIndex(pos); + } + + /** + * @param {number} index - index to the source code. + * @return {Position} position. + */ + indexToPosition(index: number): TextlintSourceCodePosition { + return this._structuredSource.indexToPosition(index); + } +} diff --git a/node_modules/@textlint/kernel/src/core/source-location.ts b/node_modules/@textlint/kernel/src/core/source-location.ts new file mode 100644 index 000000000..9f01bd0ae --- /dev/null +++ b/node_modules/@textlint/kernel/src/core/source-location.ts @@ -0,0 +1,210 @@ +import type { + TextlintMessageFixCommand, + TextlintRuleContextReportFunctionArgs, + TextlintRuleError, + TextlintRuleErrorPadding, + TextlintSourceCode +} from "@textlint/types"; +import { TxtNode } from "@textlint/ast-node-types"; +import assert from "assert"; +import { throwIfTesting } from "@textlint/feature-flag"; + +export interface ReportMessage { + ruleId: string; + node: any; + severity: number; + ruleError: TextlintRuleError; +} + +export default class SourceLocation { + private source: TextlintSourceCode; + + constructor(source: TextlintSourceCode) { + this.source = source; + } + + /** + * adjust node's location with error's padding location. + */ + adjust( + reportArgs: TextlintRuleContextReportFunctionArgs + ): { line: number; column: number; fix?: TextlintMessageFixCommand } { + const { node, ruleError, ruleId } = reportArgs; + const errorPrefix = `[${ruleId}]` || ""; + const padding = ruleError; + /* + FIXME: It is old and un-document way + new RuleError("message", index); + */ + let _backwardCompatibleIndexValue; + if (typeof padding === "number") { + _backwardCompatibleIndexValue = padding; + throwIfTesting(`${errorPrefix} This is un-document way: +report(node, new RuleError("message", index); + +Please use { index }: + +report(node, new RuleError("message", { + index: paddingLineColumn +}); +`); + } + // when running from textlint-tester, assert + if (padding.line === undefined && padding.column !== undefined) { + // FIXME: Backward compatible <= textlint.5.5 + throwIfTesting(`${errorPrefix} Have to use a sets with "line" and "column". +See FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/line-column-or-index.md + +report(node, new RuleError("message", { + line: paddingLineNumber, + column: paddingLineColumn +}); + +OR use "index" property insteadof only "column". + +report(node, new RuleError("message", { + index: paddingLineColumn +}); +`); + } + + // When either one of {column, line} or {index} is not used, throw error + if ((padding.line !== undefined || padding.column !== undefined) && padding.index !== undefined) { + // Introduced textlint 5.6 + // https://github.com/textlint/textlint/releases/tag/5.6.0 + // Always throw Error + throw new Error(`${errorPrefix} Have to use one of {line, column} or {index}. +You should use either one: + +use "line" and "column" property + +report(node, new RuleError("message", { + line: paddingLineNumber, + column: paddingLineColumn +}); + +OR + +use "index" property + +report(node, new RuleError("message", { + index: paddingIndexValue +}); +`); + } + + const adjustedLoc = this.toAbsoluteLocation(node, padding, _backwardCompatibleIndexValue); + const adjustedFix = this.toAbsolutePositionFix(node, padding); + /* + { + line, + column + fix? + } + */ + return Object.assign({}, adjustedLoc, adjustedFix) as { + line: number; + column: number; + fix?: TextlintMessageFixCommand; + }; + } + + private toAbsoluteLocation(node: any, padding: TextlintRuleErrorPadding, _paddingIndex?: number) { + const nodeRange = node.range; + const line = node.loc.start.line; + const column = node.loc.start.column; + + // when use {index} + if (padding.index !== undefined || _paddingIndex !== undefined) { + const startNodeIndex = nodeRange[0]; + const paddingIndex = _paddingIndex || padding.index; + const position = this.source.indexToPosition(startNodeIndex + paddingIndex); + return { + column: position.column, + line: position.line + }; + } + // when use {line, column} + if (padding.line !== undefined && padding.column !== undefined) { + if (padding.line > 0) { + const addedLine = line + padding.line; + // when report with padding {line, column}, message.column should be 0 + padding.column. + // In other word, padding line > 0 and message.column start with 0. + if (padding.column > 0) { + return { + line: addedLine, + column: padding.column + }; + } else { + return { + line: addedLine, + column + }; + } + } + } + // when use { line } only + if (padding.line !== undefined && padding.line > 0) { + const addedLine = line + padding.line; + return { + line: addedLine, + column + }; + } + // when use { column } only + // FIXME: backward compatible @ un-document + // Remove next version 6? + /* + new RuleError({ + column: index + }); + */ + if (padding.column !== undefined && padding.column > 0) { + const addedColumn = column + padding.column; + return { + line, + column: addedColumn + }; + } + + return { + column, + line + }; + } + + /** + * Adjust `fix` command range + * if `fix.isAbsolute` is not absolute position, adjust the position from the `node`. + */ + private toAbsolutePositionFix(node: TxtNode, ruleErrorObject: TextlintRuleError) { + const nodeRange = node.range; + // if not found `fix`, return empty object + if (ruleErrorObject.fix === undefined) { + return {}; + } + assert.ok(typeof ruleErrorObject.fix === "object", "fix should be FixCommand object"); + // if absolute position return self + if (ruleErrorObject.fix.isAbsolute) { + return { + // remove other property that is not related `fix` + // the return object will be merged by `Object.assign` + fix: { + range: ruleErrorObject.fix.range, + text: ruleErrorObject.fix.text + } + }; + } + // if relative position return adjusted position + return { + // fix(command) is relative from node's range + fix: { + range: [ + nodeRange[0] + ruleErrorObject.fix.range[0], + nodeRange[0] + ruleErrorObject.fix.range[1] + ] as const, + text: ruleErrorObject.fix.text + } + }; + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/Descriptor.ts b/node_modules/@textlint/kernel/src/descriptor/Descriptor.ts new file mode 100644 index 000000000..ef2c76e2e --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/Descriptor.ts @@ -0,0 +1,7 @@ +export interface Descriptor { + id: string; + + equals(target: this): boolean; + + toKernel(): T; +} diff --git a/node_modules/@textlint/kernel/src/descriptor/DescriptorUtil.ts b/node_modules/@textlint/kernel/src/descriptor/DescriptorUtil.ts new file mode 100644 index 000000000..796c7012e --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/DescriptorUtil.ts @@ -0,0 +1,21 @@ +import { Descriptor } from "./Descriptor"; + +/** + * Remove duplicated descriptor + * For example, A1 equals to A2 + * [A1, B, A2] + * => filter + * [A1, B] + */ +export const filterDuplicateDescriptor = >(descriptors: T[]) => { + const newDescriptorList: T[] = []; + descriptors.forEach((descriptor) => { + const existsDescriptor = newDescriptorList.some((existDescriptor) => { + return existDescriptor.equals(descriptor); + }); + if (!existsDescriptor) { + newDescriptorList.push(descriptor); + } + }); + return newDescriptorList; +}; diff --git a/node_modules/@textlint/kernel/src/descriptor/DescriptorsFactory.ts b/node_modules/@textlint/kernel/src/descriptor/DescriptorsFactory.ts new file mode 100644 index 000000000..cb0e4c5eb --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/DescriptorsFactory.ts @@ -0,0 +1,30 @@ +// LICENSE : MIT +"use strict"; +import { TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +import { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +import { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +import { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; +import { hasFixer } from "./rule-creator-helper"; +import { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; + +export const createTextlintRuleDescriptors = (rules: TextlintKernelRule[]) => { + const ruleOrFixableRuleDescriptorList = rules.map((rule) => { + if (hasFixer(rule.rule)) { + return new TextlintFixableRuleDescriptor(rule); + } else { + return new TextlintLintableRuleDescriptor(rule); + } + }); + return new TextlintRuleDescriptors(ruleOrFixableRuleDescriptorList); +}; + +export const createTextlintFilterRuleDescriptors = (rules: TextlintKernelFilterRule[]) => { + return new TextlintFilterRuleDescriptors(rules.map((rule) => new TextlintFilterRuleDescriptor(rule))); +}; + +export const createTextlintPluginDescriptors = (rules: TextlintKernelPlugin[]) => { + return new TextlintPluginDescriptors(rules.map((rule) => new TextlintPluginDescriptor(rule))); +}; diff --git a/node_modules/@textlint/kernel/src/descriptor/README.md b/node_modules/@textlint/kernel/src/descriptor/README.md new file mode 100644 index 000000000..2e3810b6e --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/README.md @@ -0,0 +1,45 @@ +# descriptor + +A Descriptor class for kernel. + +The Descriptor is a structure object of rules, filter rules, plugins. + +- The Descriptor is normalized/filtered object + - without duplication + - without disabled +- Create a Descriptor from textlintrc object +- Create a Descriptor from kernel options +- Analyze plugins and provide available extensions for linting +- Analyze rules and provide normalized rule instance + +## Usage + +```js +const descriptors = new TextlintKernelDescriptor({ + plugins: [ + { + pluginId: "text", + plugin: createDummyPlugin([".txt"]) + }, + { + pluginId: "markdown", + plugin: createDummyPlugin([".md"]) + } + ], + rules: [ + { + ruleId: "example", + rule: exampleRule + } + ], + filterRules: [] +}); +// available extensions +assert.deepStrictEqual(descriptors.plugin.availableExtensions, [".txt", ".md"]); +// get plugin instance +const markdownProcessor = descriptors.findPluginDescriptorWithExt(".md"); +assert.ok(markdownProcessor !== undefined); +// rules +assert.strictEqual(descriptors.rule.descriptors.length, 1); +``` + diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintFilterRuleDescriptor.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintFilterRuleDescriptor.ts new file mode 100644 index 000000000..a0df6ecf9 --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintFilterRuleDescriptor.ts @@ -0,0 +1,72 @@ +// LICENSE : MIT +"use strict"; +import { getFilter } from "./rule-creator-helper"; +import { TextlintKernelFilterRule } from "../textlint-kernel-interface"; +import { Descriptor } from "./Descriptor"; +import type { TextlintFilterRuleOptions, TextlintFilterRuleReporter } from "@textlint/types"; +import deepEqual from "deep-equal"; + +/** + * Textlint Rule Descriptor. + * It handle RuleCreator and RuleOption. + */ +export class TextlintFilterRuleDescriptor implements Descriptor { + constructor(private kernelFilterRule: TextlintKernelFilterRule) {} + + get id() { + return this.kernelFilterRule.ruleId; + } + + get rule(): TextlintFilterRuleReporter { + return this.kernelFilterRule.rule; + } + + /** + * Return true if this rule is enabled. + */ + get enabled(): boolean { + return this.rawOptions !== false; + } + + /** + * Return filter function + * You should check hasLiner before call this. + */ + get filter() { + return getFilter(this.rule); + } + + /** + * Return normalized rule option object. + * If the rule have not option, return `true` by default. + */ + get normalizedOptions(): TextlintFilterRuleOptions { + // default: { ruleName: true } + const DefaultRuleConfigValue = {}; + if (typeof this.kernelFilterRule.options === "boolean" || this.kernelFilterRule.options === undefined) { + return DefaultRuleConfigValue; + } else { + return this.kernelFilterRule.options; + } + } + + get rawOptions(): undefined | boolean | TextlintFilterRuleOptions { + return this.kernelFilterRule.options; + } + + /** + * Return true if descriptor is same + */ + equals(descriptor: this): boolean { + return ( + this.rule === descriptor.rule && + deepEqual(this.normalizedOptions, descriptor.normalizedOptions, { + strict: true + }) + ); + } + + toKernel() { + return this.kernelFilterRule; + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintFilterRuleDescriptors.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintFilterRuleDescriptors.ts new file mode 100644 index 000000000..73b052a11 --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintFilterRuleDescriptors.ts @@ -0,0 +1,47 @@ +// LICENSE : MIT +"use strict"; +import { TextlintKernelFilterRule } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +import { filterDuplicateDescriptor } from "./DescriptorUtil"; + +/** + * The collection class of TextlintFilterRuleDescriptor + */ +export class TextlintFilterRuleDescriptors { + constructor(private ruleDescriptorList: TextlintFilterRuleDescriptor[] = []) {} + + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + toKernelFilterRulesFormat(): Array { + return this.withoutDuplicated().descriptors.map((descriptor) => { + return descriptor.toKernel(); + }); + } + + /** + * Return enabled descriptors + */ + get descriptors() { + return this.ruleDescriptorList.filter((descriptor) => { + return descriptor.enabled; + }); + } + + /** + * Return all descriptors that include disabled descriptors + */ + get allDescriptors() { + return this.ruleDescriptorList; + } + + /** + * filter duplicated descriptors + */ + withoutDuplicated(): TextlintFilterRuleDescriptors { + // remove last duplicated item + const newDescriptorList = filterDuplicateDescriptor(this.ruleDescriptorList); + return new TextlintFilterRuleDescriptors(newDescriptorList); + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintFixableRuleDescriptor.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintFixableRuleDescriptor.ts new file mode 100644 index 000000000..2ff6b8ace --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintFixableRuleDescriptor.ts @@ -0,0 +1,20 @@ +// LICENSE : MIT +"use strict"; +import { getFixer } from "./rule-creator-helper"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import type { TextlintRuleReporter } from "@textlint/types"; + +/** + * Textlint Fixable Rule Descriptor. + * It is inherit **Rule** Descriptor and add fixer() method. + * It handle RuleCreator and RuleOption. + */ +export class TextlintFixableRuleDescriptor extends TextlintLintableRuleDescriptor { + /** + * Return fixer function + * You should check hasFixer before call this. + */ + get fixer(): TextlintRuleReporter { + return getFixer(this.rule); + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintKernelDescriptor.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintKernelDescriptor.ts new file mode 100644 index 000000000..01330703d --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintKernelDescriptor.ts @@ -0,0 +1,61 @@ +import { TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule } from "../textlint-kernel-interface"; +import { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +import { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +import { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +import { + createTextlintFilterRuleDescriptors, + createTextlintPluginDescriptors, + createTextlintRuleDescriptors +} from "./DescriptorsFactory"; +import { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; + +export interface TextlintKernelDescriptorArgs { + rules: TextlintKernelRule[]; + filterRules: TextlintKernelFilterRule[]; + plugins: TextlintKernelPlugin[]; +} + +export class TextlintKernelDescriptor { + rule: TextlintRuleDescriptors; + filterRule: TextlintFilterRuleDescriptors; + plugin: TextlintPluginDescriptors; + + constructor(private args: TextlintKernelDescriptorArgs) { + this.rule = createTextlintRuleDescriptors(args.rules); + this.filterRule = createTextlintFilterRuleDescriptors(args.filterRules); + this.plugin = createTextlintPluginDescriptors(args.plugins); + } + + /** + * Return available extensions of plugins + */ + get availableExtensions() { + return this.plugin.availableExtensions; + } + + /** + * Merge constructor args and partialArgs + * It shallow merge partialArgs. + * It means that overwrite root properties by partialArgs. + */ + shallowMerge(partialArgs: Partial) { + return new TextlintKernelDescriptor({ + ...this.args, + ...partialArgs + }); + } + + /** + * find PluginDescriptor with extension. + * This is forward match. + * + * If following config of textlint, this method prefer to select MarkdownA for markdown. + * + * { + * "plugins": [MarkdownA, MarkdownB] + * } + */ + findPluginDescriptorWithExt(ext: string): TextlintPluginDescriptor | undefined { + return this.plugin.findPluginDescriptorWithExt(ext); + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintLintableRuleDescriptor.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintLintableRuleDescriptor.ts new file mode 100644 index 000000000..7b9f6a74a --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintLintableRuleDescriptor.ts @@ -0,0 +1,76 @@ +// LICENSE : MIT +"use strict"; +import { TextlintKernelRule } from "../textlint-kernel-interface"; +import { assertRuleShape, getLinter } from "./rule-creator-helper"; +import type { TextlintRuleModule, TextlintRuleOptions, TextlintRuleReporter } from "@textlint/types"; +import deepEqual from "deep-equal"; + +/** + * Textlint Rule Descriptor. + * It handle RuleCreator and RuleOption. + */ +export class TextlintLintableRuleDescriptor { + constructor(private textlintKernelRule: TextlintKernelRule) { + assertRuleShape(textlintKernelRule.rule, textlintKernelRule.ruleId); + } + + get id() { + return this.textlintKernelRule.ruleId; + } + + /** + * Rule module-self + */ + get rule(): TextlintRuleModule { + return this.textlintKernelRule.rule; + } + + /** + * Return true if this rule is enabled. + */ + get enabled(): boolean { + return this.rawOptions !== false; + } + + /** + * Return linter function + * You should check hasLiner before call this. + */ + get linter(): TextlintRuleReporter { + return getLinter(this.rule); + } + + /** + * Return normalized rule option object. + * If the rule have not option, return `true` by default. + */ + get normalizedOptions(): TextlintRuleOptions { + // default: { ruleName: true } + const DefaultRuleConfigValue = {}; + if (typeof this.textlintKernelRule.options === "boolean" || this.textlintKernelRule.options === undefined) { + return DefaultRuleConfigValue; + } else { + return this.textlintKernelRule.options; + } + } + + get rawOptions(): boolean | undefined | TextlintRuleOptions { + return this.textlintKernelRule.options; + } + + /** + * Return true if descriptor is same + */ + equals(descriptor: TextlintLintableRuleDescriptor): boolean { + return ( + this.rule === descriptor.rule && + deepEqual(this.normalizedOptions, descriptor.normalizedOptions, { + strict: true + }) + ); + } + + toKernel(): TextlintKernelRule { + return this.textlintKernelRule; + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintPluginDescriptor.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintPluginDescriptor.ts new file mode 100644 index 000000000..c998035f6 --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintPluginDescriptor.ts @@ -0,0 +1,90 @@ +"use strict"; +import { TextlintKernelPlugin } from "../textlint-kernel-interface"; +import { Descriptor } from "./Descriptor"; +import type { + TextlintPluginOptions, + TextlintPluginProcessor, + TextlintPluginProcessorConstructor +} from "@textlint/types"; +import deepEqual from "deep-equal"; + +/** + * Get instance/static `availableExtensions()` from TextlintPluginProcessor + */ +const getAvailableExtensions = (pluginProcessor: TextlintPluginProcessor): string[] => { + if (typeof pluginProcessor.availableExtensions === "function") { + return pluginProcessor.availableExtensions(); + } + // It is compatible for textlint@10<= + // Recommended: `availableExtensions()` should be defined as instance method. + // https://github.com/textlint/textlint/issues/531 + const PluginProcessorConstructor = pluginProcessor.constructor as TextlintPluginProcessorConstructor; + if (typeof PluginProcessorConstructor.availableExtensions === "function") { + return PluginProcessorConstructor.availableExtensions(); + } + throw new Error(`Plugin(${pluginProcessor}) should implement availableExtensions() method`); +}; + +/** + * Textlint Plugin Descriptor + */ +export class TextlintPluginDescriptor implements Descriptor { + public processor: TextlintPluginProcessor; + + constructor(private plugin: TextlintKernelPlugin) { + this.plugin = plugin; + if (!this.plugin.plugin.Processor) { + throw new Error(`Plugin should have Processor property. +module.exports = { + Processor: class Processor{ ... } +} +`); + } + this.processor = new plugin.plugin.Processor(this.normalizedOptions); + } + + get id() { + return this.plugin.pluginId; + } + + /** + * Return true if this rule is enabled. + */ + get enabled(): boolean { + return this.rawOptions !== false; + } + + /** + * Return available extension of this plugin + */ + get availableExtensions(): string[] { + return getAvailableExtensions(this.processor); + } + + get normalizedOptions(): TextlintPluginOptions { + // default: { ruleName: true } + const DefaultPluginOption = {}; + if (typeof this.plugin.options === "boolean" || this.plugin.options === undefined) { + return DefaultPluginOption; + } else { + return this.plugin.options; + } + } + + get rawOptions() { + return this.plugin.options; + } + + toKernel() { + return this.plugin; + } + + equals(target: this): boolean { + return ( + this.plugin.plugin === target.plugin.plugin && + deepEqual(this.plugin.options, target.plugin.options, { + strict: true + }) + ); + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintPluginDescriptors.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintPluginDescriptors.ts new file mode 100644 index 000000000..546a820cb --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintPluginDescriptors.ts @@ -0,0 +1,65 @@ +"use strict"; +import { TextlintKernelPlugin } from "../textlint-kernel-interface"; +import { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; +import { filterDuplicateDescriptor } from "./DescriptorUtil"; + +/** + * Collection class of TextlintPluginDescriptor + */ +export class TextlintPluginDescriptors { + constructor(private pluginDescriptorList: TextlintPluginDescriptor[] = []) {} + + /** + * Return enabled descriptors + */ + get descriptors() { + return this.pluginDescriptorList.filter((descriptor) => { + return descriptor.enabled; + }); + } + + /** + * Return all descriptors that include disabled descriptors + */ + get allDescriptors() { + return this.pluginDescriptorList; + } + + /** + * Return available extensions + * It is not includes disabled plugin's extensions. + */ + get availableExtensions(): string[] { + return this.descriptors.reduce((extensions, descriptor) => { + return extensions.concat(descriptor.availableExtensions); + }, [] as string[]); + } + + /** + * find PluginDescriptor with extension. + * This is forward match. + */ + findPluginDescriptorWithExt(ext: string) { + return this.descriptors.find((descriptor) => { + return descriptor.availableExtensions.includes(ext); + }); + } + + /** + * filter duplicated descriptors + */ + withoutDuplicated() { + const newDescriptorList = filterDuplicateDescriptor(this.pluginDescriptorList); + return new TextlintPluginDescriptors(newDescriptorList); + } + + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + toKernelPluginsFormat(): TextlintKernelPlugin[] { + return this.descriptors.map((descriptor) => { + return descriptor.toKernel(); + }); + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/TextlintRuleDescriptors.ts b/node_modules/@textlint/kernel/src/descriptor/TextlintRuleDescriptors.ts new file mode 100644 index 000000000..2d154106b --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/TextlintRuleDescriptors.ts @@ -0,0 +1,66 @@ +// LICENSE : MIT +"use strict"; +import { TextlintKernelRule } from "../textlint-kernel-interface"; +import { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +import { filterDuplicateDescriptor } from "./DescriptorUtil"; +import { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; + +export type TextlintRuleAllRuleDescriptor = TextlintLintableRuleDescriptor | TextlintFixableRuleDescriptor; + +/** + * The collection class of TextlintRuleDescriptor + */ +export class TextlintRuleDescriptors { + constructor(private ruleDescriptorList: TextlintRuleAllRuleDescriptor[] = []) {} + + /** + * Convert this to TextlintKernel rules format + * @returns {Array} + */ + toKernelRulesFormat(): Array { + return this.withoutDuplicated().lintableDescriptors.map((descriptor) => { + return descriptor.toKernel(); + }); + } + + /** + * Return enabled lintable descriptors + */ + get lintableDescriptors(): TextlintLintableRuleDescriptor[] { + return this.descriptors.filter((descriptor) => { + // fixable is also lintable + return descriptor instanceof TextlintLintableRuleDescriptor; + }); + } + + /** + * Return enabled fixable descriptors + */ + get fixableDescriptors(): TextlintFixableRuleDescriptor[] { + return this.descriptors.filter((descriptor) => { + return descriptor instanceof TextlintFixableRuleDescriptor; + }) as TextlintFixableRuleDescriptor[]; + } + + /** + * Return enabled descriptors + */ + get descriptors(): TextlintRuleAllRuleDescriptor[] { + return this.ruleDescriptorList.filter((descriptor) => descriptor.enabled); + } + + /** + * Return all descriptors that include disabled descriptors + */ + get allDescriptors(): TextlintRuleAllRuleDescriptor[] { + return this.ruleDescriptorList; + } + + /** + * filter duplicated descriptors + */ + withoutDuplicated() { + const newDescriptorList = filterDuplicateDescriptor(this.ruleDescriptorList); + return new TextlintRuleDescriptors(newDescriptorList); + } +} diff --git a/node_modules/@textlint/kernel/src/descriptor/index.ts b/node_modules/@textlint/kernel/src/descriptor/index.ts new file mode 100644 index 000000000..0cf4035ec --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/index.ts @@ -0,0 +1,8 @@ +export { TextlintKernelDescriptor } from "./TextlintKernelDescriptor"; +export { TextlintRuleDescriptors } from "./TextlintRuleDescriptors"; +export { TextlintLintableRuleDescriptor } from "./TextlintLintableRuleDescriptor"; +export { TextlintFixableRuleDescriptor } from "./TextlintFixableRuleDescriptor"; +export { TextlintFilterRuleDescriptors } from "./TextlintFilterRuleDescriptors"; +export { TextlintFilterRuleDescriptor } from "./TextlintFilterRuleDescriptor"; +export { TextlintPluginDescriptors } from "./TextlintPluginDescriptors"; +export { TextlintPluginDescriptor } from "./TextlintPluginDescriptor"; diff --git a/node_modules/@textlint/kernel/src/descriptor/plugin-creator-helper.ts b/node_modules/@textlint/kernel/src/descriptor/plugin-creator-helper.ts new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/@textlint/kernel/src/descriptor/rule-creator-helper.ts b/node_modules/@textlint/kernel/src/descriptor/rule-creator-helper.ts new file mode 100644 index 000000000..425d4317e --- /dev/null +++ b/node_modules/@textlint/kernel/src/descriptor/rule-creator-helper.ts @@ -0,0 +1,108 @@ +import type { TextlintFilterRuleReporter, TextlintRuleReporter } from "@textlint/types"; + +/** + * detect that ruleCreator has linter function + * @param {*} ruleCreator + * @returns {boolean} + */ +export function hasLinter(ruleCreator: any): boolean { + if (typeof ruleCreator.linter === "function") { + return true; + } + if (typeof ruleCreator === "function") { + return true; + } + return false; +} + +/** + * get linter function from ruleCreator + * if not found, throw error + * @param {Function|Object|any} ruleCreator + * @returns {Function} linter function + * @throws + */ +export function getLinter(ruleCreator: Function | object | any): TextlintRuleReporter { + if (typeof ruleCreator.linter === "function") { + return ruleCreator.linter; + } + if (typeof ruleCreator === "function") { + return ruleCreator; + } + throw new Error("Not found linter function in the ruleCreator"); +} + +/** + * detect that ruleCreator has fixer function + * @param {*} ruleCreator + * @returns {boolean} + */ +export function hasFixer(ruleCreator: any): boolean { + return typeof ruleCreator.fixer === "function" && hasLinter(ruleCreator); +} + +/** + * get fixer function from ruleCreator + * if not found, throw error + * @param {Function|Object|any} ruleCreator + * @returns {Function} fixer function + * @throws + */ +export function getFixer(ruleCreator: Function | object | any): TextlintRuleReporter { + if (!hasLinter(ruleCreator)) { + throw new Error("fixer module should have also linter function."); + } + if (hasFixer(ruleCreator)) { + return ruleCreator.fixer; + } + throw new Error("Not found fixer function in the ruleCreator"); +} + +/** + * RuleModule should has either linter or fixer. + * @param {*} ruleCreator + * @returns {boolean} + **/ +export function isRuleModule(ruleCreator: any): boolean { + return hasLinter(ruleCreator) || hasFixer(ruleCreator); +} + +/** + * Validate rule module. + * if invalid throw error + * @param {*} ruleModule + * @param {string} [key] + * @throws + */ +export function assertRuleShape(ruleModule: any, key: string = "") { + if (ruleModule === undefined) { + throw new Error(`Definition of rule '${key}' was not found.`); + } + /* + Check old rule function + module.exports = function(context){ + + } + */ + if (!isRuleModule(ruleModule)) { + throw new Error(`Definition of rule '${key}' was not rule module. +Rule should export function: +module.exports = function(context){ + // Your rule +};`); + } +} + +/** + * get linter function from ruleCreator + * if not found, throw error + * @param {*} ruleCreator + * @returns {Function} linter function + * @throws + */ +export function getFilter(ruleCreator: any): TextlintFilterRuleReporter { + if (typeof ruleCreator === "function") { + return ruleCreator; + } + throw new Error("Not found filter function in the ruleCreator"); +} diff --git a/node_modules/@textlint/kernel/src/fixer/fixer-processor.ts b/node_modules/@textlint/kernel/src/fixer/fixer-processor.ts new file mode 100644 index 000000000..6451f1368 --- /dev/null +++ b/node_modules/@textlint/kernel/src/fixer/fixer-processor.ts @@ -0,0 +1,132 @@ +// LICENSE : MIT +"use strict"; + +import type { TextlintFixResult, TextlintMessage, TextlintPluginProcessor, TextlintSourceCode } from "@textlint/types"; +import * as assert from "assert"; +import FixerTask from "../task/fixer-task"; +import TaskRunner from "../task/task-runner"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import MessageProcessManager from "../messages/MessageProcessManager"; +import { TextlintFilterRuleDescriptors, TextlintRuleDescriptors } from "../descriptor"; +import { TextlintSourceCodeImpl } from "../context/TextlintSourceCodeImpl"; +import { isTxtAST } from "@textlint/ast-tester"; +import _debug from "debug"; +import { applyFixesToSourceCode } from "@textlint/source-code-fixer"; + +const debug = _debug("textlint:fixer-processor"); + +export interface FixerProcessorProcessArgs { + config: TextlintKernelConstructorOptions; + configBaseDir?: string; + ruleDescriptors: TextlintRuleDescriptors; + filterRules: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; +} + +export default class FixerProcessor { + private processor: TextlintPluginProcessor; + private messageProcessManager: MessageProcessManager; + + /** + * @param {Processor} processor + * @param {MessageProcessManager} messageProcessManager + */ + constructor(processor: TextlintPluginProcessor, messageProcessManager: MessageProcessManager) { + this.processor = processor; + this.messageProcessManager = messageProcessManager; + } + + /** + * Run fixer process + * @param {Config} config + * @param {string} [configBaseDir] + * @param {TextlintKernelRule[]} [rules] + * @param {TextlintKernelFilterRule[]} [filterRules] + * @param {SourceCode} sourceCode + * @returns {Promise.} + */ + process({ + config, + configBaseDir, + ruleDescriptors, + filterRules, + sourceCode + }: FixerProcessorProcessArgs): Promise { + assert.ok(sourceCode); + const { preProcess, postProcess } = this.processor.processor(sourceCode.ext); + // messages + let resultFilePath = sourceCode.filePath; + // applied fixing messages + // Revert = Sequentially apply applied message to applied output + // SourceCodeFixer.sequentiallyApplyFixes(fixedOutput, result.applyingMessages); + const applyingMessages: TextlintMessage[] = []; + // not applied fixing messages + const remainingMessages: TextlintMessage[] = []; + // original means original for applyingMessages and remainingMessages + // pre-applyingMessages + remainingMessages + const originalMessages: TextlintMessage[] = []; + const fixerProcessList = ruleDescriptors.fixableDescriptors.map((ruleDescriptor) => { + return (sourceText: string): Promise => { + // create new SourceCode object + const preProcessResult = preProcess(sourceText, sourceCode.filePath); + const isPluginReturnAnAST = isTxtAST(preProcessResult); + const textForAST = isPluginReturnAnAST ? sourceText : preProcessResult.text; + const ast = isPluginReturnAnAST ? preProcessResult : preProcessResult.ast; + const newSourceCode = new TextlintSourceCodeImpl({ + text: textForAST, + ast, + filePath: resultFilePath, + ext: sourceCode.ext + }); + // create new Task + const task = new FixerTask({ + config, + fixableRuleDescriptor: ruleDescriptor, + filterRuleDescriptors: filterRules, + sourceCode: newSourceCode, + configBaseDir + }); + + return TaskRunner.process(task).then((messages) => { + const result = postProcess(messages, sourceCode.filePath); + const filteredResult = { + messages: this.messageProcessManager.process(result.messages), + filePath: result.filePath ? result.filePath : `` + }; + // TODO: should be removed resultFilePath + resultFilePath = filteredResult.filePath; + const applied = applyFixesToSourceCode(newSourceCode, filteredResult.messages); + // add messages + Array.prototype.push.apply(applyingMessages, applied.applyingMessages); + Array.prototype.push.apply(remainingMessages, applied.remainingMessages); + Array.prototype.push.apply(originalMessages, applied.messages); + // if not fixed, still use current sourceText + if (!applied.fixed) { + return sourceText; + } + // if fixed, use fixed text at next + return applied.output; + }); + }; + }); + + const promiseTask = fixerProcessList.reduce((promise, fixerProcess) => { + return promise.then((sourceText) => { + return fixerProcess(sourceText); + }); + }, Promise.resolve(sourceCode.text)); + + return promiseTask.then((output) => { + debug(`Finish Processing: ${resultFilePath}`); + debug(`applyingMessages: ${applyingMessages.length}`); + debug(`remainingMessages: ${remainingMessages.length}`); + return { + filePath: resultFilePath ? resultFilePath : ``, + output, + messages: originalMessages, + applyingMessages, + remainingMessages + }; + }); + } +} diff --git a/node_modules/@textlint/kernel/src/fixer/rule-fixer.ts b/node_modules/@textlint/kernel/src/fixer/rule-fixer.ts new file mode 100644 index 000000000..54d72ea0e --- /dev/null +++ b/node_modules/@textlint/kernel/src/fixer/rule-fixer.ts @@ -0,0 +1,156 @@ +import * as assert from "assert"; +import { TxtNode } from "@textlint/ast-node-types"; +import type { TextlintSourceCodeRange } from "@textlint/types"; + +/** + * Fix Command object has `range` and `text`. + * `IntermediateFixCommand` has also `isAbsolute` flag value. + */ +export interface IntermediateFixCommand { + text: string; + range: number[]; + isAbsolute: boolean; +} + +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAt(index: number, text: string) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text, + isAbsolute: false + }; +} + +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {number} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + * @private + */ +function insertTextAtAbsolute(index: number, text: string) { + assert.ok(text, "text must be string"); + return { + range: [index, index], + text, + isAbsolute: true + }; +} + +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +export default class RuleFixer { + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfter(node: TxtNode, text: string) { + return insertTextAtAbsolute(node.range[1], text); + } + + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfterRange(range: TextlintSourceCodeRange, text: string) { + return insertTextAt(range[1], text); + } + + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBefore(node: TxtNode, text: string) { + return insertTextAtAbsolute(node.range[0], text); + } + + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBeforeRange(range: TextlintSourceCodeRange, text: string) { + return insertTextAt(range[0], text); + } + + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceText(node: TxtNode, text: string) { + return { + range: node.range, + text, + isAbsolute: true + }; + } + + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceTextRange(range: TextlintSourceCodeRange, text: string) { + return { + range, + text, + isAbsolute: false + }; + } + + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + remove(node: TxtNode) { + return this.replaceText(node, ""); + } + + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + removeRange(range: TextlintSourceCodeRange) { + return this.replaceTextRange(range, ""); + } +} diff --git a/node_modules/@textlint/kernel/src/index.ts b/node_modules/@textlint/kernel/src/index.ts new file mode 100644 index 000000000..6f857ca3d --- /dev/null +++ b/node_modules/@textlint/kernel/src/index.ts @@ -0,0 +1,33 @@ +// Kernel +export { TextlintKernel } from "./textlint-kernel"; +// Kernel Descriptor +export * from "./descriptor/index"; +// Kernel rule/filter/plugin format +export { TextlintKernelRule, TextlintKernelFilterRule, TextlintKernelPlugin } from "./textlint-kernel-interface"; + +/** + * Types of textlint lint/fix result + */ +export type { TextlintResult, TextlintFixResult, TextlintMessageFixCommand, TextlintMessage } from "@textlint/types"; +/** + * @deprecated These types will removed in the future. Use @textlint/types instead of it + * If you use these types in your rule, you should use @textlint/types for your rule. + * Related changes: https://github.com/textlint/textlint/pull/562 + */ +export type { + // textlint rule interface + TextlintRuleReporter, + TextlintRuleModule, + TextlintRuleOptions, + TextlintRuleSeverityLevel, + // textlint filter rule interface + TextlintFilterRuleReporter, + TextlintFilterRuleOptions, + // textlint plugin interface + TextlintPluginCreator, + TextlintPluginOptions, + TextlintPluginProcessor, + TextlintPluginProcessorConstructor +} from "@textlint/types"; +// TextlintRuleSeverityLevel Key +export { TextlintRuleSeverityLevelKeys } from "./context/TextlintRuleSeverityLevelKeys"; diff --git a/node_modules/@textlint/kernel/src/linter/linter-processor.ts b/node_modules/@textlint/kernel/src/linter/linter-processor.ts new file mode 100644 index 000000000..a1730aba1 --- /dev/null +++ b/node_modules/@textlint/kernel/src/linter/linter-processor.ts @@ -0,0 +1,68 @@ +// LICENSE : MIT +"use strict"; +import * as assert from "assert"; +import LinterTask from "../task/linter-task"; +import TaskRunner from "../task/task-runner"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; + +import MessageProcessManager from "../messages/MessageProcessManager"; +import { TextlintFilterRuleDescriptors, TextlintRuleDescriptors } from "../descriptor"; +import type { TextlintSourceCode, TextlintPluginProcessor, TextlintResult } from "@textlint/types"; + +export interface LinterProcessorArgs { + config: TextlintKernelConstructorOptions; + configBaseDir?: string; + ruleDescriptors: TextlintRuleDescriptors; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; +} + +export default class LinterProcessor { + private processor: TextlintPluginProcessor; + private messageProcessManager: MessageProcessManager; + + /** + * @param {Processor} processor + * @param {MessageProcessManager} messageProcessManager + */ + constructor(processor: TextlintPluginProcessor, messageProcessManager: MessageProcessManager) { + this.processor = processor; + this.messageProcessManager = messageProcessManager; + } + + /** + * Run linter process + */ + process({ + config, + configBaseDir, + ruleDescriptors, + filterRuleDescriptors, + sourceCode + }: LinterProcessorArgs): Promise { + const { preProcess, postProcess } = this.processor.processor(sourceCode.ext); + assert.ok( + typeof preProcess === "function" && typeof postProcess === "function", + "processor should implement {preProcess, postProcess}" + ); + const task = new LinterTask({ + config, + ruleDescriptors: ruleDescriptors, + filterRuleDescriptors: filterRuleDescriptors, + sourceCode, + configBaseDir + }); + return TaskRunner.process(task).then((messages) => { + const result = postProcess(messages, sourceCode.filePath); + result.messages = this.messageProcessManager.process(result.messages); + if (result.filePath == null) { + result.filePath = ``; + } + assert.ok( + result.filePath && result.messages.length >= 0, + "postProcess should return { messages, filePath } " + ); + return result; + }); + } +} diff --git a/node_modules/@textlint/kernel/src/messages/MessageProcessManager.ts b/node_modules/@textlint/kernel/src/messages/MessageProcessManager.ts new file mode 100644 index 000000000..01f4a3b64 --- /dev/null +++ b/node_modules/@textlint/kernel/src/messages/MessageProcessManager.ts @@ -0,0 +1,54 @@ +// LICENSE : MIT +"use strict"; +import { IgnoreReportedMessage, LintReportedMessage } from "../task/textlint-core-task"; +import type { TextlintMessage } from "@textlint/types"; + +export type PreMessageProcessor = ( + messages: Array +) => Array; +export type MessageProcessor = (messages: TextlintMessage[]) => TextlintMessage[]; + +export default class MessageProcessManager { + private _preProcessors: PreMessageProcessor[]; + private _processors: MessageProcessor[]; + + /** + * Preprossor + */ + constructor(preProcessors: PreMessageProcessor[]) { + this._preProcessors = preProcessors || []; + this._processors = []; + } + + add(messageProcessor: MessageProcessor) { + this._processors.push(messageProcessor); + } + + remove(process: MessageProcessor) { + const index = this._processors.indexOf(process); + if (index !== -1) { + this._processors.splice(index, 1); + } + } + + /** + * process `messages` with registered processes + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ + process(messages: Array): TextlintMessage[] { + const originalMessages = messages; + if (this._preProcessors.length === 0) { + throw new Error("pre process should be > 0"); + } + const preProcessedMesssages = this._preProcessors.reduce((messages, filter) => { + return filter(messages); + }, originalMessages) as TextlintMessage[]; + if (this._processors.length === 0) { + return preProcessedMesssages; + } + return this._processors.reduce((messages, filter) => { + return filter(messages); + }, preProcessedMesssages); + } +} diff --git a/node_modules/@textlint/kernel/src/messages/filter-duplicated-process.ts b/node_modules/@textlint/kernel/src/messages/filter-duplicated-process.ts new file mode 100644 index 000000000..de085be69 --- /dev/null +++ b/node_modules/@textlint/kernel/src/messages/filter-duplicated-process.ts @@ -0,0 +1,28 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintMessage } from "@textlint/types"; + +/** + * @param {TextlintMessage} aMessage + * @param {TextlintMessage} bMessage + */ +const isEqualMessage = (aMessage: TextlintMessage, bMessage: TextlintMessage) => { + return ( + aMessage.index === bMessage.index && + aMessage.severity === bMessage.severity && + aMessage.message === bMessage.message + ); +}; +/** + * filter duplicated messages + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} filtered messages + */ +export default function filterDuplicatedMessages(messages: TextlintMessage[] = []) { + return messages.filter((message, index) => { + const restMessages = messages.slice(index + 1); + return !restMessages.some((restMessage) => { + return isEqualMessage(message, restMessage); + }); + }); +} diff --git a/node_modules/@textlint/kernel/src/messages/filter-ignored-process.ts b/node_modules/@textlint/kernel/src/messages/filter-ignored-process.ts new file mode 100644 index 000000000..36dd2197c --- /dev/null +++ b/node_modules/@textlint/kernel/src/messages/filter-ignored-process.ts @@ -0,0 +1,43 @@ +// LICENSE : MIT +"use strict"; +import MessageType from "../shared/type/MessageType"; +import { IgnoreReportedMessage, LintReportedMessage } from "../task/textlint-core-task"; + +/** + * the `index` is in the `range` and return true. + * @param {Number} index + * @param {Number[]} range + * @returns {boolean} + */ +const isContainedRange = (index: number, range: [number, number]) => { + const [start, end] = range; + return start <= index && index <= end; +}; +/** + * filter messages by ignore messages + * @param {Object[]} messages + * @returns {Object[]} filtered messages + */ +export default function filterMessages(messages: ReadonlyArray = []) { + const lintingMessages = messages.filter((message) => { + return message.type === MessageType.lint; + }) as LintReportedMessage[]; + const ignoreMessages = messages.filter((message) => { + return message.type === MessageType.ignore; + }) as IgnoreReportedMessage[]; + // if match, reject the message + return lintingMessages.filter((message) => { + return !ignoreMessages.some((ignoreMessage) => { + const isInIgnoringRange = isContainedRange(message.index, ignoreMessage.range); + if (isInIgnoringRange && ignoreMessage.ignoringRuleId) { + // "*" is wildcard that match any rule + if (ignoreMessage.ignoringRuleId === "*") { + return true; + } + // compare normalized key path + return message.ruleId === ignoreMessage.ignoringRuleId; + } + return isInIgnoringRange; + }); + }); +} diff --git a/node_modules/@textlint/kernel/src/messages/filter-severity-process.ts b/node_modules/@textlint/kernel/src/messages/filter-severity-process.ts new file mode 100644 index 000000000..54da2e83d --- /dev/null +++ b/node_modules/@textlint/kernel/src/messages/filter-severity-process.ts @@ -0,0 +1,40 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintMessage } from "@textlint/types"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import { TextlintRuleSeverityLevelKeys } from "../context/TextlintRuleSeverityLevelKeys"; + +/** + * Filter messages by their severity. + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} filtered messages + */ +export function filterWarningMessages(messages: TextlintMessage[] = []) { + return messages.filter((message) => { + return message.severity === TextlintRuleSeverityLevelKeys.error; + }); +} + +/** + * Pass through all messages. + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ +export function through(messages: T[] = []): T[] { + return messages; +} + +/** + * Create message filter by config.quiet. + * @param {Config} config + * @returns {Function} filter function for messages + */ +export default function createSeverityFilter( + config: TextlintKernelConstructorOptions +): (messages: TextlintMessage[]) => TextlintMessage[] { + if (config.quiet) { + return filterWarningMessages; + } else { + return through; + } +} diff --git a/node_modules/@textlint/kernel/src/messages/sort-messages-process.ts b/node_modules/@textlint/kernel/src/messages/sort-messages-process.ts new file mode 100644 index 000000000..13ba17cea --- /dev/null +++ b/node_modules/@textlint/kernel/src/messages/sort-messages-process.ts @@ -0,0 +1,20 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintMessage } from "@textlint/types"; + +/** + * sort messages by line and column + * @param {TextlintMessage[]} messages + * @returns {TextlintMessage[]} + */ +export default function sortByLineColumn(messages: TextlintMessage[]) { + // sort by line and column + return messages.sort(function (a, b) { + const lineDiff = a.line - b.line; + if (lineDiff === 0) { + return a.column - b.column; + } else { + return lineDiff; + } + }); +} diff --git a/node_modules/@textlint/kernel/src/shared/rule-severity.ts b/node_modules/@textlint/kernel/src/shared/rule-severity.ts new file mode 100644 index 000000000..81e7b6179 --- /dev/null +++ b/node_modules/@textlint/kernel/src/shared/rule-severity.ts @@ -0,0 +1,40 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintRuleOptions, TextlintRuleSeverityLevel } from "@textlint/types"; +import { TextlintRuleSeverityLevelKeys } from "../context/TextlintRuleSeverityLevelKeys"; + +const isSeverityLevelValue = (type: any): type is TextlintRuleSeverityLevel => { + if (type === undefined) { + throw new Error(`Please set following value to severity: +"rule-key": { + "severity": "" +}`); + } + return true; +}; + +/** + * get severity level from ruleConfig. + * @param {Object|boolean|undefined} ruleConfig + * @returns {number} + */ +export function getSeverity(ruleConfig?: TextlintRuleOptions): TextlintRuleSeverityLevel { + if (ruleConfig === undefined) { + return TextlintRuleSeverityLevelKeys.error; + } + // rule: + if (typeof ruleConfig === "boolean") { + return ruleConfig ? TextlintRuleSeverityLevelKeys.error : TextlintRuleSeverityLevelKeys.none; + } + if (ruleConfig.severity) { + const severityValue = TextlintRuleSeverityLevelKeys[ruleConfig.severity]; + if (!isSeverityLevelValue(severityValue)) { + throw new Error(`Please set following value to severity: +"rule-key": { + "severity": "" +}`); + } + return severityValue; + } + return TextlintRuleSeverityLevelKeys.error; +} diff --git a/node_modules/@textlint/kernel/src/shared/type/MessageType.ts b/node_modules/@textlint/kernel/src/shared/type/MessageType.ts new file mode 100644 index 000000000..6eb5d1652 --- /dev/null +++ b/node_modules/@textlint/kernel/src/shared/type/MessageType.ts @@ -0,0 +1,11 @@ +/** + * TextLintMessage type + * @typedef {Object} MessageType + * @type {{lint: string, ignore: string}} + */ +export default { + // Linting(also include Fix) Message Type + lint: "lint", + // Ignoring Message Type + ignore: "ignore" +}; diff --git a/node_modules/@textlint/kernel/src/task/README.md b/node_modules/@textlint/kernel/src/task/README.md new file mode 100644 index 000000000..9135a35bf --- /dev/null +++ b/node_modules/@textlint/kernel/src/task/README.md @@ -0,0 +1,8 @@ +# CoreTask + +## What's does + +- Receive AST and rules +- Run linter/fixer of the rule and get *messages* +- Convert *messages* to `TextLintMessage`s +- emit TextLintMessage as "messages" event. \ No newline at end of file diff --git a/node_modules/@textlint/kernel/src/task/fixer-task.ts b/node_modules/@textlint/kernel/src/task/fixer-task.ts new file mode 100644 index 000000000..a9df9e61d --- /dev/null +++ b/node_modules/@textlint/kernel/src/task/fixer-task.ts @@ -0,0 +1,81 @@ +// LICENSE : MIT +"use strict"; +import CoreTask from "./textlint-core-task"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptors, TextlintFixableRuleDescriptor } from "../descriptor"; +import type { TextlintSourceCode } from "@textlint/types"; +import { getSeverity } from "../shared/rule-severity"; +import { TextlintFilterRuleContextImpl } from "../context/TextlintFilterRuleContextImpl"; +import { TextlintRuleContextImpl } from "../context/TextlintRuleContextImpl"; +import _debug from "debug"; + +const debug = _debug("textlint:TextLintCoreTask"); + +export interface TextLintCoreTaskArgs { + config: TextlintKernelConstructorOptions; + fixableRuleDescriptor: TextlintFixableRuleDescriptor; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; +} + +export default class TextLintCoreTask extends CoreTask { + config: TextlintKernelConstructorOptions; + fixableRuleDescriptor: TextlintFixableRuleDescriptor; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; + + constructor({ + config, + configBaseDir, + fixableRuleDescriptor, + filterRuleDescriptors, + sourceCode + }: TextLintCoreTaskArgs) { + super(); + this.config = config; + this.configBaseDir = configBaseDir; + this.fixableRuleDescriptor = fixableRuleDescriptor; + this.filterRuleDescriptors = filterRuleDescriptors; + this.sourceCode = sourceCode; + this._setupRules(); + } + + start() { + this.startTraverser(this.sourceCode); + } + + private _setupRules() { + // rule + const sourceCode = this.sourceCode; + const report = this.createReporter(sourceCode); + const ignoreReport = this.createShouldIgnore(); + // setup "rules" field by using a single fixerRule + debug("fixerRule", this.fixableRuleDescriptor); + const ruleContext = new TextlintRuleContextImpl({ + ruleId: this.fixableRuleDescriptor.id, + severityLevel: getSeverity(this.fixableRuleDescriptor.normalizedOptions), + sourceCode, + report, + configBaseDir: this.configBaseDir + }); + this.tryToAddListenRule( + this.fixableRuleDescriptor.fixer, + ruleContext, + this.fixableRuleDescriptor.normalizedOptions + ); + // setup "filters" field + debug("filterRules", this.filterRuleDescriptors); + this.filterRuleDescriptors.descriptors.forEach((filterRuleDescriptor) => { + const ruleContext = new TextlintFilterRuleContextImpl({ + ruleId: filterRuleDescriptor.id, + severityLevel: getSeverity(filterRuleDescriptor.normalizedOptions), + sourceCode, + ignoreReport, + configBaseDir: this.configBaseDir + }); + this.tryToAddListenRule(filterRuleDescriptor.filter, ruleContext, filterRuleDescriptor.normalizedOptions); + }); + } +} diff --git a/node_modules/@textlint/kernel/src/task/linter-task.ts b/node_modules/@textlint/kernel/src/task/linter-task.ts new file mode 100644 index 000000000..66cfa1f6a --- /dev/null +++ b/node_modules/@textlint/kernel/src/task/linter-task.ts @@ -0,0 +1,77 @@ +// LICENSE : MIT +"use strict"; +import CoreTask from "./textlint-core-task"; +import { TextlintKernelConstructorOptions } from "../textlint-kernel-interface"; +import { TextlintFilterRuleDescriptors, TextlintRuleDescriptors } from "../descriptor"; +import type { TextlintSourceCode } from "@textlint/types"; +import { getSeverity } from "../shared/rule-severity"; +import { TextlintRuleContextImpl } from "../context/TextlintRuleContextImpl"; +import { TextlintFilterRuleContextImpl } from "../context/TextlintFilterRuleContextImpl"; + +export interface TextLintCoreTaskArgs { + config: TextlintKernelConstructorOptions; + ruleDescriptors: TextlintRuleDescriptors; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; +} + +export default class TextLintCoreTask extends CoreTask { + config: TextlintKernelConstructorOptions; + ruleDescriptors: TextlintRuleDescriptors; + filterRuleDescriptors: TextlintFilterRuleDescriptors; + sourceCode: TextlintSourceCode; + configBaseDir?: string; + + constructor({ + config, + configBaseDir, + ruleDescriptors, + filterRuleDescriptors: filterRuleDescriptors, + sourceCode + }: TextLintCoreTaskArgs) { + super(); + this.config = config; + this.configBaseDir = configBaseDir; + this.ruleDescriptors = ruleDescriptors; + this.filterRuleDescriptors = filterRuleDescriptors; + this.sourceCode = sourceCode; + this._setupRules(); + } + + start() { + this.startTraverser(this.sourceCode); + } + + private _setupRules() { + // rule + const sourceCode = this.sourceCode; + const report = this.createReporter(sourceCode); + const ignoreReport = this.createShouldIgnore(); + // setup "rules" field + // filter duplicated rules for improving experience + // see https://github.com/textlint/textlint/issues/219 + this.ruleDescriptors.lintableDescriptors.forEach((ruleDescriptor) => { + const ruleOptions = ruleDescriptor.normalizedOptions; + const ruleContext = new TextlintRuleContextImpl({ + ruleId: ruleDescriptor.id, + severityLevel: getSeverity(ruleOptions), + sourceCode, + report, + configBaseDir: this.configBaseDir + }); + this.tryToAddListenRule(ruleDescriptor.linter, ruleContext, ruleOptions); + }); + // setup "filters" field + this.filterRuleDescriptors.descriptors.forEach((filterDescriptor) => { + const ruleContext = new TextlintFilterRuleContextImpl({ + ruleId: filterDescriptor.id, + sourceCode, + ignoreReport, + configBaseDir: this.configBaseDir, + severityLevel: getSeverity(filterDescriptor.normalizedOptions) + }); + this.tryToAddListenRule(filterDescriptor.filter, ruleContext, filterDescriptor.normalizedOptions); + }); + } +} diff --git a/node_modules/@textlint/kernel/src/task/promise-event-emitter.ts b/node_modules/@textlint/kernel/src/task/promise-event-emitter.ts new file mode 100644 index 000000000..6dd04239f --- /dev/null +++ b/node_modules/@textlint/kernel/src/task/promise-event-emitter.ts @@ -0,0 +1,32 @@ +// MIT © 2017 azu +// MIT © 2017 59naga +// https://github.com/59naga/carrack +"use strict"; +import { EventEmitter } from "events"; + +export class PromiseEventEmitter { + private events: EventEmitter; + + constructor() { + this.events = new EventEmitter(); + this.events.setMaxListeners(0); + } + + listenerCount(type: string | symbol): number { + return this.events.listenerCount(type); + } + + on(event: string, listener: (...args: any[]) => void) { + return this.events.on(event, listener); + } + + emit(event: string, ...args: Array): Promise> { + const promises: Array> = []; + + this.events.listeners(event).forEach((listener) => { + promises.push(listener(...args)); + }); + + return Promise.all(promises); + } +} diff --git a/node_modules/@textlint/kernel/src/task/task-runner.ts b/node_modules/@textlint/kernel/src/task/task-runner.ts new file mode 100644 index 000000000..9f2bdd043 --- /dev/null +++ b/node_modules/@textlint/kernel/src/task/task-runner.ts @@ -0,0 +1,31 @@ +// LICENSE : MIT +"use strict"; +import CoreTask, { + default as TextLintCoreTask, + IgnoreReportedMessage, + LintReportedMessage +} from "./textlint-core-task"; + +export default class TaskRunner { + /** + * Task and return promise + * @param {TextLintCoreTask} task + * @returns {Promise} + */ + static process(task: TextLintCoreTask): Promise> { + return new Promise((resolve, reject) => { + const messages: Array = []; + task.on(CoreTask.events.message, (message) => { + messages.push(message); + }); + task.on(CoreTask.events.error, (error) => { + reject(error); + }); + task.on(CoreTask.events.complete, () => { + task.removeAllListeners(); + resolve(messages); + }); + task.start(); + }); + } +} diff --git a/node_modules/@textlint/kernel/src/task/textlint-core-task.ts b/node_modules/@textlint/kernel/src/task/textlint-core-task.ts new file mode 100644 index 000000000..cf76346dd --- /dev/null +++ b/node_modules/@textlint/kernel/src/task/textlint-core-task.ts @@ -0,0 +1,243 @@ +// LICENSE : MIT +"use strict"; +import { TextlintRuleErrorImpl } from "../context/TextlintRuleErrorImpl"; +import { PromiseEventEmitter } from "./promise-event-emitter"; +import SourceLocation from "../core/source-location"; +import timing from "../util/timing"; +import MessageType from "../shared/type/MessageType"; +import { EventEmitter } from "events"; +import * as assert from "assert"; +import { AnyTxtNode, TxtParentNode } from "@textlint/ast-node-types"; +import type { + TextlintFilterRuleContext, + TextlintFilterRuleOptions, + TextlintFilterRuleReporter, + TextlintFilterRuleShouldIgnoreFunction, + TextlintFilterRuleShouldIgnoreFunctionArgs, + TextlintMessageFixCommand, + TextlintRuleContext, + TextlintRuleContextReportFunction, + TextlintRuleContextReportFunctionArgs, + TextlintRuleOptions, + TextlintRuleReporter, + TextlintSourceCode +} from "@textlint/types"; +import { normalizeTextlintKeyPath } from "@textlint/utils"; +import { TextlintRuleContextImpl } from "../context/TextlintRuleContextImpl"; +import _debug from "debug"; +import { Controller as TraverseController } from "@textlint/ast-traverse"; + +const traverseController = new TraverseController(); +const debug = _debug("textlint:core-task"); + +class RuleTypeEmitter extends PromiseEventEmitter {} + +export interface IgnoreReportedMessage { + ruleId: string; + type: typeof MessageType.ignore; + // location info + // TODO: compatible with TextLintMessage + // line: number; // start with 1 + // column: number;// start with 1 + // // indexed-location + // index: number;// start with 0 + range: [number, number]; + + ignoringRuleId: string; +} + +export interface LintReportedMessage { + type: typeof MessageType.lint; + ruleId: string; + message: string; + index: number; + // See https://github.com/textlint/textlint/blob/master/typing/textlint.d.ts + line: number; // start with 1(1-based line number) + column: number; // start with 1(1-based column number) + severity: number; // it's for compatible ESLint formatter + fix?: TextlintMessageFixCommand; +} + +/** + * CoreTask receive AST and prepare, traverse AST, emit nodeType event! + * You can observe task and receive "message" event that is TextLintMessage. + */ +export default abstract class TextLintCoreTask extends EventEmitter { + private ruleTypeEmitter: RuleTypeEmitter; + + static get events() { + return { + // receive start event + start: "start", + // receive message from each rules + message: "message", + // receive complete event + complete: "complete", + // receive error event + error: "error" + }; + } + + constructor() { + super(); + this.ruleTypeEmitter = new RuleTypeEmitter(); + } + + abstract start(): void; + + createShouldIgnore(): TextlintFilterRuleShouldIgnoreFunction { + const shouldIgnore = (args: TextlintFilterRuleShouldIgnoreFunctionArgs) => { + const { ruleId, range, optional } = args; + assert.ok( + typeof range[0] !== "undefined" && typeof range[1] !== "undefined" && range[0] >= 0 && range[1] >= 0, + "ignoreRange should have actual range: " + range + ); + // FIXME: should have index, loc + // should be compatible with LintReportedMessage? + const message: IgnoreReportedMessage = { + type: MessageType.ignore, + ruleId: ruleId, + range: range, + // ignoring target ruleId - default: filter all messages + // This ruleId should be normalized, because the user can report any value + ignoringRuleId: optional.ruleId ? normalizeTextlintKeyPath(optional.ruleId) : "*" + }; + this.emit(TextLintCoreTask.events.message, message); + }; + return shouldIgnore; + } + + createReporter(sourceCode: TextlintSourceCode): TextlintRuleContextReportFunction { + const sourceLocation = new SourceLocation(sourceCode); + /** + * push new RuleError to results + * @param {ReportMessage} reportArgs + */ + const reportFunction = (reportArgs: TextlintRuleContextReportFunctionArgs) => { + const { ruleId, severity, ruleError } = reportArgs; + debug("%s pushReport %s", ruleId, ruleError); + const { line, column, fix } = sourceLocation.adjust(reportArgs); + const index = sourceCode.positionToIndex({ line, column }); + // add TextLintMessage + const message: LintReportedMessage = { + type: MessageType.lint, + ruleId: ruleId, + message: ruleError.message, + index, + // See https://github.com/textlint/textlint/blob/master/typing/textlint.d.ts + line: line, // start with 1(1-based line number) + column: column + 1, // start with 1(1-based column number) + severity: severity, // it's for compatible ESLint formatter + fix: fix !== undefined ? fix : undefined + }; + if (!(ruleError instanceof TextlintRuleErrorImpl)) { + // FIXME: RuleReportedObject should be removed + // `error` is a any data. + const data = ruleError; + (message as any).data = data; + } + this.emit(TextLintCoreTask.events.message, message); + }; + return reportFunction; + } + + /** + * start process and emitting events. + * You can listen message by `task.on("message", message => {})` + * @param {SourceCode} sourceCode + */ + startTraverser(sourceCode: TextlintSourceCode) { + this.emit(TextLintCoreTask.events.start); + const promiseQueue: Array>> = []; + const ruleTypeEmitter = this.ruleTypeEmitter; + traverseController.traverse(sourceCode.ast as TxtParentNode, { + enter(node: AnyTxtNode, parent?: AnyTxtNode) { + const type = node.type; + Object.defineProperty(node, "parent", { value: parent }); + if (ruleTypeEmitter.listenerCount(type) > 0) { + const promise = ruleTypeEmitter.emit(type, node); + promiseQueue.push(promise); + } + }, + leave(node: AnyTxtNode) { + const type = `${node.type}:exit`; + if (ruleTypeEmitter.listenerCount(type) > 0) { + const promise = ruleTypeEmitter.emit(type, node); + promiseQueue.push(promise); + } + } + }); + Promise.all(promiseQueue) + .then(() => { + this.emit(TextLintCoreTask.events.complete); + }) + .catch((error) => { + this.emit(TextLintCoreTask.events.error, error); + }); + } + + /** + * try to get rule object + */ + tryToGetRuleObject( + ruleCreator: TextlintRuleReporter, + ruleContext: Readonly, + ruleOptions?: TextlintRuleOptions + ) { + try { + return ruleCreator(ruleContext, ruleOptions); + } catch (error) { + error.message = `Error while loading rule '${ruleContext.id}': ${error.message}`; + throw error; + } + } + + /** + * try to get filter rule object + */ + tryToGetFilterRuleObject( + ruleCreator: TextlintFilterRuleReporter, + ruleContext: Readonly, + ruleOptions?: TextlintFilterRuleOptions + ) { + try { + return ruleCreator(ruleContext, ruleOptions); + } catch (error) { + error.message = `Error while loading filter rule '${ruleContext.id}': ${error.message}`; + throw error; + } + } + + /** + * add all the node types as listeners of the rule + * @param {Function} ruleCreator + * @param {Readonly|Readonly} ruleContext + * @param {Object|boolean|undefined} ruleOptions + * @returns {Object} + */ + tryToAddListenRule( + ruleCreator: TextlintRuleReporter | TextlintFilterRuleReporter, + ruleContext: Readonly | Readonly, + ruleOptions?: TextlintRuleOptions | TextlintFilterRuleOptions + ): void { + const ruleObject = + ruleContext instanceof TextlintRuleContextImpl + ? this.tryToGetRuleObject( + ruleCreator as TextlintRuleReporter, + ruleContext as Readonly, + ruleOptions + ) + : this.tryToGetFilterRuleObject( + ruleCreator as TextlintFilterRuleReporter, + ruleContext as Readonly, + ruleOptions + ); + const types = Object.keys(ruleObject); + types.forEach((nodeType) => { + this.ruleTypeEmitter.on( + nodeType, + timing.enabled ? timing.time(ruleContext.id, ruleObject[nodeType] as Function) : ruleObject[nodeType]! + ); + }); + } +} diff --git a/node_modules/@textlint/kernel/src/textlint-kernel-interface.ts b/node_modules/@textlint/kernel/src/textlint-kernel-interface.ts new file mode 100644 index 000000000..ae4bea16c --- /dev/null +++ b/node_modules/@textlint/kernel/src/textlint-kernel-interface.ts @@ -0,0 +1,96 @@ +// rule config +import type { + TextlintFilterRuleOptions, + TextlintFilterRuleReporter, + TextlintPluginCreator, + TextlintPluginOptions, + TextlintRuleModule, + TextlintRuleOptions +} from "@textlint/types"; + +export interface TextlintKernelConstructorOptions { + /** + * Suppress messages of severity:warning and severity:info + */ + quiet?: boolean; +} + +// config +export interface TextlintConfigObject { + // rule directories path + rulePaths?: string[]; + // filter by file extensions + extensions?: string[]; + // formatter file name + // e.g.) stylish.js => set "stylish" + formatterName?: string; + // plugin package names + plugins?: string[]; + // base directory for loading {rule, config, plugin} modules + rulesBaseDirectory?: string; + // ".textlint" file path + configFile?: string; + // disabled rule package names + // always should start with empty + disabledRules?: string[]; + // preset package names + // e.g.) ["preset-foo"] + presets?: string[]; + // rules config object + rulesConfig?: Object; + /** + * quite options + */ + quiet?: boolean; +} + +export interface TextlintKernelPlugin { + // plugin name as key + // this key should be normalized + pluginId: string; + // plugin module + // For example, `plugin: require("@textlint/textlint-plugin-markdown")` + plugin: TextlintPluginCreator; + // plugin options + options?: TextlintPluginOptions | boolean; +} + +export interface TextlintKernelRule { + // rule name as key + // this key should be normalized + ruleId: string; + // rule module + // For example, `rule: require("textlint-rule-example")` + rule: TextlintRuleModule; + // rule options + // Often rule option is written in .textlintrc + options?: TextlintRuleOptions | boolean; +} + +export interface TextlintKernelFilterRule { + // filter rule name as key + // this key should be normalized + ruleId: string; + // filter rule module instance + rule: TextlintFilterRuleReporter; + // filter rule options + // Often rule option is written in .textlintrc + options?: TextlintFilterRuleOptions | boolean; +} + +export interface TextlintKernelOptions { + // file type + // For example) .md + ext: string; + // file path + filePath?: string; + // plugins + plugins?: TextlintKernelPlugin[]; + // rules + rules?: TextlintKernelRule[]; + // filterRules + filterRules?: TextlintKernelFilterRule[]; + // config base directory + // It is a value of context.getConfigBaseDir. + configBaseDir?: string; +} diff --git a/node_modules/@textlint/kernel/src/textlint-kernel.ts b/node_modules/@textlint/kernel/src/textlint-kernel.ts new file mode 100644 index 000000000..e265ca8d1 --- /dev/null +++ b/node_modules/@textlint/kernel/src/textlint-kernel.ts @@ -0,0 +1,223 @@ +// MIT © 2017- azu +import * as assert from "assert"; +// sequence +import FixerProcessor from "./fixer/fixer-processor"; +// parallel +import LinterProcessor from "./linter/linter-processor"; +// message process manager +import MessageProcessManager from "./messages/MessageProcessManager"; +import filterIgnoredProcess from "./messages/filter-ignored-process"; +import filterDuplicatedProcess from "./messages/filter-duplicated-process"; +import filterSeverityProcess from "./messages/filter-severity-process"; +import sortMessageProcess from "./messages/sort-messages-process"; +import { TextlintKernelConstructorOptions, TextlintKernelOptions } from "./textlint-kernel-interface"; +import type { TextlintFixResult, TextlintResult } from "@textlint/types"; +import { TextlintKernelDescriptor } from "./descriptor"; +import { TextlintSourceCodeImpl } from "./context/TextlintSourceCodeImpl"; +import { isTxtAST } from "@textlint/ast-tester"; +import _debug from "debug"; + +const debug = _debug("textlint:kernel"); + +/** + * add fileName to trailing of error message + * @param {string|undefined} fileName + * @param {string} message + * @returns {string} + */ +function addingAtFileNameToError(fileName: string | undefined, message: string) { + if (!fileName) { + return message; + } + return `${message} +at ${fileName}`; +} + +/** + * TextlintKernel is core logic written by pure JavaScript. + * + * Pass + * + * - config + * - plugins + * - rules + * - filterRules + * - messageProcessor + * + */ +export class TextlintKernel { + private readonly config: TextlintKernelConstructorOptions; + private readonly messageProcessManager: MessageProcessManager; + + /** + * @param config + */ + constructor(config: TextlintKernelConstructorOptions = {}) { + // this.config often is undefined. + this.config = config; + // Initialize Message Processor + // Now, It it built-in process only + // filter `shouldIgnore()` results + this.messageProcessManager = new MessageProcessManager([filterIgnoredProcess]); + // filter duplicated messages + this.messageProcessManager.add(filterDuplicatedProcess); + // filter by severity + this.messageProcessManager.add(filterSeverityProcess(this.config)); + this.messageProcessManager.add(sortMessageProcess); + } + + /** + * lint text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text + * @param {Object} options linting options + * @returns {Promise.} + */ + lintText(text: string, options: TextlintKernelOptions): Promise { + return Promise.resolve().then(() => { + const descriptor = new TextlintKernelDescriptor({ + rules: options.rules || [], + filterRules: options.filterRules || [], + plugins: options.plugins || [] + }); + return this._parallelProcess({ + descriptor, + text, + options + }); + }); + } + + /** + * fix texts and return fix result object + * @param {string} text + * @param {Object} options lint options + * @returns {Promise.} + */ + fixText(text: string, options: TextlintKernelOptions): Promise { + return Promise.resolve().then(() => { + const descriptor = new TextlintKernelDescriptor({ + rules: options.rules || [], + filterRules: options.filterRules || [], + plugins: options.plugins || [] + }); + return this._sequenceProcess({ + descriptor, + options, + text + }); + }); + } + + /** + * process text in parallel for Rules and return {Promise.} + * In other word, parallel flow process. + * @param {*} processor + * @param {string} text + * @param {Object} options + * @returns {Promise.} + * @private + */ + private _parallelProcess({ + descriptor, + text, + options + }: { + descriptor: TextlintKernelDescriptor; + text: string; + options: TextlintKernelOptions; + }) { + const { ext, filePath, configBaseDir } = options; + const plugin = descriptor.findPluginDescriptorWithExt(ext); + debug("available extensions: %o", descriptor.availableExtensions); + if (plugin === undefined) { + throw new Error(`Not found available plugin for ${ext}`); + } + debug("use plugin: %s", plugin.id); + const processor = plugin.processor; + const { preProcess, postProcess } = processor.processor(ext); + assert.ok( + typeof preProcess === "function" && typeof postProcess === "function", + "processor should implements {preProcess, postProcess}" + ); + const preProcessResult = preProcess(text, filePath); + const isPluginReturnAnAST = isTxtAST(preProcessResult); + const textForAST = isPluginReturnAnAST ? text : preProcessResult.text; + const ast = isPluginReturnAnAST ? preProcessResult : preProcessResult.ast; + const sourceCode = new TextlintSourceCodeImpl({ + text: textForAST, + ast, + ext, + filePath + }); + const linterProcessor = new LinterProcessor(processor, this.messageProcessManager); + return linterProcessor + .process({ + config: this.config, + ruleDescriptors: descriptor.rule, + filterRuleDescriptors: descriptor.filterRule, + sourceCode, + configBaseDir + }) + .catch((error) => { + error.message = addingAtFileNameToError(filePath, error.message); + return Promise.reject(error); + }); + } + + /** + * process text in series for Rules and return {Promise.} + * In other word, sequence flow process. + * @param {*} processor + * @param {string} text + * @param {TextlintKernelOptions} options + * @returns {Promise.} + * @private + */ + private _sequenceProcess({ + descriptor, + text, + options + }: { + descriptor: TextlintKernelDescriptor; + text: string; + options: TextlintKernelOptions; + }): Promise { + const { ext, filePath, configBaseDir } = options; + const plugin = descriptor.findPluginDescriptorWithExt(ext); + debug("available extensions: %o", descriptor.availableExtensions); + if (plugin === undefined) { + throw new Error(`Not found available plugin for ${ext}`); + } + debug("use plugin: %s", plugin.id); + const processor = plugin.processor; + const { preProcess, postProcess } = processor.processor(ext); + assert.ok( + typeof preProcess === "function" && typeof postProcess === "function", + "processor should implements {preProcess, postProcess}" + ); + const preProcessResult = preProcess(text, filePath); + const isPluginReturnAnAST = isTxtAST(preProcessResult); + const textForAST = isPluginReturnAnAST ? text : preProcessResult.text; + const ast = isPluginReturnAnAST ? preProcessResult : preProcessResult.ast; + const sourceCode = new TextlintSourceCodeImpl({ + text: textForAST, + ast, + ext, + filePath + }); + const fixerProcessor = new FixerProcessor(processor, this.messageProcessManager); + return fixerProcessor + .process({ + config: this.config, + ruleDescriptors: descriptor.rule, + filterRules: descriptor.filterRule, + sourceCode, + configBaseDir + }) + .catch((error) => { + error.message = addingAtFileNameToError(filePath, error.message); + return Promise.reject(error); + }); + } +} diff --git a/node_modules/@textlint/kernel/src/util/logger.ts b/node_modules/@textlint/kernel/src/util/logger.ts new file mode 100644 index 000000000..020311365 --- /dev/null +++ b/node_modules/@textlint/kernel/src/util/logger.ts @@ -0,0 +1,25 @@ +// LICENSE : MIT +"use strict"; + +/* eslint-disable no-console */ + +/** + * Logger Utils class + * Use this instead of `console.log` + * Main purpose for helping linting. + */ +export default class Logger { + static log(...message: Array) { + console.log(...message); + } + + static warn(...message: Array) { + console.warn(...message); + } + + static error(...message: Array) { + console.error(...message); + } +} + +/* eslint-enable no-console */ diff --git a/node_modules/@textlint/kernel/src/util/timing.ts b/node_modules/@textlint/kernel/src/util/timing.ts new file mode 100644 index 000000000..3b7d51b33 --- /dev/null +++ b/node_modules/@textlint/kernel/src/util/timing.ts @@ -0,0 +1,135 @@ +/** + * @fileoverview Tracks performance of individual rules. + * @author Brandon Mills + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; +import Logger from "./logger"; + +/* istanbul ignore next */ +/** + * Align the string to left + * @param {string} str string to evaluate + * @param {int} len length of the string + * @param {string} [ch] delimiter character + * @returns {string} modified string + * @private + */ +function alignLeft(str: string, len: number, ch?: string) { + return str + new Array(len - str.length + 1).join(ch || " "); +} + +/* istanbul ignore next */ +/** + * Align the string to right + * @param {string} str string to evaluate + * @param {int} len length of the string + * @param {string} [ch] delimiter character + * @returns {string} modified string + * @private + */ +function alignRight(str: string, len: number, ch?: string) { + return new Array(len - str.length + 1).join(ch || " ") + str; +} + +const enabled = Boolean(process.env.TIMING); + +const HEADERS = ["Rule", "Time (ms)", "Relative"]; +const ALIGN = [alignLeft, alignRight, alignRight]; + +/* istanbul ignore next */ +/** + * display the data + * @param {object} data Data object to be displayed + * @returns {string} modified string + * @private + */ +function display(data: any) { + let total = 0; + const rows = Object.keys(data) + .map(function (key) { + const time = data[key]; + total += time; + return [key, time] as any; + }) + .sort(function (a: [string, number], b: [string, number]) { + return b[1] - a[1]; + }) + .slice(0, 10); + + rows.forEach(function (row: any) { + row.push(((row[1] * 100) / total).toFixed(1) + "%"); + row[1] = row[1].toFixed(3); + }); + + rows.unshift(HEADERS); + + const widths: Array = []; + rows.forEach(function (row) { + for (let i = 0; i < row.length; i++) { + const n = row[i].length; + if (!widths[i] || n > widths[i]) { + widths[i] = n; + } + } + }); + + const table = rows.map(function (row) { + return row + .map(function (cell: any, index: number) { + return ALIGN[index](cell, widths[index]); + }) + .join(" | "); + }); + table.splice( + 1, + 0, + widths + .map(function (w, index) { + if (index !== 0 && index !== widths.length - 1) { + w++; + } + + return ALIGN[index](":", w + 1, "-"); + }) + .join("|") + ); + + Logger.log(table.join("\n")); +} + +/* istanbul ignore next */ +export default (function () { + const data = Object.create(null); + + /** + * Time the run + * @param {*} key key from the data object + * @param {Function} fn function to be called + * @returns {Function} function to be executed + * @private + */ + function time(key: string, fn: Function) { + if (typeof data[key] === "undefined") { + data[key] = 0; + } + + return function () { + let t = process.hrtime(); + fn.apply(null, Array.prototype.slice.call(arguments)); + t = process.hrtime(t); + data[key] += t[0] * 1e3 + t[1] / 1e6; + }; + } + + if (enabled) { + process.on("exit", function () { + display(data); + }); + } + + return { + time: time, + enabled: enabled + }; +})(); diff --git a/node_modules/@textlint/linter-formatter/CHANGELOG.md b/node_modules/@textlint/linter-formatter/CHANGELOG.md new file mode 100644 index 000000000..c59298cb1 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/CHANGELOG.md @@ -0,0 +1,608 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.3.5](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.3.4...@textlint/linter-formatter@3.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + +## [3.3.4](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.3.3...@textlint/linter-formatter@3.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.3.3](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.3.2...@textlint/linter-formatter@3.3.3) (2021-03-19) + + +### Bug Fixes + +* **linter-formatter:** escape XML control characters in ruleId ([#747](https://github.com/textlint/textlint/issues/747)) ([2d1cc87](https://github.com/textlint/textlint/commit/2d1cc87)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency chai to ^4.3.1 ([de13dce](https://github.com/textlint/textlint/commit/de13dce)) +* **deps:** update dependency chai to ^4.3.3 ([9eac118](https://github.com/textlint/textlint/commit/9eac118)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [3.3.2](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.3.1...@textlint/linter-formatter@3.3.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) +* **deps:** update dependency chai to ^4.3.0 ([13ac978](https://github.com/textlint/textlint/commit/13ac978)) + + + + + + +## [3.3.1](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.5...@textlint/linter-formatter@3.3.1) (2021-01-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [3.3.0](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.5...@textlint/linter-formatter@3.3.0) (2021-01-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [3.2.6](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.5...@textlint/linter-formatter@3.2.6) (2020-12-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [3.2.5](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.4...@textlint/linter-formatter@3.2.5) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [3.2.4](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.3...@textlint/linter-formatter@3.2.4) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [3.2.3](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.2...@textlint/linter-formatter@3.2.3) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [3.2.2](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.1...@textlint/linter-formatter@3.2.2) (2020-07-24) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.2.1](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.2.0...@textlint/linter-formatter@3.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [3.2.0](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.12...@textlint/linter-formatter@3.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* Drop string.prototype.padstart ([#680](https://github.com/textlint/textlint/issues/680)) ([8bb864a](https://github.com/textlint/textlint/commit/8bb864a)) +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [3.1.12](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.11...@textlint/linter-formatter@3.1.12) (2020-02-07) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.1.11](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.10...@textlint/linter-formatter@3.1.11) (2020-01-08) + + +### Bug Fixes + +* **linter-formatter:** add missing dependencies ([5501a42](https://github.com/textlint/textlint/commit/5501a42)) +* **linter-formatter:** fix --no-color support ([6cbfb1f](https://github.com/textlint/textlint/commit/6cbfb1f)) + + +### Chores + +* **deps:** update yarn.lock ([2f6fa9e](https://github.com/textlint/textlint/commit/2f6fa9e)) +* **linter-formatter:** move path ([98ff781](https://github.com/textlint/textlint/commit/98ff781)) + + +### Tests + +* **liner-formatter:** pass { color: false } ([fe3c2df](https://github.com/textlint/textlint/commit/fe3c2df)) + + + + + + +## [3.1.10](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.8...@textlint/linter-formatter@3.1.10) (2020-01-07) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.1.9](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.8...@textlint/linter-formatter@3.1.9) (2019-11-03) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.1.8](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.7...@textlint/linter-formatter@3.1.8) (2019-10-14) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.1.7](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.5...@textlint/linter-formatter@3.1.7) (2019-07-20) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) +* use [@textlint](https://github.com/textlint)/module-interop instead of interop-require ([10d34a6](https://github.com/textlint/textlint/commit/10d34a6)) + + + + + + +## [3.1.6](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.5...@textlint/linter-formatter@3.1.6) (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## [3.1.5](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.4...@textlint/linter-formatter@3.1.5) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [3.1.4](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.3...@textlint/linter-formatter@3.1.4) (2019-04-30) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.1.3](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.2...@textlint/linter-formatter@3.1.3) (2019-02-10) + + +### Bug Fixes + +* **textlint:** add reasonable debug log ([3931810](https://github.com/textlint/textlint/commit/3931810)) + + + + + + +## [3.1.2](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.1...@textlint/linter-formatter@3.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +## [3.1.1](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.1.0...@textlint/linter-formatter@3.1.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/linter-formatter + + + + + + +# [3.1.0](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.9...@textlint/linter-formatter@3.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) +* **formatter:** revert unnecessary changes ([70bef1e](https://github.com/textlint/textlint/commit/70bef1e)) + + +### Code Refactoring + +* **linter-formatter:** use [@textlint](https://github.com/textlint)/types instead of [@textlint](https://github.com/textlint)/kernel ([09cc67f](https://github.com/textlint/textlint/commit/09cc67f)) +* **types:** move type definition for rule to [@textlint](https://github.com/textlint)/types ([9be6e16](https://github.com/textlint/textlint/commit/9be6e16)) + + +### Styles + +* **eslint:** apply eslint to all files ([6a9573f](https://github.com/textlint/textlint/commit/6a9573f)) + + + + + +## [3.0.9](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.8...@textlint/linter-formatter@3.0.9) (2018-12-24) + + + + +**Note:** Version bump only for package @textlint/linter-formatter + + +## [3.0.8](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.7...@textlint/linter-formatter@3.0.8) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) +* **linter-formatter:** increase timeout ([2dd5663](https://github.com/textlint/textlint/commit/2dd5663)) + + +### Code Refactoring + +* **kernel:** separate linter and fixer descriptor ([b5bc8bd](https://github.com/textlint/textlint/commit/b5bc8bd)) + + + + + +## [3.0.7](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.6...@textlint/linter-formatter@3.0.7) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/linter-formatter + + +## [3.0.6](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.5...@textlint/linter-formatter@3.0.6) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/linter-formatter + + +## [3.0.5](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.4...@textlint/linter-formatter@3.0.5) (2018-03-25) + + +### Chores + +* **test:** use `ts-node-test-register` for TypeScript testing ([be746d8](https://github.com/textlint/textlint/commit/be746d8)), closes [#451](https://github.com/textlint/textlint/issues/451) + + + + + +## [3.0.4](https://github.com/textlint/textlint/compare/@textlint/linter-formatter@3.0.3...@textlint/linter-formatter@3.0.4) (2018-01-27) + + + + +**Note:** Version bump only for package @textlint/linter-formatter + + +## 3.0.3 (2018-01-18) + + +### Bug Fixes + +* **linter-formatter:** add `publishConfig` ([9f54a5a](https://github.com/textlint/textlint/commit/9f54a5a)) + + + + + +## [3.0.2](https://github.com/textlint/textlint/compare/textlint-formatter@3.0.1...textlint-formatter@3.0.2) (2018-01-12) + + + + +**Note:** Version bump only for package textlint-formatter + + +# [3.0.0](https://github.com/textlint/textlint/compare/textlint-formatter@2.0.0...textlint-formatter@3.0.0) (2017-12-25) + + +### Bug Fixes + +* **textlint-formatter:** define `TextLintFormatterOption` interface ([31146c7](https://github.com/textlint/textlint/commit/31146c7)) +* **textlint-formatter:** run all tests ([6d507c2](https://github.com/textlint/textlint/commit/6d507c2)), closes [#402](https://github.com/textlint/textlint/issues/402) + + +### Documentation + +* **textlint-formatter:** Update API ([8f4901f](https://github.com/textlint/textlint/commit/8f4901f)) + + +### Features + +* **textlint-formatter:** add getFormatterList function ([25e1113](https://github.com/textlint/textlint/commit/25e1113)) +* **textlint-formatter:** add new option to cli ([30351a8](https://github.com/textlint/textlint/commit/30351a8)) + + +### BREAKING CHANGES + +* **textlint-formatter:** export `{ createFormatter }` instead of `{ default }` + + + + + +# [2.0.0](https://github.com/textlint/textlint/compare/textlint-formatter@2.0.0-next.1...textlint-formatter@2.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-formatter + + +# [2.0.0-next.1](https://github.com/textlint/textlint/compare/textlint-formatter@2.0.0-next.0...textlint-formatter@2.0.0-next.1) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-formatter + + +# 2.0.0-next.0 (2017-12-15) + + +### Bug Fixes + +* **npm:** quick fix npm ([5b20137](https://github.com/textlint/textlint/commit/5b20137)) +* **npm:** resolve issue ([d214c1c](https://github.com/textlint/textlint/commit/d214c1c)) +* **options:** fix to use `color` ([9809df4](https://github.com/textlint/textlint/commit/9809df4)) +* **pretty-error:** fix `file:line:column` ([3bcb06c](https://github.com/textlint/textlint/commit/3bcb06c)) +* **pretty-error:** fix export function ([e0d568b](https://github.com/textlint/textlint/commit/e0d568b)) +* **pretty-error:** fix FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed ([dd6418d](https://github.com/textlint/textlint/commit/dd6418d)) +* **pretty-error:** fix position of column indicator ([d99b222](https://github.com/textlint/textlint/commit/d99b222)) +* **pretty-error:** remove empty line ([34fc250](https://github.com/textlint/textlint/commit/34fc250)) +* **stylish:** align table cells taking unicode chars into account ([e757c5b](https://github.com/textlint/textlint/commit/e757c5b)) +* **stylish:** narrow the width of error message when it has line breaks ([7c1aa0a](https://github.com/textlint/textlint/commit/7c1aa0a)) +* **test:** column number start with 1 ([a377817](https://github.com/textlint/textlint/commit/a377817)) +* **test:** fix pretty-errro test ([7e50453](https://github.com/textlint/textlint/commit/7e50453)) +* **textlint-formatter:** unignore lib/ ([#360](https://github.com/textlint/textlint/issues/360)) ([59488d8](https://github.com/textlint/textlint/commit/59488d8)) + + +### Features + +* **cli:** add cli for textlint-formatter ([8de0c97](https://github.com/textlint/textlint/commit/8de0c97)) +* **formatter:** add json formatter ([5642c83](https://github.com/textlint/textlint/commit/5642c83)) +* **formatter:** update formatter and add tests ([6f7778d](https://github.com/textlint/textlint/commit/6f7778d)) +* **lib:** allow to specify package name ([c9828bc](https://github.com/textlint/textlint/commit/c9828bc)) +* **preety-error:** add total output ([8a02c88](https://github.com/textlint/textlint/commit/8a02c88)) +* **pretty-error:** export prettyError ([c2726ac](https://github.com/textlint/textlint/commit/c2726ac)) +* **pretty-error:** support East Asian Width problem ([8b28994](https://github.com/textlint/textlint/commit/8b28994)), closes [#2](https://github.com/textlint/textlint/issues/2) +* **pretty-error:** support no-color option ([614c1ea](https://github.com/textlint/textlint/commit/614c1ea)) +* **stylish:** add help to use fixer ([d0eadfc](https://github.com/textlint/textlint/commit/d0eadfc)) diff --git a/node_modules/@textlint/linter-formatter/LICENSE b/node_modules/@textlint/linter-formatter/LICENSE new file mode 100644 index 000000000..74113e362 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2015 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Include: + + ESLint + Copyright (c) 2013 Nicholas C. Zakas. All rights reserved. + https://github.com/eslint/eslint/blob/master/LICENSE diff --git a/node_modules/@textlint/linter-formatter/README.md b/node_modules/@textlint/linter-formatter/README.md new file mode 100644 index 000000000..6b479cbdb --- /dev/null +++ b/node_modules/@textlint/linter-formatter/README.md @@ -0,0 +1,80 @@ +# @textlint/linter-formatter + +[textlint](https://github.com/textlint/textlint "textlint/textlint") output formatter. + +## Installation + +``` +npm install @textlint/linter-formatter +``` + +## Usage + +See [formatters/](src/formatters). + +Currently, you can use "stylish" (defaults), "checkstyle", "compact", "jslint-xml", "json", "junit", "pretty-error", "table", "tap", and "unix". + +```js +const createFormatter = require("@textlint/linter-formatter").createFormatter; +const formatter = createFormatter({ + formatterName: "stylish" +}); +const output = formatter([ + { + filePath: "./README.md", + messages: [ + { + ruleId: "semi", + line: 1, + column: 23, + message: "Expected a semicolon." + } + ] + } +]); +console.log(output); +/* +./README.md + 1:23 warning Expected a semicolon semi + +✖ 1 problem (0 errors, 1 warning) +*/ +``` + + +## API + +```typescript +export declare type FormatterConfig = { + color?: boolean; + formatterName: string; +}; +export declare function createFormatter(formatterConfig: FormatterConfig): (results: TextlintResult[]) => string; +export interface FormatterDetail { + name: string; +} +export declare function getFormatterList(): FormatterDetail[]; +``` + +## CLI + +``` +$ textlint -f json README.md --rule no-todo | textlint-formatter -f pretty-error --stdin +``` + +## Other formatter + +- [azu/textlint-formatter-codecov: textlint formatter for codecov json.](https://github.com/azu/textlint-formatter-codecov) +- [azu/textlint-formatter-lcov: textlint formatter for lcov format](https://github.com/azu/textlint-formatter-lcov) + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/@textlint/linter-formatter/module/FormatterOptions.d.ts b/node_modules/@textlint/linter-formatter/module/FormatterOptions.d.ts new file mode 100644 index 000000000..f8df6564b --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/FormatterOptions.d.ts @@ -0,0 +1,3 @@ +export interface FormatterOptions { + color?: boolean; +} diff --git a/node_modules/@textlint/linter-formatter/module/FormatterOptions.js b/node_modules/@textlint/linter-formatter/module/FormatterOptions.js new file mode 100644 index 000000000..252dc289d --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/FormatterOptions.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=FormatterOptions.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/FormatterOptions.js.map b/node_modules/@textlint/linter-formatter/module/FormatterOptions.js.map new file mode 100644 index 000000000..2ec06bf6f --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/FormatterOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FormatterOptions.js","sourceRoot":"","sources":["../src/FormatterOptions.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/cli.d.ts b/node_modules/@textlint/linter-formatter/module/cli.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/cli.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@textlint/linter-formatter/module/cli.js b/node_modules/@textlint/linter-formatter/module/cli.js new file mode 100644 index 000000000..92a3de9b3 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/cli.js @@ -0,0 +1,74 @@ +// LICENSE : MIT +"use strict"; +import * as fs from "fs"; +import { createFormatter, getFormatterList } from "./index"; +module.exports = function run(argv, text) { + return new Promise(function (resolve) { + var format; + var optionator = require("optionator")({ + prepend: "Usage: textlint-formatter [options]", + options: [ + { + option: "help", + alias: "h", + type: "Boolean", + description: "displays help" + }, + { + option: "formatter", + alias: "f", + type: "String", + description: "formatter name", + example: "textlint -f json README.md | textlint-formatter -f pretty-error" + }, + { + option: "list", + alias: "l", + type: "Boolean", + description: "print available formatters" + }, + { + option: "stdin", + type: "Boolean", + default: "false", + description: "Format text provided on ." + } + ] + }); + var options = optionator.parseArgv(argv); + var files = options._; + if (options.list) { + return resolve("Available formatters:\n" + + getFormatterList() + .map(function (formatter) { + return "- " + formatter.name; + }) + .join("\n")); + } + if (options.help || (!files.length && !text)) { + return resolve(optionator.generateHelp()); + } + var content = text ? text : fs.readFileSync(files[0], "utf-8"); + var jsonContent; + try { + jsonContent = JSON.parse(content); + } + catch (error) { + return new Error("Content should be json. " + error.message); + } + if (options.formatter) { + format = createFormatter({ + formatterName: options.formatter + }); + return resolve(format(jsonContent)); + } + else { + // default: use stylish + format = createFormatter({ + formatterName: "stylish" + }); + return resolve(format(jsonContent)); + } + }); +}; +//# sourceMappingURL=cli.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/cli.js.map b/node_modules/@textlint/linter-formatter/module/cli.js.map new file mode 100644 index 000000000..89000b103 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/cli.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,CAAC,OAAO,GAAG,SAAS,GAAG,CAAC,IAAc,EAAE,IAAY;IACtD,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO;QAChC,IAAI,MAAM,CAAC;QACX,IAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;YACrC,OAAO,EAAE,qCAAqC;YAC9C,OAAO,EAAE;gBACL;oBACI,MAAM,EAAE,MAAM;oBACd,KAAK,EAAE,GAAG;oBACV,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,eAAe;iBAC/B;gBACD;oBACI,MAAM,EAAE,WAAW;oBACnB,KAAK,EAAE,GAAG;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gBAAgB;oBAC7B,OAAO,EAAE,iEAAiE;iBAC7E;gBACD;oBACI,MAAM,EAAE,MAAM;oBACd,KAAK,EAAE,GAAG;oBACV,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,4BAA4B;iBAC5C;gBACD;oBACI,MAAM,EAAE,OAAO;oBACf,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,OAAO;oBAChB,WAAW,EAAE,kCAAkC;iBAClD;aACJ;SACJ,CAAC,CAAC;QACH,IAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;QACxB,IAAI,OAAO,CAAC,IAAI,EAAE;YACd,OAAO,OAAO,CACV,yBAAyB;gBACrB,gBAAgB,EAAE;qBACb,GAAG,CAAC,UAAC,SAA2B;oBAC7B,OAAO,OAAK,SAAS,CAAC,IAAM,CAAC;gBACjC,CAAC,CAAC;qBACD,IAAI,CAAC,IAAI,CAAC,CACtB,CAAC;SACL;QACD,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,OAAO,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;SAC7C;QACD,IAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,WAAW,CAAC;QAChB,IAAI;YACA,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAI,KAAK,CAAC,0BAA0B,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;SAChE;QACD,IAAI,OAAO,CAAC,SAAS,EAAE;YACnB,MAAM,GAAG,eAAe,CAAC;gBACrB,aAAa,EAAE,OAAO,CAAC,SAAS;aACnC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;SACvC;aAAM;YACH,uBAAuB;YACvB,MAAM,GAAG,eAAe,CAAC;gBACrB,aAAa,EAAE,SAAS;aAC3B,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;SACvC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.d.ts new file mode 100644 index 000000000..fe2d8e987 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.d.ts @@ -0,0 +1,7 @@ +/** + * @fileoverview CheckStyle XML reporter + * @author Ian Christian Myers + */ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.js b/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.js new file mode 100644 index 000000000..bf73b1f91 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.js @@ -0,0 +1,82 @@ +/** + * @fileoverview CheckStyle XML reporter + * @author Ian Christian Myers + */ +"use strict"; +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ +/** + * Returns the severity of warning or error + * @param {object} message message object to examine + * @returns {string} severity level + * @private + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } + else { + return "warning"; + } +} +/** + * Returns the escaped value for a character + * @param {string} s string to examine + * @returns {string} severity level + * @private + */ +function xmlEscape(s) { + return ("" + s).replace(/[<>&"']/g, function (c) { + switch (c) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case '"': + return """; + case "'": + return "'"; + default: + throw new Error("unreachable"); + } + }); +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results) { + var output = ""; + output += ''; + output += ''; + results.forEach(function (result) { + var messages = result.messages; + output += ''; + messages.forEach(function (message) { + output += + ''; + }); + output += ""; + }); + output += ""; + return output; +} +export default formatter; +//# sourceMappingURL=checkstyle.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.js.map b/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.js.map new file mode 100644 index 000000000..a99364469 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/checkstyle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checkstyle.js","sourceRoot":"","sources":["../../src/formatters/checkstyle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,CAAC;AAGb,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;;GAKG;AACH,SAAS,cAAc,CAAC,OAAY;IAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzC,OAAO,OAAO,CAAC;KAClB;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,CAAM;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC;QAC3C,QAAQ,CAAC,EAAE;YACP,KAAK,GAAG;gBACJ,OAAO,MAAM,CAAC;YAClB,KAAK,GAAG;gBACJ,OAAO,MAAM,CAAC;YAClB,KAAK,GAAG;gBACJ,OAAO,OAAO,CAAC;YACnB,KAAK,GAAG;gBACJ,OAAO,QAAQ,CAAC;YACpB,KAAK,GAAG;gBACJ,OAAO,QAAQ,CAAC;YACpB;gBACI,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;SACtC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB;IACxC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,IAAI,wCAAwC,CAAC;IACnD,MAAM,IAAI,4BAA4B,CAAC;IAEvC,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEjC,MAAM,IAAI,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;QAE7D,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;YAC9B,MAAM;gBACF,eAAe;oBACf,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;oBACvB,IAAI;oBACJ,UAAU;oBACV,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;oBACzB,IAAI;oBACJ,YAAY;oBACZ,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;oBAClC,IAAI;oBACJ,WAAW;oBACX,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;oBAC1B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC9D,IAAI;oBACJ,UAAU;oBACV,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACnE,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,SAAS,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,eAAe,CAAC;IAE1B,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/compact.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/compact.d.ts new file mode 100644 index 000000000..12de1e08f --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/compact.d.ts @@ -0,0 +1,7 @@ +/** + * @fileoverview Compact reporter + * @author Nicholas C. Zakas + */ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/compact.js b/node_modules/@textlint/linter-formatter/module/formatters/compact.js new file mode 100644 index 000000000..77b9dea51 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/compact.js @@ -0,0 +1,41 @@ +/** + * @fileoverview Compact reporter + * @author Nicholas C. Zakas + */ +"use strict"; +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + else { + return "Warning"; + } +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results) { + var output = "", total = 0; + results.forEach(function (result) { + var messages = result.messages; + total += messages.length; + messages.forEach(function (message) { + output += result.filePath + ": "; + output += "line " + (message.line || 0); + output += ", col " + (message.column || 0); + output += ", " + getMessageType(message); + output += " - " + message.message; + output += message.ruleId ? " (" + message.ruleId + ")" : ""; + output += "\n"; + }); + }); + if (total > 0) { + output += "\n" + total + " problem" + (total !== 1 ? "s" : ""); + } + return output; +} +export default formatter; +//# sourceMappingURL=compact.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/compact.js.map b/node_modules/@textlint/linter-formatter/module/formatters/compact.js.map new file mode 100644 index 000000000..1b3d10715 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/compact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/formatters/compact.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,CAAC;AAGb,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,cAAc,CAAC,OAAY;IAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzC,OAAO,OAAO,CAAC;KAClB;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB;IACxC,IAAI,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC;QAEzB,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;YAC9B,MAAM,IAAI,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;YACjC,MAAM,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,QAAQ,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;YAC3C,MAAM,IAAI,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;YAClC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,IAAI,IAAI,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAClE;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.d.ts new file mode 100644 index 000000000..53a8aed5e --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.d.ts @@ -0,0 +1,3 @@ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.js b/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.js new file mode 100644 index 000000000..5fadb7afc --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.js @@ -0,0 +1,39 @@ +/** + * @fileoverview JSLint XML reporter + * @author Ian Christian Myers + */ +"use strict"; +var lodash = require("lodash"); +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results) { + var output = ""; + output += ''; + output += ""; + results.forEach(function (result) { + var messages = result.messages; + output += ''; + messages.forEach(function (message) { + output += + ''; + }); + output += ""; + }); + output += ""; + return output; +} +export default formatter; +//# sourceMappingURL=jslint-xml.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.js.map b/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.js.map new file mode 100644 index 000000000..16079a7a8 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/jslint-xml.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jslint-xml.js","sourceRoot":"","sources":["../../src/formatters/jslint-xml.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,CAAC;AAIb,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB;IACxC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,IAAI,wCAAwC,CAAC;IACnD,MAAM,IAAI,UAAU,CAAC;IAErB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAE/B,MAAM,IAAI,cAAc,GAAG,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;QAElD,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;YAC9B,MAAM;gBACF,eAAe;oBACf,OAAO,CAAC,IAAI;oBACZ,IAAI;oBACJ,QAAQ;oBACR,OAAO,CAAC,MAAM;oBACd,IAAI;oBACJ,wCAAwC;oBACxC,uDAAuD;oBACvD,cAAc;oBACd,UAAU;oBACV,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;oBACpC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;oBACnD,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,SAAS,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,WAAW,CAAC;IAEtB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/json.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/json.d.ts new file mode 100644 index 000000000..53a8aed5e --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/json.d.ts @@ -0,0 +1,3 @@ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/json.js b/node_modules/@textlint/linter-formatter/module/formatters/json.js new file mode 100644 index 000000000..c8d003005 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/json.js @@ -0,0 +1,7 @@ +// LICENSE : MIT +"use strict"; +function formatter(results) { + return JSON.stringify(results); +} +export default formatter; +//# sourceMappingURL=json.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/json.js.map b/node_modules/@textlint/linter-formatter/module/formatters/json.js.map new file mode 100644 index 000000000..2111c04ec --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/json.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,SAAS,SAAS,CAAC,OAAyB;IACxC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/junit.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/junit.d.ts new file mode 100644 index 000000000..53a8aed5e --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/junit.d.ts @@ -0,0 +1,3 @@ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/junit.js b/node_modules/@textlint/linter-formatter/module/formatters/junit.js new file mode 100644 index 000000000..34aea737b --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/junit.js @@ -0,0 +1,58 @@ +/** + * @fileoverview jUnit Reporter + * @author Jamund Ferguson + */ +"use strict"; +var lodash = require("lodash"); +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + else { + return "Warning"; + } +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results) { + var output = ""; + output += '\n'; + output += "\n"; + results.forEach(function (result) { + var messages = result.messages; + if (messages.length) { + output += + '\n'; + } + messages.forEach(function (message) { + var type = message.fatal ? "error" : "failure"; + output += ''; + output += "<" + type + ' message="' + lodash.escape(message.message || "") + '">'; + output += ""; + output += ""; + output += "\n"; + }); + if (messages.length) { + output += "\n"; + } + }); + output += "\n"; + return output; +} +export default formatter; +//# sourceMappingURL=junit.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/junit.js.map b/node_modules/@textlint/linter-formatter/module/formatters/junit.js.map new file mode 100644 index 000000000..c84cdb490 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/junit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"junit.js","sourceRoot":"","sources":["../../src/formatters/junit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,CAAC;AAGb,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,cAAc,CAAC,OAAY;IAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzC,OAAO,OAAO,CAAC;KAClB;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB;IACxC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,IAAI,0CAA0C,CAAC;IACrD,MAAM,IAAI,gBAAgB,CAAC;IAE3B,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEjC,IAAI,QAAQ,CAAC,MAAM,EAAE;YACjB,MAAM;gBACF,kDAAkD;oBAClD,QAAQ,CAAC,MAAM;oBACf,YAAY;oBACZ,QAAQ,CAAC,MAAM;oBACf,UAAU;oBACV,MAAM,CAAC,QAAQ;oBACf,MAAM,CAAC;SACd;QAED,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;YAC9B,IAAM,IAAI,GAAI,OAAe,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1D,MAAM,IAAI,sCAAsC,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,CAAC;YACxF,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;YAClF,MAAM,IAAI,WAAW,CAAC;YACtB,MAAM,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;YACnD,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;YACjE,MAAM,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YACvD,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC;YAChB,MAAM,IAAI,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC;YAC5B,MAAM,IAAI,eAAe,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,EAAE;YACjB,MAAM,IAAI,gBAAgB,CAAC;SAC9B;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,iBAAiB,CAAC;IAE5B,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.d.ts new file mode 100644 index 000000000..acd2bf50d --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.d.ts @@ -0,0 +1,19 @@ +import type { TextlintMessage, TextlintResult } from "@textlint/types"; +import { FormatterOptions } from "../FormatterOptions"; +/** + * + * @param {string} code + * @param {string} filePath + * @param {TextLintMessage} message + * @returns {*} + */ +declare function prettyError(code: string, filePath: string, message: TextlintMessage): any; +/** + * + * @param {TextLintResult[]} results + * @param {TextLintFormatterOption} options + * @returns {string} + */ +declare function formatter(results: TextlintResult[], options: FormatterOptions): any; +export default formatter; +export { prettyError }; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.js b/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.js new file mode 100644 index 000000000..ed847fde4 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.js @@ -0,0 +1,162 @@ +// LICENSE : MIT +// Original code is https://github.com/azer/prettify-error +// Author : azer +"use strict"; +var format = require("@azu/format-text"); +var chalk = require("chalk"); +var style = require("@azu/style-format"); +var stripAnsi = require("strip-ansi"); +var pluralize = require("pluralize"); +// width is 2 +var widthOfString = require("string-width"); +// color set +var summaryColor = "yellow"; +var greenColor = "green"; +var template = style("{grey}{ruleId}: {red}{title}{reset}\n" + + "{grey}{filename}{reset}\n" + + " {red}{paddingForLineNo} {v}{reset}\n" + + " {grey}{previousLineNo}. {previousLine}{reset}\n" + + " {reset}{failingLineNo}. {failingLine}{reset}\n" + + " {grey}{nextLineNo}. {nextLine}{reset}\n" + + " {red}{paddingForLineNo} {^}{reset}\n" + + ""); +/** + * + * @param {string} code + * @param {TextLintMessage} message + * @returns {*} + */ +function failingCode(code, message) { + var result = []; + var lines = code.split("\n"); + var i = message.line - 3; + while (++i < message.line + 1) { + if (i + 1 !== message.line) { + result.push({ + line: message.line - (message.line - i - 1), + code: lines[i] + }); + continue; + } + result.push({ + line: message.line, + col: message.column, + code: lines[i], + failed: true + }); + } + return result; +} +function showColumn(codes, ch) { + var result = ""; + var codeObject = codes[1]; + var sliced = codeObject.code.slice(0, codeObject.col); + var width = widthOfString(sliced); + if (width <= 0) { + return ""; + } + var i = width - 1; + while (i--) { + result += " "; + } + return result + ch; +} +/** + * + * @param {string} code + * @param {string} filePath + * @param {TextLintMessage} message + * @returns {*} + */ +function prettyError(code, filePath, message) { + if (!code) { + return; + } + var parsed = failingCode(code, message); + var previousLineNo = String(parsed[0].line); + var failingLineNo = String(parsed[1].line); + var nextLineNo = String(parsed[2].line); + var linumlen = Math.max(previousLineNo.length, failingLineNo.length, nextLineNo.length); + return format(template, { + ruleId: message.ruleId, + title: message.message, + filename: filePath + ":" + message.line + ":" + message.column, + previousLine: parsed[0].code ? parsed[0].code : "", + previousLineNo: previousLineNo.padStart(linumlen), + previousColNo: parsed[0].col, + failingLine: parsed[1].code, + failingLineNo: failingLineNo.padStart(linumlen), + failingColNo: parsed[1].col, + nextLine: parsed[2].code ? parsed[2].code : "", + nextLineNo: nextLineNo.padStart(linumlen), + nextColNo: parsed[2].col, + paddingForLineNo: "".padStart(linumlen), + "^": showColumn(parsed, "^"), + v: showColumn(parsed, "v") + }); +} +/** + * + * @param {TextLintResult[]} results + * @param {TextLintFormatterOption} options + * @returns {string} + */ +function formatter(results, options) { + // default: true + var useColor = options.color !== undefined ? options.color : true; + var output = ""; + var total = 0; + var errors = 0; + var warnings = 0; + var totalFixable = 0; + results.forEach(function (result) { + var code = require("fs").readFileSync(result.filePath, "utf-8"); + var messages = result.messages; + if (messages.length === 0) { + return; + } + total += messages.length; + messages.forEach(function (message) { + // fixable + var fixableIcon = message.fix ? chalk[greenColor].bold("\u2713 ") : ""; + if (message.fix) { + totalFixable++; + } + if (message.fatal || message.severity === 2) { + errors++; + } + else { + warnings++; + } + var r = fixableIcon + prettyError(code, result.filePath, message); + if (r) { + output += r + "\n"; + } + }); + }); + if (total > 0) { + output += chalk[summaryColor].bold([ + "\u2716 ", + total, + pluralize(" problem", total), + " (", + errors, + pluralize(" error", errors), + ", ", + warnings, + pluralize(" warning", warnings), + ")\n" + ].join("")); + } + if (totalFixable > 0) { + output += chalk[greenColor].bold("✓ " + totalFixable + " fixable " + pluralize("problem", totalFixable) + ".\n"); + output += "Try to run: $ " + chalk.underline("textlint --fix [file]") + "\n"; + } + if (!useColor) { + return stripAnsi(output); + } + return output; +} +export default formatter; +export { prettyError }; +//# sourceMappingURL=pretty-error.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.js.map b/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.js.map new file mode 100644 index 000000000..181776073 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/pretty-error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pretty-error.js","sourceRoot":"","sources":["../../src/formatters/pretty-error.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAEhB,0DAA0D;AAC1D,gBAAgB;AAChB,YAAY,CAAC;AAIb,IAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC3C,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC,IAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACvC,aAAa;AACb,IAAM,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC9C,YAAY;AACZ,IAAI,YAAY,GAAG,QAAQ,CAAC;AAC5B,IAAI,UAAU,GAAG,OAAO,CAAC;AACzB,IAAM,QAAQ,GAAG,KAAK,CAClB,uCAAuC;IACnC,2BAA2B;IAC3B,2CAA2C;IAC3C,qDAAqD;IACrD,oDAAoD;IACpD,6CAA6C;IAC7C,2CAA2C;IAC3C,EAAE,CACT,CAAC;AAEF;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,OAAwB;IACvD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IACzB,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE;QAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE;YACxB,MAAM,CAAC,IAAI,CAAC;gBACR,IAAI,EAAE,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC3C,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;aACjB,CAAC,CAAC;YACH,SAAS;SACZ;QAED,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,GAAG,EAAE,OAAO,CAAC,MAAM;YACnB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACd,MAAM,EAAE,IAAI;SACf,CAAC,CAAC;KACN;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,EAAU;IACzC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAM,UAAU,GAAQ,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,IAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IACxD,IAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,KAAK,IAAI,CAAC,EAAE;QACZ,OAAO,EAAE,CAAC;KACb;IACD,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IAElB,OAAO,CAAC,EAAE,EAAE;QACR,MAAM,IAAI,GAAG,CAAC;KACjB;IAED,OAAO,MAAM,GAAG,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,QAAgB,EAAE,OAAwB;IACzE,IAAI,CAAC,IAAI,EAAE;QACP,OAAO;KACV;IACD,IAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,IAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1F,OAAO,MAAM,CAAC,QAAQ,EAAE;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,OAAO;QACtB,QAAQ,EAAE,QAAQ,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM;QAC9D,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAClD,cAAc,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACjD,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;QAC5B,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3B,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;QAC3B,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAC9C,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;QACxB,gBAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACvC,GAAG,EAAE,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;QAC5B,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;KAC7B,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,OAAyB,EAAE,OAAyB;IACnE,gBAAgB;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClE,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,OAAO;SACV;QACD,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;YAC9B,UAAU;YACV,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,YAAY,EAAE,CAAC;aAClB;YACD,IAAK,OAAe,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;gBAClD,MAAM,EAAE,CAAC;aACZ;iBAAM;gBACH,QAAQ,EAAE,CAAC;aACd;YACD,IAAM,CAAC,GAAG,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpE,IAAI,CAAC,EAAE;gBACH,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;aACtB;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAC9B;YACI,SAAS;YACT,KAAK;YACL,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC;YAC5B,IAAI;YACJ,MAAM;YACN,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC3B,IAAI;YACJ,QAAQ;YACR,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC;YAC/B,KAAK;SACR,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,CAAC;KACL;IAED,IAAI,YAAY,GAAG,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAC5B,IAAI,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CACjF,CAAC;QACF,MAAM,IAAI,gBAAgB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;KAChF;IAED,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;KAC5B;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/stylish.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/stylish.d.ts new file mode 100644 index 000000000..b5681bc63 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/stylish.d.ts @@ -0,0 +1,8 @@ +/** + * @fileoverview Stylish reporter + * @author Sindre Sorhus + */ +import type { TextlintResult } from "@textlint/types"; +import { FormatterOptions } from "../FormatterOptions"; +declare function formatter(results: TextlintResult[], options: FormatterOptions): any; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/stylish.js b/node_modules/@textlint/linter-formatter/module/formatters/stylish.js new file mode 100644 index 000000000..ea9824bb7 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/stylish.js @@ -0,0 +1,109 @@ +/** + * @fileoverview Stylish reporter + * @author Sindre Sorhus + */ +"use strict"; +var chalk = require("chalk"); +var table = require("text-table"); +var widthOfString = require("string-width"); +var stripAnsi = require("strip-ansi"); +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {int} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return count === 1 ? word : word + "s"; +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results, options) { + // default: true + var useColor = options.color !== undefined ? options.color : true; + var output = "\n"; + var total = 0; + var totalFixable = 0; + var errors = 0; + var warnings = 0; + var summaryColor = "yellow"; + var greenColor = "green"; + results.forEach(function (result) { + var messages = result.messages; + if (messages.length === 0) { + return; + } + total += messages.length; + output += chalk.underline(result.filePath) + "\n"; + output += + table(messages.map(function (message) { + var messageType; + // fixable + var fixableIcon = message.fix ? chalk[greenColor].bold("\u2713 ") : ""; + if (message.fix) { + totalFixable++; + } + if (message.fatal || message.severity === 2) { + messageType = fixableIcon + chalk.red("error"); + summaryColor = "red"; + errors++; + } + else { + messageType = fixableIcon + chalk.yellow("warning"); + warnings++; + } + return [ + "", + message.line || 0, + message.column || 0, + messageType, + message.message.replace(/\.$/, ""), + chalk.gray(message.ruleId || "") + ]; + }), { + align: ["", "r", "l"], + stringLength: function (str) { + var lines = chalk.stripColor(str).split("\n"); + return Math.max.apply(null, lines.map(function (line) { + return widthOfString(line); + })); + } + }) + .split("\n") + .map(function (el) { + return el.replace(/(\d+)\s+(\d+)/, function (_, p1, p2) { + return chalk.gray(p1 + ":" + p2); + }); + }) + .join("\n") + "\n\n"; + }); + if (total > 0) { + output += chalk[summaryColor].bold([ + "\u2716 ", + total, + pluralize(" problem", total), + " (", + errors, + pluralize(" error", errors), + ", ", + warnings, + pluralize(" warning", warnings), + ")\n" + ].join("")); + } + if (totalFixable > 0) { + output += chalk[greenColor].bold("✓ " + totalFixable + " fixable " + pluralize("problem", totalFixable) + ".\n"); + output += "Try to run: $ " + chalk.underline("textlint --fix [file]") + "\n"; + } + var finalOutput = total > 0 ? output : ""; + if (!useColor) { + return stripAnsi(finalOutput); + } + return finalOutput; +} +export default formatter; +//# sourceMappingURL=stylish.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/stylish.js.map b/node_modules/@textlint/linter-formatter/module/formatters/stylish.js.map new file mode 100644 index 000000000..da89f1acf --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/stylish.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stylish.js","sourceRoot":"","sources":["../../src/formatters/stylish.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,CAAC;AAIb,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACpC,IAAM,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC9C,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa;IAC1C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;AAC3C,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB,EAAE,OAAyB;IACnE,gBAAgB;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpE,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,YAAY,GAAG,QAAQ,CAAC;IAC5B,IAAI,UAAU,GAAG,OAAO,CAAC;IAEzB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEjC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,OAAO;SACV;QAED,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;QAElD,MAAM;YACF,KAAK,CACD,QAAQ,CAAC,GAAG,CAAC,UAAU,OAAO;gBAC1B,IAAI,WAAW,CAAC;gBAChB,UAAU;gBACV,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzE,IAAI,OAAO,CAAC,GAAG,EAAE;oBACb,YAAY,EAAE,CAAC;iBAClB;gBACD,IAAK,OAAe,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;oBAClD,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBAC/C,YAAY,GAAG,KAAK,CAAC;oBACrB,MAAM,EAAE,CAAC;iBACZ;qBAAM;oBACH,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACpD,QAAQ,EAAE,CAAC;iBACd;gBAED,OAAO;oBACH,EAAE;oBACF,OAAO,CAAC,IAAI,IAAI,CAAC;oBACjB,OAAO,CAAC,MAAM,IAAI,CAAC;oBACnB,WAAW;oBACX,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;oBAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;iBACnC,CAAC;YACN,CAAC,CAAC,EACF;gBACI,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC;gBACrB,YAAY,EAAE,UAAU,GAAW;oBAC/B,IAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAChD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CACjB,IAAI,EACJ,KAAK,CAAC,GAAG,CAAC,UAAU,IAAY;wBAC5B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;oBAC/B,CAAC,CAAC,CACL,CAAC;gBACN,CAAC;aACJ,CACJ;iBACI,KAAK,CAAC,IAAI,CAAC;iBACX,GAAG,CAAC,UAAU,EAAU;gBACrB,OAAO,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE;oBAClD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC;gBACrC,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAC9B;YACI,SAAS;YACT,KAAK;YACL,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC;YAC5B,IAAI;YACJ,MAAM;YACN,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC3B,IAAI;YACJ,QAAQ;YACR,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC;YAC/B,KAAK;SACR,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,CAAC;KACL;IAED,IAAI,YAAY,GAAG,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAC5B,IAAI,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CACjF,CAAC;QACF,MAAM,IAAI,gBAAgB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;KAChF;IAED,IAAM,WAAW,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC;KACjC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/table.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/table.d.ts new file mode 100644 index 000000000..c29e9b039 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/table.d.ts @@ -0,0 +1,8 @@ +/** + * @fileoverview "table reporter. + * @author Gajus Kuizinas + * @copyright 2016 Gajus Kuizinas . All rights reserved. + */ +import { FormatterOptions } from "../FormatterOptions"; +declare function formatter(report: any, options: FormatterOptions): any; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/table.js b/node_modules/@textlint/linter-formatter/module/formatters/table.js new file mode 100644 index 000000000..f227bd327 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/table.js @@ -0,0 +1,130 @@ +/** + * @fileoverview "table reporter. + * @author Gajus Kuizinas + * @copyright 2016 Gajus Kuizinas . All rights reserved. + */ +"use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ +var chalk = require("chalk"); +var table = require("table").default; +var pluralize = require("pluralize"); +var stripAnsi = require("strip-ansi"); +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ +/** + * Draws text table. + * @param {Array} messages Error messages relating to a specific file. + * @returns {string} A text table. + */ +function drawTable(messages) { + var rows = []; + if (messages.length === 0) { + return ""; + } + rows.push([ + chalk.bold("Line"), + chalk.bold("Column"), + chalk.bold("Type"), + chalk.bold("Message"), + chalk.bold("Rule ID") + ]); + messages.forEach(function (message) { + var messageType; + if (message.fatal || message.severity === 2) { + messageType = chalk.red("error"); + } + else { + messageType = chalk.yellow("warning"); + } + rows.push([message.line || 0, message.column || 0, messageType, message.message, message.ruleId || ""]); + }); + var output = table(rows, { + columns: { + 0: { + width: 8, + wrapWord: true + }, + 1: { + width: 8, + wrapWord: true + }, + 2: { + width: 8, + wrapWord: true + }, + 3: { + paddingRight: 5, + width: 50, + wrapWord: true + }, + 4: { + width: 20, + wrapWord: true + } + }, + drawHorizontalLine: function (index) { + return index === 1; + } + }); + return output; +} +/** + * Draws a report (multiple tables). + * @param {Array} results Report results for every file. + * @returns {string} A column of text tables. + */ +function drawReport(results) { + var files; + files = results.map(function (result) { + if (!result.messages.length) { + return ""; + } + return "\n" + result.filePath + "\n\n" + drawTable(result.messages); + }); + files = files.filter(function (content) { + return content.trim(); + }); + return files.join(""); +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(report, options) { + // default: true + var useColor = options.color !== undefined ? options.color : true; + var output = ""; + var errorCount = 0; + var warningCount = 0; + report.forEach(function (fileReport) { + errorCount += fileReport.errorCount; + warningCount += fileReport.warningCount; + }); + if (errorCount || warningCount) { + output = drawReport(report); + } + output += + "\n" + + table([ + [chalk.red(pluralize("Error", errorCount, true))], + [chalk.yellow(pluralize("Warning", warningCount, true))] + ], { + columns: { + 0: { + width: 110, + wrapWord: true + } + }, + drawHorizontalLine: function () { + return true; + } + }); + if (!useColor) { + return stripAnsi(output); + } + return output; +} +export default formatter; +//# sourceMappingURL=table.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/table.js.map b/node_modules/@textlint/linter-formatter/module/formatters/table.js.map new file mode 100644 index 000000000..ac82e6b83 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/table.js.map @@ -0,0 +1 @@ +{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/formatters/table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;AAIb,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AACvC,IAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACvC,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;;;GAIG;AACH,SAAS,SAAS,CAAC,QAA2B;IAC1C,IAAI,IAAI,GAAQ,EAAE,CAAC;IAEnB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,EAAE,CAAC;KACb;IAED,IAAI,CAAC,IAAI,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;KACxB,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAwB;QAC/C,IAAI,WAAW,CAAC;QAEhB,IAAK,OAAe,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;YAClD,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACpC;aAAM;YACH,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACzC;QAED,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;IAEH,IAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE;QACvB,OAAO,EAAE;YACL,CAAC,EAAE;gBACC,KAAK,EAAE,CAAC;gBACR,QAAQ,EAAE,IAAI;aACjB;YACD,CAAC,EAAE;gBACC,KAAK,EAAE,CAAC;gBACR,QAAQ,EAAE,IAAI;aACjB;YACD,CAAC,EAAE;gBACC,KAAK,EAAE,CAAC;gBACR,QAAQ,EAAE,IAAI;aACjB;YACD,CAAC,EAAE;gBACC,YAAY,EAAE,CAAC;gBACf,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,IAAI;aACjB;YACD,CAAC,EAAE;gBACC,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,IAAI;aACjB;SACJ;QACD,kBAAkB,EAAE,UAAU,KAAa;YACvC,OAAO,KAAK,KAAK,CAAC,CAAC;QACvB,CAAC;KACJ,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,OAAY;IAC5B,IAAI,KAAK,CAAC;IAEV,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,MAAW;QACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,OAAO,EAAE,CAAC;SACb;QAED,OAAO,IAAI,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,OAAe;QAC1C,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,MAAW,EAAE,OAAyB;IACrD,gBAAgB;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,MAAM,CAAC,OAAO,CAAC,UAAU,UAAe;QACpC,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC;QACpC,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,IAAI,YAAY,EAAE;QAC5B,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;KAC/B;IAED,MAAM;QACF,IAAI;YACJ,KAAK,CACD;gBACI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;gBACjD,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;aAC3D,EACD;gBACI,OAAO,EAAE;oBACL,CAAC,EAAE;wBACC,KAAK,EAAE,GAAG;wBACV,QAAQ,EAAE,IAAI;qBACjB;iBACJ;gBACD,kBAAkB,EAAE;oBAChB,OAAO,IAAI,CAAC;gBAChB,CAAC;aACJ,CACJ,CAAC;IAEN,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;KAC5B;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/tap.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/tap.d.ts new file mode 100644 index 000000000..dc1c5bc70 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/tap.d.ts @@ -0,0 +1,7 @@ +/** + * @fileoverview TAP reporter + * @author Jonathan Kingston + */ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/tap.js b/node_modules/@textlint/linter-formatter/module/formatters/tap.js new file mode 100644 index 000000000..f071bbf56 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/tap.js @@ -0,0 +1,84 @@ +/** + * @fileoverview TAP reporter + * @author Jonathan Kingston + */ +"use strict"; +var yaml = require("js-yaml"); +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {object} message Individual error message provided by eslint + * @returns {String} Error level string + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } + else { + return "warning"; + } +} +/** + * Takes in a JavaScript object and outputs a TAP diagnostics string + * @param {object} diagnostic JavaScript object to be embedded as YAML into output. + * @returns {string} diagnostics string with YAML embedded - TAP version 13 compliant + */ +function outputDiagnostics(diagnostic) { + var prefix = " "; + var output = prefix + "---\n"; + output += + prefix + + yaml + .safeDump(diagnostic) + .split("\n") + .join("\n" + prefix); + output += "...\n"; + return output; +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results) { + var output = "TAP version 13\n1.." + results.length + "\n"; + results.forEach(function (result, id) { + var messages = result.messages; + var testResult = "ok"; + var diagnostics = {}; + if (messages.length > 0) { + testResult = "not ok"; + messages.forEach(function (message) { + var diagnostic = { + message: message.message, + severity: getMessageType(message), + data: { + line: message.line || 0, + column: message.column || 0, + ruleId: message.ruleId || "" + } + }; + // If we have multiple messages place them under a messages key + // The first error will be logged as message key + // This is to adhere to TAP 13 loosely defined specification of having a message key + if ("message" in diagnostics) { + if (typeof diagnostics.messages === "undefined") { + diagnostics.messages = []; + } + diagnostics.messages.push(diagnostic); + } + else { + diagnostics = diagnostic; + } + }); + } + output += testResult + " " + (id + 1) + " - " + result.filePath + "\n"; + // If we have an error include diagnostics + if (messages.length > 0) { + output += outputDiagnostics(diagnostics); + } + }); + return output; +} +export default formatter; +//# sourceMappingURL=tap.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/tap.js.map b/node_modules/@textlint/linter-formatter/module/formatters/tap.js.map new file mode 100644 index 000000000..d9851057d --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/tap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tap.js","sourceRoot":"","sources":["../../src/formatters/tap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,CAAC;AAGb,IAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAEhC,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAY;IAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzC,OAAO,OAAO,CAAC;KAClB;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,UAAe;IACtC,IAAM,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9B,MAAM;QACF,MAAM;YACN,IAAI;iBACC,QAAQ,CAAC,UAAU,CAAC;iBACpB,KAAK,CAAC,IAAI,CAAC;iBACX,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAC7B,MAAM,IAAI,OAAO,CAAC;IAClB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB;IACxC,IAAI,MAAM,GAAG,qBAAqB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAE3D,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM,EAAE,EAAE;QAChC,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,IAAI,UAAU,GAAG,IAAI,CAAC;QACtB,IAAI,WAAW,GAAQ,EAAE,CAAC;QAE1B,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,UAAU,GAAG,QAAQ,CAAC;YAEtB,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;gBAC9B,IAAM,UAAU,GAAG;oBACf,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC;oBACjC,IAAI,EAAE;wBACF,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC;wBACvB,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC;wBAC3B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;qBAC/B;iBACJ,CAAC;gBAEF,+DAA+D;gBAC/D,gDAAgD;gBAChD,oFAAoF;gBACpF,IAAI,SAAS,IAAI,WAAW,EAAE;oBAC1B,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,WAAW,EAAE;wBAC7C,WAAW,CAAC,QAAQ,GAAG,EAAE,CAAC;qBAC7B;oBACD,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;iBACzC;qBAAM;oBACH,WAAW,GAAG,UAAU,CAAC;iBAC5B;YACL,CAAC,CAAC,CAAC;SACN;QAED,MAAM,IAAI,UAAU,GAAG,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;QAEvE,0CAA0C;QAC1C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,MAAM,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;SAC5C;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/unix.d.ts b/node_modules/@textlint/linter-formatter/module/formatters/unix.d.ts new file mode 100644 index 000000000..1192166ef --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/unix.d.ts @@ -0,0 +1,8 @@ +/** + * @fileoverview unix-style formatter. + * @author oshi-shinobu + * @copyright 2015 oshi-shinobu. All rights reserved. + */ +import type { TextlintResult } from "@textlint/types"; +declare function formatter(results: TextlintResult[]): string; +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/module/formatters/unix.js b/node_modules/@textlint/linter-formatter/module/formatters/unix.js new file mode 100644 index 000000000..4cb895e57 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/unix.js @@ -0,0 +1,46 @@ +/** + * @fileoverview unix-style formatter. + * @author oshi-shinobu + * @copyright 2015 oshi-shinobu. All rights reserved. + */ +"use strict"; +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {object} message Individual error message provided by eslint + * @returns {String} Error level string + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + else { + return "Warning"; + } +} +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +function formatter(results) { + var output = "", total = 0; + results.forEach(function (result) { + var messages = result.messages; + total += messages.length; + messages.forEach(function (message) { + output += result.filePath + ":"; + output += (message.line || 0) + ":"; + output += (message.column || 0) + ":"; + output += " " + message.message + " "; + output += "[" + getMessageType(message) + (message.ruleId ? "/" + message.ruleId : "") + "]"; + output += "\n"; + }); + }); + if (total > 0) { + output += "\n" + total + " problem" + (total !== 1 ? "s" : ""); + } + return output; +} +export default formatter; +//# sourceMappingURL=unix.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/formatters/unix.js.map b/node_modules/@textlint/linter-formatter/module/formatters/unix.js.map new file mode 100644 index 000000000..a7e97e252 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/formatters/unix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unix.js","sourceRoot":"","sources":["../../src/formatters/unix.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;AAGb,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAY;IAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzC,OAAO,OAAO,CAAC;KAClB;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,SAAS,CAAC,OAAyB;IACxC,IAAI,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC5B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC;QAEzB,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO;YAC9B,MAAM,IAAI,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC;YAChC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;YACpC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;YACtC,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC;YACtC,MAAM,IAAI,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;YAC7F,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,IAAI,IAAI,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAClE;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/index.d.ts b/node_modules/@textlint/linter-formatter/module/index.d.ts new file mode 100644 index 000000000..76b3170e8 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/index.d.ts @@ -0,0 +1,10 @@ +import type { TextlintResult } from "@textlint/types"; +export interface FormatterConfig { + formatterName: string; + color?: boolean; +} +export declare function createFormatter(formatterConfig: FormatterConfig): (results: TextlintResult[]) => string; +export interface FormatterDetail { + name: string; +} +export declare function getFormatterList(): FormatterDetail[]; diff --git a/node_modules/@textlint/linter-formatter/module/index.js b/node_modules/@textlint/linter-formatter/module/index.js new file mode 100644 index 000000000..ee9a8e6c7 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/index.js @@ -0,0 +1,54 @@ +// LICENSE : MIT +"use strict"; +import { moduleInterop } from "@textlint/module-interop"; +var fs = require("fs"); +var path = require("path"); +var tryResolve = require("try-resolve"); +var isFile = require("is-file"); +var debug = require("debug")("textlint:@textlint/linter-formatter"); +export function createFormatter(formatterConfig) { + var formatterName = formatterConfig.formatterName; + debug("formatterName: " + formatterName); + var formatter; + var formatterPath; + if (fs.existsSync(formatterName)) { + formatterPath = formatterName; + } + else if (fs.existsSync(path.resolve(process.cwd(), formatterName))) { + formatterPath = path.resolve(process.cwd(), formatterName); + } + else { + if (isFile(path.join(__dirname, "formatters/", formatterName) + ".js")) { + formatterPath = path.join(__dirname, "formatters/", formatterName) + ".js"; + } + else if (isFile(path.join(__dirname, "formatters/", formatterName) + ".ts")) { + formatterPath = path.join(__dirname, "formatters/", formatterName) + ".ts"; + } + else { + var pkgPath = tryResolve("textlint-formatter-" + formatterName) || tryResolve(formatterName); + if (pkgPath) { + formatterPath = pkgPath; + } + } + } + try { + formatter = moduleInterop(require(formatterPath)); + } + catch (ex) { + throw new Error("Could not find formatter " + formatterName + "\n" + ex); + } + return function (results) { + return formatter(results, formatterConfig); + }; +} +export function getFormatterList() { + return fs + .readdirSync(path.join(__dirname, "formatters")) + .filter(function (file) { + return path.extname(file) === ".js"; + }) + .map(function (file) { + return { name: path.basename(file, ".js") }; + }); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/module/index.js.map b/node_modules/@textlint/linter-formatter/module/index.js.map new file mode 100644 index 000000000..d1dda7b47 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE1C,IAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,CAAC;AAOtE,MAAM,UAAU,eAAe,CAAC,eAAgC;IAC5D,IAAM,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;IACpD,KAAK,CAAC,oBAAkB,aAAe,CAAC,CAAC;IACzC,IAAI,SAAkF,CAAC;IACvF,IAAI,aAAa,CAAC;IAClB,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QAC9B,aAAa,GAAG,aAAa,CAAC;KACjC;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC,EAAE;QAClE,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;KAC9D;SAAM;QACH,IAAI,MAAM,CAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC,EAAE;YACpE,aAAa,GAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC;SAC9E;aAAM,IAAI,MAAM,CAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC,EAAE;YAC3E,aAAa,GAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,QAAK,CAAC;SAC9E;aAAM;YACH,IAAM,OAAO,GAAG,UAAU,CAAC,wBAAsB,aAAe,CAAC,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/F,IAAI,OAAO,EAAE;gBACT,aAAa,GAAG,OAAO,CAAC;aAC3B;SACJ;KACJ;IACD,IAAI;QACA,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KACrD;IAAC,OAAO,EAAE,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,8BAA4B,aAAa,UAC/D,EAAI,CAAC,CAAC;KACH;IACD,OAAO,UAAU,OAAyB;QACtC,OAAO,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC;AACN,CAAC;AAMD,MAAM,UAAU,gBAAgB;IAC5B,OAAO,EAAE;SACJ,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;SAC/C,MAAM,CAAC,UAAC,IAAY;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC;IACxC,CAAC,CAAC;SACD,GAAG,CAAC,UAAC,IAAY;QACd,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/linter-formatter/package.json b/node_modules/@textlint/linter-formatter/package.json new file mode 100644 index 000000000..147b3a0c1 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/package.json @@ -0,0 +1,72 @@ +{ + "name": "@textlint/linter-formatter", + "version": "3.3.5", + "description": "textlint output formatter", + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/linter-formatter", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bin": { + "textlint-formatter": "bin/cmd.js" + }, + "directories": { + "test": "test/" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run build", + "test": "mocha \"test/**/*.{js,ts}\"" + }, + "dependencies": { + "@azu/format-text": "^1.0.1", + "@azu/style-format": "^1.0.0", + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "concat-stream": "^1.6.2", + "debug": "^4.3.1", + "is-file": "^1.0.0", + "js-yaml": "^3.14.1", + "optionator": "^0.9.1", + "pluralize": "^2.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "table": "^3.8.3", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1", + "xml-escape": "^1.1.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "chai": "^4.3.4", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "power-assert": "^1.6.1", + "proxyquire": "^2.1.3", + "rimraf": "^3.0.2", + "sinon": "^1.17.7", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "~4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/linter-formatter/src/FormatterOptions.ts b/node_modules/@textlint/linter-formatter/src/FormatterOptions.ts new file mode 100644 index 000000000..f8df6564b --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/FormatterOptions.ts @@ -0,0 +1,3 @@ +export interface FormatterOptions { + color?: boolean; +} diff --git a/node_modules/@textlint/linter-formatter/src/cli.ts b/node_modules/@textlint/linter-formatter/src/cli.ts new file mode 100644 index 000000000..dca2ef72a --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/cli.ts @@ -0,0 +1,74 @@ +// LICENSE : MIT +"use strict"; +import * as fs from "fs"; +import { createFormatter, getFormatterList } from "./index"; + +module.exports = function run(argv: string[], text: string) { + return new Promise(function (resolve) { + let format; + const optionator = require("optionator")({ + prepend: "Usage: textlint-formatter [options]", + options: [ + { + option: "help", + alias: "h", + type: "Boolean", + description: "displays help" + }, + { + option: "formatter", + alias: "f", + type: "String", + description: "formatter name", + example: "textlint -f json README.md | textlint-formatter -f pretty-error" + }, + { + option: "list", + alias: "l", + type: "Boolean", + description: "print available formatters" + }, + { + option: "stdin", + type: "Boolean", + default: "false", + description: "Format text provided on ." + } + ] + }); + const options = optionator.parseArgv(argv); + const files = options._; + if (options.list) { + return resolve( + "Available formatters:\n" + + getFormatterList() + .map((formatter: { name: string }) => { + return `- ${formatter.name}`; + }) + .join("\n") + ); + } + if (options.help || (!files.length && !text)) { + return resolve(optionator.generateHelp()); + } + const content = text ? text : fs.readFileSync(files[0], "utf-8"); + let jsonContent; + try { + jsonContent = JSON.parse(content); + } catch (error) { + return new Error("Content should be json. " + error.message); + } + if (options.formatter) { + format = createFormatter({ + formatterName: options.formatter + }); + return resolve(format(jsonContent)); + } else { + // default: use stylish + format = createFormatter({ + formatterName: "stylish" + }); + return resolve(format(jsonContent)); + } + }); +}; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/checkstyle.ts b/node_modules/@textlint/linter-formatter/src/formatters/checkstyle.ts new file mode 100644 index 000000000..caa1ea52d --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/checkstyle.ts @@ -0,0 +1,95 @@ +/** + * @fileoverview CheckStyle XML reporter + * @author Ian Christian Myers + */ + +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns the severity of warning or error + * @param {object} message message object to examine + * @returns {string} severity level + * @private + */ +function getMessageType(message: any): string { + if (message.fatal || message.severity === 2) { + return "error"; + } else { + return "warning"; + } +} + +/** + * Returns the escaped value for a character + * @param {string} s string to examine + * @returns {string} severity level + * @private + */ +function xmlEscape(s: any): string { + return ("" + s).replace(/[<>&"']/g, function (c) { + switch (c) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case '"': + return """; + case "'": + return "'"; + default: + throw new Error("unreachable"); + } + }); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[]) { + let output = ""; + + output += ''; + output += ''; + + results.forEach(function (result) { + const messages = result.messages; + + output += ''; + + messages.forEach(function (message) { + output += + ''; + }); + + output += ""; + }); + + output += ""; + + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/compact.ts b/node_modules/@textlint/linter-formatter/src/formatters/compact.ts new file mode 100644 index 000000000..5bce6b5d2 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/compact.ts @@ -0,0 +1,51 @@ +/** + * @fileoverview Compact reporter + * @author Nicholas C. Zakas + */ + +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +function getMessageType(message: any): string { + if (message.fatal || message.severity === 2) { + return "Error"; + } else { + return "Warning"; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[]) { + let output = "", + total = 0; + + results.forEach(function (result) { + const messages = result.messages; + total += messages.length; + + messages.forEach(function (message) { + output += result.filePath + ": "; + output += "line " + (message.line || 0); + output += ", col " + (message.column || 0); + output += ", " + getMessageType(message); + output += " - " + message.message; + output += message.ruleId ? " (" + message.ruleId + ")" : ""; + output += "\n"; + }); + }); + + if (total > 0) { + output += "\n" + total + " problem" + (total !== 1 ? "s" : ""); + } + + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/jslint-xml.ts b/node_modules/@textlint/linter-formatter/src/formatters/jslint-xml.ts new file mode 100644 index 000000000..6ccb77a39 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/jslint-xml.ts @@ -0,0 +1,51 @@ +/** + * @fileoverview JSLint XML reporter + * @author Ian Christian Myers + */ +"use strict"; + +import type { TextlintResult } from "@textlint/types"; + +const lodash = require("lodash"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[]) { + let output = ""; + + output += ''; + output += ""; + + results.forEach(function (result) { + var messages = result.messages; + + output += ''; + + messages.forEach(function (message) { + output += + ''; + }); + + output += ""; + }); + + output += ""; + + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/json.ts b/node_modules/@textlint/linter-formatter/src/formatters/json.ts new file mode 100644 index 000000000..95e633bd6 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/json.ts @@ -0,0 +1,9 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +function formatter(results: TextlintResult[]) { + return JSON.stringify(results); +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/junit.ts b/node_modules/@textlint/linter-formatter/src/formatters/junit.ts new file mode 100644 index 000000000..42be0c30b --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/junit.ts @@ -0,0 +1,70 @@ +/** + * @fileoverview jUnit Reporter + * @author Jamund Ferguson + */ +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +const lodash = require("lodash"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +function getMessageType(message: any): string { + if (message.fatal || message.severity === 2) { + return "Error"; + } else { + return "Warning"; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[]) { + let output = ""; + + output += '\n'; + output += "\n"; + + results.forEach(function (result) { + const messages = result.messages; + + if (messages.length) { + output += + '\n'; + } + + messages.forEach(function (message) { + const type = (message as any).fatal ? "error" : "failure"; + output += ''; + output += "<" + type + ' message="' + lodash.escape(message.message || "") + '">'; + output += ""; + output += ""; + output += "\n"; + }); + + if (messages.length) { + output += "\n"; + } + }); + + output += "\n"; + + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/pretty-error.ts b/node_modules/@textlint/linter-formatter/src/formatters/pretty-error.ts new file mode 100644 index 000000000..75a557fc7 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/pretty-error.ts @@ -0,0 +1,182 @@ +// LICENSE : MIT + +// Original code is https://github.com/azer/prettify-error +// Author : azer +"use strict"; +import type { TextlintMessage, TextlintResult } from "@textlint/types"; +import { FormatterOptions } from "../FormatterOptions"; + +const format = require("@azu/format-text"); +const chalk = require("chalk"); +const style = require("@azu/style-format"); +const stripAnsi = require("strip-ansi"); +const pluralize = require("pluralize"); +// width is 2 +const widthOfString = require("string-width"); +// color set +let summaryColor = "yellow"; +let greenColor = "green"; +const template = style( + "{grey}{ruleId}: {red}{title}{reset}\n" + + "{grey}{filename}{reset}\n" + + " {red}{paddingForLineNo} {v}{reset}\n" + + " {grey}{previousLineNo}. {previousLine}{reset}\n" + + " {reset}{failingLineNo}. {failingLine}{reset}\n" + + " {grey}{nextLineNo}. {nextLine}{reset}\n" + + " {red}{paddingForLineNo} {^}{reset}\n" + + "" +); + +/** + * + * @param {string} code + * @param {TextLintMessage} message + * @returns {*} + */ +function failingCode(code: string, message: TextlintMessage): any { + let result = []; + const lines = code.split("\n"); + let i = message.line - 3; + while (++i < message.line + 1) { + if (i + 1 !== message.line) { + result.push({ + line: message.line - (message.line - i - 1), + code: lines[i] + }); + continue; + } + + result.push({ + line: message.line, + col: message.column, + code: lines[i], + failed: true + }); + } + + return result; +} + +function showColumn(codes: string, ch: string): string { + let result = ""; + const codeObject: any = codes[1]; + const sliced = codeObject.code.slice(0, codeObject.col); + const width = widthOfString(sliced); + if (width <= 0) { + return ""; + } + let i = width - 1; + + while (i--) { + result += " "; + } + + return result + ch; +} + +/** + * + * @param {string} code + * @param {string} filePath + * @param {TextLintMessage} message + * @returns {*} + */ +function prettyError(code: string, filePath: string, message: TextlintMessage): any { + if (!code) { + return; + } + const parsed = failingCode(code, message); + const previousLineNo = String(parsed[0].line); + const failingLineNo = String(parsed[1].line); + const nextLineNo = String(parsed[2].line); + const linumlen = Math.max(previousLineNo.length, failingLineNo.length, nextLineNo.length); + return format(template, { + ruleId: message.ruleId, + title: message.message, + filename: filePath + ":" + message.line + ":" + message.column, + previousLine: parsed[0].code ? parsed[0].code : "", + previousLineNo: previousLineNo.padStart(linumlen), + previousColNo: parsed[0].col, + failingLine: parsed[1].code, + failingLineNo: failingLineNo.padStart(linumlen), + failingColNo: parsed[1].col, + nextLine: parsed[2].code ? parsed[2].code : "", + nextLineNo: nextLineNo.padStart(linumlen), + nextColNo: parsed[2].col, + paddingForLineNo: "".padStart(linumlen), + "^": showColumn(parsed, "^"), + v: showColumn(parsed, "v") + }); +} + +/** + * + * @param {TextLintResult[]} results + * @param {TextLintFormatterOption} options + * @returns {string} + */ +function formatter(results: TextlintResult[], options: FormatterOptions) { + // default: true + const useColor = options.color !== undefined ? options.color : true; + let output = ""; + let total = 0; + let errors = 0; + let warnings = 0; + let totalFixable = 0; + results.forEach(function (result) { + const code = require("fs").readFileSync(result.filePath, "utf-8"); + const messages = result.messages; + if (messages.length === 0) { + return; + } + total += messages.length; + messages.forEach(function (message) { + // fixable + const fixableIcon = message.fix ? chalk[greenColor].bold("\u2713 ") : ""; + if (message.fix) { + totalFixable++; + } + if ((message as any).fatal || message.severity === 2) { + errors++; + } else { + warnings++; + } + const r = fixableIcon + prettyError(code, result.filePath, message); + if (r) { + output += r + "\n"; + } + }); + }); + + if (total > 0) { + output += chalk[summaryColor].bold( + [ + "\u2716 ", + total, + pluralize(" problem", total), + " (", + errors, + pluralize(" error", errors), + ", ", + warnings, + pluralize(" warning", warnings), + ")\n" + ].join("") + ); + } + + if (totalFixable > 0) { + output += chalk[greenColor].bold( + "✓ " + totalFixable + " fixable " + pluralize("problem", totalFixable) + ".\n" + ); + output += "Try to run: $ " + chalk.underline("textlint --fix [file]") + "\n"; + } + + if (!useColor) { + return stripAnsi(output); + } + return output; +} + +export default formatter; +export { prettyError }; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/stylish.ts b/node_modules/@textlint/linter-formatter/src/formatters/stylish.ts new file mode 100644 index 000000000..b8ed63ef0 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/stylish.ts @@ -0,0 +1,134 @@ +/** + * @fileoverview Stylish reporter + * @author Sindre Sorhus + */ + +"use strict"; +import type { TextlintResult } from "@textlint/types"; +import { FormatterOptions } from "../FormatterOptions"; + +const chalk = require("chalk"); +const table = require("text-table"); +const widthOfString = require("string-width"); +const stripAnsi = require("strip-ansi"); +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {int} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word: string, count: number): string { + return count === 1 ? word : word + "s"; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[], options: FormatterOptions) { + // default: true + const useColor = options.color !== undefined ? options.color : true; + + let output = "\n"; + let total = 0; + let totalFixable = 0; + let errors = 0; + let warnings = 0; + let summaryColor = "yellow"; + let greenColor = "green"; + + results.forEach(function (result) { + const messages = result.messages; + + if (messages.length === 0) { + return; + } + + total += messages.length; + output += chalk.underline(result.filePath) + "\n"; + + output += + table( + messages.map(function (message) { + let messageType; + // fixable + const fixableIcon = message.fix ? chalk[greenColor].bold("\u2713 ") : ""; + if (message.fix) { + totalFixable++; + } + if ((message as any).fatal || message.severity === 2) { + messageType = fixableIcon + chalk.red("error"); + summaryColor = "red"; + errors++; + } else { + messageType = fixableIcon + chalk.yellow("warning"); + warnings++; + } + + return [ + "", + message.line || 0, + message.column || 0, + messageType, + message.message.replace(/\.$/, ""), + chalk.gray(message.ruleId || "") + ]; + }), + { + align: ["", "r", "l"], + stringLength: function (str: string) { + const lines = chalk.stripColor(str).split("\n"); + return Math.max.apply( + null, + lines.map(function (line: string) { + return widthOfString(line); + }) + ); + } + } + ) + .split("\n") + .map(function (el: string) { + return el.replace(/(\d+)\s+(\d+)/, function (_, p1, p2) { + return chalk.gray(p1 + ":" + p2); + }); + }) + .join("\n") + "\n\n"; + }); + + if (total > 0) { + output += chalk[summaryColor].bold( + [ + "\u2716 ", + total, + pluralize(" problem", total), + " (", + errors, + pluralize(" error", errors), + ", ", + warnings, + pluralize(" warning", warnings), + ")\n" + ].join("") + ); + } + + if (totalFixable > 0) { + output += chalk[greenColor].bold( + "✓ " + totalFixable + " fixable " + pluralize("problem", totalFixable) + ".\n" + ); + output += "Try to run: $ " + chalk.underline("textlint --fix [file]") + "\n"; + } + + const finalOutput = total > 0 ? output : ""; + if (!useColor) { + return stripAnsi(finalOutput); + } + return finalOutput; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/table.ts b/node_modules/@textlint/linter-formatter/src/formatters/table.ts new file mode 100644 index 000000000..e3ac0aac1 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/table.ts @@ -0,0 +1,155 @@ +/** + * @fileoverview "table reporter. + * @author Gajus Kuizinas + * @copyright 2016 Gajus Kuizinas . All rights reserved. + */ + +"use strict"; +import type { TextlintMessage } from "@textlint/types"; +import { FormatterOptions } from "../FormatterOptions"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const chalk = require("chalk"); +const table = require("table").default; +const pluralize = require("pluralize"); +const stripAnsi = require("strip-ansi"); +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Draws text table. + * @param {Array} messages Error messages relating to a specific file. + * @returns {string} A text table. + */ +function drawTable(messages: TextlintMessage[]): string { + let rows: any = []; + + if (messages.length === 0) { + return ""; + } + + rows.push([ + chalk.bold("Line"), + chalk.bold("Column"), + chalk.bold("Type"), + chalk.bold("Message"), + chalk.bold("Rule ID") + ]); + + messages.forEach(function (message: TextlintMessage) { + let messageType; + + if ((message as any).fatal || message.severity === 2) { + messageType = chalk.red("error"); + } else { + messageType = chalk.yellow("warning"); + } + + rows.push([message.line || 0, message.column || 0, messageType, message.message, message.ruleId || ""]); + }); + + const output = table(rows, { + columns: { + 0: { + width: 8, + wrapWord: true + }, + 1: { + width: 8, + wrapWord: true + }, + 2: { + width: 8, + wrapWord: true + }, + 3: { + paddingRight: 5, + width: 50, + wrapWord: true + }, + 4: { + width: 20, + wrapWord: true + } + }, + drawHorizontalLine: function (index: number) { + return index === 1; + } + }); + return output; +} + +/** + * Draws a report (multiple tables). + * @param {Array} results Report results for every file. + * @returns {string} A column of text tables. + */ +function drawReport(results: any): string { + let files; + + files = results.map(function (result: any) { + if (!result.messages.length) { + return ""; + } + + return "\n" + result.filePath + "\n\n" + drawTable(result.messages); + }); + + files = files.filter(function (content: string) { + return content.trim(); + }); + + return files.join(""); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(report: any, options: FormatterOptions) { + // default: true + const useColor = options.color !== undefined ? options.color : true; + let output = ""; + let errorCount = 0; + let warningCount = 0; + + report.forEach(function (fileReport: any) { + errorCount += fileReport.errorCount; + warningCount += fileReport.warningCount; + }); + + if (errorCount || warningCount) { + output = drawReport(report); + } + + output += + "\n" + + table( + [ + [chalk.red(pluralize("Error", errorCount, true))], + [chalk.yellow(pluralize("Warning", warningCount, true))] + ], + { + columns: { + 0: { + width: 110, + wrapWord: true + } + }, + drawHorizontalLine: function () { + return true; + } + } + ); + + if (!useColor) { + return stripAnsi(output); + } + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/tap.ts b/node_modules/@textlint/linter-formatter/src/formatters/tap.ts new file mode 100644 index 000000000..f928c6d3e --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/tap.ts @@ -0,0 +1,97 @@ +/** + * @fileoverview TAP reporter + * @author Jonathan Kingston + */ + +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +const yaml = require("js-yaml"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {object} message Individual error message provided by eslint + * @returns {String} Error level string + */ +function getMessageType(message: any): string { + if (message.fatal || message.severity === 2) { + return "error"; + } else { + return "warning"; + } +} + +/** + * Takes in a JavaScript object and outputs a TAP diagnostics string + * @param {object} diagnostic JavaScript object to be embedded as YAML into output. + * @returns {string} diagnostics string with YAML embedded - TAP version 13 compliant + */ +function outputDiagnostics(diagnostic: any): string { + const prefix = " "; + let output = prefix + "---\n"; + output += + prefix + + yaml + .safeDump(diagnostic) + .split("\n") + .join("\n" + prefix); + output += "...\n"; + return output; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[]) { + let output = "TAP version 13\n1.." + results.length + "\n"; + + results.forEach(function (result, id) { + const messages = result.messages; + let testResult = "ok"; + let diagnostics: any = {}; + + if (messages.length > 0) { + testResult = "not ok"; + + messages.forEach(function (message) { + const diagnostic = { + message: message.message, + severity: getMessageType(message), + data: { + line: message.line || 0, + column: message.column || 0, + ruleId: message.ruleId || "" + } + }; + + // If we have multiple messages place them under a messages key + // The first error will be logged as message key + // This is to adhere to TAP 13 loosely defined specification of having a message key + if ("message" in diagnostics) { + if (typeof diagnostics.messages === "undefined") { + diagnostics.messages = []; + } + diagnostics.messages.push(diagnostic); + } else { + diagnostics = diagnostic; + } + }); + } + + output += testResult + " " + (id + 1) + " - " + result.filePath + "\n"; + + // If we have an error include diagnostics + if (messages.length > 0) { + output += outputDiagnostics(diagnostics); + } + }); + + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/formatters/unix.ts b/node_modules/@textlint/linter-formatter/src/formatters/unix.ts new file mode 100644 index 000000000..bc2857c21 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/formatters/unix.ts @@ -0,0 +1,56 @@ +/** + * @fileoverview unix-style formatter. + * @author oshi-shinobu + * @copyright 2015 oshi-shinobu. All rights reserved. + */ + +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {object} message Individual error message provided by eslint + * @returns {String} Error level string + */ +function getMessageType(message: any): string { + if (message.fatal || message.severity === 2) { + return "Error"; + } else { + return "Warning"; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +function formatter(results: TextlintResult[]) { + let output = "", + total = 0; + + results.forEach(function (result) { + const messages = result.messages; + total += messages.length; + + messages.forEach(function (message) { + output += result.filePath + ":"; + output += (message.line || 0) + ":"; + output += (message.column || 0) + ":"; + output += " " + message.message + " "; + output += "[" + getMessageType(message) + (message.ruleId ? "/" + message.ruleId : "") + "]"; + output += "\n"; + }); + }); + + if (total > 0) { + output += "\n" + total + " problem" + (total !== 1 ? "s" : ""); + } + + return output; +} + +export default formatter; diff --git a/node_modules/@textlint/linter-formatter/src/index.ts b/node_modules/@textlint/linter-formatter/src/index.ts new file mode 100644 index 000000000..c07fe6447 --- /dev/null +++ b/node_modules/@textlint/linter-formatter/src/index.ts @@ -0,0 +1,64 @@ +// LICENSE : MIT +"use strict"; +import type { TextlintResult } from "@textlint/types"; + +import { moduleInterop } from "@textlint/module-interop"; + +const fs = require("fs"); +const path = require("path"); +const tryResolve = require("try-resolve"); + +const isFile = require("is-file"); +const debug = require("debug")("textlint:@textlint/linter-formatter"); + +export interface FormatterConfig { + formatterName: string; + color?: boolean; +} + +export function createFormatter(formatterConfig: FormatterConfig) { + const formatterName = formatterConfig.formatterName; + debug(`formatterName: ${formatterName}`); + let formatter: (results: TextlintResult[], formatterConfig: FormatterConfig) => string; + let formatterPath; + if (fs.existsSync(formatterName)) { + formatterPath = formatterName; + } else if (fs.existsSync(path.resolve(process.cwd(), formatterName))) { + formatterPath = path.resolve(process.cwd(), formatterName); + } else { + if (isFile(`${path.join(__dirname, "formatters/", formatterName)}.js`)) { + formatterPath = `${path.join(__dirname, "formatters/", formatterName)}.js`; + } else if (isFile(`${path.join(__dirname, "formatters/", formatterName)}.ts`)) { + formatterPath = `${path.join(__dirname, "formatters/", formatterName)}.ts`; + } else { + const pkgPath = tryResolve(`textlint-formatter-${formatterName}`) || tryResolve(formatterName); + if (pkgPath) { + formatterPath = pkgPath; + } + } + } + try { + formatter = moduleInterop(require(formatterPath)); + } catch (ex) { + throw new Error(`Could not find formatter ${formatterName} +${ex}`); + } + return function (results: TextlintResult[]) { + return formatter(results, formatterConfig); + }; +} + +export interface FormatterDetail { + name: string; +} + +export function getFormatterList(): FormatterDetail[] { + return fs + .readdirSync(path.join(__dirname, "formatters")) + .filter((file: string) => { + return path.extname(file) === ".js"; + }) + .map((file: string) => { + return { name: path.basename(file, ".js") }; + }); +} diff --git a/node_modules/@textlint/markdown-to-ast/CHANGELOG.md b/node_modules/@textlint/markdown-to-ast/CHANGELOG.md new file mode 100644 index 000000000..0d33ec043 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/CHANGELOG.md @@ -0,0 +1,569 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [6.3.5](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.3.4...@textlint/markdown-to-ast@6.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + +## [6.3.4](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.3.3...@textlint/markdown-to-ast@6.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + + +## [6.3.3](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.3.2...@textlint/markdown-to-ast@6.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [6.3.2](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.3.1...@textlint/markdown-to-ast@6.3.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [6.3.1](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.5...@textlint/markdown-to-ast@6.3.1) (2021-01-22) + + +### Bug Fixes + +* **@textlint/markdown-to-ast:** fix [@ts-expect-error](https://github.com/ts-expect-error) issue ([d47f3ec](https://github.com/textlint/textlint/commit/d47f3ec)) +* **ast-node-types:** deprecated "ReferenceDef" type ([#701](https://github.com/textlint/textlint/issues/701)) ([a088520](https://github.com/textlint/textlint/commit/a088520)) +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [6.3.0](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.5...@textlint/markdown-to-ast@6.3.0) (2021-01-22) + + +### Bug Fixes + +* **@textlint/markdown-to-ast:** fix [@ts-expect-error](https://github.com/ts-expect-error) issue ([d47f3ec](https://github.com/textlint/textlint/commit/d47f3ec)) +* **ast-node-types:** deprecated "ReferenceDef" type ([#701](https://github.com/textlint/textlint/issues/701)) ([a088520](https://github.com/textlint/textlint/commit/a088520)) +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [6.2.6](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.5...@textlint/markdown-to-ast@6.2.6) (2020-12-22) + + +### Bug Fixes + +* **@textlint/markdown-to-ast:** fix [@ts-expect-error](https://github.com/ts-expect-error) issue ([d47f3ec](https://github.com/textlint/textlint/commit/d47f3ec)) +* **ast-node-types:** deprecated "ReferenceDef" type ([#701](https://github.com/textlint/textlint/issues/701)) ([a088520](https://github.com/textlint/textlint/commit/a088520)) +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [6.2.5](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.4...@textlint/markdown-to-ast@6.2.5) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [6.2.4](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.3...@textlint/markdown-to-ast@6.2.4) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [6.2.3](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.2...@textlint/markdown-to-ast@6.2.3) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [6.2.2](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.1...@textlint/markdown-to-ast@6.2.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/markdown-to-ast:** fix "module" field ([b577531](https://github.com/textlint/textlint/commit/b577531)) + + +### Tests + +* **@textlint/markdown-to-ast:** fix import ([03a5fdd](https://github.com/textlint/textlint/commit/03a5fdd)) + + + + + + +## [6.2.1](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.2.0...@textlint/markdown-to-ast@6.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [6.2.0](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.7...@textlint/markdown-to-ast@6.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **markdown-to-ast:** Convert to TypScript ([#671](https://github.com/textlint/textlint/issues/671)) ([b879a09](https://github.com/textlint/textlint/commit/b879a09)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [6.1.7](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.6...@textlint/markdown-to-ast@6.1.7) (2020-02-07) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + + +## [6.1.6](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.5...@textlint/markdown-to-ast@6.1.6) (2019-10-14) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + + +## [6.1.5](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.3...@textlint/markdown-to-ast@6.1.5) (2019-07-20) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + + +## [6.1.4](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.3...@textlint/markdown-to-ast@6.1.4) (2019-07-13) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + + +## [6.1.3](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.2...@textlint/markdown-to-ast@6.1.3) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [6.1.2](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.1...@textlint/markdown-to-ast@6.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/markdown-to-ast + + + + + + +## [6.1.1](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.1.0...@textlint/markdown-to-ast@6.1.1) (2019-01-03) + + +### Code Refactoring + +* **markdown-to-ast:** remove unused deps" ([3a5dc5d](https://github.com/textlint/textlint/commit/3a5dc5d)) + + + + + + +# [6.1.0](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.0.9...@textlint/markdown-to-ast@6.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Styles + +* **eslint:** apply eslint to all files ([6a9573f](https://github.com/textlint/textlint/commit/6a9573f)) +* **prettier:** format style by prettier ([19a2901](https://github.com/textlint/textlint/commit/19a2901)) + + + + + +## [6.0.9](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.0.8...@textlint/markdown-to-ast@6.0.9) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + +### Code Refactoring + +* **typescript:** update to TypeScript 2.8 ([f7b2b08](https://github.com/textlint/textlint/commit/f7b2b08)) + + + + + +## [6.0.8](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.0.7...@textlint/markdown-to-ast@6.0.8) (2018-04-02) + + +### Bug Fixes + +* **markdown-to-ast:** enable yaml frontmatter parse by default ([121c62f](https://github.com/textlint/textlint/commit/121c62f)) + + + + + +## [6.0.7](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.0.6...@textlint/markdown-to-ast@6.0.7) (2018-04-02) + + +### Bug Fixes + +* **markdown-to-ast:** upgrade remark@^9.0.0 ([8a70c0f](https://github.com/textlint/textlint/commit/8a70c0f)) + + +### Chores + +* **markdown-to-ast:** update fixtures ([ac61a54](https://github.com/textlint/textlint/commit/ac61a54)) + + +### Tests + +* **markdown-to-ast:** add failure test case ([87f218d](https://github.com/textlint/textlint/commit/87f218d)) + + + + + +## [6.0.6](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.0.5...@textlint/markdown-to-ast@6.0.6) (2018-03-25) + + +### Chores + +* format ([d8f44db](https://github.com/textlint/textlint/commit/d8f44db)) + + + + + +## [6.0.5](https://github.com/textlint/textlint/compare/@textlint/markdown-to-ast@6.0.4...@textlint/markdown-to-ast@6.0.5) (2018-01-27) + + +### Code Refactoring + +* **ast-traverse:** update usage of [@textlint](https://github.com/textlint)/ast-traverse ([133ab5a](https://github.com/textlint/textlint/commit/133ab5a)) + + + + + +## 6.0.4 (2018-01-18) + + +### Bug Fixes + +* **markdown-to-ast:** add "publishConfig" ([929b575](https://github.com/textlint/textlint/commit/929b575)) + + + + + +## [6.0.3](https://github.com/textlint/textlint/compare/markdown-to-ast@6.0.2...markdown-to-ast@6.0.3) (2018-01-12) + + + + +**Note:** Version bump only for package markdown-to-ast + + +## [6.0.2](https://github.com/textlint/textlint/compare/markdown-to-ast@6.0.1...markdown-to-ast@6.0.2) (2017-12-31) + + + + +**Note:** Version bump only for package markdown-to-ast + + +## [6.0.1](https://github.com/textlint/textlint/compare/markdown-to-ast@6.0.0...markdown-to-ast@6.0.1) (2017-12-25) + + + + +**Note:** Version bump only for package markdown-to-ast + + +# [6.0.0](https://github.com/textlint/textlint/compare/markdown-to-ast@6.0.0-next.0...markdown-to-ast@6.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package markdown-to-ast + + +# [6.0.0-next.0](https://github.com/textlint/textlint/compare/markdown-to-ast@5.0.0...markdown-to-ast@6.0.0-next.0) (2017-12-15) + + + + +**Note:** Version bump only for package markdown-to-ast + + +# 4.0.0 (2017-05-06) + + +### Bug Fixes + +* **example:** fix path ([3047d10](https://github.com/textlint/textlint/commit/3047d10)) +* **example:** update ([a8e4941](https://github.com/textlint/textlint/commit/a8e4941)) +* **npm:** move debug module to dependency ([eef12f0](https://github.com/textlint/textlint/commit/eef12f0)) +* **npm:** move dev to dependecies ([8e7cd32](https://github.com/textlint/textlint/commit/8e7cd32)) +* **parse:** use thematicBreak as a map key ([b9fe7d1](https://github.com/textlint/textlint/commit/b9fe7d1)) +* **readme:** fix outdated link ([5697807](https://github.com/textlint/textlint/commit/5697807)), closes [#9](https://github.com/textlint/textlint/issues/9) +* **remark:** fix usage of remark ([8702d24](https://github.com/textlint/textlint/commit/8702d24)) +* **test:** fix test on Windows ([956c6d1](https://github.com/textlint/textlint/commit/956c6d1)) +* **test:** rename test case ([821c650](https://github.com/textlint/textlint/commit/821c650)) +* **test:** update to mdast latest ([9eee76d](https://github.com/textlint/textlint/commit/9eee76d)) +* **travis:** fix path to shell-script ([13c0174](https://github.com/textlint/textlint/commit/13c0174)) + + +### Features + +* **ast:** enable SetextHeader test ([f980d41](https://github.com/textlint/textlint/commit/f980d41)) +* **ast:** implement Break node ([fb41948](https://github.com/textlint/textlint/commit/fb41948)) +* **ast:** implement HorizontalRule node ([a01084c](https://github.com/textlint/textlint/commit/a01084c)) +* **ast:** implement Html node ([3b94068](https://github.com/textlint/textlint/commit/3b94068)) +* **ast:** implement some node ([f6bbd54](https://github.com/textlint/textlint/commit/f6bbd54)) +* **ast:** re-implement Code ([832cbd6](https://github.com/textlint/textlint/commit/832cbd6)) +* **ast:** re-implement CodeBlock ([902a6c8](https://github.com/textlint/textlint/commit/902a6c8)) +* **ast:** re-implement Emphasis node ([6faf2f3](https://github.com/textlint/textlint/commit/6faf2f3)) +* **ast:** re-implement Strong node ([307c037](https://github.com/textlint/textlint/commit/307c037)) +* **demo:** add title ([174ac1b](https://github.com/textlint/textlint/commit/174ac1b)) +* **markdown:** update remark to 4.x ([f44a326](https://github.com/textlint/textlint/commit/f44a326)) +* **markdown-to-ast:** update remark[@7](https://github.com/7) (#278) ([197d5d4](https://github.com/textlint/textlint/commit/197d5d4)) +* **parser:** add `loc` object to Document type node ([dcc7e2b](https://github.com/textlint/textlint/commit/dcc7e2b)) +* **parser:** add workaround for Header ([e79ab46](https://github.com/textlint/textlint/commit/e79ab46)) +* **parser:** correct `range` of `CodeBlock` ([583b1d7](https://github.com/textlint/textlint/commit/583b1d7)) +* **parser:** correct `raw` property of `BlockQuote` ([a38bdf9](https://github.com/textlint/textlint/commit/a38bdf9)) +* **parser:** correct `raw` property of `Code` ([ef4535f](https://github.com/textlint/textlint/commit/ef4535f)) +* **parser:** correct `raw` property of `Emph` ([6da8e88](https://github.com/textlint/textlint/commit/6da8e88)) +* **parser:** correct `raw` property of `Image` ([27f46d0](https://github.com/textlint/textlint/commit/27f46d0)) +* **parser:** correct `raw` property of `List` type ([59f1723](https://github.com/textlint/textlint/commit/59f1723)) +* **parser:** correct `raw` property of `Strong` ([2265122](https://github.com/textlint/textlint/commit/2265122)) +* **parser:** correct `raw` property of LiteItem ([8414d50](https://github.com/textlint/textlint/commit/8414d50)) +* **parser:** correct `start_column` of each nodes. ([408e97b](https://github.com/textlint/textlint/commit/408e97b)) +* **parser:** implement Header of `raw` ([740d11a](https://github.com/textlint/textlint/commit/740d11a)) +* **parser:** remove un-used properties ([f72fde8](https://github.com/textlint/textlint/commit/f72fde8)) +* **parser:** update to commonmark 0.15 ([f31eaa3](https://github.com/textlint/textlint/commit/f31eaa3)) +* **travis:** add npm run build ([69eaa48](https://github.com/textlint/textlint/commit/69eaa48)) +* **travis:** add travis badge ([7121865](https://github.com/textlint/textlint/commit/7121865)) +* **travis:** auto deploy to gh-page ([a686595](https://github.com/textlint/textlint/commit/a686595)) + + +### BREAKING CHANGES + +* **markdown-to-ast:** some parse result is changed. + +It is correct, but we think that is a breacking change. +This change have possibilities that the user update patch-version textlint and fail test. + +close https://github.com/textlint/markdown-to-ast/issues/14 diff --git a/node_modules/@textlint/markdown-to-ast/LICENSE b/node_modules/@textlint/markdown-to-ast/LICENSE new file mode 100644 index 000000000..d6a58d093 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/markdown-to-ast/README.md b/node_modules/@textlint/markdown-to-ast/README.md new file mode 100644 index 000000000..0fe6724df --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/README.md @@ -0,0 +1,163 @@ +# @textlint/markdown-to-ast + +Parse Markdown to AST with location info. + +This library is not parser itself, it dependent on [wooorm/remark](https://github.com/wooorm/remark). + +> Markdown -> remark -> markdown-to-ast -> `TxtNode`s + +The AST consists of `TxtNode`s. +A `TxtNode` of the AST has following properties: + +- `loc` - Nodes have line and column-based location info. +- `range` - Nodes have an index-based location range (array). +- `raw` - Node have a `raw` text. +- `value` - Node have a `value` of text. + +The interface are defined in [textlint/txtnode.md](https://github.com/textlint/textlint/blob/master/docs/txtnode.md "textlint/txtnode.md at master · textlint/textlint") + +This library is a part of [textlint/textlint](https://github.com/textlint/textlint "textlint/textlint"). + +**If you need to markdown parser, please use [wooorm/remark](https://github.com/wooorm/remark) directly.** + +## DEMO + +- [textlint AST explorer](https://textlint.github.io/astexplorer/ "textlint AST explorer") + +## Installation + +``` +npm install @textlint/markdown-to-ast +``` + +## Usage + +```sh +var parse = require("@textlint/markdown-to-ast").parse; +var markdown = "It's a *text*"; +var AST = parse(markdown); +/* +{ + "type": "Document", + "children": [ + { + "type": "Paragraph", + "children": [ + { + "type": "Str", + "value": "It's a ", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 0, + 7 + ], + "raw": "It's a " + }, + { + "type": "Emphasis", + "children": [ + { + "type": "Str", + "value": "text", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 8, + 12 + ], + "raw": "text" + } + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 7, + 13 + ], + "raw": "*text*" + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "raw": "It's a *text*" + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "raw": "It's a *text*" +} +*/ +``` + +If you want to know real use-case, please see [textlint/textlint](https://github.com/textlint/textlint "textlint/textlint"). + +## Tests + +``` +npm test +``` + +### Create fixtures + +See [tools/](tools/) directory. + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/@textlint/markdown-to-ast/module/index.d.ts b/node_modules/@textlint/markdown-to-ast/module/index.d.ts new file mode 100644 index 000000000..e27bcfd76 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/module/index.d.ts @@ -0,0 +1,8 @@ +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +export { ASTNodeTypes as Syntax }; +/** + * parse markdown text and return ast mapped location info. + * @param {string} text + * @returns {TxtNode} + */ +export declare function parse(text: string): T; diff --git a/node_modules/@textlint/markdown-to-ast/module/index.js b/node_modules/@textlint/markdown-to-ast/module/index.js new file mode 100644 index 000000000..ba6c83ea5 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/module/index.js @@ -0,0 +1,60 @@ +// LICENSE : MIT +"use strict"; +import { SyntaxMap } from "./mapping/markdown-syntax-map"; +import { ASTNodeTypes } from "@textlint/ast-node-types"; +import traverse from "traverse"; +import StructuredSource from "structured-source"; +import debug0 from "debug"; +// @ts-ignore +import unified from "unified"; +// @ts-ignore +import remarkParse from "remark-parse"; +// @ts-ignore +import frontmatter from "remark-frontmatter"; +var debug = debug0("@textlint/markdown-to-ast"); +var remark = unified().use(remarkParse).use(frontmatter, ["yaml"]); +export { ASTNodeTypes as Syntax }; +/** + * parse markdown text and return ast mapped location info. + * @param {string} text + * @returns {TxtNode} + */ +export function parse(text) { + var ast = remark.parse(text); + var src = new StructuredSource(text); + traverse(ast).forEach(function (node) { + // eslint-disable-next-line no-invalid-this + if (this.notLeaf) { + if (node.type) { + var replacedType = SyntaxMap[node.type]; + if (!replacedType) { + debug("replacedType : " + replacedType + " , node.type: " + node.type); + } + else { + node.type = replacedType; + } + } + // map `range`, `loc` and `raw` to node + if (node.position) { + var position = node.position; + var positionCompensated = { + start: { line: position.start.line, column: Math.max(position.start.column - 1, 0) }, + end: { line: position.end.line, column: Math.max(position.end.column - 1, 0) } + }; + var range = src.locationToRange(positionCompensated); + node.loc = positionCompensated; + node.range = range; + node.raw = text.slice(range[0], range[1]); + // Compatible for https://github.com/wooorm/unist, but hidden + Object.defineProperty(node, "position", { + enumerable: false, + configurable: false, + writable: false, + value: position + }); + } + } + }); + return ast; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/markdown-to-ast/module/index.js.map b/node_modules/@textlint/markdown-to-ast/module/index.js.map new file mode 100644 index 000000000..889b6e7a4 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAW,MAAM,0BAA0B,CAAC;AACjE,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AACjD,OAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,aAAa;AACb,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,aAAa;AACb,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,aAAa;AACb,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,IAAM,KAAK,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAClD,IAAM,MAAM,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAErE,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAoB,IAAY;IACjD,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAM,GAAG,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,IAAa;QACzC,2CAA2C;QAC3C,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,IAAI,CAAC,IAAI,EAAE;gBACX,IAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC,IAA8B,CAAC,CAAC;gBACpE,IAAI,CAAC,YAAY,EAAE;oBACf,KAAK,CAAC,oBAAkB,YAAY,sBAAiB,IAAI,CAAC,IAAM,CAAC,CAAC;iBACrE;qBAAM;oBACH,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;iBAC5B;aACJ;YACD,uCAAuC;YACvC,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAC/B,IAAM,mBAAmB,GAAG;oBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE;oBACpF,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE;iBACjF,CAAC;gBACF,IAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;gBACvD,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC;gBAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;gBACnB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1C,6DAA6D;gBAC7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE;oBACpC,UAAU,EAAE,KAAK;oBACjB,YAAY,EAAE,KAAK;oBACnB,QAAQ,EAAE,KAAK;oBACf,KAAK,EAAE,QAAQ;iBAClB,CAAC,CAAC;aACN;SACJ;IACL,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.d.ts b/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.d.ts new file mode 100644 index 000000000..8daecf866 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.d.ts @@ -0,0 +1,33 @@ +import { ASTNodeTypes } from "@textlint/ast-node-types"; +export declare const SyntaxMap: { + root: ASTNodeTypes; + paragraph: ASTNodeTypes; + blockquote: ASTNodeTypes; + listItem: ASTNodeTypes; + list: ASTNodeTypes; + Bullet: string; + heading: ASTNodeTypes; + code: ASTNodeTypes; + HtmlBlock: ASTNodeTypes; + thematicBreak: ASTNodeTypes; + text: ASTNodeTypes; + break: ASTNodeTypes; + emphasis: ASTNodeTypes; + strong: ASTNodeTypes; + html: ASTNodeTypes; + link: ASTNodeTypes; + image: ASTNodeTypes; + inlineCode: ASTNodeTypes; + delete: ASTNodeTypes; + yaml: string; + table: string; + tableRow: string; + tableCell: string; + linkReference: string; + imageReference: string; + definition: string; + /** + * @deprecated + */ + ReferenceDef: ASTNodeTypes; +}; diff --git a/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.js b/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.js new file mode 100644 index 000000000..40295ff72 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.js @@ -0,0 +1,39 @@ +// LICENSE : MIT +"use strict"; +import { ASTNodeTypes } from "@textlint/ast-node-types"; +export var SyntaxMap = { + root: ASTNodeTypes.Document, + paragraph: ASTNodeTypes.Paragraph, + blockquote: ASTNodeTypes.BlockQuote, + listItem: ASTNodeTypes.ListItem, + list: ASTNodeTypes.List, + Bullet: "Bullet", + heading: ASTNodeTypes.Header, + code: ASTNodeTypes.CodeBlock, + HtmlBlock: ASTNodeTypes.HtmlBlock, + thematicBreak: ASTNodeTypes.HorizontalRule, + // inline block + text: ASTNodeTypes.Str, + break: ASTNodeTypes.Break, + emphasis: ASTNodeTypes.Emphasis, + strong: ASTNodeTypes.Strong, + html: ASTNodeTypes.Html, + link: ASTNodeTypes.Link, + image: ASTNodeTypes.Image, + inlineCode: ASTNodeTypes.Code, + delete: ASTNodeTypes.Delete, + // remark(markdown) extension + // Following type is not in @textlint/ast-node-types + yaml: "Yaml", + table: "Table", + tableRow: "TableRow", + tableCell: "TableCell", + linkReference: "LinkReference", + imageReference: "ImageReference", + definition: "Definition", + /** + * @deprecated + */ + ReferenceDef: ASTNodeTypes.ReferenceDef +}; +//# sourceMappingURL=markdown-syntax-map.js.map \ No newline at end of file diff --git a/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.js.map b/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.js.map new file mode 100644 index 000000000..529257354 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/module/mapping/markdown-syntax-map.js.map @@ -0,0 +1 @@ +{"version":3,"file":"markdown-syntax-map.js","sourceRoot":"","sources":["../../src/mapping/markdown-syntax-map.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,IAAM,SAAS,GAAG;IACrB,IAAI,EAAE,YAAY,CAAC,QAAQ;IAC3B,SAAS,EAAE,YAAY,CAAC,SAAS;IACjC,UAAU,EAAE,YAAY,CAAC,UAAU;IACnC,QAAQ,EAAE,YAAY,CAAC,QAAQ;IAC/B,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,YAAY,CAAC,MAAM;IAC5B,IAAI,EAAE,YAAY,CAAC,SAAS;IAC5B,SAAS,EAAE,YAAY,CAAC,SAAS;IACjC,aAAa,EAAE,YAAY,CAAC,cAAc;IAC1C,eAAe;IACf,IAAI,EAAE,YAAY,CAAC,GAAG;IACtB,KAAK,EAAE,YAAY,CAAC,KAAK;IACzB,QAAQ,EAAE,YAAY,CAAC,QAAQ;IAC/B,MAAM,EAAE,YAAY,CAAC,MAAM;IAC3B,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,KAAK,EAAE,YAAY,CAAC,KAAK;IACzB,UAAU,EAAE,YAAY,CAAC,IAAI;IAC7B,MAAM,EAAE,YAAY,CAAC,MAAM;IAC3B,6BAA6B;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,UAAU,EAAE,YAAY;IACxB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC,YAAY;CAC1C,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/markdown-to-ast/package.json b/node_modules/@textlint/markdown-to-ast/package.json new file mode 100644 index 000000000..f748e1583 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/package.json @@ -0,0 +1,65 @@ +{ + "name": "@textlint/markdown-to-ast", + "version": "6.3.5", + "description": "Parse Markdown to AST with location info.", + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/markdown-to-ast/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "module": "./module/index.js", + "types": "lib/index.d.ts", + "directories": { + "test": "test/" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "example:build": "browserify example/js/index.js -o example/app/app.js", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.{js,ts}\"", + "updateSnapshot": "npm run build && node tools/update-fixtures.js", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "debug": "^4.3.1", + "remark-frontmatter": "^1.3.3", + "remark-parse": "^5.0.0", + "structured-source": "^3.0.2", + "traverse": "^0.6.6", + "unified": "^6.2.0" + }, + "devDependencies": { + "@textlint/ast-tester": "^2.3.5", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "@types/structured-source": "^3.0.0", + "@types/traverse": "^0.6.32", + "browserify": "^16.5.2", + "cross-env": "^7.0.3", + "mkdirp": "^1.0.4", + "mocha": "^8.4.0", + "power-assert": "^1.6.1", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/markdown-to-ast/src/index.ts b/node_modules/@textlint/markdown-to-ast/src/index.ts new file mode 100644 index 000000000..466ce71e7 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/src/index.ts @@ -0,0 +1,60 @@ +// LICENSE : MIT +"use strict"; +import { SyntaxMap } from "./mapping/markdown-syntax-map"; +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +import traverse from "traverse"; +import StructuredSource from "structured-source"; +import debug0 from "debug"; +// @ts-ignore +import unified from "unified"; +// @ts-ignore +import remarkParse from "remark-parse"; +// @ts-ignore +import frontmatter from "remark-frontmatter"; +const debug = debug0("@textlint/markdown-to-ast"); +const remark = unified().use(remarkParse).use(frontmatter, ["yaml"]); + +export { ASTNodeTypes as Syntax }; + +/** + * parse markdown text and return ast mapped location info. + * @param {string} text + * @returns {TxtNode} + */ +export function parse(text: string): T { + const ast = remark.parse(text); + const src = new StructuredSource(text); + traverse(ast).forEach(function (node: TxtNode) { + // eslint-disable-next-line no-invalid-this + if (this.notLeaf) { + if (node.type) { + const replacedType = SyntaxMap[node.type as keyof typeof SyntaxMap]; + if (!replacedType) { + debug(`replacedType : ${replacedType} , node.type: ${node.type}`); + } else { + node.type = replacedType; + } + } + // map `range`, `loc` and `raw` to node + if (node.position) { + const position = node.position; + const positionCompensated = { + start: { line: position.start.line, column: Math.max(position.start.column - 1, 0) }, + end: { line: position.end.line, column: Math.max(position.end.column - 1, 0) } + }; + const range = src.locationToRange(positionCompensated); + node.loc = positionCompensated; + node.range = range; + node.raw = text.slice(range[0], range[1]); + // Compatible for https://github.com/wooorm/unist, but hidden + Object.defineProperty(node, "position", { + enumerable: false, + configurable: false, + writable: false, + value: position + }); + } + } + }); + return ast; +} diff --git a/node_modules/@textlint/markdown-to-ast/src/mapping/markdown-syntax-map.ts b/node_modules/@textlint/markdown-to-ast/src/mapping/markdown-syntax-map.ts new file mode 100644 index 000000000..97a5cc164 --- /dev/null +++ b/node_modules/@textlint/markdown-to-ast/src/mapping/markdown-syntax-map.ts @@ -0,0 +1,39 @@ +// LICENSE : MIT +"use strict"; +import { ASTNodeTypes } from "@textlint/ast-node-types"; + +export const SyntaxMap = { + root: ASTNodeTypes.Document, + paragraph: ASTNodeTypes.Paragraph, + blockquote: ASTNodeTypes.BlockQuote, + listItem: ASTNodeTypes.ListItem, + list: ASTNodeTypes.List, + Bullet: "Bullet", // no need? + heading: ASTNodeTypes.Header, + code: ASTNodeTypes.CodeBlock, + HtmlBlock: ASTNodeTypes.HtmlBlock, + thematicBreak: ASTNodeTypes.HorizontalRule, + // inline block + text: ASTNodeTypes.Str, + break: ASTNodeTypes.Break, + emphasis: ASTNodeTypes.Emphasis, + strong: ASTNodeTypes.Strong, + html: ASTNodeTypes.Html, + link: ASTNodeTypes.Link, + image: ASTNodeTypes.Image, + inlineCode: ASTNodeTypes.Code, + delete: ASTNodeTypes.Delete, + // remark(markdown) extension + // Following type is not in @textlint/ast-node-types + yaml: "Yaml", + table: "Table", + tableRow: "TableRow", + tableCell: "TableCell", + linkReference: "LinkReference", + imageReference: "ImageReference", + definition: "Definition", + /** + * @deprecated + */ + ReferenceDef: ASTNodeTypes.ReferenceDef +}; diff --git a/node_modules/@textlint/module-interop/CHANGELOG.md b/node_modules/@textlint/module-interop/CHANGELOG.md new file mode 100644 index 000000000..a5fda7383 --- /dev/null +++ b/node_modules/@textlint/module-interop/CHANGELOG.md @@ -0,0 +1,271 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [1.2.5](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.2.4...@textlint/module-interop@1.2.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/module-interop + + + + + +## [1.2.4](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.2.3...@textlint/module-interop@1.2.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/module-interop + + + + + + +## [1.2.3](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.2.2...@textlint/module-interop@1.2.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [1.2.2](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.2.1...@textlint/module-interop@1.2.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [1.2.1](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.4...@textlint/module-interop@1.2.1) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [1.2.0](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.4...@textlint/module-interop@1.2.0) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [1.1.5](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.4...@textlint/module-interop@1.1.5) (2020-12-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [1.1.4](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.3...@textlint/module-interop@1.1.4) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [1.1.3](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.2...@textlint/module-interop@1.1.3) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [1.1.2](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.1...@textlint/module-interop@1.1.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [1.1.1](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.1.0...@textlint/module-interop@1.1.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [1.1.0](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.0.2...@textlint/module-interop@1.1.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [1.0.2](https://github.com/textlint/textlint/compare/@textlint/module-interop@1.0.1...@textlint/module-interop@1.0.2) (2019-10-14) + +**Note:** Version bump only for package @textlint/module-interop + + + + + + +## 1.0.1 (2019-07-20) + + +### Features + +* **module-interop:** add [@textlint](https://github.com/textlint)/module-interop ([d9895e4](https://github.com/textlint/textlint/commit/d9895e4)) diff --git a/node_modules/@textlint/module-interop/LICENSE b/node_modules/@textlint/module-interop/LICENSE new file mode 100644 index 000000000..add9e8e8b --- /dev/null +++ b/node_modules/@textlint/module-interop/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2019 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/module-interop/README.md b/node_modules/@textlint/module-interop/README.md new file mode 100644 index 000000000..08e1b8c4b --- /dev/null +++ b/node_modules/@textlint/module-interop/README.md @@ -0,0 +1,94 @@ +# @textlint/module-interop + +ECMAScript module interop library. + +import `.default` from ES module or CommonJS module. + +`example.mjs` +```ts +const value = 42; + +export default value; +``` + +```ts +import {moduleInterop} from "@textlint/module-interop"; + +// Doesn't matter if `require` uses `module.exports` or ES Module `export` +const value = moduleInterop(require("./example")); +console.log(value); // 42 +``` + +**Notes**: This library is for common use. +This library is not depended on textlint. + +## Why it is needed? + +Some rule modules use `export default`. + +If you creating rule preset for textlint, you should wrap the required result. + +```js +const rule = require("textlint-rule-es-export-default-example"); +console.log(rule); // { default: ruleImplantation } +``` + +This library resolve this issue by `moduleInterop` function. + +```js +const {moduleInterop} = require("@textlint/module-interop"); +const rule = moduleInterop(require("textlint-rule-es-export-default-example")); +console.log(rule); // ruleImplantation +`````` + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/module-interop + +## Usage + +```ts +const {moduleInterop} = require("@textlint/module-interop"); +const rule = moduleInterop(require("textlint-rule-example")); // rule implementation +``` + +## Related + +- [leebenson/module-interop: ES6 module interop](https://github.com/leebenson/module-interop) + - Same purpose, but it has different API +- [izaakschroeder/interop-require: Require babel ES6 modules from node land.](https://github.com/izaakschroeder/interop-require) + - Same function, but it prevent static analyzer + - It is just dynamic `require` that prevent static analyzer like [Asset Relocator Loader for Webpack](https://github.com/zeit/webpack-asset-relocator-loader). + +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + npm test + +## Contributing + +Pull requests and stars are always welcome. + +For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/module-interop/module/index.d.ts b/node_modules/@textlint/module-interop/module/index.d.ts new file mode 100644 index 000000000..9dc582596 --- /dev/null +++ b/node_modules/@textlint/module-interop/module/index.d.ts @@ -0,0 +1 @@ +export declare function moduleInterop(moduleExports: T): T; diff --git a/node_modules/@textlint/module-interop/module/index.js b/node_modules/@textlint/module-interop/module/index.js new file mode 100644 index 000000000..1caa68903 --- /dev/null +++ b/node_modules/@textlint/module-interop/module/index.js @@ -0,0 +1,4 @@ +export function moduleInterop(moduleExports) { + return moduleExports && moduleExports.__esModule ? moduleExports.default : moduleExports; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/module-interop/module/index.js.map b/node_modules/@textlint/module-interop/module/index.js.map new file mode 100644 index 000000000..7db89bafc --- /dev/null +++ b/node_modules/@textlint/module-interop/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAI,aAAgB;IAC7C,OAAO,aAAa,IAAK,aAAqB,CAAC,UAAU,CAAC,CAAC,CAAE,aAAqB,CAAC,OAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;AAChH,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/module-interop/package.json b/node_modules/@textlint/module-interop/package.json new file mode 100644 index 000000000..e0c42e177 --- /dev/null +++ b/node_modules/@textlint/module-interop/package.json @@ -0,0 +1,63 @@ +{ + "name": "@textlint/module-interop", + "version": "1.2.5", + "description": "ECMAScript module interop library", + "keywords": [ + "commonjs", + "default", + "es", + "import", + "module" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/module-interop/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "module": "./module/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib", + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -b --watch" + }, + "prettier": { + "printWidth": 120, + "singleQuote": false, + "tabWidth": 4 + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "prettier": "^2.1.1", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/module-interop/src/index.ts b/node_modules/@textlint/module-interop/src/index.ts new file mode 100644 index 000000000..12c8824da --- /dev/null +++ b/node_modules/@textlint/module-interop/src/index.ts @@ -0,0 +1,3 @@ +export function moduleInterop(moduleExports: T): T { + return moduleExports && (moduleExports as any).__esModule ? (moduleExports as any).default! : moduleExports; +} diff --git a/node_modules/@textlint/regexp-string-matcher/LICENSE b/node_modules/@textlint/regexp-string-matcher/LICENSE new file mode 100644 index 000000000..f9d0172e9 --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/regexp-string-matcher/README.md b/node_modules/@textlint/regexp-string-matcher/README.md new file mode 100644 index 000000000..af4d9aa46 --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/README.md @@ -0,0 +1,246 @@ +# @textlint/regexp-string-matcher [![Actions Status: test](https://github.com/textlint/regexp-string-matcher/workflows/test/badge.svg)](https://github.com/textlint/regexp-string-matcher/actions?query=workflow%3A"test") + +Regexp-like string matcher library. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/regexp-string-matcher + +## Usage + +Interface: + +```ts +export interface matchPatternResult { + match: string; + startIndex: number; + endIndex: number; +} +/** + * Match regExpLikeStrings and return matchPatternResults + * @param text target text + * @param regExpLikeStrings an array of pattern string + */ +export declare const matchPatterns: (text: string, regExpLikeStrings: string[]) => matchPatternResult[]; +``` + +Example: + +```js +import { matchPatterns } from "@textlint/regexp-string-matcher"; +const inputText = ` +GitHub is a web-based hosting service for version control using git. +It is mostly used for computer code. +GitHub launched in 2018-04-10.`; +// RegExp like strings +const inputPatterns = [ + "git", // => /git/g + "/github/i", // => /github/ig + "/\\d{4}-\\d{2}-\\d{2}/" // => /\d{4}-\d{2}-\d{2}/g +]; + +const results = matchPatterns(inputText, inputPatterns); +assert.deepStrictEqual(results, [ + { match: "GitHub", startIndex: 1, endIndex: 7 }, + { match: "git", startIndex: 65, endIndex: 68 }, + { match: "GitHub", startIndex: 107, endIndex: 113 }, + { match: "2018-04-10", startIndex: 126, endIndex: 136 } +]); +``` + +## RegExp-like String + +This library aim to represent RegExp in JSON and use it for ignoring words. +`g`(global) flag is added by default, Because ignoring words is always global in a document. + + +| Input | Ouput | Note| +| ---- | ---| --- | +| `"str"` | `/str/g`| convert string to regexp with global | +| `"/str/"` | `/str/g`| | +| `"/str/g"` | `/str/g`| Duplicated `g` is just ignored | +| `"/str/i"` | `/str/ig`| | +| `"/str/u"` | `/str/ug`| | +| `"/str/m"` | `/str/mg`| | +| `"/str/y"` | `/str/yg`| | +| ---|---| --- | +| `"/\\d+/"` | `/\d+/g`| You should escape meta character like `\d` | + +:warning: You should escape meta character like `\d` in RegExp-like string. + +For example, If you want to write `\w`(any word) in RegExp-like string, you should escape `\w` to `\\w`. + +- [Regular Expressions - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_special_characters) + +Text: + +``` +This is a pen. +``` + +RegExp-like String: + +```json +[ + "/a \\w+/" +] +``` + +Results: + +``` +[ { match: 'a pen', startIndex: 8, endIndex: 13 } ] +``` + +## Examples + +### string + +**text:** +```markdown +GitHub is a web-based hosting service for version control using git. +It is mostly used for computer code. +GitHub launched in 2018-04-10. +``` + +**pattern:** + +```json +[ + "GitHub" +] +``` + +**results:** 2 hits +```markdown +**GitHub** is a web-based hosting service for version control using git. +It is mostly used for computer code. +**GitHub** launched in 2018-04-10. +``` + +### Ignore Case match + +**text:** +```markdown +GitHub is a web-based hosting service for version control using git. +It is mostly used for computer code. +GitHub launched in 2018-04-10. +``` + +**pattern:** + +```json +[ + "/git/i" +] +``` + +**results:**: 3 hits +```markdown +**Git**Hub is a web-based hosting service for version control using **git**. +It is mostly used for computer code. +**Git**Hub launched in 2018-04-10. +``` + +### Special character + +You should escape special charactor like `\d` in RegExp-like string. + +**text:** +```markdown +GitHub is a web-based hosting service for version control using git. +It is mostly used for computer code. +GitHub launched in 2018-04-10. +``` + +**pattern:** +```json +[ + "/\\d{4}-\\d{2}-\\d{2}/" +] +``` + +**results:**: 1 hit +```markdown +GitHub is a web-based hosting service for version control using git. +It is mostly used for computer code. +GitHub launched in **2018-04-10**. +``` + +### Multi-line + + +**text:** +```markdown +===START=== +1st inline text. +===END=== + +===START=== +2nd inline text. +===END=== +``` + +**pattern:** +```json +[ + "/===START===[\\s\\S]*?===END===/m" +] + +``` + +**results:**: 2 hits +```markdown +**===START=== +1st inline text. +===END===** + +**===START=== +2nd inline text. +===END===** +``` + + +For more details, see [test/snapshots](./test/snapshots) + +## Changelog + +See [Releases page](https://github.com/textlint/regexp-string-matcher/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + npm i -d && npm test + +### How to add snapshot tests? + +1. Create new dir to `./snapshots//` +2. Add `input.txt` and `input-patterns.json` +3. Run `npm run test:updateSnapshot` +4. You should verify the output results manually +5. Run `npm test` and pass it +5. Commit it + +## Contributing + +Pull requests and stars are always welcome. + +For bugs and feature requests, [please create an issue](https://github.com/textlint/regexp-string-matcher/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/index.d.ts b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/index.d.ts new file mode 100644 index 000000000..7d34edc7c --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/index.d.ts @@ -0,0 +1,18 @@ +/** +Escape RegExp special characters. + +You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. + +@example +``` +import escapeStringRegexp = require('escape-string-regexp'); + +const escapedString = escapeStringRegexp('How much $ for a 🦄?'); +//=> 'How much \\$ for a 🦄\\?' + +new RegExp(escapedString); +``` +*/ +declare const escapeStringRegexp: (string: string) => string; + +export = escapeStringRegexp; diff --git a/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/index.js b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/index.js new file mode 100644 index 000000000..58217a4ef --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/index.js @@ -0,0 +1,11 @@ +'use strict'; + +const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g; + +module.exports = string => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + return string.replace(matchOperatorsRegex, '\\$&'); +}; diff --git a/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/license b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/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/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/package.json b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/package.json new file mode 100644 index 000000000..2e343cfa0 --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/package.json @@ -0,0 +1,43 @@ +{ + "name": "escape-string-regexp", + "version": "2.0.0", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": "sindresorhus/escape-string-regexp", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Boy Nicolai Appelman (jbna.nl)" + ], + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "escape", + "regex", + "regexp", + "re", + "regular", + "expression", + "string", + "str", + "special", + "characters" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/readme.md b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/readme.md new file mode 100644 index 000000000..157472b7a --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp/readme.md @@ -0,0 +1,29 @@ +# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) + +> Escape RegExp special characters + + +## Install + +``` +$ npm install escape-string-regexp +``` + + +## Usage + +```js +const escapeStringRegexp = require('escape-string-regexp'); + +const escapedString = escapeStringRegexp('How much $ for a 🦄?'); +//=> 'How much \\$ for a 🦄\\?' + +new RegExp(escapedString); +``` + +You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/@textlint/regexp-string-matcher/package.json b/node_modules/@textlint/regexp-string-matcher/package.json new file mode 100644 index 000000000..a79e131ee --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/package.json @@ -0,0 +1,79 @@ +{ + "name": "@textlint/regexp-string-matcher", + "version": "1.1.1", + "description": "Regexp-like string matcher.", + "keywords": [ + "helper", + "regexp", + "util" + ], + "homepage": "https://github.com/textlint/regexp-string-matcher", + "bugs": { + "url": "https://github.com/textlint/regexp-string-matcher/issues" + }, + "license": "MIT", + "author": "azu", + "files": [ + "bin/", + "lib/", + "src/" + ], + "main": "lib/regexp-string-matcher.js", + "types": "lib/regexp-string-matcher.d.ts", + "directories": { + "lib": "lib", + "test": "test" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/regexp-string-matcher.git" + }, + "scripts": { + "build": "cross-env NODE_ENV=production tsc -p .", + "precommit": "lint-staged", + "postcommit": "git reset", + "prepublish": "npm run --if-present build", + "test:updateSnapshot": "cross-env UPDATE_SNAPSHOT=1 npm test", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -p . --watch", + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", + "prepare": "git config --local core.hooksPath .githooks" + }, + "prettier": { + "singleQuote": false, + "printWidth": 120, + "tabWidth": 4, + "trailingComma": "none" + }, + "devDependencies": { + "@types/lodash.sortby": "^4.7.3", + "@types/lodash.uniq": "^4.5.3", + "@types/lodash.uniqwith": "^4.5.3", + "@types/mocha": "^9.1.1", + "@types/node": "^17.0.34", + "@types/to-regex": "^3.0.0", + "cross-env": "^7.0.3", + "lint-staged": "^12.4.1", + "mocha": "^10.0.0", + "prettier": "^2.6.2", + "ts-node": "^10.7.0", + "ts-node-test-register": "^10.0.0", + "typescript": "^4.6.4" + }, + "publishConfig": { + "access": "public" + }, + "lint-staged": { + "*.{js,jsx,ts,tsx,css}": [ + "prettier --write" + ] + }, + "dependencies": { + "escape-string-regexp": "^2.0.0", + "execall": "^2.0.0", + "lodash.sortby": "^4.7.0", + "lodash.uniq": "^4.5.0", + "lodash.uniqwith": "^4.5.0", + "to-regex": "^3.0.2" + } +} diff --git a/node_modules/@textlint/regexp-string-matcher/src/regexp-parse.ts b/node_modules/@textlint/regexp-string-matcher/src/regexp-parse.ts new file mode 100644 index 000000000..e78f11f19 --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/src/regexp-parse.ts @@ -0,0 +1,14 @@ +const REGEXP_LITERAL_PATTERN = /^\/(.*)\/([guimy]*)$/; +export const parseRegExpString = (str: string): { source: string; flagString: string } | null => { + const result = str.match(REGEXP_LITERAL_PATTERN); + if (!result) { + return null; + } + return { + source: result[1], + flagString: result[2] + }; +}; +export const isRegExpString = (str: string): boolean => { + return REGEXP_LITERAL_PATTERN.test(str); +}; diff --git a/node_modules/@textlint/regexp-string-matcher/src/regexp-string-matcher.ts b/node_modules/@textlint/regexp-string-matcher/src/regexp-string-matcher.ts new file mode 100644 index 000000000..c2bdcd1fe --- /dev/null +++ b/node_modules/@textlint/regexp-string-matcher/src/regexp-string-matcher.ts @@ -0,0 +1,71 @@ +import uniq from "lodash.uniq"; +import uniqWith from "lodash.uniqwith"; +import sortBy from "lodash.sortby"; +import escapeStringRegexp from "escape-string-regexp"; +import { isRegExpString, parseRegExpString } from "./regexp-parse"; + +import execall from "execall"; +import toRegex from "to-regex"; + +const DEFAULT_FLAGS = "g"; + +const defaultFlags = (flagsString: string) => { + if (flagsString.length === 0) { + return DEFAULT_FLAGS; + } + return uniq((flagsString + DEFAULT_FLAGS).split("")).join(""); +}; + +export interface matchPatternResult { + match: string; + startIndex: number; + endIndex: number; +} + +export const createRegExp = (patternString: string, defaultFlag: string = DEFAULT_FLAGS): RegExp => { + if (patternString.length === 0) { + throw new Error("Empty string can not handled"); + } + if (isRegExpString(patternString)) { + const regExpStructure = parseRegExpString(patternString); + if (regExpStructure) { + return toRegex(regExpStructure.source, { + flags: defaultFlags(regExpStructure.flagString), + contains: true + }); + } + throw new Error(`"${patternString}" can not parse as RegExp.`); + } else { + return new RegExp(escapeStringRegexp(patternString), defaultFlag); + } +}; + +const isEqualMatchPatternResult = (a: matchPatternResult, b: matchPatternResult): boolean => { + return a.startIndex === b.startIndex && a.endIndex === b.endIndex && a.match === b.match; +}; +/** + * Match regExpLikeStrings and return matchPatternResults + * @param text target text + * @param regExpLikeStrings an array of pattern string + */ +export const matchPatterns = (text: string, regExpLikeStrings: string[]): matchPatternResult[] => { + const matchPatternResults: matchPatternResult[] = []; + regExpLikeStrings + .map((patternString) => { + return createRegExp(patternString); + }) + .forEach((regExp) => { + const execallResults = execall(regExp, text); + execallResults.forEach((result) => { + const match = result.match; + const index = result.index; + matchPatternResults.push({ + match: match, + startIndex: index, + endIndex: index + match.length + }); + }); + }); + const uniqResults = uniqWith(matchPatternResults, isEqualMatchPatternResult); + return sortBy(uniqResults, ["startIndex", "endIndex"]); +}; diff --git a/node_modules/@textlint/source-code-fixer/CHANGELOG.md b/node_modules/@textlint/source-code-fixer/CHANGELOG.md new file mode 100644 index 000000000..6edd44e6d --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/CHANGELOG.md @@ -0,0 +1,84 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.4.5](https://github.com/textlint/textlint/compare/@textlint/source-code-fixer@3.4.4...@textlint/source-code-fixer@3.4.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/source-code-fixer + + + + + +## [3.4.4](https://github.com/textlint/textlint/compare/@textlint/source-code-fixer@3.4.3...@textlint/source-code-fixer@3.4.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/source-code-fixer + + + + + + +## [3.4.3](https://github.com/textlint/textlint/compare/@textlint/source-code-fixer@3.4.2...@textlint/source-code-fixer@3.4.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [3.4.2](https://github.com/textlint/textlint/compare/@textlint/source-code-fixer@3.4.1...@textlint/source-code-fixer@3.4.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## 3.4.1 (2021-01-22) + + +### Bug Fixes + +* **source-code-fixer:** add src to files ([252b6cb](https://github.com/textlint/textlint/commit/252b6cb)) + + +### Chores + +* **deps:** update workspaces-to-typescript-project-references ([9fcfc0d](https://github.com/textlint/textlint/commit/9fcfc0d)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# 3.4.0 (2021-01-22) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) diff --git a/node_modules/@textlint/source-code-fixer/LICENSE b/node_modules/@textlint/source-code-fixer/LICENSE new file mode 100644 index 000000000..887014d58 --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2021 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/source-code-fixer/README.md b/node_modules/@textlint/source-code-fixer/README.md new file mode 100644 index 000000000..a79660528 --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/README.md @@ -0,0 +1,56 @@ +# @textlint/source-code-fixer + +Apply @textlint/kernel lint result to text. + +Almost user just use `@textlint/kernel`'s `fixText` API instead of This package. + +This package provide primitive functions for @textlint/kernel. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/source-code-fixer + +## Usage + +```ts +import { TextlintKernel } from "@textlint/kernel"; +import { applyFixesToText } from "@textlint/source-code-fixer"; +const kernel = new TextlintKernel(); +const text = "text"; +const result = kernel.lintText(text, { + ... +}); +const fixedOutput = applyFixesToText(text, result.messages); +``` + +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + npm test + +## Contributing + +Pull requests and stars are always welcome. + +For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- azu: [GitHub](https://github.com/azu), [Twitter](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/source-code-fixer/module/index.d.ts b/node_modules/@textlint/source-code-fixer/module/index.d.ts new file mode 100644 index 000000000..dcc2098aa --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/module/index.d.ts @@ -0,0 +1 @@ +export { applyFixesToText, applyFixesToSourceCode, revertSourceCode, SimpleTextSourceCode, SourceCodeFixerResult } from "./source-code-fixer"; diff --git a/node_modules/@textlint/source-code-fixer/module/index.js b/node_modules/@textlint/source-code-fixer/module/index.js new file mode 100644 index 000000000..5c7c84653 --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/module/index.js @@ -0,0 +1,2 @@ +export { applyFixesToText, applyFixesToSourceCode, revertSourceCode } from "./source-code-fixer"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/source-code-fixer/module/index.js.map b/node_modules/@textlint/source-code-fixer/module/index.js.map new file mode 100644 index 000000000..63d88722b --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAGnB,MAAM,qBAAqB,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/source-code-fixer/module/source-code-fixer.d.ts b/node_modules/@textlint/source-code-fixer/module/source-code-fixer.d.ts new file mode 100644 index 000000000..06d0d9be9 --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/module/source-code-fixer.d.ts @@ -0,0 +1,35 @@ +import type { TextlintMessage } from "@textlint/types"; +/** + * It is limited version of TextlintSourceCode + */ +export declare type SimpleTextSourceCode = { + text: string; + hasBOM: boolean; +}; +export declare type SourceCodeFixerResult = { + fixed: boolean; + messages: TextlintMessage[]; + applyingMessages: TextlintMessage[]; + remainingMessages: TextlintMessage[]; + output: string; +}; +/** + * Applies the fixes to text and return string + * use applyFixes If you want to use primitive function, + */ +export declare function applyFixesToText(text: string, messages: TextlintMessage[]): string; +/** + * Applies the fixes specified by the messages to the given text. Tries to be + * smart about the fixes and won't apply fixes over the same area in the text. + * @param sourceCode The source code to apply the changes to. + * @param messages The array of messages reported by textlint. + * @returns An object containing the fixed text and any unfixed messages. + */ +export declare function applyFixesToSourceCode(sourceCode: SimpleTextSourceCode, messages: TextlintMessage[]): SourceCodeFixerResult; +/** + * revert text using applyingMessages + * @param sourceCode The source code to apply the changes to. + * @param applyingMessages The array of TextLintMessage reported by SourceCodeFixer#applyFixes + * @returns An object containing the fixed text and any unfixed messages. + */ +export declare function revertSourceCode(sourceCode: SimpleTextSourceCode, applyingMessages: TextlintMessage[]): string; diff --git a/node_modules/@textlint/source-code-fixer/module/source-code-fixer.js b/node_modules/@textlint/source-code-fixer/module/source-code-fixer.js new file mode 100644 index 000000000..4c427f862 --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/module/source-code-fixer.js @@ -0,0 +1,135 @@ +import _debug from "debug"; +var debug = _debug("textlint:source-code-fixer"); +var BOM = "\uFEFF"; +/** + * Compares items in a messages array by line and column. + * @param {TextlintMessage} a The first message. + * @param {TextlintMessage} b The second message. + * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. + * @private + */ +function compareMessagesByLocation(a, b) { + var lineDiff = a.line - b.line; + if (lineDiff === 0) { + return a.column - b.column; + } + else { + return lineDiff; + } +} +function clone(object) { + return JSON.parse(JSON.stringify(object)); +} +/** + * Applies the fixes to text and return string + * use applyFixes If you want to use primitive function, + */ +export function applyFixesToText(text, messages) { + var hasBOM = text.charCodeAt(0) === 0xfeff; + return applyFixesToSourceCode({ + text: text, + hasBOM: hasBOM + }, messages).output; +} +/** + * Applies the fixes specified by the messages to the given text. Tries to be + * smart about the fixes and won't apply fixes over the same area in the text. + * @param sourceCode The source code to apply the changes to. + * @param messages The array of messages reported by textlint. + * @returns An object containing the fixed text and any unfixed messages. + */ +export function applyFixesToSourceCode(sourceCode, messages) { + debug("Applying fixes"); + var text = sourceCode.text; + // As as result, show diff + var remainingMessages = []; + var applyingMessages = []; + var cloneMessages = messages.slice(); + var fixes = []; + var lastFixPos = text.length; + var prefix = sourceCode.hasBOM ? BOM : ""; + cloneMessages.forEach(function (problem) { + if (problem && problem.fix !== undefined) { + fixes.push(problem); + } + else { + remainingMessages.push(problem); + } + }); + if (fixes.length) { + debug("Found fixes to apply"); + // sort in reverse order of occurrence + fixes.sort(function (a, b) { + return b.fix.range[1] - a.fix.range[1] || b.fix.range[0] - a.fix.range[0]; + }); + // split into array of characters for easier manipulation + var chars_1 = text.split(""); // range is code-unit based + fixes.forEach(function (problem) { + // pickup fix range + var fix = problem.fix; + var start = fix.range[0]; + var end = fix.range[1]; + var insertionText = fix.text; + if (end <= lastFixPos) { + if (start < 0) { + // Remove BOM. + prefix = ""; + start = 0; + } + if (start === 0 && insertionText[0] === BOM) { + // Set BOM. + prefix = BOM; + insertionText = insertionText.slice(1); + } + var replacedChars = chars_1.splice(start, end - start, insertionText); + lastFixPos = start; + var copyOfMessage = clone(problem); + copyOfMessage.fix = { + range: [start, start + insertionText.length], + text: replacedChars.join("") + }; + applyingMessages.push(copyOfMessage); + } + else { + remainingMessages.push(problem); + } + }); + return { + fixed: true, + messages: cloneMessages, + applyingMessages: applyingMessages.reverse(), + remainingMessages: remainingMessages.sort(compareMessagesByLocation), + output: prefix + chars_1.join("") + }; + } + else { + debug("No fixes to apply"); + return { + fixed: false, + messages: cloneMessages, + applyingMessages: applyingMessages, + remainingMessages: remainingMessages, + output: prefix + text + }; + } +} +/** + * revert text using applyingMessages + * @param sourceCode The source code to apply the changes to. + * @param applyingMessages The array of TextLintMessage reported by SourceCodeFixer#applyFixes + * @returns An object containing the fixed text and any unfixed messages. + */ +export function revertSourceCode(sourceCode, applyingMessages) { + debug("Restore applied fixes"); + var text = sourceCode.text; + applyingMessages.forEach(function (message) { + var newSource = { + text: text, + hasBOM: sourceCode.hasBOM + }; + var result = applyFixesToSourceCode(newSource, [message]); + text = result.output; + }); + return text; +} +//# sourceMappingURL=source-code-fixer.js.map \ No newline at end of file diff --git a/node_modules/@textlint/source-code-fixer/module/source-code-fixer.js.map b/node_modules/@textlint/source-code-fixer/module/source-code-fixer.js.map new file mode 100644 index 000000000..120232b7a --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/module/source-code-fixer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"source-code-fixer.js","sourceRoot":"","sources":["../src/source-code-fixer.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,IAAM,KAAK,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAEnD,IAAM,GAAG,GAAG,QAAQ,CAAC;AAErB;;;;;;GAMG;AACH,SAAS,yBAAyB,CAAC,CAAkB,EAAE,CAAkB;IACrE,IAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;IAEjC,IAAI,QAAQ,KAAK,CAAC,EAAE;QAChB,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;KAC9B;SAAM;QACH,OAAO,QAAQ,CAAC;KACnB;AACL,CAAC;AAED,SAAS,KAAK,CAAqC,MAAS;IACxD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9C,CAAC;AAqBD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,QAA2B;IACtE,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;IAC7C,OAAO,sBAAsB,CACzB;QACI,IAAI,MAAA;QACJ,MAAM,QAAA;KACT,EACD,QAAQ,CACX,CAAC,MAAM,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAClC,UAAgC,EAChC,QAA2B;IAE3B,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxB,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC7B,0BAA0B;IAC1B,IAAM,iBAAiB,GAAsB,EAAE,CAAC;IAChD,IAAM,gBAAgB,GAAsB,EAAE,CAAC;IAC/C,IAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvC,IAAM,KAAK,GAA6B,EAAE,CAAC;IAC3C,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,aAAa,CAAC,OAAO,CAAC,UAAC,OAAO;QAC1B,IAAI,OAAO,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE;YACtC,KAAK,CAAC,IAAI,CAAC,OAAiC,CAAC,CAAC;SACjD;aAAM;YACH,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACnC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,EAAE;QACd,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAE9B,sCAAsC;QACtC,KAAK,CAAC,IAAI,CAAC,UAAC,CAAyB,EAAE,CAAyB;YAC5D,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;QAEH,yDAAyD;QACzD,IAAM,OAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,2BAA2B;QAEzD,KAAK,CAAC,OAAO,CAAC,UAAC,OAAO;YAClB,mBAAmB;YACnB,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YACxB,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACzB,IAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC;YAE7B,IAAI,GAAG,IAAI,UAAU,EAAE;gBACnB,IAAI,KAAK,GAAG,CAAC,EAAE;oBACX,cAAc;oBACd,MAAM,GAAG,EAAE,CAAC;oBACZ,KAAK,GAAG,CAAC,CAAC;iBACb;gBACD,IAAI,KAAK,KAAK,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;oBACzC,WAAW;oBACX,MAAM,GAAG,GAAG,CAAC;oBACb,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAC1C;gBAED,IAAM,aAAa,GAAG,OAAK,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,EAAE,aAAa,CAAC,CAAC;gBACtE,UAAU,GAAG,KAAK,CAAC;gBACnB,IAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;gBACrC,aAAa,CAAC,GAAG,GAAG;oBAChB,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC;oBAC5C,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC/B,CAAC;gBACF,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACxC;iBAAM;gBACH,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACnC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,aAAa;YACvB,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,EAAE;YAC5C,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,CAAC,yBAAyB,CAAC;YACpE,MAAM,EAAE,MAAM,GAAG,OAAK,CAAC,IAAI,CAAC,EAAE,CAAC;SAClC,CAAC;KACL;SAAM;QACH,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,OAAO;YACH,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,aAAa;YACvB,gBAAgB,kBAAA;YAChB,iBAAiB,mBAAA;YACjB,MAAM,EAAE,MAAM,GAAG,IAAI;SACxB,CAAC;KACL;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAgC,EAAE,gBAAmC;IAClG,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC3B,gBAAgB,CAAC,OAAO,CAAC,UAAC,OAAO;QAC7B,IAAM,SAAS,GAAyB;YACpC,IAAI,MAAA;YACJ,MAAM,EAAE,UAAU,CAAC,MAAM;SAC5B,CAAC;QACF,IAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/source-code-fixer/package.json b/node_modules/@textlint/source-code-fixer/package.json new file mode 100644 index 000000000..febed7808 --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/package.json @@ -0,0 +1,66 @@ +{ + "name": "@textlint/source-code-fixer", + "version": "3.4.5", + "description": "Apply @textlint/kernel lint result to text.", + "keywords": [ + "textlint", + "kernel" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/source-code-fixer/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "sideEffects": false, + "main": "lib/index.js", + "module": "module/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib", + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublishOnly": "npm run build", + "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -p . --watch" + }, + "prettier": { + "printWidth": 120, + "singleQuote": false, + "tabWidth": 4, + "trailingComma": "none" + }, + "dependencies": { + "@textlint/types": "^1.5.5", + "debug": "^4.3.1" + }, + "devDependencies": { + "@monorepo-utils/workspaces-to-typescript-project-references": "^2.5.1", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "mocha": "^8.4.0", + "prettier": "^2.2.1", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.1.3" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/source-code-fixer/src/index.ts b/node_modules/@textlint/source-code-fixer/src/index.ts new file mode 100644 index 000000000..073597c9e --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/src/index.ts @@ -0,0 +1,7 @@ +export { + applyFixesToText, + applyFixesToSourceCode, + revertSourceCode, + SimpleTextSourceCode, + SourceCodeFixerResult +} from "./source-code-fixer"; diff --git a/node_modules/@textlint/source-code-fixer/src/source-code-fixer.ts b/node_modules/@textlint/source-code-fixer/src/source-code-fixer.ts new file mode 100644 index 000000000..a77494c6f --- /dev/null +++ b/node_modules/@textlint/source-code-fixer/src/source-code-fixer.ts @@ -0,0 +1,170 @@ +import type { TextlintMessage, TextlintMessageFixCommand } from "@textlint/types"; +import _debug from "debug"; +const debug = _debug("textlint:source-code-fixer"); + +const BOM = "\uFEFF"; + +/** + * Compares items in a messages array by line and column. + * @param {TextlintMessage} a The first message. + * @param {TextlintMessage} b The second message. + * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. + * @private + */ +function compareMessagesByLocation(a: TextlintMessage, b: TextlintMessage) { + const lineDiff = a.line - b.line; + + if (lineDiff === 0) { + return a.column - b.column; + } else { + return lineDiff; + } +} + +function clone(object: T): T { + return JSON.parse(JSON.stringify(object)); +} + +type TextLintMessageFixable = TextlintMessage & { + fix: TextlintMessageFixCommand; +}; + +/** + * It is limited version of TextlintSourceCode + */ +export type SimpleTextSourceCode = { + text: string; + hasBOM: boolean; +}; +export type SourceCodeFixerResult = { + fixed: boolean; + messages: TextlintMessage[]; // have order + applyingMessages: TextlintMessage[]; // have order + remainingMessages: TextlintMessage[]; // have not order + output: string; +}; + +/** + * Applies the fixes to text and return string + * use applyFixes If you want to use primitive function, + */ +export function applyFixesToText(text: string, messages: TextlintMessage[]): string { + const hasBOM = text.charCodeAt(0) === 0xfeff; + return applyFixesToSourceCode( + { + text, + hasBOM + }, + messages + ).output; +} + +/** + * Applies the fixes specified by the messages to the given text. Tries to be + * smart about the fixes and won't apply fixes over the same area in the text. + * @param sourceCode The source code to apply the changes to. + * @param messages The array of messages reported by textlint. + * @returns An object containing the fixed text and any unfixed messages. + */ +export function applyFixesToSourceCode( + sourceCode: SimpleTextSourceCode, + messages: TextlintMessage[] +): SourceCodeFixerResult { + debug("Applying fixes"); + const text = sourceCode.text; + // As as result, show diff + const remainingMessages: TextlintMessage[] = []; + const applyingMessages: TextlintMessage[] = []; + const cloneMessages = messages.slice(); + const fixes: TextLintMessageFixable[] = []; + let lastFixPos = text.length; + let prefix = sourceCode.hasBOM ? BOM : ""; + cloneMessages.forEach((problem) => { + if (problem && problem.fix !== undefined) { + fixes.push(problem as TextLintMessageFixable); + } else { + remainingMessages.push(problem); + } + }); + + if (fixes.length) { + debug("Found fixes to apply"); + + // sort in reverse order of occurrence + fixes.sort((a: TextLintMessageFixable, b: TextLintMessageFixable) => { + return b.fix.range[1] - a.fix.range[1] || b.fix.range[0] - a.fix.range[0]; + }); + + // split into array of characters for easier manipulation + const chars = text.split(""); // range is code-unit based + + fixes.forEach((problem) => { + // pickup fix range + const fix = problem.fix; + let start = fix.range[0]; + const end = fix.range[1]; + let insertionText = fix.text; + + if (end <= lastFixPos) { + if (start < 0) { + // Remove BOM. + prefix = ""; + start = 0; + } + if (start === 0 && insertionText[0] === BOM) { + // Set BOM. + prefix = BOM; + insertionText = insertionText.slice(1); + } + + const replacedChars = chars.splice(start, end - start, insertionText); + lastFixPos = start; + const copyOfMessage = clone(problem); + copyOfMessage.fix = { + range: [start, start + insertionText.length], + text: replacedChars.join("") + }; + applyingMessages.push(copyOfMessage); + } else { + remainingMessages.push(problem); + } + }); + + return { + fixed: true, + messages: cloneMessages, // have order + applyingMessages: applyingMessages.reverse(), // have order + remainingMessages: remainingMessages.sort(compareMessagesByLocation), // have not order + output: prefix + chars.join("") + }; + } else { + debug("No fixes to apply"); + return { + fixed: false, + messages: cloneMessages, + applyingMessages, + remainingMessages, + output: prefix + text + }; + } +} + +/** + * revert text using applyingMessages + * @param sourceCode The source code to apply the changes to. + * @param applyingMessages The array of TextLintMessage reported by SourceCodeFixer#applyFixes + * @returns An object containing the fixed text and any unfixed messages. + */ +export function revertSourceCode(sourceCode: SimpleTextSourceCode, applyingMessages: TextlintMessage[]): string { + debug("Restore applied fixes"); + let text = sourceCode.text; + applyingMessages.forEach((message) => { + const newSource: SimpleTextSourceCode = { + text, + hasBOM: sourceCode.hasBOM + }; + const result = applyFixesToSourceCode(newSource, [message]); + text = result.output; + }); + return text; +} diff --git a/node_modules/@textlint/text-to-ast/CHANGELOG.md b/node_modules/@textlint/text-to-ast/CHANGELOG.md new file mode 100644 index 000000000..c2fe532ae --- /dev/null +++ b/node_modules/@textlint/text-to-ast/CHANGELOG.md @@ -0,0 +1,381 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.3.5](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.3.4...@textlint/text-to-ast@3.3.5) (2021-05-08) + + +### Bug Fixes + +* **text-to-ast:** correct to parse CRLF empty line ([#763](https://github.com/textlint/textlint/issues/763)) ([a3288e0](https://github.com/textlint/textlint/commit/a3288e0c49bd122ff97e159d3d82bd5a4012f5ea)) + + + + + +## [3.3.4](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.3.3...@textlint/text-to-ast@3.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +## [3.3.3](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.3.2...@textlint/text-to-ast@3.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [3.3.2](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.3.1...@textlint/text-to-ast@3.3.2) (2021-02-06) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +## [3.3.1](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.4...@textlint/text-to-ast@3.3.1) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [3.3.0](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.4...@textlint/text-to-ast@3.3.0) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [3.2.5](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.4...@textlint/text-to-ast@3.2.5) (2020-12-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [3.2.4](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.3...@textlint/text-to-ast@3.2.4) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [3.2.3](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.2...@textlint/text-to-ast@3.2.3) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [3.2.2](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.1...@textlint/text-to-ast@3.2.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [3.2.1](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.2.0...@textlint/text-to-ast@3.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [3.2.0](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.7...@textlint/text-to-ast@3.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **text-to-ast:** convert to typescript ([#673](https://github.com/textlint/textlint/issues/673)) ([953eb03](https://github.com/textlint/textlint/commit/953eb03)), closes [#669](https://github.com/textlint/textlint/issues/669) [#669](https://github.com/textlint/textlint/issues/669) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [3.1.7](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.6...@textlint/text-to-ast@3.1.7) (2020-02-01) + + +### Bug Fixes + +* **text-to-ast:** support CRLF line break ([dec1b39](https://github.com/textlint/textlint/commit/dec1b39)) + + +### Chores + +* **text-to-ast:** force convert to crlf ([14673ed](https://github.com/textlint/textlint/commit/14673ed)) +* remove unused modules ([6c8bb3f](https://github.com/textlint/textlint/commit/6c8bb3f)) +* **deps:** remove string.prototype.matchall ([9aa5de3](https://github.com/textlint/textlint/commit/9aa5de3)) + + +### Tests + +* **text-to-ast:** add \r\n test case ([c853e6f](https://github.com/textlint/textlint/commit/c853e6f)) +* **text-to-ast:** support empty text ([6195e85](https://github.com/textlint/textlint/commit/6195e85)) + + + + + + +## [3.1.6](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.5...@textlint/text-to-ast@3.1.6) (2019-10-14) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +## [3.1.5](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.3...@textlint/text-to-ast@3.1.5) (2019-07-20) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +## [3.1.4](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.3...@textlint/text-to-ast@3.1.4) (2019-07-13) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +## [3.1.3](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.2...@textlint/text-to-ast@3.1.3) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [3.1.2](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.1...@textlint/text-to-ast@3.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +## [3.1.1](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.1.0...@textlint/text-to-ast@3.1.1) (2019-01-03) + +**Note:** Version bump only for package @textlint/text-to-ast + + + + + + +# [3.1.0](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.0.9...@textlint/text-to-ast@3.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Styles + +* **eslint:** apply eslint to all files ([6a9573f](https://github.com/textlint/textlint/commit/6a9573f)) + + + + + +## [3.0.9](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.0.8...@textlint/text-to-ast@3.0.9) (2018-07-22) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + + + + +## [3.0.8](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.0.7...@textlint/text-to-ast@3.0.8) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/text-to-ast + + +## [3.0.7](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.0.6...@textlint/text-to-ast@3.0.7) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/text-to-ast + + +## [3.0.6](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.0.5...@textlint/text-to-ast@3.0.6) (2018-03-25) + + + + +**Note:** Version bump only for package @textlint/text-to-ast + + +## [3.0.5](https://github.com/textlint/textlint/compare/@textlint/text-to-ast@3.0.4...@textlint/text-to-ast@3.0.5) (2018-01-27) + + + + +**Note:** Version bump only for package @textlint/text-to-ast + + +## 3.0.4 (2018-01-18) + + + + +**Note:** Version bump only for package @textlint/text-to-ast + + +## [3.0.3](https://github.com/textlint/textlint/compare/txt-to-ast@3.0.2...txt-to-ast@3.0.3) (2018-01-12) + + + + +**Note:** Version bump only for package txt-to-ast + + +## [3.0.2](https://github.com/textlint/textlint/compare/txt-to-ast@3.0.1...txt-to-ast@3.0.2) (2017-12-31) + + + + +**Note:** Version bump only for package txt-to-ast + + +## [3.0.1](https://github.com/textlint/textlint/compare/txt-to-ast@3.0.0...txt-to-ast@3.0.1) (2017-12-25) + + + + +**Note:** Version bump only for package txt-to-ast + + +# [3.0.0](https://github.com/textlint/textlint/compare/txt-to-ast@3.0.0-next.0...txt-to-ast@3.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package txt-to-ast + + +# [3.0.0-next.0](https://github.com/textlint/textlint/compare/txt-to-ast@2.0.0...txt-to-ast@3.0.0-next.0) (2017-12-15) + + + + +**Note:** Version bump only for package txt-to-ast diff --git a/node_modules/@textlint/text-to-ast/LICENSE b/node_modules/@textlint/text-to-ast/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/text-to-ast/README.md b/node_modules/@textlint/text-to-ast/README.md new file mode 100644 index 000000000..e6d4b7605 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/README.md @@ -0,0 +1,165 @@ +# @textlint/text-to-ast + +Parse plain text to AST with location info. + +This library is a part of [textlint/textlint](https://github.com/textlint/textlint "textlint/textlint"). + +Markdown version: [@textlint/markdown-to-ast](https://github.com/textlint/textlint/tree/master/packages/@textlint/markdown-to-ast "textlint/markdown-to-ast") + +The AST consists of `TxtNode`s. +A `TxtNode` of the AST has following properties: + +- `loc` - Nodes have line and column-based location info. +- `range` - Nodes have an index-based location range (array). +- `raw` - Node have a `raw` text. +- `value` - Node have a `value` of text. + +The interface are defined in [textlint/txtnode.md](https://github.com/textlint/textlint/blob/master/docs/txtnode.md "textlint/txtnode.md at master · textlint/textlint") + +This library is a part of [textlint/textlint](https://github.com/textlint/textlint "textlint/textlint"). + +## Installation + +``` +npm install @textlint/text-to-ast +``` + +## DEMO + +- [AST explorer for textlint](https://textlint.github.io/astexplorer/ "AST explorer for textlint") + +## Usage + +```js +var parse = require("@textlint/text-to-ast").parse; +var text = "This is a text\nParse text to AST"; +var AST = parse(text); +console.log(JSON.stringify(AST, null ,4)) +/* +{ + "type": "Document", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "children": [ + { + "type": "Paragraph", + "raw": "This is a text", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "children": [ + { + "type": "Str", + "raw": "This is a text", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] + }, + { + "type": "Break", + "raw": "\n", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Paragraph", + "raw": "Parse text to AST", + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "children": [ + { + "type": "Str", + "raw": "Parse text to AST", + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ] + } + ] +} +*/ +``` + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/@textlint/text-to-ast/module/index.d.ts b/node_modules/@textlint/text-to-ast/module/index.d.ts new file mode 100644 index 000000000..4a8544da3 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/index.d.ts @@ -0,0 +1,3 @@ +import { parse } from "./plaintext-parser"; +import { Syntax } from "./plaintext-syntax"; +export { parse, Syntax }; diff --git a/node_modules/@textlint/text-to-ast/module/index.js b/node_modules/@textlint/text-to-ast/module/index.js new file mode 100644 index 000000000..3421b8955 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/index.js @@ -0,0 +1,6 @@ +// LICENSE : MIT +"use strict"; +import { parse } from "./plaintext-parser"; +import { Syntax } from "./plaintext-syntax"; +export { parse, Syntax }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/text-to-ast/module/index.js.map b/node_modules/@textlint/text-to-ast/module/index.js.map new file mode 100644 index 000000000..298fc41af --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/text-to-ast/module/plaintext-parser.d.ts b/node_modules/@textlint/text-to-ast/module/plaintext-parser.d.ts new file mode 100644 index 000000000..78b6e4f7b --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/plaintext-parser.d.ts @@ -0,0 +1,7 @@ +import { TxtNode } from "@textlint/ast-node-types"; +/** + * parse text and return ast mapped location info. + * @param {string} text + * @returns {TxtNode} + */ +export declare function parse(text: string): TxtNode; diff --git a/node_modules/@textlint/text-to-ast/module/plaintext-parser.js b/node_modules/@textlint/text-to-ast/module/plaintext-parser.js new file mode 100644 index 000000000..ddb4f3dab --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/plaintext-parser.js @@ -0,0 +1,208 @@ +// LICENSE : MIT +"use strict"; +import { Syntax } from "./plaintext-syntax"; +function parseLine(lineText, lineNumber, startIndex) { + // Inline Node have `value`. It it not part of TxtNode. + // TODO: https://github.com/textlint/textlint/issues/141 + return { + type: Syntax.Str, + raw: lineText, + value: lineText, + range: [startIndex, startIndex + lineText.length], + loc: { + start: { + line: lineNumber, + column: 0 + }, + end: { + line: lineNumber, + column: lineText.length + } + } + }; +} +/** + * create BreakNode next to StrNode + * @param {TxtNode} prevNode previous node from BreakNode + * @param lineBreakText + */ +function createEndedBRNode(_a) { + var prevNode = _a.prevNode, lineBreakText = _a.lineBreakText; + return { + type: Syntax.Break, + raw: lineBreakText, + range: [prevNode.range[1], prevNode.range[1] + lineBreakText.length], + loc: { + start: { + line: prevNode.loc.end.line, + column: prevNode.loc.end.column + }, + end: { + line: prevNode.loc.end.line, + column: prevNode.loc.end.column + lineBreakText.length + } + } + }; +} +/** + * create BreakNode next to StrNode + */ +function createBRNode(_a) { + var lineBreak = _a.lineBreak, lineNumber = _a.lineNumber, startIndex = _a.startIndex; + return { + type: Syntax.Break, + raw: lineBreak, + range: [startIndex, startIndex + lineBreak.length], + loc: { + start: { + line: lineNumber, + column: 0 + }, + end: { + line: lineNumber, + column: lineBreak.length + } + } + }; +} +/** + * create paragraph node from TxtNodes + * @param {TxtNode[]} nodes + * @returns {TxtNode} Paragraph node + */ +function createParagraph(nodes) { + var firstNode = nodes[0]; + var lastNode = nodes[nodes.length - 1]; + return { + type: Syntax.Paragraph, + raw: nodes + .map(function (node) { + return node.raw; + }) + .join(""), + range: [firstNode.range[0], lastNode.range[1]], + loc: { + start: { + line: firstNode.loc.start.line, + column: firstNode.loc.start.column + }, + end: { + line: lastNode.loc.end.line, + column: lastNode.loc.end.column + } + }, + children: nodes + }; +} +function splitTextByLine(text) { + var LINEBREAK_MARK_PATTERN = /\r?\n/g; + var results = []; + var match = null; + var prevMatchIndex = 0; + while ((match = LINEBREAK_MARK_PATTERN.exec(text)) !== null) { + var slicedText = text.slice(prevMatchIndex, match.index); + results.push({ + text: prevMatchIndex === match.index ? "" : slicedText, + lineBreak: match[0] + }); + prevMatchIndex = match.index + match[0].length; + } + if (text.length !== prevMatchIndex) { + results.push({ + text: text.slice(prevMatchIndex, text.length), + lineBreak: null + }); + } + return results; +} +/** + * parse text and return ast mapped location info. + * @param {string} text + * @returns {TxtNode} + */ +export function parse(text) { + var textLineByLine = splitTextByLine(text); + // it should be alternately Str and Break + var startIndex = 0; + var lastLineIndex = textLineByLine.length - 1; + var isLastEmptyLine = function (line, index) { + return index === lastLineIndex && line.text === ""; + }; + var isEmptyLine = function (line, index) { + return index !== lastLineIndex && line.text === ""; + }; + var children = textLineByLine.reduce(function (result, currentLine, index) { + var lineNumber = index + 1; + if (isLastEmptyLine(currentLine, index)) { + return result; + } + // \n + if (isEmptyLine(currentLine, index)) { + var emptyBreakNode = createBRNode({ + lineBreak: currentLine.lineBreak, + lineNumber: lineNumber, + startIndex: startIndex + }); + startIndex += emptyBreakNode.raw.length; + result.push(emptyBreakNode); + return result; + } + // (Paragraph > Str) -> Br? + var strNode = parseLine(currentLine.text, lineNumber, startIndex); + var paragraph = createParagraph([strNode]); + startIndex += paragraph.raw.length; + result.push(paragraph); + // add Break node with actual line break value + // It should support CRLF + // https://github.com/textlint/textlint/issues/656 + if (currentLine.lineBreak !== null) { + var breakNode = createEndedBRNode({ prevNode: paragraph, lineBreakText: currentLine.lineBreak }); + startIndex += breakNode.raw.length; + result.push(breakNode); + } + return result; + }, []); + var lastLine = textLineByLine[textLineByLine.length - 1]; + if (lastLine === undefined) { + return { + type: Syntax.Document, + raw: "", + range: [0, 0], + loc: { + start: { + line: 1, + column: 0 + }, + end: { + line: 1, + column: 0 + } + }, + children: children + }; + } + return { + type: Syntax.Document, + raw: text, + range: [0, text.length], + loc: { + start: { + line: 1, + column: 0 + }, + end: + // if Last Line has line break + lastLine.lineBreak !== null + ? { + line: textLineByLine.length + 1, + column: 0 + } + : { + line: textLineByLine.length, + column: lastLine.text.length + } + }, + children: children + }; +} +//# sourceMappingURL=plaintext-parser.js.map \ No newline at end of file diff --git a/node_modules/@textlint/text-to-ast/module/plaintext-parser.js.map b/node_modules/@textlint/text-to-ast/module/plaintext-parser.js.map new file mode 100644 index 000000000..e9b3ce85c --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/plaintext-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plaintext-parser.js","sourceRoot":"","sources":["../src/plaintext-parser.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,SAAS,SAAS,CAAC,QAAgB,EAAE,UAAkB,EAAE,UAAkB;IACvE,uDAAuD;IACvD,wDAAwD;IACxD,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,GAAG;QAChB,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;QACjD,GAAG,EAAE;YACD,KAAK,EAAE;gBACH,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,CAAC;aACZ;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;aAC1B;SACJ;KACJ,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,EAAyE;QAAvE,QAAQ,cAAA,EAAE,aAAa,mBAAA;IAChD,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,KAAK;QAClB,GAAG,EAAE,aAAa;QAClB,KAAK,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC;QACpE,GAAG,EAAE;YACD,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;gBAC3B,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM;aAClC;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;gBAC3B,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;aACzD;SACJ;KACJ,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,EAQrB;QAPG,SAAS,eAAA,EACT,UAAU,gBAAA,EACV,UAAU,gBAAA;IAMV,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,KAAK;QAClB,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC;QAClD,GAAG,EAAE;YACD,KAAK,EAAE;gBACH,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,CAAC;aACZ;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,SAAS,CAAC,MAAM;aAC3B;SACJ;KACJ,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAgB;IACrC,IAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,SAAS;QACtB,GAAG,EAAE,KAAK;aACL,GAAG,CAAC,UAAU,IAAI;YACf,OAAO,IAAI,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC;QACb,KAAK,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9C,GAAG,EAAE;YACD,KAAK,EAAE;gBACH,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI;gBAC9B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM;aACrC;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;gBAC3B,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM;aAClC;SACJ;QACD,QAAQ,EAAE,KAAK;KAClB,CAAC;AACN,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACjC,IAAM,sBAAsB,GAAG,QAAQ,CAAC;IACxC,IAAM,OAAO,GAAG,EAAE,CAAC;IACnB,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,OAAO,CAAC,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE;QACzD,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,cAAc,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU;YACtD,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;SACtB,CAAC,CAAC;QACH,cAAc,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAClD;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,cAAc,EAAE;QAChC,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC;YAC7C,SAAS,EAAE,IAAI;SAClB,CAAC,CAAC;KACN;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAMD;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY;IAC9B,IAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAC7C,yCAAyC;IACzC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAM,aAAa,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;IAChD,IAAM,eAAe,GAAG,UAAC,IAA0C,EAAE,KAAa;QAC9E,OAAO,KAAK,KAAK,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC,CAAC;IACF,IAAM,WAAW,GAAG,UAAC,IAA0C,EAAE,KAAa;QAC1E,OAAO,KAAK,KAAK,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC,CAAC;IACF,IAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,UAAU,MAAM,EAAE,WAAW,EAAE,KAAK;QACvE,IAAM,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC;QAC7B,IAAI,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;YACrC,OAAO,MAAM,CAAC;SACjB;QACD,KAAK;QACL,IAAI,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;YACjC,IAAM,cAAc,GAAG,YAAY,CAAC;gBAChC,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,UAAU,YAAA;gBACV,UAAU,YAAA;aACb,CAAC,CAAC;YACH,UAAU,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,MAAM,CAAC;SACjB;QAED,2BAA2B;QAC3B,IAAM,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QACpE,IAAM,SAAS,GAAG,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7C,UAAU,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvB,8CAA8C;QAC9C,yBAAyB;QACzB,kDAAkD;QAClD,IAAI,WAAW,CAAC,SAAS,KAAK,IAAI,EAAE;YAChC,IAAM,SAAS,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC;YACnG,UAAU,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC1B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC,EAAE,EAAe,CAAC,CAAC;IACpB,IAAM,QAAQ,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3D,IAAI,QAAQ,KAAK,SAAS,EAAE;QACxB,OAAO;YACH,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACb,GAAG,EAAE;gBACD,KAAK,EAAE;oBACH,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,CAAC;iBACZ;gBACD,GAAG,EAAE;oBACD,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,CAAC;iBACZ;aACJ;YACD,QAAQ,UAAA;SACX,CAAC;KACL;IACD,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,GAAG,EAAE,IAAI;QACT,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;QACvB,GAAG,EAAE;YACD,KAAK,EAAE;gBACH,IAAI,EAAE,CAAC;gBACP,MAAM,EAAE,CAAC;aACZ;YACD,GAAG;YACC,8BAA8B;YAC9B,QAAQ,CAAC,SAAS,KAAK,IAAI;gBACvB,CAAC,CAAC;oBACI,IAAI,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC;oBAC/B,MAAM,EAAE,CAAC;iBACZ;gBACH,CAAC,CAAC;oBACI,IAAI,EAAE,cAAc,CAAC,MAAM;oBAC3B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;iBAC/B;SACd;QACD,QAAQ,UAAA;KACX,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/text-to-ast/module/plaintext-syntax.d.ts b/node_modules/@textlint/text-to-ast/module/plaintext-syntax.d.ts new file mode 100644 index 000000000..50ff7c666 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/plaintext-syntax.d.ts @@ -0,0 +1,7 @@ +import { ASTNodeTypes } from "@textlint/ast-node-types"; +export declare const Syntax: { + Document: ASTNodeTypes; + Paragraph: ASTNodeTypes; + Str: ASTNodeTypes; + Break: ASTNodeTypes; +}; diff --git a/node_modules/@textlint/text-to-ast/module/plaintext-syntax.js b/node_modules/@textlint/text-to-ast/module/plaintext-syntax.js new file mode 100644 index 000000000..ddfd839da --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/plaintext-syntax.js @@ -0,0 +1,11 @@ +// LICENSE : MIT +"use strict"; +import { ASTNodeTypes } from "@textlint/ast-node-types"; +export var Syntax = { + Document: ASTNodeTypes.Document, + Paragraph: ASTNodeTypes.Paragraph, + // inline + Str: ASTNodeTypes.Str, + Break: ASTNodeTypes.Break // must +}; +//# sourceMappingURL=plaintext-syntax.js.map \ No newline at end of file diff --git a/node_modules/@textlint/text-to-ast/module/plaintext-syntax.js.map b/node_modules/@textlint/text-to-ast/module/plaintext-syntax.js.map new file mode 100644 index 000000000..1ec78de17 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/module/plaintext-syntax.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plaintext-syntax.js","sourceRoot":"","sources":["../src/plaintext-syntax.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,IAAM,MAAM,GAAG;IAClB,QAAQ,EAAE,YAAY,CAAC,QAAQ;IAC/B,SAAS,EAAE,YAAY,CAAC,SAAS;IACjC,SAAS;IACT,GAAG,EAAE,YAAY,CAAC,GAAG;IACrB,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO;CACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/text-to-ast/package.json b/node_modules/@textlint/text-to-ast/package.json new file mode 100644 index 000000000..be2c47d8e --- /dev/null +++ b/node_modules/@textlint/text-to-ast/package.json @@ -0,0 +1,60 @@ +{ + "name": "@textlint/text-to-ast", + "version": "3.3.5", + "description": "Parse plain text to AST with location info.", + "keywords": [ + "ast", + "textlint", + "txt" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/text-to-ast/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "module": "./module/index.js", + "types": "lib/index.d.ts", + "directories": { + "example": "example", + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "crlf": "eolConverter crlf test/snapshots/crlf/input.txt && eolConverter crlf test/snapshots/crlf-empty-line/input.txt", + "prepublish": "npm run --if-present build", + "pretest": "npm run crlf", + "test": "mocha \"test/**/*.{js,ts}\"", + "updateSnapshot": "cross-env UPDATE_SNAPSHOT=1 npm test", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + }, + "devDependencies": { + "@textlint/ast-tester": "^2.3.5", + "cross-env": "^7.0.3", + "eol-converter-cli": "^1.0.8", + "mocha": "^8.4.0", + "power-assert": "^1.6.1", + "rimraf": "^3.0.2", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/text-to-ast/src/index.ts b/node_modules/@textlint/text-to-ast/src/index.ts new file mode 100644 index 000000000..a571defde --- /dev/null +++ b/node_modules/@textlint/text-to-ast/src/index.ts @@ -0,0 +1,6 @@ +// LICENSE : MIT +"use strict"; +import { parse } from "./plaintext-parser"; +import { Syntax } from "./plaintext-syntax"; + +export { parse, Syntax }; diff --git a/node_modules/@textlint/text-to-ast/src/plaintext-parser.ts b/node_modules/@textlint/text-to-ast/src/plaintext-parser.ts new file mode 100644 index 000000000..d47f0d7ec --- /dev/null +++ b/node_modules/@textlint/text-to-ast/src/plaintext-parser.ts @@ -0,0 +1,225 @@ +// LICENSE : MIT +"use strict"; +import { Syntax } from "./plaintext-syntax"; +import { TxtNode } from "@textlint/ast-node-types"; + +function parseLine(lineText: string, lineNumber: number, startIndex: number): TxtNode { + // Inline Node have `value`. It it not part of TxtNode. + // TODO: https://github.com/textlint/textlint/issues/141 + return { + type: Syntax.Str, + raw: lineText, + value: lineText, + range: [startIndex, startIndex + lineText.length], + loc: { + start: { + line: lineNumber, + column: 0 + }, + end: { + line: lineNumber, + column: lineText.length + } + } + }; +} + +/** + * create BreakNode next to StrNode + * @param {TxtNode} prevNode previous node from BreakNode + * @param lineBreakText + */ +function createEndedBRNode({ prevNode, lineBreakText }: { prevNode: TxtNode; lineBreakText: string }): TxtNode { + return { + type: Syntax.Break, + raw: lineBreakText, + range: [prevNode.range[1], prevNode.range[1] + lineBreakText.length], + loc: { + start: { + line: prevNode.loc.end.line, + column: prevNode.loc.end.column + }, + end: { + line: prevNode.loc.end.line, + column: prevNode.loc.end.column + lineBreakText.length + } + } + }; +} + +/** + * create BreakNode next to StrNode + */ +function createBRNode({ + lineBreak, + lineNumber, + startIndex +}: { + lineBreak: string; + lineNumber: number; + startIndex: number; +}): TxtNode { + return { + type: Syntax.Break, + raw: lineBreak, + range: [startIndex, startIndex + lineBreak.length], + loc: { + start: { + line: lineNumber, + column: 0 + }, + end: { + line: lineNumber, + column: lineBreak.length + } + } + }; +} + +/** + * create paragraph node from TxtNodes + * @param {TxtNode[]} nodes + * @returns {TxtNode} Paragraph node + */ +function createParagraph(nodes: TxtNode[]): TxtNode { + const firstNode = nodes[0]; + const lastNode = nodes[nodes.length - 1]; + return { + type: Syntax.Paragraph, + raw: nodes + .map(function (node) { + return node.raw; + }) + .join(""), + range: [firstNode.range[0], lastNode.range[1]], + loc: { + start: { + line: firstNode.loc.start.line, + column: firstNode.loc.start.column + }, + end: { + line: lastNode.loc.end.line, + column: lastNode.loc.end.column + } + }, + children: nodes + }; +} + +function splitTextByLine(text: string) { + const LINEBREAK_MARK_PATTERN = /\r?\n/g; + const results = []; + let match = null; + let prevMatchIndex = 0; + while ((match = LINEBREAK_MARK_PATTERN.exec(text)) !== null) { + const slicedText = text.slice(prevMatchIndex, match.index); + results.push({ + text: prevMatchIndex === match.index ? "" : slicedText, + lineBreak: match[0] + }); + prevMatchIndex = match.index + match[0].length; + } + if (text.length !== prevMatchIndex) { + results.push({ + text: text.slice(prevMatchIndex, text.length), + lineBreak: null + }); + } + return results; +} + +type EmptyLine = { text: ""; lineBreak: string }; +type LastLine = { text: string; lineBreak: null }; +type LineWithBreak = { text: string; lineBreak: string }; + +/** + * parse text and return ast mapped location info. + * @param {string} text + * @returns {TxtNode} + */ +export function parse(text: string): TxtNode { + const textLineByLine = splitTextByLine(text); + // it should be alternately Str and Break + let startIndex = 0; + const lastLineIndex = textLineByLine.length - 1; + const isLastEmptyLine = (line: LineWithBreak | LastLine | EmptyLine, index: number): line is EmptyLine => { + return index === lastLineIndex && line.text === ""; + }; + const isEmptyLine = (line: LineWithBreak | LastLine | EmptyLine, index: number): line is EmptyLine => { + return index !== lastLineIndex && line.text === ""; + }; + const children = textLineByLine.reduce(function (result, currentLine, index) { + const lineNumber = index + 1; + if (isLastEmptyLine(currentLine, index)) { + return result; + } + // \n + if (isEmptyLine(currentLine, index)) { + const emptyBreakNode = createBRNode({ + lineBreak: currentLine.lineBreak, + lineNumber, + startIndex + }); + startIndex += emptyBreakNode.raw.length; + result.push(emptyBreakNode); + return result; + } + + // (Paragraph > Str) -> Br? + const strNode = parseLine(currentLine.text, lineNumber, startIndex); + const paragraph = createParagraph([strNode]); + startIndex += paragraph.raw.length; + result.push(paragraph); + // add Break node with actual line break value + // It should support CRLF + // https://github.com/textlint/textlint/issues/656 + if (currentLine.lineBreak !== null) { + const breakNode = createEndedBRNode({ prevNode: paragraph, lineBreakText: currentLine.lineBreak }); + startIndex += breakNode.raw.length; + result.push(breakNode); + } + return result; + }, [] as TxtNode[]); + const lastLine = textLineByLine[textLineByLine.length - 1]; + if (lastLine === undefined) { + return { + type: Syntax.Document, + raw: "", + range: [0, 0], + loc: { + start: { + line: 1, + column: 0 + }, + end: { + line: 1, + column: 0 + } + }, + children + }; + } + return { + type: Syntax.Document, + raw: text, + range: [0, text.length], + loc: { + start: { + line: 1, + column: 0 + }, + end: + // if Last Line has line break + lastLine.lineBreak !== null + ? { + line: textLineByLine.length + 1, + column: 0 + } + : { + line: textLineByLine.length, + column: lastLine.text.length + } + }, + children + }; +} diff --git a/node_modules/@textlint/text-to-ast/src/plaintext-syntax.ts b/node_modules/@textlint/text-to-ast/src/plaintext-syntax.ts new file mode 100644 index 000000000..df7e9aaa6 --- /dev/null +++ b/node_modules/@textlint/text-to-ast/src/plaintext-syntax.ts @@ -0,0 +1,11 @@ +// LICENSE : MIT +"use strict"; +import { ASTNodeTypes } from "@textlint/ast-node-types"; + +export const Syntax = { + Document: ASTNodeTypes.Document, // must + Paragraph: ASTNodeTypes.Paragraph, + // inline + Str: ASTNodeTypes.Str, // must + Break: ASTNodeTypes.Break // must +}; diff --git a/node_modules/@textlint/textlint-plugin-markdown/CHANGELOG.md b/node_modules/@textlint/textlint-plugin-markdown/CHANGELOG.md new file mode 100644 index 000000000..1dd9b673f --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/CHANGELOG.md @@ -0,0 +1,582 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [5.3.5](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.3.4...@textlint/textlint-plugin-markdown@5.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + +## [5.3.4](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.3.3...@textlint/textlint-plugin-markdown@5.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.3.3](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.3.2...@textlint/textlint-plugin-markdown@5.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [5.3.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.3.1...@textlint/textlint-plugin-markdown@5.3.2) (2021-02-06) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.3.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.6...@textlint/textlint-plugin-markdown@5.3.1) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [5.3.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.6...@textlint/textlint-plugin-markdown@5.3.0) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [5.2.7](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.6...@textlint/textlint-plugin-markdown@5.2.7) (2020-12-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [5.2.6](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.5...@textlint/textlint-plugin-markdown@5.2.6) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [5.2.5](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.4...@textlint/textlint-plugin-markdown@5.2.5) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [5.2.4](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.3...@textlint/textlint-plugin-markdown@5.2.4) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [5.2.3](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.2...@textlint/textlint-plugin-markdown@5.2.3) (2020-07-24) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.2.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.1...@textlint/textlint-plugin-markdown@5.2.2) (2020-07-24) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.2.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.2.0...@textlint/textlint-plugin-markdown@5.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [5.2.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.12...@textlint/textlint-plugin-markdown@5.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **textlint-plugin-markdown:** convert to typescript ([24f3f44](https://github.com/textlint/textlint/commit/24f3f44)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) +* **textlint-plugin-markdown:** convert to typescript ([5358e99](https://github.com/textlint/textlint/commit/5358e99)) + + + + + + +## [5.1.12](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.11...@textlint/textlint-plugin-markdown@5.1.12) (2020-02-07) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.11](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.9...@textlint/textlint-plugin-markdown@5.1.11) (2020-01-07) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.10](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.9...@textlint/textlint-plugin-markdown@5.1.10) (2019-11-03) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.9](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.8...@textlint/textlint-plugin-markdown@5.1.9) (2019-10-14) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.8](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.6...@textlint/textlint-plugin-markdown@5.1.8) (2019-07-20) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.7](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.6...@textlint/textlint-plugin-markdown@5.1.7) (2019-07-13) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.6](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.5...@textlint/textlint-plugin-markdown@5.1.6) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [5.1.5](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.4...@textlint/textlint-plugin-markdown@5.1.5) (2019-04-30) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.4](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.3...@textlint/textlint-plugin-markdown@5.1.4) (2019-02-10) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.3](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.2...@textlint/textlint-plugin-markdown@5.1.3) (2019-02-10) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.1...@textlint/textlint-plugin-markdown@5.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + + + + + +## [5.1.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.1.0...@textlint/textlint-plugin-markdown@5.1.1) (2019-01-03) + + +### Bug Fixes + +* **textlint-plugin-markdown:** remove cycle dependency ([b241962](https://github.com/textlint/textlint/commit/b241962)) + + +### Code Refactoring + +* **textlint-plugin-text:** Use [@textlint](https://github.com/textlint)/kernel instead of textlint ([5a2fd25](https://github.com/textlint/textlint/commit/5a2fd25)), closes [#567](https://github.com/textlint/textlint/issues/567) + + + + + + +# [5.1.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.0.2...@textlint/textlint-plugin-markdown@5.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Tests + +* **deps:** update no-todo rule reference ([6cecc88](https://github.com/textlint/textlint/commit/6cecc88)) + + + + + +## [5.0.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.0.0...@textlint/textlint-plugin-markdown@5.0.2) (2018-12-24) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + +## [5.0.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@5.0.0...@textlint/textlint-plugin-markdown@5.0.1) (2018-10-12) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + +# [5.0.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@4.0.10...@textlint/textlint-plugin-markdown@5.0.0) (2018-07-22) + + +### Bug Fixes + +* **kernel:** make rule and plugin's option value {} by default ([b7aa63d](https://github.com/textlint/textlint/commit/b7aa63d)) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + +### Documentation + +* **plugin:** add plugin configuration ([6e179ec](https://github.com/textlint/textlint/commit/6e179ec)) + + +### Features + +* **textlint-plugin-markdown:** Support "extensions" option ([c3d55fe](https://github.com/textlint/textlint/commit/c3d55fe)) + + +### BREAKING CHANGES + +* **kernel:** Previously, textlint pass `true` to rule and plugin as default value of option. +This commit change the default value to `{}` (empty object). + +fix https://github.com/textlint/textlint/issues/535 + + + + + +## [4.0.10](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@4.0.9...@textlint/textlint-plugin-markdown@4.0.10) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + +## [4.0.9](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@4.0.8...@textlint/textlint-plugin-markdown@4.0.9) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + +## [4.0.8](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-markdown@4.0.7...@textlint/textlint-plugin-markdown@4.0.8) (2018-03-25) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-markdown + + +## 4.0.7 (2018-01-27) + + +### Bug Fixes + +* **plugin-markdown:** add `publishConfig` ([f3a20c9](https://github.com/textlint/textlint/commit/f3a20c9)) + + +### Code Refactoring + +* **plugin-markdown:** move to [@textlint](https://github.com/textlint) ([f50f851](https://github.com/textlint/textlint/commit/f50f851)) + + + + + +## [4.0.6](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.5...textlint-plugin-markdown@4.0.6) (2018-01-18) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [4.0.5](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.4...textlint-plugin-markdown@4.0.5) (2018-01-12) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [4.0.3](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.2...textlint-plugin-markdown@4.0.3) (2017-12-31) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [4.0.2](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.1...textlint-plugin-markdown@4.0.2) (2017-12-25) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [4.0.1](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.0...textlint-plugin-markdown@4.0.1) (2017-12-19) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +# [4.0.0](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.0-next.2...textlint-plugin-markdown@4.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +# [4.0.0-next.2](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.0-next.1...textlint-plugin-markdown@4.0.0-next.2) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +# [4.0.0-next.1](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@4.0.0-next.0...textlint-plugin-markdown@4.0.0-next.1) (2017-12-17) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +# [4.0.0-next.0](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@3.0.3...textlint-plugin-markdown@4.0.0-next.0) (2017-12-15) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [3.0.3](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@3.0.2...textlint-plugin-markdown@3.0.3) (2017-11-05) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [3.0.2](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@3.0.1...textlint-plugin-markdown@3.0.2) (2017-11-03) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +# [3.0.0](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@3.0.0-beta.0...textlint-plugin-markdown@3.0.0) (2017-10-28) + + + + +**Note:** Version bump only for package textlint-plugin-markdown + + +## [2.0.5](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@2.0.4...textlint-plugin-markdown@2.0.5) (2017-05-21) + + + + + +## [2.0.4](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@2.0.3...textlint-plugin-markdown@2.0.4) (2017-05-21) + + + + + +## [2.0.3](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@2.0.2...textlint-plugin-markdown@2.0.3) (2017-05-18) + + + + + +## [2.0.2](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@2.0.1...textlint-plugin-markdown@2.0.2) (2017-05-11) + + + + + +## [2.0.1](https://github.com/textlint/textlint/compare/textlint-plugin-markdown@2.0.0...textlint-plugin-markdown@2.0.1) (2017-05-07) + + + + + +# 2.0.0 (2017-05-06) + + +### Bug Fixes + +* **npm:** fix main path ([2072acf](https://github.com/textlint/textlint/commit/2072acf)) +* **npm:** fix meta info ([6671d60](https://github.com/textlint/textlint/commit/6671d60)) +* **npm:** update markdown-to-ast[@3](https://github.com/3).2.3 ([c8b2aed](https://github.com/textlint/textlint/commit/c8b2aed)) +* **textlint-plugin-markdown:** fix export modules ([9adeb0e](https://github.com/textlint/textlint/commit/9adeb0e)) + + +### Features + +* **npm:** update dependencies ([d525b10](https://github.com/textlint/textlint/commit/d525b10)) +* **textlint-plugin-markdown:** import textlint/textlint-plugin-markdown ([47f02eb](https://github.com/textlint/textlint/commit/47f02eb)) +* **textlint-plugin-markdown:** update markdown-to-ast@^4 ([4446aaa](https://github.com/textlint/textlint/commit/4446aaa)) + + +### BREAKING CHANGES + +* **textlint-plugin-markdown:** markdown-to-ast@4 includes some breaking change diff --git a/node_modules/@textlint/textlint-plugin-markdown/LICENSE b/node_modules/@textlint/textlint-plugin-markdown/LICENSE new file mode 100644 index 000000000..d6a58d093 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/textlint-plugin-markdown/README.md b/node_modules/@textlint/textlint-plugin-markdown/README.md new file mode 100644 index 000000000..380f3f3c1 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/README.md @@ -0,0 +1,58 @@ +# @textlint/textlint-plugin-markdown + +Markdown support for [textlint](https://github.com/textlint/textlint "textlint"). + +## Installation + + npm install @textlint/textlint-plugin-markdown + +## Usage + +Built-in support on textlint. +No need configuration. + +------ + +Following config is set by default. + +``` +{ + "plugins": { + "@textlint/markdown": true + } +} +``` + +## Options + +- `extensions`: `string[]` + - Additional file extensions for markdown + +For example, if you want to treat [MDX](https://github.com/mdx-js/mdx) as markdown, put following config to `.textlintrc` + +```json5 +{ + "plugins": { + "@textlint/markdown": { + "extensions": [".mdx"] + } + } +} +``` + + +## Tests + + npm test + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.d.ts b/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.d.ts new file mode 100644 index 000000000..8ca9fa63e --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.d.ts @@ -0,0 +1,14 @@ +import type { TextlintPluginOptions } from "@textlint/types"; +export declare class MarkdownProcessor { + config: TextlintPluginOptions; + extensions: Array; + constructor(config?: {}); + availableExtensions(): string[]; + processor(_ext: string): { + preProcess(text: string, _filePath?: string | undefined): import("@textlint/ast-node-types").TxtNode; + postProcess(messages: any[], filePath?: string | undefined): { + messages: any[]; + filePath: string; + }; + }; +} diff --git a/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.js b/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.js new file mode 100644 index 000000000..becbc72d5 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.js @@ -0,0 +1,30 @@ +/* eslint-disable no-unused-vars */ +// LICENSE : MIT +"use strict"; +import { parse } from "@textlint/markdown-to-ast"; +var MarkdownProcessor = /** @class */ (function () { + function MarkdownProcessor(config) { + if (config === void 0) { config = {}; } + this.config = config; + this.extensions = this.config.extensions ? this.config.extensions : []; + } + MarkdownProcessor.prototype.availableExtensions = function () { + return [".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".mdwn", ".mkdown", ".ron"].concat(this.extensions); + }; + MarkdownProcessor.prototype.processor = function (_ext) { + return { + preProcess: function (text, _filePath) { + return parse(text); + }, + postProcess: function (messages, filePath) { + return { + messages: messages, + filePath: filePath ? filePath : "" + }; + } + }; + }; + return MarkdownProcessor; +}()); +export { MarkdownProcessor }; +//# sourceMappingURL=MarkdownProcessor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.js.map b/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.js.map new file mode 100644 index 000000000..74dea5af1 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/module/MarkdownProcessor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MarkdownProcessor.js","sourceRoot":"","sources":["../src/MarkdownProcessor.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD;IAGI,2BAAY,MAAW;QAAX,uBAAA,EAAA,WAAW;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,CAAC;IAED,+CAAmB,GAAnB;QACI,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/G,CAAC;IAED,qCAAS,GAAT,UAAU,IAAY;QAClB,OAAO;YACH,UAAU,EAAV,UAAW,IAAY,EAAE,SAAkB;gBACvC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YACD,WAAW,EAAX,UAAY,QAAe,EAAE,QAAiB;gBAC1C,OAAO;oBACH,QAAQ,UAAA;oBACR,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY;iBAC/C,CAAC;YACN,CAAC;SACJ,CAAC;IACN,CAAC;IACL,wBAAC;AAAD,CAAC,AAzBD,IAyBC"} \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-markdown/module/index.d.ts b/node_modules/@textlint/textlint-plugin-markdown/module/index.d.ts new file mode 100644 index 000000000..00a6ee5c9 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/module/index.d.ts @@ -0,0 +1,5 @@ +import { MarkdownProcessor } from "./MarkdownProcessor"; +declare const _default: { + Processor: typeof MarkdownProcessor; +}; +export default _default; diff --git a/node_modules/@textlint/textlint-plugin-markdown/module/index.js b/node_modules/@textlint/textlint-plugin-markdown/module/index.js new file mode 100644 index 000000000..643eb3e2e --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/module/index.js @@ -0,0 +1,7 @@ +// LICENSE : MIT +"use strict"; +import { MarkdownProcessor } from "./MarkdownProcessor"; +export default { + Processor: MarkdownProcessor +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-markdown/module/index.js.map b/node_modules/@textlint/textlint-plugin-markdown/module/index.js.map new file mode 100644 index 000000000..7560161ce --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,eAAe;IACX,SAAS,EAAE,iBAAiB;CAC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-markdown/package.json b/node_modules/@textlint/textlint-plugin-markdown/package.json new file mode 100644 index 000000000..c21e9a763 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/package.json @@ -0,0 +1,57 @@ +{ + "name": "@textlint/textlint-plugin-markdown", + "version": "5.3.5", + "description": "Markdown support for textlint.", + "keywords": [ + "markdown", + "plugin", + "textlint" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/textlint-plugin-markdown", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "type": "lib/index.d.ts", + "main": "lib/index.js", + "module": "./module/index.js", + "directories": { + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/markdown-to-ast": "^6.3.5" + }, + "devDependencies": { + "@textlint/kernel": "^3.4.5", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "power-assert": "^1.6.1", + "rimraf": "^3.0.2", + "textlint-rule-no-todo": "^2.0.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "email": "azuciao@gmail.com", + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/textlint-plugin-markdown/src/MarkdownProcessor.ts b/node_modules/@textlint/textlint-plugin-markdown/src/MarkdownProcessor.ts new file mode 100644 index 000000000..8df063b25 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/src/MarkdownProcessor.ts @@ -0,0 +1,32 @@ +/* eslint-disable no-unused-vars */ +// LICENSE : MIT +"use strict"; +import { parse } from "@textlint/markdown-to-ast"; +import type { TextlintPluginOptions } from "@textlint/types"; + +export class MarkdownProcessor { + config: TextlintPluginOptions; + extensions: Array; + constructor(config = {}) { + this.config = config; + this.extensions = this.config.extensions ? this.config.extensions : []; + } + + availableExtensions() { + return [".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".mdwn", ".mkdown", ".ron"].concat(this.extensions); + } + + processor(_ext: string) { + return { + preProcess(text: string, _filePath?: string) { + return parse(text); + }, + postProcess(messages: any[], filePath?: string) { + return { + messages, + filePath: filePath ? filePath : "" + }; + } + }; + } +} diff --git a/node_modules/@textlint/textlint-plugin-markdown/src/index.ts b/node_modules/@textlint/textlint-plugin-markdown/src/index.ts new file mode 100644 index 000000000..1ed970552 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-markdown/src/index.ts @@ -0,0 +1,7 @@ +// LICENSE : MIT +"use strict"; +import { MarkdownProcessor } from "./MarkdownProcessor"; + +export default { + Processor: MarkdownProcessor +}; diff --git a/node_modules/@textlint/textlint-plugin-text/CHANGELOG.md b/node_modules/@textlint/textlint-plugin-text/CHANGELOG.md new file mode 100644 index 000000000..d206381c2 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/CHANGELOG.md @@ -0,0 +1,602 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [4.3.5](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.3.4...@textlint/textlint-plugin-text@4.3.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + +## [4.3.4](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.3.3...@textlint/textlint-plugin-text@4.3.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.3.3](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.3.2...@textlint/textlint-plugin-text@4.3.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [4.3.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.3.1...@textlint/textlint-plugin-text@4.3.2) (2021-02-06) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.3.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.6...@textlint/textlint-plugin-text@4.3.1) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* enable TypeScript incremental ([#716](https://github.com/textlint/textlint/issues/716)) ([199da5c](https://github.com/textlint/textlint/commit/199da5c)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [4.3.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.6...@textlint/textlint-plugin-text@4.3.0) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* enable TypeScript incremental ([#716](https://github.com/textlint/textlint/issues/716)) ([199da5c](https://github.com/textlint/textlint/commit/199da5c)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [4.2.7](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.6...@textlint/textlint-plugin-text@4.2.7) (2020-12-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* enable TypeScript incremental ([#716](https://github.com/textlint/textlint/issues/716)) ([199da5c](https://github.com/textlint/textlint/commit/199da5c)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [4.2.6](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.5...@textlint/textlint-plugin-text@4.2.6) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [4.2.5](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.4...@textlint/textlint-plugin-text@4.2.5) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [4.2.4](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.3...@textlint/textlint-plugin-text@4.2.4) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [4.2.3](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.2...@textlint/textlint-plugin-text@4.2.3) (2020-07-24) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.2.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.1...@textlint/textlint-plugin-text@4.2.2) (2020-07-24) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.2.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.2.0...@textlint/textlint-plugin-text@4.2.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [4.2.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.13...@textlint/textlint-plugin-text@4.2.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) +* **textlint-plugin-text:** Add missing 'type' property to package.json ([1560b48](https://github.com/textlint/textlint/commit/1560b48)) +* **textlint-plugin-text:** Change default exports to named exports ([31e0f92](https://github.com/textlint/textlint/commit/31e0f92)) +* **textlint-plugin-text:** Fix export module name ([32bcad1](https://github.com/textlint/textlint/commit/32bcad1)) +* **textlint-plugin-text:** Fix TextlintPluginProcessor.preProcess type ([7880037](https://github.com/textlint/textlint/commit/7880037)) +* **textlint-plugin-text:** Fix typescript project references ([5db0790](https://github.com/textlint/textlint/commit/5db0790)) + + +### Code Refactoring + +* **textlint-plugin-text:** Convert to TypeScript ([803558d](https://github.com/textlint/textlint/commit/803558d)) + + +### Documentation + +* **textlint-plugin-text:** Fix typo "markdown" to "text" ([bb2406c](https://github.com/textlint/textlint/commit/bb2406c)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) +* **textlint-plugin-text:** Convert to TypeScript ([28261c1](https://github.com/textlint/textlint/commit/28261c1)) + + + + + + +## [4.1.13](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.12...@textlint/textlint-plugin-text@4.1.13) (2020-02-07) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.12](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.11...@textlint/textlint-plugin-text@4.1.12) (2020-02-01) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.11](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.9...@textlint/textlint-plugin-text@4.1.11) (2020-01-07) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.10](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.9...@textlint/textlint-plugin-text@4.1.10) (2019-11-03) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.9](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.8...@textlint/textlint-plugin-text@4.1.9) (2019-10-14) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.8](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.6...@textlint/textlint-plugin-text@4.1.8) (2019-07-20) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.7](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.6...@textlint/textlint-plugin-text@4.1.7) (2019-07-13) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.6](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.5...@textlint/textlint-plugin-text@4.1.6) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [4.1.5](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.4...@textlint/textlint-plugin-text@4.1.5) (2019-04-30) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.4](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.3...@textlint/textlint-plugin-text@4.1.4) (2019-02-10) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.3](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.2...@textlint/textlint-plugin-text@4.1.3) (2019-02-10) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.1...@textlint/textlint-plugin-text@4.1.2) (2019-01-03) + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + + + + + +## [4.1.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.1.0...@textlint/textlint-plugin-text@4.1.1) (2019-01-03) + + +### Code Refactoring + +* **textlint-plugin-text:** Use [@textlint](https://github.com/textlint)/kernel instead of textlint ([5a2fd25](https://github.com/textlint/textlint/commit/5a2fd25)), closes [#567](https://github.com/textlint/textlint/issues/567) + + + + + + +# [4.1.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.0.2...@textlint/textlint-plugin-text@4.1.0) (2019-01-01) + + +### Chores + +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) + + +### Tests + +* **deps:** update no-todo rule reference ([6cecc88](https://github.com/textlint/textlint/commit/6cecc88)) + + + + + +## [4.0.2](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.0.0...@textlint/textlint-plugin-text@4.0.2) (2018-12-24) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + +## [4.0.1](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@4.0.0...@textlint/textlint-plugin-text@4.0.1) (2018-10-12) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + +# [4.0.0](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@3.0.10...@textlint/textlint-plugin-text@4.0.0) (2018-07-22) + + +### Bug Fixes + +* **kernel:** make rule and plugin's option value {} by default ([b7aa63d](https://github.com/textlint/textlint/commit/b7aa63d)) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) + + +### Documentation + +* **plugin:** add "extensions" option to docs ([8026997](https://github.com/textlint/textlint/commit/8026997)) +* **plugin:** add plugin configuration ([6e179ec](https://github.com/textlint/textlint/commit/6e179ec)) + + +### Features + +* **textlint-text-markdown:** support "extensions" option ([cce29ed](https://github.com/textlint/textlint/commit/cce29ed)) + + +### BREAKING CHANGES + +* **kernel:** Previously, textlint pass `true` to rule and plugin as default value of option. +This commit change the default value to `{}` (empty object). + +fix https://github.com/textlint/textlint/issues/535 + + + + + +## [3.0.10](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@3.0.9...@textlint/textlint-plugin-text@3.0.10) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + +## [3.0.9](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@3.0.8...@textlint/textlint-plugin-text@3.0.9) (2018-04-02) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + +## [3.0.8](https://github.com/textlint/textlint/compare/@textlint/textlint-plugin-text@3.0.7...@textlint/textlint-plugin-text@3.0.8) (2018-03-25) + + + + +**Note:** Version bump only for package @textlint/textlint-plugin-text + + +## 3.0.7 (2018-01-27) + + +### Bug Fixes + +* **plugin-text:** add `publishConfig` ([41ca4a8](https://github.com/textlint/textlint/commit/41ca4a8)) + + +### Chores + +* **plugin-text:** correct markdown ([448b33d](https://github.com/textlint/textlint/commit/448b33d)) + + +### Code Refactoring + +* **plugin-text:** move to [@textlint](https://github.com/textlint) ([08ce34e](https://github.com/textlint/textlint/commit/08ce34e)) + + + + + +## [3.0.6](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.5...textlint-plugin-text@3.0.6) (2018-01-18) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [3.0.5](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.4...textlint-plugin-text@3.0.5) (2018-01-12) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [3.0.3](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.2...textlint-plugin-text@3.0.3) (2017-12-31) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [3.0.2](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.1...textlint-plugin-text@3.0.2) (2017-12-25) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [3.0.1](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.0...textlint-plugin-text@3.0.1) (2017-12-19) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +# [3.0.0](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.0-next.2...textlint-plugin-text@3.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +# [3.0.0-next.2](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.0-next.1...textlint-plugin-text@3.0.0-next.2) (2017-12-18) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +# [3.0.0-next.1](https://github.com/textlint/textlint/compare/textlint-plugin-text@3.0.0-next.0...textlint-plugin-text@3.0.0-next.1) (2017-12-17) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +# [3.0.0-next.0](https://github.com/textlint/textlint/compare/textlint-plugin-text@2.0.3...textlint-plugin-text@3.0.0-next.0) (2017-12-15) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [2.0.3](https://github.com/textlint/textlint/compare/textlint-plugin-text@2.0.2...textlint-plugin-text@2.0.3) (2017-11-05) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [2.0.2](https://github.com/textlint/textlint/compare/textlint-plugin-text@2.0.1...textlint-plugin-text@2.0.2) (2017-11-03) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +# [2.0.0](https://github.com/textlint/textlint/compare/textlint-plugin-text@2.0.0-beta.0...textlint-plugin-text@2.0.0) (2017-10-28) + + + + +**Note:** Version bump only for package textlint-plugin-text + + +## [1.1.4](https://github.com/textlint/textlint/compare/textlint-plugin-text@1.1.3...textlint-plugin-text@1.1.4) (2017-05-21) + + + + + +## [1.1.3](https://github.com/textlint/textlint/compare/textlint-plugin-text@1.1.2...textlint-plugin-text@1.1.3) (2017-05-21) + + + + + +## [1.1.2](https://github.com/textlint/textlint/compare/textlint-plugin-text@1.1.1...textlint-plugin-text@1.1.2) (2017-05-18) + + + + + +## [1.1.1](https://github.com/textlint/textlint/compare/textlint-plugin-text@1.1.0...textlint-plugin-text@1.1.1) (2017-05-11) + + + + + +# 1.1.0 (2017-05-07) + + +### Bug Fixes + +* **babel:** ignore lib directory ([12e581d](https://github.com/textlint/textlint/commit/12e581d)) + + +### Features + +* **packages:** import textlint-plugin-text ([1b7a571](https://github.com/textlint/textlint/commit/1b7a571)) diff --git a/node_modules/@textlint/textlint-plugin-text/LICENSE b/node_modules/@textlint/textlint-plugin-text/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/textlint-plugin-text/README.md b/node_modules/@textlint/textlint-plugin-text/README.md new file mode 100644 index 000000000..4b49e247b --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/README.md @@ -0,0 +1,73 @@ +# @textlint/textlint-plugin-text + +Plain text plugin for [textlint](https://github.com/textlint/textlint "textlint"). + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/textlint-plugin-text + +## Usage + +This plugin is built-in in textlint. +No need configuration. + +------ + +Following config is set by default. + +``` +{ + "plugins": { + "@textlint/text": true + } +} +``` + +## Options + +- `extensions`: `string[]` + - Additional file extensions for plain text + +For example, if you want to treat `.custom-ext` as text, put following config to `.textlintrc` + +```json5 +{ + "plugins": { + "@textlint/text": { + "extensions": [".custom-ext"] + } + } +} +``` +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.d.ts b/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.d.ts new file mode 100644 index 000000000..c2283dfc3 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.d.ts @@ -0,0 +1,18 @@ +import type { TextlintPluginProcessor, TextlintPluginOptions } from "@textlint/types"; +import { TxtNode } from "@textlint/ast-node-types"; +export declare class TextProcessor implements TextlintPluginProcessor { + config: TextlintPluginOptions; + extensions: Array; + constructor(config?: {}); + availableExtensions(): string[]; + processor(_ext: string): { + preProcess(text: string, _filePath?: string | undefined): TxtNode | { + text: string; + ast: TxtNode; + }; + postProcess(messages: Array, filePath?: string | undefined): { + messages: Array; + filePath: string; + }; + }; +} diff --git a/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.js b/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.js new file mode 100644 index 000000000..1101cdcbd --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.js @@ -0,0 +1,31 @@ +/* eslint-disable no-unused-vars */ +// LICENSE : MIT +"use strict"; +import { parse } from "@textlint/text-to-ast"; +var TextProcessor = /** @class */ (function () { + function TextProcessor(config) { + if (config === void 0) { config = {}; } + this.config = config; + // support "extension" option + this.extensions = this.config.extensions ? this.config.extensions : []; + } + TextProcessor.prototype.availableExtensions = function () { + return [".txt", ".text"].concat(this.extensions); + }; + TextProcessor.prototype.processor = function (_ext) { + return { + preProcess: function (text, _filePath) { + return parse(text); + }, + postProcess: function (messages, filePath) { + return { + messages: messages, + filePath: filePath ? filePath : "" + }; + } + }; + }; + return TextProcessor; +}()); +export { TextProcessor }; +//# sourceMappingURL=TextProcessor.js.map \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.js.map b/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.js.map new file mode 100644 index 000000000..8a96ec77d --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/module/TextProcessor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextProcessor.js","sourceRoot":"","sources":["../src/TextProcessor.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9C;IAGI,uBAAY,MAAW;QAAX,uBAAA,EAAA,WAAW;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,6BAA6B;QAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,CAAC;IAED,2CAAmB,GAAnB;QACI,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IAED,iCAAS,GAAT,UAAU,IAAY;QAClB,OAAO;YACH,UAAU,EAAV,UAAW,IAAY,EAAE,SAAkB;gBACvC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YACD,WAAW,EAAX,UAAY,QAAoB,EAAE,QAAiB;gBAC/C,OAAO;oBACH,QAAQ,UAAA;oBACR,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;iBAC3C,CAAC;YACN,CAAC;SACJ,CAAC;IACN,CAAC;IACL,oBAAC;AAAD,CAAC,AA1BD,IA0BC"} \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-text/module/index.d.ts b/node_modules/@textlint/textlint-plugin-text/module/index.d.ts new file mode 100644 index 000000000..a9c05cfb3 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/module/index.d.ts @@ -0,0 +1,5 @@ +import { TextProcessor } from "./TextProcessor"; +declare const _default: { + Processor: typeof TextProcessor; +}; +export default _default; diff --git a/node_modules/@textlint/textlint-plugin-text/module/index.js b/node_modules/@textlint/textlint-plugin-text/module/index.js new file mode 100644 index 000000000..9fcecaba4 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/module/index.js @@ -0,0 +1,7 @@ +// LICENSE : MIT +"use strict"; +import { TextProcessor } from "./TextProcessor"; +export default { + Processor: TextProcessor +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-text/module/index.js.map b/node_modules/@textlint/textlint-plugin-text/module/index.js.map new file mode 100644 index 000000000..2f367122b --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,eAAe;IACX,SAAS,EAAE,aAAa;CAC3B,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/textlint-plugin-text/package.json b/node_modules/@textlint/textlint-plugin-text/package.json new file mode 100644 index 000000000..2e174db2b --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/package.json @@ -0,0 +1,52 @@ +{ + "name": "@textlint/textlint-plugin-text", + "version": "4.3.5", + "description": "plain text plugin for textlint", + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/textlint-plugin-text/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "type": "lib/index.d.ts", + "main": "lib/index.js", + "module": "./module/index.js", + "directories": { + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/text-to-ast": "^3.3.5" + }, + "devDependencies": { + "@textlint/kernel": "^3.4.5", + "@types/mocha": "8.2.2", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "rimraf": "^3.0.2", + "textlint-rule-no-todo": "^2.0.1", + "ts-node": "9.1.1", + "ts-node-test-register": "9.0.1", + "typescript": "4.0.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/textlint-plugin-text/src/TextProcessor.ts b/node_modules/@textlint/textlint-plugin-text/src/TextProcessor.ts new file mode 100644 index 000000000..7e54f560c --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/src/TextProcessor.ts @@ -0,0 +1,34 @@ +/* eslint-disable no-unused-vars */ +// LICENSE : MIT +"use strict"; +import { parse } from "@textlint/text-to-ast"; +import type { TextlintPluginProcessor, TextlintPluginOptions } from "@textlint/types"; +import { TxtNode } from "@textlint/ast-node-types"; + +export class TextProcessor implements TextlintPluginProcessor { + config: TextlintPluginOptions; + extensions: Array; + constructor(config = {}) { + this.config = config; + // support "extension" option + this.extensions = this.config.extensions ? this.config.extensions : []; + } + + availableExtensions() { + return [".txt", ".text"].concat(this.extensions); + } + + processor(_ext: string) { + return { + preProcess(text: string, _filePath?: string): TxtNode | { text: string; ast: TxtNode } { + return parse(text); + }, + postProcess(messages: Array, filePath?: string): { messages: Array; filePath: string } { + return { + messages, + filePath: filePath ? filePath : "" + }; + } + }; + } +} diff --git a/node_modules/@textlint/textlint-plugin-text/src/index.ts b/node_modules/@textlint/textlint-plugin-text/src/index.ts new file mode 100644 index 000000000..05e1fc206 --- /dev/null +++ b/node_modules/@textlint/textlint-plugin-text/src/index.ts @@ -0,0 +1,6 @@ +// LICENSE : MIT +"use strict"; +import { TextProcessor } from "./TextProcessor"; +export default { + Processor: TextProcessor +}; diff --git a/node_modules/@textlint/types/CHANGELOG.md b/node_modules/@textlint/types/CHANGELOG.md new file mode 100644 index 000000000..62a253f25 --- /dev/null +++ b/node_modules/@textlint/types/CHANGELOG.md @@ -0,0 +1,481 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [1.5.5](https://github.com/textlint/textlint/compare/@textlint/types@1.5.4...@textlint/types@1.5.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/types + + + + + +## [1.5.4](https://github.com/textlint/textlint/compare/@textlint/types@1.5.3...@textlint/types@1.5.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/types + + + + + + +## [1.5.3](https://github.com/textlint/textlint/compare/@textlint/types@1.5.2...@textlint/types@1.5.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [1.5.2](https://github.com/textlint/textlint/compare/@textlint/types@1.5.1...@textlint/types@1.5.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [1.5.1](https://github.com/textlint/textlint/compare/@textlint/types@1.4.5...@textlint/types@1.5.1) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update dependency unist-util-select to ^3.0.2 ([8fcd244](https://github.com/textlint/textlint/commit/8fcd244)) +* **deps:** update dependency unist-util-select to ^3.0.4 ([42f2449](https://github.com/textlint/textlint/commit/42f2449)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [1.5.0](https://github.com/textlint/textlint/compare/@textlint/types@1.4.5...@textlint/types@1.5.0) (2021-01-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update dependency unist-util-select to ^3.0.2 ([8fcd244](https://github.com/textlint/textlint/commit/8fcd244)) +* **deps:** update dependency unist-util-select to ^3.0.4 ([42f2449](https://github.com/textlint/textlint/commit/42f2449)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [1.4.6](https://github.com/textlint/textlint/compare/@textlint/types@1.4.5...@textlint/types@1.4.6) (2020-12-22) + + +### Bug Fixes + +* fix tsconfig ([a722a6f](https://github.com/textlint/textlint/commit/a722a6f)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update dependency unist-util-select to ^3.0.2 ([8fcd244](https://github.com/textlint/textlint/commit/8fcd244)) +* **deps:** update dependency unist-util-select to ^3.0.4 ([42f2449](https://github.com/textlint/textlint/commit/42f2449)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [1.4.5](https://github.com/textlint/textlint/compare/@textlint/types@1.4.4...@textlint/types@1.4.5) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [1.4.4](https://github.com/textlint/textlint/compare/@textlint/types@1.4.3...@textlint/types@1.4.4) (2020-07-24) + + +### Chores + +* **@textlint/types:** module build is not needed ([a4c6e70](https://github.com/textlint/textlint/commit/a4c6e70)) + + + + + + +## [1.4.3](https://github.com/textlint/textlint/compare/@textlint/types@1.4.2...@textlint/types@1.4.3) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [1.4.2](https://github.com/textlint/textlint/compare/@textlint/types@1.4.1...@textlint/types@1.4.2) (2020-07-24) + +**Note:** Version bump only for package @textlint/types + + + + + + +## [1.4.1](https://github.com/textlint/textlint/compare/@textlint/types@1.4.0...@textlint/types@1.4.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [1.4.0](https://github.com/textlint/textlint/compare/@textlint/types@1.3.1...@textlint/types@1.4.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) +* **textlint-plugin-text:** Fix TextlintPluginProcessor.preProcess type ([7880037](https://github.com/textlint/textlint/commit/7880037)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [1.3.1](https://github.com/textlint/textlint/compare/@textlint/types@1.3.0...@textlint/types@1.3.1) (2020-02-07) + +**Note:** Version bump only for package @textlint/types + + + + + + +# [1.3.0](https://github.com/textlint/textlint/compare/@textlint/types@1.2.2...@textlint/types@1.3.0) (2020-01-07) + + +### Documentation + +* **textlint/types:** Add FAQ ([9652c33](https://github.com/textlint/textlint/commit/9652c33)) + + +### Features + +* **types:** allow plugin's `preProcess` return { text, ast } ([db56bc4](https://github.com/textlint/textlint/commit/db56bc4)) + + +### Styles + +* update style ([dc78f87](https://github.com/textlint/textlint/commit/dc78f87)) + + + + + + +## [1.2.3](https://github.com/textlint/textlint/compare/@textlint/types@1.2.2...@textlint/types@1.2.3) (2019-11-03) + + +### Documentation + +* **textlint/types:** Add FAQ ([9652c33](https://github.com/textlint/textlint/commit/9652c33)) + + +### Styles + +* update style ([dc78f87](https://github.com/textlint/textlint/commit/dc78f87)) + + + + + + +## [1.2.2](https://github.com/textlint/textlint/compare/@textlint/types@1.2.1...@textlint/types@1.2.2) (2019-10-14) + +**Note:** Version bump only for package @textlint/types + + + + + + +## [1.2.1](https://github.com/textlint/textlint/compare/@textlint/types@1.1.5...@textlint/types@1.2.1) (2019-07-20) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + +### Documentation + +* **types:** Update [@textlint](https://github.com/textlint)/types README ([da72b09](https://github.com/textlint/textlint/commit/da72b09)) + + +### Features + +* **types:** add generics parameter to TextlintRuleReporter ([#615](https://github.com/textlint/textlint/issues/615)) ([963324b](https://github.com/textlint/textlint/commit/963324b)) + + + + + + +# [1.2.0](https://github.com/textlint/textlint/compare/@textlint/types@1.1.5...@textlint/types@1.2.0) (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + +### Documentation + +* **types:** Update [@textlint](https://github.com/textlint)/types README ([da72b09](https://github.com/textlint/textlint/commit/da72b09)) + + +### Features + +* **types:** add generics parameter to TextlintRuleReporter ([#615](https://github.com/textlint/textlint/issues/615)) ([963324b](https://github.com/textlint/textlint/commit/963324b)) + + + + + + +## [1.1.5](https://github.com/textlint/textlint/compare/@textlint/types@1.1.4...@textlint/types@1.1.5) (2019-04-30) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + + + + + +## [1.1.4](https://github.com/textlint/textlint/compare/@textlint/types@1.1.3...@textlint/types@1.1.4) (2019-04-30) + + +### Code Refactoring + +* **textlint:** move normalization logic to [@textlint](https://github.com/textlint)/types ([9930809](https://github.com/textlint/textlint/commit/9930809)) + + + + + + +## [1.1.3](https://github.com/textlint/textlint/compare/@textlint/types@1.1.2...@textlint/types@1.1.3) (2019-02-10) + + +### Bug Fixes + +* **textlint:** add reasonable debug log ([3931810](https://github.com/textlint/textlint/commit/3931810)) + + + + + + +## [1.1.2](https://github.com/textlint/textlint/compare/@textlint/types@1.1.1...@textlint/types@1.1.2) (2019-01-03) + + +### Bug Fixes + +* **types:** allow other node type for RuleReportHandler ([fbc73e7](https://github.com/textlint/textlint/commit/fbc73e7)) + + + + + + +## [1.1.1](https://github.com/textlint/textlint/compare/@textlint/types@1.1.0...@textlint/types@1.1.1) (2019-01-03) + + +### Bug Fixes + +* **types:** enhance `TextlintRuleReportHandler` typing ([aa354d1](https://github.com/textlint/textlint/commit/aa354d1)) + + + + + + +# 1.1.0 (2019-01-01) + + +### Bug Fixes + +* **types:** fix name of type definition ([67d9c49](https://github.com/textlint/textlint/commit/67d9c49)) + + +### Chores + +* **textlint:** restore get severity() ([6057210](https://github.com/textlint/textlint/commit/6057210)) + + +### Code Refactoring + +* **kernel:** move report()/shouldIgnore() definition to types ([601ce3a](https://github.com/textlint/textlint/commit/601ce3a)) +* **types:** move type definition for rule to [@textlint](https://github.com/textlint)/types ([9be6e16](https://github.com/textlint/textlint/commit/9be6e16)) + + +### Documentation + +* **types:** Update README ([ab1e2ba](https://github.com/textlint/textlint/commit/ab1e2ba)) + + +### Features + +* **types:** add ReportHandler types ([d5ffe55](https://github.com/textlint/textlint/commit/d5ffe55)) +* **types:** Move TextlintResult/TextlintMessage type to [@textlint](https://github.com/textlint)/types ([b2a03a1](https://github.com/textlint/textlint/commit/b2a03a1)) + + +### Tests + +* **types:** Move SourceCode test to types ([ec61d65](https://github.com/textlint/textlint/commit/ec61d65)) diff --git a/node_modules/@textlint/types/LICENSE b/node_modules/@textlint/types/LICENSE new file mode 100644 index 000000000..f9d0172e9 --- /dev/null +++ b/node_modules/@textlint/types/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/types/README.md b/node_modules/@textlint/types/README.md new file mode 100644 index 000000000..2a9fc5afa --- /dev/null +++ b/node_modules/@textlint/types/README.md @@ -0,0 +1,106 @@ +# @textlint/types + +Type definition and Typed object package for textlint and textlint rule. + +If you import types from `@textlint/kernel` in your rule module, please use `@textlint/types` instead of it. + +## Types + +### Rule types + +Rule types includes following definition. + +- Rule module types +- Rule report function types +- Rule Context types + +Rule types is depended from textlint's rule module and `@textlint/kernel`. +By contrasts, textlint's rule module should not depended on `@textlint/kernel` + +- OK: Rule types <--- Rule module +- OK: Rule types <--- Kernel module +- NG: Kernel module <--- Rule module +- NG: Kernel module ---> Rule module + +### Abstraction Layer + +`@textlint/types` does not includes implementations. +In other words, It has only type definition file. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/types + +## Usage + +```ts +import type { TextlintSourceCode, TextlintSourceCodeArgs, TextlintSourceCodeLocation, TextlintSourceCodePosition, TextlintSourceCodeRange } from "@textlint/types"; +import type { TextlintRuleContextFixCommand } from "@textlint/types"; +import type { TextlintRuleContextFixCommandGenerator } from "@textlint/types"; +import type { TextlintRuleError, TextlintRuleErrorPadding, TextlintRuleReportedObject } from "@textlint/types"; +import type { TextlintRuleSeverityLevel } from "@textlint/types"; +import type { TextlintRuleContext, TextlintRuleContextArgs, TextlintRuleContextReportFunction, TextlintRuleContextReportFunctionArgs } from "@textlint/types"; +import type { TextlintRuleOptions } from "@textlint/types"; +import type { TextlintRuleReporter, TextlintFixableRuleModule, TextlintRuleModule, TextlintRuleReportHandler } from "@textlint/types"; +import type { TextlintFilterRuleContext, TextlintFilterRuleShouldIgnoreFunction, TextlintFilterRuleShouldIgnoreFunctionArgs } from "@textlint/types"; +import type { TextlintFilterRuleModule, TextlintFilterRuleOptions, TextlintFilterRuleReporter, TextlintFilterRuleReportHandler } from "@textlint/types"; +import type { TextlintPluginCreator, TextlintPluginOptions, TextlintPluginProcessor, TextlintPluginProcessorConstructor } from "@textlint/types"; +``` + +## FAQ + +### Occur incompatible types between `@textlint/types` and other module like `textlint-rule-helper` + +You should check if your `@textlint/types` dependencies is duplicated. + +`@textlint/types` should be deduped. + +``` +npm ls @textlint/types +``` + +If your dependencies is duplicated, you should update modules that are depended on `@textlint/types`. + +## Versioning Policy + +`@textlint/types` is not semantic versioning. +Because, This library provide only TypeScript definition. + +It is hard that we follow a semantic versioning. + +- patch: fix bugs, maybe includes breaking change +- minor: add new types, maybe includes breaking change +- major: includes breaking change + +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + npm test + +## Contributing + +Pull requests and stars are always welcome. + +For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/types/package.json b/node_modules/@textlint/types/package.json new file mode 100644 index 000000000..7f81b3956 --- /dev/null +++ b/node_modules/@textlint/types/package.json @@ -0,0 +1,65 @@ +{ + "name": "@textlint/types", + "version": "1.5.5", + "description": "Type definition package for textlint", + "keywords": [ + "definition", + "textlint", + "types", + "typescript" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/types/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib", + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "src/" + ], + "scripts": { + "build": "tsc -b", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo", + "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", + "prepublish": "npm run --if-present build", + "test": "tsc -b test", + "watch": "tsc -b --watch" + }, + "prettier": { + "printWidth": 120, + "singleQuote": false, + "tabWidth": 4 + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + }, + "devDependencies": { + "@textlint/markdown-to-ast": "^6.3.5", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "prettier": "^2.1.1", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2", + "unist-util-select": "^3.0.4" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/types/src/Message/TextlintResult.ts b/node_modules/@textlint/types/src/Message/TextlintResult.ts new file mode 100644 index 000000000..75d3dd1c5 --- /dev/null +++ b/node_modules/@textlint/types/src/Message/TextlintResult.ts @@ -0,0 +1,48 @@ +// "range" will be replaced by "text" +export interface TextlintMessageFixCommand { + text: string; + range: [number, number]; +} + +export interface TextlintMessage { + // See src/shared/type/MessageType.js + // Message Type + type: string; + // Rule Id + ruleId: string; + message: string; + // optional data + data?: any; + // FixCommand + fix?: TextlintMessageFixCommand; + // location info + // Text -> AST TxtNode(0-based columns) -> textlint -> TextlintMessage(**1-based columns**) + line: number; // start with 1 + column: number; // start with 1 + // indexed-location + index: number; // start with 0 + // Severity Level + // See src/shared/type/SeverityLevel.js + severity: number; +} + +// Linting result +export interface TextlintResult { + filePath: string; + messages: TextlintMessage[]; +} + +// Fixing result +export interface TextlintFixResult { + filePath: string; + // fixed content + output: string; + // all messages = pre-applyingMessages + remainingMessages + // it is same with one of `TextlintResult` + messages: TextlintMessage[]; + // applied fixable messages + applyingMessages: TextlintMessage[]; + // original means original for applyingMessages and remainingMessages + // pre-applyingMessages + remainingMessages + remainingMessages: TextlintMessage[]; +} diff --git a/node_modules/@textlint/types/src/Plugin/TextlintPluginModule.ts b/node_modules/@textlint/types/src/Plugin/TextlintPluginModule.ts new file mode 100644 index 000000000..436ed9449 --- /dev/null +++ b/node_modules/@textlint/types/src/Plugin/TextlintPluginModule.ts @@ -0,0 +1,53 @@ +// Plugin +import { TxtNode } from "@textlint/ast-node-types"; + +/** + * textlint plugin option values is object or boolean. + * if this option value is false, disable the plugin. + */ +export declare type TextlintPluginOptions = { + [index: string]: any; +}; + +export interface TextlintPluginProcessorConstructor extends Function { + new (options?: TextlintPluginOptions): TextlintPluginProcessor; + + /** + * Should defined `availableExtensions()` as instance method instead of static method. + * @deprecated textlint@11+ + * @see https://github.com/textlint/textlint/issues/531 + */ + availableExtensions?(): Array; +} + +export declare class TextlintPluginProcessor { + constructor(options?: TextlintPluginOptions); + + /** + * Return available extensions for this plugin. + * This extension should start with `.`(dot). + * Example is [".md", ".mkd"] + */ + availableExtensions(): Array; + + processor( + extension: string + ): { + /** + * plugin's `preProcess` return a TxtParentNode or text and AST. + * If your plugin use different text for original file, the plugin should return the text and an AST for the text. + * For example, a plugin for binary format. + * textlint can not handle binary and the plugin should return Pseudo-text for original binary file. + * @see https://github.com/textlint/textlint/issues/649 + * @param text + * @param filePath + */ + preProcess(text: string, filePath?: string): TxtNode | { text: string; ast: TxtNode }; + postProcess(messages: Array, filePath?: string): { messages: Array; filePath: string }; + }; +} + +// textlint plugin module should export this interface +export interface TextlintPluginCreator { + Processor: TextlintPluginProcessorConstructor; +} diff --git a/node_modules/@textlint/types/src/Rule/BaseRuleContext.ts b/node_modules/@textlint/types/src/Rule/BaseRuleContext.ts new file mode 100644 index 000000000..d1fbc8760 --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/BaseRuleContext.ts @@ -0,0 +1,61 @@ +import { TextlintRuleErrorConstructor } from "./TextlintRuleError"; +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types"; +import { TextlintRuleSeverityLevel } from "./TextlintRuleSeverityLevel"; + +/** + * This Base class is internal. + * @internal + */ +export interface BaseRuleContext { + /** + * Return rule id + */ + id: string; + + /** + * Node's type values + * @type {TextLintNodeType} + */ + Syntax: typeof ASTNodeTypes; + + /** + * Return rule "severity" level + */ + severity: TextlintRuleSeverityLevel; + + /** + * CustomError object + * @type {RuleError} + */ + RuleError: TextlintRuleErrorConstructor; + + /** + * get file path current processing. + * if process text like stdin, return undefined + */ + getFilePath(): string | undefined; + + /** + * Gets the source code for the given node. + * @param {TxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string|null} The text representing the AST node. + */ + getSource(node: TxtNode, beforeCount?: number, afterCount?: number): string; + + /** + * get config base directory path + * config base directory path often is the place of .textlintrc + * + * e.g.) /path/to/dir/.textlintrc + * `getConfigBaseDir()` return `"/path/to/dir/"`. + * + * When using textlint as module, it is specified by `configBaseDir` + * If not found the value, return undefined. + * + * You can use it for resolving relative path from config dir. + * @returns {string|undefined} + */ + getConfigBaseDir(): string | undefined; +} diff --git a/node_modules/@textlint/types/src/Rule/TextlintFilterRuleContext.ts b/node_modules/@textlint/types/src/Rule/TextlintFilterRuleContext.ts new file mode 100644 index 000000000..59a5d1a9c --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintFilterRuleContext.ts @@ -0,0 +1,51 @@ +// LICENSE : MIT +"use strict"; +import { TextlintSourceCode } from "../Source/TextlintSourceCode"; +import { BaseRuleContext } from "./BaseRuleContext"; +import { TextlintRuleSeverityLevel } from "./TextlintRuleSeverityLevel"; + +/** + * Message of ignoring + * @typedef {Object} ReportIgnoreMessage + * @property {string} ruleId + * @property {number[]} range + * @property {string} ignoringRuleId to ignore ruleId + * "*" is special case, it match all ruleId(work as wildcard). + */ +export interface TextlintFilterRuleShouldIgnoreFunctionArgs { + ruleId: string; + range: [number, number]; + optional: { + ruleId?: string; + }; +} + +export declare type TextlintFilterRuleShouldIgnoreFunction = (args: TextlintFilterRuleShouldIgnoreFunctionArgs) => void; + +/** + * Rule context object is passed to each rule as `context` + * @param {string} ruleId + * @param {TextlintSourceCode} sourceCode + * @param {ReportCallback} report + * @param {Object|boolean|undefined} ruleOptions + * @param {string} [configBaseDir] + * @constructor + */ +export interface TextlintFilterRuleContextArgs { + ruleId: string; + ignoreReport: TextlintFilterRuleShouldIgnoreFunction; + sourceCode: TextlintSourceCode; + configBaseDir?: string; + severityLevel: TextlintRuleSeverityLevel; +} + +/** + * Rule context object is passed to each rule as `context` + * @param ruleId + * @param sourceCode + * @param ignoreReport shouldIgnore function + * @constructor + */ +export interface TextlintFilterRuleContext extends BaseRuleContext { + shouldIgnore(range: [number, number], optional: {}): void; +} diff --git a/node_modules/@textlint/types/src/Rule/TextlintFilterRuleModule.ts b/node_modules/@textlint/types/src/Rule/TextlintFilterRuleModule.ts new file mode 100644 index 000000000..8d6ef93e8 --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintFilterRuleModule.ts @@ -0,0 +1,34 @@ +/** + * Filter rule reporter function + */ +import { TextlintFilterRuleContext } from "./TextlintFilterRuleContext"; +import { ASTNodeTypes, TypeofTxtNode } from "@textlint/ast-node-types"; +/** + * textlint filter rule option values is object or boolean. + * if this option value is false, disable the filter rule. + */ +export type TextlintFilterRuleOptions = { + [index: string]: any; +}; + +/** + * Rule Reporter Handler object define handler for each TxtNode type. + */ +export type TextlintFilterRuleReportHandler = { + [P in ASTNodeTypes]?: (node: TypeofTxtNode

) => void | Promise; +} & { + [index: string]: (node: any) => void | Promise; +}; + +/** + * textlint filter rule report function + */ +export type TextlintFilterRuleReporter = ( + context: Readonly, + options?: TextlintFilterRuleOptions +) => TextlintFilterRuleReportHandler; +/** + * textlint filter module exports + * Currently, module.exports = reporter; + */ +export type TextlintFilterRuleModule = TextlintFilterRuleReporter; diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleContext.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleContext.ts new file mode 100644 index 000000000..1b6d0656d --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleContext.ts @@ -0,0 +1,46 @@ +// LICENSE : MIT +"use strict"; + +import { BaseRuleContext } from "./BaseRuleContext"; +import { TxtNode } from "@textlint/ast-node-types"; +import { TextlintRuleError, TextlintRuleReportedObject } from "./TextlintRuleError"; +import { TextlintRuleSeverityLevel } from "./TextlintRuleSeverityLevel"; +import { TextlintSourceCode } from "../Source/TextlintSourceCode"; +import { TextlintRuleContextFixCommandGenerator } from "./TextlintRuleContextFixCommandGenerator"; + +/** + * context.report function + */ +export interface TextlintRuleContextReportFunctionArgs { + ruleId: string; + node: TxtNode; + severity: number; + ruleError: TextlintRuleError | TextlintRuleReportedObject; +} + +/** + * Rule's context.report() function + */ +export type TextlintRuleContextReportFunction = (args: TextlintRuleContextReportFunctionArgs) => void; + +/** + * Rule context object is passed to each rule as `context` + * @param {string} ruleId + * @param {TextlintSourceCode} sourceCode + * @param {ReportCallback} report + * @param {Object|boolean|undefined} ruleOptions + * @param {string} [configBaseDir] + * @constructor + */ +export interface TextlintRuleContextArgs { + ruleId: string; + sourceCode: TextlintSourceCode; + report: TextlintRuleContextReportFunction; + configBaseDir?: string; + severityLevel: TextlintRuleSeverityLevel; +} + +export interface TextlintRuleContext extends BaseRuleContext { + fixer: TextlintRuleContextFixCommandGenerator; + report: (node: TxtNode, ruleError: TextlintRuleReportedObject | TextlintRuleError, _shouldNotUsed?: any) => void; +} diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleContextFixCommand.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleContextFixCommand.ts new file mode 100644 index 000000000..8be43bc14 --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleContextFixCommand.ts @@ -0,0 +1,9 @@ +/** + * `RuleReporterFixCommand` is intermediate object between Rule report and Kernel. + * `IntermediateFixCommand` has also `isAbsolute` flag value. + */ +export interface TextlintRuleContextFixCommand { + text: string; + range: number[]; + isAbsolute: boolean; +} diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleContextFixCommandGenerator.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleContextFixCommandGenerator.ts new file mode 100644 index 000000000..570a419ca --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleContextFixCommandGenerator.ts @@ -0,0 +1,90 @@ +import { TxtNode } from "@textlint/ast-node-types"; +import { TextlintSourceCodeRange } from "../Source/TextlintSourceCode"; +import { TextlintRuleContextFixCommand } from "./TextlintRuleContextFixCommand"; + +/** + * Creates code fixing commands for rules. + * It create command for fixing texts. + * The `range` arguments of these command is should be **relative** value from reported node. + * See {@link SourceLocation} class for more detail. + * @constructor + */ +export interface TextlintRuleContextFixCommandGenerator { + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert after. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfter(node: TxtNode, text: string): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextAfterRange(range: TextlintSourceCodeRange, text: string): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to insert before. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBefore(node: TxtNode, text: string): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + insertTextBeforeRange(range: TextlintSourceCodeRange, text: string): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceText(node: TxtNode, text: string): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to replace, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @param {string} text The text to insert. + * @returns {IntermediateFixCommand} The fix command. + */ + replaceTextRange(range: TextlintSourceCodeRange, text: string): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {TxtNode} node The node or token to remove. + * @returns {IntermediateFixCommand} The fix command. + */ + remove(node: TxtNode): TextlintRuleContextFixCommand; + + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {number[]} range The range to remove, first item is start of range, second + * is end of range. + * The `range` should be **relative** value from reported node. + * @returns {IntermediateFixCommand} The fix command. + */ + removeRange(range: TextlintSourceCodeRange): TextlintRuleContextFixCommand; +} diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleError.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleError.ts new file mode 100644 index 000000000..c4063b2ab --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleError.ts @@ -0,0 +1,41 @@ +// LICENSE : MIT +"use strict"; +import { TextlintRuleContextFixCommand } from "./TextlintRuleContextFixCommand"; + +/** + * Object version of RuleError + * It is undocument way. Please dont use it. + * + * report(node, { + * message: "" + * }) + */ +export interface TextlintRuleReportedObject { + line?: number; + column?: number; + index?: number; + fix?: TextlintRuleContextFixCommand; + message: string; + severity?: number; + + [index: string]: any; +} + +export interface TextlintRuleErrorPadding { + line?: number; + column?: number; + index?: number; + fix?: TextlintRuleContextFixCommand; +} + +export interface TextlintRuleErrorConstructor { + new (message: string, paddingLocation?: number | TextlintRuleErrorPadding): TextlintRuleError; +} + +export interface TextlintRuleError { + readonly message: string; + readonly line?: number; + readonly column?: number; + readonly index?: number; + readonly fix?: TextlintRuleContextFixCommand; +} diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleModule.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleModule.ts new file mode 100644 index 000000000..b9f87dae9 --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleModule.ts @@ -0,0 +1,36 @@ +/** + * Rule reporter function + */ +import { ASTNodeTypes, TypeofTxtNode } from "@textlint/ast-node-types"; +import { TextlintRuleOptions } from "./TextlintRuleOptions"; +import { TextlintRuleContext } from "./TextlintRuleContext"; +/** + * Rule Reporter Handler object define handler for each TxtNode type. + * + * Note: *Handler* naming is come from ES Proxy. + * `new Proxy(target, handler)` + * + * Each comment is example value of Markdown + */ +export type TextlintRuleReportHandler = { [P in ASTNodeTypes]?: (node: TypeofTxtNode

) => void | Promise } & { + [index: string]: (node: any) => void | Promise; +}; + +/** + * Textlint rule reporter function + */ +export type TextlintRuleReporter = ( + context: Readonly, + options?: TextlintRuleOptions +) => TextlintRuleReportHandler; +/** + * If Textlint rule has fixer, it should both of { linter, fixer }. + */ +export type TextlintFixableRuleModule = { + linter: TextlintRuleReporter; + fixer: TextlintRuleReporter; +}; +/** + * module.export = reporter | { linter, fixer } + */ +export type TextlintRuleModule = TextlintRuleReporter | TextlintFixableRuleModule; diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleOptions.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleOptions.ts new file mode 100644 index 000000000..14af9b1d0 --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleOptions.ts @@ -0,0 +1,10 @@ +/** + * textlint rule option values is object or boolean. + * if this option value is false, disable the rule. + */ +import { TextlintRuleSeverityLevel } from "./TextlintRuleSeverityLevel"; + +export type TextlintRuleOptions = { + [index: string]: any; + severity?: TextlintRuleSeverityLevel; +} & T; diff --git a/node_modules/@textlint/types/src/Rule/TextlintRuleSeverityLevel.ts b/node_modules/@textlint/types/src/Rule/TextlintRuleSeverityLevel.ts new file mode 100644 index 000000000..f4ded5036 --- /dev/null +++ b/node_modules/@textlint/types/src/Rule/TextlintRuleSeverityLevel.ts @@ -0,0 +1,9 @@ +/** + * Severity Level list + * It is used in configuration and message + */ +type none = 0; +type info = 0; +type warning = 1; +type error = 2; +export type TextlintRuleSeverityLevel = none | info | warning | error; diff --git a/node_modules/@textlint/types/src/Source/TextlintSourceCode.ts b/node_modules/@textlint/types/src/Source/TextlintSourceCode.ts new file mode 100644 index 000000000..55234a84a --- /dev/null +++ b/node_modules/@textlint/types/src/Source/TextlintSourceCode.ts @@ -0,0 +1,74 @@ +import { AnyTxtNode, ASTNodeTypes } from "@textlint/ast-node-types"; + +export interface TextlintSourceCodePosition { + line: number; + column: number; +} + +/** + * Line number starts with 1. + * Column number starts with 0. + */ +export interface TextlintSourceCodeLocation { + start: TextlintSourceCodePosition; + end: TextlintSourceCodePosition; +} + +export type TextlintSourceCodeRange = [number, number]; +export type TextlintSourceCodeArgs = { text: string; ast: AnyTxtNode; ext: string; filePath?: string }; + +/** + * This class represent of source code. + */ +export interface TextlintSourceCode { + readonly hasBOM: boolean; + readonly text: string; + readonly ast: AnyTxtNode; + readonly filePath: string | undefined; + readonly ext: string; + + /** + * @returns {ASTNodeTypes} + */ + getSyntax(): typeof ASTNodeTypes; + + /** + * get filePath + * @returns {string|undefined} + */ + getFilePath(): string | undefined; + + /** + * Gets the source code for the given node. + * @param {AnyTxtNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + getSource(node?: AnyTxtNode, beforeCount?: number, afterCount?: number): string; + + // StructuredSource wrapper + /** + * @param {TextlintSourceCodeLocation} loc - location indicator. + * @return {[ number, number ]} range. + */ + locationToRange(loc: TextlintSourceCodeLocation): TextlintSourceCodeRange; + + /** + * @param {[ number, number ]} range - pair of indice. + * @return {TextlintSourceCodeLocation} location. + */ + rangeToLocation(range: TextlintSourceCodeRange): TextlintSourceCodeLocation; + + /** + * @param {Position} pos - position indicator. + * @return {number} index. + */ + positionToIndex(pos: TextlintSourceCodePosition): number; + + /** + * @param {number} index - index to the source code. + * @return {Position} position. + */ + indexToPosition(index: number): TextlintSourceCodePosition; +} diff --git a/node_modules/@textlint/types/src/index.ts b/node_modules/@textlint/types/src/index.ts new file mode 100644 index 000000000..032b69fea --- /dev/null +++ b/node_modules/@textlint/types/src/index.ts @@ -0,0 +1,66 @@ +/** + * @fileoverview + * Public function and interface should be included `Textlint` prefix or postfix. + * It aim to avoid conflict naming on user land code. + */ + +// SourceCode +export type { + TextlintSourceCode, + TextlintSourceCodeArgs, + TextlintSourceCodeLocation, + TextlintSourceCodePosition, + TextlintSourceCodeRange, +} from "./Source/TextlintSourceCode"; +// RuleContext +export type { TextlintRuleContextFixCommand } from "./Rule/TextlintRuleContextFixCommand"; +export type { TextlintRuleContextFixCommandGenerator } from "./Rule/TextlintRuleContextFixCommandGenerator"; +export type { + TextlintRuleError, + TextlintRuleErrorConstructor, + TextlintRuleErrorPadding, + TextlintRuleReportedObject, +} from "./Rule/TextlintRuleError"; +export type { TextlintRuleSeverityLevel } from "./Rule/TextlintRuleSeverityLevel"; +// Rule +export type { + TextlintRuleContext, + TextlintRuleContextArgs, + TextlintRuleContextReportFunction, + TextlintRuleContextReportFunctionArgs, +} from "./Rule/TextlintRuleContext"; +export type { TextlintRuleOptions } from "./Rule/TextlintRuleOptions"; +export type { + TextlintRuleReporter, + TextlintFixableRuleModule, + TextlintRuleModule, + TextlintRuleReportHandler, +} from "./Rule/TextlintRuleModule"; +// Filter Rule +export type { + TextlintFilterRuleContext, + TextlintFilterRuleContextArgs, + TextlintFilterRuleShouldIgnoreFunction, + TextlintFilterRuleShouldIgnoreFunctionArgs, +} from "./Rule/TextlintFilterRuleContext"; +export type { + TextlintFilterRuleModule, + TextlintFilterRuleOptions, + TextlintFilterRuleReporter, + TextlintFilterRuleReportHandler, +} from "./Rule/TextlintFilterRuleModule"; +// Plugin +export type { + TextlintPluginCreator, + TextlintPluginOptions, + TextlintPluginProcessor, + TextlintPluginProcessorConstructor, +} from "./Plugin/TextlintPluginModule"; +// Output message from textlint +// This types is come from output of textlint lint results +export type { + TextlintResult, + TextlintFixResult, + TextlintMessage, + TextlintMessageFixCommand, +} from "./Message/TextlintResult"; diff --git a/node_modules/@textlint/utils/CHANGELOG.md b/node_modules/@textlint/utils/CHANGELOG.md new file mode 100644 index 000000000..49a057fc7 --- /dev/null +++ b/node_modules/@textlint/utils/CHANGELOG.md @@ -0,0 +1,283 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [1.2.5](https://github.com/textlint/textlint/compare/@textlint/utils@1.2.4...@textlint/utils@1.2.5) (2021-05-08) + +**Note:** Version bump only for package @textlint/utils + + + + + +## [1.2.4](https://github.com/textlint/textlint/compare/@textlint/utils@1.2.3...@textlint/utils@1.2.4) (2021-03-21) + +**Note:** Version bump only for package @textlint/utils + + + + + + +## [1.2.3](https://github.com/textlint/textlint/compare/@textlint/utils@1.2.2...@textlint/utils@1.2.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [1.2.2](https://github.com/textlint/textlint/compare/@textlint/utils@1.2.1...@textlint/utils@1.2.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [1.2.1](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.4...@textlint/utils@1.2.1) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [1.2.0](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.4...@textlint/utils@1.2.0) (2021-01-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [1.1.5](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.4...@textlint/utils@1.1.5) (2020-12-22) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [1.1.4](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.3...@textlint/utils@1.1.4) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [1.1.3](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.2...@textlint/utils@1.1.3) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [1.1.2](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.1...@textlint/utils@1.1.2) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [1.1.1](https://github.com/textlint/textlint/compare/@textlint/utils@1.1.0...@textlint/utils@1.1.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [1.1.0](https://github.com/textlint/textlint/compare/@textlint/utils@1.0.3...@textlint/utils@1.1.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) + + +### Code Refactoring + +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [1.0.3](https://github.com/textlint/textlint/compare/@textlint/utils@1.0.2...@textlint/utils@1.0.3) (2019-10-14) + +**Note:** Version bump only for package @textlint/utils + + + + + + +## 1.0.2 (2019-07-20) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + + + + + +## 1.0.1 (2019-07-13) + + +### Code Refactoring + +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) diff --git a/node_modules/@textlint/utils/LICENSE b/node_modules/@textlint/utils/LICENSE new file mode 100644 index 000000000..add9e8e8b --- /dev/null +++ b/node_modules/@textlint/utils/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2019 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@textlint/utils/README.md b/node_modules/@textlint/utils/README.md new file mode 100644 index 000000000..e3c9387a0 --- /dev/null +++ b/node_modules/@textlint/utils/README.md @@ -0,0 +1,47 @@ +# @textlint/utils + +textlint internal utils. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install @textlint/utils + +## Usage + +This utils is internal usage. + +- [@textlint/types] has only abstract interface. +- [@textlint/utils] has implementation + +## Changelog + +See [Releases page](https://github.com/textlint/textlint/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + npm test + +## Contributing + +Pull requests and stars are always welcome. + +For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.d.ts b/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.d.ts new file mode 100644 index 000000000..00825d766 --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.d.ts @@ -0,0 +1,11 @@ +/** + * split "preset/rule" string to {preset, rule} + */ +export declare const splitKeyToPresetSubRule: (name: string) => { + preset: string | null; + rule: string; +}; +/** + * Remove `prefix` from `text`. + */ +export declare const removePrefixFromPackageName: (prefixList: string[], packageName: string) => string; diff --git a/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.js b/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.js new file mode 100644 index 000000000..d3c79ca14 --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.js @@ -0,0 +1,55 @@ +// @org/preset/@org/rule +var patternOrgXOrg = /^(@.*?\/.*?)\/(@.*?\/.*?)$/; +// @org/preset/rule +var patternOrgXRule = /^(@.*?\/.*?)\/(.*?)$/; +// preset/@org/rule +var patternPresetXOrg = /^(.*?)\/(@.*?)$/; +// preset/rule +var patternPresetXRule = /^([^@].*?)\/(.*?)$/; +/** + * pattern list of key path + */ +var patternList = [patternOrgXOrg, patternOrgXRule, patternPresetXOrg, patternPresetXRule]; +/** + * split "preset/rule" string to {preset, rule} + */ +export var splitKeyToPresetSubRule = function (name) { + for (var i = 0; i < patternList.length; i++) { + var pattern = patternList[i]; + var result = name.match(pattern); + if (!result) { + continue; + } + return { preset: result[1], rule: result[2] }; + } + // Other case is a single rule + // @org/rule or rule + return { + preset: null, + rule: name, + }; +}; +/** + * Remove `prefix` from `text`. + */ +export var removePrefixFromPackageName = function (prefixList, packageName) { + for (var i = 0; i < prefixList.length; i++) { + var prefix = prefixList[i]; + // @scope/name -> @scope/name + // @scope/textlint-rule-name -> @scope/name + if (packageName.charAt(0) === "@") { + var _a = packageName.split("/"), namespace = _a[0], name_1 = _a[1]; + if (name_1.startsWith(prefix)) { + return namespace + "/" + name_1.slice(prefix.length); + } + } + // name -> name + // textlint-rule-name -> name + else if (packageName.startsWith(prefix)) { + return packageName.slice(prefix.length); + } + } + // No match + return packageName; +}; +//# sourceMappingURL=KeyPathUtil.js.map \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.js.map b/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.js.map new file mode 100644 index 000000000..0007286dc --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/KeyPathUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"KeyPathUtil.js","sourceRoot":"","sources":["../../src/KeyPath/KeyPathUtil.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,IAAM,cAAc,GAAG,4BAA4B,CAAC;AACpD,mBAAmB;AACnB,IAAM,eAAe,GAAG,sBAAsB,CAAC;AAC/C,mBAAmB;AACnB,IAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,cAAc;AACd,IAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD;;GAEG;AACH,IAAM,WAAW,GAAG,CAAC,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAC7F;;GAEG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAC,IAAY;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACzC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE;YACT,SAAS;SACZ;QACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;KACjD;IACD,8BAA8B;IAC9B,oBAAoB;IACpB,OAAO;QACH,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;KACb,CAAC;AACN,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG,UAAC,UAAoB,EAAE,WAAmB;IACjF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,6BAA6B;QAC7B,2CAA2C;QAC3C,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACzB,IAAA,KAAoB,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAzC,SAAS,QAAA,EAAE,MAAI,QAA0B,CAAC;YACjD,IAAI,MAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBACzB,OAAU,SAAS,SAAI,MAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAG,CAAC;aACtD;SACJ;QACD,eAAe;QACf,6BAA6B;aACxB,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YACrC,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC3C;KACJ;IACD,WAAW;IACX,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.d.ts b/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.d.ts new file mode 100644 index 000000000..addc5078b --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.d.ts @@ -0,0 +1,37 @@ +/** + * normalize `keyPath` that is specific path for rule + * This normalize function handle ambiguity `key` + * `keyPath` is one of "preset/rule` key, or "rule" key + * + * Note: `textlint-rule-textlint-rule-x`(twice!) is normalized at once. + * It is edge case and this function can not treat it. + * @param keyPath + */ +export declare const normalizeTextlintKeyPath: (keyPath: string) => string; +/** + * Normalize to preset-name/rule-name + */ +export declare const normalizeTextlintPresetSubRuleKey: (names: { + preset: string; + rule: string; +}) => string; +/** + * Normalize rule key + * @param name + */ +export declare const normalizeTextlintRuleKey: (name: string) => string; +/** + * Normalize filter rule key + * @param name + */ +export declare const normalizeTextlintFilterRuleKey: (name: string) => string; +/** + * Normalize rule preset key + * @param name + */ +export declare const normalizeTextlintRulePresetKey: (name: string) => string; +/** + * Normalize plugin key + * @param name + */ +export declare const normalizeTextlintPluginKey: (name: string) => string; diff --git a/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.js b/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.js new file mode 100644 index 000000000..fef0c5e90 --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.js @@ -0,0 +1,55 @@ +import { TextlintPackageNamePrefix } from "./TextlintPackagePrefix"; +import { removePrefixFromPackageName, splitKeyToPresetSubRule } from "./KeyPathUtil"; +/** + * normalize `keyPath` that is specific path for rule + * This normalize function handle ambiguity `key` + * `keyPath` is one of "preset/rule` key, or "rule" key + * + * Note: `textlint-rule-textlint-rule-x`(twice!) is normalized at once. + * It is edge case and this function can not treat it. + * @param keyPath + */ +export var normalizeTextlintKeyPath = function (keyPath) { + var _a = splitKeyToPresetSubRule(keyPath), preset = _a.preset, rule = _a.rule; + if (!preset) { + return normalizeTextlintRuleKey(rule); + } + return normalizeTextlintRulePresetKey(preset) + "/" + normalizeTextlintRuleKey(rule); +}; +/** + * Normalize to preset-name/rule-name + */ +export var normalizeTextlintPresetSubRuleKey = function (names) { + var preset = names.preset, rule = names.rule; + return normalizeTextlintRulePresetKey(preset) + "/" + normalizeTextlintRuleKey(rule); +}; +/** + * Normalize rule key + * @param name + */ +export var normalizeTextlintRuleKey = function (name) { + return removePrefixFromPackageName([TextlintPackageNamePrefix.rule], name); +}; +/** + * Normalize filter rule key + * @param name + */ +export var normalizeTextlintFilterRuleKey = function (name) { + return removePrefixFromPackageName([TextlintPackageNamePrefix.filterRule], name); +}; +/** + * Normalize rule preset key + * @param name + */ +export var normalizeTextlintRulePresetKey = function (name) { + // "preset-" and "textlint-rule-preset-" + return removePrefixFromPackageName([TextlintPackageNamePrefix.rulePreset, "preset-"], name); +}; +/** + * Normalize plugin key + * @param name + */ +export var normalizeTextlintPluginKey = function (name) { + return removePrefixFromPackageName([TextlintPackageNamePrefix.plugin], name); +}; +//# sourceMappingURL=TextlintKeyPath.js.map \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.js.map b/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.js.map new file mode 100644 index 000000000..9e8e0ce18 --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/TextlintKeyPath.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintKeyPath.js","sourceRoot":"","sources":["../../src/KeyPath/TextlintKeyPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG,UAAC,OAAe;IAC9C,IAAA,KAAmB,uBAAuB,CAAC,OAAO,CAAC,EAAjD,MAAM,YAAA,EAAE,IAAI,UAAqC,CAAC;IAC1D,IAAI,CAAC,MAAM,EAAE;QACT,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC;KACzC;IACD,OAAU,8BAA8B,CAAC,MAAM,CAAC,SAAI,wBAAwB,CAAC,IAAI,CAAG,CAAC;AACzF,CAAC,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,IAAM,iCAAiC,GAAG,UAAC,KAAuC;IAC7E,IAAA,MAAM,GAAW,KAAK,OAAhB,EAAE,IAAI,GAAK,KAAK,KAAV,CAAW;IAC/B,OAAU,8BAA8B,CAAC,MAAM,CAAC,SAAI,wBAAwB,CAAC,IAAI,CAAG,CAAC;AACzF,CAAC,CAAC;AACF;;;GAGG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG,UAAC,IAAY;IACjD,OAAO,2BAA2B,CAAC,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AAC/E,CAAC,CAAC;AACF;;;GAGG;AACH,MAAM,CAAC,IAAM,8BAA8B,GAAG,UAAC,IAAY;IACvD,OAAO,2BAA2B,CAAC,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;AACrF,CAAC,CAAC;AACF;;;GAGG;AACH,MAAM,CAAC,IAAM,8BAA8B,GAAG,UAAC,IAAY;IACvD,8CAA8C;IAC9C,OAAO,2BAA2B,CAAC,CAAC,yBAAyB,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;AAChG,CAAC,CAAC;AACF;;;GAGG;AACH,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,IAAY;IACnD,OAAO,2BAA2B,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AACjF,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.d.ts b/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.d.ts new file mode 100644 index 000000000..968bf75dc --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.d.ts @@ -0,0 +1,13 @@ +/** + * Package name prefix list + * It is used for shortcut name. + * + * For example, textlint plugin package start with textlint-plugin prefix. + */ +export declare const TextlintPackageNamePrefix: { + config: string; + rule: string; + filterRule: string; + rulePreset: string; + plugin: string; +}; diff --git a/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.js b/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.js new file mode 100644 index 000000000..bbf4e6e9a --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.js @@ -0,0 +1,14 @@ +/** + * Package name prefix list + * It is used for shortcut name. + * + * For example, textlint plugin package start with textlint-plugin prefix. + */ +export var TextlintPackageNamePrefix = { + config: "textlint-config-", + rule: "textlint-rule-", + filterRule: "textlint-filter-rule-", + rulePreset: "textlint-rule-preset-", + plugin: "textlint-plugin-", +}; +//# sourceMappingURL=TextlintPackagePrefix.js.map \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.js.map b/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.js.map new file mode 100644 index 000000000..0d2de796a --- /dev/null +++ b/node_modules/@textlint/utils/module/KeyPath/TextlintPackagePrefix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextlintPackagePrefix.js","sourceRoot":"","sources":["../../src/KeyPath/TextlintPackagePrefix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,IAAM,yBAAyB,GAAG;IACrC,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,uBAAuB;IACnC,MAAM,EAAE,kBAAkB;CAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/index.d.ts b/node_modules/@textlint/utils/module/index.d.ts new file mode 100644 index 000000000..75572da90 --- /dev/null +++ b/node_modules/@textlint/utils/module/index.d.ts @@ -0,0 +1,2 @@ +export { normalizeTextlintPresetSubRuleKey, normalizeTextlintRuleKey, normalizeTextlintRulePresetKey, normalizeTextlintPluginKey, normalizeTextlintFilterRuleKey, normalizeTextlintKeyPath, } from "./KeyPath/TextlintKeyPath"; +export { TextlintPackageNamePrefix } from "./KeyPath/TextlintPackagePrefix"; diff --git a/node_modules/@textlint/utils/module/index.js b/node_modules/@textlint/utils/module/index.js new file mode 100644 index 000000000..d44ad88f8 --- /dev/null +++ b/node_modules/@textlint/utils/module/index.js @@ -0,0 +1,3 @@ +export { normalizeTextlintPresetSubRuleKey, normalizeTextlintRuleKey, normalizeTextlintRulePresetKey, normalizeTextlintPluginKey, normalizeTextlintFilterRuleKey, normalizeTextlintKeyPath, } from "./KeyPath/TextlintKeyPath"; +export { TextlintPackageNamePrefix } from "./KeyPath/TextlintPackagePrefix"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@textlint/utils/module/index.js.map b/node_modules/@textlint/utils/module/index.js.map new file mode 100644 index 000000000..7725f5c4f --- /dev/null +++ b/node_modules/@textlint/utils/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iCAAiC,EACjC,wBAAwB,EACxB,8BAA8B,EAC9B,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"} \ No newline at end of file diff --git a/node_modules/@textlint/utils/package.json b/node_modules/@textlint/utils/package.json new file mode 100644 index 000000000..700c09209 --- /dev/null +++ b/node_modules/@textlint/utils/package.json @@ -0,0 +1,60 @@ +{ + "name": "@textlint/utils", + "version": "1.2.5", + "description": "textlint internal utils.", + "keywords": [ + "internal", + "utils" + ], + "homepage": "https://github.com/textlint/textlint/tree/master/packages/utils/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "module": "./module/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib", + "test": "test" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -b --watch" + }, + "prettier": { + "printWidth": 120, + "singleQuote": false, + "tabWidth": 4 + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "prettier": "^2.1.1", + "rimraf": "^3.0.2", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "^4.0.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/@textlint/utils/src/KeyPath/KeyPathUtil.ts b/node_modules/@textlint/utils/src/KeyPath/KeyPathUtil.ts new file mode 100644 index 000000000..6a9ac5135 --- /dev/null +++ b/node_modules/@textlint/utils/src/KeyPath/KeyPathUtil.ts @@ -0,0 +1,56 @@ +// @org/preset/@org/rule +const patternOrgXOrg = /^(@.*?\/.*?)\/(@.*?\/.*?)$/; +// @org/preset/rule +const patternOrgXRule = /^(@.*?\/.*?)\/(.*?)$/; +// preset/@org/rule +const patternPresetXOrg = /^(.*?)\/(@.*?)$/; +// preset/rule +const patternPresetXRule = /^([^@].*?)\/(.*?)$/; + +/** + * pattern list of key path + */ +const patternList = [patternOrgXOrg, patternOrgXRule, patternPresetXOrg, patternPresetXRule]; +/** + * split "preset/rule" string to {preset, rule} + */ +export const splitKeyToPresetSubRule = (name: string): { preset: string | null; rule: string } => { + for (let i = 0; i < patternList.length; i++) { + const pattern = patternList[i]; + const result = name.match(pattern); + if (!result) { + continue; + } + return { preset: result[1], rule: result[2] }; + } + // Other case is a single rule + // @org/rule or rule + return { + preset: null, + rule: name, + }; +}; + +/** + * Remove `prefix` from `text`. + */ +export const removePrefixFromPackageName = (prefixList: string[], packageName: string) => { + for (let i = 0; i < prefixList.length; i++) { + const prefix = prefixList[i]; + // @scope/name -> @scope/name + // @scope/textlint-rule-name -> @scope/name + if (packageName.charAt(0) === "@") { + const [namespace, name] = packageName.split("/"); + if (name.startsWith(prefix)) { + return `${namespace}/${name.slice(prefix.length)}`; + } + } + // name -> name + // textlint-rule-name -> name + else if (packageName.startsWith(prefix)) { + return packageName.slice(prefix.length); + } + } + // No match + return packageName; +}; diff --git a/node_modules/@textlint/utils/src/KeyPath/TextlintKeyPath.ts b/node_modules/@textlint/utils/src/KeyPath/TextlintKeyPath.ts new file mode 100644 index 000000000..c69ca67b7 --- /dev/null +++ b/node_modules/@textlint/utils/src/KeyPath/TextlintKeyPath.ts @@ -0,0 +1,55 @@ +import { TextlintPackageNamePrefix } from "./TextlintPackagePrefix"; +import { removePrefixFromPackageName, splitKeyToPresetSubRule } from "./KeyPathUtil"; + +/** + * normalize `keyPath` that is specific path for rule + * This normalize function handle ambiguity `key` + * `keyPath` is one of "preset/rule` key, or "rule" key + * + * Note: `textlint-rule-textlint-rule-x`(twice!) is normalized at once. + * It is edge case and this function can not treat it. + * @param keyPath + */ +export const normalizeTextlintKeyPath = (keyPath: string) => { + const { preset, rule } = splitKeyToPresetSubRule(keyPath); + if (!preset) { + return normalizeTextlintRuleKey(rule); + } + return `${normalizeTextlintRulePresetKey(preset)}/${normalizeTextlintRuleKey(rule)}`; +}; +/** + * Normalize to preset-name/rule-name + */ +export const normalizeTextlintPresetSubRuleKey = (names: { preset: string; rule: string }) => { + const { preset, rule } = names; + return `${normalizeTextlintRulePresetKey(preset)}/${normalizeTextlintRuleKey(rule)}`; +}; +/** + * Normalize rule key + * @param name + */ +export const normalizeTextlintRuleKey = (name: string) => { + return removePrefixFromPackageName([TextlintPackageNamePrefix.rule], name); +}; +/** + * Normalize filter rule key + * @param name + */ +export const normalizeTextlintFilterRuleKey = (name: string) => { + return removePrefixFromPackageName([TextlintPackageNamePrefix.filterRule], name); +}; +/** + * Normalize rule preset key + * @param name + */ +export const normalizeTextlintRulePresetKey = (name: string) => { + // "preset-" and "textlint-rule-preset-" + return removePrefixFromPackageName([TextlintPackageNamePrefix.rulePreset, "preset-"], name); +}; +/** + * Normalize plugin key + * @param name + */ +export const normalizeTextlintPluginKey = (name: string) => { + return removePrefixFromPackageName([TextlintPackageNamePrefix.plugin], name); +}; diff --git a/node_modules/@textlint/utils/src/KeyPath/TextlintPackagePrefix.ts b/node_modules/@textlint/utils/src/KeyPath/TextlintPackagePrefix.ts new file mode 100644 index 000000000..447d10818 --- /dev/null +++ b/node_modules/@textlint/utils/src/KeyPath/TextlintPackagePrefix.ts @@ -0,0 +1,13 @@ +/** + * Package name prefix list + * It is used for shortcut name. + * + * For example, textlint plugin package start with textlint-plugin prefix. + */ +export const TextlintPackageNamePrefix = { + config: "textlint-config-", + rule: "textlint-rule-", + filterRule: "textlint-filter-rule-", + rulePreset: "textlint-rule-preset-", + plugin: "textlint-plugin-", +}; diff --git a/node_modules/@textlint/utils/src/index.ts b/node_modules/@textlint/utils/src/index.ts new file mode 100644 index 000000000..68b4f33a6 --- /dev/null +++ b/node_modules/@textlint/utils/src/index.ts @@ -0,0 +1,9 @@ +export { + normalizeTextlintPresetSubRuleKey, + normalizeTextlintRuleKey, + normalizeTextlintRulePresetKey, + normalizeTextlintPluginKey, + normalizeTextlintFilterRuleKey, + normalizeTextlintKeyPath, +} from "./KeyPath/TextlintKeyPath"; +export { TextlintPackageNamePrefix } from "./KeyPath/TextlintPackagePrefix"; diff --git a/node_modules/@types/unist/LICENSE b/node_modules/@types/unist/LICENSE new file mode 100644 index 000000000..9e841e7a2 --- /dev/null +++ b/node_modules/@types/unist/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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 000000000..b038f89e9 --- /dev/null +++ b/node_modules/@types/unist/README.md @@ -0,0 +1,122 @@ +# Installation +> `npm install --save @types/unist` + +# Summary +This package contains type definitions for unist (https://github.com/syntax-tree/unist). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2/index.d.ts) +````ts +/** + * Syntactic units in unist syntax trees are called nodes. + * + * @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}. + */ +export interface Node { + /** + * The variant of a node. + */ + type: string; + + /** + * Information from the ecosystem. + */ + data?: TData | undefined; + + /** + * Location of a node in a source document. + * Must not be present if a node is generated. + */ + position?: Position | undefined; +} + +/** + * 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[] | undefined; +} + +/** + * 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 | undefined; +} + +/** + * Util for extracting type of {@link Node.data} + * + * @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc. + * + * @example `NodeData>` -> `{ key: string }` + */ +export type NodeData> = TNode extends Node ? TData : never; + +/** + * Nodes containing other nodes. + * + * @typeParam ChildNode Node item of {@link Parent.children} + */ +export interface Parent = Node, TData extends object = NodeData> + extends Node +{ + /** + * List representing the children of a node. + */ + children: ChildNode[]; +} + +/** + * Nodes containing a value. + * + * @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node + */ +export interface Literal extends Node { + value: Value; +} + +```` + +### Additional Details + * Last updated: Thu, 15 Aug 2024 02:18:53 GMT + * Dependencies: none + +# Credits +These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), and [JounQin](https://github.com/JounQin). diff --git a/node_modules/@types/unist/index.d.ts b/node_modules/@types/unist/index.d.ts new file mode 100644 index 000000000..b019d389d --- /dev/null +++ b/node_modules/@types/unist/index.d.ts @@ -0,0 +1,103 @@ +/** + * Syntactic units in unist syntax trees are called nodes. + * + * @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}. + */ +export interface Node { + /** + * The variant of a node. + */ + type: string; + + /** + * Information from the ecosystem. + */ + data?: TData | undefined; + + /** + * Location of a node in a source document. + * Must not be present if a node is generated. + */ + position?: Position | undefined; +} + +/** + * 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[] | undefined; +} + +/** + * 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 | undefined; +} + +/** + * Util for extracting type of {@link Node.data} + * + * @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc. + * + * @example `NodeData>` -> `{ key: string }` + */ +export type NodeData> = TNode extends Node ? TData : never; + +/** + * Nodes containing other nodes. + * + * @typeParam ChildNode Node item of {@link Parent.children} + */ +export interface Parent = Node, TData extends object = NodeData> + extends Node +{ + /** + * List representing the children of a node. + */ + children: ChildNode[]; +} + +/** + * Nodes containing a value. + * + * @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node + */ +export interface Literal extends Node { + value: Value; +} diff --git a/node_modules/@types/unist/package.json b/node_modules/@types/unist/package.json new file mode 100644 index 000000000..01cb5b0d4 --- /dev/null +++ b/node_modules/@types/unist/package.json @@ -0,0 +1,55 @@ +{ + "name": "@types/unist", + "version": "2.0.11", + "description": "TypeScript definitions for unist", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist", + "license": "MIT", + "contributors": [ + { + "name": "bizen241", + "githubUsername": "bizen241", + "url": "https://github.com/bizen241" + }, + { + "name": "Jun Lu", + "githubUsername": "lujun2", + "url": "https://github.com/lujun2" + }, + { + "name": "Hernan Rajchert", + "githubUsername": "hrajchert", + "url": "https://github.com/hrajchert" + }, + { + "name": "Titus Wormer", + "githubUsername": "wooorm", + "url": "https://github.com/wooorm" + }, + { + "name": "Junyoung Choi", + "githubUsername": "rokt33r", + "url": "https://github.com/rokt33r" + }, + { + "name": "Ben Moon", + "githubUsername": "GuiltyDolphin", + "url": "https://github.com/GuiltyDolphin" + }, + { + "name": "JounQin", + "githubUsername": "JounQin", + "url": "https://github.com/JounQin" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/unist" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "6e36525a6db49ae5517fe0751796ca8f6c65099098415046d4f1ad6c2ef1a33c", + "typeScriptVersion": "4.8" +} \ No newline at end of file diff --git a/node_modules/ajv-keywords/LICENSE b/node_modules/ajv-keywords/LICENSE new file mode 100644 index 000000000..90139aa74 --- /dev/null +++ b/node_modules/ajv-keywords/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ajv-keywords/README.md b/node_modules/ajv-keywords/README.md new file mode 100644 index 000000000..e432391d6 --- /dev/null +++ b/node_modules/ajv-keywords/README.md @@ -0,0 +1,443 @@ +# ajv-keywords + +Custom JSON-Schema keywords for [ajv](https://github.com/epoberezkin/ajv) validator + +[![Build Status](https://travis-ci.org/epoberezkin/ajv-keywords.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv-keywords) +[![npm version](https://badge.fury.io/js/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords) +[![npm downloads](https://img.shields.io/npm/dm/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/ajv-keywords/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/ajv-keywords?branch=master) + + +## Contents + +- [Install](#install) +- [Usage](#usage) +- [Keywords](#keywords) + - [typeof](#typeof) + - [instanceof](#instanceof) + - [range and exclusiveRange](#range-and-exclusiverange) + - [propertyNames](#propertynames) + - [if/then/else](#ifthenelse) + - [prohibited](#prohibited) + - [deepProperties](#deepproperties) + - [deepRequired](#deeprequired) + - [regexp](#regexp) + - [dynamicDefaults](#dynamicdefaults) +- [License](#license) + + +## Install + +``` +npm install ajv-keywords +``` + + +## Usage + +To add all available keywords: + +```javascript +var Ajv = require('ajv'); +var ajv = new Ajv; +require('ajv-keywords')(ajv); + +ajv.validate({ instanceof: 'RegExp' }, /.*/); // true +ajv.validate({ instanceof: 'RegExp' }, '.*'); // false +``` + +To add a single keyword: + +```javascript +require('ajv-keywords')(ajv, 'instanceof'); +``` + +To add multiple keywords: + +```javascript +require('ajv-keywords')(ajv, ['typeof', 'instanceof']); +``` + +To add a single keyword in browser (to avoid adding unused code): + +```javascript +require('ajv-keywords/keywords/instanceof')(ajv); +``` + + +## Keywords + +### `typeof` + +Based on JavaScript `typeof` operation. + +The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or array of strings. + +To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array). + +``` +ajv.validate({ typeof: 'undefined' }, undefined); // true +ajv.validate({ typeof: 'undefined' }, null); // false +ajv.validate({ typeof: ['undefined', 'object'] }, null); // true +``` + + +### `instanceof` + +Based on JavaScript `instanceof` operation. + +The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"` or `"Buffer"`) or array of strings. + +To pass validation the result of `data instanceof ...` operation on the value should be true: + +``` +ajv.validate({ instanceof: 'Array' }, []); // true +ajv.validate({ instanceof: 'Array' }, {}); // false +ajv.validate({ instanceof: ['Array', 'Function'] }, funciton(){}); // true +``` + +You can add your own constructor function to be recognised by this keyword: + +```javascript +function MyClass() {} +var instanceofDefinition = require('ajv-keywords').get('instanceof').definition; +// or require('ajv-keywords/keywords/instanceof').definition; +instanceofDefinition.CONSTRUCTORS.MyClass = MyClass; + +ajv.validate({ instanceof: 'MyClass' }, new MyClass); // true +``` + + +### `range` and `exclusiveRange` + +Syntax sugar for the combination of minimum and maximum keywords, also fails schema compilation if there are no numbers in the range. + +The value of this keyword must be the array consisting of two numbers, the second must be greater or equal than the first one. + +If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. If `exclusiveRange` keyword is present in the same schema and its value is true, the validated value must not be equal to the range boundaries. + +```javascript +var schema = { range: [1, 3] }; +ajv.validate(schema, 1); // true +ajv.validate(schema, 2); // true +ajv.validate(schema, 3); // true +ajv.validate(schema, 0.99); // false +ajv.validate(schema, 3.01); // false + +var schema = { range: [1, 3], exclusiveRange: true }; +ajv.validate(schema, 1.01); // true +ajv.validate(schema, 2); // true +ajv.validate(schema, 2.99); // true +ajv.validate(schema, 1); // false +ajv.validate(schema, 3); // false +``` + + +### `propertyNames` + +This keyword allows to define the schema for the property names of the object. The value of this keyword should be a valid JSON schema (v5 schemas are supported with Ajv option `{v5: true}`). + +```javascript +var schema = { + type: 'object' + propertyNames: { + anyOf: [ + { format: ipv4 }, + { format: hostname } + ] + } +}; + +var validData = { + '192.128.0.1': {}, + 'test.example.com': {} +}; + +var invalidData = { + '1.2.3': {} +}; + +ajv.validate(schema, validData); // true +ajv.validate(schema, invalidData); // false +``` + +__Please note__: This keyword will be added to the next version of the JSON-Schema standard (draft-6), after it is published the keyword will be included in Ajv as standard validation keyword. + + +### `if`/`then`/`else` + +These keywords allow to implement conditional validation. Their values should be valid JSON-schemas. At the moment it requires using Ajv with v5 option. + +If the data is valid according to the sub-schema in `if` keyword, then the result is equal to the result of data validation against the sub-schema in `then` keyword, otherwise - in `else` keyword (if `else` is absent, the validation succeeds). + +```javascript +require('ajv-keywords')(ajv, 'if'); + +var schema = { + type: 'array', + items: { + type: 'integer', + minimum: 1, + if: { maximum: 10 }, + then: { multipleOf: 2 }, + else: { multipleOf: 5 } + } +}; + +var validItems = [ 2, 4, 6, 8, 10, 15, 20, 25 ]; // etc. + +var invalidItems = [ 1, 3, 5, 11, 12 ]; // etc. + +ajv.validate(schema, validItems); // true +ajv.validate(schema, invalidItems); // false +``` + +This keyword is [proposed](https://github.com/json-schema-org/json-schema-spec/issues/180) for the future version of JSON-Schema standard. + + +### `prohibited` + +This keyword allows to prohibit that any of the properties in the list is present in the object. + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object. + +``` +var schema = { prohibited: ['foo', 'bar']}; + +var validData = { baz: 1 }; +var alsoValidData = {}; + +var invalidDataList = [ + { foo: 1 }, + { bar: 2 }, + { foo: 1, bar: 2} +]; +``` + + +### `deepRequired` + +This keyword allows to check that some deep properties (identified by JSON pointers) are available. The value should be an array of JSON pointers to the data, starting from the current position in data. + +```javascript +var schema = { + type: 'object', + deepRequired: ["/users/1/role"] +}; + +var validData = { + users: [ + {}, + { + id: 123, + role: 'admin' + } + ] +}; + +var invalidData = { + users: [ + {}, + { + id: 123 + } + ] +}; +``` + +See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword. + + +## `deepProperties` + +This keyword allows to validate deep properties (identified by JSON pointers). The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are corresponding schemas. + +```javascript +var schema = { + type: 'object', + deepProperties: { + "/users/1/role": { "enum": ["admin"] } + } +}; + +var validData = { + users: [ + {}, + { + id: 123, + role: 'admin' + } + ] +}; + +var alsoValidData = { + users: { + "1": { + id: 123, + role: 'admin' + } + } +}; + +var invalidData = { + users: [ + {}, + { + id: 123, + role: 'user' + } + ] +}; + +var alsoInvalidData = { + users: { + "1": { + id: 123, + role: 'user' + } + } +}; +``` + + +### `regexp` + +This keyword allows to use regular expressions with flags in schemas (the standard `pattern` keyword does not support flags). The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor). + +```javascript +var schema = { + type: 'object', + properties: { + foo: { regexp: '/foo/i' }, + bar: { regexp: { pattern: 'bar', flags: 'i' } } + } +}; + +var validData = { + foo: 'Food', + bar: 'Barmen' +}; + +var invalidData = { + foo: 'fog', + bar: 'bad' +}; +``` + + +### `dynamicDefaults` + +This keyword allows to assign dynamic defaults to properties, such as timestamps, unique IDs etc. + +This keyword only works if `useDefaults` options is used and not inside `anyOf` keywrods etc., in the same way as [default keyword treated by Ajv](https://github.com/epoberezkin/ajv#assigning-defaults). + +The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be: + +- an identifier of default function (a string) +- an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples). + +The properties used in `dynamicDefaults` should not be added to `required` keyword (or validation will fail), because unlike `default` this keyword is processed after validation. + +There are several predefined dynamic default functions: + +- `"timestamp"` - current timestamp in milliseconds +- `"datetime"` - current date and time as string (ISO, valid according to `date-time` format) +- `"date"` - current date as string (ISO, valid according to `date` format) +- `"time"` - current time as string (ISO, valid according to `time` format) +- `"random"` - pseudo-random number in [0, 1) interval +- `"randomint"` - pseudo-random integer number. If string is used as a property value, the function will randomly return 0 or 1. If object `{func: 'randomint', max: N}` is used then the default will be an integer number in [0, N) interval. +- `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{func: 'seq', name: 'foo'}` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used. + +```javascript +var schema = { + type: 'object', + dynamicDefaults: { + ts: 'datetime', + r: { func: 'randomint', max: 100 }, + id: { func: 'seq', name: 'id' } + }, + properties: { + ts: { + type: 'string', + format: 'datetime' + }, + r: { + type: 'integer', + minimum: 0, + maximum: 100, + exclusiveMaximum: true + }, + id: { + type: 'integer', + minimum: 0 + } + } +}; + +var data = {}; +ajv.validate(data); // true +data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } + +var data1 = {}; +ajv.validate(data1); // true +data1; // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 } + +ajv.validate(data1); // true +data1; // didn't change, as all properties were defined +``` + +You can add your own dynamic default function to be recognised by this keyword: + +```javascript +var uuid = require('uuid'); + +function uuidV4() { return uuid.v4(); } + +var definition = require('ajv-keywords').get('dynamicDefaults').definition; +// or require('ajv-keywords/keywords/dynamicDefaults').definition; +definition.DEFAULTS.uuid = uuidV4; + +var schema = { + dynamicDefaults: { id: 'uuid' }, + properties: { id: { type: 'string', format: 'uuid' } } +}; + +var data = {}; +ajv.validate(schema, data); // true +data; // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' }; + +var data1 = {}; +ajv.validate(schema, data1); // true +data1; // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' } +``` + +You also can define dynamic default that accepts parameters, e.g. version of uuid: + +```javascript +var uuid = require('uuid'); + +function getUuid(args) { + var version = 'v' + (arvs && args.v || 4); + return function() { + return uuid[version](); + }; +} + +var definition = require('ajv-keywords').get('dynamicDefaults').definition; +definition.DEFAULTS.uuid = getUuid; + +var schema = { + dynamicDefaults: { + id1: 'uuid', // v4 + id2: { func: 'uuid', v: 4 }, // v4 + id3: { func: 'uuid', v: 1 } // v1 + } +}; +``` + + +## License + +[MIT](https://github.com/JSONScript/ajv-keywords/blob/master/LICENSE) diff --git a/node_modules/ajv-keywords/index.js b/node_modules/ajv-keywords/index.js new file mode 100644 index 000000000..07a8edabc --- /dev/null +++ b/node_modules/ajv-keywords/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var KEYWORDS = require('./keywords'); + +module.exports = defineKeywords; + + +/** + * Defines one or several keywords in ajv instance + * @param {Ajv} ajv validator instance + * @param {String|Array|undefined} keyword keyword(s) to define + * @return {Ajv} ajv instance (for chaining) + */ +function defineKeywords(ajv, keyword) { + if (Array.isArray(keyword)) { + for (var i=0; i d2) return 1; + if (d1 < d2) return -1; + if (d1 === d2) return 0; +} + + +function compareTime(t1, t2) { + if (!(t1 && t2)) return; + t1 = t1.match(TIME); + t2 = t2.match(TIME); + if (!(t1 && t2)) return; + t1 = t1[1] + t1[2] + t1[3] + (t1[4]||''); + t2 = t2[1] + t2[2] + t2[3] + (t2[4]||''); + if (t1 > t2) return 1; + if (t1 < t2) return -1; + if (t1 === t2) return 0; +} + + +function compareDateTime(dt1, dt2) { + if (!(dt1 && dt2)) return; + dt1 = dt1.split(DATE_TIME_SEPARATOR); + dt2 = dt2.split(DATE_TIME_SEPARATOR); + var res = compareDate(dt1[0], dt2[0]); + if (res === undefined) return; + return res || compareTime(dt1[1], dt2[1]); +} diff --git a/node_modules/ajv-keywords/keywords/deepProperties.js b/node_modules/ajv-keywords/keywords/deepProperties.js new file mode 100644 index 000000000..daa87426a --- /dev/null +++ b/node_modules/ajv-keywords/keywords/deepProperties.js @@ -0,0 +1,55 @@ +'use strict'; + +module.exports = function defFunc(ajv) { + defFunc.definition = { + type: 'object', + macro: function (schema) { + var schemas = []; + for (var pointer in schema) + schemas.push(getSchema(pointer, schema[pointer])); + return { 'allOf': schemas }; + }, + metaSchema: { + type: 'object', + patternProperties: { + '^(\\/([^~\\/]|~0|~1)*)*(\\/)?$': { + $ref: ajv._opts.v5 + ? 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#' + : 'http://json-schema.org/draft-04/schema#' + } + }, + additionalProperties: false + } + }; + + ajv.addKeyword('deepProperties', defFunc.definition); + return ajv; +}; + + +function getSchema(jsonPointer, schema) { + var segments = jsonPointer.split('/'); + var rootSchema = {}; + var pointerSchema = rootSchema; + for (var i=1; i' + , $result = 'result' + $lvl; +}} + +{{# def.$data }} + + +{{? $isDataExcl }} + {{ + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr) + , $exclusive = 'exclusive' + $lvl + , $opExpr = 'op' + $lvl + , $opStr = '\' + ' + $opExpr + ' + \''; + }} + var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}}; + {{ $schemaValueExcl = 'schemaExcl' + $lvl; }} + + if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) { + {{=$valid}} = false; + {{ var $errorKeyword = $exclusiveKeyword; }} + {{# def.error:'_formatExclusiveLimit' }} + } + + {{# def.elseIfValid }} + + {{# def.compareFormat }} + var {{=$exclusive}} = {{=$schemaValueExcl}} === true; + + if ({{=$valid}} === undefined) { + {{=$valid}} = {{=$exclusive}} + ? {{=$result}} {{=$op}} 0 + : {{=$result}} {{=$op}}= 0; + } + + if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}='; +{{??}} + {{ + var $exclusive = $schemaExcl === true + , $opStr = $op; /*used in error*/ + if (!$exclusive) $opStr += '='; + var $opExpr = '\'' + $opStr + '\''; /*used in error*/ + }} + + {{# def.compareFormat }} + + if ({{=$valid}} === undefined) + {{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0; +{{?}} + +{{= $closingBraces }} + +if (!{{=$valid}}) { + {{ var $errorKeyword = $keyword; }} + {{# def.error:'_formatLimit' }} +} diff --git a/node_modules/ajv-keywords/keywords/dot/patternRequired.jst b/node_modules/ajv-keywords/keywords/dot/patternRequired.jst new file mode 100644 index 000000000..9af2cdc9d --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dot/patternRequired.jst @@ -0,0 +1,28 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} + +{{ + var $key = 'key' + $lvl + , $matched = 'patternMatched' + $lvl + , $closingBraces = '' + , $ownProperties = it.opts.ownProperties; +}} + +var {{=$valid}} = true; +{{~ $schema:$pProperty }} + var {{=$matched}} = false; + for (var {{=$key}} in {{=$data}}) { + {{# def.checkOwnProperty }} + {{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}}); + if ({{=$matched}}) break; + } + + {{ var $missingPattern = it.util.escapeQuotes($pProperty); }} + if (!{{=$matched}}) { + {{=$valid}} = false; + {{# def.addError:'patternRequired' }} + } {{# def.elseIfValid }} +{{~}} + +{{= $closingBraces }} diff --git a/node_modules/ajv-keywords/keywords/dot/switch.jst b/node_modules/ajv-keywords/keywords/dot/switch.jst new file mode 100644 index 000000000..7b2906a60 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dot/switch.jst @@ -0,0 +1,73 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + + +{{## def.validateIf: + {{# def.setCompositeRule }} + {{ $it.createErrors = false; }} + {{# def._validateSwitchRule:if }} + {{ $it.createErrors = true; }} + {{# def.resetCompositeRule }} + {{=$ifPassed}} = valid{{=$it.level}}; +#}} + +{{## def.validateThen: + {{? typeof $sch.then == 'boolean' }} + {{? $sch.then === false }} + {{# def.error:'switch' }} + {{?}} + var valid{{=$it.level}} = {{= $sch.then }}; + {{??}} + {{# def._validateSwitchRule:then }} + {{?}} +#}} + +{{## def._validateSwitchRule:_clause: + {{ + $it.schema = $sch._clause; + $it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause'; + }} + {{# def.insertSubschemaCode }} +#}} + +{{## def.switchCase: + {{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }} + var {{=$errs}} = errors; + {{# def.validateIf }} + if ({{=$ifPassed}}) { + {{# def.validateThen }} + } else { + {{# def.resetErrors }} + } + {{??}} + {{=$ifPassed}} = true; + {{# def.validateThen }} + {{?}} +#}} + + +{{ + var $ifPassed = 'ifPassed' + it.level + , $currentBaseId = $it.baseId + , $shouldContinue; +}} +var {{=$ifPassed}}; + +{{~ $schema:$sch:$caseIndex }} + {{? $caseIndex && !$shouldContinue }} + if (!{{=$ifPassed}}) { + {{ $closingBraces+= '}'; }} + {{?}} + + {{# def.switchCase }} + {{ $shouldContinue = $sch.continue }} +{{~}} + +{{= $closingBraces }} + +var {{=$valid}} = valid{{=$it.level}}; + +{{# def.cleanUp }} diff --git a/node_modules/ajv-keywords/keywords/dotjs/README.md b/node_modules/ajv-keywords/keywords/dotjs/README.md new file mode 100644 index 000000000..e2846c86b --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dotjs/README.md @@ -0,0 +1,3 @@ +These files are compiled dot templates from dot folder. + +Do NOT edit them directly, edit the templates and run `npm run build` from main ajv-keywords folder. diff --git a/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js b/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js new file mode 100644 index 000000000..b2c5093df --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js @@ -0,0 +1,176 @@ +'use strict'; +module.exports = function generate__formatLimit(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + out += 'var ' + ($valid) + ' = undefined;'; + if (it.opts.format === false) { + out += ' ' + ($valid) + ' = true; '; + return out; + } + var $schemaFormat = it.schema.format, + $isDataFormat = it.opts.v5 && $schemaFormat.$data, + $closingBraces = ''; + if ($isDataFormat) { + var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr), + $format = 'format' + $lvl, + $compare = 'compare' + $lvl; + out += ' var ' + ($format) + ' = formats[' + ($schemaValueFormat) + '] , ' + ($compare) + ' = ' + ($format) + ' && ' + ($format) + '.compare;'; + } else { + var $format = it.formats[$schemaFormat]; + if (!($format && $format.compare)) { + out += ' ' + ($valid) + ' = true; '; + return out; + } + var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare'; + } + var $isMax = $keyword == 'formatMaximum', + $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum'), + $schemaExcl = it.schema[$exclusiveKeyword], + $isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data, + $op = $isMax ? '<' : '>', + $result = 'result' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), + $exclusive = 'exclusive' + $lvl, + $opExpr = 'op' + $lvl, + $opStr = '\' + ' + $opExpr + ' + \''; + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; + $schemaValueExcl = 'schemaExcl' + $lvl; + out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; '; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + if ($isData) { + out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + if ($isDataFormat) { + out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { '; + $closingBraces += '}'; + } + out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; + } else { + var $exclusive = $schemaExcl === true, + $opStr = $op; + if (!$exclusive) $opStr += '='; + var $opExpr = '\'' + $opStr + '\''; + if ($isData) { + out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + if ($isDataFormat) { + out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { '; + $closingBraces += '}'; + } + out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op); + if (!$exclusive) { + out += '='; + } + out += ' 0;'; + } + out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , exclusive: ' + ($exclusive) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be ' + ($opStr) + ' "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '}'; + return out; +} diff --git a/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js b/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js new file mode 100644 index 000000000..e20df98ca --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js @@ -0,0 +1,52 @@ +'use strict'; +module.exports = function generate_patternRequired(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $key = 'key' + $lvl, + $matched = 'patternMatched' + $lvl, + $closingBraces = '', + $ownProperties = it.opts.ownProperties; + out += 'var ' + ($valid) + ' = true;'; + var arr1 = $schema; + if (arr1) { + var $pProperty, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $pProperty = arr1[i1 += 1]; + out += ' var ' + ($matched) + ' = false; for (var ' + ($key) + ' in ' + ($data) + ') { '; + if ($ownProperties) { + out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; '; + } + out += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } '; + var $missingPattern = it.util.escapeQuotes($pProperty); + out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + } + } + out += '' + ($closingBraces); + return out; +} diff --git a/node_modules/ajv-keywords/keywords/dotjs/switch.js b/node_modules/ajv-keywords/keywords/dotjs/switch.js new file mode 100644 index 000000000..f0e843fe0 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dotjs/switch.js @@ -0,0 +1,129 @@ +'use strict'; +module.exports = function generate_switch(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $ifPassed = 'ifPassed' + it.level, + $currentBaseId = $it.baseId, + $shouldContinue; + out += 'var ' + ($ifPassed) + ';'; + var arr1 = $schema; + if (arr1) { + var $sch, $caseIndex = -1, + l1 = arr1.length - 1; + while ($caseIndex < l1) { + $sch = arr1[$caseIndex += 1]; + if ($caseIndex && !$shouldContinue) { + out += ' if (!' + ($ifPassed) + ') { '; + $closingBraces += '}'; + } + if ($sch.if && it.util.schemaHasRules($sch.if, it.RULES.all)) { + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.createErrors = false; + $it.schema = $sch.if; + $it.schemaPath = $schemaPath + '[' + $caseIndex + '].if'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/if'; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + $it.createErrors = true; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($ifPassed) + ' = valid' + ($it.level) + '; if (' + ($ifPassed) + ') { '; + if (typeof $sch.then == 'boolean') { + if ($sch.then === false) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "switch" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' var valid' + ($it.level) + ' = ' + ($sch.then) + '; '; + } else { + $it.schema = $sch.then; + $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then'; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } } '; + } else { + out += ' ' + ($ifPassed) + ' = true; '; + if (typeof $sch.then == 'boolean') { + if ($sch.then === false) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "switch" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' var valid' + ($it.level) + ' = ' + ($sch.then) + '; '; + } else { + $it.schema = $sch.then; + $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then'; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } + } + $shouldContinue = $sch.continue + } + } + out += '' + ($closingBraces) + 'var ' + ($valid) + ' = valid' + ($it.level) + '; '; + out = it.util.cleanUpCode(out); + return out; +} diff --git a/node_modules/ajv-keywords/keywords/dynamicDefaults.js b/node_modules/ajv-keywords/keywords/dynamicDefaults.js new file mode 100644 index 000000000..e6766d121 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/dynamicDefaults.js @@ -0,0 +1,68 @@ +'use strict'; + +var sequences = {}; + +var DEFAULTS = { + timestamp: function() { return Date.now(); }, + datetime: function() { return (new Date).toISOString(); }, + date: function() { return (new Date).toISOString().slice(0, 10); }, + time: function() { return (new Date).toISOString().slice(11); }, + random: function() { return Math.random(); }, + randomint: function (args) { + var limit = args && args.max || 2; + return function() { return Math.floor(Math.random() * limit); }; + }, + seq: function (args) { + var name = args && args.name || ''; + sequences[name] = sequences[name] || 0; + return function() { return sequences[name]++; }; + } +}; + +module.exports = function defFunc(ajv) { + defFunc.definition = { + compile: function (schema, parentSchema, it) { + var funcs = {}; + + for (var key in schema) { + var d = schema[key]; + var func = getDefault(typeof d == 'string' ? d : d.func); + funcs[key] = func.length ? func(d.args) : func; + } + + return it.opts.useDefaults && !it.compositeRule + ? assignDefaults + : noop; + + function assignDefaults(data) { + for (var prop in schema) + if (data[prop] === undefined) data[prop] = funcs[prop](); + return true; + } + + function noop() { return true; } + }, + DEFAULTS: DEFAULTS, + metaSchema: { + type: 'object', + additionalProperties: { + type: ['string', 'object'], + additionalProperties: false, + required: ['func', 'args'], + properties: { + func: { type: 'string' }, + args: { type: 'object' } + } + } + } + }; + + ajv.addKeyword('dynamicDefaults', defFunc.definition); + return ajv; + + function getDefault(d) { + var def = DEFAULTS[d]; + if (def) return def; + throw new Error('invalid "dynamicDefaults" keyword property value: ' + d); + } +}; diff --git a/node_modules/ajv-keywords/keywords/formatMaximum.js b/node_modules/ajv-keywords/keywords/formatMaximum.js new file mode 100644 index 000000000..e7daabf85 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/formatMaximum.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_formatLimit')('Maximum'); diff --git a/node_modules/ajv-keywords/keywords/formatMinimum.js b/node_modules/ajv-keywords/keywords/formatMinimum.js new file mode 100644 index 000000000..eddd6e404 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/formatMinimum.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_formatLimit')('Minimum'); diff --git a/node_modules/ajv-keywords/keywords/if.js b/node_modules/ajv-keywords/keywords/if.js new file mode 100644 index 000000000..014b0dc0b --- /dev/null +++ b/node_modules/ajv-keywords/keywords/if.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = function defFunc(ajv) { + if (!ajv._opts.v5) console.warn('keywords if/then/else require v5 option'); + + defFunc.definition = { + macro: function (schema, parentSchema) { + if (parentSchema.then === undefined) + throw new Error('keyword "then" is absent'); + var cases = [ { 'if': schema, 'then': parentSchema.then } ]; + if (parentSchema.else !== undefined) + cases[1] = { 'then': parentSchema.else }; + return { switch: cases }; + } + }; + + ajv.addKeyword('if', defFunc.definition); + ajv.addKeyword('then'); + ajv.addKeyword('else'); + return ajv; +}; diff --git a/node_modules/ajv-keywords/keywords/index.js b/node_modules/ajv-keywords/keywords/index.js new file mode 100644 index 000000000..931aa6ad3 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/index.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = { + 'instanceof': require('./instanceof'), + propertyNames: require('./propertyNames'), + range: require('./range'), + regexp: require('./regexp'), + 'typeof': require('./typeof'), + dynamicDefaults: require('./dynamicDefaults'), + 'if': require('./if'), + prohibited: require('./prohibited'), + deepProperties: require('./deepProperties'), + deepRequired: require('./deepRequired') + // formatMinimum: require('./formatMinimum'), + // formatMaximum: require('./formatMaximum'), + // patternRequired: require('./patternRequired'), + // 'switch': require('./switch') +}; diff --git a/node_modules/ajv-keywords/keywords/instanceof.js b/node_modules/ajv-keywords/keywords/instanceof.js new file mode 100644 index 000000000..d02906032 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/instanceof.js @@ -0,0 +1,54 @@ +'use strict'; + +var CONSTRUCTORS = { + Object: Object, + Array: Array, + Function: Function, + Number: Number, + String: String, + Date: Date, + RegExp: RegExp +}; + +module.exports = function defFunc(ajv) { + /* istanbul ignore else */ + if (typeof Buffer != 'undefined') + CONSTRUCTORS.Buffer = Buffer; + + defFunc.definition = { + compile: function (schema) { + if (typeof schema == 'string') { + var Constructor = getConstructor(schema); + return function (data) { + return data instanceof Constructor; + }; + } + + var constructors = schema.map(getConstructor); + return function (data) { + for (var i=0; i max || (exclusive && min == max)) + throw new Error('There are no numbers in range'); + } +}; diff --git a/node_modules/ajv-keywords/keywords/regexp.js b/node_modules/ajv-keywords/keywords/regexp.js new file mode 100644 index 000000000..84efbd666 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/regexp.js @@ -0,0 +1,36 @@ +'use strict'; + +module.exports = function defFunc(ajv) { + defFunc.definition = { + type: 'string', + inline: function (it, keyword, schema) { + return getRegExp() + '.test(data' + (it.dataLevel || '') + ')'; + + function getRegExp() { + try { + if (typeof schema == 'object') + return new RegExp(schema.pattern, schema.flags); + + var rx = schema.match(/^\/(.*)\/([gimy]*)$/); + if (rx) return new RegExp(rx[1], rx[2]); + throw new Error('cannot parse string into RegExp'); + } catch(e) { + console.error('regular expression', schema, 'is invalid'); + throw e; + } + } + }, + metaSchema: { + type: ['string', 'object'], + properties: { + pattern: { type: 'string' }, + flags: { type: 'string' } + }, + required: ['pattern'], + additionalProperties: false + } + }; + + ajv.addKeyword('regexp', defFunc.definition); + return ajv; +}; diff --git a/node_modules/ajv-keywords/keywords/switch.js b/node_modules/ajv-keywords/keywords/switch.js new file mode 100644 index 000000000..8c22bf8b9 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/switch.js @@ -0,0 +1,39 @@ +'use strict'; + +module.exports = function defFunc(ajv) { + if (ajv.RULES.keywords.switch) + return console.warn('Keyword switch is already defined'); + + var metaSchemaUri = ajv._opts.v5 + ? 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#' + : 'http://json-schema.org/draft-04/schema#'; + + defFunc.definition = { + inline: require('./dotjs/switch'), + statements: true, + errors: 'full', + metaSchema: { + type: 'array', + items: { + required: [ 'then' ], + properties: { + 'if': { $ref: metaSchemaUri }, + 'then': { + anyOf: [ + { type: 'boolean' }, + { $ref: metaSchemaUri } + ] + }, + 'continue': { type: 'boolean' } + }, + additionalProperties: false, + dependencies: { + 'continue': [ 'if' ] + } + } + } + }; + + ajv.addKeyword('switch', defFunc.definition); + return ajv; +}; diff --git a/node_modules/ajv-keywords/keywords/typeof.js b/node_modules/ajv-keywords/keywords/typeof.js new file mode 100644 index 000000000..3a3574d83 --- /dev/null +++ b/node_modules/ajv-keywords/keywords/typeof.js @@ -0,0 +1,32 @@ +'use strict'; + +var KNOWN_TYPES = ['undefined', 'string', 'number', 'object', 'function', 'boolean', 'symbol']; + +module.exports = function defFunc(ajv) { + defFunc.definition = { + inline: function (it, keyword, schema) { + var data = 'data' + (it.dataLevel || ''); + if (typeof schema == 'string') return 'typeof ' + data + ' == "' + schema + '"'; + schema = 'validate.schema' + it.schemaPath + '.' + keyword; + return schema + '.indexOf(typeof ' + data + ') >= 0'; + }, + metaSchema: { + anyOf: [ + { + type: 'string', + enum: KNOWN_TYPES + }, + { + type: 'array', + items: { + type: 'string', + enum: KNOWN_TYPES + } + } + ] + } + }; + + ajv.addKeyword('typeof', defFunc.definition); + return ajv; +}; diff --git a/node_modules/ajv-keywords/package.json b/node_modules/ajv-keywords/package.json new file mode 100644 index 000000000..485b8eb5e --- /dev/null +++ b/node_modules/ajv-keywords/package.json @@ -0,0 +1,51 @@ +{ + "name": "ajv-keywords", + "version": "1.5.1", + "description": "Custom JSON-Schema keywords for ajv validator", + "main": "index.js", + "scripts": { + "build": "node node_modules/ajv/scripts/compile-dots.js node_modules/ajv/lib keywords", + "prepublish": "npm run build", + "test": "npm run build && npm run eslint && npm run test-cov", + "eslint": "eslint index.js keywords/*.js", + "test-spec": "mocha spec/*.spec.js -R spec", + "test-cov": "istanbul cover -x 'spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/epoberezkin/ajv-keywords.git" + }, + "keywords": [ + "JSON-Schema", + "ajv", + "keywords" + ], + "files": [ + "index.js", + "keywords" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/epoberezkin/ajv-keywords/issues" + }, + "homepage": "https://github.com/epoberezkin/ajv-keywords#readme", + "peerDependencies": { + "ajv": ">=4.10.0" + }, + "devDependencies": { + "ajv": "^4.10.0", + "ajv-pack": "^0.2.0", + "chai": "^3.5.0", + "coveralls": "^2.11.9", + "dot": "^1.1.1", + "eslint": "^3.6.0", + "glob": "^7.1.1", + "istanbul": "^0.4.3", + "js-beautify": "^1.6.4", + "json-schema-test": "^1.2.1", + "mocha": "^3.0.2", + "pre-commit": "^1.1.3", + "uuid": "^3.0.1" + } +} diff --git a/node_modules/ajv/.tonic_example.js b/node_modules/ajv/.tonic_example.js new file mode 100644 index 000000000..0c3cc86ce --- /dev/null +++ b/node_modules/ajv/.tonic_example.js @@ -0,0 +1,20 @@ +var Ajv = require('ajv'); +var ajv = Ajv({allErrors: true}); + +var schema = { + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "number", "maximum": 3 } + } +}; + +var validate = ajv.compile(schema); + +test({"foo": "abc", "bar": 2}); +test({"foo": 2, "bar": 4}); + +function test(data) { + var valid = validate(data); + if (valid) console.log('Valid!'); + else console.log('Invalid: ' + ajv.errorsText(validate.errors)); +} \ No newline at end of file diff --git a/node_modules/ajv/LICENSE b/node_modules/ajv/LICENSE new file mode 100644 index 000000000..810539685 --- /dev/null +++ b/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/ajv/README.md b/node_modules/ajv/README.md new file mode 100644 index 000000000..9d4fcbb9c --- /dev/null +++ b/node_modules/ajv/README.md @@ -0,0 +1,1213 @@ +Ajv logo + +# Ajv: Another JSON Schema Validator + +The fastest JSON Schema validator for node.js and browser. Supports [v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals). + + +[![Build Status](https://travis-ci.org/epoberezkin/ajv.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv) +[![npm version](https://badge.fury.io/js/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Code Climate](https://codeclimate.com/github/epoberezkin/ajv/badges/gpa.svg)](https://codeclimate.com/github/epoberezkin/ajv) +[![Coverage Status](https://coveralls.io/repos/epoberezkin/ajv/badge.svg?branch=master&service=github)](https://coveralls.io/github/epoberezkin/ajv?branch=master) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) + + +__Please note__: You can start using NEW beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.3) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)) with the support of JSON-Schema draft-06 (not officially published yet): `npm install ajv@^5.0.4-beta`. + +Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.4-beta.3) for 5.0.4. + + +## Contents + +- [Performance](#performance) +- [Features](#features) +- [Getting started](#getting-started) +- [Frequently Asked Questions](https://github.com/epoberezkin/ajv/blob/master/FAQ.md) +- [Using in browser](#using-in-browser) +- [Command line interface](#command-line-interface) +- Validation + - [Keywords](#validation-keywords) + - [Formats](#formats) + - [$data reference](#data-reference) + - NEW: [$merge and $patch keywords](#merge-and-patch-keywords) + - [Defining custom keywords](#defining-custom-keywords) + - [Asynchronous schema compilation](#asynchronous-compilation) + - [Asynchronous validation](#asynchronous-validation) +- Modifying data during validation + - [Filtering data](#filtering-data) + - [Assigning defaults](#assigning-defaults) + - [Coercing data types](#coercing-data-types) +- API + - [Methods](#api) + - [Options](#options) + - [Validation errors](#validation-errors) +- [Related packages](#related-packages) +- [Packages using Ajv](#some-packages-using-ajv) +- [Tests, Contributing, History, License](#tests) + + +## Performance + +Ajv generates code using [doT templates](https://github.com/olado/doT) to turn JSON schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + + +Performace of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:%7Cajv%7Cis-my-json-valid%7Cjsen%7Cschemasaurus%7Cthemis%7Cz-schema%7Cjsck%7Cjsonschema%7Cskeemas%7Ctv4%7Cjayschema&chd=t:100,68,61,22.8,17.6,6.6,2.7,0.9,0.7,0.4,0.1)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + + +## Features + +- Ajv implements full [JSON Schema draft 4](http://json-schema.org/) standard: + - all validation keywords (see [JSON-Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md)) + - full support of remote refs (remote schemas have to be added with `addSchema` or compiled to be available) + - support of circular references between schemas + - correct string lengths for strings with unicode pairs (can be turned off) + - [formats](#formats) defined by JSON Schema draft 4 standard and custom formats (can be turned off) + - [validates schemas against meta-schema](#api-validateschema) +- supports [browsers](#using-in-browser) and nodejs 0.10-6.x +- [asynchronous loading](#asynchronous-compilation) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](#options) +- [error messages with parameters](#validation-errors) describing error reasons to allow creating custom error messages +- i18n error messages support with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package +- [filtering data](#filtering-data) from additional properties +- [assigning defaults](#assigning-defaults) to missing properties and items +- [coercing data](#coercing-data-types) to the types specified in `type` keywords +- [custom keywords](#defining-custom-keywords) +- keywords `switch`, `constant`, `contains`, `patternGroups`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON-schema v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [option v5](#options) +- [v5 meta-schema](https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#) for schemas using v5 keywords +- [v5 $data reference](#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](#asynchronous-validation) of custom formats and keywords + +Currently Ajv is the only validator that passes all the tests from [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) (according to [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark), apart from the test that requires that `1.0` is not an integer that is impossible to satisfy in JavaScript). + + +## Install + +``` +npm install ajv +``` + +To install a stable beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.3) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)): + +``` +npm install ajv@^5.0.4-beta +``` + + +## Getting started + +Try it in the node REPL: https://tonicdev.com/npm/ajv + + +The fastest validation call: + +```javascript +var Ajv = require('ajv'); +var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true} +var validate = ajv.compile(schema); +var valid = validate(data); +if (!valid) console.log(validate.errors); +``` + +or with less code + +```javascript +// ... +var valid = ajv.validate(schema, data); +if (!valid) console.log(ajv.errors); +// ... +``` + +or + +```javascript +// ... +ajv.addSchema(schema, 'mySchema'); +var valid = ajv.validate('mySchema', data); +if (!valid) console.log(ajv.errorsText()); +// ... +``` + +See [API](#api) and [Options](#options) for more details. + +Ajv compiles schemas to functions and caches them in all cases (using schema stringified with [json-stable-stringify](https://github.com/substack/json-stable-stringify) as a key), so that the next time the same schema is used (not necessarily the same object instance) it won't be compiled again. + +The best performance is achieved when using compiled functions returned by `compile` or `getSchema` methods (there is no additional function call). + +__Please note__: every time validation function or `ajv.validate` are called `errors` property is overwritten. You need to copy `errors` array reference to another variable if you want to use it later (e.g., in the callback). See [Validation errors](#validation-errors) + + +## Using in browser + +You can require Ajv directly from the code you browserify - in this case Ajv will be a part of your bundle. + +If you need to use Ajv in several bundles you can create a separate UMD bundle using `npm run bundle` script (thanks to [siddo420](https://github.com/siddo420)). + +Then you need to load Ajv in the browser: +```html + +``` + +This bundle can be used with different module systems or creates global `Ajv` if no module system is found. + +The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). + +Ajv is tested with these browsers: + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin) + +__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/epoberezkin/ajv/issues/234)). + + +## Command line interface + +CLI is available as a separate npm package [ajv-cli](https://github.com/jessedc/ajv-cli). It supports: + +- compiling JSON-schemas to test their validity +- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/epoberezkin/ajv-pack)) +- validating data file(s) against JSON-schema +- testing expected validity of data against JSON-schema +- referenced schemas +- custom meta-schemas +- files in JSON and JavaScript format +- all Ajv options +- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format + + +## Validation keywords + +Ajv supports all validation keywords from draft 4 of JSON-schema standard: + +- [type](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#type) +- [for numbers](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf +- [for strings](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format +- [for arrays](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems +- [for objects](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minproperties, required, properties, patternProperties, additionalProperties, dependencies +- [compound keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, not, oneOf, anyOf, allOf + +With option `v5: true` Ajv also supports all validation keywords and [$data reference](#data-reference) from [v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON-schema standard: + +- [switch](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#switch-v5-proposal) - conditional validation with a sequence of if/then clauses +- [contains](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#contains-v5-proposal) - check that array contains a valid item +- [constant](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#constant-v5-proposal) - check that data is equal to some value +- [patternGroups](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#patterngroups-v5-proposal) - a more powerful alternative to patternProperties +- [patternRequired](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#patternrequired-v5-proposal) - like `required` but with patterns that some property should match. +- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-v5-proposal) - setting limits for date, time, etc. + +See [JSON-Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md) for more details. + + +## Formats + +The following formats are supported for string validation with "format" keyword: + +- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). +- _time_: time with optional time-zone. +- _date-time_: date-time from the same source (time-zone is mandatory). `date`, `time` and `date-time` validate ranges in `full` mode and only regexp in `fast` mode (see [options](#options)). +- _uri_: full uri with optional protocol. +- _email_: email address. +- _hostname_: host name acording to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). +- _ipv4_: IP address v4. +- _ipv6_: IP address v6. +- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. +- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). +- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). +- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). + +There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `email`, and `hostname`. See [Options](#options) for details. + +You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method. + +The option `unknownFormats` allows to change the behaviour in case an unknown format is encountered - Ajv can either ignore them (default now) or fail schema compilation (will be the default in 5.0.0). + +You can find patterns used for format validation and the sources that were used in [formats.js](https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js). + + +## $data reference + +With `v5` option you can use values from the validated data as the values for the schema keywords. See [v5 proposal](https://github.com/json-schema/json-schema/wiki/$data-(v5-proposal)) for more information about how it works. + +`$data` reference is supported in the keywords: constant, enum, format, maximum/minimum, exclusiveMaximum / exclusiveMinimum, maxLength / minLength, maxItems / minItems, maxProperties / minProperties, formatMaximum / formatMinimum, formatExclusiveMaximum / formatExclusiveMinimum, multipleOf, pattern, required, uniqueItems. + +The value of "$data" should be a [JSON-pointer](https://tools.ietf.org/html/rfc6901) to the data (the root is always the top level data object, even if the $data reference is inside a referenced subschema) or a [relative JSON-pointer](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00) (it is relative to the current point in data; if the $data reference is inside a referenced subschema it cannot point to the data outside of the root level for this subschema). + +Examples. + +This schema requires that the value in property `smaller` is less or equal than the value in the property larger: + +```javascript +var schema = { + "properties": { + "smaller": { + "type": "number", + "maximum": { "$data": "1/larger" } + }, + "larger": { "type": "number" } + } +}; + +var validData = { + smaller: 5, + larger: 7 +}; +``` + +This schema requires that the properties have the same format as their field names: + +```javascript +var schema = { + "additionalProperties": { + "type": "string", + "format": { "$data": "0#" } + } +}; + +var validData = { + 'date-time': '1963-06-19T08:30:06.283185Z', + email: 'joe.bloggs@example.com' +} +``` + +`$data` reference is resolved safely - it won't throw even if some property is undefined. If `$data` resolves to `undefined` the validation succeeds (with the exclusion of `constant` keyword). If `$data` resolves to incorrect type (e.g. not "number" for maximum keyword) the validation fails. + + +## $merge and $patch keywords + +With v5 option and the package [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON-schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902). + +To add keywords `$merge` and `$patch` to Ajv instance use this code: + +```javascript +require('ajv-merge-patch')(ajv); +``` + +Examples. + +Using `$merge`: + +```json +{ + "$merge": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": { + "properties": { "q": { "type": "number" } } + } + } +} +``` + +Using `$patch`: + +```json +{ + "$patch": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": [ + { "op": "add", "path": "/properties/q", "value": { "type": "number" } } + ] + } +} +``` + +The schemas above are equivalent to this schema: + +```json +{ + "type": "object", + "properties": { + "p": { "type": "string" }, + "q": { "type": "number" } + }, + "additionalProperties": false +} +``` + +The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema. + +See the package [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) for more information. + + +## Defining custom keywords + +The advantages of using custom keywords are: + +- allow creating validation scenarios that cannot be expressed using JSON-Schema +- simplify your schemas +- help bringing a bigger part of the validation logic to your schemas +- make your schemas more expressive, less verbose and closer to your application domain +- implement custom data processors that modify your data (`modifying` option MUST be used in keyword definition) and/or create side effects while the data is being validated + +If a keyword is used only for side-effects and its validation result is pre-defined, use option `valid: true/false` in keyword definition to simplify both generated code (no error handling in case of `valid: true`) and your keyword functions (no need to return any validation result). + +The concerns you have to be aware of when extending JSON-schema standard with custom keywords are the portability and understanding of your schemas. You will have to support these custom keywords on other platforms and to properly document these keywords so that everybody can understand them in your schemas. + +You can define custom keywords with [addKeyword](#api-addkeyword) method. Keywords are defined on the `ajv` instance level - new instances will not have previously defined keywords. + +Ajv allows defining keywords with: +- validation function +- compilation function +- macro function +- inline compilation function that should return code (as string) that will be inlined in the currently compiled schema. + +Example. `range` and `exclusiveRange` keywords using compiled schema: + +```javascript +ajv.addKeyword('range', { type: 'number', compile: function (sch, parentSchema) { + var min = sch[0]; + var max = sch[1]; + + return parentSchema.exclusiveRange === true + ? function (data) { return data > min && data < max; } + : function (data) { return data >= min && data <= max; } +} }); + +var schema = { "range": [2, 4], "exclusiveRange": true }; +var validate = ajv.compile(schema); +console.log(validate(2.01)); // true +console.log(validate(3.99)); // true +console.log(validate(2)); // false +console.log(validate(4)); // false +``` + +Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords. + +See [Defining custom keywords](https://github.com/epoberezkin/ajv/blob/master/CUSTOM.md) for more details. + + +## Asynchronous compilation + +During asynchronous compilation remote references are loaded using supplied function. See `compileAsync` method and `loadSchema` [option](#options). + +Example: + +```javascript +var ajv = new Ajv({ loadSchema: loadSchema }); + +ajv.compileAsync(schema, function (err, validate) { + if (err) return; + var valid = validate(data); +}); + +function loadSchema(uri, callback) { + request.json(uri, function(err, res, body) { + if (err || res.statusCode >= 400) + callback(err || new Error('Loading error: ' + res.statusCode)); + else + callback(null, body); + }); +} +``` + +__Please note__: [Option](#options) `missingRefs` should NOT be set to `"ignore"` or `"fail"` for asynchronous compilation to work. + + +## Asynchronous validation + +Example in node REPL: https://tonicdev.com/esp/ajv-asynchronous-validation + +You can define custom formats and keywords that perform validation asyncronously by accessing database or some service. You should add `async: true` in the keyword or format defnition (see [addFormat](#api-addformat), [addKeyword](#api-addkeyword) and [Defining custom keywords](#defining-custom-keywords)). + +If your schema uses asynchronous formats/keywords or refers to some schema that contains them it should have `"$async": true` keyword so that Ajv can compile it correctly. If asynchronous format/keyword or reference to asynchronous schema is used in the schema without `$async` keyword Ajv will throw an exception during schema compilation. + +__Please note__: all asynchronous subschemas that are referenced from the current or other schemas should have `"$async": true` keyword as well, otherwise the schema compilation will fail. + +Validation function for an asynchronous custom format/keyword should return a promise that resolves to `true` or `false` (or rejects with `new Ajv.ValidationError(errors)` if you want to return custom errors from the keyword function). Ajv compiles asynchronous schemas to either [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) (default) that can be optionally transpiled with [regenerator](https://github.com/facebook/regenerator) or to [es7 async function](http://tc39.github.io/ecmascript-asyncawait/) that can be transpiled with [nodent](https://github.com/MatAtBread/nodent) or with regenerator as well. You can also supply any other transpiler as a function. See [Options](#options). + +The compiled validation function has `$async: true` property (if the schema is asynchronous), so you can differentiate these functions if you are using both syncronous and asynchronous schemas. + +If you are using generators, the compiled validation function can be either wrapped with [co](https://github.com/tj/co) (default) or returned as generator function, that can be used directly, e.g. in [koa](http://koajs.com/) 1.0. `co` is a small library, it is included in Ajv (both as npm dependency and in the browser bundle). + +Generator functions are currently supported in Chrome, Firefox and node.js (0.11+); if you are using Ajv in other browsers or in older versions of node.js you should use one of available transpiling options. All provided async modes use global Promise class. If your platform does not have Promise you should use a polyfill that defines it. + +Validation result will be a promise that resolves to `true` or rejects with an exception `Ajv.ValidationError` that has the array of validation errors in `errors` property. + + +Example: + +```javascript +/** + * without "async" and "transpile" options (or with option {async: true}) + * Ajv will choose the first supported/installed option in this order: + * 1. native generator function wrapped with co + * 2. es7 async functions transpiled with nodent + * 3. es7 async functions transpiled with regenerator + */ + +var ajv = new Ajv; + +ajv.addKeyword('idExists', { + async: true, + type: 'number', + validate: checkIdExists +}); + + +function checkIdExists(schema, data) { + return knex(schema.table) + .select('id') + .where('id', data) + .then(function (rows) { + return !!rows.length; // true if record is found + }); +} + +var schema = { + "$async": true, + "properties": { + "userId": { + "type": "integer", + "idExists": { "table": "users" } + }, + "postId": { + "type": "integer", + "idExists": { "table": "posts" } + } + } +}; + +var validate = ajv.compile(schema); + +validate({ userId: 1, postId: 19 })) +.then(function (valid) { + // "valid" is always true here + console.log('Data is valid'); +}) +.catch(function (err) { + if (!(err instanceof Ajv.ValidationError)) throw err; + // data is invalid + console.log('Validation errors:', err.errors); +}); + +``` + +### Using transpilers with asyncronous validation functions. + +To use a transpiler you should separately install it (or load its bundle in the browser). + +Ajv npm package includes minified browser bundles of regenerator and nodent in dist folder. + + +#### Using nodent + +```javascript +var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' }); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +`npm install nodent` or use `nodent.min.js` from dist folder of npm package. + + +#### Using regenerator + +```javascript +var ajv = new Ajv({ /* async: 'es7', */ transpile: 'regenerator' }); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +`npm install regenerator` or use `regenerator.min.js` from dist folder of npm package. + + +#### Using other transpilers + +```javascript +var ajv = new Ajv({ async: 'es7', transpile: transpileFunc }); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +See [Options](#options). + + +#### Comparison of async modes + +|mode|transpile
speed*|run-time
speed*|bundle
size| +|---|:-:|:-:|:-:| +|generators
(native)|-|1.0|-| +|es7.nodent|1.35|1.1|183Kb| +|es7.regenerator|1.0|2.7|322Kb| +|regenerator|1.0|3.2|322Kb| + +\* Relative performance in node v.4, smaller is better. + +[nodent](https://github.com/MatAtBread/nodent) has several advantages: + +- much smaller browser bundle than regenerator +- almost the same performance of generated code as native generators in nodejs and the latest Chrome +- much better performace than native generators in other browsers +- works in IE 9 (regenerator does not) + +[regenerator](https://github.com/facebook/regenerator) is a more widely adopted alternative. + + +## Filtering data + +With [option `removeAdditional`](#options) (added by [andyscott](https://github.com/andyscott)) you can filter data during the validation. + +This option modifies original data. + +Example: + +```javascript +var ajv = new Ajv({ removeAdditional: true }); +var schema = { + "additionalProperties": false, + "properties": { + "foo": { "type": "number" }, + "bar": { + "additionalProperties": { "type": "number" }, + "properties": { + "baz": { "type": "string" } + } + } + } +} + +var data = { + "foo": 0, + "additional1": 1, // will be removed; `additionalProperties` == false + "bar": { + "baz": "abc", + "additional2": 2 // will NOT be removed; `additionalProperties` != false + }, +} + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 0, "bar": { "baz": "abc", "additional2": 2 } +``` + +If `removeAdditional` option in the example above were `"all"` then both `additional1` and `additional2` properties would have been removed. + +If the option were `"failing"` then property `additional1` would have been removed regardless of its value and property `additional2` would have been removed only if its value were failing the schema in the inner `additionalProperties` (so in the example above it would have stayed because it passes the schema, but any non-number would have been removed). + +__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: + +```json +{ + "type": "object", + "oneOf": [ + { + "properties": { + "foo": { "type": "string" } + }, + "required": [ "foo" ], + "additionalProperties": false + }, + { + "properties": { + "bar": { "type": "integer" } + }, + "required": [ "bar" ], + "additionalProperties": false + } + ] +} +``` + +The intention of the schema above is to allow objects with either the string property "foo" or the integer property "bar", but not with both and not with any other properties. + +With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema). + +While this behaviour is unexpected (issues [#129](https://github.com/epoberezkin/ajv/issues/129), [#134](https://github.com/epoberezkin/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way: + +```json +{ + "type": "object", + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "integer" } + }, + "additionalProperties": false, + "oneOf": [ + { "required": [ "foo" ] }, + { "required": [ "bar" ] } + ] +} +``` + +The schema above is also more efficient - it will compile into a faster function. + + +## Assigning defaults + +With [option `useDefaults`](#options) Ajv will assign values from `default` keyword in the schemas of `properties` and `items` (when it is the array of schemas) to the missing properties and items. + +This option modifies original data. + +__Please note__: by default the default value is inserted in the generated validation code as a literal (starting from v4.0), so the value inserted in the data will be the deep clone of the default in the schema. + +If you need to insert the default value in the data by reference pass the option `useDefaults: "shared"`. + +Inserting defaults by reference can be faster (in case you have an object in `default`) and it allows to have dynamic values in defaults, e.g. timestamp, without recompiling the schema. The side effect is that modifying the default value in any validated data instance will change the default in the schema and in other validated data instances. See example 3 below. + + +Example 1 (`default` in `properties`): + +```javascript +var ajv = new Ajv({ useDefaults: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "string", "default": "baz" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": 1 }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": "baz" } +``` + +Example 2 (`default` in `items`): + +```javascript +var schema = { + "type": "array", + "items": [ + { "type": "number" }, + { "type": "string", "default": "foo" } + ] +} + +var data = [ 1 ]; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // [ 1, "foo" ] +``` + +Example 3 (inserting "defaults" by reference): + +```javascript +var ajv = new Ajv({ useDefaults: 'shared' }); + +var schema = { + properties: { + foo: { + default: { bar: 1 } + } + } +} + +var validate = ajv.compile(schema); + +var data = {}; +console.log(validate(data)); // true +console.log(data); // { foo: { bar: 1 } } + +data.foo.bar = 2; + +var data2 = {}; +console.log(validate(data2)); // true +console.log(data2); // { foo: { bar: 2 } } +``` + +`default` keywords in other cases are ignored: + +- not in `properties` or `items` subschemas +- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/epoberezkin/ajv/issues/42)) +- in `if` subschema of v5 `switch` keyword +- in schemas generated by custom macro keywords + + +## Coercing data types + +When you are validating user inputs all your data properties are usually strings. The option `coerceTypes` allows you to have your data types coerced to the types specified in your schema `type` keywords, both to pass the validation and to use the correctly typed data afterwards. + +This option modifies original data. + +__Please note__: if you pass a scalar value to the validating function its type will be coerced and it will pass the validation, but the value of the variable you pass won't be updated because scalars are passed by value. + + +Example 1: + +```javascript +var ajv = new Ajv({ coerceTypes: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "boolean" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": "1", "bar": "false" }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": false } +``` + +Example 2 (array coercions): + +```javascript +var ajv = new Ajv({ coerceTypes: 'array' }); +var schema = { + "properties": { + "foo": { "type": "array", "items": { "type": "number" } }, + "bar": { "type": "boolean" } + } +}; + +var data = { "foo": "1", "bar": ["false"] }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": [1], "bar": false } +``` + +The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords). + +See [Coercion rules](https://github.com/epoberezkin/ajv/blob/master/COERCION.md) for details. + + +## API + +##### new Ajv(Object options) -> Object + +Create Ajv instance. + +All the instance methods below are bound to the instance, so they can be used without the instance. + + +##### .compile(Object schema) -> Function<Object data> + +Generate validating function and cache the compiled schema for future use. + +Validating function returns boolean and has properties `errors` with the errors from the last validation (`null` if there were no errors) and `schema` with the reference to the original schema. + +Unless the option `validateSchema` is false, the schema will be validated against meta-schema and if schema is invalid the error will be thrown. See [options](#options). + + +##### .compileAsync(Object schema, Function callback) + +Asyncronous version of `compile` method that loads missing remote schemas using asynchronous function in `options.loadSchema`. Callback will always be called with 2 parameters: error (or null) and validating function. Error will be not null in the following cases: + +- missing schema can't be loaded (`loadSchema` calls callback with error). +- the schema containing missing reference is loaded, but the reference cannot be resolved. +- schema (or some referenced schema) is invalid. + +The function compiles schema and loads the first missing schema multiple times, until all missing schemas are loaded. + +See example in [Asynchronous compilation](#asynchronous-compilation). + + +##### .validate(Object schema|String key|String ref, data) -> Boolean + +Validate data using passed schema (it will be compiled and cached). + +Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference. + +Validation errors will be available in the `errors` property of Ajv instance (`null` if there were no errors). + +__Please note__: every time this method is called the errors are overwritten so you need to copy them to another variable if you want to use them later. + +If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). + + +##### .addSchema(Array<Object>|Object schema [, String key]) + +Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. + +Array of schemas can be passed (schemas should have ids), the second parameter will be ignored. + +Key can be passed that can be used to reference the schema and will be used as the schema id if there is no id inside the schema. If the key is not passed, the schema id will be used as the key. + + +Once the schema is added, it (and all the references inside it) can be referenced in other schemas and used to validate data. + +Although `addSchema` does not compile schemas, explicit compilation is not required - the schema will be compiled when it is used first time. + +By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. + + +##### .addMetaSchema(Array<Object>|Object schema [, String key]) + +Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). + +There is no need to explicitly add draft 4 meta schema (http://json-schema.org/draft-04/schema and http://json-schema.org/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`. + +With option `v5: true` [meta-schema that includes v5 keywords](https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json) also added. + + +##### .validateSchema(Object schema) -> Boolean + +Validates schema. This method should be used to validate schemas rather than `validate` due to the inconsistency of `uri` format in JSON-Schema standard. + +By default this method is called automatically when the schema is added, so you rarely need to use it directly. + +If schema doesn't have `$schema` property it is validated against draft 4 meta-schema (option `meta` should not be false) or against [v5 meta-schema](https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#) if option `v5` is true. + +If schema has `$schema` property then the schema with this id (that should be previously added) is used to validate passed schema. + +Errors will be available at `ajv.errors`. + + +##### .getSchema(String key) -> Function<Object data> + +Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). Returned validating function has `schema` property with the reference to the original schema. + + +##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) + +Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. + +Schema can be removed using: +- key passed to `addSchema` +- it's full reference (id) +- RegExp that should match schema id or key (meta-schemas won't be removed) +- actual schema object that will be stable-stringified to remove schema from cache + +If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. + + +##### .addFormat(String name, String|RegExp|Function|Object format) + +Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance. + +Strings are converted to RegExp. + +Function should return validation result as `true` or `false`. + +If object is passed it should have properties `validate`, `compare` and `async`: + +- _validate_: a string, RegExp or a function as described above. +- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (from [v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) - `v5` option should be used). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal. +- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`. + +Custom formats can be also added via `formats` option. + + +##### .addKeyword(String keyword, Object definition) + +Add custom validation keyword to Ajv instance. + +Keyword should be different from all standard JSON schema keywords and different from previously defined keywords. There is no way to redefine keywords or to remove keyword definition from the instance. + +Keyword must start with a letter, `_` or `$`, and may continue with letters, numbers, `_`, `$`, or `-`. +It is recommended to use an application-specific prefix for keywords to avoid current and future name collisions. + +Example Keywords: +- `"xyz-example"`: valid, and uses prefix for the xyz project to avoid name collisions. +- `"example"`: valid, but not recommended as it could collide with future versions of JSON schema etc. +- `"3-example"`: invalid as numbers are not allowed to be the first character in a keyword + +Keyword definition is an object with the following properties: + +- _type_: optional string or array of strings with data type(s) that the keyword applies to. If not present, the keyword will apply to all types. +- _validate_: validating function +- _compile_: compiling function +- _macro_: macro function +- _inline_: compiling function that returns code (as string) +- _schema_: an optional `false` value used with "validate" keyword to not pass schema +- _metaSchema_: an optional meta-schema for keyword schema +- _modifying_: `true` MUST be passed if keyword modifies data +- _valid_: pass `true`/`false` to pre-define validation result, the result returned from validation function will be ignored. This option cannot be used with macro keywords. +- _$data_: an optional `true` value to support [$data reference](#data-reference) as the value of custom keyword. The reference will be resolved at validation time. If the keyword has meta-schema it would be extended to allow $data and it will be used to validate the resolved value. Supporting $data reference requires that keyword has validating function (as the only option or in addition to compile, macro or inline function). +- _async_: an optional `true` value if the validation function is asynchronous (whether it is compiled or passed in _validate_ property); in this case it should return a promise that resolves with a value `true` or `false`. This option is ignored in case of "macro" and "inline" keywords. +- _errors_: an optional boolean indicating whether keyword returns errors. If this property is not set Ajv will determine if the errors were set in case of failed validation. + +_compile_, _macro_ and _inline_ are mutually exclusive, only one should be used at a time. _validate_ can be used separately or in addition to them to support $data reference. + +__Please note__: If the keyword is validating data type that is different from the type(s) in its definition, the validation function will not be called (and expanded macro will not be used), so there is no need to check for data type inside validation function or inside schema returned by macro function (unless you want to enforce a specific type and for some reason do not want to use a separate `type` keyword for that). In the same way as standard keywords work, if the keyword does not apply to the data type being validated, the validation of this keyword will succeed. + +See [Defining custom keywords](#defining-custom-keywords) for more details. + + +##### .getKeyword(String keyword) -> Object|Boolean + +Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. + + +##### .removeKeyword(String keyword) + +Removes custom or pre-defined keyword so you can redefine them. + +While this method can be used to extend pre-defined keywords, it can also be used to completely change their meaning - it may lead to unexpected results. + +__Please note__: schemas compiled before the keyword is removed will continue to work without changes. To recompile schemas use `removeSchema` method and compile them again. + + +##### .errorsText([Array<Object> errors [, Object options]]) -> String + +Returns the text with all errors in a String. + +Options can have properties `separator` (string used to separate errors, ", " by default) and `dataVar` (the variable name that dataPaths are prefixed with, "data" by default). + + +## Options + +Defaults: + +```javascript +{ + // validation and reporting options: + v5: false, + allErrors: false, + verbose: false, + jsonPointers: false, + uniqueItems: true, + unicode: true, + format: 'fast', + formats: {}, + unknownFormats: 'ignore', + schemas: {}, + // referenced schema options: + missingRefs: true, + extendRefs: true, + loadSchema: undefined, // function(uri, cb) { /* ... */ cb(err, schema); }, + // options to modify validated data: + removeAdditional: false, + useDefaults: false, + coerceTypes: false, + // asynchronous validation options: + async: undefined, + transpile: undefined, + // advanced options: + meta: true, + validateSchema: true, + addUsedSchema: true, + inlineRefs: true, + passContext: false, + loopRequired: Infinity, + ownProperties: false, + multipleOfPrecision: false, + errorDataPath: 'object', + sourceCode: true, + messages: true, + beautify: false, + cache: new Cache +} +``` + +##### Validation and reporting options + +- _v5_: add keywords `switch`, `constant`, `contains`, `patternGroups`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON-schema v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals). With this option added schemas without `$schema` property are validated against [v5 meta-schema](https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#). `false` by default. +- _allErrors_: check all rules collecting all errors. Default is to return after the first error. +- _verbose_: include the reference to the part of the schema (`schema` and `parentSchema`) and validated data in errors (false by default). +- _jsonPointers_: set `dataPath` propery of errors using [JSON Pointers](https://tools.ietf.org/html/rfc6901) instead of JavaScript property access notation. +- _uniqueItems_: validate `uniqueItems` keyword (true by default). +- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters. +- _format_: formats validation mode ('fast' by default). Pass 'full' for more correct and slow validation or `false` not to validate formats at all. E.g., 25:00:00 and 2015/14/33 will be invalid time and date in 'full' mode but it will be valid in 'fast' mode. +- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method. +- _unknownFormats_: handling of unknown formats. Option values: + - `true` (will be default in 5.0.0) - if the unknown format is encountered the exception is thrown during schema compilation. If `format` keyword value is [v5 $data reference](#data-reference) and it is unknown the validation will fail. + - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if some other unknown format is used. If `format` keyword value is [v5 $data reference](#data-reference) and it is not in this array the validation will fail. + - `"ignore"` (default now) - to log warning during schema compilation and always pass validation. This option is not recommended, as it allows to mistype format name. This behaviour is required by JSON-schema specification. +- _schemas_: an array or object of schemas that will be added to the instance. If the order is important, pass array. In this case schemas must have IDs in them. Otherwise the object can be passed - `addSchema(value, key)` will be called for each schema in this object. + + +##### Referenced schema options + +- _missingRefs_: handling of missing referenced schemas. Option values: + - `true` (default) - if the reference cannot be resolved during compilation the exception is thrown. The thrown error has properties `missingRef` (with hash fragment) and `missingSchema` (without it). Both properties are resolved relative to the current base id (usually schema id, unless it was substituted). + - `"ignore"` - to log error during compilation and always pass validation. + - `"fail"` - to log error and successfully compile schema but fail validation if this rule is checked. +- _extendRefs_: validation of other keywords when `$ref` is present in the schema. Option values: + - `true` (default) - validate all keywords in the schemas with `$ref`. + - `"ignore"` - when `$ref` is used other keywords are ignored (as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3) standard). A warning will be logged during the schema compilation. + - `"fail"` - if other validation keywords are used together with `$ref` the exception will be throw when the schema is compiled. +- _loadSchema_: asynchronous function that will be used to load remote schemas when the method `compileAsync` is used and some reference is missing (option `missingRefs` should NOT be 'fail' or 'ignore'). This function should accept 2 parameters: remote schema uri and node-style callback. See example in [Asynchronous compilation](#asynchronous-compilation). + + +##### Options to modify validated data + +- _removeAdditional_: remove additional properties - see example in [Filtering data](#filtering-data). This option is not used if schema is added with `addMetaSchema` method. Option values: + - `false` (default) - not to remove additional properties + - `"all"` - all additional properties are removed, regardless of `additionalProperties` keyword in schema (and no validation is made for them). + - `true` - only additional properties with `additionalProperties` keyword equal to `false` are removed. + - `"failing"` - additional properties that fail schema validation will be removed (where `additionalProperties` keyword is `false` or schema). +- _useDefaults_: replace missing properties and items with the values from corresponding `default` keywords. Default behaviour is to ignore `default` keywords. This option is not used if schema is added with `addMetaSchema` method. See examples in [Assigning defaults](#assigning-defaults). Option values: + - `false` (default) - do not use defaults + - `true` - insert defaults by value (safer and slower, object literal is used). + - `"shared"` - insert defaults by reference (faster). If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well. +- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/epoberezkin/ajv/blob/master/COERCION.md). Option values: + - `false` (default) - no type coercion. + - `true` - coerce scalar data types. + - `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema). + + +##### Asynchronous validation options + +- _async_: determines how Ajv compiles asynchronous schemas (see [Asynchronous validation](#asynchronous-validation)) to functions. Option values: + - `"*"` / `"co*"` - compile to generator function ("co*" - wrapped with `co.wrap`). If generators are not supported and you don't provide `transpile` option, the exception will be thrown when Ajv instance is created. + - `"es7"` - compile to es7 async function. Unless your platform supports them you need to provide `transpile` option. Currently only MS Edge 13 with flag supports es7 async functions according to [compatibility table](http://kangax.github.io/compat-table/es7/)). + - `true` - if transpile option is not passed Ajv will choose the first supported/installed async/transpile modes in this order: "co*" (native generator with co.wrap), "es7"/"nodent", "co*"/"regenerator" during the creation of the Ajv instance. If none of the options is available the exception will be thrown. + - `undefined`- Ajv will choose the first available async mode in the same way as with `true` option but when the first asynchronous schema is compiled. +- _transpile_: determines whether Ajv transpiles compiled asynchronous validation function. Option values: + - `"nodent"` - transpile with [nodent](https://github.com/MatAtBread/nodent). If nodent is not installed, the exception will be thrown. nodent can only transpile es7 async functions; it will enforce this mode. + - `"regenerator"` - transpile with [regenerator](https://github.com/facebook/regenerator). If regenerator is not installed, the exception will be thrown. + - a function - this function should accept the code of validation function as a string and return transpiled code. This option allows you to use any other transpiler you prefer. + + +##### Advanced options + +- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default). With option `v5: true` [v5 meta-schema](https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#) will be added as well. If an object is passed, it will be used as the default meta-schema for schemas that have no `$schema` keyword. This default meta-schema MUST have `$schema` keyword. +- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can either be http://json-schema.org/schema or http://json-schema.org/draft-04/schema or absent (draft-4 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. Option values: + - `true` (default) - if the validation fails, throw the exception. + - `"log"` - if the validation fails, log error. + - `false` - skip schema validation. +- _addUsedSchema_: by default methods `compile` and `validate` add schemas to the instance if they have `id` property that doesn't start with "#". If `id` is present and it is not unique the exception will be thrown. Set this option to `false` to skip adding schemas to the instance and the `id` uniqueness check when these methods are used. This option does not affect `addSchema` method. +- _inlineRefs_: Affects compilation of referenced schemas. Option values: + - `true` (default) - the referenced schemas that don't have refs in them are inlined, regardless of their size - that substantially improves performance at the cost of the bigger size of compiled schema functions. + - `false` - to not inline referenced schemas (they will be compiled as separate functions). + - integer number - to limit the maximum number of keywords of the schema that will be inlined. +- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance. +- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance. +- _ownProperties_: by default ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst. +- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/epoberezkin/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations). +- _errorDataPath_: set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`. +- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call). +- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n)). +- _beautify_: format the generated function with [js-beautify](https://github.com/beautify-web/js-beautify) (the validating function is generated without line-breaks). `npm install js-beautify` to use this option. `true` or js-beautify options can be passed. +- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`. + + +## Validation errors + +In case of validation failure Ajv assigns the array of errors to `.errors` property of validation function (or to `.errors` property of Ajv instance in case `validate` or `validateSchema` methods were called). In case of [asynchronous validation](#asynchronous-validation) the returned promise is rejected with the exception of the class `Ajv.ValidationError` that has `.errors` poperty. + + +### Error objects + +Each error is an object with the following properties: + +- _keyword_: validation keyword. +- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`). +- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation. +- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package). See below for parameters set by all keywords. +- _message_: the standard error message (can be excluded with option `messages` set to false). +- _schema_: the schema of the keyword (added with `verbose` option). +- _parentSchema_: the schema containing the keyword (added with `verbose` option) +- _data_: the data validated by the keyword (added with `verbose` option). + + +### Error parameters + +Properties of `params` object in errors depend on the keyword that failed validation. + +- `maxItems`, `minItems`, `maxLength`, `minLength`, `maxProperties`, `minProperties` - property `limit` (number, the schema of the keyword). +- `additionalItems` - property `limit` (the maximum number of allowed items in case when `items` keyword is an array of schemas and `additionalItems` is false). +- `additionalProperties` - property `additionalProperty` (the property not used in `properties` and `patternProperties` keywords). +- `patternGroups` (with v5 option) - properties: + - `pattern` + - `reason` ("minimum"/"maximum"), + - `limit` (max/min allowed number of properties matching number) +- `dependencies` - properties: + - `property` (dependent property), + - `missingProperty` (required missing dependency - only the first one is reported currently) + - `deps` (required dependencies, comma separated list as a string), + - `depsCount` (the number of required dependedncies). +- `format` - property `format` (the schema of the keyword). +- `maximum`, `minimum` - properties: + - `limit` (number, the schema of the keyword), + - `exclusive` (boolean, the schema of `exclusiveMaximum` or `exclusiveMinimum`), + - `comparison` (string, comparison operation to compare the data to the limit, with the data on the left and the limit on the right; can be "<", "<=", ">", ">=") +- `multipleOf` - property `multipleOf` (the schema of the keyword) +- `pattern` - property `pattern` (the schema of the keyword) +- `required` - property `missingProperty` (required property that is missing). +- `patternRequired` (with v5 option) - property `missingPattern` (required pattern that did not match any property). +- `type` - property `type` (required type(s), a string, can be a comma-separated list) +- `uniqueItems` - properties `i` and `j` (indices of duplicate items). +- `enum` - property `allowedValues` pointing to the array of values (the schema of the keyword). +- `$ref` - property `ref` with the referenced schema URI. +- custom keywords (in case keyword definition doesn't create errors) - property `keyword` (the keyword name). + + +## Related packages + +- [ajv-cli](https://github.com/epoberezkin/ajv-cli) - command line interface for Ajv +- [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) - internationalised error messages +- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - keywords $merge and $patch from v5 proposals. +- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - several custom keywords that can be used with Ajv (typeof, instanceof, range, propertyNames) + + +## Some packages using Ajv + +- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser +- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services +- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition +- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator +- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org +- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON-schema http://jsonschemalint.com +- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for node.js +- [table](https://github.com/gajus/table) - formats data into a string table +- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser +- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content +- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation +- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation +- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages +- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema +- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON-schema with expect in mocha tests +- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON-Schema +- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file +- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app +- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter +- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages + + +## Tests + +``` +npm install +git submodule update --init +npm test +``` + +## Contributing + +All validation functions are generated using doT templates in [dot](https://github.com/epoberezkin/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency. + +`npm run build` - compiles templates to [dotjs](https://github.com/epoberezkin/ajv/tree/master/lib/dotjs) folder. + +`npm run watch` - automatically compiles templates when files in dot folder change + +Please see [Contributing guidelines](https://github.com/epoberezkin/ajv/blob/master/CONTRIBUTING.md) + + +## Changes history + +See https://github.com/epoberezkin/ajv/releases + +__Please note__: [Changes in version 5.0.1-beta](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0). + +[Changes in version 4.6.0](https://github.com/epoberezkin/ajv/releases/tag/4.6.0). + +[Changes in version 4.0.0](https://github.com/epoberezkin/ajv/releases/tag/4.0.0). + +[Changes in version 3.0.0](https://github.com/epoberezkin/ajv/releases/tag/3.0.0). + +[Changes in version 2.0.0](https://github.com/epoberezkin/ajv/releases/tag/2.0.0). + + +## License + +[MIT](https://github.com/epoberezkin/ajv/blob/master/LICENSE) diff --git a/node_modules/ajv/dist/ajv.bundle.js b/node_modules/ajv/dist/ajv.bundle.js new file mode 100644 index 000000000..b624d1367 --- /dev/null +++ b/node_modules/ajv/dist/ajv.bundle.js @@ -0,0 +1,8023 @@ +(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.Ajv = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 1 && month <= 12 && day >= 1 && day <= DAYS[month]; +} + + +function time(str, full) { + var matches = str.match(TIME); + if (!matches) return false; + + var hour = matches[1]; + var minute = matches[2]; + var second = matches[3]; + var timeZone = matches[5]; + return hour <= 23 && minute <= 59 && second <= 59 && (!full || timeZone); +} + + +var DATE_TIME_SEPARATOR = /t|\s/i; +function date_time(str) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + var dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); +} + + +function hostname(str) { + // https://tools.ietf.org/html/rfc1034#section-3.5 + // https://tools.ietf.org/html/rfc1123#section-2 + return str.length <= 255 && HOSTNAME.test(str); +} + + +var NOT_URI_FRAGMENT = /\/|\:/; +function uri(str) { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} + + +function regex(str) { + try { + new RegExp(str); + return true; + } catch(e) { + return false; + } +} + + +function compareDate(d1, d2) { + if (!(d1 && d2)) return; + if (d1 > d2) return 1; + if (d1 < d2) return -1; + if (d1 === d2) return 0; +} + + +function compareTime(t1, t2) { + if (!(t1 && t2)) return; + t1 = t1.match(TIME); + t2 = t2.match(TIME); + if (!(t1 && t2)) return; + t1 = t1[1] + t1[2] + t1[3] + (t1[4]||''); + t2 = t2[1] + t2[2] + t2[3] + (t2[4]||''); + if (t1 > t2) return 1; + if (t1 < t2) return -1; + if (t1 === t2) return 0; +} + + +function compareDateTime(dt1, dt2) { + if (!(dt1 && dt2)) return; + dt1 = dt1.split(DATE_TIME_SEPARATOR); + dt2 = dt2.split(DATE_TIME_SEPARATOR); + var res = compareDate(dt1[0], dt2[0]); + if (res === undefined) return; + return res || compareTime(dt1[1], dt2[1]); +} + +},{"./util":11}],6:[function(require,module,exports){ +'use strict'; + +var resolve = require('./resolve') + , util = require('./util') + , stableStringify = require('json-stable-stringify') + , async = require('../async'); + +var beautify; + +function loadBeautify(){ + if (beautify === undefined) { + var name = 'js-beautify'; + try { beautify = require(name).js_beautify; } + catch(e) { beautify = false; } + } +} + +var validateGenerator = require('../dotjs/validate'); + +/** + * Functions below are used inside compiled validations function + */ + +var co = require('co'); +var ucs2length = util.ucs2length; +var equal = require('./equal'); + +// this error is thrown by async schemas to return validation errors via exception +var ValidationError = require('./validation_error'); + +module.exports = compile; + + +/** + * Compiles schema to validation function + * @this Ajv + * @param {Object} schema schema object + * @param {Object} root object with information about the root schema for this schema + * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution + * @param {String} baseId base ID for IDs in the schema + * @return {Function} validation function + */ +function compile(schema, root, localRefs, baseId) { + /* jshint validthis: true, evil: true */ + /* eslint no-shadow: 0 */ + var self = this + , opts = this._opts + , refVal = [ undefined ] + , refs = {} + , patterns = [] + , patternsHash = {} + , defaults = [] + , defaultsHash = {} + , customRules = [] + , keepSourceCode = opts.sourceCode !== false; + + root = root || { schema: schema, refVal: refVal, refs: refs }; + + var c = checkCompiling.call(this, schema, root, baseId); + var compilation = this._compilations[c.index]; + if (c.compiling) return (compilation.callValidate = callValidate); + + var formats = this._formats; + var RULES = this.RULES; + + try { + var v = localCompile(schema, root, localRefs, baseId); + compilation.validate = v; + var cv = compilation.callValidate; + if (cv) { + cv.schema = v.schema; + cv.errors = null; + cv.refs = v.refs; + cv.refVal = v.refVal; + cv.root = v.root; + cv.$async = v.$async; + if (keepSourceCode) cv.sourceCode = v.sourceCode; + } + return v; + } finally { + endCompiling.call(this, schema, root, baseId); + } + + function callValidate() { + var validate = compilation.validate; + var result = validate.apply(null, arguments); + callValidate.errors = validate.errors; + return result; + } + + function localCompile(_schema, _root, localRefs, baseId) { + var isRoot = !_root || (_root && _root.schema == _schema); + if (_root.schema != root.schema) + return compile.call(self, _schema, _root, localRefs, baseId); + + var $async = _schema.$async === true; + if ($async && !opts.transpile) async.setup(opts); + + var sourceCode = validateGenerator({ + isTop: true, + schema: _schema, + isRoot: isRoot, + baseId: baseId, + root: _root, + schemaPath: '', + errSchemaPath: '#', + errorPath: '""', + RULES: RULES, + validate: validateGenerator, + util: util, + resolve: resolve, + resolveRef: resolveRef, + usePattern: usePattern, + useDefault: useDefault, + useCustomRule: useCustomRule, + opts: opts, + formats: formats, + self: self + }); + + sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + + vars(defaults, defaultCode) + vars(customRules, customRuleCode) + + sourceCode; + + if (opts.beautify) { + loadBeautify(); + /* istanbul ignore else */ + if (beautify) sourceCode = beautify(sourceCode, opts.beautify); + else console.error('"npm install js-beautify" to use beautify option'); + } + // console.log('\n\n\n *** \n', sourceCode); + var validate, validateCode + , transpile = opts._transpileFunc; + try { + validateCode = $async && transpile + ? transpile(sourceCode) + : sourceCode; + + var makeValidate = new Function( + 'self', + 'RULES', + 'formats', + 'root', + 'refVal', + 'defaults', + 'customRules', + 'co', + 'equal', + 'ucs2length', + 'ValidationError', + validateCode + ); + + validate = makeValidate( + self, + RULES, + formats, + root, + refVal, + defaults, + customRules, + co, + equal, + ucs2length, + ValidationError + ); + + refVal[0] = validate; + } catch(e) { + console.error('Error compiling schema, function code:', validateCode); + throw e; + } + + validate.schema = _schema; + validate.errors = null; + validate.refs = refs; + validate.refVal = refVal; + validate.root = isRoot ? validate : _root; + if ($async) validate.$async = true; + if (keepSourceCode) validate.sourceCode = sourceCode; + if (opts.sourceCode === true) { + validate.source = { + patterns: patterns, + defaults: defaults + }; + } + + return validate; + } + + function resolveRef(baseId, ref, isRoot) { + ref = resolve.url(baseId, ref); + var refIndex = refs[ref]; + var _refVal, refCode; + if (refIndex !== undefined) { + _refVal = refVal[refIndex]; + refCode = 'refVal[' + refIndex + ']'; + return resolvedRef(_refVal, refCode); + } + if (!isRoot && root.refs) { + var rootRefId = root.refs[ref]; + if (rootRefId !== undefined) { + _refVal = root.refVal[rootRefId]; + refCode = addLocalRef(ref, _refVal); + return resolvedRef(_refVal, refCode); + } + } + + refCode = addLocalRef(ref); + var v = resolve.call(self, localCompile, root, ref); + if (!v) { + var localSchema = localRefs && localRefs[ref]; + if (localSchema) { + v = resolve.inlineRef(localSchema, opts.inlineRefs) + ? localSchema + : compile.call(self, localSchema, root, localRefs, baseId); + } + } + + if (v) { + replaceLocalRef(ref, v); + return resolvedRef(v, refCode); + } + } + + function addLocalRef(ref, v) { + var refId = refVal.length; + refVal[refId] = v; + refs[ref] = refId; + return 'refVal' + refId; + } + + function replaceLocalRef(ref, v) { + var refId = refs[ref]; + refVal[refId] = v; + } + + function resolvedRef(refVal, code) { + return typeof refVal == 'object' + ? { code: code, schema: refVal, inline: true } + : { code: code, $async: refVal && refVal.$async }; + } + + function usePattern(regexStr) { + var index = patternsHash[regexStr]; + if (index === undefined) { + index = patternsHash[regexStr] = patterns.length; + patterns[index] = regexStr; + } + return 'pattern' + index; + } + + function useDefault(value) { + switch (typeof value) { + case 'boolean': + case 'number': + return '' + value; + case 'string': + return util.toQuotedString(value); + case 'object': + if (value === null) return 'null'; + var valueStr = stableStringify(value); + var index = defaultsHash[valueStr]; + if (index === undefined) { + index = defaultsHash[valueStr] = defaults.length; + defaults[index] = value; + } + return 'default' + index; + } + } + + function useCustomRule(rule, schema, parentSchema, it) { + var validateSchema = rule.definition.validateSchema; + if (validateSchema && self._opts.validateSchema !== false) { + var valid = validateSchema(schema); + if (!valid) { + var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); + if (self._opts.validateSchema == 'log') console.error(message); + else throw new Error(message); + } + } + + var compile = rule.definition.compile + , inline = rule.definition.inline + , macro = rule.definition.macro; + + var validate; + if (compile) { + validate = compile.call(self, schema, parentSchema, it); + } else if (macro) { + validate = macro.call(self, schema, parentSchema, it); + if (opts.validateSchema !== false) self.validateSchema(validate, true); + } else if (inline) { + validate = inline.call(self, it, rule.keyword, schema, parentSchema); + } else { + validate = rule.definition.validate; + } + + var index = customRules.length; + customRules[index] = validate; + + return { + code: 'customRule' + index, + validate: validate + }; + } +} + + +/** + * Checks if the schema is currently compiled + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) + */ +function checkCompiling(schema, root, baseId) { + /* jshint validthis: true */ + var index = compIndex.call(this, schema, root, baseId); + if (index >= 0) return { index: index, compiling: true }; + index = this._compilations.length; + this._compilations[index] = { + schema: schema, + root: root, + baseId: baseId + }; + return { index: index, compiling: false }; +} + + +/** + * Removes the schema from the currently compiled list + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + */ +function endCompiling(schema, root, baseId) { + /* jshint validthis: true */ + var i = compIndex.call(this, schema, root, baseId); + if (i >= 0) this._compilations.splice(i, 1); +} + + +/** + * Index of schema compilation in the currently compiled list + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + * @return {Integer} compilation index + */ +function compIndex(schema, root, baseId) { + /* jshint validthis: true */ + for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate + } + } + return length; +}; + +},{}],11:[function(require,module,exports){ +'use strict'; + + +module.exports = { + copy: copy, + checkDataType: checkDataType, + checkDataTypes: checkDataTypes, + coerceToTypes: coerceToTypes, + toHash: toHash, + getProperty: getProperty, + escapeQuotes: escapeQuotes, + ucs2length: require('./ucs2length'), + varOccurences: varOccurences, + varReplace: varReplace, + cleanUpCode: cleanUpCode, + cleanUpVarErrors: cleanUpVarErrors, + schemaHasRules: schemaHasRules, + schemaHasRulesExcept: schemaHasRulesExcept, + stableStringify: require('json-stable-stringify'), + toQuotedString: toQuotedString, + getPathExpr: getPathExpr, + getPath: getPath, + getData: getData, + unescapeFragment: unescapeFragment, + escapeFragment: escapeFragment, + escapeJsonPointer: escapeJsonPointer +}; + + +function copy(o, to) { + to = to || {}; + for (var key in o) to[key] = o[key]; + return to; +} + + +function checkDataType(dataType, data, negate) { + var EQUAL = negate ? ' !== ' : ' === ' + , AND = negate ? ' || ' : ' && ' + , OK = negate ? '!' : '' + , NOT = negate ? '' : '!'; + switch (dataType) { + case 'null': return data + EQUAL + 'null'; + case 'array': return OK + 'Array.isArray(' + data + ')'; + case 'object': return '(' + OK + data + AND + + 'typeof ' + data + EQUAL + '"object"' + AND + + NOT + 'Array.isArray(' + data + '))'; + case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + + NOT + '(' + data + ' % 1)' + + AND + data + EQUAL + data + ')'; + default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; + } +} + + +function checkDataTypes(dataTypes, data) { + switch (dataTypes.length) { + case 1: return checkDataType(dataTypes[0], data, true); + default: + var code = ''; + var types = toHash(dataTypes); + if (types.array && types.object) { + code = types.null ? '(': '(!' + data + ' || '; + code += 'typeof ' + data + ' !== "object")'; + delete types.null; + delete types.array; + delete types.object; + } + if (types.number) delete types.integer; + for (var t in types) + code += (code ? ' && ' : '' ) + checkDataType(t, data, true); + + return code; + } +} + + +var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); +function coerceToTypes(optionCoerceTypes, dataTypes) { + if (Array.isArray(dataTypes)) { + var types = []; + for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); + return paths[lvl - up]; + } + + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); + data = 'data' + ((lvl - up) || ''); + if (!jsonPointer) return data; + } + + var expr = data; + var segments = jsonPointer.split('/'); + for (var i=0; i', + $result = 'result' + $lvl; + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), + $exclusive = 'exclusive' + $lvl, + $opExpr = 'op' + $lvl, + $opStr = '\' + ' + $opExpr + ' + \''; + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; + $schemaValueExcl = 'schemaExcl' + $lvl; + out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; '; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + if ($isData) { + out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + if ($isDataFormat) { + out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { '; + $closingBraces += '}'; + } + out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; + } else { + var $exclusive = $schemaExcl === true, + $opStr = $op; + if (!$exclusive) $opStr += '='; + var $opExpr = '\'' + $opStr + '\''; + if ($isData) { + out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + if ($isDataFormat) { + out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { '; + $closingBraces += '}'; + } + out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op); + if (!$exclusive) { + out += '='; + } + out += ' 0;'; + } + out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , exclusive: ' + ($exclusive) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be ' + ($opStr) + ' "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '}'; + return out; +} + +},{}],14:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limit(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $isMax = $keyword == 'maximum', + $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', + $schemaExcl = it.schema[$exclusiveKeyword], + $isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data, + $op = $isMax ? '<' : '>', + $notOp = $isMax ? '>' : '<'; + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), + $exclusive = 'exclusive' + $lvl, + $opExpr = 'op' + $lvl, + $opStr = '\' + ' + $opExpr + ' + \''; + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; + $schemaValueExcl = 'schemaExcl' + $lvl; + out += ' var exclusive' + ($lvl) + '; if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && typeof ' + ($schemaValueExcl) + ' != \'undefined\') { '; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else if( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ((exclusive' + ($lvl) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ') || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = exclusive' + ($lvl) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; + } else { + var $exclusive = $schemaExcl === true, + $opStr = $op; + if (!$exclusive) $opStr += '='; + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + ' ' + ($notOp); + if ($exclusive) { + out += '='; + } + out += ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') {'; + } + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be ' + ($opStr) + ' '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schema) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],15:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limitItems(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxItems' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxItems') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' items\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],16:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limitLength(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxLength' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + if (it.opts.unicode === false) { + out += ' ' + ($data) + '.length '; + } else { + out += ' ucs2length(' + ($data) + ') '; + } + out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be '; + if ($keyword == 'maxLength') { + out += 'longer'; + } else { + out += 'shorter'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' characters\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],17:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limitProperties(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxProperties' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxProperties') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],18:[function(require,module,exports){ +'use strict'; +module.exports = function generate_allOf(it, $keyword) { + var out = ' '; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $currentBaseId = $it.baseId, + $allSchemasEmpty = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $allSchemasEmpty = false; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if ($breakOnError) { + if ($allSchemasEmpty) { + out += ' if (true) { '; + } else { + out += ' ' + ($closingBraces.slice(0, -1)) + ' '; + } + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],19:[function(require,module,exports){ +'use strict'; +module.exports = function generate_anyOf(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $noEmptySchema = $schema.every(function($sch) { + return it.util.schemaHasRules($sch, it.RULES.all); + }); + if ($noEmptySchema) { + var $currentBaseId = $it.baseId; + out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; + $closingBraces += '}'; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should match some schema in anyOf\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + if (it.opts.allErrors) { + out += ' } '; + } + out = it.util.cleanUpCode(out); + } else { + if ($breakOnError) { + out += ' if (true) { '; + } + } + return out; +} + +},{}],20:[function(require,module,exports){ +'use strict'; +module.exports = function generate_constant(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if (!$isData) { + out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; + } + out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('constant') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should be equal to constant\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' }'; + return out; +} + +},{}],21:[function(require,module,exports){ +'use strict'; +module.exports = function generate_custom(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $rule = this, + $definition = 'definition' + $lvl, + $rDef = $rule.definition; + var $compile, $inline, $macro, $ruleValidate, $validateCode; + if ($isData && $rDef.$data) { + $validateCode = 'keywordValidate' + $lvl; + var $validateSchema = $rDef.validateSchema; + out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; + } else { + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); + $schemaValue = 'validate.schema' + $schemaPath; + $validateCode = $ruleValidate.code; + $compile = $rDef.compile; + $inline = $rDef.inline; + $macro = $rDef.macro; + } + var $ruleErrs = $validateCode + '.errors', + $i = 'i' + $lvl, + $ruleErr = 'ruleErr' + $lvl, + $asyncKeyword = $rDef.async; + if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); + if (!($inline || $macro)) { + out += '' + ($ruleErrs) + ' = null;'; + } + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if ($validateSchema) { + out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') {'; + } + if ($inline) { + if ($rDef.statements) { + out += ' ' + ($ruleValidate.validate) + ' '; + } else { + out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; + } + } else if ($macro) { + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + $it.schema = $ruleValidate.validate; + $it.schemaPath = ''; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($code); + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + out += ' ' + ($validateCode) + '.call( '; + if (it.opts.passContext) { + out += 'this'; + } else { + out += 'self'; + } + if ($compile || $rDef.schema === false) { + out += ' , ' + ($data) + ' '; + } else { + out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; + } + out += ' , (dataPath || \'\')'; + if (it.errorPath != '""') { + out += ' + ' + (it.errorPath); + } + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; + var def_callRuleValidate = out; + out = $$outStack.pop(); + if ($rDef.errors === false) { + out += ' ' + ($valid) + ' = '; + if ($asyncKeyword) { + out += '' + (it.yieldAwait); + } + out += '' + (def_callRuleValidate) + '; '; + } else { + if ($asyncKeyword) { + $ruleErrs = 'customErrors' + $lvl; + out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; + } else { + out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; + } + } + } + if ($rDef.modifying) { + out += ' ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; + } + if ($validateSchema) { + out += ' }'; + } + if ($rDef.valid) { + if ($breakOnError) { + out += ' if (true) { '; + } + } else { + out += ' if ( '; + if ($rDef.valid === undefined) { + out += ' !'; + if ($macro) { + out += '' + ($nextValid); + } else { + out += '' + ($valid); + } + } else { + out += ' ' + (!$rDef.valid) + ' '; + } + out += ') { '; + $errorKeyword = $rule.keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + var def_customError = out; + out = $$outStack.pop(); + if ($inline) { + if ($rDef.errors) { + if ($rDef.errors != 'full') { + out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' ' + ($i) + ') { '; + var $passData = $data + '[' + $i + ']'; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); + $it.dataPathArr[$dataNxt] = $i; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) { + $it.schema = $additionalItems; + $it.schemaPath = it.schemaPath + '.additionalItems'; + $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; + out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } else if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],26:[function(require,module,exports){ +'use strict'; +module.exports = function generate_multipleOf(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + out += 'var division' + ($lvl) + ';if ('; + if ($isData) { + out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; + } + out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; + if (it.opts.multipleOfPrecision) { + out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; + } else { + out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; + } + out += ' ) '; + if ($isData) { + out += ' ) '; + } + out += ' ) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be multiple of '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schema) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],27:[function(require,module,exports){ +'use strict'; +module.exports = function generate_not(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.createErrors = false; + var $allErrorsOption; + if ($it.opts.allErrors) { + $allErrorsOption = $it.opts.allErrors; + $it.opts.allErrors = false; + } + out += ' ' + (it.validate($it)) + ' '; + $it.createErrors = true; + if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' if (' + ($nextValid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be valid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + if (it.opts.allErrors) { + out += ' } '; + } + } else { + out += ' var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be valid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if ($breakOnError) { + out += ' if (false) { '; + } + } + return out; +} + +},{}],28:[function(require,module,exports){ +'use strict'; +module.exports = function generate_oneOf(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;'; + var $currentBaseId = $it.baseId; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } else { + out += ' var ' + ($nextValid) + ' = true; '; + } + if ($i) { + out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;'; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should match exactly one schema in oneOf\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; + if (it.opts.allErrors) { + out += ' } '; + } + return out; +} + +},{}],29:[function(require,module,exports){ +'use strict'; +module.exports = function generate_pattern(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; + } + out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should match pattern "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],30:[function(require,module,exports){ +'use strict'; +module.exports = function generate_patternRequired(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $key = 'key' + $lvl, + $matched = 'patternMatched' + $lvl, + $closingBraces = '', + $ownProperties = it.opts.ownProperties; + out += 'var ' + ($valid) + ' = true;'; + var arr1 = $schema; + if (arr1) { + var $pProperty, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $pProperty = arr1[i1 += 1]; + out += ' var ' + ($matched) + ' = false; for (var ' + ($key) + ' in ' + ($data) + ') { '; + if ($ownProperties) { + out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; '; + } + out += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } '; + var $missingPattern = it.util.escapeQuotes($pProperty); + out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + } + } + out += '' + ($closingBraces); + return out; +} + +},{}],31:[function(require,module,exports){ +'use strict'; +module.exports = function generate_properties(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $key = 'key' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt; + var $schemaKeys = Object.keys($schema || {}), + $pProperties = it.schema.patternProperties || {}, + $pPropertyKeys = Object.keys($pProperties), + $aProperties = it.schema.additionalProperties, + $someProperties = $schemaKeys.length || $pPropertyKeys.length, + $noAdditional = $aProperties === false, + $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, + $removeAdditional = it.opts.removeAdditional, + $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, + $ownProperties = it.opts.ownProperties, + $currentBaseId = it.baseId; + var $required = it.schema.required; + if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required); + if (it.opts.v5) { + var $pgProperties = it.schema.patternGroups || {}, + $pgPropertyKeys = Object.keys($pgProperties); + } + out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; + if ($checkAdditional) { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + if ($ownProperties) { + out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; '; + } + if ($someProperties) { + out += ' var isAdditional' + ($lvl) + ' = !(false '; + if ($schemaKeys.length) { + if ($schemaKeys.length > 5) { + out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] '; + } else { + var arr1 = $schemaKeys; + if (arr1) { + var $propertyKey, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $propertyKey = arr1[i1 += 1]; + out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; + } + } + } + } + if ($pPropertyKeys.length) { + var arr2 = $pPropertyKeys; + if (arr2) { + var $pProperty, $i = -1, + l2 = arr2.length - 1; + while ($i < l2) { + $pProperty = arr2[$i += 1]; + out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; + } + } + } + if (it.opts.v5 && $pgPropertyKeys && $pgPropertyKeys.length) { + var arr3 = $pgPropertyKeys; + if (arr3) { + var $pgProperty, $i = -1, + l3 = arr3.length - 1; + while ($i < l3) { + $pgProperty = arr3[$i += 1]; + out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') '; + } + } + } + out += ' ); if (isAdditional' + ($lvl) + ') { '; + } + if ($removeAdditional == 'all') { + out += ' delete ' + ($data) + '[' + ($key) + ']; '; + } else { + var $currentErrorPath = it.errorPath; + var $additionalProperty = '\' + ' + $key + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + } + if ($noAdditional) { + if ($removeAdditional) { + out += ' delete ' + ($data) + '[' + ($key) + ']; '; + } else { + out += ' ' + ($nextValid) + ' = false; '; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalProperties'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have additional properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += ' break; '; + } + } + } else if ($additionalIsSchema) { + if ($removeAdditional == 'failing') { + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; + it.compositeRule = $it.compositeRule = $wasComposite; + } else { + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + } + } + it.errorPath = $currentErrorPath; + } + if ($someProperties) { + out += ' } '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + var $useDefaults = it.opts.useDefaults && !it.compositeRule; + if ($schemaKeys.length) { + var arr4 = $schemaKeys; + if (arr4) { + var $propertyKey, i4 = -1, + l4 = arr4.length - 1; + while (i4 < l4) { + $propertyKey = arr4[i4 += 1]; + var $sch = $schema[$propertyKey]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + var $prop = it.util.getProperty($propertyKey), + $passData = $data + $prop, + $hasDefault = $useDefaults && $sch.default !== undefined; + $it.schema = $sch; + $it.schemaPath = $schemaPath + $prop; + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); + $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); + $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + $code = it.util.varReplace($code, $nextData, $passData); + var $useData = $passData; + } else { + var $useData = $nextData; + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; + } + if ($hasDefault) { + out += ' ' + ($code) + ' '; + } else { + if ($requiredHash && $requiredHash[$propertyKey]) { + out += ' if (' + ($useData) + ' === undefined) { ' + ($nextValid) + ' = false; '; + var $currentErrorPath = it.errorPath, + $currErrSchemaPath = $errSchemaPath, + $missingProperty = it.util.escapeQuotes($propertyKey); + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + $errSchemaPath = it.errSchemaPath + '/required'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + $errSchemaPath = $currErrSchemaPath; + it.errorPath = $currentErrorPath; + out += ' } else { '; + } else { + if ($breakOnError) { + out += ' if (' + ($useData) + ' === undefined) { ' + ($nextValid) + ' = true; } else { '; + } else { + out += ' if (' + ($useData) + ' !== undefined) { '; + } + } + out += ' ' + ($code) + ' } '; + } + } + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + var arr5 = $pPropertyKeys; + if (arr5) { + var $pProperty, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $pProperty = arr5[i5 += 1]; + var $sch = $pProperties[$pProperty]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); + $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + if ($ownProperties) { + out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; '; + } + out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else ' + ($nextValid) + ' = true; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if (it.opts.v5) { + var arr6 = $pgPropertyKeys; + if (arr6) { + var $pgProperty, i6 = -1, + l6 = arr6.length - 1; + while (i6 < l6) { + $pgProperty = arr6[i6 += 1]; + var $pgSchema = $pgProperties[$pgProperty], + $sch = $pgSchema.schema; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema'; + $it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema'; + out += ' var pgPropCount' + ($lvl) + ' = 0; for (var ' + ($key) + ' in ' + ($data) + ') { '; + if ($ownProperties) { + out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; '; + } + out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else ' + ($nextValid) + ' = true; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + var $pgMin = $pgSchema.minimum, + $pgMax = $pgSchema.maximum; + if ($pgMin !== undefined || $pgMax !== undefined) { + out += ' var ' + ($valid) + ' = true; '; + var $currErrSchemaPath = $errSchemaPath; + if ($pgMin !== undefined) { + var $limit = $pgMin, + $reason = 'minimum', + $moreOrLess = 'less'; + out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; '; + $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($pgMax !== undefined) { + out += ' else '; + } + } + if ($pgMax !== undefined) { + var $limit = $pgMax, + $reason = 'maximum', + $moreOrLess = 'more'; + out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; '; + $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += ' if (' + ($valid) + ') { '; + $closingBraces += '}'; + } + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],32:[function(require,module,exports){ +'use strict'; +module.exports = function generate_ref(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $async, $refCode; + if ($schema == '#' || $schema == '#/') { + if (it.isRoot) { + $async = it.async; + $refCode = 'validate'; + } else { + $async = it.root.schema.$async === true; + $refCode = 'root.refVal[0]'; + } + } else { + var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); + if ($refVal === undefined) { + var $message = 'can\'t resolve reference ' + $schema + ' from id ' + it.baseId; + if (it.opts.missingRefs == 'fail') { + console.log($message); + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' '; + } + if (it.opts.verbose) { + out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + if ($breakOnError) { + out += ' if (false) { '; + } + } else if (it.opts.missingRefs == 'ignore') { + console.log($message); + if ($breakOnError) { + out += ' if (true) { '; + } + } else { + var $error = new Error($message); + $error.missingRef = it.resolve.url(it.baseId, $schema); + $error.missingSchema = it.resolve.normalizeId(it.resolve.fullPath($error.missingRef)); + throw $error; + } + } else if ($refVal.inline) { + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + $it.schema = $refVal.schema; + $it.schemaPath = ''; + $it.errSchemaPath = $schema; + var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); + out += ' ' + ($code) + ' '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + } + } else { + $async = $refVal.$async === true; + $refCode = $refVal.code; + } + } + if ($refCode) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + if (it.opts.passContext) { + out += ' ' + ($refCode) + '.call(this, '; + } else { + out += ' ' + ($refCode) + '( '; + } + out += ' ' + ($data) + ', (dataPath || \'\')'; + if (it.errorPath != '""') { + out += ' + ' + (it.errorPath); + } + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) '; + var __callValidate = out; + out = $$outStack.pop(); + if ($async) { + if (!it.async) throw new Error('async schema referenced by sync schema'); + out += ' try { '; + if ($breakOnError) { + out += 'var ' + ($valid) + ' ='; + } + out += ' ' + (it.yieldAwait) + ' ' + (__callValidate) + '; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } '; + if ($breakOnError) { + out += ' if (' + ($valid) + ') { '; + } + } else { + out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } '; + if ($breakOnError) { + out += ' else { '; + } + } + } + return out; +} + +},{}],33:[function(require,module,exports){ +'use strict'; +module.exports = function generate_required(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $vSchema = 'schema' + $lvl; + if (!$isData) { + if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) { + var $required = []; + var arr1 = $schema; + if (arr1) { + var $property, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $property = arr1[i1 += 1]; + var $propertySch = it.schema.properties[$property]; + if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) { + $required[$required.length] = $property; + } + } + } + } else { + var $required = $schema; + } + } + if ($isData || $required.length) { + var $currentErrorPath = it.errorPath, + $loopRequired = $isData || $required.length >= it.opts.loopRequired; + if ($breakOnError) { + out += ' var missing' + ($lvl) + '; '; + if ($loopRequired) { + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; + } + var $i = 'i' + $lvl, + $propertyPath = 'schema' + $lvl + '[' + $i + ']', + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + out += ' var ' + ($valid) + ' = true; '; + if ($isData) { + out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; + } + out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined; if (!' + ($valid) + ') break; } '; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + } else { + out += ' if ( '; + var arr2 = $required; + if (arr2) { + var _$property, $i = -1, + l2 = arr2.length - 1; + while ($i < l2) { + _$property = arr2[$i += 1]; + if ($i) { + out += ' || '; + } + var $prop = it.util.getProperty(_$property); + out += ' ( ' + ($data) + ($prop) + ' === undefined && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? _$property : $prop)) + ') ) '; + } + } + out += ') { '; + var $propertyPath = 'missing' + $lvl, + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + } + } else { + if ($loopRequired) { + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; + } + var $i = 'i' + $lvl, + $propertyPath = 'schema' + $lvl + '[' + $i + ']', + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + if ($isData) { + out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; + } + out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined) { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; + if ($isData) { + out += ' } '; + } + } else { + var arr3 = $required; + if (arr3) { + var $reqProperty, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $reqProperty = arr3[i3 += 1]; + var $prop = it.util.getProperty($reqProperty), + $missingProperty = it.util.escapeQuotes($reqProperty); + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $reqProperty, it.opts.jsonPointers); + } + out += ' if (' + ($data) + ($prop) + ' === undefined) { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + } + } + } + } + it.errorPath = $currentErrorPath; + } else if ($breakOnError) { + out += ' if (true) {'; + } + return out; +} + +},{}],34:[function(require,module,exports){ +'use strict'; +module.exports = function generate_switch(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $ifPassed = 'ifPassed' + it.level, + $currentBaseId = $it.baseId, + $shouldContinue; + out += 'var ' + ($ifPassed) + ';'; + var arr1 = $schema; + if (arr1) { + var $sch, $caseIndex = -1, + l1 = arr1.length - 1; + while ($caseIndex < l1) { + $sch = arr1[$caseIndex += 1]; + if ($caseIndex && !$shouldContinue) { + out += ' if (!' + ($ifPassed) + ') { '; + $closingBraces += '}'; + } + if ($sch.if && it.util.schemaHasRules($sch.if, it.RULES.all)) { + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.createErrors = false; + $it.schema = $sch.if; + $it.schemaPath = $schemaPath + '[' + $caseIndex + '].if'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/if'; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + $it.createErrors = true; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($ifPassed) + ' = ' + ($nextValid) + '; if (' + ($ifPassed) + ') { '; + if (typeof $sch.then == 'boolean') { + if ($sch.then === false) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "switch" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; '; + } else { + $it.schema = $sch.then; + $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then'; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } } '; + } else { + out += ' ' + ($ifPassed) + ' = true; '; + if (typeof $sch.then == 'boolean') { + if ($sch.then === false) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "switch" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; '; + } else { + $it.schema = $sch.then; + $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then'; + $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then'; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } + } + $shouldContinue = $sch.continue + } + } + out += '' + ($closingBraces) + 'var ' + ($valid) + ' = ' + ($nextValid) + '; '; + out = it.util.cleanUpCode(out); + return out; +} + +},{}],35:[function(require,module,exports){ +'use strict'; +module.exports = function generate_uniqueItems(it, $keyword) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.v5 && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if (($schema || $isData) && it.opts.uniqueItems !== false) { + if ($isData) { + out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; + } + out += ' var ' + ($valid) + ' = true; if (' + ($data) + '.length > 1) { var i = ' + ($data) + '.length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } } '; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + } else { + if ($breakOnError) { + out += ' if (true) { '; + } + } + return out; +} + +},{}],36:[function(require,module,exports){ +'use strict'; +module.exports = function generate_validate(it, $keyword) { + var out = ''; + var $async = it.schema.$async === true; + if (it.isTop) { + var $top = it.isTop, + $lvl = it.level = 0, + $dataLvl = it.dataLevel = 0, + $data = 'data'; + it.rootId = it.resolve.fullPath(it.root.schema.id); + it.baseId = it.baseId || it.rootId; + if ($async) { + it.async = true; + var $es7 = it.opts.async == 'es7'; + it.yieldAwait = $es7 ? 'await' : 'yield'; + } + delete it.isTop; + it.dataPathArr = [undefined]; + out += ' var validate = '; + if ($async) { + if ($es7) { + out += ' (async function '; + } else { + if (it.opts.async == 'co*') { + out += 'co.wrap'; + } + out += '(function* '; + } + } else { + out += ' (function '; + } + out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; var vErrors = null; '; + out += ' var errors = 0; '; + out += ' if (rootData === undefined) rootData = data;'; + } else { + var $lvl = it.level, + $dataLvl = it.dataLevel, + $data = 'data' + ($dataLvl || ''); + if (it.schema.id) it.baseId = it.resolve.url(it.baseId, it.schema.id); + if ($async && !it.async) throw new Error('async schema in sync schema'); + out += ' var errs_' + ($lvl) + ' = errors;'; + } + var $valid = 'valid' + $lvl, + $breakOnError = !it.opts.allErrors, + $closingBraces1 = '', + $closingBraces2 = ''; + var $typeSchema = it.schema.type, + $typeIsArray = Array.isArray($typeSchema); + if ($typeSchema && it.opts.coerceTypes) { + var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); + if ($coerceToTypes) { + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type', + $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; + out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { '; + var $dataType = 'dataType' + $lvl, + $coerced = 'coerced' + $lvl; + out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; '; + if (it.opts.coerceTypes == 'array') { + out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; '; + } + out += ' var ' + ($coerced) + ' = undefined; '; + var $bracesCoercion = ''; + var arr1 = $coerceToTypes; + if (arr1) { + var $type, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $type = arr1[$i += 1]; + if ($i) { + out += ' if (' + ($coerced) + ' === undefined) { '; + $bracesCoercion += '}'; + } + if (it.opts.coerceTypes == 'array' && $type != 'array') { + out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } '; + } + if ($type == 'string') { + out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; + } else if ($type == 'number' || $type == 'integer') { + out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; + if ($type == 'integer') { + out += ' && !(' + ($data) + ' % 1)'; + } + out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; + } else if ($type == 'boolean') { + out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; + } else if ($type == 'null') { + out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; + } else if (it.opts.coerceTypes == 'array' && $type == 'array') { + out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; + } + } + } + out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' ' + ($data) + ' = ' + ($coerced) + '; '; + if (!$dataLvl) { + out += 'if (' + ($parentData) + ' !== undefined)'; + } + out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } } '; + } + } + var $refKeywords; + if (it.schema.$ref && ($refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'))) { + if (it.opts.extendRefs == 'fail') { + throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '"'); + } else if (it.opts.extendRefs == 'ignore') { + $refKeywords = false; + console.log('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + } else if (it.opts.extendRefs !== true) { + console.log('$ref: all keywords used in schema at path "' + it.errSchemaPath + '". It will change in the next major version, see issue #260. Use option { extendRefs: true } to keep current behaviour'); + } + } + if (it.schema.$ref && !$refKeywords) { + out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; + if ($breakOnError) { + out += ' } if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } else { + var arr2 = it.RULES; + if (arr2) { + var $rulesGroup, i2 = -1, + l2 = arr2.length - 1; + while (i2 < l2) { + $rulesGroup = arr2[i2 += 1]; + if ($shouldUseGroup($rulesGroup)) { + if ($rulesGroup.type) { + out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { '; + } + if (it.opts.useDefaults && !it.compositeRule) { + if ($rulesGroup.type == 'object' && it.schema.properties) { + var $schema = it.schema.properties, + $schemaKeys = Object.keys($schema); + var arr3 = $schemaKeys; + if (arr3) { + var $propertyKey, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $sch = $schema[$propertyKey]; + if ($sch.default !== undefined) { + var $passData = $data + it.util.getProperty($propertyKey); + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { + var arr4 = it.schema.items; + if (arr4) { + var $sch, $i = -1, + l4 = arr4.length - 1; + while ($i < l4) { + $sch = arr4[$i += 1]; + if ($sch.default !== undefined) { + var $passData = $data + '[' + $i + ']'; + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } + } + var arr5 = $rulesGroup.rules; + if (arr5) { + var $rule, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $rule = arr5[i5 += 1]; + if ($shouldUseRule($rule)) { + out += ' ' + ($rule.code(it, $rule.keyword)) + ' '; + if ($breakOnError) { + $closingBraces1 += '}'; + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces1) + ' '; + $closingBraces1 = ''; + } + if ($rulesGroup.type) { + out += ' } '; + if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { + var $typeChecked = true; + out += ' else { '; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + } + if ($breakOnError) { + out += ' if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } + } + } + } + if ($typeSchema && !$typeChecked && !$coerceToTypes) { + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type', + $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; + out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' }'; + } + if ($breakOnError) { + out += ' ' + ($closingBraces2) + ' '; + } + if ($top) { + if ($async) { + out += ' if (errors === 0) return true; '; + out += ' else throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; '; + out += ' return errors === 0; '; + } + out += ' }); return validate;'; + } else { + out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; + } + out = it.util.cleanUpCode(out); + if ($top && $breakOnError) { + out = it.util.cleanUpVarErrors(out, $async); + } + + function $shouldUseGroup($rulesGroup) { + for (var i = 0; i < $rulesGroup.rules.length; i++) + if ($shouldUseRule($rulesGroup.rules[i])) return true; + } + + function $shouldUseRule($rule) { + return it.schema[$rule.keyword] !== undefined || ($rule.keyword == 'properties' && (it.schema.additionalProperties === false || typeof it.schema.additionalProperties == 'object' || (it.schema.patternProperties && Object.keys(it.schema.patternProperties).length) || (it.opts.v5 && it.schema.patternGroups && Object.keys(it.schema.patternGroups).length))); + } + return out; +} + +},{}],37:[function(require,module,exports){ +'use strict'; + +var IDENTIFIER = /^[a-z_$][a-z0-9_$\-]*$/i; +var customRuleCode = require('./dotjs/custom'); + +module.exports = { + add: addKeyword, + get: getKeyword, + remove: removeKeyword +}; + +/** + * Define custom keyword + * @this Ajv + * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). + * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. + */ +function addKeyword(keyword, definition) { + /* jshint validthis: true */ + /* eslint no-shadow: 0 */ + var RULES = this.RULES; + + if (RULES.keywords[keyword]) + throw new Error('Keyword ' + keyword + ' is already defined'); + + if (!IDENTIFIER.test(keyword)) + throw new Error('Keyword ' + keyword + ' is not a valid identifier'); + + if (definition) { + if (definition.macro && definition.valid !== undefined) + throw new Error('"valid" option cannot be used with macro keywords'); + + var dataType = definition.type; + if (Array.isArray(dataType)) { + var i, len = dataType.length; + for (i=0; i 2) res = slice.call(arguments, 1); + resolve(res); + }); + }); +} + +/** + * Convert an array of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Array} obj + * @return {Promise} + * @api private + */ + +function arrayToPromise(obj) { + return Promise.all(obj.map(toPromise, this)); +} + +/** + * Convert an object of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Object} obj + * @return {Promise} + * @api private + */ + +function objectToPromise(obj){ + var results = new obj.constructor(); + var keys = Object.keys(obj); + var promises = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var promise = toPromise.call(this, obj[key]); + if (promise && isPromise(promise)) defer(promise, key); + else results[key] = obj[key]; + } + return Promise.all(promises).then(function () { + return results; + }); + + function defer(promise, key) { + // predefine the key in the result + results[key] = undefined; + promises.push(promise.then(function (res) { + results[key] = res; + })); + } +} + +/** + * Check if `obj` is a promise. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + +function isPromise(obj) { + return 'function' == typeof obj.then; +} + +/** + * Check if `obj` is a generator. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + +function isGenerator(obj) { + return 'function' == typeof obj.next && 'function' == typeof obj.throw; +} + +/** + * Check if `obj` is a generator function. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ +function isGeneratorFunction(obj) { + var constructor = obj.constructor; + if (!constructor) return false; + if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; + return isGenerator(constructor.prototype); +} + +/** + * Check for plain object. + * + * @param {Mixed} val + * @return {Boolean} + * @api private + */ + +function isObject(val) { + return Object == val.constructor; +} + +},{}],42:[function(require,module,exports){ +var json = typeof JSON !== 'undefined' ? JSON : require('jsonify'); + +module.exports = function (obj, opts) { + if (!opts) opts = {}; + if (typeof opts === 'function') opts = { cmp: opts }; + var space = opts.space || ''; + if (typeof space === 'number') space = Array(space+1).join(' '); + var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; + var replacer = opts.replacer || function(key, value) { return value; }; + + var cmp = opts.cmp && (function (f) { + return function (node) { + return function (a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + })(opts.cmp); + + var seen = []; + return (function stringify (parent, key, node, level) { + var indent = space ? ('\n' + new Array(level + 1).join(space)) : ''; + var colonSeparator = space ? ': ' : ':'; + + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } + + node = replacer.call(parent, key, node); + + if (node === undefined) { + return; + } + if (typeof node !== 'object' || node === null) { + return json.stringify(node); + } + if (isArray(node)) { + var out = []; + for (var i = 0; i < node.length; i++) { + var item = stringify(node, i, node[i], level+1) || json.stringify(null); + out.push(indent + space + item); + } + return '[' + out.join(',') + indent + ']'; + } + else { + if (seen.indexOf(node) !== -1) { + if (cycles) return json.stringify('__cycle__'); + throw new TypeError('Converting circular structure to JSON'); + } + else seen.push(node); + + var keys = objectKeys(node).sort(cmp && cmp(node)); + var out = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node, key, node[key], level+1); + + if(!value) continue; + + var keyValue = json.stringify(key) + + colonSeparator + + value; + ; + out.push(indent + space + keyValue); + } + seen.splice(seen.indexOf(node), 1); + return '{' + out.join(',') + indent + '}'; + } + })({ '': obj }, '', obj, 0); +}; + +var isArray = Array.isArray || function (x) { + return {}.toString.call(x) === '[object Array]'; +}; + +var objectKeys = Object.keys || function (obj) { + var has = Object.prototype.hasOwnProperty || function () { return true }; + var keys = []; + for (var key in obj) { + if (has.call(obj, key)) keys.push(key); + } + return keys; +}; + +},{"jsonify":43}],43:[function(require,module,exports){ +exports.parse = require('./lib/parse'); +exports.stringify = require('./lib/stringify'); + +},{"./lib/parse":44,"./lib/stringify":45}],44:[function(require,module,exports){ +var at, // The index of the current character + ch, // The current character + escapee = { + '"': '"', + '\\': '\\', + '/': '/', + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t' + }, + text, + + error = function (m) { + // Call error when something is wrong. + throw { + name: 'SyntaxError', + message: m, + at: at, + text: text + }; + }, + + next = function (c) { + // If a c parameter is provided, verify that it matches the current character. + if (c && c !== ch) { + error("Expected '" + c + "' instead of '" + ch + "'"); + } + + // Get the next character. When there are no more characters, + // return the empty string. + + ch = text.charAt(at); + at += 1; + return ch; + }, + + number = function () { + // Parse a number value. + var number, + string = ''; + + if (ch === '-') { + string = '-'; + next('-'); + } + 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(); + } + } + number = +string; + if (!isFinite(number)) { + error("Bad number"); + } else { + return number; + } + }, + + string = function () { + // Parse a string value. + var hex, + i, + string = '', + uffff; + + // When parsing for string values, we must look for " and \ characters. + if (ch === '"') { + while (next()) { + if (ch === '"') { + 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 (typeof escapee[ch] === 'string') { + string += escapee[ch]; + } else { + break; + } + } else { + string += ch; + } + } + } + error("Bad string"); + }, + + white = function () { + +// Skip whitespace. + + while (ch && ch <= ' ') { + next(); + } + }, + + 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; + } + error("Unexpected '" + ch + "'"); + }, + + value, // Place holder for the value function. + + array = function () { + +// Parse an array value. + + var array = []; + + if (ch === '[') { + next('['); + white(); + if (ch === ']') { + next(']'); + return array; // empty array + } + while (ch) { + array.push(value()); + white(); + if (ch === ']') { + next(']'); + return array; + } + next(','); + white(); + } + } + error("Bad array"); + }, + + object = function () { + +// Parse an object value. + + var key, + object = {}; + + if (ch === '{') { + next('{'); + white(); + if (ch === '}') { + next('}'); + return object; // empty object + } + while (ch) { + key = string(); + white(); + next(':'); + if (Object.hasOwnProperty.call(object, key)) { + error('Duplicate key "' + key + '"'); + } + object[key] = value(); + white(); + 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 '"': + return string(); + 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. + +module.exports = function (source, reviver) { + var result; + + text = source; + at = 0; + 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; +}; + +},{}],45:[function(require,module,exports){ +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, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + +function quote(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 + '"'; +} + +function str(key, holder) { + // Produce a string from holder[key]. + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + // JSON numbers must be finite. Encode non-finite numbers as null. + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + return String(value); + + case 'object': + if (!value) return 'null'; + gap += indent; + partial = []; + + // Array.isArray + if (Object.prototype.toString.apply(value) === '[object Array]') { + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and + // wrap them in brackets. + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be + // stringified. + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + else { + // Otherwise, iterate through all of the keys in the object. + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } +} + +module.exports = function (value, replacer, space) { + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + } + // If the space parameter is a string, it will be used as the indent string. + else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + rep = replacer; + if (replacer && typeof replacer !== 'function' + && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + return str('', {'': value}); +}; + +},{}],46:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],47:[function(require,module,exports){ +// 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'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],48:[function(require,module,exports){ +// 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 stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],49:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":47,"./encode":48}],50:[function(require,module,exports){ +// 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 punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":51,"punycode":46,"querystring":49}],51:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],"ajv":[function(require,module,exports){ +'use strict'; + +var compileSchema = require('./compile') + , resolve = require('./compile/resolve') + , Cache = require('./cache') + , SchemaObject = require('./compile/schema_obj') + , stableStringify = require('json-stable-stringify') + , formats = require('./compile/formats') + , rules = require('./compile/rules') + , v5 = require('./v5') + , util = require('./compile/util') + , async = require('./async') + , co = require('co'); + +module.exports = Ajv; + +Ajv.prototype.compileAsync = async.compile; + +var customKeyword = require('./keyword'); +Ajv.prototype.addKeyword = customKeyword.add; +Ajv.prototype.getKeyword = customKeyword.get; +Ajv.prototype.removeKeyword = customKeyword.remove; +Ajv.ValidationError = require('./compile/validation_error'); + +var META_SCHEMA_ID = 'http://json-schema.org/draft-04/schema'; +var SCHEMA_URI_FORMAT = /^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i; +function SCHEMA_URI_FORMAT_FUNC(str) { + return SCHEMA_URI_FORMAT.test(str); +} + +var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes' ]; + +/** + * Creates validator instance. + * Usage: `Ajv(opts)` + * @param {Object} opts optional options + * @return {Object} ajv instance + */ +function Ajv(opts) { + if (!(this instanceof Ajv)) return new Ajv(opts); + var self = this; + + opts = this._opts = util.copy(opts) || {}; + this._schemas = {}; + this._refs = {}; + this._fragments = {}; + this._formats = formats(opts.format); + this._cache = opts.cache || new Cache; + this._loadingSchemas = {}; + this._compilations = []; + this.RULES = rules(); + + // this is done on purpose, so that methods are bound to the instance + // (without using bind) so that they can be used without the instance + this.validate = validate; + this.compile = compile; + this.addSchema = addSchema; + this.addMetaSchema = addMetaSchema; + this.validateSchema = validateSchema; + this.getSchema = getSchema; + this.removeSchema = removeSchema; + this.addFormat = addFormat; + this.errorsText = errorsText; + + this._addSchema = _addSchema; + this._compile = _compile; + + opts.loopRequired = opts.loopRequired || Infinity; + if (opts.async || opts.transpile) async.setup(opts); + if (opts.beautify === true) opts.beautify = { indent_size: 2 }; + if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; + this._metaOpts = getMetaSchemaOptions(); + + if (opts.formats) addInitialFormats(); + addDraft4MetaSchema(); + if (opts.v5) v5.enable(this); + if (typeof opts.meta == 'object') addMetaSchema(opts.meta); + addInitialSchemas(); + + + /** + * Validate data using schema + * Schema will be compiled and cached (using serialized JSON as key. [json-stable-stringify](https://github.com/substack/json-stable-stringify) is used to serialize. + * @param {String|Object} schemaKeyRef key, ref or schema object + * @param {Any} data to be validated + * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). + */ + function validate(schemaKeyRef, data) { + var v; + if (typeof schemaKeyRef == 'string') { + v = getSchema(schemaKeyRef); + if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); + } else { + var schemaObj = _addSchema(schemaKeyRef); + v = schemaObj.validate || _compile(schemaObj); + } + + var valid = v(data); + if (v.$async === true) + return self._opts.async == '*' ? co(valid) : valid; + self.errors = v.errors; + return valid; + } + + + /** + * Create validating function for passed schema. + * @param {Object} schema schema object + * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. + * @return {Function} validating function + */ + function compile(schema, _meta) { + var schemaObj = _addSchema(schema, undefined, _meta); + return schemaObj.validate || _compile(schemaObj); + } + + + /** + * Adds schema to the instance. + * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. + * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. + * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + */ + function addSchema(schema, key, _skipValidation, _meta) { + if (Array.isArray(schema)){ + for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used. + * @param {Object} options optional options with properties `separator` and `dataVar`. + * @return {String} human readable string with all errors descriptions + */ + function errorsText(errors, options) { + errors = errors || self.errors; + if (!errors) return 'No errors'; + options = options || {}; + var separator = options.separator === undefined ? ', ' : options.separator; + var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; + + var text = ''; + for (var i=0; i=1&&t<=12&&a>=1&&a<=m[t]}function o(e,r){var t=e.match(v);if(!t)return!1;var a=t[1],s=t[2],o=t[3],i=t[5];return a<=23&&s<=59&&o<=59&&(!r||i)}function i(e){var r=e.split(b);return 2==r.length&&s(r[0])&&o(r[1],!0)}function n(e){return e.length<=255&&y.test(e)}function l(e){return w.test(e)&&g.test(e)}function c(e){try{return new RegExp(e),!0}catch(e){return!1}}function h(e,r){if(e&&r)return e>r?1:er?1:e=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:r,baseId:t},{index:a,compiling:!1})}function i(e,r,t){var a=n.call(this,e,r,t);a>=0&&this._compilations.splice(a,1)}function n(e,r,t){for(var a=0;a=55296&&r<=56319&&s=r)throw new Error("Cannot access property/index "+a+" levels up, current level is "+r);return t[r-a]}if(a>r)throw new Error("Cannot access data "+a+" levels up, current level is "+r);if(o="data"+(r-a||""),!s)return o}for(var n=o,c=s.split("/"),h=0;h",S="result"+s,$=e.opts.v5&&i&&i.$data;if($?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+s):g=i,w){var x=e.util.getData(b.$data,o,e.dataPathArr),_="exclusive"+s,O="op"+s,R="' + "+O+" + '";a+=" var schemaExcl"+s+" = "+x+"; ",x="schemaExcl"+s,a+=" if (typeof "+x+" != 'boolean' && "+x+" !== undefined) { "+u+" = false; ";var t=E,I=I||[];I.push(a),a="",!1!==e.createErrors?(a+=" { keyword: '"+(t||"_formatExclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var A=a;a=I.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(p+="}",a+=" else { "),$&&(a+=" if ("+g+" === undefined) "+u+" = true; else if (typeof "+g+" != 'string') "+u+" = false; else { ",p+="}"),d&&(a+=" if (!"+y+") "+u+" = true; else { ",p+="}"),a+=" var "+S+" = "+y+"("+h+", ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" ); if ("+S+" === undefined) "+u+" = false; var "+_+" = "+x+" === true; if ("+u+" === undefined) { "+u+" = "+_+" ? "+S+" "+j+" 0 : "+S+" "+j+"= 0; } if (!"+u+") var op"+s+" = "+_+" ? '"+j+"' : '"+j+"=';"}else{var _=!0===b,R=j;_||(R+="=");var O="'"+R+"'";$&&(a+=" if ("+g+" === undefined) "+u+" = true; else if (typeof "+g+" != 'string') "+u+" = false; else { ",p+="}"),d&&(a+=" if (!"+y+") "+u+" = true; else { ",p+="}"),a+=" var "+S+" = "+y+"("+h+", ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" ); if ("+S+" === undefined) "+u+" = false; if ("+u+" === undefined) "+u+" = "+S+" "+j,_||(a+="="),a+=" 0;"}a+=p+"if (!"+u+") { ";var t=r,I=I||[];I.push(a),a="",!1!==e.createErrors?(a+=" { keyword: '"+(t||"_formatLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+O+", limit: ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" , exclusive: "+_+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be "+R+' "',a+=$?"' + "+g+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=$?"validate.schema"+n:""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var A=a;return a=I.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="}"}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maximum"==r,p=d?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[p],v=e.opts.v5&&m&&m.$data,y=d?"<":">",g=d?">":"<";if(v){var P=e.util.getData(m.$data,i,e.dataPathArr),E="exclusive"+o,b="op"+o,w="' + "+b+" + '";s+=" var schemaExcl"+o+" = "+P+"; ",P="schemaExcl"+o,s+=" var exclusive"+o+"; if (typeof "+P+" != 'boolean' && typeof "+P+" != 'undefined') { ";var t=p,j=j||[];j.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var S=s;s=j.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ((exclusive"+o+" = "+P+" === true) ? "+u+" "+g+"= "+a+" : "+u+" "+g+" "+a+") || "+u+" !== "+u+") { var op"+o+" = exclusive"+o+" ? '"+y+"' : '"+y+"=';"}else{var E=!0===m,w=y;E||(w+="=");var b="'"+w+"'";s+=" if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+" "+g,E&&(s+="="),s+=" "+a+" || "+u+" !== "+u+") {"}var t=r,j=j||[];j.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+b+", limit: "+a+", exclusive: "+E+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+w+" ",s+=f?"' + "+a:n+"'"),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var S=s;return s=j.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",h&&(s+=" else { "),s}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxItems"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+".length "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==r?"more":"less",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxLength"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=!1===e.opts.unicode?" "+u+".length ":" ucs2length("+u+") ",s+=" "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==r?"longer":"shorter",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n, +s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxProperties"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+u+").length "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==r?"more":"less",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],18:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,h=n.baseId,u=!0,f=a;if(f)for(var d,p=-1,m=f.length-1;p "+$+") { ";var _=c+"["+$+"]";f.schema=S,f.schemaPath=i+"["+$+"]",f.errSchemaPath=n+"/"+$,f.errorPath=e.util.getPathExpr(e.errorPath,$,e.opts.jsonPointers,!0),f.dataPathArr[v]=$;var O=e.validate(f);f.baseId=g,e.util.varOccurences(O,y)<2?t+=" "+e.util.varReplace(O,y,_)+" ":t+=" var "+y+" = "+_+"; "+O+" ",t+=" } ",l&&(t+=" if ("+p+") { ",d+="}")}if("object"==typeof P&&e.util.schemaHasRules(P,e.RULES.all)){f.schema=P,f.schemaPath=e.schemaPath+".additionalItems",f.errSchemaPath=e.errSchemaPath+"/additionalItems",t+=" "+p+" = true; if ("+c+".length > "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);var _=c+"["+m+"]";f.dataPathArr[v]=m;var O=e.validate(f);f.baseId=g,e.util.varOccurences(O,y)<2?t+=" "+e.util.varReplace(O,y,_)+" ":t+=" var "+y+" = "+_+"; "+O+" ",l&&(t+=" if (!"+p+") break; "),t+=" } } ",l&&(t+=" if ("+p+") { ",d+="}")}}else if(e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=i,f.errSchemaPath=n,t+=" for (var "+m+" = 0; "+m+" < "+c+".length; "+m+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);var _=c+"["+m+"]";f.dataPathArr[v]=m;var O=e.validate(f);f.baseId=g,e.util.varOccurences(O,y)<2?t+=" "+e.util.varReplace(O,y,_)+" ":t+=" var "+y+" = "+_+"; "+O+" ",l&&(t+=" if (!"+p+") break; "),t+=" } ",l&&(t+=" if ("+p+") { ",d+="}")}return l&&(t+=" "+d+" if ("+u+" == errors) {"),t=e.util.cleanUpCode(t)}},{}],26:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(o||""),u=e.opts.v5&&i&&i.$data;u?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",t="schema"+s):t=i,a+="var division"+s+";if (",u&&(a+=" "+t+" !== undefined && ( typeof "+t+" != 'number' || "),a+=" (division"+s+" = "+h+" / "+t+", ",a+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",u&&(a+=" ) "),a+=" ) { ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be multiple of ",a+=u?"' + "+t:i+"'"),e.opts.verbose&&(a+=" , schema: ",a+=u?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var d=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+d+"]); ":" validate.errors = ["+d+"]; return false; ":" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],27:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),h="errs__"+a,u=e.util.copy(e);u.level++;var f="valid"+u.level;if(e.util.schemaHasRules(o,e.RULES.all)){u.schema=o,u.schemaPath=i,u.errSchemaPath=n,t+=" var "+h+" = errors; ";var d=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1;var p;u.opts.allErrors&&(p=u.opts.allErrors,u.opts.allErrors=!1),t+=" "+e.validate(u)+" ",u.createErrors=!0,p&&(u.opts.allErrors=p),e.compositeRule=u.compositeRule=d,t+=" if ("+f+") { ";var m=m||[];m.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: {} ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var v=t;t=m.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else t+=" var err = ",!1!==e.createErrors?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: {} ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l&&(t+=" if (false) { ");return t}},{}],28:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),h="valid"+a,u="errs__"+a,f=e.util.copy(e),d="";f.level++;var p="valid"+f.level;t+="var "+u+" = errors;var prevValid"+a+" = false;var "+h+" = false;";var m=f.baseId,v=e.compositeRule;e.compositeRule=f.compositeRule=!0;var y=o;if(y)for(var g,P=-1,E=y.length-1;P5)t+=" || validate.schema"+i+"["+m+"] ";else{var q=g;if(q)for(var D,L=-1,Q=q.length-1;L= "+pe+"; ",n=e.errSchemaPath+"/patternGroups/minimum",t+=" if (!"+h+") { ";var G=G||[];G.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { reason: '"+ye+"', limit: "+ve+", pattern: '"+e.util.escapeQuotes(M)+"' } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have "+ge+" than "+ve+' properties matching pattern "'+e.util.escapeQuotes(M)+"\"' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var K=t;t=G.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+K+"]); ":" validate.errors = ["+K+"]; return false; ":" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",void 0!==me&&(t+=" else ")}if(void 0!==me){var ve=me,ye="maximum",ge="more";t+=" "+h+" = pgPropCount"+a+" <= "+me+"; ",n=e.errSchemaPath+"/patternGroups/maximum",t+=" if (!"+h+") { ";var G=G||[];G.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { reason: '"+ye+"', limit: "+ve+", pattern: '"+e.util.escapeQuotes(M)+"' } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have "+ge+" than "+ve+' properties matching pattern "'+e.util.escapeQuotes(M)+"\"' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var K=t;t=G.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+K+"]); ":" validate.errors = ["+K+"]; return false; ":" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } "}n=J,l&&(t+=" if ("+h+") { ",d+="}")}}}}return l&&(t+=" "+d+" if ("+u+" == errors) {"),t=e.util.cleanUpCode(t)}},{}],32:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(i||""),u="valid"+o;if("#"==n||"#/"==n)e.isRoot?(t=e.async,a="validate"):(t=!0===e.root.schema.$async,a="root.refVal[0]");else{var f=e.resolveRef(e.baseId,n,e.isRoot);if(void 0===f){var d="can't resolve reference "+n+" from id "+e.baseId;if("fail"==e.opts.missingRefs){console.log(d);var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(n)+"' } ",!1!==e.opts.messages&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(n)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(n)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),s+=" } "):s+=" {} ";var m=s;s=p.pop(),s+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(s+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs){var v=new Error(d);throw v.missingRef=e.resolve.url(e.baseId,n),v.missingSchema=e.resolve.normalizeId(e.resolve.fullPath(v.missingRef)),v}console.log(d),c&&(s+=" if (true) { ")}}else if(f.inline){var y=e.util.copy(e);y.level++;var g="valid"+y.level;y.schema=f.schema,y.schemaPath="",y.errSchemaPath=n;var P=e.validate(y).replace(/validate\.schema/g,f.code);s+=" "+P+" ",c&&(s+=" if ("+g+") { ")}else t=!0===f.$async,a=f.code}if(a){var p=p||[];p.push(s),s="",s+=e.opts.passContext?" "+a+".call(this, ":" "+a+"( ",s+=" "+h+", (dataPath || '')",'""'!=e.errorPath&&(s+=" + "+e.errorPath);s+=" , "+(i?"data"+(i-1||""):"parentData")+" , "+(i?e.dataPathArr[i]:"parentDataProperty")+", rootData) ";var E=s;if(s=p.pop(),t){if(!e.async)throw new Error("async schema referenced by sync schema");s+=" try { ",c&&(s+="var "+u+" ="),s+=" "+e.yieldAwait+" "+E+"; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ",c&&(s+=" if ("+u+") { ")}else s+=" if (!"+E+") { if (vErrors === null) vErrors = "+a+".errors; else vErrors = vErrors.concat("+a+".errors); errors = vErrors.length; } ",c&&(s+=" else { ")}return s}},{}],33:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),h="valid"+a,u=e.opts.v5&&o&&o.$data;u&&(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ");var f="schema"+a;if(!u)if(o.length=e.opts.loopRequired;if(l)if(t+=" var missing"+a+"; ",E){u||(t+=" var "+f+" = validate.schema"+i+"; ");var b="i"+a,w="schema"+a+"["+b+"]",j="' + "+w+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,w,e.opts.jsonPointers)),t+=" var "+h+" = true; ",u&&(t+=" if (schema"+a+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+a+")) "+h+" = false; else {"),t+=" for (var "+b+" = 0; "+b+" < "+f+".length; "+b+"++) { "+h+" = "+c+"["+f+"["+b+"]] !== undefined; if (!"+h+") break; } ",u&&(t+=" } "),t+=" if (!"+h+") { ";var S=S||[];S.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { missingProperty: '"+j+"' } ",!1!==e.opts.messages&&(t+=" , message: '",t+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+j+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var $=t;t=S.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+$+"]); ":" validate.errors = ["+$+"]; return false; ":" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else{t+=" if ( ";var x=d;if(x)for(var _,b=-1,O=x.length-1;b 1) { var i = "+h+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+u+" = false; break outer; } } } } ",f&&(a+=" } "),a+=" if (!"+u+") { ";var d=d||[];d.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",a+=f?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var p=a;a=d.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a}},{}],36:[function(e,r,t){"use strict";r.exports=function(e,r){function t(r){return void 0!==e.schema[r.keyword]||"properties"==r.keyword&&(!1===e.schema.additionalProperties||"object"==typeof e.schema.additionalProperties||e.schema.patternProperties&&Object.keys(e.schema.patternProperties).length||e.opts.v5&&e.schema.patternGroups&&Object.keys(e.schema.patternGroups).length)}var a="",s=!0===e.schema.$async;if(e.isTop){var o=e.isTop,i=e.level=0,n=e.dataLevel=0,l="data";if(e.rootId=e.resolve.fullPath(e.root.schema.id),e.baseId=e.baseId||e.rootId,s){e.async=!0;var c="es7"==e.opts.async;e.yieldAwait=c?"await":"yield"}delete e.isTop,e.dataPathArr=[void 0],a+=" var validate = ",s?c?a+=" (async function ":("co*"==e.opts.async&&(a+="co.wrap"),a+="(function* "):a+=" (function ",a+=" (data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data;"}else{var i=e.level,n=e.dataLevel,l="data"+(n||"");if(e.schema.id&&(e.baseId=e.resolve.url(e.baseId,e.schema.id)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+i+" = errors;"}var h="valid"+i,u=!e.opts.allErrors,f="",d="",p=e.schema.type,m=Array.isArray(p);if(p&&e.opts.coerceTypes){var v=e.util.coerceToTypes(e.opts.coerceTypes,p);if(v){var y=e.schemaPath+".type",g=e.errSchemaPath+"/type",P=m?"checkDataTypes":"checkDataType";a+=" if ("+e.util[P](p,l,!0)+") { ";var E="dataType"+i,b="coerced"+i;a+=" var "+E+" = typeof "+l+"; ","array"==e.opts.coerceTypes&&(a+=" if ("+E+" == 'object' && Array.isArray("+l+")) "+E+" = 'array'; "),a+=" var "+b+" = undefined; ";var w="",j=v;if(j)for(var S,$=-1,x=j.length-1;$2&&(r=f.call(arguments,1)),t(r)})})}function i(e){return Promise.all(e.map(s,this))}function n(e){for(var r=new e.constructor,t=Object.keys(e),a=[],o=0;o="0"&&s<="9";)r+=s,c();if("."===s)for(r+=".";c()&&s>="0"&&s<="9";)r+=s;if("e"===s||"E"===s)for(r+=s,c(),"-"!==s&&"+"!==s||(r+=s,c());s>="0"&&s<="9";)r+=s,c();if(e=+r,isFinite(e))return e;l("Bad number")},u=function(){var e,r,t,a="";if('"'===s)for(;c();){if('"'===s)return c(),a;if("\\"===s)if(c(),"u"===s){for(t=0,r=0;r<4&&(e=parseInt(c(),16),isFinite(e));r+=1)t=16*t+e;a+=String.fromCharCode(t)}else{if("string"!=typeof n[s])break;a+=n[s]}else a+=s}l("Bad string")},f=function(){for(;s&&s<=" ";)c()},d=function(){switch(s){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}l("Unexpected '"+s+"'")},p=function(){var e=[];if("["===s){if(c("["),f(),"]"===s)return c("]"),e;for(;s;){if(e.push(i()),f(),"]"===s)return c("]"),e;c(","),f()}}l("Bad array")},m=function(){var e,r={};if("{"===s){if(c("{"),f(),"}"===s)return c("}"),r;for(;s;){if(e=u(),f(),c(":"),Object.hasOwnProperty.call(r,e)&&l('Duplicate key "'+e+'"'),r[e]=i(),f(),"}"===s)return c("}"),r;c(","),f()}}l("Bad object")};i=function(){switch(f(),s){case"{":return m();case"[":return p();case'"':return u();case"-":return h();default:return s>="0"&&s<="9"?h():d()}},r.exports=function(e,r){var t;return o=e,a=0,s=" ",t=i(),f(),s&&l("Syntax error"),"function"==typeof r?function e(t,a){var s,o,i=t[a];if(i&&"object"==typeof i)for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(o=e(i,s),void 0!==o?i[s]=o:delete i[s]);return r.call(t,a,i)}({"":t},""):t}},{}],45:[function(e,r,t){function a(e){return l.lastIndex=0,l.test(e)?'"'+e.replace(l,function(e){var r=c[e];return"string"==typeof r?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function s(e,r){var t,l,c,h,u,f=o,d=r[e];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(e)),"function"==typeof n&&(d=n.call(r,e,d)),typeof d){case"string":return a(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(o+=i,u=[],"[object Array]"===Object.prototype.toString.apply(d)){for(h=d.length,t=0;t1&&(a=t[0]+"@",e=t[1]),e=e.replace(q,"."),a+i(e.split("."),r).join(".")}function l(e){for(var r,t,a=[],s=0,o=e.length;s=55296&&r<=56319&&s65535&&(e-=65536,r+=C(e>>>10&1023|55296),e=56320|1023&e),r+=C(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:j}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function f(e,r,t){var a=0;for(e=t?Q(e/_):e>>1,e+=Q(e/r);e>L*$>>1;a+=j)e=Q(e/L);return Q(a+(L+1)*e/(e+x))}function d(e){var r,t,a,s,i,n,l,u,d,p,m=[],v=e.length,y=0,g=R,P=O;for(t=e.lastIndexOf(I),t<0&&(t=0),a=0;a=128&&o("not-basic"),m.push(e.charCodeAt(a));for(s=t>0?t+1:0;s=v&&o("invalid-input"),u=h(e.charCodeAt(s++)),(u>=j||u>Q((w-y)/n))&&o("overflow"),y+=u*n,d=l<=P?S:l>=P+$?$:l-P,!(uQ(w/p)&&o("overflow"),n*=p;r=m.length+1,P=f(y-i,r,0==i),Q(y/r)>w-g&&o("overflow"),g+=Q(y/r),y%=r,m.splice(y++,0,g)}return c(m)}function p(e){var r,t,a,s,i,n,c,h,d,p,m,v,y,g,P,E=[];for(e=l(e),v=e.length,r=R,t=0,i=O,n=0;n=r&&mQ((w-t)/y)&&o("overflow"),t+=(c-r)*y,r=c,n=0;nw&&o("overflow"),m==r){for(h=t,d=j;p=d<=i?S:d>=i+$?$:d-i,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=j-S,Q=Math.floor,C=String.fromCharCode;if(E={version:"1.4.1",ucs2:{decode:l,encode:c},decode:d,encode:p,toASCII:v,toUnicode:m},"function"==typeof e&&"object"==typeof e.amd&&e.amd)e("punycode",function(){return E});else if(y&&g)if(t.exports==y)g.exports=E;else for(b in E)E.hasOwnProperty(b)&&(y[b]=E[b]);else s.punycode=E}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(e,r,t){"use strict";function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}r.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;e=e.split(r);var n=1e3;o&&"number"==typeof o.maxKeys&&(n=o.maxKeys);var l=e.length;n>0&&l>n&&(l=n);for(var c=0;c=0?(h=p.substr(0,m),u=p.substr(m+1)):(h=p,u=""),f=decodeURIComponent(h),d=decodeURIComponent(u),a(i,f)?s(i[f])?i[f].push(d):i[f]=[i[f],d]:i[f]=d}return i};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],48:[function(e,r,t){"use strict";function a(e,r){if(e.map)return e.map(r);for(var t=[],a=0;a",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),v=["%","/","?",";","#"].concat(m),y=["/","?","#"],g={javascript:!0,"javascript:":!0},P={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=e("querystring");a.prototype.parse=function(e,r,t){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=-1!==a&&a127?A+="x":A+=I[k];if(!A.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var D=O.slice(0,j),L=O.slice(j+1),Q=I.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);Q&&(D.push(Q[1]),L.unshift(Q[2])),L.length&&(i="/"+L.join(".")+i),this.hostname=D.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),_||(this.hostname=l.toASCII(this.hostname));var C=this.port?":"+this.port:"";this.host=(this.hostname||"")+C,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!g[d])for(var j=0,R=m.length;j0)&&t.host.split("@");j&&(t.auth=j.shift(),t.host=t.hostname=j.shift())}return t.search=e.search,t.query=e.query,c.isNull(t.pathname)&&c.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!b.length)return t.pathname=null,t.path=t.search?"/"+t.search:null,t.href=t.format(),t;for(var S=b.slice(-1)[0],$=(t.host||e.host||b.length>1)&&("."===S||".."===S)||""===S,x=0,_=b.length;_>=0;_--)S=b[_],"."===S?b.splice(_,1):".."===S?(b.splice(_,1),x++):x&&(b.splice(_,1),x--);if(!y&&!g)for(;x--;x)b.unshift("..");!y||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),$&&"/"!==b.join("/").substr(-1)&&b.push("");var O=""===b[0]||b[0]&&"/"===b[0].charAt(0);if(w){t.hostname=t.host=O?"":b.length?b.shift():"";var j=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@");j&&(t.auth=j.shift(),t.host=t.hostname=j.shift())}return y=y||t.host&&b.length,y&&!O&&b.unshift(""),b.length?t.pathname=b.join("/"):(t.pathname=null,t.path=null),c.isNull(t.pathname)&&c.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},a.prototype.parseHost=function(){var e=this.host,r=u.exec(e);r&&(r=r[0],":"!==r&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)}},{"./util":51,punycode:46,querystring:49}],51:[function(e,r,t){"use strict";r.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],ajv:[function(e,r,t){"use strict";function a(e){return g.test(e)}function s(r){function t(e,r){var t;if("string"==typeof e){if(!(t=S(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=R(e);t=a.validate||I(a)}var s=t(r);return!0===t.$async?"*"==D._opts.async?m(s):s:(D.errors=t.errors,s)}function v(e,r){var t=R(e,void 0,r);return t.validate||I(t)}function E(e,r,t,a){if(Array.isArray(e))for(var s=0;s=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(p,"$1 $3")),e.test(r)}function s(e,t,n,r){var i=new e.constructor(e.options,e.input,t);if(n)for(var s in n)i[s]=n[s];var o=e,a=i;return["inFunction","inAsyncFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in o&&(a[e]=o[e])}),r&&(i.options.preserveParens=!0),i.nextToken(),i}function o(e,t){var n=function(){};e.extend("initialContext",function(r){return function(){return this.options.ecmaVersion<7&&(n=function(t){e.raise(t.start,"async/await keywords only available when ecmaVersion>=7")}),this.reservedWords=new RegExp(this.reservedWords.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrict=new RegExp(this.reservedWordsStrict.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrictBind=new RegExp(this.reservedWordsStrictBind.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.inAsyncFunction=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),r.apply(this,arguments)}}),e.extend("shouldParseExportStatement",function(e){return function(){return!("name"!==this.type.label||"async"!==this.value||!i(c,this))||e.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label)if(i(c,this,!0)){var a=this.inAsyncFunction;try{this.inAsyncFunction=!0,this.next();var l=this.parseStatement(n,r);return l.async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}finally{this.inAsyncFunction=a}}else if("object"==typeof t&&t.asyncExits&&i(u,this)){this.next();var l=this.parseStatement(n,r);return l.async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(t){var n=e.apply(this,arguments);return this.inAsyncFunction&&"await"===n.name&&0===arguments.length&&this.raise(n.start,"'await' is reserved within async functions"),n}}),e.extend("parseExprAtom",function(e){return function(i){var o,u=this.start,c=this.startLoc,p=e.apply(this,arguments);if("Identifier"===p.type)if("async"!==p.name||r(this,p.end)){if("await"===p.name){var h=this.startNodeAt(p.start,p.loc&&p.loc.start);if(this.inAsyncFunction)return o=this.parseExprSubscripts(),h.operator="await",h.argument=o,h=this.finishNodeAt(h,"AwaitExpression",o.end,o.loc&&o.loc.end),n(h),h;if(this.input.slice(p.end).match(l))return t.awaitAnywhere||"module"!==this.options.sourceType?p:this.raise(p.start,"'await' is reserved within modules");if("object"==typeof t&&t.awaitAnywhere&&(u=this.start,o=s(this,u-4).parseExprSubscripts(),o.end<=u))return o=s(this,u).parseExprSubscripts(),h.operator="await",h.argument=o,h=this.finishNodeAt(h,"AwaitExpression",o.end,o.loc&&o.loc.end),this.pos=o.end,this.end=o.end,this.endLoc=o.endLoc,this.next(),n(h),h;if(!t.awaitAnywhere&&"module"===this.options.sourceType)return this.raise(p.start,"'await' is reserved within modules")}}else{var f=this.inAsyncFunction;try{this.inAsyncFunction=!0;var d=this,y=!1,m={parseFunctionBody:function(e,t){try{var n=y;return y=!0,d.parseFunctionBody.apply(this,arguments)}finally{y=n}},raise:function(){try{return d.raise.apply(this,arguments)}catch(e){throw y?e:a}}};if(o=s(this,this.start,m,!0).parseExpression(),"SequenceExpression"===o.type&&(o=o.expressions[0]),"CallExpression"===o.type&&(o=o.callee),"FunctionExpression"===o.type||"FunctionDeclaration"===o.type||"ArrowFunctionExpression"===o.type)return o=s(this,this.start,m).parseExpression(),"SequenceExpression"===o.type&&(o=o.expressions[0]),"CallExpression"===o.type&&(o=o.callee),o.async=!0,o.start=u,o.loc&&(o.loc.start=c),o.range&&(o.range[0]=u),this.pos=o.end,this.end=o.end,this.endLoc=o.endLoc,this.next(),n(o),o}catch(e){if(e!==a)throw e}finally{this.inAsyncFunction=f}}return p}}),e.extend("finishNodeAt",function(e){return function(t,n,r,i){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("finishNode",function(e){return function(t,n){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}});e.extend("parsePropertyName",function(e){return function(t){var i=(t.key&&t.key.name,e.apply(this,arguments));return"Identifier"!==i.type||"async"!==i.name||r(this,i.end)||this.input.slice(i.end).match(l)||(h.test(this.input.slice(i.end))?(i=e.apply(this,arguments),t.__asyncValue=!0):(n(t),"set"===t.kind&&this.raise(i.start,"'set (value)' cannot be be async"),i=e.apply(this,arguments),"Identifier"===i.type&&"set"===i.name&&this.raise(i.start,"'set (value)' cannot be be async"),t.__asyncValue=!0)),i}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i;n.__asyncValue&&("constructor"===n.kind&&this.raise(n.start,"class constructor() cannot be be async"),i=this.inAsyncFunction,this.inAsyncFunction=!0);var s=e.apply(this,arguments);return this.inAsyncFunction=i,s}}),e.extend("parseMethod",function(e){return function(t){var n;this.__currentProperty&&this.__currentProperty.__asyncValue&&(n=this.inAsyncFunction,this.inAsyncFunction=!0);var r=e.apply(this,arguments);return this.inAsyncFunction=n,r}}),e.extend("parsePropertyValue",function(e){return function(t,n,r,i,s,o){var a=this.__currentProperty;this.__currentProperty=t;var u;t.__asyncValue&&(u=this.inAsyncFunction,this.inAsyncFunction=!0);var c=e.apply(this,arguments);return this.inAsyncFunction=u,this.__currentProperty=a,c}})}var a={},u=/^async[\t ]+(return|throw)/,c=/^async[\t ]+function/,l=/^\s*[():;]/,p=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g,h=/\s*(get|set)\s*\(/;t.exports=o},{}],3:[function(e,t,n){function r(e,t){return e.lineStart>=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(c,"$1 $3")),e.test(r)}function s(e,t,n){var r=new e.constructor(e.options,e.input,t);if(n)for(var i in n)r[i]=n[i];var s=e,o=r;return["inFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in s&&(o[e]=s[e])}),r.nextToken(),r}function o(e,t){t&&"object"==typeof t||(t={}),e.extend("parse",function(n){return function(){return this.inAsync=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),n.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label&&t.asyncExits&&i(a,this)){this.next();var u=this.parseStatement(n,r);return u.async=!0,u.start=s,u.loc&&(u.loc.start=o),u.range&&(u.range[0]=s),u}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(n){return"module"===this.options.sourceType&&this.options.ecmaVersion>=8&&t.awaitAnywhere?e.call(this,!0):e.apply(this,arguments)}}),e.extend("parseExprAtom",function(e){var n={};return function(r){var i,o=this.start,a=(this.startLoc,e.apply(this,arguments));if("Identifier"===a.type&&"await"===a.name&&!this.inAsync&&t.awaitAnywhere){var u=this.startNodeAt(a.start,a.loc&&a.loc.start);o=this.start;var c={raise:function(){try{return pp.raise.apply(this,arguments)}catch(e){throw n}}};try{if(i=s(this,o-4,c).parseExprSubscripts(),i.end<=o)return i=s(this,o,c).parseExprSubscripts(),u.argument=i,u=this.finishNodeAt(u,"AwaitExpression",i.end,i.loc&&i.loc.end),this.pos=i.end,this.end=i.end,this.endLoc=i.endLoc,this.next(),u}catch(e){if(e===n)return a;throw e}}return a}});var n={undefined:!0,get:!0,set:!0,static:!0,async:!0,constructor:!0};e.extend("parsePropertyName",function(e){return function(t){var i=t.key&&t.key.name,s=e.apply(this,arguments);"get"===this.value&&(t.__maybeStaticAsyncGetter=!0);return n[this.value]?s:("Identifier"!==s.type||"async"!==s.name&&"async"!==i||r(this,s.end)||this.input.slice(s.end).match(u)?delete t.__maybeStaticAsyncGetter:"set"===t.kind||"set"===s.name?this.raise(s.start,"'set (value)' cannot be be async"):(this.__isAsyncProp=!0,s=e.apply(this,arguments),"Identifier"===s.type&&"set"===s.name&&this.raise(s.start,"'set (value)' cannot be be async")),s)}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i=e.apply(this,arguments);return n.__maybeStaticAsyncGetter&&(delete n.__maybeStaticAsyncGetter,"get"!==n.key.name&&(n.kind="get")),i}}),e.extend("parseFunctionBody",function(e){return function(t,n){var r=this.inAsync;this.__isAsyncProp&&(t.async=!0,this.inAsync=!0,delete this.__isAsyncProp);var i=e.apply(this,arguments);return this.inAsync=r,i}})}var a=/^async[\t ]+(return|throw)/,u=/^\s*[):;]/,c=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g;t.exports=o},{}],4:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function s(e){var t,n,i,s,o,a,u=e.length;o=r(e),a=new p(3*u/4-o),i=o>0?u-4:u;var c=0;for(t=0,n=0;t>16&255,a[c++]=s>>8&255,a[c++]=255&s;return 2===o?(s=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,a[c++]=255&s):1===o&&(s=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,a[c++]=s>>8&255,a[c++]=255&s),a}function o(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function a(e,t,n){for(var r,i=[],s=t;su?u:o+16383));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),s.push(i),s.join("")}n.byteLength=i,n.toByteArray=s,n.fromByteArray=u;for(var c=[],l=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=h.length;fH)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(e)}return s(e,t,n)}function s(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return e instanceof ArrayBuffer?p(e,t,n):"string"==typeof e?c(e,t):h(e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function a(e,t,n){return o(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}function u(e){return o(e),r(e<0?0:0|f(e))}function c(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(e,t),s=r(n),o=s.write(e,t);return o!==n&&(s=s.slice(0,o)),s}function l(e){for(var t=e.length<0?0:0|f(e.length),n=r(t),i=0;i=H)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H.toString(16)+" bytes");return 0|e}function d(e){return+e!=e&&(e=0),i.alloc(+e)}function y(e,t){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return P(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}var c;if(i){var l=-1;for(c=n;ca&&(n=a-u),c=n;c>=0;c--){for(var p=!0,h=0;hi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o239?4:s>223?3:s>191?2:1;if(i+a<=n){var u,c,l,p;switch(a){case 1:s<128&&(o=s);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&s)<<6|63&u)>127&&(o=p);break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(p=(15&s)<<12|(63&u)<<6|63&c)>2047&&(p<55296||p>57343)&&(o=p);break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(p=(15&s)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&p<1114112&&(o=p)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return L(r)}function L(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,s,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function B(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function R(e,t,n,r,i){return t=+t,n>>>=0,i||B(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(e,t,n,r,23,4),n+4}function I(e,t,n,r,i){return t=+t,n>>>=0,i||B(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(e,t,n,r,52,8),n+8}function j(e){if(e=M(e).replace(Q,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function M(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(e){for(var t=[],n=0;n>8,i=n%256,s.push(i),s.push(r);return s}function z(e){return J.toByteArray(j(e))}function W(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var J=e("base64-js"),Y=e("ieee754");n.Buffer=i,n.SlowBuffer=d,n.INSPECT_MAX_BYTES=50;var H=2147483647;n.kMaxLength=H,i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,n){return s(e,t,n)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,n){return a(e,t,n)},i.allocUnsafe=function(e){return u(e)},i.allocUnsafeSlow=function(e){return u(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,s=0,o=Math.min(n,r);s0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,s>>>=0,this===e)return 0;for(var o=s-r,a=n-t,u=Math.min(o,a),c=this.slice(r,s),l=e.slice(t,n),p=0;p>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||$(e,t,this.length);for(var r=this[e],i=1,s=0;++s>>=0,t>>>=0,n||$(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},i.prototype.readUInt8=function(e,t){return e>>>=0,t||$(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||$(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||$(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||$(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||$(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||$(e,t,this.length);for(var r=this[e],i=1,s=0;++s=i&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||$(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||$(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||$(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){e>>>=0,t||$(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||$(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||$(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||$(e,4,this.length),Y.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||$(e,4,this.length),Y.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||$(e,8,this.length),Y.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||$(e,8,this.length),Y.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){O(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,!r){O(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>1,l=-7,p=n?i-1:0,h=n?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+p],p+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+p],p+=h,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=c}return(f?-1:1)*o*Math.pow(2,s-r)},n.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),t+=o+p>=1?h/u:h*Math.pow(2,1-p),t*u>=2&&(o++,u/=2),o+p>=l?(a=0,o=l):o+p>=1?(a=(t*u-1)*Math.pow(2,i),o+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(o=o<0;e[n+f]=255&o,f+=d,o/=256,c-=8);e[n+f-d]|=128*y}},{}],8:[function(e,t,n){"use strict";function r(e,t){if(Function.prototype.$asyncspawn||Object.defineProperty(Function.prototype,"$asyncspawn",{value:r,enumerable:!1,configurable:!0,writable:!0}),this instanceof Function){var n=this;return new e(function(e,r){function i(t,n){var o;try{if(o=t.call(s,n),o.done){if(o.value!==e){if(o.value&&o.value===o.value.then)return o.value(e,r);e&&e(o.value),e=null}return}o.value.then?o.value.then(function(e){i(s.next,e)},function(e){i(s.throw,e)}):i(s.next,o.value)}catch(e){return r&&r(e),void(r=null)}}var s=n.call(t,e,r);i(s.next)})}}var i=function(e,t){for(var n=t.toString(),r="return "+n,i=n.match(/.*\(([^)]*)\)/)[1],s=/['"]!!!([^'"]*)['"]/g,o=[];;){var a=s.exec(r);if(!a)break;o.push(a)}return o.reverse().forEach(function(t){r=r.slice(0,t.index)+e[t[1]]+r.substr(t.index+t[0].length)}),r=r.replace(/\/\*[^*]*\*\//g," ").replace(/\s+/g," "),new Function(i,r)()}({zousan:e("./zousan").toString(),thenable:e("./thenableFactory").toString()},function e(t,n){function r(){return i.apply(t,arguments)}Function.prototype.$asyncbind||Object.defineProperty(Function.prototype,"$asyncbind",{value:e,enumerable:!1,configurable:!0,writable:!0}),e.trampoline||(e.trampoline=function(e,t,n,r,i){return function s(o){for(;o;){if(o.then)return o=o.then(s,r),i?void 0:o;try{ +if(o.pop){if(o.length)return o.pop()?t.call(e):o;o=n}else o=o.call(e)}catch(e){return r(e)}}}}),e.LazyThenable||(e.LazyThenable="!!!thenable"(),e.EagerThenable=e.Thenable=(e.EagerThenableFactory="!!!zousan")());var i=this;switch(n){case!0:return new e.Thenable(r);case 0:return new e.LazyThenable(r);case void 0:return r.then=r,r;default:return function(){try{return i.apply(t,arguments)}catch(e){return n(e)}}}});i(),r(),t.exports={$asyncbind:i,$asyncspawn:r}},{"./thenableFactory":9,"./zousan":10}],9:[function(e,t,n){t.exports=function(){function e(e){return e&&e instanceof Object&&"function"==typeof e.then}function t(n,r,i){try{var s=i?i(r):r;if(n===s)return n.reject(new TypeError("Promise resolution loop"));e(s)?s.then(function(e){t(n,e)},function(e){n.reject(e)}):n.resolve(s)}catch(e){n.reject(e)}}function n(){}function r(e){}function i(e,t){this.resolve=e,this.reject=t}function s(r,i){var s=new n;try{this._resolver(function(n){return e(n)?n.then(r,i):t(s,n,r)},function(e){t(s,e,i)})}catch(e){t(s,e,i)}return s}function o(e){this._resolver=e,this.then=s}return n.prototype={resolve:r,reject:r,then:i},o.resolve=function(e){return o.isThenable(e)?e:{then:function(t){return t(e)}}},o.isThenable=e,o}},{}],10:[function(e,t,n){(function(e){"use strict";t.exports=function(t){function n(e){if(e){var t=this;e(function(e){t.resolve(e)},function(e){t.reject(e)})}}function r(e,t){if("function"==typeof e.y)try{var n=e.y.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.resolve(t)}function i(e,t){if("function"==typeof e.n)try{var n=e.n.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.reject(t)}t=t||"object"==typeof e&&e.nextTick||"function"==typeof setImmediate&&setImmediate||function(e){setTimeout(e,0)};var s=function(){function e(){for(;n.length-r;){try{n[r]()}catch(e){}n[r++]=void 0,r===i&&(n.splice(0,i),r=0)}}var n=[],r=0,i=1024;return function(i){n.push(i),n.length-r==1&&t(e)}}();return n.prototype={resolve:function(e){if(void 0===this.state){if(e===this)return this.reject(new TypeError("Attempt to resolve promise with self"));var t=this;if(e&&("function"==typeof e||"object"==typeof e))try{var n=0,i=e.then;if("function"==typeof i)return void i.call(e,function(e){n++||t.resolve(e)},function(e){n++||t.reject(e)})}catch(e){return void(n||this.reject(e))}this.state=r,this.v=e,t.c&&s(function(){for(var n=0,i=t.c.length;n]*>)(.*)/i,/(.*)(<\/script>)(.*)/i],o=0,a=!0;t=t.split("\n");for(var u=0;u0){if(!a)return t(e);delete e.async}return void(!a&&i?t():(e.type="ReturnStatement",e.$mapped=!0,e.argument={type:"CallExpression",callee:A(s,[n]).$error,arguments:[e.argument]}))}return"TryStatement"===e.type?(i++,t(e),void i--):o(e).isFunction?(r++,t(e),void r--):void t(e)}if(r>0){if(!o(e).isAsync)return t(e);delete e.async}return e.$mapped=!0,void(o(e.argument).isUnaryExpression&&"void"===e.argument.operator?e.argument=e.argument.argument:e.argument={type:"CallExpression",callee:A(s,[n]).$return,arguments:e.argument?[e.argument]:[]})},t)}function $(e,t){return Array.isArray(e)?e.map(function(e){return $(e,t)}):(y.treeWalker(e,function(e,t,n){if(t(),"ConditionalExpression"===e.type&&(u(e.alternate)||u(e.consequent))){h(E("condOp"));i(e,L(y.part("if ($0) return $1 ; return $2",[e.test,e.consequent,e.alternate]).body))}},t),e)}function O(e,t){return Array.isArray(e)?e.map(function(e){return O(e,t)}):(y.treeWalker(e,function(e,t,n){if(t(),"LogicalExpression"===e.type&&u(e.right)){var r,s=h(E("logical"+("&&"===e.operator?"And":"Or")));if("||"===e.operator)r="var $0; if (!($0 = $1)) {$0 = $2} return $0";else{if("&&"!==e.operator)throw new Error(v(e)+"Illegal logical operator: "+e.operator);r="var $0; if ($0 = $1) {$0 = $2} return $0"}i(e,L(y.part(r,[s,e.left,e.right]).body))}},t),e)}function B(e,t,n){if("SwitchCase"!==e.type&&o(e).isBlockStatement)for(var r=0;r { $$setMapped: while (q) { if (q.then) "+(1===s?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }))($idIter)":"($idTrampoline = (function (q) { $$setMapped: while (q) { if (q.then) "+(1===s?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }).bind(this))($idIter)",{setMapped:function(e){return e.$mapped=!0,e},idTrampoline:E,exit:$,idIter:S,idContinuation:_,idStep:k}).expr:y.part("(Function.$0.trampoline(this,$1,$2,$3,$5)($4))",[me.asyncbind,_,k,$,S,b(1===s)]).expr,l.push({type:"ReturnStatement",argument:F}),l.push({$label:e.$label,type:"FunctionDeclaration",id:S,params:[],body:{type:"BlockStatement",body:m}}),d&&l.push({type:"FunctionDeclaration",id:k,params:[],body:{type:"BlockStatement",body:[d,P]}}),!p||"VariableDeclaration"!==p.type||"let"!==p.kind&&"const"!==p.kind?(l.push(x),t[0].replace(l.map(r))):("const"===p.kind&&(p.kind="let"),t[0].replace([{type:"BlockStatement",body:l.map(r)},r(x)]))}}function Y(e,t){return y.treeWalker(e,function(e,t,s){function a(e){return{type:"ReturnStatement",argument:{type:"UnaryExpression",operator:"void",prefix:!0,argument:P(e||S)}}}function c(e,t){if("BreakStatement"===e.type)i(e,r(A(e.label&&n.generatedSymbolPrefix+"Loop_"+e.label.name+"_exit")));else if("ContinueStatement"===e.type)i(e,r(a(e.label&&n.generatedSymbolPrefix+"Loop_"+e.label.name+"_next")));else if(o(e).isFunction)return!0;t()}"ForInStatement"===e.type&&u(e)?W(e,s):"ForOfStatement"===e.type&&u(e)&&G(e,s),t();var p;if(o(e).isLoop&&u(e)){var f=e.init,d=e.test||b(!0),g=e.update,v=e.body,x=l(v);f&&(o(f).isStatement||(f={type:"ExpressionStatement",expression:f})),g=g&&{type:"ExpressionStatement",expression:g},v=o(v).isBlockStatement?r(v).body:[r(v)];var w=e.$label&&e.$label.name;w="Loop_"+(w||ye++);var E=n.generatedSymbolPrefix+(w+"_exit"),S=n.generatedSymbolPrefix+(w+"_next"),k=h(n.generatedSymbolPrefix+w),A=function(e){return{type:"ReturnStatement",argument:{type:"UnaryExpression",operator:"void",prefix:!0,argument:{type:"CallExpression",callee:h(e||E),arguments:[]}}}},_=C(S,[{type:"ReturnStatement",argument:{type:"CallExpression",callee:x?m(k):k,arguments:[h(E),me.error]}}]);g&&_.body.body.unshift(g);for(var L=0;L0&&o(e).isAsync)return delete e.async,e.argument={type:"CallExpression",callee:"ThrowStatement"===e.type?me.error:me.return,arguments:e.argument?[e.argument]:[]},void(e.type="ReturnStatement");n(e)})}function K(e,t){if(n.noRuntime)throw new Error("Nodent: 'noRuntime' option only compatible with -promise and -engine modes");return y.part("{ return (function*($return,$error){ $:body }).$asyncspawn(Promise,this) }",{return:me.return,error:me.error,asyncspawn:me.asyncspawn,body:X(e).concat(t?[{type:"ReturnStatement",argument:me.return}]:[])}).body[0]}function ee(e){e.$asyncgetwarninig||(e.$asyncgetwarninig=!0,d(v(e)+"'async get "+printNode(e)+"(){...}' is non-standard. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification"))}function te(e,t){function s(e,t){y.treeWalker(e,function(n,r,i){n!==e&&o(n).isFunction||(o(n).isAwait?t?(n.$hidden=!0,r()):(delete n.operator,n.delegate=!1,n.type="YieldExpression",r()):r())})}function a(e){var t=n.promises;n.promises=!0,_(e,!0),n.promises=t}function u(e){return"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:e.body}]}),e}function c(e,n){n.$asyncexitwarninig||(n.$asyncexitwarninig=!0,d(v(e)+"'async "+{ReturnStatement:"return",ThrowStatement:"throw"}[e.type]+"' not possible in "+(t?"engine":"generator")+" mode. Using Promises for function at "+v(n)))}y.treeWalker(e,function(e,n,r){n();var l,p,h;if(o(e).isAsync&&o(e).isFunction){var f;(f=x(r[0].parent))&&o(f).isAsync&&"get"===r[0].parent.kind&&ee(r[0].parent.key),(p=H(e))?(c(p,e.body),a(e)):t?"get"!==r[0].parent.kind&&s(e,!0):(l=e,delete l.async,h=w(l),s(l,!1),l=u(l),l.body=K(l.body.body,p),h&&D(l.body.body,[ge]),l.id&&"ExpressionStatement"===r[0].parent.type?(l.type="FunctionDeclaration",r[1].replace(l)):r[0].replace(l))}else(l=x(e))&&o(l).isAsync&&((p=H(l))?(c(p,l),a(e)):t&&"get"!==e.kind||(t?a(e):(e.async=!1,h=w(l),s(l,!1),i(l,u(l)),l.body=K(l.body.body,p)),h&&D(l.body.body,[ge])))});var l=r(n);return n.engine=!1,n.generators=!1,ce(e),oe(e),M(e,l.engine),O(e),$(e),U(e,[q,J,R,I,B]),z(e,"warn"),n.engine=l.engine,n.generators=l.generators,e}function ne(e,t,n){var r=[];return y.treeWalker(e,function(i,s,a){return i===e?s():t(i,a)?void r.push([].concat(a)):void(n||o(i).isScope||s())}),r}function re(e,t){var n=[],i={};if(e=e.filter(function(e){return"ExportNamedDeclaration"!==e[0].parent.type}),e.length){var s={};e.forEach(function(e){function t(e){e in s?i[e]=o.declarations[u]:s[e]=o.declarations[u]}for(var n=e[0],o=n.self,a=(o.kind,[]),u=0;u1?{type:"SequenceExpression",expressions:a}:a[0];"For"!==n.parent.type.slice(0,3)&&(p={type:"ExpressionStatement",expression:p}),n.replace(p)}});var o=Object.keys(s);o.length&&(o=o.map(function(e){return{type:"VariableDeclarator",id:h(e),loc:s[e].loc,start:s[e].start,end:s[e].end}}),n[0]&&"VariableDeclaration"===n[0].type?n[0].declarations=n[0].declarations.concat(o):n.unshift({type:"VariableDeclaration",kind:t,declarations:o}))}return{decls:n,duplicates:i}}function ie(e){if(!e)return[];if(Array.isArray(e))return e.reduce(function(e,t){return e.concat(ie(t.id))},[]);switch(e.type){case"Identifier":return[e.name];case"AssignmentPattern":return ie(e.left);case"ArrayPattern":return e.elements.reduce(function(e,t){return e.concat(ie(t))},[]);case"ObjectPattern":return e.properties.reduce(function(e,t){return e.concat(ie(t))},[]);case"ObjectProperty":case"Property":return ie(e.value);case"RestElement":case"RestProperty":return ie(e.argument)}}function se(e){function t(e){d(v(e)+"Possible assignment to 'const "+printNode(e)+"'")}function n(e){switch(e.type){case"Identifier":"const"===r[e.name]&&t(e);break;case"ArrayPattern":e.elements.forEach(function(e){"const"===r[e.name]&&t(e)});break;case"ObjectPattern":e.properties.forEach(function(e){"const"===r[e.key.name]&&t(e)})}}var r={};y.treeWalker(e,function(e,t,i){var s=o(e).isBlockStatement;if(s){r=Object.create(r);for(var a=0;a=0){var r=n[0];return("left"!=r.field||"ForInStatement"!==r.parent.type&&"ForOfStatement"!==r.parent.type)&&("init"!=r.field||"ForStatement"!==r.parent.type||"const"!==t.kind&&"let"!==t.kind)}}}function s(e,t){return!("FunctionDeclaration"!==e.type||!e.id)&&(o(e).isAsync||!e.$continuation)}var c={TemplateLiteral:function(e){return e.expressions},NewExpression:function(e){return e.arguments},CallExpression:function(e){return e.arguments},SequenceExpression:function(e){return e.expressions},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties.map(function(e){return e.value})}};y.treeWalker(e,function(e,n,s){var a;if(n(),e.type in c&&!e.$hoisted){var s,l=c[e.type](e),p=[];for(a=0;a0;a--)if(e.declarations[a]&&e.declarations[a].init&&u(e.declarations[a].init)){var h={type:"VariableDeclaration",kind:e.kind,declarations:e.declarations.splice(a)},f=s[0];if(!("index"in f))throw new Error("VariableDeclaration not in a block");f.parent[f.field].splice(f.index+1,0,h)}}),se(e);var l=!1;return y.treeWalker(e,function(e,t,r){var i=l;if(l=l||pe(e),o(e).isBlockStatement){if(u(e)){var a,c,p,f,y,m=!r[0].parent||o(r[0].parent).isScope;if(m){c=ne(e,n(["const"]),!1);var g={},b={};c.forEach(function(e){e[0].self.declarations.forEach(function(e){ie(e.id).forEach(function(t){g[t]||b[t]?(delete g[t],b[t]=e):g[t]=e})})}),c.forEach(function(e){for(var t=0;t=0&&"ReturnStatement"===i[1].self.type){var s=e.$thisCallName,a=r(de[s].def.body.body);de[s].$inlined=!0,o(i[1].self).isJump||a.push({type:"ReturnStatement"}),i[1].replace(a)}});var n=Object.keys(de).map(function(e){return de[e].$inlined&&de[e].def});y.treeWalker(e,function(e,t,r){t(),n.indexOf(e)>=0&&r[0].remove()})}if(!("Program"===e.type&&"module"===e.sourceType||a(e,function(e){return o(e).isES6},!0))){var i=pe(e);!function(e){y.treeWalker(e,function(e,t,n){if("Program"===e.type||"FunctionDeclaration"===e.type||"FunctionExpression"===e.type){var r=i;if(i=i||pe(e)){t();var s="Program"===e.type?e:e.body,o=ne(s,function(e,t){if("FunctionDeclaration"===e.type)return t[0].parent!==s});o=o.map(function(e){return e[0].remove()}),[].push.apply(s.body,o)}else t();i=r}else t()})}(e)}return y.treeWalker(e,function(e,t,n){t(),Object.keys(e).filter(function(e){return"$"===e[0]}).forEach(function(t){delete e[t]})}),e}var de={},ye=1,me={};Object.keys(n).filter(function(e){return"$"===e[0]}).forEach(function(e){me[e.slice(1)]=h(n[e])});var ge=y.part("var $0 = arguments",[me.arguments]).body[0];return n.engine?(e.ast=ue(e.ast,!0),e.ast=te(e.ast,n.engine),e.ast=le(e.ast),fe(e.ast)):n.generators?(e.ast=ue(e.ast),e.ast=te(e.ast),e.ast=le(e.ast),fe(e.ast)):(e.ast=ue(e.ast),_(e.ast)),n.babelTree&&y.treeWalker(e.ast,function(e,t,n){t(),"Literal"===e.type&&i(e,b(e.value))}),e}var y=e("./parser"),m=e("./output");n.printNode=function e(t){if(!t)return"";if(Array.isArray(t))return t.map(e).join("|\n");try{return m(t)}catch(e){return e.message+": "+(t&&t.type)}};var g={start:!0,end:!0,loc:!0,range:!0},v={getScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type?this.node.body.body:"Program"===this.node.type?this.node.body:null},isScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"Program"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type},isFunction:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type},isClass:function(){return"ClassDeclaration"===this.node.type||"ClassExpression"===this.node.type},isBlockStatement:function(){return"ClassBody"===this.node.type||"Program"===this.node.type||"BlockStatement"===this.node.type?this.node.body:"SwitchCase"===this.node.type&&this.node.consequent},isExpressionStatement:function(){return"ExpressionStatement"===this.node.type},isLiteral:function(){return"Literal"===this.node.type||"BooleanLiteral"===this.node.type||"RegExpLiteral"===this.node.type||"NumericLiteral"===this.node.type||"StringLiteral"===this.node.type||"NullLiteral"===this.node.type},isDirective:function(){return"ExpressionStatement"===this.node.type&&("StringLiteral"===this.node.expression.type||"Literal"===this.node.expression.type&&"string"==typeof this.node.expression.value)},isUnaryExpression:function(){return"UnaryExpression"===this.node.type},isAwait:function(){return"AwaitExpression"===this.node.type&&!this.node.$hidden},isAsync:function(){return this.node.async},isStatement:function(){return null!==this.node.type.match(/[a-zA-Z]+Declaration/)||null!==this.node.type.match(/[a-zA-Z]+Statement/)},isExpression:function(){return null!==this.node.type.match(/[a-zA-Z]+Expression/)},isLoop:function(){return"ForStatement"===this.node.type||"WhileStatement"===this.node.type||"DoWhileStatement"===this.node.type},isJump:function(){return"ReturnStatement"===this.node.type||"ThrowStatement"===this.node.type||"BreakStatement"===this.node.type||"ContinueStatement"===this.node.type},isES6:function(){switch(this.node.type){case"ExportNamedDeclaration":case"ExportSpecifier":case"ExportDefaultDeclaration":case"ExportAllDeclaration":case"ImportDeclaration":case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ArrowFunctionExpression":case"ForOfStatement":case"YieldExpression":case"Super":case"RestElement":case"RestProperty":case"SpreadElement":case"TemplateLiteral":case"ClassDeclaration":case"ClassExpression":return!0;case"VariableDeclaration":return this.node.kind&&"var"!==this.node.kind;case"FunctionDeclaration":case"FunctionExpression":return!!this.node.generator}}},b={};Object.keys(v).forEach(function(e){Object.defineProperty(b,e,{get:v[e]})}),t.exports={printNode:printNode,babelLiteralNode:p,asynchronize:function(e,t,n,r){try{return d(e,t,n,r)}catch(t){if(t instanceof SyntaxError){var i=e.origCode.substr(t.pos-t.loc.column);i=i.split("\n")[0],t.message+=" (nodent)\n"+i+"\n"+i.replace(/[\S ]/g,"-").substring(0,t.loc.column)+"^",t.stack=""}throw t}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./output":13,"./parser":14}],13:[function(e,t,n){"use strict";function r(e){var t=y[e.type]||y[e.type+e.operator]||y[e.type+e.operator+(e.prefix?"prefix":"")];return void 0!==t?t:20}function i(e,t,n){var r=this[n||e.type];r?r.call(this,e,t):t.write(e,"/*"+e.type+"?*/ "+t.sourceAt(e.start,e.end))}function s(e,t,n,i){2===i||r(n)0){this.out(e[0],t,e[0].type);for(var r=1,i=e.length;r>":13,"BinaryExpression>>>":13,"BinaryExpression<":12,"BinaryExpression<=":12,"BinaryExpression>":12,"BinaryExpression>=":12,BinaryExpressionin:12,BinaryExpressioninstanceof:12,"BinaryExpression==":11,"BinaryExpression===":11,"BinaryExpression!=":11,"BinaryExpression!==":11,"BinaryExpression&":10,"BinaryExpression^":9,"BinaryExpression|":8,"LogicalExpression&&":7,"LogicalExpression||":6,ConditionalExpression:5,AssignmentPattern:4,AssignmentExpression:4,yield:3,YieldExpression:3,SpreadElement:2,"comma-separated-list":1.5,SequenceExpression:1},m={type:"comma-separated-list"},g={out:i,expr:s,formatParameters:o,Program:function(e,t){var n,r,i=h(t.indent,t.indentLevel),s=t.lineEnd;n=e.body;for(var o=0,a=n.length;o0){t.write(null,s);for(var a=0,u=n.length;a0){this.out(n[0],t,"VariableDeclarator");for(var i=1;i0){for(var n=0;n0)for(var r=0;r ")):(this.formatParameters(e.params,t),t.write(e,"=> ")),"ObjectExpression"===e.body.type||"SequenceExpression"===e.body.type?(t.write(null,"("),this.out(e.body,t,e.body.type),t.write(null,")")):this.out(e.body,t,e.body.type)},ThisExpression:function(e,t){t.write(e,"this")},Super:function(e,t){t.write(e,"super")},RestElement:u=function(e,t){t.write(e,"..."),this.out(e.argument,t,e.argument.type)},SpreadElement:u,YieldExpression:function(e,t){t.write(e,e.delegate?"yield*":"yield"),e.argument&&(t.write(null," "),this.expr(t,e,e.argument))},AwaitExpression:function(e,t){t.write(e,"await "),this.expr(t,e,e.argument)},TemplateLiteral:function(e,t){var n,r=e.quasis,i=e.expressions;t.write(e,"`");for(var s=0,o=i.length;s0)for(var n=e.elements,r=n.length,i=0;;){var s=n[i];if(s&&this.expr(t,m,s),i+=1,(i=r)break;t.lineLength()>t.wrapColumn&&t.write(null,t.lineEnd,h(t.indent,t.indentLevel+1))}t.write(null,"]")},ArrayPattern:l,ObjectExpression:function(e,t){var n,r=h(t.indent,t.indentLevel++),i=t.lineEnd,s=r+t.indent;if(t.write(e,"{"),e.properties.length>0){t.write(null,i);for(var o=e.properties,a=o.length,u=0;n=o[u],t.write(null,s),this.out(n,t,"Property"),++ut.wrapColumn&&t.write(null,t.lineEnd,h(t.indent,t.indentLevel+1));t.write(null,i,r,"}")}else t.write(null,"}");t.indentLevel--},Property:function(e,t){e.method||"get"===e.kind||"set"===e.kind?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),t.write(null,": ")),this.expr(t,m,e.value))},ObjectPattern:function(e,t){if(t.write(e,"{"),e.properties.length>0)for(var n=e.properties,r=n.length,i=0;this.out(n[i],t,"Property"),++i0)for(var i=r.length,s=0;s1&&t.write(e," "),this.expr(t,e,e.argument,!0)):(this.expr(t,e,e.argument),t.write(e,e.operator))},UpdateExpression:function(e,t){e.prefix?(t.write(e,e.operator),this.out(e.argument,t,e.argument.type)):(this.out(e.argument,t,e.argument.type),t.write(e,e.operator))},BinaryExpression:c=function(e,t){var n=e.operator;"in"===n&&t.inForInit&&t.write(null,"("),this.expr(t,e,e.left),t.write(e," ",n," "),this.expr(t,e,e.right,"ArrowFunctionExpression"===e.right.type?2:0),"in"===n&&t.inForInit&&t.write(null,")")},LogicalExpression:c,AssignmentExpression:function(e,t){"ObjectPattern"===e.left.type&&t.write(null,"("),this.BinaryExpression(e,t),"ObjectPattern"===e.left.type&&t.write(null,")")},AssignmentPattern:function(e,t){this.expr(t,e,e.left),t.write(e," = "),this.expr(t,e,e.right)},ConditionalExpression:function(e,t){this.expr(t,e,e.test,!0),t.write(e," ? "),this.expr(t,e,e.consequent),t.write(null," : "),this.expr(t,e,e.alternate)},NewExpression:function(e,t){t.write(e,"new "),this.out(e,t,"CallExpression")},CallExpression:function(e,t){this.expr(t,e,e.callee,"ObjectExpression"===e.callee.type?2:0),t.write(e,"(");var n=e.arguments;if(n.length>0)for(var r=n.length,i=0;i=0&&r({self:i,parent:e,field:a[u],index:!0}):c instanceof Object&&i===c&&r({self:i,parent:e,field:a[u]})}})}return n||(n=[{self:e}],n.replace=function(e,t){n[e].replace(t)}),t(e,s,n),e}function s(t,n){var r=[],s={ecmaVersion:8,allowHashBang:!0,allowReturnOutsideFunction:!0,allowImportExportEverywhere:!0,locations:!0,onComment:r};if((!n||!n.noNodentExtensions||parseInt(a.version)<4)&&(h||(parseInt(a.version)<4&&console.warn("Nodent: Warning - noNodentExtensions option requires acorn >=v4.x. Extensions installed."),e("acorn-es7-plugin")(a),h=!0),s.plugins=s.plugins||{},s.plugins.asyncawait={asyncExits:!0,awaitAnywhere:!0}),n)for(var o in n)"noNodentExtensions"!==o&&(s[o]=n[o]);var u=a.parse(t,s);return i(u,function(e,t,n){for(t();r.length&&e.loc&&e.loc.start.line>=r[0].loc.start.line&&e.loc.end.line>=r[0].loc.end.line;)e.$comments=e.$comments||[],e.$comments.push(r.shift())}),u}function o(e,t){function n(e,r){if(Array.isArray(r)&&!Array.isArray(e))throw new Error("Can't substitute an array for a node");return r=r||{},Object.keys(e).forEach(function(i){function s(e){return"function"==typeof e&&(e=e()),r=r.concat(e)}function o(e){return"function"==typeof e&&(e=e()),r[i]=e,r}if(!(e[i]instanceof Object))return r[i]=e[i];if(Array.isArray(e[i]))return r[i]=n(e[i],[]);var a;if(a=Array.isArray(r)?s:o,"Identifier"===e[i].type&&"$"===e[i].name[0])return a(t[e[i].name.slice(1)]);if("LabeledStatement"===e[i].type&&"$"===e[i].label.name){var u=e[i].body.expression;return a(t[u.name||u.value])}return a("LabeledStatement"===e[i].type&&"$$"===e[i].label.name.slice(0,2)?t[e[i].label.name.slice(2)](n(e[i]).body):n(e[i]))}),r}f[e]||(f[e]=s(e,{noNodentExtensions:!0,locations:!1,ranges:!1,onComment:null}));var r=n(f[e]);return{body:r.body,expr:"ExpressionStatement"===r.body[0].type?r.body[0].expression:null}}var a=e("acorn"),u=e("acorn/dist/walk"),c={AwaitExpression:function(e,t,n){n(e.argument,t,"Expression")},SwitchStatement:function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0;re)return!1;if((n+=t[r+1])>=e)return!0}}function n(e,n){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&k.test(String.fromCharCode(e)):!1!==n&&t(e,_)))}function r(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&A.test(String.fromCharCode(e)):!1!==n&&(t(e,_)||t(e,C)))))}function i(e,t){ +return new L(e,{beforeExpr:!0,binop:t})}function s(e,t){return void 0===t&&(t={}),t.keyword=e,T[e]=new L(e,t)}function o(e){return 10===e||13===e||8232===e||8233===e}function a(e,t){return j.call(e,t)}function u(e,t){for(var n=1,r=0;;){O.lastIndex=r;var i=O.exec(e);if(!(i&&i.index=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),D(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return D(t.onComment)&&(t.onComment=l(t,t.onComment)),t}function l(e,t){return function(n,r,i,s,o,a){var u={type:n?"Block":"Line",value:r,start:i,end:s};e.locations&&(u.loc=new q(this,o,a)),e.ranges&&(u.range=[i,s]),t.push(u)}}function p(e){return new RegExp("^("+e.replace(/ /g,"|")+")$")}function h(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}function f(e,t,n,r){try{return new RegExp(e,t)}catch(e){if(void 0!==n)throw e instanceof SyntaxError&&r.raise(n,"Error parsing regular expression: "+e.message),e}}function d(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function y(e,t){return new W(t,e).parse()}function m(e,t,n){var r=new W(n,e,t);return r.nextToken(),r.parseExpression()}function g(e,t){return new W(t,e)}function v(t,n,r){e.parse_dammit=t,e.LooseParser=n,e.pluginsLoose=r}var b={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},x="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",w={5:x,6:x+" const class extends export import super"},E="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",S="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",k=new RegExp("["+E+"]"),A=new RegExp("["+E+S+"]");E=S=null;var _=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],C=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],L=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},P={beforeExpr:!0},N={startsExpr:!0},T={},F={num:new L("num",N),regexp:new L("regexp",N),string:new L("string",N),name:new L("name",N),eof:new L("eof"),bracketL:new L("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new L("]"),braceL:new L("{",{beforeExpr:!0,startsExpr:!0}),braceR:new L("}"),parenL:new L("(",{beforeExpr:!0,startsExpr:!0}),parenR:new L(")"),comma:new L(",",P),semi:new L(";",P),colon:new L(":",P),dot:new L("."),question:new L("?",P),arrow:new L("=>",P),template:new L("template"),ellipsis:new L("...",P),backQuote:new L("`",N),dollarBraceL:new L("${",{beforeExpr:!0,startsExpr:!0}),eq:new L("=",{beforeExpr:!0,isAssign:!0}),assign:new L("_=",{beforeExpr:!0,isAssign:!0}),incDec:new L("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new L("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=",6),relational:i("",7),bitShift:i("<>",8),plusMin:new L("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),starstar:new L("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",P),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",P),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",P),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",N),_if:s("if"),_return:s("return",P),_switch:s("switch"),_throw:s("throw",P),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",N),_super:s("super",N),_class:s("class"),_extends:s("extends",P),_export:s("export"),_import:s("import"),_null:s("null",N),_true:s("true",N),_false:s("false",N),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},$=/\r\n?|\n|\u2028|\u2029/,O=new RegExp($.source,"g"),B=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,R=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,I=Object.prototype,j=I.hasOwnProperty,M=I.toString,D=Array.isArray||function(e){return"[object Array]"===M.call(e)},V=function(e,t){this.line=e,this.column=t};V.prototype.offset=function(e){return new V(this.line,this.column+e)};var q=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)},U={ecmaVersion:7,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},z={},W=function(e,t,n){this.options=e=c(e),this.sourceFile=e.sourceFile,this.keywords=p(w[e.ecmaVersion>=6?6:5]);var r="";if(!e.allowReserved){for(var i=e.ecmaVersion;!(r=b[i]);i--);"module"==e.sourceType&&(r+=" await")}this.reservedWords=p(r);var s=(r?r+" ":"")+b.strict;this.reservedWordsStrict=p(s),this.reservedWordsStrictBind=p(s+" "+b.strictBind),this.input=String(t),this.containsEsc=!1,this.loadPlugins(e.plugins),n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split($).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=F.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.inFunction=this.inGenerator=this.inAsync=!1,this.yieldPos=this.awaitPos=0,this.labels=[],0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterFunctionScope()};W.prototype.isKeyword=function(e){return this.keywords.test(e)},W.prototype.isReservedWord=function(e){return this.reservedWords.test(e)},W.prototype.extend=function(e,t){this[e]=t(this[e])},W.prototype.loadPlugins=function(e){var t=this;for(var n in e){var r=z[n];if(!r)throw new Error("Plugin '"+n+"' not found");r(t,e[n])}},W.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};var G=W.prototype,J=/^(?:'((?:[^']|\.)*)'|"((?:[^"]|\.)*)"|;)/;G.strictDirective=function(e){for(var t=this;;){R.lastIndex=e,e+=R.exec(t.input)[0].length;var n=J.exec(t.input.slice(e));if(!n)return!1;if("use strict"==(n[1]||n[2]))return!0;e+=n[0].length}},G.eat=function(e){return this.type===e&&(this.next(),!0)},G.isContextual=function(e){return this.type===F.name&&this.value===e},G.eatContextual=function(e){return this.value===e&&this.eat(F.name)},G.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},G.canInsertSemicolon=function(){return this.type===F.eof||this.type===F.braceR||$.test(this.input.slice(this.lastTokEnd,this.start))},G.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},G.semicolon=function(){this.eat(F.semi)||this.insertSemicolon()||this.unexpected()},G.afterTrailingComma=function(e,t){if(this.type==e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},G.expect=function(e){this.eat(e)||this.unexpected()},G.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Y=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=-1};G.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},G.checkExpressionErrors=function(e,t){var n=e?e.shorthandAssign:-1;if(!t)return n>=0;n>-1&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns")},G.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos=6&&(e.sourceType=this.options.sourceType),this.finishNode(e,"Program")};var Z={kind:"loop"},Q={kind:"switch"};H.isLet=function(){if(this.type!==F.name||this.options.ecmaVersion<6||"let"!=this.value)return!1;R.lastIndex=this.pos;var e=R.exec(this.input),t=this.pos+e[0].length,i=this.input.charCodeAt(t);if(91===i||123==i)return!0;if(n(i,!0)){for(var s=t+1;r(this.input.charCodeAt(s),!0);)++s;var o=this.input.slice(t,s);if(!this.isKeyword(o))return!0}return!1},H.isAsyncFunction=function(){if(this.type!==F.name||this.options.ecmaVersion<8||"async"!=this.value)return!1;R.lastIndex=this.pos;var e=R.exec(this.input),t=this.pos+e[0].length;return!($.test(this.input.slice(this.pos,t))||"function"!==this.input.slice(t,t+8)||t+8!=this.input.length&&r(this.input.charAt(t+8)))},H.parseStatement=function(e,t,n){var r,i=this.type,s=this.startNode();switch(this.isLet()&&(i=F._var,r="let"),i){case F._break:case F._continue:return this.parseBreakContinueStatement(s,i.keyword);case F._debugger:return this.parseDebuggerStatement(s);case F._do:return this.parseDoStatement(s);case F._for:return this.parseForStatement(s);case F._function:return!e&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1);case F._class:return e||this.unexpected(),this.parseClass(s,!0);case F._if:return this.parseIfStatement(s);case F._return:return this.parseReturnStatement(s);case F._switch:return this.parseSwitchStatement(s);case F._throw:return this.parseThrowStatement(s);case F._try:return this.parseTryStatement(s);case F._const:case F._var:return r=r||this.value,e||"var"==r||this.unexpected(),this.parseVarStatement(s,r);case F._while:return this.parseWhileStatement(s);case F._with:return this.parseWithStatement(s);case F.braceL:return this.parseBlock();case F.semi:return this.parseEmptyStatement(s);case F._export:case F._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===F._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction()&&e)return this.next(),this.parseFunctionStatement(s,!0);var o=this.value,a=this.parseExpression();return i===F.name&&"Identifier"===a.type&&this.eat(F.colon)?this.parseLabeledStatement(s,o,a):this.parseExpressionStatement(s,a)}},H.parseBreakContinueStatement=function(e,t){var n=this,r="break"==t;this.next(),this.eat(F.semi)||this.insertSemicolon()?e.label=null:this.type!==F.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i=6?this.eat(F.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},H.parseForStatement=function(e){if(this.next(),this.labels.push(Z),this.enterLexicalScope(),this.expect(F.parenL),this.type===F.semi)return this.parseFor(e,null);var t=this.isLet();if(this.type===F._var||this.type===F._const||t){var n=this.startNode(),r=t?"let":this.value;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),!(this.type===F._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==n.declarations.length||"var"!==r&&n.declarations[0].init?this.parseFor(e,n):this.parseForIn(e,n)}var i=new Y,s=this.parseExpression(!0,i);return this.type===F._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.toAssignable(s),this.checkLVal(s),this.checkPatternErrors(i,!0),this.parseForIn(e,s)):(this.checkExpressionErrors(i,!0),this.parseFor(e,s))},H.parseFunctionStatement=function(e,t){return this.next(),this.parseFunction(e,!0,!1,t)},H.isFunction=function(){return this.type===F._function||this.isAsyncFunction()},H.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!this.strict&&this.isFunction()),e.alternate=this.eat(F._else)?this.parseStatement(!this.strict&&this.isFunction()):null,this.finishNode(e,"IfStatement")},H.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(F.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},H.parseSwitchStatement=function(e){var t=this;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(F.braceL),this.labels.push(Q),this.enterLexicalScope();for(var n,r=!1;this.type!=F.braceR;)if(t.type===F._case||t.type===F._default){var i=t.type===F._case;n&&t.finishNode(n,"SwitchCase"),e.cases.push(n=t.startNode()),n.consequent=[],t.next(),i?n.test=t.parseExpression():(r&&t.raiseRecoverable(t.lastTokStart,"Multiple default clauses"),r=!0,n.test=null),t.expect(F.colon)}else n||t.unexpected(),n.consequent.push(t.parseStatement(!0));return this.exitLexicalScope(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},H.parseThrowStatement=function(e){return this.next(),$.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var X=[];H.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===F._catch){var t=this.startNode();this.next(),this.expect(F.parenL),t.param=this.parseBindingAtom(),this.enterLexicalScope(),this.checkLVal(t.param,"let"),this.expect(F.parenR),t.body=this.parseBlock(!1),this.exitLexicalScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(F._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},H.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},H.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Z),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"WhileStatement")},H.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},H.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},H.parseLabeledStatement=function(e,t,n){for(var r=this,i=0;i=0;o--){var a=r.labels[o];if(a.statementStart!=e.start)break;a.statementStart=r.start,a.kind=s}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(!0),("ClassDeclaration"==e.body.type||"VariableDeclaration"==e.body.type&&"var"!=e.body.kind||"FunctionDeclaration"==e.body.type&&(this.strict||e.body.generator))&&this.raiseRecoverable(e.body.start,"Invalid labeled declaration"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},H.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},H.parseBlock=function(e){var t=this;void 0===e&&(e=!0);var n=this.startNode();for(n.body=[],this.expect(F.braceL),e&&this.enterLexicalScope();!this.eat(F.braceR);){var r=t.parseStatement(!0);n.body.push(r)}return e&&this.exitLexicalScope(),this.finishNode(n,"BlockStatement")},H.parseFor=function(e,t){return e.init=t,this.expect(F.semi),e.test=this.type===F.semi?null:this.parseExpression(),this.expect(F.semi),e.update=this.type===F.parenR?null:this.parseExpression(),this.expect(F.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"ForStatement")},H.parseForIn=function(e,t){var n=this.type===F._in?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(F.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,n)},H.parseVar=function(e,t,n){var r=this;for(e.declarations=[],e.kind=n;;){var i=r.startNode();if(r.parseVarId(i,n),r.eat(F.eq)?i.init=r.parseMaybeAssign(t):"const"!==n||r.type===F._in||r.options.ecmaVersion>=6&&r.isContextual("of")?"Identifier"==i.id.type||t&&(r.type===F._in||r.isContextual("of"))?i.init=null:r.raise(r.lastTokEnd,"Complex binding patterns require an initialization value"):r.unexpected(),e.declarations.push(r.finishNode(i,"VariableDeclarator")),!r.eat(F.comma))break}return e},H.parseVarId=function(e,t){e.id=this.parseBindingAtom(t),this.checkLVal(e.id,t,!1)},H.parseFunction=function(e,t,n,r){this.initFunction(e),this.options.ecmaVersion>=6&&!r&&(e.generator=this.eat(F.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&&(e.id="nullableID"===t&&this.type!=F.name?null:this.parseIdent(),e.id&&this.checkLVal(e.id,"var"));var i=this.inGenerator,s=this.inAsync,o=this.yieldPos,a=this.awaitPos,u=this.inFunction;return this.inGenerator=e.generator,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),t||(e.id=this.type==F.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n),this.inGenerator=i,this.inAsync=s,this.yieldPos=o,this.awaitPos=a,this.inFunction=u,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},H.parseFunctionParams=function(e){this.expect(F.parenL),e.params=this.parseBindingList(F.parenR,!1,this.options.ecmaVersion>=8,!0),this.checkYieldAwaitInDefaultParams()},H.parseClass=function(e,t){var n=this;this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var r=this.startNode(),i=!1;for(r.body=[],this.expect(F.braceL);!this.eat(F.braceR);)if(!n.eat(F.semi)){var s=n.startNode(),o=n.eat(F.star),a=!1,u=n.type===F.name&&"static"===n.value;n.parsePropertyName(s),s.static=u&&n.type!==F.parenL,s.static&&(o&&n.unexpected(),o=n.eat(F.star),n.parsePropertyName(s)),n.options.ecmaVersion>=8&&!o&&!s.computed&&"Identifier"===s.key.type&&"async"===s.key.name&&n.type!==F.parenL&&!n.canInsertSemicolon()&&(a=!0,n.parsePropertyName(s)),s.kind="method";var c=!1;if(!s.computed){var l=s.key;o||a||"Identifier"!==l.type||n.type===F.parenL||"get"!==l.name&&"set"!==l.name||(c=!0,s.kind=l.name,l=n.parsePropertyName(s)),!s.static&&("Identifier"===l.type&&"constructor"===l.name||"Literal"===l.type&&"constructor"===l.value)&&(i&&n.raise(l.start,"Duplicate constructor in the same class"),c&&n.raise(l.start,"Constructor can't have get/set modifier"),o&&n.raise(l.start,"Constructor can't be a generator"),a&&n.raise(l.start,"Constructor can't be an async method"),s.kind="constructor",i=!0)}if(n.parseClassMethod(r,s,o,a),c){var p="get"===s.kind?0:1;if(s.value.params.length!==p){var h=s.value.start;"get"===s.kind?n.raiseRecoverable(h,"getter should have no params"):n.raiseRecoverable(h,"setter should have exactly one param")}else"set"===s.kind&&"RestElement"===s.value.params[0].type&&n.raiseRecoverable(s.value.params[0].start,"Setter cannot use rest params")}}return e.body=this.finishNode(r,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},H.parseClassMethod=function(e,t,n,r){t.value=this.parseMethod(n,r),e.body.push(this.finishNode(t,"MethodDefinition"))},H.parseClassId=function(e,t){e.id=this.type===F.name?this.parseIdent():!0===t?this.unexpected():null},H.parseClassSuper=function(e){e.superClass=this.eat(F._extends)?this.parseExprSubscripts():null},H.parseExport=function(e,t){var n=this;if(this.next(),this.eat(F.star))return this.expectContextual("from"),e.source=this.type===F.string?this.parseExprAtom():this.unexpected(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration");if(this.eat(F._default)){this.checkExport(t,"default",this.lastTokStart);var r;if(this.type===F._function||(r=this.isAsyncFunction())){var i=this.startNode();this.next(),r&&this.next(),e.declaration=this.parseFunction(i,"nullableID",!1,r)}else if(this.type===F._class){var s=this.startNode();e.declaration=this.parseClass(s,"nullableID")}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(!0),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))e.source=this.type===F.string?this.parseExprAtom():this.unexpected();else{for(var o=0;o=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Can not use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var r=0;r=6&&(e.computed||e.method||e.shorthand))){var n,r=e.key;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===n&&"init"===i&&(t.proto&&this.raiseRecoverable(r.start,"Redefinition of __proto__ property"),t.proto=!0));n="$"+n;var s=t[n];if(s){var o;o="init"===i?this.strict&&s.init||s.get||s.set:s.init||s[i],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[n]={init:!1,get:!1,set:!1};s[i]=!0}},ee.parseExpression=function(e,t){var n=this,r=this.start,i=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===F.comma){var o=this.startNodeAt(r,i);for(o.expressions=[s];this.eat(F.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return this.finishNode(o,"SequenceExpression")}return s},ee.parseMaybeAssign=function(e,t,n){if(this.inGenerator&&this.isContextual("yield"))return this.parseYield();var r=!1,i=-1,s=-1;t?(i=t.parenthesizedAssign,s=t.trailingComma,t.parenthesizedAssign=t.trailingComma=-1):(t=new Y,r=!0);var o=this.start,a=this.startLoc;this.type!=F.parenL&&this.type!=F.name||(this.potentialArrowAt=this.start);var u=this.parseMaybeConditional(e,t);if(n&&(u=n.call(this,u,o,a)),this.type.isAssign){this.checkPatternErrors(t,!0),r||Y.call(t);var c=this.startNodeAt(o,a);return c.operator=this.value,c.left=this.type===F.eq?this.toAssignable(u):u,t.shorthandAssign=-1,this.checkLVal(u),this.next(),c.right=this.parseMaybeAssign(e),this.finishNode(c,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),s>-1&&(t.trailingComma=s),u},ee.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(F.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(F.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return i},ee.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1);return this.checkExpressionErrors(t)?i:i.start==n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,e)},ee.parseExprOp=function(e,t,n,r,i){var s=this.type.binop;if(null!=s&&(!i||this.type!==F._in)&&s>r){var o=this.type===F.logicalOR||this.type===F.logicalAND,a=this.value;this.next();var u=this.start,c=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1),u,c,s,i),p=this.buildBinary(t,n,e,l,a,o);return this.parseExprOp(p,t,n,r,i)}return e},ee.buildBinary=function(e,t,n,r,i,s){var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")},ee.parseMaybeUnary=function(e,t){var n,r=this,i=this.start,s=this.startLoc;if(this.inAsync&&this.isContextual("await"))n=this.parseAwait(e),t=!0;else if(this.type.prefix){var o=this.startNode(),a=this.type===F.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),a?this.checkLVal(o.argument):this.strict&&"delete"===o.operator&&"Identifier"===o.argument.type?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):t=!0,n=this.finishNode(o,a?"UpdateExpression":"UnaryExpression")}else{if(n=this.parseExprSubscripts(e),this.checkExpressionErrors(e))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=r.startNodeAt(i,s);u.operator=r.value,u.prefix=!1,u.argument=n,r.checkLVal(n),r.next(),n=r.finishNode(u,"UpdateExpression")}}return!t&&this.eat(F.starstar)?this.buildBinary(i,s,n,this.parseMaybeUnary(null,!1),"**",!1):n},ee.parseExprSubscripts=function(e){var t=this.start,n=this.startLoc,r=this.parseExprAtom(e),i="ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd);if(this.checkExpressionErrors(e)||i)return r;var s=this.parseSubscripts(r,t,n);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1)),s},ee.parseSubscripts=function(e,t,n,r){for(var i,s=this,o=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd==e.end&&!this.canInsertSemicolon();;)if((i=s.eat(F.bracketL))||s.eat(F.dot)){var a=s.startNodeAt(t,n);a.object=e,a.property=i?s.parseExpression():s.parseIdent(!0),a.computed=!!i,i&&s.expect(F.bracketR),e=s.finishNode(a,"MemberExpression")}else if(!r&&s.eat(F.parenL)){var u=new Y,c=s.yieldPos,l=s.awaitPos;s.yieldPos=0,s.awaitPos=0;var p=s.parseExprList(F.parenR,s.options.ecmaVersion>=8,!1,u);if(o&&!s.canInsertSemicolon()&&s.eat(F.arrow))return s.checkPatternErrors(u,!1),s.checkYieldAwaitInDefaultParams(),s.yieldPos=c,s.awaitPos=l,s.parseArrowExpression(s.startNodeAt(t,n),p,!0);s.checkExpressionErrors(u,!0),s.yieldPos=c||s.yieldPos,s.awaitPos=l||s.awaitPos;var h=s.startNodeAt(t,n);h.callee=e,h.arguments=p,e=s.finishNode(h,"CallExpression")}else{if(s.type!==F.backQuote)return e;var f=s.startNodeAt(t,n);f.tag=e,f.quasi=s.parseTemplate(),e=s.finishNode(f,"TaggedTemplateExpression")}},ee.parseExprAtom=function(e){var t,n=this.potentialArrowAt==this.start;switch(this.type){case F._super:this.inFunction||this.raise(this.start,"'super' outside of function or class");case F._this:var r=this.type===F._this?"ThisExpression":"Super";return t=this.startNode(),this.next(),this.finishNode(t,r);case F.name:var i=this.start,s=this.startLoc,o=this.parseIdent(this.type!==F.name);if(this.options.ecmaVersion>=8&&"async"===o.name&&!this.canInsertSemicolon()&&this.eat(F._function))return this.parseFunction(this.startNodeAt(i,s),!1,!1,!0);if(n&&!this.canInsertSemicolon()){if(this.eat(F.arrow))return this.parseArrowExpression(this.startNodeAt(i,s),[o],!1);if(this.options.ecmaVersion>=8&&"async"===o.name&&this.type===F.name)return o=this.parseIdent(),!this.canInsertSemicolon()&&this.eat(F.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,s),[o],!0)}return o;case F.regexp:var a=this.value;return t=this.parseLiteral(a.value),t.regex={pattern:a.pattern,flags:a.flags},t;case F.num:case F.string:return this.parseLiteral(this.value);case F._null:case F._true:case F._false:return t=this.startNode(),t.value=this.type===F._null?null:this.type===F._true,t.raw=this.type.keyword,this.next(),this.finishNode(t,"Literal");case F.parenL:var u=this.start,c=this.parseParenAndDistinguishExpression(n);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),c;case F.bracketL:return t=this.startNode(),this.next(),t.elements=this.parseExprList(F.bracketR,!0,!0,e),this.finishNode(t,"ArrayExpression");case F.braceL:return this.parseObj(!1,e);case F._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case F._class:return this.parseClass(this.startNode(),!1);case F._new:return this.parseNew();case F.backQuote:return this.parseTemplate();default:this.unexpected()}},ee.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(t,"Literal")},ee.parseParenExpression=function(){this.expect(F.parenL);var e=this.parseExpression();return this.expect(F.parenR),e},ee.parseParenAndDistinguishExpression=function(e){var t,n=this,r=this.start,i=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o,a,u=this.start,c=this.startLoc,l=[],p=!0,h=!1,f=new Y,d=this.yieldPos,y=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==F.parenR;){if(p?p=!1:n.expect(F.comma),s&&n.afterTrailingComma(F.parenR,!0)){h=!0;break}if(n.type===F.ellipsis){o=n.start,l.push(n.parseParenItem(n.parseRest())),n.type===F.comma&&n.raise(n.start,"Comma is not permitted after the rest element");break}n.type!==F.parenL||a||(a=n.start),l.push(n.parseMaybeAssign(!1,f,n.parseParenItem))}var m=this.start,g=this.startLoc;if(this.expect(F.parenR),e&&!this.canInsertSemicolon()&&this.eat(F.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),a&&this.unexpected(a),this.yieldPos=d,this.awaitPos=y,this.parseParenArrowList(r,i,l);l.length&&!h||this.unexpected(this.lastTokStart),o&&this.unexpected(o),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=y||this.awaitPos,l.length>1?(t=this.startNodeAt(u,c),t.expressions=l,this.finishNodeAt(t,"SequenceExpression",m,g)):t=l[0]}else t=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(r,i);return v.expression=t,this.finishNode(v,"ParenthesizedExpression")}return t},ee.parseParenItem=function(e){return e},ee.parseParenArrowList=function(e,t,n){return this.parseArrowExpression(this.startNodeAt(e,t),n)};var te=[];ee.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(F.dot))return e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is new.target"),this.inFunction||this.raiseRecoverable(e.start,"new.target can only be used in functions"),this.finishNode(e,"MetaProperty");var n=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(),n,r,!0),this.eat(F.parenL)?e.arguments=this.parseExprList(F.parenR,this.options.ecmaVersion>=8,!1):e.arguments=te,this.finishNode(e,"NewExpression")},ee.parseTemplateElement=function(){var e=this.startNode();return e.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),e.tail=this.type===F.backQuote,this.finishNode(e,"TemplateElement")},ee.parseTemplate=function(){var e=this,t=this.startNode();this.next(),t.expressions=[];var n=this.parseTemplateElement();for(t.quasis=[n];!n.tail;)e.expect(F.dollarBraceL),t.expressions.push(e.parseExpression()),e.expect(F.braceR),t.quasis.push(n=e.parseTemplateElement());return this.next(),this.finishNode(t,"TemplateLiteral")},ee.parseObj=function(e,t){var n=this,r=this.startNode(),i=!0,s={};for(r.properties=[],this.next();!this.eat(F.braceR);){if(i)i=!1;else if(n.expect(F.comma),n.afterTrailingComma(F.braceR))break;var o,a,u,c,l=n.startNode();n.options.ecmaVersion>=6&&(l.method=!1,l.shorthand=!1,(e||t)&&(u=n.start,c=n.startLoc),e||(o=n.eat(F.star))),n.parsePropertyName(l),e||!(n.options.ecmaVersion>=8)||o||l.computed||"Identifier"!==l.key.type||"async"!==l.key.name||n.type===F.parenL||n.type===F.colon||n.canInsertSemicolon()?a=!1:(a=!0,n.parsePropertyName(l,t)),n.parsePropertyValue(l,e,o,a,u,c,t),n.checkPropClash(l,s),r.properties.push(n.finishNode(l,"Property"))}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},ee.parsePropertyValue=function(e,t,n,r,i,s,o){if((n||r)&&this.type===F.colon&&this.unexpected(),this.eat(F.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init";else if(this.options.ecmaVersion>=6&&this.type===F.parenL)t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,r);else if(this.options.ecmaVersion>=5&&!e.computed&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)&&this.type!=F.comma&&this.type!=F.braceR){(n||r||t)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var a="get"===e.kind?0:1;if(e.value.params.length!==a){var u=e.value.start;"get"===e.kind?this.raiseRecoverable(u,"getter should have no params"):this.raiseRecoverable(u,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")}else this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((this.keywords.test(e.key.name)||(this.strict?this.reservedWordsStrict:this.reservedWords).test(e.key.name)||this.inGenerator&&"yield"==e.key.name||this.inAsync&&"await"==e.key.name)&&this.raiseRecoverable(e.key.start,"'"+e.key.name+"' can not be used as shorthand property"),e.kind="init",t?e.value=this.parseMaybeDefault(i,s,e.key):this.type===F.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,s,e.key)):e.value=e.key,e.shorthand=!0):this.unexpected()},ee.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(F.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(F.bracketR),e.key;e.computed=!1}return e.key=this.type===F.num||this.type===F.string?this.parseExprAtom():this.parseIdent(!0)},ee.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},ee.parseMethod=function(e,t){var n=this.startNode(),r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.inGenerator=n.generator,this.inAsync=n.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),this.expect(F.parenL),n.params=this.parseBindingList(F.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(n,"FunctionExpression")},ee.parseArrowExpression=function(e,t,n){var r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.enterFunctionScope(),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.inGenerator=!1,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(e,"ArrowFunctionExpression")},ee.parseFunctionBody=function(e,t){var n=t&&this.type!==F.braceL,r=this.strict,i=!1;if(n)e.body=this.parseMaybeAssign(),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);r&&!s||(i=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var o=this.labels;this.labels=[],i&&(this.strict=!0),this.checkParams(e,!r&&!i&&!t&&this.isSimpleParamList(e.params)),e.body=this.parseBlock(!1),e.expression=!1,this.labels=o}this.exitFunctionScope(),this.strict&&e.id&&this.checkLVal(e.id,"none"),this.strict=r},ee.isSimpleParamList=function(e){for(var t=0;t=6||-1==this.input.slice(this.start,this.end).indexOf("\\"))&&this.raiseRecoverable(this.start,"The keyword '"+this.value+"' is reserved"),this.inGenerator&&"yield"===this.value&&this.raiseRecoverable(this.start,"Can not use 'yield' as identifier inside a generator"),this.inAsync&&"await"===this.value&&this.raiseRecoverable(this.start,"Can not use 'await' as identifier inside an async function"),t.name=this.value):e&&this.type.keyword?t.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"Identifier")},ee.parseYield=function(){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type==F.semi||this.canInsertSemicolon()||this.type!=F.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(F.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")},ee.parseAwait=function(){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0),this.finishNode(e,"AwaitExpression")};var ne=W.prototype;ne.raise=function(e,t){var n=u(this.input,e);t+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},ne.raiseRecoverable=ne.raise,ne.curPosition=function(){if(this.options.locations)return new V(this.curLine,this.pos-this.lineStart)};var re=W.prototype,ie=Object.assign||function(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];for(var r=0;r=0;t--)if(e.context[t].generator)return!0;return!1},ce.updateContext=function(e){var t,n=this.type;n.keyword&&e==F.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},F.parenR.updateContext=F.braceR.updateContext=function(){if(1==this.context.length)return void(this.exprAllowed=!0);var e,t=this.context.pop();t===ue.b_stat&&(e=this.curContext())&&"function"===e.token?(this.context.pop(),this.exprAllowed=!1):t===ue.b_tmpl?this.exprAllowed=!0:this.exprAllowed=!t.isExpr},F.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?ue.b_stat:ue.b_expr),this.exprAllowed=!0},F.dollarBraceL.updateContext=function(){this.context.push(ue.b_tmpl),this.exprAllowed=!0},F.parenL.updateContext=function(e){var t=e===F._if||e===F._for||e===F._with||e===F._while;this.context.push(t?ue.p_stat:ue.p_expr),this.exprAllowed=!0},F.incDec.updateContext=function(){},F._function.updateContext=function(e){e.beforeExpr&&e!==F.semi&&e!==F._else&&(e!==F.colon&&e!==F.braceL||this.curContext()!==ue.b_stat)&&this.context.push(ue.f_expr),this.exprAllowed=!1},F.backQuote.updateContext=function(){this.curContext()===ue.q_tmpl?this.context.pop():this.context.push(ue.q_tmpl),this.exprAllowed=!1},F.star.updateContext=function(e){e==F._function&&(this.curContext()===ue.f_expr?this.context[this.context.length-1]=ue.f_expr_gen:this.context.push(ue.f_gen)),this.exprAllowed=!0},F.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&("of"==this.value&&!this.exprAllowed||"yield"==this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var le=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new q(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},pe=W.prototype,he="object"==typeof Packages&&"[object JavaPackage]"==Object.prototype.toString.call(Packages);pe.next=function(){this.options.onToken&&this.options.onToken(new le(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},pe.getToken=function(){return this.next(),new le(this)},"undefined"!=typeof Symbol&&(pe[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===F.eof,value:t}}}}),pe.curContext=function(){return this.context[this.context.length-1]},pe.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(F.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},pe.readToken=function(e){return n(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},pe.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);return e<=55295||e>=57344?e:(e<<10)+this.input.charCodeAt(this.pos+1)-56613888},pe.skipBlockComment=function(){var e=this,t=this.options.onComment&&this.curPosition(),n=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations){O.lastIndex=n;for(var i;(i=O.exec(this.input))&&i.index8&&t<14||t>=5760&&B.test(String.fromCharCode(t))))break e;++e.pos}}},pe.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},pe.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(F.ellipsis)):(++this.pos,this.finishToken(F.dot))},pe.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(F.assign,2):this.finishOp(F.slash,1)},pe.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=42===e?F.star:F.modulo;return this.options.ecmaVersion>=7&&42===t&&(++n,r=F.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(F.assign,n+1):this.finishOp(r,n)},pe.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.finishOp(124===e?F.logicalOR:F.logicalAND,2):61===t?this.finishOp(F.assign,2):this.finishOp(124===e?F.bitwiseOR:F.bitwiseAND,1)},pe.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(F.assign,2):this.finishOp(F.bitwiseXOR,1)},pe.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45==t&&62==this.input.charCodeAt(this.pos+2)&&$.test(this.input.slice(this.lastTokEnd,this.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(F.incDec,2):61===t?this.finishOp(F.assign,2):this.finishOp(F.plusMin,1)},pe.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(F.assign,n+1):this.finishOp(F.bitShift,n)):33==t&&60==e&&45==this.input.charCodeAt(this.pos+2)&&45==this.input.charCodeAt(this.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(n=2),this.finishOp(F.relational,n))},pe.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(F.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(F.arrow)):this.finishOp(61===e?F.eq:F.prefix,1)},pe.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(F.parenL);case 41:return++this.pos,this.finishToken(F.parenR);case 59:return++this.pos,this.finishToken(F.semi);case 44:return++this.pos,this.finishToken(F.comma);case 91:return++this.pos,this.finishToken(F.bracketL);case 93:return++this.pos,this.finishToken(F.bracketR);case 123:return++this.pos,this.finishToken(F.braceL);case 125:return++this.pos,this.finishToken(F.braceR);case 58:return++this.pos,this.finishToken(F.colon);case 63:return++this.pos,this.finishToken(F.question);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(F.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(F.prefix,1)}this.raise(this.pos,"Unexpected character '"+d(e)+"'")},pe.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)};var fe=!!f("￿","u");pe.readRegexp=function(){for(var e,t,n=this,r=this.pos;;){n.pos>=n.input.length&&n.raise(r,"Unterminated regular expression");var i=n.input.charAt(n.pos);if($.test(i)&&n.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++n.pos}var s=this.input.slice(r,this.pos);++this.pos;var o=this.readWord1(),a=s,u="";if(o){var c=/^[gim]*$/;this.options.ecmaVersion>=6&&(c=/^[gimuy]*$/),c.test(o)||this.raise(r,"Invalid regular expression flag"),o.indexOf("u")>=0&&(fe?u="u":(a=a.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t,i){return t=Number("0x"+t),t>1114111&&n.raise(r+i+3,"Code point out of bounds"),"x"}),a=a.replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"),u=u.replace("u","")))}var l=null;return he||(f(a,u,r,this),l=f(s,o)),this.finishToken(F.regexp,{pattern:s,flags:o,value:l})},pe.readInt=function(e,t){for(var n=this,r=this.pos,i=0,s=0,o=null==t?1/0:t;s=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0)>=e)break;++n.pos,i=i*e+a}return this.pos===r||null!=t&&this.pos-r!==t?null:i},pe.readRadixNumber=function(e){this.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.start+2,"Expected number in radix "+e),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(F.num,t)},pe.readNumber=function(e){var t=this.pos,r=!1,i=48===this.input.charCodeAt(this.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number"),i&&this.pos==t+1&&(i=!1);var s=this.input.charCodeAt(this.pos);46!==s||i||(++this.pos,this.readInt(10),r=!0,s=this.input.charCodeAt(this.pos)),69!==s&&101!==s||i||(s=this.input.charCodeAt(++this.pos),43!==s&&45!==s||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o,a=this.input.slice(t,this.pos);return r?o=parseFloat(a):i&&1!==a.length?/[89]/.test(a)||this.strict?this.raise(t,"Invalid number"):o=parseInt(a,8):o=parseInt(a,10),this.finishToken(F.num,o)},pe.readCodePoint=function(){var e,t=this.input.charCodeAt(this.pos);if(123===t){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.raise(n,"Code point out of bounds")}else e=this.readHexChar(4);return e},pe.readString=function(e){for(var t=this,n="",r=++this.pos;;){t.pos>=t.input.length&&t.raise(t.start,"Unterminated string constant");var i=t.input.charCodeAt(t.pos);if(i===e)break;92===i?(n+=t.input.slice(r,t.pos),n+=t.readEscapedChar(!1),r=t.pos):(o(i)&&t.raise(t.start,"Unterminated string constant"),++t.pos)}return n+=this.input.slice(r,this.pos++),this.finishToken(F.string,n)},pe.readTmplToken=function(){for(var e=this,t="",n=this.pos;;){e.pos>=e.input.length&&e.raise(e.start,"Unterminated template");var r=e.input.charCodeAt(e.pos);if(96===r||36===r&&123===e.input.charCodeAt(e.pos+1))return e.pos===e.start&&e.type===F.template?36===r?(e.pos+=2,e.finishToken(F.dollarBraceL)):(++e.pos,e.finishToken(F.backQuote)):(t+=e.input.slice(n,e.pos),e.finishToken(F.template,t));if(92===r)t+=e.input.slice(n,e.pos),t+=e.readEscapedChar(!0),n=e.pos;else if(o(r)){switch(t+=e.input.slice(n,e.pos),++e.pos,r){case 13:10===e.input.charCodeAt(e.pos)&&++e.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(r)}e.options.locations&&(++e.curLine,e.lineStart=e.pos),n=e.pos}else++e.pos}},pe.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return d(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(n,8);return r>255&&(n=n.slice(0,-1),r=parseInt(n,8)),"0"!==n&&(this.strict||e)&&this.raise(this.pos-2,"Octal literal in strict mode"), +this.pos+=n.length-1,String.fromCharCode(r)}return String.fromCharCode(t)}},pe.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.raise(t,"Bad character escape sequence"),n},pe.readWord1=function(){var e=this;this.containsEsc=!1;for(var t="",i=!0,s=this.pos,o=this.options.ecmaVersion>=6;this.pos=r)&&o[u](t,i,e),(null==n||t.start==n)&&(null==r||t.end==r)&&s(u,t))throw new h(t,i)}(t,a)}catch(e){if(e instanceof h)return e;throw e}}function o(t,n,r,s,o){r=i(r),s||(s=e.base);try{!function e(t,i,o){var a=o||t.type;if(!(t.start>n||t.end=n&&r(a,t))throw new h(t,i);s[a](t,i,e)}}(t,o)}catch(e){if(e instanceof h)return e;throw e}}function u(t,n,r,s,o){r=i(r),s||(s=e.base);var a;return function e(t,i,o){if(!(t.start>n)){var u=o||t.type;t.end<=n&&(!a||a.node.end=0&&e>1;return t?-n:n}var s=e("./base64");n.encode=function(e){var t,n="",i=r(e);do{t=31&i,i>>>=5,i>0&&(t|=32),n+=s.encode(t)}while(i>0);return n},n.decode=function(e,t,n){var r,o,a=e.length,u=0,c=0;do{if(t>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=s.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));r=!!(32&o),o&=31,u+=o<0?t-u>1?r(u,t,i,s,o,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,i,s,o,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,i,s){if(0===t.length)return-1;var o=r(-1,t.length,e,t,i,s||n.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(t[o],t[o-1],!0);)--o;return o}},{}],21:[function(e,t,n){function r(e,t){var n=e.generatedLine,r=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return r>n||r==n&&o>=i||s.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var s=e("./util");i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){r(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(s.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=i},{"./util":26}],22:[function(e,t,n){function r(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function i(e,t){return Math.round(e+Math.random()*(t-e))}function s(e,t,n,o){if(n=0){var s=this._originalMappings[i];if(void 0===e.column)for(var o=s.originalLine;s&&s.originalLine===o;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var c=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==c;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return r},n.SourceMapConsumer=r,i.prototype=Object.create(r.prototype),i.prototype.consumer=r,i.fromSourceMap=function(e){var t=Object.create(i.prototype),n=t._names=c.fromArray(e._names.toArray(),!0),r=t._sources=c.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var o=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],h=0,f=o.length;h1&&(n.source=y+i[1],y+=i[1],n.originalLine=f+i[2],f=n.originalLine,n.originalLine+=1,n.originalColumn=d+i[3],d=n.originalColumn,i.length>4&&(n.name=m+i[4],m+=i[4])),E.push(n),"number"==typeof n.originalLine&&w.push(n)}p(E,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=E,p(w,a.compareByOriginalPositions),this.__originalMappings=w},i.prototype._findMapping=function(e,t,n,r,i,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[n];if(i.generatedLine===t.generatedLine){var s=a.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=a.join(this.sourceRoot,s)));var o=a.getArg(i,"name",null);return null!==o&&(o=this._names.at(o)),{source:s,line:a.getArg(i,"originalLine",null),column:a.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){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 n;if(null!=this.sourceRoot&&(n=a.urlParse(this.sourceRoot))){var r=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=a.getArg(e,"source");if(null!=this.sourceRoot&&(t=a.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};t=this._sources.indexOf(t);var n={source:t,originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",r.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===n.source)return{line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=i,o.prototype=Object.create(r.prototype),o.prototype.constructor=r,o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){for(var e=[],t=0;t0&&e.column>=0)||t||n||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},r.prototype._serializeMappings=function(){for(var e,t,n,r,o=0,a=1,u=0,c=0,l=0,p=0,h="",f=this._mappings.toArray(),d=0,y=f.length;d0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(r=this._sources.indexOf(t.source),e+=i.encode(r-p),p=r,e+=i.encode(t.originalLine-1-c),c=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=i.encode(n-l),l=n)),h+=e}return h},r.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var n=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)},r.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},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=r},{"./array-set":17,"./base64-vlq":18,"./mapping-list":21,"./util":26}],25:[function(e,t,n){function r(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==i?null:i,this[o]=!0,null!=r&&this.add(r)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),o="$$$isSourceNode$$$";r.fromStringWithSourceMap=function(e,t,n){function i(e,t){if(null===e||void 0===e.source)o.add(t);else{var i=n?s.join(n,e.source):e.source;o.add(new r(e.originalLine,e.originalColumn,i,t,e.name))}}var o=new r,a=e.split(/(\r?\n)/),u=function(){return a.shift()+(a.shift()||"")},c=1,l=0,p=null;return t.eachMapping(function(e){if(null!==p){if(!(c0&&(p&&i(p,u()),o.add(a.join(""))),t.sources.forEach(function(e){var r=t.sourceContentFor(e);null!=r&&(null!=n&&(e=s.join(n,e)),o.setSourceContent(e,r))}),o},r.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},r.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[o]&&"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},r.prototype.walk=function(e){for(var t,n=0,r=this.children.length;n0){for(t=[],n=0;n=0;l--)o=u[l],"."===o?u.splice(l,1):".."===o?c++:c>0&&(""===o?(u.splice(l+1,c),c=0):(u.splice(l,2),c--));return t=u.join("/"),""===t&&(t=a?"/":"."),r?(r.path=t,s(r)):t}function a(e,t){""===e&&(e="."),""===t&&(t=".");var n=i(t),r=i(e);if(r&&(e=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),s(n);if(n||t.match(v))return t;if(r&&!r.host&&!r.path)return r.host=t,s(r);var a="/"===t.charAt(0)?t:o(e.replace(/\/+$/,"")+"/"+t);return r?(r.path=a,s(r)):a}function u(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)}function c(e){return e}function l(e){return h(e)?"$"+e:e}function p(e){return h(e)?e.slice(1):e}function h(e){if(!e)return!1;var t=e.length;if(t<9)return!1 +;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function f(e,t,n){var r=e.source-t.source;return 0!==r?r:0!==(r=e.originalLine-t.originalLine)?r:0!==(r=e.originalColumn-t.originalColumn)||n?r:0!==(r=e.generatedColumn-t.generatedColumn)?r:(r=e.generatedLine-t.generatedLine,0!==r?r:e.name-t.name)}function d(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!==(r=e.generatedColumn-t.generatedColumn)||n?r:0!==(r=e.source-t.source)?r:0!==(r=e.originalLine-t.originalLine)?r:(r=e.originalColumn-t.originalColumn,0!==r?r:e.name-t.name)}function y(e,t){return e===t?0:e>t?1:-1}function m(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!==(n=e.generatedColumn-t.generatedColumn)?n:0!==(n=y(e.source,t.source))?n:0!==(n=e.originalLine-t.originalLine)?n:(n=e.originalColumn-t.originalColumn,0!==n?n:y(e.name,t.name))}n.getArg=r;var g=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,v=/^data:.+\,.+$/;n.urlParse=i,n.urlGenerate=s,n.normalize=o,n.join=a,n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(g)},n.relative=u;var b=function(){return!("__proto__"in Object.create(null))}();n.toSetString=b?c:l,n.fromSetString=b?c:p,n.compareByOriginalPositions=f,n.compareByGeneratedPositionsDeflated=d,n.compareByGeneratedPositionsInflated=m},{}],27:[function(e,t,n){n.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,n.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,n.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":23,"./lib/source-map-generator":24,"./lib/source-node":25}],28:[function(e,t,n){t.exports={_args:[[{raw:"nodent@^3.0.17",scope:null,escapedName:"nodent",name:"nodent",rawSpec:"^3.0.17",spec:">=3.0.17 <4.0.0",type:"range"},"/Users/evgenypoberezkin/JSON/ajv-v4"]],_from:"nodent@>=3.0.17 <4.0.0",_id:"nodent@3.0.17",_inCache:!0,_location:"/nodent",_nodeVersion:"6.9.1",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/nodent-3.0.17.tgz_1490780005669_0.5196401283610612"},_npmUser:{name:"matatbread",email:"npm@mailed.me.uk"},_npmVersion:"3.10.8",_phantomChildren:{},_requested:{raw:"nodent@^3.0.17",scope:null,escapedName:"nodent",name:"nodent",rawSpec:"^3.0.17",spec:">=3.0.17 <4.0.0",type:"range"},_requiredBy:["#DEV:/"],_resolved:"https://registry.npmjs.org/nodent/-/nodent-3.0.17.tgz",_shasum:"22df57d33c5346d6acc3722d9d69fa68bff518e4",_shrinkwrap:null,_spec:"nodent@^3.0.17",_where:"/Users/evgenypoberezkin/JSON/ajv-v4",author:{name:"Mat At Bread",email:"nodent@mailed.me.uk"},bin:{nodentjs:"./nodent.js"},bugs:{url:"https://github.com/MatAtBread/nodent/issues"},dependencies:{acorn:">=2.5.2","acorn-es7-plugin":">=1.1.6","nodent-runtime":">=3.0.4",resolve:"^1.2.0","source-map":"^0.5.6"},description:"NoDent - Asynchronous Javascript language extensions",devDependencies:{},directories:{},dist:{shasum:"22df57d33c5346d6acc3722d9d69fa68bff518e4",tarball:"https://registry.npmjs.org/nodent/-/nodent-3.0.17.tgz"},engines:"node >= 0.10.0",gitHead:"1a48bd0e8d0b4df69aa7b4b3cf8483c03c1cfbd5",homepage:"https://github.com/MatAtBread/nodent#readme",keywords:["Javascript","ES7","async","await","language","extensions","Node","callback","generator","Promise","asynchronous"],license:"BSD-2-Clause",main:"nodent.js",maintainers:[{name:"matatbread",email:"npm@mailed.me.uk"}],name:"nodent",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/MatAtBread/nodent.git"},scripts:{cover:"istanbul cover ./nodent.js tests -- --quick --syntax ; open ./coverage/lcov-report/index.html",start:"./nodent.js",test:"cd tests && npm i --prod && cd .. && node --expose-gc ./nodent.js tests --syntax --quick && node --expose-gc ./nodent.js tests --quick --notStrict","test-loader":"cd tests/loader/app && npm test && cd ../../.."},version:"3.0.17"}},{}],29:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),s="/"===o(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u1)for(var n=1;n=(t[n]||0))return!0;return!1}(o))for(var a=0;a"))}return o.promises||o.es7||o.generators||o.engine?((o.promises||o.es7)&&o.generators&&(n("No valid 'use nodent' directive, assumed -es7 mode"),o=I.es7),(o.generators||o.engine)&&(o.promises=!0),o.promises&&(o.es7=!0),o):null}function y(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),"#!"===e.substring(0,2)&&(e="//"+e),e}function m(e){var t;return t=e instanceof i?e:new i(e.toString(),"binary"),t.toString("base64")}function g(e,t){return t=t||e.log,function(n,r,i){var s=y(N.readFileSync(r,"utf8")),o=e.parse(s,r,i);i=i||d(o.ast,t,r),e.asynchronize(o,void 0,i,t),e.prettyPrint(o,i),n._compile(o.code,o.filename)}}function v(e){return e=e||q,function(t,n,r){if(Array.isArray(n)){var i=n;n=function(e,t){return i.indexOf(e)>=0}}else n=n||function(e,t){return!(e.match(/Sync$/)&&e.replace(/Sync$/,"")in t)};r||(r="");var s=Object.create(t);for(var o in s)!function(){var i=o;try{"function"!=typeof t[i]||s[i+r]&&s[i+r].isAsync||!n(i,s)||(s[i+r]=function(){var n=Array.prototype.slice.call(arguments);return new e(function(e,r){var s=function(t,n){if(t)return r(t);switch(arguments.length){case 0:return e();case 2:return e(n);default:return e(Array.prototype.slice.call(arguments,1))}};n.length>t[i].length?n.push(s):n[t[i].length-1]=s;t[i].apply(t,n)})},s[i+r].isAsync=!0)}catch(e){}}();return s.super=t,s}}function b(t,n){var r=t.filename.split("/"),i=r.pop(),s=T(t.ast,n&&n.sourcemap?{map:{startLine:n.mapStartLine||0,file:i+"(original)",sourceMapRoot:r.join("/"),sourceContent:t.origCode}}:null,t.origCode);if(n&&n.sourcemap)try{var o="",a=s.map.toJSON();if(a){var u=e("source-map").SourceMapConsumer;t.sourcemap=a,P[t.filename]={map:a,smc:new u(a)},o="\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+m(JSON.stringify(a))+"\n"}t.code=s.code+o}catch(e){t.code=s}else t.code=s;return t}function x(e,t,n,r){"object"==typeof n&&void 0===r&&(r=n);var i={origCode:e.toString(),filename:t};try{return i.ast=F.parse(i.origCode,r&&r.parser),r.babelTree&&F.treeWalker(i.ast,function(e,t,n){"Literal"===e.type?n[0].replace($.babelLiteralNode(e.value)):"Property"===e.type&&("ClassBody"===n[0].parent.type?e.type="ClassProperty":e.type="ObjectProperty"),t()}),i}catch(e){if(e instanceof SyntaxError){var s=i.origCode.substr(e.pos-e.loc.column);s=s.split("\n")[0],e.message+=" "+t+" (nodent)\n"+s+"\n"+s.replace(/[\S ]/g,"-").substring(0,e.loc.column)+"^",e.stack=""}throw e}}function w(t,n){n=n||{};var r=t+"|"+Object.keys(n).sort().reduce(function(e,t){return e+t+JSON.stringify(n[t])},"");return this.covers[r]||(t.indexOf("/")>=0?this.covers[r]=e(t):this.covers[r]=e(c+"/covers/"+t)),this.covers[r](this,n)}function E(e,t,n,r){"object"==typeof n&&void 0===r&&(r=n),r=r||{};for(var i in R)i in r||(r[i]=R[i]);var s=this.parse(e,t,null,r);return this.asynchronize(s,null,r,this.log||h),this.prettyPrint(s,r),s}function S(t,n,r){var i={},s=this;n||(n=/\.njs$/),r?r.compiler||(r.compiler={}):r={compiler:{}};var o=l([B,r.compiler]);return function(a,u,c){function l(e){u.statusCode=500,u.write(e.toString()),u.end()}if(i[a.url])return u.setHeader("Content-Type",i[a.url].contentType),r.setHeaders&&r.setHeaders(u),u.write(i[a.url].output),void u.end();if(!(a.url.match(n)||r.htmlScriptRegex&&a.url.match(r.htmlScriptRegex)))return c&&c();var p=t+a.url;if(r.extensions&&!N.existsSync(p))for(var h=0;h …"+n.source+":"+n.line+":"+n.column+(e.getFunctionName()?")":"")}}return"\n at "+e}return e+t.map(n).join("")}function _(e){var t={};t[R.$asyncbind]={value:D,writable:!0,enumerable:!1,configurable:!0},t[R.$asyncspawn]={value:V,writable:!0,enumerable:!1,configurable:!0};try{Object.defineProperties(Function.prototype,t)}catch(t){e.log("Function prototypes already assigned: ",t.messsage)}R[R.$error]in r||(r[R[R.$error]]=p),e.augmentObject&&Object.defineProperties(Object.prototype,{asyncify:{value:function(e,t,n){return v(e)(this,t,n)},writable:!0,configurable:!0},isThenable:{value:function(){return q.isThenable(this)},writable:!0,configurable:!0}}),Object[R.$makeThenable]=q.resolve}function C(t){function n(e,t){e=e.split("."),t=t.split(".");for(var n=0;n<3;n++){if(e[n]t[n])return 1}return 0}function r(i,s){if(!s.match(/nodent\/nodent\.js$/)){if(s.match(/node_modules\/nodent\/.*\.js$/))return L(i,s);for(var u=0;u=3&&function(){function t(e,t){try{var n,s;if(o.fromast){if(e=JSON.parse(e),n={origCode:"",filename:i,ast:e},!(s=d(e,a.log))){var u=o.use?'"use nodent-'+o.use+'";':'"use nodent";';s=d(u,a.log),console.warn("/* "+i+": No 'use nodent*' directive, assumed "+u+" */")}}else s=d(o.use?'"use nodent-'+o.use+'";':e,a.log),s||(s=d('"use nodent";',a.log),o.dest||console.warn("/* "+i+": 'use nodent*' directive missing/ignored, assumed 'use nodent;' */")),n=a.parse(e,i,s);if(o.parseast||o.pretty||a.asynchronize(n,void 0,s,a.log),a.prettyPrint(n,s),o.out||o.pretty||o.dest){if(o.dest&&!t)throw new Error("Can't write unknown file to "+o.dest);var c="";o.runtime&&(c+="Function.prototype.$asyncbind = "+Function.prototype.$asyncbind.toString()+";\n",c+="global.$error = global.$error || "+r.$error.toString()+";\n"),c+=n.code,t&&o.dest?(N.writeFileSync(o.dest+t,c),console.log("Compiled",o.dest+t)):console.log(c)}(o.minast||o.parseast)&&console.log(JSON.stringify(n.ast,function(e,t){return"$"===e[0]||e.match(/^(start|end|loc)$/)?void 0:t},2,null)),o.ast&&console.log(JSON.stringify(n.ast,function(e,t){return"$"===e[0]?void 0:t},0)),o.exec&&new Function(n.code)()}catch(e){console.error(e)}}var i,s=e("path"),o=(n.env.NODENT_OPTS&&JSON.parse(n.env.NODENT_OPTS),function(e){for(var t=[],r=e||2;r<]/g}},{}],2:[function(e,t,r){"use strict";function n(){var e={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{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]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};return e.colors.grey=e.colors.gray,Object.keys(e).forEach(function(t){var r=e[t];Object.keys(r).forEach(function(t){var n=r[t];e[t]=r[t]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(e,t,{value:r,enumerable:!1})}),e}Object.defineProperty(t,"exports",{enumerable:!0,get:n})},{}],3:[function(e,t,r){(function(r){"use strict";function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i=0;o--)if(u[o]!==l[o])return!1;for(o=u.length-1;o>=0;o--)if(a=u[o],!f(e[a],t[a],r,n))return!1;return!0}function y(e,t,r){f(e,t,!0)&&p(e,t,r,"notDeepStrictEqual",y)}function g(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function b(e){var t;try{e()}catch(e){t=e}return t}function v(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=b(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&p(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&x.isError(i),o=!e&&i&&!r;if((a&&s&&g(i,r)||o)&&p(i,r,"Got unwanted exception"+n),e&&i&&r&&!g(i,r)||!e&&i)throw i}var x=e("util/"),E=Object.prototype.hasOwnProperty,A=Array.prototype.slice,D=function(){return"foo"===function(){}.name}(),C=t.exports=h,S=/\s*function\s+([^\(\s]*)\s*/;C.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var t=e.stackStartFunction||p;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=o(t),s=n.indexOf("\n"+i);if(s>=0){var a=n.indexOf("\n",s+1);n=n.substring(a+1)}this.stack=n}}},x.inherits(C.AssertionError,Error),C.fail=p,C.ok=h,C.equal=function(e,t,r){e!=t&&p(e,t,r,"==",C.equal)},C.notEqual=function(e,t,r){e==t&&p(e,t,r,"!=",C.notEqual)},C.deepEqual=function(e,t,r){f(e,t,!1)||p(e,t,r,"deepEqual",C.deepEqual)},C.deepStrictEqual=function(e,t,r){f(e,t,!0)||p(e,t,r,"deepStrictEqual",C.deepStrictEqual)},C.notDeepEqual=function(e,t,r){f(e,t,!1)&&p(e,t,r,"notDeepEqual",C.notDeepEqual)},C.notDeepStrictEqual=y,C.strictEqual=function(e,t,r){e!==t&&p(e,t,r,"===",C.strictEqual)},C.notStrictEqual=function(e,t,r){e===t&&p(e,t,r,"!==",C.notStrictEqual)},C.throws=function(e,t,r){v(!0,e,t,r)},C.doesNotThrow=function(e,t,r){v(!1,e,t,r)},C.ifError=function(e){if(e)throw e};var _=Object.keys||function(e){var t=[];for(var r in e)E.call(e,r)&&t.push(r);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":601}],4:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("Noop").bases("Node").build(),i("DoExpression").bases("Expression").build("body").field("body",[i("Statement")]),i("Super").bases("Expression").build(),i("BindExpression").bases("Expression").build("object","callee").field("object",s(i("Expression"),null)).field("callee",i("Expression")),i("Decorator").bases("Node").build("expression").field("expression",i("Expression")),i("Property").field("decorators",s([i("Decorator")],null),n.null),i("MethodDefinition").field("decorators",s([i("Decorator")],null),n.null),i("MetaProperty").bases("Expression").build("meta","property").field("meta",i("Identifier")).field("property",i("Identifier")),i("ParenthesizedExpression").bases("Expression").build("expression").field("expression",i("Expression")),i("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",i("Identifier")),i("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),i("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),i("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",s(i("Declaration"),i("Expression"))),i("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",s(i("Declaration"),null)).field("specifiers",[i("ExportSpecifier")],n.emptyArray).field("source",s(i("Literal"),null),n.null),i("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",i("Identifier")),i("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",i("Identifier")),i("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",i("Identifier")),i("ExportAllDeclaration").bases("Declaration").build("exported","source").field("exported",s(i("Identifier"),null)).field("source",i("Literal")),i("CommentBlock").bases("Comment").build("value","leading","trailing"),i("CommentLine").bases("Comment").build("value","leading","trailing")}},{"../lib/shared":20,"../lib/types":21,"./es7":9}],5:[function(e,t,r){t.exports=function(t){t.use(e("./babel")),t.use(e("./flow"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("Directive").bases("Node").build("value").field("value",i("DirectiveLiteral")),i("DirectiveLiteral").bases("Node","Expression").build("value").field("value",String,n["use strict"]),i("BlockStatement").bases("Statement").build("body").field("body",[i("Statement")]).field("directives",[i("Directive")],n.emptyArray),i("Program").bases("Node").build("body").field("body",[i("Statement")]).field("directives",[i("Directive")],n.emptyArray),i("StringLiteral").bases("Literal").build("value").field("value",String),i("NumericLiteral").bases("Literal").build("value").field("value",Number),i("NullLiteral").bases("Literal").build(),i("BooleanLiteral").bases("Literal").build("value").field("value",Boolean),i("RegExpLiteral").bases("Literal").build("pattern","flags").field("pattern",String).field("flags",String);var a=s(i("Property"),i("ObjectMethod"),i("ObjectProperty"),i("SpreadProperty"));i("ObjectExpression").bases("Expression").build("properties").field("properties",[a]),i("ObjectMethod").bases("Node","Function").build("kind","key","params","body","computed").field("kind",s("method","get","set")).field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("params",[i("Pattern")]).field("body",i("BlockStatement")).field("computed",Boolean,n.false).field("generator",Boolean,n.false).field("async",Boolean,n.false).field("decorators",s([i("Decorator")],null),n.null),i("ObjectProperty").bases("Node").build("key","value").field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("value",s(i("Expression"),i("Pattern"))).field("computed",Boolean,n.false);var o=s(i("MethodDefinition"),i("VariableDeclarator"),i("ClassPropertyDefinition"),i("ClassProperty"),i("ClassMethod"));i("ClassBody").bases("Declaration").build("body").field("body",[o]),i("ClassMethod").bases("Declaration","Function").build("kind","key","params","body","computed","static").field("kind",s("get","set","method","constructor")).field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("params",[i("Pattern")]).field("body",i("BlockStatement")).field("computed",Boolean,n.false).field("static",Boolean,n.false).field("generator",Boolean,n.false).field("async",Boolean,n.false).field("decorators",s([i("Decorator")],null),n.null);var u=s(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"),i("SpreadProperty"),i("ObjectProperty"),i("RestProperty"));i("ObjectPattern").bases("Pattern").build("properties").field("properties",[u]).field("decorators",s([i("Decorator")],null),n.null),i("SpreadProperty").bases("Node").build("argument").field("argument",i("Expression")),i("RestProperty").bases("Node").build("argument").field("argument",i("Expression")),i("ForAwaitStatement").bases("Statement").build("left","right","body").field("left",s(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("Import").bases("Expression").build()}},{"../lib/shared":20,"../lib/types":21,"./babel":4,"./flow":11}],6:[function(e,t,r){t.exports=function(t){var r=t.use(e("../lib/types")),n=r.Type,i=n.def,s=n.or,a=t.use(e("../lib/shared")),o=a.defaults,u=a.geq;i("Printable").field("loc",s(i("SourceLocation"),null),o.null,!0),i("Node").bases("Printable").field("type",String).field("comments",s([i("Comment")],null),o.null,!0),i("SourceLocation").build("start","end","source").field("start",i("Position")).field("end",i("Position")).field("source",s(String,null),o.null),i("Position").build("line","column").field("line",u(1)).field("column",u(0)),i("File").bases("Node").build("program","name").field("program",i("Program")).field("name",s(String,null),o.null),i("Program").bases("Node").build("body").field("body",[i("Statement")]),i("Function").bases("Node").field("id",s(i("Identifier"),null),o.null).field("params",[i("Pattern")]).field("body",i("BlockStatement")),i("Statement").bases("Node"),i("EmptyStatement").bases("Statement").build(),i("BlockStatement").bases("Statement").build("body").field("body",[i("Statement")]),i("ExpressionStatement").bases("Statement").build("expression").field("expression",i("Expression")),i("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",i("Expression")).field("consequent",i("Statement")).field("alternate",s(i("Statement"),null),o.null),i("LabeledStatement").bases("Statement").build("label","body").field("label",i("Identifier")).field("body",i("Statement")),i("BreakStatement").bases("Statement").build("label").field("label",s(i("Identifier"),null),o.null),i("ContinueStatement").bases("Statement").build("label").field("label",s(i("Identifier"),null),o.null),i("WithStatement").bases("Statement").build("object","body").field("object",i("Expression")).field("body",i("Statement")),i("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",i("Expression")).field("cases",[i("SwitchCase")]).field("lexical",Boolean,o.false),i("ReturnStatement").bases("Statement").build("argument").field("argument",s(i("Expression"),null)),i("ThrowStatement").bases("Statement").build("argument").field("argument",i("Expression")),i("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",i("BlockStatement")).field("handler",s(i("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[i("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[i("CatchClause")],o.emptyArray).field("finalizer",s(i("BlockStatement"),null),o.null),i("CatchClause").bases("Node").build("param","guard","body").field("param",i("Pattern")).field("guard",s(i("Expression"),null),o.null).field("body",i("BlockStatement")),i("WhileStatement").bases("Statement").build("test","body").field("test",i("Expression")).field("body",i("Statement")),i("DoWhileStatement").bases("Statement").build("body","test").field("body",i("Statement")).field("test",i("Expression")),i("ForStatement").bases("Statement").build("init","test","update","body").field("init",s(i("VariableDeclaration"),i("Expression"),null)).field("test",s(i("Expression"),null)).field("update",s(i("Expression"),null)).field("body",i("Statement")),i("ForInStatement").bases("Statement").build("left","right","body").field("left",s(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("DebuggerStatement").bases("Statement").build(),i("Declaration").bases("Statement"),i("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",i("Identifier")),i("FunctionExpression").bases("Function","Expression").build("id","params","body"),i("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",s("var","let","const")).field("declarations",[i("VariableDeclarator")]),i("VariableDeclarator").bases("Node").build("id","init").field("id",i("Pattern")).field("init",s(i("Expression"),null)),i("Expression").bases("Node","Pattern"),i("ThisExpression").bases("Expression").build(),i("ArrayExpression").bases("Expression").build("elements").field("elements",[s(i("Expression"),null)]),i("ObjectExpression").bases("Expression").build("properties").field("properties",[i("Property")]),i("Property").bases("Node").build("kind","key","value").field("kind",s("init","get","set")).field("key",s(i("Literal"),i("Identifier"))).field("value",i("Expression")),i("SequenceExpression").bases("Expression").build("expressions").field("expressions",[i("Expression")]);var l=s("-","+","!","~","typeof","void","delete");i("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",l).field("argument",i("Expression")).field("prefix",Boolean,o.true);var c=s("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");i("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",c).field("left",i("Expression")).field("right",i("Expression"));var p=s("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");i("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",p).field("left",i("Pattern")).field("right",i("Expression"));var h=s("++","--");i("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",h).field("argument",i("Expression")).field("prefix",Boolean);var f=s("||","&&");i("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",f).field("left",i("Expression")).field("right",i("Expression")),i("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",i("Expression")).field("consequent",i("Expression")).field("alternate",i("Expression")),i("NewExpression").bases("Expression").build("callee","arguments").field("callee",i("Expression")).field("arguments",[i("Expression")]),i("CallExpression").bases("Expression").build("callee","arguments").field("callee",i("Expression")).field("arguments",[i("Expression")]),i("MemberExpression").bases("Expression").build("object","property","computed").field("object",i("Expression")).field("property",s(i("Identifier"),i("Expression"))).field("computed",Boolean,function(){var e=this.property.type;return"Literal"===e||"MemberExpression"===e||"BinaryExpression"===e}),i("Pattern").bases("Node"),i("SwitchCase").bases("Node").build("test","consequent").field("test",s(i("Expression"),null)).field("consequent",[i("Statement")]),i("Identifier").bases("Node","Expression","Pattern").build("name").field("name",String),i("Literal").bases("Node","Expression").build("value").field("value",s(String,Boolean,null,Number,RegExp)).field("regex",s({pattern:String,flags:String},null),function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null}),i("Comment").bases("Printable").field("value",String).field("leading",Boolean,o.true).field("trailing",Boolean,o.false)}},{"../lib/shared":20,"../lib/types":21}],7:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or;n("XMLDefaultDeclaration").bases("Declaration").field("namespace",n("Expression")),n("XMLAnyName").bases("Expression"),n("XMLQualifiedIdentifier").bases("Expression").field("left",i(n("Identifier"),n("XMLAnyName"))).field("right",i(n("Identifier"),n("Expression"))).field("computed",Boolean),n("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",i(n("Identifier"),n("Expression"))).field("computed",Boolean),n("XMLAttributeSelector").bases("Expression").field("attribute",n("Expression")),n("XMLFilterExpression").bases("Expression").field("left",n("Expression")).field("right",n("Expression")),n("XMLElement").bases("XML","Expression").field("contents",[n("XML")]),n("XMLList").bases("XML","Expression").field("contents",[n("XML")]),n("XML").bases("Node"),n("XMLEscape").bases("XML").field("expression",n("Expression")),n("XMLText").bases("XML").field("text",String),n("XMLStartTag").bases("XML").field("contents",[n("XML")]),n("XMLEndTag").bases("XML").field("contents",[n("XML")]),n("XMLPointTag").bases("XML").field("contents",[n("XML")]),n("XMLName").bases("XML").field("contents",i(String,[n("XML")])),n("XMLAttribute").bases("XML").field("value",String),n("XMLCdata").bases("XML").field("contents",String),n("XMLComment").bases("XML").field("contents",String),n("XMLProcessingInstruction").bases("XML").field("target",String).field("contents",i(String,null))}},{"../lib/types":21,"./core":6}],8:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("Function").field("generator",Boolean,s.false).field("expression",Boolean,s.false).field("defaults",[i(n("Expression"),null)],s.emptyArray).field("rest",i(n("Identifier"),null),s.null),n("RestElement").bases("Pattern").build("argument").field("argument",n("Pattern")),n("SpreadElementPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("FunctionDeclaration").build("id","params","body","generator","expression"),n("FunctionExpression").build("id","params","body","generator","expression"),n("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,s.null).field("body",i(n("BlockStatement"),n("Expression"))).field("generator",!1,s.false),n("YieldExpression").bases("Expression").build("argument","delegate").field("argument",i(n("Expression"),null)).field("delegate",Boolean,s.false),n("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",i(n("Expression"),null)),n("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",i(n("Expression"),null)),n("ComprehensionBlock").bases("Node").build("left","right","each").field("left",n("Pattern")).field("right",n("Expression")).field("each",Boolean),n("Property").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("value",i(n("Expression"),n("Pattern"))).field("method",Boolean,s.false).field("shorthand",Boolean,s.false).field("computed",Boolean,s.false),n("PropertyPattern").bases("Pattern").build("key","pattern").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("pattern",n("Pattern")).field("computed",Boolean,s.false),n("ObjectPattern").bases("Pattern").build("properties").field("properties",[i(n("PropertyPattern"),n("Property"))]),n("ArrayPattern").bases("Pattern").build("elements").field("elements",[i(n("Pattern"),null)]),n("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",i("constructor","method","get","set")).field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("value",n("Function")).field("computed",Boolean,s.false).field("static",Boolean,s.false),n("SpreadElement").bases("Node").build("argument").field("argument",n("Expression")),n("ArrayExpression").field("elements",[i(n("Expression"),n("SpreadElement"),n("RestElement"),null)]),n("NewExpression").field("arguments",[i(n("Expression"),n("SpreadElement"))]),n("CallExpression").field("arguments",[i(n("Expression"),n("SpreadElement"))]),n("AssignmentPattern").bases("Pattern").build("left","right").field("left",n("Pattern")).field("right",n("Expression"));var a=i(n("MethodDefinition"),n("VariableDeclarator"),n("ClassPropertyDefinition"),n("ClassProperty"));n("ClassProperty").bases("Declaration").build("key").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("computed",Boolean,s.false),n("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",a),n("ClassBody").bases("Declaration").build("body").field("body",[a]),n("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",i(n("Identifier"),null)).field("body",n("ClassBody")).field("superClass",i(n("Expression"),null),s.null),n("ClassExpression").bases("Expression").build("id","body","superClass").field("id",i(n("Identifier"),null),s.null).field("body",n("ClassBody")).field("superClass",i(n("Expression"),null),s.null).field("implements",[n("ClassImplements")],s.emptyArray),n("ClassImplements").bases("Node").build("id").field("id",n("Identifier")).field("superClass",i(n("Expression"),null),s.null),n("Specifier").bases("Node"),n("ModuleSpecifier").bases("Specifier").field("local",i(n("Identifier"),null),s.null).field("id",i(n("Identifier"),null),s.null).field("name",i(n("Identifier"),null),s.null),n("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",n("Expression")).field("quasi",n("TemplateLiteral")),n("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[n("TemplateElement")]).field("expressions",[n("Expression")]),n("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)}},{"../lib/shared":20,"../lib/types":21,"./core":6}],9:[function(e,t,r){t.exports=function(t){t.use(e("./es6"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=(r.builtInTypes,t.use(e("../lib/shared")).defaults);n("Function").field("async",Boolean,s.false),n("SpreadProperty").bases("Node").build("argument").field("argument",n("Expression")),n("ObjectExpression").field("properties",[i(n("Property"),n("SpreadProperty"))]),n("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("ObjectPattern").field("properties",[i(n("Property"),n("PropertyPattern"),n("SpreadPropertyPattern"))]),n("AwaitExpression").bases("Expression").build("argument","all").field("argument",i(n("Expression"),null)).field("all",Boolean,s.false)}},{"../lib/shared":20,"../lib/types":21,"./es6":8}],10:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("VariableDeclaration").field("declarations",[s(i("VariableDeclarator"),i("Identifier"))]),i("Property").field("value",s(i("Expression"),i("Pattern"))),i("ArrayPattern").field("elements",[s(i("Pattern"),i("SpreadElement"),null)]),i("ObjectPattern").field("properties",[s(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"),i("SpreadProperty"))]),i("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),i("ExportBatchSpecifier").bases("Specifier").build(),i("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),i("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),i("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),i("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",s(i("Declaration"),i("Expression"),null)).field("specifiers",[s(i("ExportSpecifier"),i("ExportBatchSpecifier"))],n.emptyArray).field("source",s(i("Literal"),null),n.null),i("ImportDeclaration").bases("Declaration").build("specifiers","source","importKind").field("specifiers",[s(i("ImportSpecifier"),i("ImportNamespaceSpecifier"),i("ImportDefaultSpecifier"))],n.emptyArray).field("source",i("Literal")).field("importKind",s("value","type"),function(){return"value"}),i("Block").bases("Comment").build("value","leading","trailing"),i("Line").bases("Comment").build("value","leading","trailing")}},{"../lib/shared":20,"../lib/types":21,"./es7":9}],11:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("Type").bases("Node"),n("AnyTypeAnnotation").bases("Type").build(),n("EmptyTypeAnnotation").bases("Type").build(),n("MixedTypeAnnotation").bases("Type").build(),n("VoidTypeAnnotation").bases("Type").build(),n("NumberTypeAnnotation").bases("Type").build(),n("NumberLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),n("NumericLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),n("StringTypeAnnotation").bases("Type").build(),n("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",String).field("raw",String),n("BooleanTypeAnnotation").bases("Type").build(),n("BooleanLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Boolean).field("raw",String),n("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullLiteralTypeAnnotation").bases("Type").build(),n("NullTypeAnnotation").bases("Type").build(),n("ThisTypeAnnotation").bases("Type").build(),n("ExistsTypeAnnotation").bases("Type").build(),n("ExistentialTypeParam").bases("Type").build(),n("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[n("FunctionTypeParam")]).field("returnType",n("Type")).field("rest",i(n("FunctionTypeParam"),null)).field("typeParameters",i(n("TypeParameterDeclaration"),null)),n("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",n("Identifier")).field("typeAnnotation",n("Type")).field("optional",Boolean),n("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",n("Type")),n("ObjectTypeAnnotation").bases("Type").build("properties","indexers","callProperties").field("properties",[n("ObjectTypeProperty")]).field("indexers",[n("ObjectTypeIndexer")],s.emptyArray).field("callProperties",[n("ObjectTypeCallProperty")],s.emptyArray).field("exact",Boolean,s.false),n("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",i(n("Literal"),n("Identifier"))).field("value",n("Type")).field("optional",Boolean).field("variance",i("plus","minus",null),s.null),n("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",n("Identifier")).field("key",n("Type")).field("value",n("Type")).field("variance",i("plus","minus",null),s.null),n("ObjectTypeCallProperty").bases("Node").build("value").field("value",n("FunctionTypeAnnotation")).field("static",Boolean,s.false),n("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",i(n("Identifier"),n("QualifiedTypeIdentifier"))).field("id",n("Identifier")),n("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",i(n("Identifier"),n("QualifiedTypeIdentifier"))).field("typeParameters",i(n("TypeParameterInstantiation"),null)),n("MemberTypeAnnotation").bases("Type").build("object","property").field("object",n("Identifier")).field("property",i(n("MemberTypeAnnotation"),n("GenericTypeAnnotation"))),n("UnionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",n("Type")),n("Identifier").field("typeAnnotation",i(n("TypeAnnotation"),null),s.null),n("TypeParameterDeclaration").bases("Node").build("params").field("params",[n("TypeParameter")]),n("TypeParameterInstantiation").bases("Node").build("params").field("params",[n("Type")]),n("TypeParameter").bases("Type").build("name","variance","bound").field("name",String).field("variance",i("plus","minus",null),s.null).field("bound",i(n("TypeAnnotation"),null),s.null),n("Function").field("returnType",i(n("TypeAnnotation"),null),s.null).field("typeParameters",i(n("TypeParameterDeclaration"),null),s.null),n("ClassProperty").build("key","value","typeAnnotation","static").field("value",i(n("Expression"),null)).field("typeAnnotation",i(n("TypeAnnotation"),null)).field("static",Boolean,s.false).field("variance",i("plus","minus",null),s.null),n("ClassImplements").field("typeParameters",i(n("TypeParameterInstantiation"),null),s.null),n("InterfaceDeclaration").bases("Declaration").build("id","body","extends").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterDeclaration"),null),s.null).field("body",n("ObjectTypeAnnotation")).field("extends",[n("InterfaceExtends")]),n("DeclareInterface").bases("InterfaceDeclaration").build("id","body","extends"),n("InterfaceExtends").bases("Node").build("id").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterInstantiation"),null)),n("TypeAlias").bases("Declaration").build("id","typeParameters","right").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterDeclaration"),null)).field("right",n("Type")),n("DeclareTypeAlias").bases("TypeAlias").build("id","typeParameters","right"), +n("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",n("Expression")).field("typeAnnotation",n("TypeAnnotation")),n("TupleTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("DeclareVariable").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareFunction").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareClass").bases("InterfaceDeclaration").build("id"),n("DeclareModule").bases("Statement").build("id","body").field("id",i(n("Identifier"),n("Literal"))).field("body",n("BlockStatement")),n("DeclareModuleExports").bases("Statement").build("typeAnnotation").field("typeAnnotation",n("Type")),n("DeclareExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",i(n("DeclareVariable"),n("DeclareFunction"),n("DeclareClass"),n("Type"),null)).field("specifiers",[i(n("ExportSpecifier"),n("ExportBatchSpecifier"))],s.emptyArray).field("source",i(n("Literal"),null),s.null),n("DeclareExportAllDeclaration").bases("Declaration").build("source").field("source",i(n("Literal"),null),s.null)}},{"../lib/shared":20,"../lib/types":21,"./es7":9}],12:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("JSXAttribute").bases("Node").build("name","value").field("name",i(n("JSXIdentifier"),n("JSXNamespacedName"))).field("value",i(n("Literal"),n("JSXExpressionContainer"),null),s.null),n("JSXIdentifier").bases("Identifier").build("name").field("name",String),n("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",n("JSXIdentifier")).field("name",n("JSXIdentifier")),n("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",i(n("JSXIdentifier"),n("JSXMemberExpression"))).field("property",n("JSXIdentifier")).field("computed",Boolean,s.false);var a=i(n("JSXIdentifier"),n("JSXNamespacedName"),n("JSXMemberExpression"));n("JSXSpreadAttribute").bases("Node").build("argument").field("argument",n("Expression"));var o=[i(n("JSXAttribute"),n("JSXSpreadAttribute"))];n("JSXExpressionContainer").bases("Expression").build("expression").field("expression",n("Expression")),n("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",n("JSXOpeningElement")).field("closingElement",i(n("JSXClosingElement"),null),s.null).field("children",[i(n("JSXElement"),n("JSXExpressionContainer"),n("JSXText"),n("Literal"))],s.emptyArray).field("name",a,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",o,function(){return this.openingElement.attributes},!0),n("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",a).field("attributes",o,s.emptyArray).field("selfClosing",Boolean,s.false),n("JSXClosingElement").bases("Node").build("name").field("name",a),n("JSXText").bases("Literal").build("value").field("value",String),n("JSXEmptyExpression").bases("Expression").build()}},{"../lib/shared":20,"../lib/types":21,"./es7":9}],13:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")),a=s.geq,o=s.defaults;n("Function").field("body",i(n("BlockStatement"),n("Expression"))),n("ForInStatement").build("left","right","body","each").field("each",Boolean,o.false),n("ForOfStatement").bases("Statement").build("left","right","body").field("left",i(n("VariableDeclaration"),n("Expression"))).field("right",n("Expression")).field("body",n("Statement")),n("LetStatement").bases("Statement").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Statement")),n("LetExpression").bases("Expression").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Expression")),n("GraphExpression").bases("Expression").build("index","expression").field("index",a(0)).field("expression",n("Literal")),n("GraphIndexExpression").bases("Expression").build("index").field("index",a(0))}},{"../lib/shared":20,"../lib/types":21,"./core":6}],14:[function(e,t,r){t.exports=function(t){function r(e){var t=n.indexOf(e);return-1===t&&(t=n.length,n.push(e),i[t]=e(s)),i[t]}var n=[],i=[],s={};s.use=r;var a=r(e("./lib/types"));t.forEach(r),a.finalize();var o={Type:a.Type,builtInTypes:a.builtInTypes,namedTypes:a.namedTypes,builders:a.builders,defineMethod:a.defineMethod,getFieldNames:a.getFieldNames,getFieldValue:a.getFieldValue,eachField:a.eachField,someField:a.someField,getSupertypeNames:a.getSupertypeNames,astNodesAreEquivalent:r(e("./lib/equiv")),finalize:a.finalize,Path:r(e("./lib/path")),NodePath:r(e("./lib/node-path")),PathVisitor:r(e("./lib/path-visitor")),use:r};return o.visit=o.PathVisitor.visit,o}},{"./lib/equiv":15,"./lib/node-path":16,"./lib/path":18,"./lib/path-visitor":17,"./lib/types":21}],15:[function(e,t,r){t.exports=function(t){function r(e,t,r){return c.check(r)?r.length=0:r=null,i(e,t,r)}function n(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function i(e,t,r){return e===t||(c.check(e)?s(e,t,r):p.check(e)?a(e,t,r):h.check(e)?h.check(t)&&+e==+t:f.check(e)?f.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t)}function s(e,t,r){c.assert(e);var n=e.length;if(!c.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var s=0;so)return!0;if(t===o&&"right"===this.name){if(n.right!==r)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(n.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(n.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===n.type&&p.check(r.value)&&"object"===this.name&&n.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&n.callee===r;case"ConditionalExpression":return"test"===this.name&&n.test===r;case"MemberExpression":return"object"===this.name&&n.object===r;default:return!1}default:if("NewExpression"===n.type&&"callee"===this.name&&n.callee===r)return i(r)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var y={};return[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){y[e]=t})}),m.canBeFirstInStatement=function(){var e=this.node;return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},m.firstInStatement=function(){return s(this)},r}},{"./path":18,"./scope":19,"./types":21}],17:[function(e,t,r){var n=Object.prototype.hasOwnProperty;t.exports=function(t){function r(){if(!(this instanceof r))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=i(this),this._shouldVisitComments=n.call(this._methodNameTable,"Block")||n.call(this._methodNameTable,"Line"),this.Context=o(this),this._visiting=!1,this._changeReported=!1}function i(e){var t=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(t[r.slice("visit".length)]=!0);for(var n=u.computeSupertypeLookupTable(t),i=Object.create(null),t=Object.keys(n),s=t.length,a=0;a=0&&(s[e.name=a]=e)}else i[e.name]=e.value,s[e.name]=e;if(i[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("");return e}var l=t.use(e("./types")),c=l.builtInTypes.array,p=l.builtInTypes.number,h=r.prototype;return h.getValueProperty=function(e){return this.value[e]},h.get=function(e){for(var t=this,r=arguments,n=r.length,s=0;s=e},a+" >= "+e)},r.defaults={null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){}};var o=i.or(s.string,s.number,s.boolean,s.null,s.undefined);return r.isPrimitive=new i(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},o.toString()),r}},{"../lib/types":21}],21:[function(e,t,r){var n=Array.prototype,i=n.slice,s=(n.map,n.forEach,Object.prototype),a=s.toString,o=a.call(function(){}),u=a.call(""),l=s.hasOwnProperty;t.exports=function(){function e(t,r){var n=this;if(!(n instanceof e))throw new Error("Type constructor cannot be invoked without 'new'");if(a.call(t)!==o)throw new Error(t+" is not a function");var i=a.call(r);if(i!==o&&i!==u)throw new Error(r+" is neither a function nor a string");Object.defineProperties(n,{name:{value:r},check:{value:function(e,r){var i=t.call(n,e,r);return!i&&r&&a.call(r)===o&&r(n,e),i}}})}function t(e){return _.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":S.check(e)?"["+e.map(t).join(", ")+"]":JSON.stringify(e)}function r(t,r){var n=a.call(t),i=new e(function(e){return a.call(e)===n},r);return A[r]=i,t&&"function"==typeof t.constructor&&(x.push(t.constructor),E.push(i)),i}function n(t,r){if(t instanceof e)return t;if(t instanceof c)return t.type;if(S.check(t))return e.fromArray(t);if(_.check(t))return e.fromObject(t);if(C.check(t)){var n=x.indexOf(t);return n>=0?E[n]:new e(t,r)}return new e(function(e){return e===t},k.check(r)?function(){return t+""}:r)}function s(e,t,r,i){var a=this;if(!(a instanceof s))throw new Error("Field constructor cannot be invoked without 'new'");D.assert(e),t=n(t);var o={name:{value:e},type:{value:t},hidden:{value:!!i}};C.check(r)&&(o.defaultFn={value:r}),Object.defineProperties(a,o)}function c(t){var r=this;if(!(r instanceof c))throw new Error("Def constructor cannot be invoked without 'new'");Object.defineProperties(r,{typeName:{value:t},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new e(function(e,t){return r.check(e,t)},t)}})}function p(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function h(e){return e=p(e),e.replace(/(Expression)?$/,"Statement")}function f(e){var t=c.fromValue(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function d(e,t){var r=c.fromValue(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e&&e[t]}function m(e){var t=h(e);if(!B[t]){var r=B[p(e)];r&&(B[t]=function(){return B.expressionStatement(r.apply(B,arguments))})}}function y(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n=0&&m(e.typeName)}},b.finalize=function(){Object.keys(T).forEach(function(e){T[e].finalize()})},b}},{}],22:[function(e,t,r){t.exports=e("./fork")([e("./def/core"),e("./def/es6"),e("./def/es7"),e("./def/mozilla"),e("./def/e4x"),e("./def/jsx"),e("./def/flow"),e("./def/esprima"),e("./def/babel"),e("./def/babel6")])},{"./def/babel":4,"./def/babel6":5,"./def/core":6,"./def/e4x":7,"./def/es6":8,"./def/es7":9,"./def/esprima":10,"./def/flow":11,"./def/jsx":12,"./def/mozilla":13,"./fork":14}],23:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return{keyword:e.cyan,capitalized:e.yellow,jsx_tag:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold,gutter:e.grey,marker:e.red.bold}}function s(e){var t=e.slice(-2),r=t[0],n=t[1],i=(0,o.matchToToken)(e);if("name"===i.type){if(c.default.keyword.isReservedWordES6(i.value))return"keyword";if(d.test(i.value)&&("<"===n[r-1]||"3&&void 0!==arguments[3]?arguments[3]:{};r=Math.max(r,0);var s=n.highlightCode&&h.default.supportsColor||n.forceColor,o=h.default;n.forceColor&&(o=new h.default.constructor({enabled:!0}));var u=function(e,t){return s?e(t):t},l=i(o);s&&(e=a(l,e));var c=n.linesAbove||2,p=n.linesBelow||3,d=e.split(f),m=Math.max(t-(c+1),0),y=Math.min(d.length,t+p);t||r||(m=0,y=d.length);var g=String(y).length,b=d.slice(m,y).map(function(e,n){var i=m+1+n,s=(" "+i).slice(-g),a=" "+s+" | ";if(i===t){var o="";if(r){var c=e.slice(0,r-1).replace(/[^\t]/g," ");o=["\n ",u(l.gutter,a.replace(/\d/g," ")),c,u(l.marker,"^")].join("")}return[u(l.marker,">"),u(l.gutter,a),e,o].join("")}return" "+u(l.gutter,a)+e}).join("\n");return s?o.reset(b):b};var o=e("js-tokens"),u=n(o),l=e("esutils"),c=n(l),p=e("chalk"),h=n(p),f=/\r\n|[\n\r\u2028\u2029]/,d=/^[a-z][\w-]*$/i,m=/^[()\[\]{}]$/;t.exports=r.default},{chalk:185,esutils:27,"js-tokens":311}],24:[function(e,t,r){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function r(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function n(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function i(e){return n(e)||null!=e&&"FunctionDeclaration"===e.type}function s(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function a(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=s(t)}while(t);return!1}t.exports={isExpression:e,isStatement:n,isIterationStatement:r,isSourceElement:i,isProblematicIfStatement:a,trailingStatement:s}}()},{}],25:[function(e,t,r){!function(){"use strict";function e(e){return 48<=e&&e<=57}function r(e){return 48<=e&&e<=57||97<=e&&e<=102||65<=e&&e<=70}function n(e){return e>=48&&e<=55}function i(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&f.indexOf(e)>=0}function s(e){return 10===e||13===e||8232===e||8233===e}function a(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(Math.floor((e-65536)/1024)+55296)+String.fromCharCode((e-65536)%1024+56320)}function o(e){return e<128?d[e]:h.NonAsciiIdentifierStart.test(a(e))}function u(e){return e<128?m[e]:h.NonAsciiIdentifierPart.test(a(e))}function l(e){return e<128?d[e]:p.NonAsciiIdentifierStart.test(a(e))}function c(e){return e<128?m[e]:p.NonAsciiIdentifierPart.test(a(e))}var p,h,f,d,m,y;for(h={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},p={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},f=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],d=new Array(128),y=0;y<128;++y)d[y]=y>=97&&y<=122||y>=65&&y<=90||36===y||95===y;for(m=new Array(128),y=0;y<128;++y)m[y]=y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||36===y||95===y;t.exports={isDecimalDigit:e,isHexDigit:r,isOctalDigit:n,isWhiteSpace:i,isLineTerminator:s,isIdentifierStartES5:o,isIdentifierPartES5:u,isIdentifierStartES6:l,isIdentifierPartES6:c}}()},{}],26:[function(e,t,r){!function(){"use strict";function r(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function n(e,t){return!(!t&&"yield"===e)&&i(e,t)}function i(e,t){if(t&&r(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function s(e,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function a(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function o(e){return"eval"===e||"arguments"===e}function u(e){var t,r,n;if(0===e.length)return!1;if(n=e.charCodeAt(0),!f.isIdentifierStartES5(n))return!1 +;for(t=1,r=e.length;t=r)return!1;if(!(56320<=(i=e.charCodeAt(t))&&i<=57343))return!1;n=l(n,i)}if(!s(n))return!1;s=f.isIdentifierPartES6}return!0}function p(e,t){return u(e)&&!s(e,t)}function h(e,t){return c(e)&&!a(e,t)}var f=e("./code");t.exports={isKeywordES5:n,isKeywordES6:i,isReservedWordES5:s,isReservedWordES6:a,isRestrictedWord:o,isIdentifierNameES5:u,isIdentifierNameES6:c,isIdentifierES5:p,isIdentifierES6:h}}()},{"./code":25}],27:[function(e,t,r){!function(){"use strict";r.ast=e("./ast"),r.code=e("./code"),r.keyword=e("./keyword")}()},{"./ast":24,"./code":25,"./keyword":26}],28:[function(e,t,r){t.exports=e("./lib/api/node.js")},{"./lib/api/node.js":29}],29:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){throw new Error("The ("+e+") Babel 5 plugin is being run with Babel 6.")}function a(e,t,r){"function"==typeof t&&(r=t,t={}),t.filename=e,y.default.readFile(e,function(e,n){var i=void 0;if(!e)try{i=T(n,t)}catch(t){e=t}e?r(e):r(null,i)})}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.filename=e,T(y.default.readFileSync(e,"utf8"),t)}r.__esModule=!0,r.transformFromAst=r.transform=r.analyse=r.Pipeline=r.OptionManager=r.traverse=r.types=r.messages=r.util=r.version=r.resolvePreset=r.resolvePlugin=r.template=r.buildExternalHelpers=r.options=r.File=void 0;var u=e("../transformation/file");Object.defineProperty(r,"File",{enumerable:!0,get:function(){return i(u).default}});var l=e("../transformation/file/options/config");Object.defineProperty(r,"options",{enumerable:!0,get:function(){return i(l).default}});var c=e("../tools/build-external-helpers");Object.defineProperty(r,"buildExternalHelpers",{enumerable:!0,get:function(){return i(c).default}});var p=e("babel-template");Object.defineProperty(r,"template",{enumerable:!0,get:function(){return i(p).default}});var h=e("../helpers/resolve-plugin");Object.defineProperty(r,"resolvePlugin",{enumerable:!0,get:function(){return i(h).default}});var f=e("../helpers/resolve-preset");Object.defineProperty(r,"resolvePreset",{enumerable:!0,get:function(){return i(f).default}});var d=e("../../package");Object.defineProperty(r,"version",{enumerable:!0,get:function(){return d.version}}),r.Plugin=s,r.transformFile=a,r.transformFileSync=o;var m=e("fs"),y=i(m),g=e("../util"),b=n(g),v=e("babel-messages"),x=n(v),E=e("babel-types"),A=n(E),D=e("babel-traverse"),C=i(D),S=e("../transformation/file/options/option-manager"),_=i(S),w=e("../transformation/pipeline"),k=i(w);r.util=b,r.messages=x,r.types=A,r.traverse=C.default,r.OptionManager=_.default,r.Pipeline=k.default;var F=new k.default,T=(r.analyse=F.analyse.bind(F),r.transform=F.transform.bind(F));r.transformFromAst=F.transformFromAst.bind(F)},{"../../package":66,"../helpers/resolve-plugin":35,"../helpers/resolve-preset":36,"../tools/build-external-helpers":39,"../transformation/file":40,"../transformation/file/options/config":44,"../transformation/file/options/option-manager":46,"../transformation/pipeline":51,"../util":54,"babel-messages":103,"babel-template":132,"babel-traverse":136,"babel-types":169,fs:182}],30:[function(e,t,r){"use strict";function n(e){return["babel-plugin-"+e,e]}r.__esModule=!0,r.default=n,t.exports=r.default},{}],31:[function(e,t,r){"use strict";function n(e){var t=["babel-preset-"+e,e],r=e.match(/^(@[^\/]+)\/(.+)$/);if(r){var n=r[1],i=r[2];t.push(n+"/babel-preset-"+i)}return t}r.__esModule=!0,r.default=n,t.exports=r.default},{}],32:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/core-js/get-iterator"),s=n(i);r.default=function(e,t){if(e&&t)return(0,o.default)(e,t,function(e,t){if(t&&Array.isArray(e)){for(var r=t.slice(0),n=e,i=Array.isArray(n),a=0,n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if(a=n.next(),a.done)break;o=a.value}var u=o;r.indexOf(u)<0&&r.push(u)}return r}})};var a=e("lodash/mergeWith"),o=n(a);t.exports=r.default},{"babel-runtime/core-js/get-iterator":113,"lodash/mergeWith":516}],33:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t,r){if(e){if("Program"===e.type)return i.file(e,t||[],r||[]);if("File"===e.type)return e}throw new Error("Not a valid ast?")};var n=e("babel-types"),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n);t.exports=r.default},{"babel-types":169}],34:[function(e,t,r){"use strict";function n(e,t){return e.reduce(function(e,r){return e||(0,s.default)(r,t)},null)}r.__esModule=!0,r.default=n;var i=e("./resolve"),s=function(e){return e&&e.__esModule?e:{default:e}}(i);t.exports=r.default},{"./resolve":37}],35:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();return(0,o.default)((0,l.default)(e),t)}r.__esModule=!0,r.default=s;var a=e("./resolve-from-possible-names"),o=i(a),u=e("./get-possible-plugin-names"),l=i(u);t.exports=r.default}).call(this,e("_process"))},{"./get-possible-plugin-names":30,"./resolve-from-possible-names":34,_process:539}],36:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();return(0,o.default)((0,l.default)(e),t)}r.__esModule=!0,r.default=s;var a=e("./resolve-from-possible-names"),o=i(a),u=e("./get-possible-preset-names"),l=i(u);t.exports=r.default}).call(this,e("_process"))},{"./get-possible-preset-names":31,"./resolve-from-possible-names":34,_process:539}],37:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=e("babel-runtime/helpers/typeof"),a=i(s);r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();if("object"===(void 0===u.default?"undefined":(0,a.default)(u.default)))return null;var r=p[t];if(!r){r=new u.default;var i=c.default.join(t,".babelrc");r.id=i,r.filename=i,r.paths=u.default._nodeModulePaths(t),p[t]=r}try{return u.default._resolveFilename(e,r)}catch(e){return null}};var o=e("module"),u=i(o),l=e("path"),c=i(l),p={};t.exports=r.default}).call(this,e("_process"))},{_process:539,"babel-runtime/helpers/typeof":131,module:182,path:535}],38:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/core-js/map"),s=n(i),a=e("babel-runtime/helpers/classCallCheck"),o=n(a),u=e("babel-runtime/helpers/possibleConstructorReturn"),l=n(u),c=e("babel-runtime/helpers/inherits"),p=n(c),h=function(e){function t(){(0,o.default)(this,t);var r=(0,l.default)(this,e.call(this));return r.dynamicData={},r}return(0,p.default)(t,e),t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(t){if(this.has(t))return e.prototype.get.call(this,t);if(Object.prototype.hasOwnProperty.call(this.dynamicData,t)){var r=this.dynamicData[t]();return this.set(t,r),r}},t}(s.default);r.default=h,t.exports=r.default},{"babel-runtime/core-js/map":115,"babel-runtime/helpers/classCallCheck":127,"babel-runtime/helpers/inherits":128,"babel-runtime/helpers/possibleConstructorReturn":130}],39:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e,t){var r=[],n=b.functionExpression(null,[b.identifier("global")],b.blockStatement(r)),i=b.program([b.expressionStatement(b.callExpression(n,[c.get("selfGlobal")]))]);return r.push(b.variableDeclaration("var",[b.variableDeclarator(e,b.assignmentExpression("=",b.memberExpression(b.identifier("global"),e),b.objectExpression([])))])),t(r),i}function a(e,t){var r=[];return r.push(b.variableDeclaration("var",[b.variableDeclarator(e,b.identifier("global"))])),t(r),b.program([v({FACTORY_PARAMETERS:b.identifier("global"),BROWSER_ARGUMENTS:b.assignmentExpression("=",b.memberExpression(b.identifier("root"),e),b.objectExpression([])),COMMON_ARGUMENTS:b.identifier("exports"),AMD_ARGUMENTS:b.arrayExpression([b.stringLiteral("exports")]),FACTORY_BODY:r,UMD_ROOT:b.identifier("this")})])}function o(e,t){var r=[];return r.push(b.variableDeclaration("var",[b.variableDeclarator(e,b.objectExpression([]))])),t(r),r.push(b.expressionStatement(e)),b.program(r)}function u(e,t,r){c.list.forEach(function(n){if(!(r&&r.indexOf(n)<0)){var i=b.identifier(n);e.push(b.expressionStatement(b.assignmentExpression("=",b.memberExpression(t,i),c.get(n))))}})}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"global",r=b.identifier("babelHelpers"),n=function(t){return u(t,r,e)},i=void 0,l={global:s,umd:a,var:o}[t];if(!l)throw new Error(d.get("unsupportedOutputType",t));return i=l(r,n),(0,h.default)(i).code};var l=e("babel-helpers"),c=i(l),p=e("babel-generator"),h=n(p),f=e("babel-messages"),d=i(f),m=e("babel-template"),y=n(m),g=e("babel-types"),b=i(g),v=(0,y.default)('\n (function (root, factory) {\n if (typeof define === "function" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === "object") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n');t.exports=r.default},{"babel-generator":78,"babel-helpers":102,"babel-messages":103,"babel-template":132,"babel-types":169}],40:[function(e,t,r){(function(t){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.File=void 0;var s=e("babel-runtime/core-js/get-iterator"),a=i(s),o=e("babel-runtime/core-js/object/create"),u=i(o),l=e("babel-runtime/core-js/object/assign"),c=i(l),p=e("babel-runtime/helpers/classCallCheck"),h=i(p),f=e("babel-runtime/helpers/possibleConstructorReturn"),d=i(f),m=e("babel-runtime/helpers/inherits"),y=i(m),g=e("babel-helpers"),b=i(g),v=e("./metadata"),x=n(v),E=e("convert-source-map"),A=i(E),D=e("./options/option-manager"),C=i(D),S=e("../plugin-pass"),_=i(S),w=e("babel-traverse"),k=i(w),F=e("source-map"),T=i(F),P=e("babel-generator"),B=i(P),O=e("babel-code-frame"),j=i(O),N=e("lodash/defaults"),I=i(N),L=e("./logger"),M=i(L),R=e("../../store"),U=i(R),V=e("babylon"),q=e("../../util"),G=n(q),X=e("path"),J=i(X),W=e("babel-types"),K=n(W),z=e("../../helpers/resolve"),Y=i(z),H=e("../internal-plugins/block-hoist"),$=i(H),Q=e("../internal-plugins/shadow-functions"),Z=i(Q),ee=/^#!.*/,te=[[$.default],[Z.default]],re={enter:function(e,t){var r=e.node.loc;r&&(t.loc=r,e.stop())}},ne=function(r){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];(0,h.default)(this,n);var i=(0,d.default)(this,r.call(this));return i.pipeline=t,i.log=new M.default(i,e.filename||"unknown"),i.opts=i.initOptions(e),i.parserOpts={sourceType:i.opts.sourceType,sourceFileName:i.opts.filename,plugins:[]},i.pluginVisitors=[],i.pluginPasses=[],i.buildPluginsForOptions(i.opts),i.opts.passPerPreset&&(i.perPresetOpts=[],i.opts.presets.forEach(function(e){var t=(0,c.default)((0,u.default)(i.opts),e);i.perPresetOpts.push(t),i.buildPluginsForOptions(t)})),i.metadata={usedHelpers:[],marked:[],modules:{imports:[],exports:{exported:[],specifiers:[]}}},i.dynamicImportTypes={},i.dynamicImportIds={},i.dynamicImports=[],i.declarations={},i.usedHelpers={},i.path=null,i.ast={},i.code="",i.shebang="",i.hub=new w.Hub(i),i}return(0,y.default)(n,r),n.prototype.getMetadata=function(){for(var e=!1,t=this.ast.program.body,r=Array.isArray(t),n=0,t=r?t:(0,a.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i;if(K.isModuleDeclaration(s)){e=!0;break}}e&&this.path.traverse(x,this)},n.prototype.initOptions=function(e){e=new C.default(this.log,this.pipeline).init(e),e.inputSourceMap&&(e.sourceMaps=!0),e.moduleId&&(e.moduleIds=!0),e.basename=J.default.basename(e.filename,J.default.extname(e.filename)),e.ignore=G.arrayify(e.ignore,G.regexify),e.only&&(e.only=G.arrayify(e.only,G.regexify)),(0,I.default)(e,{moduleRoot:e.sourceRoot}),(0,I.default)(e,{sourceRoot:e.moduleRoot}),(0,I.default)(e,{filenameRelative:e.filename});var t=J.default.basename(e.filenameRelative);return(0,I.default)(e,{sourceFileName:t,sourceMapTarget:t}),e},n.prototype.buildPluginsForOptions=function(e){if(Array.isArray(e.plugins)){for(var t=e.plugins.concat(te),r=[],n=[],i=t,s=Array.isArray(i),o=0,i=s?i:(0,a.default)(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if(o=i.next(),o.done)break;u=o.value}var l=u,c=l[0],p=l[1];r.push(c.visitor),n.push(new _.default(this,c,p)),c.manipulateOptions&&c.manipulateOptions(e,this.parserOpts,this)}this.pluginVisitors.push(r),this.pluginPasses.push(n)}},n.prototype.getModuleName=function(){var e=this.opts;if(!e.moduleIds)return null;if(null!=e.moduleId&&!e.getModuleId)return e.moduleId;var t=e.filenameRelative,r="";if(null!=e.moduleRoot&&(r=e.moduleRoot+"/"),!e.filenameRelative)return r+e.filename.replace(/^\//,"");if(null!=e.sourceRoot){var n=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(n,"")}return t=t.replace(/\.(\w*?)$/,""),r+=t,r=r.replace(/\\/g,"/"),e.getModuleId?e.getModuleId(r)||r:r},n.prototype.resolveModuleSource=function(e){var t=this.opts.resolveModuleSource;return t&&(e=t(e,this.opts.filename)),e},n.prototype.addImport=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=e+":"+t,i=this.dynamicImportIds[n];if(!i){e=this.resolveModuleSource(e),i=this.dynamicImportIds[n]=this.scope.generateUidIdentifier(r);var s=[];"*"===t?s.push(K.importNamespaceSpecifier(i)):"default"===t?s.push(K.importDefaultSpecifier(i)):s.push(K.importSpecifier(i,K.identifier(t)));var a=K.importDeclaration(s,K.stringLiteral(e));a._blockHoist=3,this.path.unshiftContainer("body",a)}return i},n.prototype.addHelper=function(e){var t=this.declarations[e];if(t)return t;this.usedHelpers[e]||(this.metadata.usedHelpers.push(e),this.usedHelpers[e]=!0);var r=this.get("helperGenerator"),n=this.get("helpersNamespace");if(r){var i=r(e);if(i)return i}else if(n)return K.memberExpression(n,K.identifier(e));var s=(0,b.default)(e),a=this.declarations[e]=this.scope.generateUidIdentifier(e);return K.isFunctionExpression(s)&&!s.id?(s.body._compact=!0,s._generated=!0,s.id=a,s.type="FunctionDeclaration",this.path.unshiftContainer("body",s)):(s._compact=!0,this.scope.push({id:a,init:s,unique:!0})),a},n.prototype.addTemplateObject=function(e,t,r){var n=r.elements.map(function(e){return e.value}),i=e+"_"+r.elements.length+"_"+n.join(","),s=this.declarations[i];if(s)return s;var a=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(e),u=K.callExpression(o,[t,r]);return u._compact=!0,this.scope.push({id:a,init:u,_blockHoist:1.9}),a},n.prototype.buildCodeFrameError=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:SyntaxError,n=e&&(e.loc||e._loc),i=new r(t);return n?i.loc=n.start:((0,k.default)(e,re,this.scope,i),i.message+=" (This is an error on an internal node. Probably an internal error",i.loc&&(i.message+=". Location has been estimated."),i.message+=")"),i},n.prototype.mergeSourceMap=function(e){var t=this.opts.inputSourceMap;if(t){var r=new T.default.SourceMapConsumer(t),n=new T.default.SourceMapConsumer(e),i=new T.default.SourceMapGenerator({file:r.file,sourceRoot:r.sourceRoot}),s=n.sources[0];r.eachMapping(function(e){var t=n.generatedPositionFor({line:e.generatedLine,column:e.generatedColumn,source:s});null!=t.column&&i.addMapping({source:e.source,original:null==e.source?null:{line:e.originalLine,column:e.originalColumn},generated:t})});var a=i.toJSON();return t.mappings=a.mappings,t}return e},n.prototype.parse=function(r){var n=V.parse,i=this.opts.parserOpts;if(i&&(i=(0,c.default)({},this.parserOpts,i),i.parser)){if("string"==typeof i.parser){var s=J.default.dirname(this.opts.filename)||t.cwd(),a=(0,Y.default)(i.parser,s);if(!a)throw new Error("Couldn't find parser "+i.parser+' with "parse" method relative to directory '+s);n=e(a).parse}else n=i.parser;i.parser={parse:function(e){return(0,V.parse)(e,i)}}}this.log.debug("Parse start");var o=n(r,i||this.parserOpts);return this.log.debug("Parse stop"),o},n.prototype._addAst=function(e){this.path=w.NodePath.get({hub:this.hub,parentPath:null,parent:e,container:e,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=e,this.getMetadata()},n.prototype.addAst=function(e){this.log.debug("Start set AST"),this._addAst(e),this.log.debug("End set AST")},n.prototype.transform=function(){for(var e=0;e=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var o=s,u=o.plugin,l=u[e];l&&l.call(o,this)}},n.prototype.parseInputSourceMap=function(e){var t=this.opts;if(!1!==t.inputSourceMap){var r=A.default.fromSource(e);r&&(t.inputSourceMap=r.toObject(),e=A.default.removeComments(e))}return e},n.prototype.parseShebang=function(){var e=ee.exec(this.code);e&&(this.shebang=e[0],this.code=this.code.replace(ee,""))},n.prototype.makeResult=function(e){var t=e.code,r=e.map,n=e.ast,i=e.ignored,s={metadata:null,options:this.opts,ignored:!!i,code:null,ast:null,map:r||null};return this.opts.code&&(s.code=t),this.opts.ast&&(s.ast=n),this.opts.metadata&&(s.metadata=this.metadata),s},n.prototype.generate=function(){var r=this.opts,n=this.ast,i={ast:n};if(!r.code)return this.makeResult(i);var s=B.default;if(r.generatorOpts.generator&&"string"==typeof(s=r.generatorOpts.generator)){var a=J.default.dirname(this.opts.filename)||t.cwd(),o=(0,Y.default)(s,a);if(!o)throw new Error("Couldn't find generator "+s+' with "print" method relative to directory '+a);s=e(o).print}this.log.debug("Generation start");var u=s(n,r.generatorOpts?(0,c.default)(r,r.generatorOpts):r,this.code);return i.code=u.code,i.map=u.map,this.log.debug("Generation end"),this.shebang&&(i.code=this.shebang+"\n"+i.code),i.map&&(i.map=this.mergeSourceMap(i.map)),"inline"!==r.sourceMaps&&"both"!==r.sourceMaps||(i.code+="\n"+A.default.fromObject(i.map).toComment()),"inline"===r.sourceMaps&&(i.map=null),this.makeResult(i)},n}(U.default);r.default=ne,r.File=ne}).call(this,e("_process"))},{"../../helpers/resolve":37,"../../store":38,"../../util":54,"../internal-plugins/block-hoist":49,"../internal-plugins/shadow-functions":50,"../plugin-pass":52,"./logger":41,"./metadata":42,"./options/option-manager":46,_process:539,"babel-code-frame":23,"babel-generator":78,"babel-helpers":102,"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/object/assign":117,"babel-runtime/core-js/object/create":118,"babel-runtime/helpers/classCallCheck":127,"babel-runtime/helpers/inherits":128,"babel-runtime/helpers/possibleConstructorReturn":130,"babel-traverse":136,"babel-types":169,babylon:177,"convert-source-map":187,"lodash/defaults":484,path:535,"source-map":65}],41:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/helpers/classCallCheck"),s=n(i),a=e("debug/node"),o=n(a),u=(0,o.default)("babel:verbose"),l=(0,o.default)("babel"),c=[],p=function(){function e(t,r){(0,s.default)(this,e),this.filename=r,this.file=t}return e.prototype._buildMessage=function(e){var t="[BABEL] "+this.filename;return e&&(t+=": "+e),t},e.prototype.warn=function(e){console.warn(this._buildMessage(e))},e.prototype.error=function(e){throw new(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Error)(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts&&this.file.opts.suppressDeprecationMessages||(e=this._buildMessage(e),c.indexOf(e)>=0||(c.push(e),console.error(e)))},e.prototype.verbose=function(e){u.enabled&&u(this._buildMessage(e))},e.prototype.debug=function(e){l.enabled&&l(this._buildMessage(e))},e.prototype.deopt=function(e,t){this.debug(t)},e}();r.default=p,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":127,"debug/node":295}],42:[function(e,t,r){"use strict";function n(e,t){var r=e.node,n=r.source?r.source.value:null,i=t.metadata.modules.exports,s=e.get("declaration");if(s.isStatement()){var o=s.getBindingIdentifiers();for(var l in o)i.exported.push(l),i.specifiers.push({kind:"local",local:l,exported:e.isExportDefaultDeclaration()?"default":l})}if(e.isExportNamedDeclaration()&&r.specifiers)for(var c=r.specifiers,p=Array.isArray(c),h=0,c=p?c:(0,a.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if(h=c.next(),h.done)break;f=h.value}var d=f,m=d.exported.name;i.exported.push(m),u.isExportDefaultSpecifier(d)&&i.specifiers.push({kind:"external",local:m,exported:m,source:n}),u.isExportNamespaceSpecifier(d)&&i.specifiers.push({kind:"external-namespace",exported:m,source:n});var y=d.local;y&&(n&&i.specifiers.push({kind:"external",local:y.name,exported:m,source:n}),n||i.specifiers.push({kind:"local",local:y.name,exported:m}))}e.isExportAllDeclaration()&&i.specifiers.push({kind:"external-all",source:n})}function i(e){e.skip()}r.__esModule=!0,r.ImportDeclaration=r.ModuleDeclaration=void 0;var s=e("babel-runtime/core-js/get-iterator"),a=function(e){return e&&e.__esModule?e:{default:e}}(s);r.ExportDeclaration=n,r.Scope=i;var o=e("babel-types"),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(o);r.ModuleDeclaration={enter:function(e,t){var r=e.node;r.source&&(r.source.value=t.resolveModuleSource(r.source.value))}},r.ImportDeclaration={exit:function(e,t){var r=e.node,n=[],i=[];t.metadata.modules.imports.push({source:r.source.value,imported:i,specifiers:n});for(var s=e.get("specifiers"),o=Array.isArray(s),u=0,s=o?s:(0,a.default)(s);;){var l;if(o){if(u>=s.length)break;l=s[u++]}else{if(u=s.next(),u.done)break;l=u.value}var c=l,p=c.node.local.name;if(c.isImportDefaultSpecifier()&&(i.push("default"),n.push({kind:"named",imported:"default",local:p})),c.isImportSpecifier()){var h=c.node.imported.name;i.push(h),n.push({kind:"named",imported:h,local:p})}c.isImportNamespaceSpecifier()&&(i.push("*"),n.push({kind:"namespace",local:p}))}}}},{"babel-runtime/core-js/get-iterator":113,"babel-types":169}],43:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=E[e];return null==t?E[e]=x.default.existsSync(e):t}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],r=e.filename,n=new D(t);return!1!==e.babelrc&&n.findConfigs(r),n.mergeConfig({options:e,alias:"base",dirname:r&&b.default.dirname(r)}),n.configs}r.__esModule=!0;var o=e("babel-runtime/core-js/object/assign"),u=i(o),l=e("babel-runtime/helpers/classCallCheck"),c=i(l);r.default=a;var p=e("../../../helpers/resolve"),h=i(p),f=e("json5"),d=i(f),m=e("path-is-absolute"),y=i(m),g=e("path"),b=i(g),v=e("fs"),x=i(v),E={},A={},D=function(){function e(t){(0,c.default)(this,e),this.resolvedConfigs=[],this.configs=[],this.log=t}return e.prototype.findConfigs=function(e){if(e){(0,y.default)(e)||(e=b.default.join(n.cwd(),e));for(var t=!1,r=!1;e!==(e=b.default.dirname(e));){if(!t){var i=b.default.join(e,".babelrc");s(i)&&(this.addConfig(i),t=!0);var a=b.default.join(e,"package.json");!t&&s(a)&&(t=this.addConfig(a,"babel",JSON))}if(!r){var o=b.default.join(e,".babelignore");s(o)&&(this.addIgnoreConfig(o),r=!0)}if(r&&t)return}}},e.prototype.addIgnoreConfig=function(e){var t=x.default.readFileSync(e,"utf8"),r=t.split("\n");r=r.map(function(e){return e.replace(/#(.*?)$/,"").trim()}).filter(function(e){return!!e}),r.length&&this.mergeConfig({options:{ignore:r},alias:e,dirname:b.default.dirname(e)})},e.prototype.addConfig=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d.default;if(this.resolvedConfigs.indexOf(e)>=0)return!1;this.resolvedConfigs.push(e);var n=x.default.readFileSync(e,"utf8"),i=void 0;try{i=A[n]=A[n]||r.parse(n),t&&(i=i[t])}catch(t){throw t.message=e+": Error while parsing JSON - "+t.message,t}return this.mergeConfig({options:i,alias:e,dirname:b.default.dirname(e)}),!!i},e.prototype.mergeConfig=function(e){var t=e.options,r=e.alias,i=e.loc,s=e.dirname;if(!t)return!1;if(t=(0,u.default)({},t),s=s||n.cwd(),i=i||r,t.extends){var a=(0,h.default)(t.extends,s);a?this.addConfig(a):this.log&&this.log.error("Couldn't resolve extends clause of "+t.extends+" in "+r),delete t.extends}this.configs.push({options:t,alias:r,loc:i,dirname:s});var o=void 0,l=n.env.BABEL_ENV||n.env.NODE_ENV||"development";t.env&&(o=t.env[l],delete t.env),this.mergeConfig({options:o,alias:r+".env."+l,dirname:s})},e}();t.exports=r.default}).call(this,e("_process"))},{"../../../helpers/resolve":37,_process:539,"babel-runtime/core-js/object/assign":117,"babel-runtime/helpers/classCallCheck":127,fs:182,json5:313,path:535,"path-is-absolute":536}],44:[function(e,t,r){"use strict";t.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc",default:"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},env:{hidden:!0,default:{}},mode:{description:"",hidden:!0},retainLines:{type:"boolean",default:!1,description:"retain line numbers - will result in really ugly code"},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean",default:!0},suppressDeprecationMessages:{type:"boolean",default:!1,hidden:!0},presets:{type:"list",description:"",default:[]},plugins:{type:"list",default:[],description:""},ignore:{type:"list",description:"list of glob paths to **not** compile",default:[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,default:!0,type:"boolean"},metadata:{hidden:!0,default:!0,type:"boolean"},ast:{hidden:!0,default:!0,type:"boolean"},extends:{type:"string",hidden:!0},comments:{type:"boolean",default:!0,description:"write comments to generated output (true by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},wrapPluginVisitorMethod:{hidden:!0,description:"optional callback to wrap all visitor methods"},compact:{type:"booleanString",default:"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},minified:{type:"boolean",default:!1,description:"save as much bytes when printing [true|false]"},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]",default:!1,shorthand:"s"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},babelrc:{description:"Whether or not to look up .babelrc and .babelignore files",type:"boolean",default:!0},sourceType:{description:"",default:"module"},auxiliaryCommentBefore:{type:"string",description:"print a comment before any injected non-user code"},auxiliaryCommentAfter:{type:"string",description:"print a comment after any injected non-user code"},resolveModuleSource:{hidden:!0},getModuleId:{hidden:!0},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},moduleIds:{type:"boolean",default:!1,shorthand:"M",description:"insert an explicit id for modules"},moduleId:{description:"specify a custom name for module ids",type:"string"},passPerPreset:{description:"Whether to spawn a traversal pass per a preset. By default all presets are merged.",type:"boolean",default:!1,hidden:!0},parserOpts:{description:"Options to pass into the parser, or to change parsers (parserOpts.parser)",default:!1},generatorOpts:{description:"Options to pass into the generator, or to change generators (generatorOpts.generator)",default:!1}}},{}],45:[function(e,t,r){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e){var r=e[t];if(null!=r){var n=o.default[t];if(n&&n.alias&&(n=o.default[n.alias]),n){var i=s[n.type];i&&(r=i(r)),e[t]=r}}}return e}r.__esModule=!0,r.config=void 0,r.normaliseOptions=n;var i=e("./parsers"),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(i),a=e("./config"),o=function(e){return e&&e.__esModule?e:{default:e}}(a);r.config=o.default},{"./config":44,"./parsers":47}],46:[function(e,t,r){(function(n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var a=e("babel-runtime/helpers/objectWithoutProperties"),o=s(a),u=e("babel-runtime/core-js/json/stringify"),l=s(u),c=e("babel-runtime/core-js/object/assign"),p=s(c),h=e("babel-runtime/core-js/get-iterator"),f=s(h),d=e("babel-runtime/helpers/typeof"),m=s(d),y=e("babel-runtime/helpers/classCallCheck"),g=s(y),b=e("../../../api/node"),v=i(b),x=e("../../plugin"),E=s(x),A=e("babel-messages"),D=i(A),C=e("./index"),S=e("../../../helpers/resolve-plugin"),_=s(S),w=e("../../../helpers/resolve-preset"),k=s(w),F=e("lodash/cloneDeepWith"),T=s(F),P=e("lodash/clone"),B=s(P),O=e("../../../helpers/merge"),j=s(O),N=e("./config"),I=s(N),L=e("./removed"),M=s(L),R=e("./build-config-chain"),U=s(R),V=e("path"),q=s(V),G=function(){function t(e){(0,g.default)(this,t),this.resolvedConfigs=[],this.options=t.createBareOptions(),this.log=e}return t.memoisePluginContainer=function(e,r,n,i){for(var s=t.memoisedPlugins,a=Array.isArray(s),o=0,s=a?s:(0,f.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var l=u;if(l.container===e)return l.plugin}var c=void 0;if(c="function"==typeof e?e(v):e,"object"===(void 0===c?"undefined":(0,m.default)(c))){var p=new E.default(c,i);return t.memoisedPlugins.push({container:e,plugin:p}),p}throw new TypeError(D.get("pluginNotObject",r,n,void 0===c?"undefined":(0,m.default)(c))+r+n)},t.createBareOptions=function(){var e={};for(var t in I.default){ +var r=I.default[t];e[t]=(0,B.default)(r.default)}return e},t.normalisePlugin=function(e,r,n,i){if(!((e=e.__esModule?e.default:e)instanceof E.default)){if("function"!=typeof e&&"object"!==(void 0===e?"undefined":(0,m.default)(e)))throw new TypeError(D.get("pluginNotFunction",r,n,void 0===e?"undefined":(0,m.default)(e)));e=t.memoisePluginContainer(e,r,n,i)}return e.init(r,n),e},t.normalisePlugins=function(r,n,i){return i.map(function(i,s){var a=void 0,o=void 0;if(!i)throw new TypeError("Falsy value found in plugins");Array.isArray(i)?(a=i[0],o=i[1]):a=i;var u="string"==typeof a?a:r+"$"+s;if("string"==typeof a){var l=(0,_.default)(a,n);if(!l)throw new ReferenceError(D.get("pluginUnknown",a,r,s,n));a=e(l)}return a=t.normalisePlugin(a,r,s,u),[a,o]})},t.prototype.mergeOptions=function(e){var r=this,i=e.options,s=e.extending,a=e.alias,o=e.loc,u=e.dirname;if(a=a||"foreign",i){("object"!==(void 0===i?"undefined":(0,m.default)(i))||Array.isArray(i))&&this.log.error("Invalid options type for "+a,TypeError);var l=(0,T.default)(i,function(e){if(e instanceof E.default)return e});u=u||n.cwd(),o=o||a;for(var c in l){if(!I.default[c]&&this.log)if(M.default[c])this.log.error("Using removed Babel 5 option: "+a+"."+c+" - "+M.default[c].message,ReferenceError);else{var h="Unknown option: "+a+"."+c+". Check out http://babeljs.io/docs/usage/options/ for more information about options.";this.log.error(h+"\n\nA common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.",ReferenceError)}}(0,C.normaliseOptions)(l),l.plugins&&(l.plugins=t.normalisePlugins(o,u,l.plugins)),l.presets&&(l.passPerPreset?l.presets=this.resolvePresets(l.presets,u,function(e,t){r.mergeOptions({options:e,extending:e,alias:t,loc:t,dirname:u})}):(this.mergePresets(l.presets,u),delete l.presets)),i===s?(0,p.default)(s,l):(0,j.default)(s||this.options,l)}},t.prototype.mergePresets=function(e,t){var r=this;this.resolvePresets(e,t,function(e,t){r.mergeOptions({options:e,alias:t,loc:t,dirname:q.default.dirname(t||"")})})},t.prototype.resolvePresets=function(t,r,n){return t.map(function(t){var i=void 0;if(Array.isArray(t)){if(t.length>2)throw new Error("Unexpected extra options "+(0,l.default)(t.slice(2))+" passed to preset.");var s=t;t=s[0],i=s[1]}var a=void 0;try{if("string"==typeof t){if(!(a=(0,k.default)(t,r)))throw new Error("Couldn't find preset "+(0,l.default)(t)+" relative to directory "+(0,l.default)(r));t=e(a)}if("object"===(void 0===t?"undefined":(0,m.default)(t))&&t.__esModule)if(t.default)t=t.default;else{var u=t,c=(u.__esModule,(0,o.default)(u,["__esModule"]));t=c}if("object"===(void 0===t?"undefined":(0,m.default)(t))&&t.buildPreset&&(t=t.buildPreset),"function"!=typeof t&&void 0!==i)throw new Error("Options "+(0,l.default)(i)+" passed to "+(a||"a preset")+" which does not accept options.");if("function"==typeof t&&(t=t(v,i,{dirname:r})),"object"!==(void 0===t?"undefined":(0,m.default)(t)))throw new Error("Unsupported preset format: "+t+".");n&&n(t,a)}catch(e){throw a&&(e.message+=" (While processing preset: "+(0,l.default)(a)+")"),e}return t})},t.prototype.normaliseOptions=function(){var e=this.options;for(var t in I.default){var r=I.default[t],n=e[t];!n&&r.optional||(r.alias?e[r.alias]=e[r.alias]||n:e[t]=n)}},t.prototype.init=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,U.default)(e,this.log),r=Array.isArray(t),n=0,t=r?t:(0,f.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i;this.mergeOptions(s)}return this.normaliseOptions(e),this.options},t}();r.default=G,G.memoisedPlugins=[],t.exports=r.default}).call(this,e("_process"))},{"../../../api/node":29,"../../../helpers/merge":32,"../../../helpers/resolve-plugin":35,"../../../helpers/resolve-preset":36,"../../plugin":53,"./build-config-chain":43,"./config":44,"./index":45,"./removed":48,_process:539,"babel-messages":103,"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/json/stringify":114,"babel-runtime/core-js/object/assign":117,"babel-runtime/helpers/classCallCheck":127,"babel-runtime/helpers/objectWithoutProperties":129,"babel-runtime/helpers/typeof":131,"lodash/clone":480,"lodash/cloneDeepWith":482,path:535}],47:[function(e,t,r){"use strict";function n(e){return!!e}function i(e){return l.booleanify(e)}function s(e){return l.list(e)}r.__esModule=!0,r.filename=void 0,r.boolean=n,r.booleanString=i,r.list=s;var a=e("slash"),o=function(e){return e&&e.__esModule?e:{default:e}}(a),u=e("../../../util"),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u);r.filename=o.default},{"../../../util":54,slash:589}],48:[function(e,t,r){"use strict";t.exports={auxiliaryComment:{message:"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"},blacklist:{message:"Put the specific transforms you want in the `plugins` option"},breakConfig:{message:"This is not a necessary option in Babel 6"},experimental:{message:"Put the specific transforms you want in the `plugins` option"},externalHelpers:{message:"Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"},extra:{message:""},jsxPragma:{message:"use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"},loose:{message:"Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."},metadataUsedHelpers:{message:"Not required anymore as this is enabled by default"},modules:{message:"Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"},nonStandard:{message:"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"},optional:{message:"Put the specific transforms you want in the `plugins` option"},sourceMapName:{message:"Use the `sourceMapTarget` option"},stage:{message:"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"},whitelist:{message:"Put the specific transforms you want in the `plugins` option"}}},{}],49:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("../plugin"),s=n(i),a=e("lodash/sortBy"),o=n(a);r.default=new s.default({name:"internal.blockHoist",visitor:{Block:{exit:function(e){for(var t=e.node,r=!1,n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return t.code=!1,t.mode="lint",this.transform(e,t)},e.prototype.pretransform=function(e,t){var r=new p.default(t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r})},e.prototype.transform=function(e,t){var r=new p.default(t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r.transform()})},e.prototype.analyse=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];return t.code=!1,r&&(t.plugins=t.plugins||[],t.plugins.push(new l.default({visitor:r}))),this.transform(e,t).metadata},e.prototype.transformFromAst=function(e,t,r){e=(0,o.default)(e);var n=new p.default(r,this);return n.wrap(t,function(){return n.addCode(t),n.addAst(e),n.transform()})},e}();r.default=h,t.exports=r.default},{"../helpers/normalize-ast":33,"./file":40,"./plugin":53,"babel-runtime/helpers/classCallCheck":127}],52:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/helpers/classCallCheck"),s=n(i),a=e("babel-runtime/helpers/possibleConstructorReturn"),o=n(a),u=e("babel-runtime/helpers/inherits"),l=n(u),c=e("../store"),p=n(c),h=e("./file"),f=(n(h),function(e){function t(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,s.default)(this,t);var a=(0,o.default)(this,e.call(this));return a.plugin=n,a.key=n.key,a.file=r,a.opts=i,a}return(0,l.default)(t,e),t.prototype.addHelper=function(){var e;return(e=this.file).addHelper.apply(e,arguments)},t.prototype.addImport=function(){var e;return(e=this.file).addImport.apply(e,arguments)},t.prototype.getModuleName=function(){var e;return(e=this.file).getModuleName.apply(e,arguments)},t.prototype.buildCodeFrameError=function(){var e;return(e=this.file).buildCodeFrameError.apply(e,arguments)},t}(p.default));r.default=f,t.exports=r.default},{"../store":38,"./file":40,"babel-runtime/helpers/classCallCheck":127,"babel-runtime/helpers/inherits":128,"babel-runtime/helpers/possibleConstructorReturn":130}],53:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/core-js/get-iterator"),s=n(i),a=e("babel-runtime/helpers/classCallCheck"),o=n(a),u=e("babel-runtime/helpers/possibleConstructorReturn"),l=n(u),c=e("babel-runtime/helpers/inherits"),p=n(c),h=e("./file/options/option-manager"),f=n(h),d=e("babel-messages"),m=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(d),y=e("../store"),g=n(y),b=e("babel-traverse"),v=n(b),x=e("lodash/assign"),E=n(x),A=e("lodash/clone"),D=n(A),C=["enter","exit"],S=function(e){function t(r,n){(0,o.default)(this,t);var i=(0,l.default)(this,e.call(this));return i.initialized=!1,i.raw=(0,E.default)({},r),i.key=i.take("name")||n,i.manipulateOptions=i.take("manipulateOptions"),i.post=i.take("post"),i.pre=i.take("pre"),i.visitor=i.normaliseVisitor((0,D.default)(i.take("visitor"))||{}),i}return(0,p.default)(t,e),t.prototype.take=function(e){var t=this.raw[e];return delete this.raw[e],t},t.prototype.chain=function(e,t){if(!e[t])return this[t];if(!this[t])return e[t];var r=[e[t],this[t]];return function(){for(var e=void 0,t=arguments.length,n=Array(t),i=0;i=a.length)break;l=a[u++]}else{if(u=a.next(),u.done)break;l=u.value}var c=l;if(c){var p=c.apply(this,n);null!=p&&(e=p)}}return e}},t.prototype.maybeInherit=function(e){var t=this.take("inherits");t&&(t=f.default.normalisePlugin(t,e,"inherits"),this.manipulateOptions=this.chain(t,"manipulateOptions"),this.post=this.chain(t,"post"),this.pre=this.chain(t,"pre"),this.visitor=v.default.visitors.merge([t.visitor,this.visitor]))},t.prototype.init=function(e,t){if(!this.initialized){this.initialized=!0,this.maybeInherit(e);for(var r in this.raw)throw new Error(m.get("pluginInvalidProperty",e,t,r))}},t.prototype.normaliseVisitor=function(e){for(var t=C,r=Array.isArray(t),n=0,t=r?t:(0,s.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}if(e[i])throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes.")}return v.default.explode(e),e},t}(g.default);r.default=S,t.exports=r.default},{"../store":38,"./file/options/option-manager":46,"babel-messages":103,"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/classCallCheck":127,"babel-runtime/helpers/inherits":128,"babel-runtime/helpers/possibleConstructorReturn":130,"babel-traverse":136,"lodash/assign":477,"lodash/clone":480}],54:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var r=t||i.EXTENSIONS,n=S.default.extname(e);return(0,E.default)(r,n)}function s(e){return e?Array.isArray(e)?e:"string"==typeof e?e.split(","):[e]:[]}function a(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(m.default).join("|"),"i")),"string"==typeof e){e=(0,w.default)(e),((0,g.default)(e,"./")||(0,g.default)(e,"*/"))&&(e=e.slice(2)),(0,g.default)(e,"**/")&&(e=e.slice(3));var t=v.default.makeRe(e,{nocase:!0});return new RegExp(t.source.slice(1,-1),"i")}if((0,D.default)(e))return e;throw new TypeError("illegal type for regexify")}function o(e,t){return e?"boolean"==typeof e?o([e],t):"string"==typeof e?o(s(e),t):Array.isArray(e)?(t&&(e=e.map(t)),e):[e]:[]}function u(e){return"true"===e||1==e||!("false"===e||0==e||!e)&&e}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2];if(e=e.replace(/\\/g,"/"),r){for(var n=r,i=Array.isArray(n),s=0,n=i?n:(0,h.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}if(c(a,e))return!1}return!0}if(t.length)for(var o=t,u=Array.isArray(o),l=0,o=u?o:(0,h.default)(o);;){var p;if(u){if(l>=o.length)break;p=o[l++]}else{if(l=o.next(),l.done)break;p=l.value}var f=p;if(c(f,e))return!0}return!1}function c(e,t){return"function"==typeof e?e(t):e.test(t)}r.__esModule=!0,r.inspect=r.inherits=void 0;var p=e("babel-runtime/core-js/get-iterator"),h=n(p),f=e("util");Object.defineProperty(r,"inherits",{enumerable:!0,get:function(){return f.inherits}}),Object.defineProperty(r,"inspect",{enumerable:!0,get:function(){return f.inspect}}),r.canCompile=i,r.list=s,r.regexify=a,r.arrayify=o,r.booleanify=u,r.shouldIgnore=l;var d=e("lodash/escapeRegExp"),m=n(d),y=e("lodash/startsWith"),g=n(y),b=e("minimatch"),v=n(b),x=e("lodash/includes"),E=n(x),A=e("lodash/isRegExp"),D=n(A),C=e("path"),S=n(C),_=e("slash"),w=n(_);i.EXTENSIONS=[".js",".jsx",".es6",".es"]},{"babel-runtime/core-js/get-iterator":113,"lodash/escapeRegExp":486,"lodash/includes":496,"lodash/isRegExp":508,"lodash/startsWith":521,minimatch:531,path:535,slash:589,util:601}],55:[function(e,t,r){function n(){this._array=[],this._set=Object.create(null)}var i=e("./util"),s=Object.prototype.hasOwnProperty;n.fromArray=function(e,t){for(var r=new n,i=0,s=e.length;i=0&&e>1;return t?-r:r}var s=e("./base64");r.encode=function(e){var t,r="",i=n(e);do{t=31&i,i>>>=5,i>0&&(t|=32),r+=s.encode(t)}while(i>0);return r},r.decode=function(e,t,r){var n,a,o=e.length,u=0,l=0;do{if(t>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(a=s.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(32&a),a&=31,u+=a<0?t-u>1?n(u,t,i,s,a,o):o==r.LEAST_UPPER_BOUND?t1?n(e,u,i,s,a,o):o==r.LEAST_UPPER_BOUND?u:e<0?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,i,s){if(0===t.length)return-1;var a=n(-1,t.length,e,t,i,s||r.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===i(t[a],t[a-1],!0);)--a;return a}},{}],59:[function(e,t,r){function n(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||s.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var s=e("./util");i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(s.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=i},{"./util":64}],60:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function i(e,t){return Math.round(e+Math.random()*(t-e))}function s(e,t,r,a){if(r=0){var s=this._originalMappings[i];if(void 0===e.column)for(var a=s.originalLine;s&&s.originalLine===a;)n.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==l;)n.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return n},r.SourceMapConsumer=n,i.prototype=Object.create(n.prototype),i.prototype.consumer=n,i.fromSourceMap=function(e){var t=Object.create(i.prototype),r=t._names=l.fromArray(e._names.toArray(),!0),n=t._sources=l.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var a=e._mappings.toArray().slice(),u=t.__generatedMappings=[],c=t.__originalMappings=[],h=0,f=a.length;h1&&(r.source=m+i[1],m+=i[1],r.originalLine=f+i[2],f=r.originalLine,r.originalLine+=1,r.originalColumn=d+i[3],d=r.originalColumn,i.length>4&&(r.name=y+i[4],y+=i[4])),A.push(r),"number"==typeof r.originalLine&&E.push(r)}p(A,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,p(E,o.compareByOriginalPositions),this.__originalMappings=E},i.prototype._findMapping=function(e,t,r,n,i,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var s=o.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=o.join(this.sourceRoot,s)));var a=o.getArg(i,"name",null);return null!==a&&(a=this._names.at(a)),{source:s,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=o.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=o.getArg(e,"source");if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};t=this._sources.indexOf(t);var r={source:t,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===r.source)return{line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=i,a.prototype=Object.create(n.prototype),a.prototype.constructor=n,a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){for(var e=[],t=0;t0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n,a=0,o=1,u=0,l=0,c=0,p=0,h="",f=this._mappings.toArray(),d=0,m=f.length;d0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-a),a=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),e+=i.encode(n-p),p=n,e+=i.encode(t.originalLine-1-l),l=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=i.encode(r-c),c=r)),h+=e}return h},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var r=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.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},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{"./array-set":55,"./base64-vlq":56,"./mapping-list":59,"./util":64}],63:[function(e,t,r){function n(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[a]=!0,null!=n&&this.add(n)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),a="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function i(e,t){if(null===e||void 0===e.source)a.add(t);else{var i=r?s.join(r,e.source):e.source;a.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var a=new n,o=e.split(/(\r?\n)/),u=function(){return o.shift()+(o.shift()||"")},l=1,c=0,p=null;return t.eachMapping(function(e){if(null!==p){if(!(l0&&(p&&i(p,u()),a.add(o.join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=s.join(r,e)),a.setSourceContent(e,n))}),a},n.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[a]&&"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},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;r0){for(t=[],r=0;r=0;c--)a=u[c],"."===a?u.splice(c,1):".."===a?l++:l>0&&(""===a?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return t=u.join("/"),""===t&&(t=o?"/":"."),n?(n.path=t,s(n)):t}function o(e,t){""===e&&(e="."),""===t&&(t=".");var r=i(t),n=i(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),s(r);if(r||t.match(b))return t;if(n&&!n.host&&!n.path)return n.host=t,s(n);var o="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=o,s(n)):o}function u(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(n<0)return t;if(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}function l(e){return e}function c(e){return h(e)?"$"+e:e}function p(e){return h(e)?e.slice(1):e}function h(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function f(e,t,r){var n=e.source-t.source;return 0!==n?n:0!==(n=e.originalLine-t.originalLine)?n:0!==(n=e.originalColumn-t.originalColumn)||r?n:0!==(n=e.generatedColumn-t.generatedColumn)?n:(n=e.generatedLine-t.generatedLine,0!==n?n:e.name-t.name)}function d(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!==(n=e.generatedColumn-t.generatedColumn)||r?n:0!==(n=e.source-t.source)?n:0!==(n=e.originalLine-t.originalLine)?n:(n=e.originalColumn-t.originalColumn,0!==n?n:e.name-t.name)}function m(e,t){return e===t?0:e>t?1:-1}function y(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!==(r=e.generatedColumn-t.generatedColumn)?r:0!==(r=m(e.source,t.source))?r:0!==(r=e.originalLine-t.originalLine)?r:(r=e.originalColumn-t.originalColumn,0!==r?r:m(e.name,t.name))}r.getArg=n;var g=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,b=/^data:.+\,.+$/;r.urlParse=i,r.urlGenerate=s,r.normalize=a,r.join=o,r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(g)},r.relative=u;var v=function(){return!("__proto__"in Object.create(null))}();r.toSetString=v?l:c,r.fromSetString=v?l:p,r.compareByOriginalPositions=f,r.compareByGeneratedPositionsDeflated=d,r.compareByGeneratedPositionsInflated=y},{}],65:[function(e,t,r){r.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,r.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,r.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":61,"./lib/source-map-generator":62,"./lib/source-node":63}],66:[function(e,t,r){t.exports={_args:[[{raw:"babel-core@^6.18.2",scope:null,escapedName:"babel-core",name:"babel-core",rawSpec:"^6.18.2",spec:">=6.18.2 <7.0.0",type:"range"},"/Users/evgenypoberezkin/JSON/ajv-v4/node_modules/regenerator"]],_from:"babel-core@>=6.18.2 <7.0.0",_id:"babel-core@6.24.0",_inCache:!0,_location:"/babel-core",_nodeVersion:"6.9.0",_npmOperationalInternal:{host:"packages-18-east.internal.npmjs.com",tmp:"tmp/babel-core-6.24.0.tgz_1489371490272_0.8722315817140043"},_npmUser:{name:"hzoo",email:"hi@henryzoo.com"},_npmVersion:"3.10.10",_phantomChildren:{},_requested:{raw:"babel-core@^6.18.2",scope:null,escapedName:"babel-core",name:"babel-core",rawSpec:"^6.18.2",spec:">=6.18.2 <7.0.0",type:"range"},_requiredBy:["/babel-register","/regenerator"],_resolved:"https://registry.npmjs.org/babel-core/-/babel-core-6.24.0.tgz",_shasum:"8f36a0a77f5c155aed6f920b844d23ba56742a02",_shrinkwrap:null,_spec:"babel-core@^6.18.2",_where:"/Users/evgenypoberezkin/JSON/ajv-v4/node_modules/regenerator",author:{name:"Sebastian McKenzie",email:"sebmck@gmail.com"},dependencies:{"babel-code-frame":"^6.22.0","babel-generator":"^6.24.0","babel-helpers":"^6.23.0","babel-messages":"^6.23.0","babel-register":"^6.24.0","babel-runtime":"^6.22.0","babel-template":"^6.23.0","babel-traverse":"^6.23.1","babel-types":"^6.23.0",babylon:"^6.11.0","convert-source-map":"^1.1.0",debug:"^2.1.1",json5:"^0.5.0",lodash:"^4.2.0",minimatch:"^3.0.2","path-is-absolute":"^1.0.0",private:"^0.1.6",slash:"^1.0.0","source-map":"^0.5.0"},description:"Babel compiler core.",devDependencies:{"babel-helper-fixtures":"^6.22.0","babel-helper-transform-fixture-test-runner":"^6.24.0","babel-polyfill":"^6.23.0"},directories:{},dist:{shasum:"8f36a0a77f5c155aed6f920b844d23ba56742a02",tarball:"https://registry.npmjs.org/babel-core/-/babel-core-6.24.0.tgz"},homepage:"https://babeljs.io/",keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var","babel-core","compiler"],license:"MIT",maintainers:[{name:"amasad",email:"amjad.masad@gmail.com"},{name:"hzoo",email:"hi@henryzoo.com"},{name:"jmm",email:"npm-public@jessemccarthy.net"},{name:"loganfsmyth",email:"loganfsmyth@gmail.com"},{name:"sebmck",email:"sebmck@gmail.com"},{name:"thejameskyle",email:"me@thejameskyle.com"}],name:"babel-core",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"https://github.com/babel/babel/tree/master/packages/babel-core"},scripts:{bench:"make bench",test:"make test"},version:"6.24.0"}},{}],67:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/helpers/classCallCheck"),s=n(i),a=e("trim-right"),o=n(a),u=/^[ \t]+$/,l=function(){function e(t){(0,s.default)(this,e),this._map=null,this._buf=[],this._last="",this._queue=[],this._position={line:1,column:0},this._sourcePosition={identifierName:null,line:null,column:null,filename:null},this._map=t}return e.prototype.get=function(){this._flush();var e=this._map,t={code:(0,o.default)(this._buf.join("")),map:null,rawMappings:e&&e.getRawMappings()};return e&&Object.defineProperty(t,"map",{configurable:!0,enumerable:!0,get:function(){return this.map=e.get()},set:function(e){Object.defineProperty(this,"map",{value:e,writable:!0})}}),t},e.prototype.append=function(e){this._flush();var t=this._sourcePosition,r=t.line,n=t.column,i=t.filename,s=t.identifierName;this._append(e,r,n,s,i)},e.prototype.queue=function(e){if("\n"===e)for(;this._queue.length>0&&u.test(this._queue[0][0]);)this._queue.shift();var t=this._sourcePosition,r=t.line,n=t.column,i=t.filename,s=t.identifierName;this._queue.unshift([e,r,n,s,i])},e.prototype._flush=function(){for(var e=void 0;e=this._queue.pop();)this._append.apply(this,e)},e.prototype._append=function(e,t,r,n,i){this._map&&"\n"!==e[0]&&this._map.mark(this._position.line,this._position.column,t,r,n,i),this._buf.push(e),this._last=e[e.length-1];for(var s=0;s0&&"\n"===this._queue[0][0]&&this._queue.shift()},e.prototype.removeLastSemicolon=function(){this._queue.length>0&&";"===this._queue[0][0]&&this._queue.shift()},e.prototype.endsWith=function(e){if(1===e.length){var t=void 0;if(this._queue.length>0){var r=this._queue[0][0];t=r[r.length-1]}else t=this._last;return t===e}var n=this._last+this._queue.reduce(function(e,t){return t[0]+e},"");return e.length<=n.length&&n.slice(-e.length)===e},e.prototype.hasContent=function(){return this._queue.length>0||!!this._last},e.prototype.source=function(e,t){if(!e||t){var r=t?t[e]:null;this._sourcePosition.identifierName=t&&t.identifierName||null,this._sourcePosition.line=r?r.line:null,this._sourcePosition.column=r?r.column:null,this._sourcePosition.filename=t&&t.filename||null}},e.prototype.withSource=function(e,t,r){if(!this._map)return r();var n=this._sourcePosition.line,i=this._sourcePosition.column,s=this._sourcePosition.filename,a=this._sourcePosition.identifierName;this.source(e,t),r(),this._sourcePosition.line=n,this._sourcePosition.column=i,this._sourcePosition.filename=s,this._sourcePosition.identifierName=a},e.prototype.getCurrentColumn=function(){var e=this._queue.reduce(function(e,t){return t[0]+e},""),t=e.lastIndexOf("\n");return-1===t?this._position.column+e.length:e.length-1-t},e.prototype.getCurrentLine=function(){for(var e=this._queue.reduce(function(e,t){return t[0]+e},""),t=0,r=0;r")),this.space(),this.print(e.returnType,e)}function g(e){this.print(e.name,e),e.optional&&this.token("?"),this.token(":"),this.space(),this.print(e.typeAnnotation,e)}function b(e){this.print(e.id,e),this.print(e.typeParameters,e)}function v(e){this.print(e.id,e),this.print(e.typeParameters,e),e.extends.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),e.mixins&&e.mixins.length&&(this.space(),this.word("mixins"),this.space(),this.printList(e.mixins,e)),this.space(),this.print(e.body,e)}function x(e){"plus"===e.variance?this.token("+"):"minus"===e.variance&&this.token("-")}function E(e){this.word("interface"),this.space(),this._interfaceish(e)}function A(){this.space(),this.token("&"),this.space()}function D(e){this.printJoin(e.types,e,{separator:A})}function C(){this.word("mixed")}function S(){this.word("empty")}function _(e){this.token("?"),this.print(e.typeAnnotation,e)}function w(){this.word("number")}function k(){this.word("string")}function F(){this.word("this")}function T(e){this.token("["),this.printList(e.types,e),this.token("]")}function P(e){this.word("typeof"),this.space(),this.print(e.argument,e)}function B(e){this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),this.space(),this.token("="),this.space(),this.print(e.right,e),this.semicolon()}function O(e){this.token(":"),this.space(),e.optional&&this.token("?"),this.print(e.typeAnnotation,e)}function j(e){this._variance(e),this.word(e.name),e.bound&&this.print(e.bound,e),e.default&&(this.space(),this.token("="),this.space(),this.print(e.default,e))}function N(e){this.token("<"),this.printList(e.params,e,{}),this.token(">")}function I(e){var t=this;e.exact?this.token("{|"):this.token("{");var r=e.properties.concat(e.callProperties,e.indexers);r.length&&(this.space(),this.printJoin(r,e,{addNewlines:function(e){if(e&&!r[0])return 1},indent:!0,statement:!0,iterator:function(){1!==r.length&&(t.format.flowCommaSeparator?t.token(","):t.semicolon(),t.space())}}),this.space()),e.exact?this.token("|}"):this.token("}")}function L(e){e.static&&(this.word("static"),this.space()),this.print(e.value,e)}function M(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.token("["),this.print(e.id,e),this.token(":"),this.space(),this.print(e.key,e),this.token("]"),this.token(":"),this.space(),this.print(e.value,e)}function R(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.print(e.key,e),e.optional&&this.token("?"),this.token(":"),this.space(),this.print(e.value,e)}function U(e){this.print(e.qualification,e),this.token("."),this.print(e.id,e)}function V(){this.space(),this.token("|"),this.space()}function q(e){this.printJoin(e.types,e,{separator:V})}function G(e){this.token("("),this.print(e.expression,e),this.print(e.typeAnnotation,e),this.token(")")}function X(){this.word("void")}r.__esModule=!0,r.AnyTypeAnnotation=n,r.ArrayTypeAnnotation=i,r.BooleanTypeAnnotation=s,r.BooleanLiteralTypeAnnotation=a,r.NullLiteralTypeAnnotation=o,r.DeclareClass=u,r.DeclareFunction=l,r.DeclareInterface=c,r.DeclareModule=p,r.DeclareModuleExports=h,r.DeclareTypeAlias=f,r.DeclareVariable=d,r.ExistentialTypeParam=m,r.FunctionTypeAnnotation=y,r.FunctionTypeParam=g,r.InterfaceExtends=b,r._interfaceish=v,r._variance=x,r.InterfaceDeclaration=E,r.IntersectionTypeAnnotation=D,r.MixedTypeAnnotation=C,r.EmptyTypeAnnotation=S,r.NullableTypeAnnotation=_;var J=e("./types");Object.defineProperty(r,"NumericLiteralTypeAnnotation",{enumerable:!0,get:function(){return J.NumericLiteral}}),Object.defineProperty(r,"StringLiteralTypeAnnotation",{enumerable:!0,get:function(){return J.StringLiteral}}),r.NumberTypeAnnotation=w,r.StringTypeAnnotation=k,r.ThisTypeAnnotation=F,r.TupleTypeAnnotation=T,r.TypeofTypeAnnotation=P,r.TypeAlias=B,r.TypeAnnotation=O,r.TypeParameter=j,r.TypeParameterInstantiation=N,r.ObjectTypeAnnotation=I,r.ObjectTypeCallProperty=L,r.ObjectTypeIndexer=M,r.ObjectTypeProperty=R,r.QualifiedTypeIdentifier=U,r.UnionTypeAnnotation=q,r.TypeCastExpression=G,r.VoidTypeAnnotation=X,r.ClassImplements=b,r.GenericTypeAnnotation=b,r.TypeParameterDeclaration=N},{"./types":77}],72:[function(e,t,r){"use strict";function n(e){this.print(e.name,e),e.value&&(this.token("="),this.print(e.value,e))}function i(e){this.word(e.name)}function s(e){this.print(e.namespace,e),this.token(":"),this.print(e.name,e)}function a(e){this.print(e.object,e),this.token("."),this.print(e.property,e)}function o(e){this.token("{"),this.token("..."),this.print(e.argument,e),this.token("}")}function u(e){this.token("{"),this.print(e.expression,e),this.token("}")}function l(e){this.token("{"),this.token("..."),this.print(e.expression,e),this.token("}")}function c(e){this.token(e.value)}function p(e){var t=e.openingElement;if(this.print(t,e),!t.selfClosing){this.indent();for(var r=e.children,n=Array.isArray(r),i=0,r=n?r:(0,g.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;this.print(a,e)}this.dedent(),this.print(e.closingElement,e)}}function h(){this.space()}function f(e){this.token("<"),this.print(e.name,e),e.attributes.length>0&&(this.space(),this.printJoin(e.attributes,e,{separator:h})),e.selfClosing?(this.space(),this.token("/>")):this.token(">")}function d(e){this.token("")}function m(){}r.__esModule=!0;var y=e("babel-runtime/core-js/get-iterator"),g=function(e){return e&&e.__esModule?e:{default:e}}(y);r.JSXAttribute=n,r.JSXIdentifier=i,r.JSXNamespacedName=s,r.JSXMemberExpression=a,r.JSXSpreadAttribute=o,r.JSXExpressionContainer=u,r.JSXSpreadChild=l,r.JSXText=c,r.JSXElement=p,r.JSXOpeningElement=f,r.JSXClosingElement=d,r.JSXEmptyExpression=m},{"babel-runtime/core-js/get-iterator":113}],73:[function(e,t,r){"use strict";function n(e){var t=this;this.print(e.typeParameters,e),this.token("("),this.printList(e.params,e,{iterator:function(e){e.optional&&t.token("?"),t.print(e.typeAnnotation,e)}}),this.token(")"),e.returnType&&this.print(e.returnType,e)}function i(e){var t=e.kind,r=e.key;"method"!==t&&"init"!==t||e.generator&&this.token("*"),"get"!==t&&"set"!==t||(this.word(t),this.space()),e.async&&(this.word("async"),this.space()),e.computed?(this.token("["),this.print(r,e),this.token("]")):this.print(r,e),this._params(e),this.space(),this.print(e.body,e)}function s(e){e.async&&(this.word("async"),this.space()),this.word("function"),e.generator&&this.token("*"),e.id?(this.space(),this.print(e.id,e)):this.space(),this._params(e),this.space(),this.print(e.body,e)}function a(e){e.async&&(this.word("async"),this.space());var t=e.params[0];1===e.params.length&&l.isIdentifier(t)&&!o(e,t)?this.print(t,e):this._params(e),this.space(),this.token("=>"),this.space(),this.print(e.body,e)}function o(e,t){return e.typeParameters||e.returnType||t.typeAnnotation||t.optional||t.trailingComments}r.__esModule=!0,r.FunctionDeclaration=void 0,r._params=n,r._method=i,r.FunctionExpression=s,r.ArrowFunctionExpression=a;var u=e("babel-types"),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u);r.FunctionDeclaration=s},{"babel-types":169}],74:[function(e,t,r){"use strict";function n(e){"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space()),this.print(e.imported,e),e.local&&e.local.name!==e.imported.name&&(this.space(),this.word("as"),this.space(),this.print(e.local,e))}function i(e){this.print(e.local,e)}function s(e){this.print(e.exported,e)}function a(e){this.print(e.local,e),e.exported&&e.local.name!==e.exported.name&&(this.space(),this.word("as"),this.space(),this.print(e.exported,e))}function o(e){this.token("*"),this.space(),this.word("as"),this.space(),this.print(e.exported,e)}function u(e){this.word("export"),this.space(),this.token("*"),this.space(),this.word("from"),this.space(),this.print(e.source,e),this.semicolon()}function l(){this.word("export"),this.space(),p.apply(this,arguments)}function c(){this.word("export"),this.space(),this.word("default"),this.space(),p.apply(this,arguments)}function p(e){if(e.declaration){var t=e.declaration;this.print(t,e),m.isStatement(t)||this.semicolon()}else{"type"===e.exportKind&&(this.word("type"),this.space());for(var r=e.specifiers.slice(0),n=!1;;){var i=r[0];if(!m.isExportDefaultSpecifier(i)&&!m.isExportNamespaceSpecifier(i))break;n=!0,this.print(r.shift(),e),r.length&&(this.token(","),this.space())}(r.length||!r.length&&!n)&&(this.token("{"),r.length&&(this.space(),this.printList(r,e),this.space()),this.token("}")),e.source&&(this.space(),this.word("from"),this.space(),this.print(e.source,e)),this.semicolon()}}function h(e){this.word("import"),this.space(),"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space());var t=e.specifiers.slice(0);if(t&&t.length){for(;;){var r=t[0];if(!m.isImportDefaultSpecifier(r)&&!m.isImportNamespaceSpecifier(r))break;this.print(t.shift(),e),t.length&&(this.token(","),this.space())}t.length&&(this.token("{"),this.space(),this.printList(t,e),this.space(),this.token("}")),this.space(),this.word("from"),this.space()}this.print(e.source,e),this.semicolon()}function f(e){this.token("*"),this.space(),this.word("as"),this.space(),this.print(e.local,e)}r.__esModule=!0,r.ImportSpecifier=n,r.ImportDefaultSpecifier=i,r.ExportDefaultSpecifier=s,r.ExportSpecifier=a, +r.ExportNamespaceSpecifier=o,r.ExportAllDeclaration=u,r.ExportNamedDeclaration=l,r.ExportDefaultDeclaration=c,r.ImportDeclaration=h,r.ImportNamespaceSpecifier=f;var d=e("babel-types"),m=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(d)},{"babel-types":169}],75:[function(e,t,r){"use strict";function n(e){this.word("with"),this.space(),this.token("("),this.print(e.object,e),this.token(")"),this.printBlock(e)}function i(e){this.word("if"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.space();var t=e.alternate&&D.isIfStatement(s(e.consequent));t&&(this.token("{"),this.newline(),this.indent()),this.printAndIndentOnComments(e.consequent,e),t&&(this.dedent(),this.newline(),this.token("}")),e.alternate&&(this.endsWith("}")&&this.space(),this.word("else"),this.space(),this.printAndIndentOnComments(e.alternate,e))}function s(e){return D.isStatement(e.body)?s(e.body):e}function a(e){this.word("for"),this.space(),this.token("("),this.inForStatementInitCounter++,this.print(e.init,e),this.inForStatementInitCounter--,this.token(";"),e.test&&(this.space(),this.print(e.test,e)),this.token(";"),e.update&&(this.space(),this.print(e.update,e)),this.token(")"),this.printBlock(e)}function o(e){this.word("while"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.printBlock(e)}function u(e){this.word("do"),this.space(),this.print(e.body,e),this.space(),this.word("while"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.semicolon()}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"label";return function(r){this.word(e);var n=r[t];if(n){this.space();var i=this.startTerminatorless();this.print(n,r),this.endTerminatorless(i)}this.semicolon()}}function c(e){this.print(e.label,e),this.token(":"),this.space(),this.print(e.body,e)}function p(e){this.word("try"),this.space(),this.print(e.block,e),this.space(),e.handlers?this.print(e.handlers[0],e):this.print(e.handler,e),e.finalizer&&(this.space(),this.word("finally"),this.space(),this.print(e.finalizer,e))}function h(e){this.word("catch"),this.space(),this.token("("),this.print(e.param,e),this.token(")"),this.space(),this.print(e.body,e)}function f(e){this.word("switch"),this.space(),this.token("("),this.print(e.discriminant,e),this.token(")"),this.space(),this.token("{"),this.printSequence(e.cases,e,{indent:!0,addNewlines:function(t,r){if(!t&&e.cases[e.cases.length-1]===r)return-1}}),this.token("}")}function d(e){e.test?(this.word("case"),this.space(),this.print(e.test,e),this.token(":")):(this.word("default"),this.token(":")),e.consequent.length&&(this.newline(),this.printSequence(e.consequent,e,{indent:!0}))}function m(){this.word("debugger"),this.semicolon()}function y(){if(this.token(","),this.newline(),this.endsWith("\n"))for(var e=0;e<4;e++)this.space(!0)}function g(){if(this.token(","),this.newline(),this.endsWith("\n"))for(var e=0;e<6;e++)this.space(!0)}function b(e,t){this.word(e.kind),this.space();var r=!1;if(!D.isFor(t))for(var n=e.declarations,i=Array.isArray(n),s=0,n=i?n:(0,E.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;o.init&&(r=!0)}var u=void 0;r&&(u="const"===e.kind?g:y),this.printList(e.declarations,e,{separator:u}),(!D.isFor(t)||t.left!==e&&t.init!==e)&&this.semicolon()}function v(e){this.print(e.id,e),this.print(e.id.typeAnnotation,e),e.init&&(this.space(),this.token("="),this.space(),this.print(e.init,e))}r.__esModule=!0,r.ThrowStatement=r.BreakStatement=r.ReturnStatement=r.ContinueStatement=r.ForAwaitStatement=r.ForOfStatement=r.ForInStatement=void 0;var x=e("babel-runtime/core-js/get-iterator"),E=function(e){return e&&e.__esModule?e:{default:e}}(x);r.WithStatement=n,r.IfStatement=i,r.ForStatement=a,r.WhileStatement=o,r.DoWhileStatement=u,r.LabeledStatement=c,r.TryStatement=p,r.CatchClause=h,r.SwitchStatement=f,r.SwitchCase=d,r.DebuggerStatement=m,r.VariableDeclaration=b,r.VariableDeclarator=v;var A=e("babel-types"),D=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(A),C=function(e){return function(t){this.word("for"),this.space(),"await"===e&&(this.word("await"),this.space()),this.token("("),this.print(t.left,t),this.space(),this.word("await"===e?"of":e),this.space(),this.print(t.right,t),this.token(")"),this.printBlock(t)}};r.ForInStatement=C("in"),r.ForOfStatement=C("of"),r.ForAwaitStatement=C("await"),r.ContinueStatement=l("continue"),r.ReturnStatement=l("return","argument"),r.BreakStatement=l("break"),r.ThrowStatement=l("throw","argument")},{"babel-runtime/core-js/get-iterator":113,"babel-types":169}],76:[function(e,t,r){"use strict";function n(e){this.print(e.tag,e),this.print(e.quasi,e)}function i(e,t){var r=t.quasis[0]===e,n=t.quasis[t.quasis.length-1]===e,i=(r?"`":"}")+e.value.raw+(n?"`":"${");this.token(i)}function s(e){for(var t=e.quasis,r=0;r0&&this.space(),this.print(i,e),n=0||e.indexOf("@preserve")>=0},"auto"===a.compact&&(a.compact=e.length>5e5,a.compact&&console.error("[BABEL] "+g.get("codeGeneratorDeopt",t.filename,"500KB"))),a.compact&&(a.indent.adjustMultilineComment=!1),a}function s(e,t){if(!e)return"double";for(var r={single:0,double:0},n=0,i=0;i=3)break}}return r.single>r.double?"single":"double"}r.__esModule=!0,r.CodeGenerator=void 0;var a=e("babel-runtime/helpers/classCallCheck"),o=n(a),u=e("babel-runtime/helpers/possibleConstructorReturn"),l=n(u),c=e("babel-runtime/helpers/inherits"),p=n(c);r.default=function(e,t,r){return new x(e,t,r).generate()};var h=e("detect-indent"),f=n(h),d=e("./source-map"),m=n(d),y=e("babel-messages"),g=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(y),b=e("./printer"),v=n(b),x=function(e){function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments[2];(0,o.default)(this,t);var a=r.tokens||[],u=i(s,n,a),c=n.sourceMaps?new m.default(n,s):null,p=(0,l.default)(this,e.call(this,u,c,a));return p.ast=r,p}return(0,p.default)(t,e),t.prototype.generate=function(){return e.prototype.generate.call(this,this.ast)},t}(v.default);r.CodeGenerator=function(){function e(t,r,n){(0,o.default)(this,e),this._generator=new x(t,r,n)}return e.prototype.generate=function(){return this._generator.generate()},e}()},{"./printer":82,"./source-map":83,"babel-messages":103,"babel-runtime/helpers/classCallCheck":127,"babel-runtime/helpers/inherits":128,"babel-runtime/helpers/possibleConstructorReturn":130,"detect-indent":299}],79:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){function t(e,t){var n=r[e];r[e]=n?function(e,r,i){var s=n(e,r,i);return null==s?t(e,r,i):s}:t}for(var r={},n=(0,m.default)(e),i=Array.isArray(n),s=0,n=i?n:(0,f.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a,u=E.FLIPPED_ALIAS_KEYS[o];if(u)for(var l=u,c=Array.isArray(l),p=0,l=c?l:(0,f.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if(p=l.next(),p.done)break;h=p.value}var d=h;t(d,e[o])}else t(o,e[o])}return r}function a(e,t,r,n){var i=e[t.type];return i?i(t,r,n):null}function o(e){return!!E.isCallExpression(e)||!!E.isMemberExpression(e)&&(o(e.object)||!e.computed&&o(e.property))}function u(e,t,r){if(!e)return 0;E.isExpressionStatement(e)&&(e=e.expression);var n=a(D,e,t);if(!n){var i=a(C,e,t);if(i)for(var s=0;ss)return!0}return!1}function u(e,t){return"in"===e.operator&&(v.isVariableDeclarator(t)||v.isFor(t))}function l(e,t){return!(v.isForStatement(t)||v.isThrowStatement(t)||v.isReturnStatement(t)||v.isIfStatement(t)&&t.test===e||v.isWhileStatement(t)&&t.test===e||v.isForInStatement(t)&&t.right===e||v.isSwitchStatement(t)&&t.discriminant===e||v.isExpressionStatement(t)&&t.expression===e)}function c(e,t){return v.isBinary(t)||v.isUnaryLike(t)||v.isCallExpression(t)||v.isMemberExpression(t)||v.isNewExpression(t)||v.isConditionalExpression(t)&&e===t.test}function p(e,t,r){return g(r,{considerDefaultExports:!0})}function h(e,t){return v.isMemberExpression(t,{object:e})||v.isCallExpression(t,{callee:e})||v.isNewExpression(t,{callee:e})}function f(e,t,r){return g(r,{considerDefaultExports:!0})}function d(e,t){return!!(v.isExportDeclaration(t)||v.isBinaryExpression(t)||v.isLogicalExpression(t)||v.isUnaryExpression(t)||v.isTaggedTemplateExpression(t))||h(e,t)}function m(e,t){return!!(v.isUnaryLike(t)||v.isBinary(t)||v.isConditionalExpression(t,{test:e})||v.isAwaitExpression(t))||h(e,t)}function y(e){return!!v.isObjectPattern(e.left)||m.apply(void 0,arguments)}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.considerArrow,n=void 0!==r&&r,i=t.considerDefaultExports,s=void 0!==i&&i,a=e.length-1,o=e[a];a--;for(var u=e[a];a>0;){if(v.isExpressionStatement(u,{expression:o})||v.isTaggedTemplateExpression(u)||s&&v.isExportDefaultDeclaration(u,{declaration:o})||n&&v.isArrowFunctionExpression(u,{body:o}))return!0;if(!(v.isCallExpression(u,{callee:o})||v.isSequenceExpression(u)&&u.expressions[0]===o||v.isMemberExpression(u,{object:o})||v.isConditional(u,{test:o})||v.isBinary(u,{left:o})||v.isAssignmentExpression(u,{left:o})))return!1;o=u,a--,u=e[a]}return!1}r.__esModule=!0,r.AwaitExpression=r.FunctionTypeAnnotation=void 0,r.NullableTypeAnnotation=n,r.UpdateExpression=i,r.ObjectExpression=s,r.DoExpression=a,r.Binary=o,r.BinaryExpression=u,r.SequenceExpression=l,r.YieldExpression=c,r.ClassExpression=p,r.UnaryLike=h,r.FunctionExpression=f,r.ArrowFunctionExpression=d,r.ConditionalExpression=m,r.AssignmentExpression=y;var b=e("babel-types"),v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(b),x={"||":0,"&&":1,"|":2,"^":3,"&":4,"==":5,"===":5,"!=":5,"!==":5,"<":6,">":6,"<=":6,">=":6,in:6,instanceof:6,">>":7,"<<":7,">>>":7,"+":8,"-":8,"*":9,"/":9,"%":9,"**":10};r.FunctionTypeAnnotation=n,r.AwaitExpression=c},{"babel-types":169}],81:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l.isMemberExpression(e)?(n(e.object,t),e.computed&&n(e.property,t)):l.isBinary(e)||l.isAssignmentExpression(e)?(n(e.left,t),n(e.right,t)):l.isCallExpression(e)?(t.hasCall=!0,n(e.callee,t)):l.isFunction(e)?t.hasFunction=!0:l.isIdentifier(e)&&(t.hasHelper=t.hasHelper||i(e.callee)),t}function i(e){return l.isMemberExpression(e)?i(e.object)||i(e.property):l.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:l.isCallExpression(e)?i(e.callee):!(!l.isBinary(e)&&!l.isAssignmentExpression(e))&&(l.isIdentifier(e.left)&&i(e.left)||i(e.right))}function s(e){return l.isLiteral(e)||l.isObjectExpression(e)||l.isArrayExpression(e)||l.isIdentifier(e)||l.isMemberExpression(e)}var a=e("lodash/map"),o=function(e){return e&&e.__esModule?e:{default:e}}(a),u=e("babel-types"),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u);r.nodes={AssignmentExpression:function(e){var t=n(e.right);if(t.hasCall&&t.hasHelper||t.hasFunction)return{before:t.hasFunction,after:!0}},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){if(l.isFunction(e.left)||l.isFunction(e.right))return{after:!0}},Literal:function(e){if("use strict"===e.value)return{after:!0}},CallExpression:function(e){if(l.isFunction(e.callee)||i(e))return{before:!0,after:!0}},VariableDeclaration:function(e){for(var t=0;t0?new F.default(n):null}return e.prototype.generate=function(e){return this.print(e),this._maybeAddAuxComment(),this._buf.get()},e.prototype.indent=function(){this.format.compact||this.format.concise||this._indent++},e.prototype.dedent=function(){this.format.compact||this.format.concise||this._indent--},e.prototype.semicolon=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._maybeAddAuxComment(),this._append(";",!e)},e.prototype.rightBrace=function(){this.format.minified&&this._buf.removeLastSemicolon(),this.token("}")},e.prototype.space=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.format.compact||(this._buf.hasContent()&&!this.endsWith(" ")&&!this.endsWith("\n")||e)&&this._space()},e.prototype.word=function(e){this._endsWithWord&&this._space(),this._maybeAddAuxComment(),this._append(e),this._endsWithWord=!0},e.prototype.number=function(e){this.word(e),this._endsWithInteger=(0,E.default)(+e)&&!j.test(e)&&!B.test(e)&&!O.test(e)&&"."!==e[e.length-1]},e.prototype.token=function(e){("--"===e&&this.endsWith("!")||"+"===e[0]&&this.endsWith("+")||"-"===e[0]&&this.endsWith("-")||"."===e[0]&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._append(e)},e.prototype.newline=function(e){if(!this.format.retainLines&&!this.format.compact){if(this.format.concise)return void this.space();if(!(this.endsWith("\n\n")||("number"!=typeof e&&(e=1),e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,e<=0)))for(var t=0;t1&&void 0!==arguments[1]&&arguments[1];this._maybeAddParen(e),this._maybeIndent(e),t?this._buf.queue(e):this._buf.append(e),this._endsWithWord=!1,this._endsWithInteger=!1},e.prototype._maybeIndent=function(e){this._indent&&this.endsWith("\n")&&"\n"!==e[0]&&this._buf.queue(this._getIndent())},e.prototype._maybeAddParen=function(e){var t=this._parenPushNewlineState;if(t){this._parenPushNewlineState=null;var r=void 0;for(r=0;r2&&void 0!==arguments[2]?arguments[2]:{};if(e&&e.length){r.indent&&this.indent();for(var n={addNewlines:r.addNewlines},i=0;i1&&void 0!==arguments[1])||arguments[1];e.innerComments&&(t&&this.indent(),this._printComments(e.innerComments),t&&this.dedent())},e.prototype.printSequence=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.statement=!0,this.printJoin(e,t,r)},e.prototype.printList=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return null==r.separator&&(r.separator=s),this.printJoin(e,t,r)},e.prototype._printNewline=function(e,t,r,n){var i=this;if(!this.format.retainLines&&!this.format.compact){if(this.format.concise)return void this.space();var s=0;if(null!=t.start&&!t._ignoreUserWhitespace&&this._whitespace)if(e){var a=t.leadingComments,o=a&&(0,g.default)(a,function(e){return!!e.loc&&i.format.shouldPrintComment(e.value)});s=this._whitespace.getNewlinesBefore(o||t)}else{var u=t.trailingComments,l=u&&(0,v.default)(u,function(e){return!!e.loc&&i.format.shouldPrintComment(e.value)});s=this._whitespace.getNewlinesAfter(l||t)}else{e||s++,n.addNewlines&&(s+=n.addNewlines(e,t)||0);var c=w.needsWhitespaceAfter;e&&(c=w.needsWhitespaceBefore),c(t,r)&&s++,this._buf.hasContent()||(s=0)}this.newline(s)}},e.prototype._getComments=function(e,t){return t&&(e?t.leadingComments:t.trailingComments)||[]},e.prototype._printComment=function(e){var t=this;if(this.format.shouldPrintComment(e.value)&&!e.ignore&&!this._printedComments.has(e)){if(this._printedComments.add(e),null!=e.start){if(this._printedCommentStarts[e.start])return;this._printedCommentStarts[e.start]=!0}this.newline(this._whitespace?this._whitespace.getNewlinesBefore(e):0),this.endsWith("[")||this.endsWith("{")||this.space();var r="CommentLine"===e.type?"//"+e.value+"\n":"/*"+e.value+"*/";if("CommentBlock"===e.type&&this.format.indent.adjustMultilineComment){var n=e.loc&&e.loc.start.column;if(n){var i=new RegExp("\\n\\s{1,"+n+"}","g");r=r.replace(i,"\n")}var s=Math.max(this._getIndent().length,this._buf.getCurrentColumn());r=r.replace(/\n(?!$)/g,"\n"+(0,D.default)(" ",s))}this.withSource("start",e.loc,function(){t._append(r)}),this.newline((this._whitespace?this._whitespace.getNewlinesAfter(e):0)+("CommentLine"===e.type?-1:0))}},e.prototype._printComments=function(e){if(e&&e.length)for(var t=e,r=Array.isArray(t),n=0,t=r?t:(0,l.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i;this._printComment(s)}},e}();r.default=N;for(var I=[e("./generators/template-literals"),e("./generators/expressions"),e("./generators/statements"),e("./generators/classes"),e("./generators/methods"),e("./generators/modules"),e("./generators/types"),e("./generators/flow"),e("./generators/base"),e("./generators/jsx")],L=0;L=0){for(;i&&e.start===n[i-1].start;)--i;t=n[i-1],r=n[i]}return this._getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){var t=void 0,r=void 0,n=this.tokens,i=this._findToken(function(t){return t.end-e.end},0,n.length);if(i>=0){for(;i&&e.end===n[i-1].end;)--i;t=n[i],r=n[i+1],","===r.type.label&&(r=n[i+2])}return r&&"eof"===r.type.label?1:this._getNewlinesBetween(t,r)},e.prototype._getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var r=e?e.loc.end.line:1,n=t.loc.start.line,i=0,s=r;s=r)return-1;var n=t+r>>>1,i=e(this.tokens[n]);return i<0?this._findToken(e,n+1,r):i>0?this._findToken(e,t,n):0===i?n:-1},e}();r.default=s,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":127}],85:[function(e,t,r){arguments[4][55][0].apply(r,arguments)},{"./util":94,dup:55}],86:[function(e,t,r){arguments[4][56][0].apply(r,arguments)},{"./base64":87,dup:56}],87:[function(e,t,r){arguments[4][57][0].apply(r,arguments)},{dup:57}],88:[function(e,t,r){arguments[4][58][0].apply(r,arguments)},{dup:58}],89:[function(e,t,r){arguments[4][59][0].apply(r,arguments)},{"./util":94,dup:59}],90:[function(e,t,r){arguments[4][60][0].apply(r,arguments)},{dup:60}],91:[function(e,t,r){arguments[4][61][0].apply(r,arguments)},{"./array-set":85,"./base64-vlq":86,"./binary-search":88,"./quick-sort":90,"./util":94,dup:61}],92:[function(e,t,r){arguments[4][62][0].apply(r,arguments)},{"./array-set":85,"./base64-vlq":86,"./mapping-list":89,"./util":94,dup:62}],93:[function(e,t,r){arguments[4][63][0].apply(r,arguments)},{"./source-map-generator":92,"./util":94,dup:63}],94:[function(e,t,r){arguments[4][64][0].apply(r,arguments)},{dup:64}],95:[function(e,t,r){arguments[4][65][0].apply(r,arguments)},{"./lib/source-map-consumer":91,"./lib/source-map-generator":92,"./lib/source-node":93,dup:65}],96:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return!g.isClassMethod(e)&&!g.isObjectMethod(e)||"get"!==e.kind&&"set"!==e.kind?"value":e.kind}function s(e,t,r,n,s){var a=g.toKeyAlias(t),o={};if((0,m.default)(e,a)&&(o=e[a]),e[a]=o,o._inherits=o._inherits||[],o._inherits.push(t),o._key=t.key,t.computed&&(o._computed=!0),t.decorators){var u=o.decorators=o.decorators||g.arrayExpression([]);u.elements=u.elements.concat(t.decorators.map(function(e){return e.expression}).reverse())}if(o.value||o.initializer)throw n.buildCodeFrameError(t,"Key conflict with sibling node");var l=void 0,c=void 0;(g.isObjectProperty(t)||g.isObjectMethod(t)||g.isClassMethod(t))&&(l=g.toComputedKey(t,t.key)), +g.isObjectProperty(t)||g.isClassProperty(t)?c=t.value:(g.isObjectMethod(t)||g.isClassMethod(t))&&(c=g.functionExpression(null,t.params,t.body,t.generator,t.async),c.returnType=t.returnType);var p=i(t);return r&&"value"===p||(r=p),s&&g.isStringLiteral(l)&&("value"===r||"initializer"===r)&&g.isFunctionExpression(c)&&(c=(0,f.default)({id:l,node:c,scope:s})),c&&(g.inheritsComments(c,t),o[r]=c),o}function a(e){for(var t in e)if(e[t]._computed)return!0;return!1}function o(e){for(var t=g.arrayExpression([]),r=0;r1&&void 0!==arguments[1]&&arguments[1];(0,l.default)(this,e),this.forceSuperMemoisation=t.forceSuperMemoisation,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=r,this.isLoose=t.isLoose,this.scope=this.methodPath.scope,this.file=t.file,this.opts=t,this.bareSupers=[],this.returns=[],this.thises=[]}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,r){return g.callExpression(this.file.addHelper("set"),[o(this.getObjectRef(),this.isStatic),r?e:g.stringLiteral(e.name),t,g.thisExpression()])},e.prototype.getSuperProperty=function(e,t){return g.callExpression(this.file.addHelper("get"),[o(this.getObjectRef(),this.isStatic),t?e:g.stringLiteral(e.name),g.thisExpression()])},e.prototype.replace=function(){this.methodPath.traverse(v,this)},e.prototype.getLooseSuperProperty=function(e,t){var r=this.methodNode,n=this.superRef||g.identifier("Function");return t.property===e?void 0:g.isCallExpression(t,{callee:e})?void 0:g.isMemberExpression(t)&&!r.static?g.memberExpression(n,g.identifier("prototype")):n},e.prototype.looseHandle=function(e){var t=e.node;if(e.isSuper())return this.getLooseSuperProperty(t,e.parent);if(e.isCallExpression()){var r=t.callee;if(!g.isMemberExpression(r))return;if(!g.isSuper(r.object))return;return g.appendToMemberExpression(r,g.identifier("call")),t.arguments.unshift(g.thisExpression()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,r){return"="===r.operator?this.setSuperProperty(r.left.property,r.right,r.left.computed):(e=e||t.scope.generateUidIdentifier("ref"),[g.variableDeclaration("var",[g.variableDeclarator(e,r.left)]),g.expressionStatement(g.assignmentExpression("=",r.left,g.binaryExpression(r.operator[0],e,r.right)))])},e.prototype.specHandle=function(e){var t=void 0,r=void 0,n=void 0,i=e.parent,o=e.node;if(s(o,i))throw e.buildCodeFrameError(m.get("classesIllegalBareSuper"));if(g.isCallExpression(o)){var u=o.callee;if(g.isSuper(u))return;a(u)&&(t=u.property,r=u.computed,n=o.arguments)}else if(g.isMemberExpression(o)&&g.isSuper(o.object))t=o.property,r=o.computed;else{if(g.isUpdateExpression(o)&&a(o.argument)){var l=g.binaryExpression(o.operator[0],o.argument,g.numericLiteral(1));if(o.prefix)return this.specHandleAssignmentExpression(null,e,l);var c=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(c,e,l).concat(g.expressionStatement(c))}if(g.isAssignmentExpression(o)&&a(o.left))return this.specHandleAssignmentExpression(null,e,o)}if(t){var p=this.getSuperProperty(t,r);return n?this.optimiseCall(p,n):p}},e.prototype.optimiseCall=function(e,t){var r=g.thisExpression();return r[b]=!0,(0,f.default)(e,r,t)},e}();r.default=x,t.exports=r.default},{"babel-helper-optimise-call-expression":99,"babel-messages":103,"babel-runtime/core-js/symbol":122,"babel-runtime/helpers/classCallCheck":127,"babel-types":169}],101:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("babel-template"),i=function(e){return e&&e.__esModule?e:{default:e}}(n),s={};r.default=s,s.typeof=(0,i.default)('\n (typeof Symbol === "function" && typeof Symbol.iterator === "symbol")\n ? function (obj) { return typeof obj; }\n : function (obj) {\n return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype\n ? "symbol"\n : typeof obj;\n };\n'),s.jsx=(0,i.default)('\n (function () {\n var REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7;\n\n return function createRawReactElement (type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n // If we\'re going to assign props.children, we create a new object now\n // to avoid mutating defaultProps.\n props = {};\n }\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : \'\' + key,\n ref: null,\n props: props,\n _owner: null,\n };\n };\n\n })()\n'),s.asyncIterator=(0,i.default)('\n (function (iterable) {\n if (typeof Symbol === "function") {\n if (Symbol.asyncIterator) {\n var method = iterable[Symbol.asyncIterator];\n if (method != null) return method.call(iterable);\n }\n if (Symbol.iterator) {\n return iterable[Symbol.iterator]();\n }\n }\n throw new TypeError("Object is not async iterable");\n })\n'),s.asyncGenerator=(0,i.default)('\n (function () {\n function AwaitValue(value) {\n this.value = value;\n }\n\n function AsyncGenerator(gen) {\n var front, back;\n\n function send(key, arg) {\n return new Promise(function (resolve, reject) {\n var request = {\n key: key,\n arg: arg,\n resolve: resolve,\n reject: reject,\n next: null\n };\n\n if (back) {\n back = back.next = request;\n } else {\n front = back = request;\n resume(key, arg);\n }\n });\n }\n\n function resume(key, arg) {\n try {\n var result = gen[key](arg)\n var value = result.value;\n if (value instanceof AwaitValue) {\n Promise.resolve(value.value).then(\n function (arg) { resume("next", arg); },\n function (arg) { resume("throw", arg); });\n } else {\n settle(result.done ? "return" : "normal", result.value);\n }\n } catch (err) {\n settle("throw", err);\n }\n }\n\n function settle(type, value) {\n switch (type) {\n case "return":\n front.resolve({ value: value, done: true });\n break;\n case "throw":\n front.reject(value);\n break;\n default:\n front.resolve({ value: value, done: false });\n break;\n }\n\n front = front.next;\n if (front) {\n resume(front.key, front.arg);\n } else {\n back = null;\n }\n }\n\n this._invoke = send;\n\n // Hide "return" method if generator return is not supported\n if (typeof gen.return !== "function") {\n this.return = undefined;\n }\n }\n\n if (typeof Symbol === "function" && Symbol.asyncIterator) {\n AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; };\n }\n\n AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); };\n AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); };\n AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); };\n\n return {\n wrap: function (fn) {\n return function () {\n return new AsyncGenerator(fn.apply(this, arguments));\n };\n },\n await: function (value) {\n return new AwaitValue(value);\n }\n };\n\n })()\n'),s.asyncGeneratorDelegate=(0,i.default)('\n (function (inner, awaitWrap) {\n var iter = {}, waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) { resolve(inner[key](value)); });\n return { done: false, value: awaitWrap(value) };\n };\n\n if (typeof Symbol === "function" && Symbol.iterator) {\n iter[Symbol.iterator] = function () { return this; };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n return pump("next", value);\n };\n\n if (typeof inner.throw === "function") {\n iter.throw = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n return pump("throw", value);\n };\n }\n\n if (typeof inner.return === "function") {\n iter.return = function (value) {\n return pump("return", value);\n };\n }\n\n return iter;\n })\n'),s.asyncToGenerator=(0,i.default)('\n (function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n step("next", value);\n }, function (err) {\n step("throw", err);\n });\n }\n }\n\n return step("next");\n });\n };\n })\n'),s.classCallCheck=(0,i.default)('\n (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n });\n'),s.createClass=(0,i.default)('\n (function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i ++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n })()\n'),s.defineEnumerableProperties=(0,i.default)('\n (function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if ("value" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n return obj;\n })\n'),s.defaults=(0,i.default)("\n (function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj;\n })\n"),s.defineProperty=(0,i.default)("\n (function (obj, key, value) {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n });\n"),s.extends=(0,i.default)("\n Object.assign || (function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n })\n"),s.get=(0,i.default)('\n (function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if ("value" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n });\n'),s.inherits=(0,i.default)('\n (function (subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n })\n'),s.instanceof=(0,i.default)('\n (function (left, right) {\n if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n });\n'),s.interopRequireDefault=(0,i.default)("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n"),s.interopRequireWildcard=(0,i.default)("\n (function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n newObj.default = obj;\n return newObj;\n }\n })\n"),s.newArrowCheck=(0,i.default)('\n (function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError("Cannot instantiate an arrow function");\n }\n });\n'),s.objectDestructuringEmpty=(0,i.default)('\n (function (obj) {\n if (obj == null) throw new TypeError("Cannot destructure undefined");\n });\n'),s.objectWithoutProperties=(0,i.default)("\n (function (obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n return target;\n })\n"),s.possibleConstructorReturn=(0,i.default)('\n (function (self, call) {\n if (!self) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n return call && (typeof call === "object" || typeof call === "function") ? call : self;\n });\n'),s.selfGlobal=(0,i.default)('\n typeof global === "undefined" ? self : global\n'),s.set=(0,i.default)('\n (function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if ("value" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n });\n'),s.slicedToArray=(0,i.default)('\n (function () {\n // Broken out into a separate function to avoid deoptimizations due to the try/catch for the\n // array iterator case.\n function sliceIterator(arr, i) {\n // this is an expanded form of `for...of` that properly supports abrupt completions of\n // iterators etc. variable names have been minimised to reduce the size of this massive\n // helper. sometimes spec compliancy is annoying :(\n //\n // _n = _iteratorNormalCompletion\n // _d = _didIteratorError\n // _e = _iteratorError\n // _i = _iterator\n // _s = _step\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i["return"]) _i["return"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n };\n })();\n'),s.slicedToArrayLoose=(0,i.default)('\n (function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n if (i && _arr.length === i) break;\n }\n return _arr;\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n });\n'),s.taggedTemplateLiteral=(0,i.default)("\n (function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: { value: Object.freeze(raw) }\n }));\n });\n"),s.taggedTemplateLiteralLoose=(0,i.default)("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n"),s.temporalRef=(0,i.default)('\n (function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + " is not defined - temporal dead zone");\n } else {\n return val;\n }\n })\n'),s.temporalUndefined=(0,i.default)("\n ({})\n"),s.toArray=(0,i.default)("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n"),s.toConsumableArray=(0,i.default)("\n (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n return arr2;\n } else {\n return Array.from(arr);\n }\n });\n"),t.exports=r.default},{"babel-template":132}],102:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=u.default[e];if(!t)throw new ReferenceError("Unknown helper "+e);return t().expression}r.__esModule=!0,r.list=void 0;var s=e("babel-runtime/core-js/object/keys"),a=n(s);r.get=i;var o=e("./helpers"),u=n(o);r.list=(0,a.default)(u.default).map(function(e){return e.replace(/^_/,"")}).filter(function(e){return"__esModule"!==e});r.default=i},{"./helpers":101,"babel-runtime/core-js/object/keys":120}],103:[function(e,t,r){"use strict";function n(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n4&&void 0!==arguments[4]&&arguments[4];if(t||(t=e.node),!v.isFor(r))for(var s=0;s0&&e.traverse(k,t),e.skip()}},g.visitor]),k=y.default.visitors.merge([{ReferencedIdentifier:function(e,t){var r=t.letReferences[e.node.name];if(r){var n=e.scope.getBindingIdentifier(e.node.name);n&&n!==r||(t.closurify=!0)}}},g.visitor]),F={enter:function(e,t){var r=e.node;e.parent;if(e.isForStatement()){if(o(r.init)){var n=t.pushDeclar(r.init);1===n.length?r.init=n[0]:r.init=v.sequenceExpression(n)}}else if(e.isFor())o(r.left)&&(t.pushDeclar(r.left),r.left=r.left.declarations[0].id);else if(o(r))e.replaceWithMultiple(t.pushDeclar(r).map(function(e){return v.expressionStatement(e)}));else if(e.isFunction())return e.skip()}},T={LabeledStatement:function(e,t){var r=e.node;t.innerLabels.push(r.label.name)}},P={enter:function(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){var r=e.getBindingIdentifiers();for(var n in r)t.outsideReferences[n]===e.scope.getBindingIdentifier(n)&&(t.reassignments[n]=!0)}}},B={Loop:function(e,t){var r=t.ignoreLabeless;t.ignoreLabeless=!0,e.traverse(B,t),t.ignoreLabeless=r,e.skip()},Function:function(e){e.skip()},SwitchCase:function(e,t){var r=t.inSwitchCase;t.inSwitchCase=!0,e.traverse(B,t),t.inSwitchCase=r,e.skip()},"BreakStatement|ContinueStatement|ReturnStatement":function(e,t){var r=e.node,n=e.parent,i=e.scope;if(!r[this.LOOP_IGNORE]){var s=void 0,a=u(r);if(a){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0)return;a=a+"|"+r.label.name}else{if(t.ignoreLabeless)return;if(t.inSwitchCase)return;if(v.isBreakStatement(r)&&v.isSwitchCase(n))return}t.hasBreakContinue=!0,t.map[a]=r,s=v.stringLiteral(a)}e.isReturnStatement()&&(t.hasReturn=!0,s=v.objectExpression([v.objectProperty(v.identifier("v"),r.argument||i.buildUndefinedNode())])),s&&(s=v.returnStatement(s),s[this.LOOP_IGNORE]=!0,e.skip(),e.replaceWith(v.inherits(s,r)))}}},O=function(){function e(t,r,n,i,s){(0,d.default)(this,e),this.parent=n,this.scope=i,this.file=s,this.blockPath=r,this.block=r.node,this.outsideLetReferences=(0,h.default)(null),this.hasLetReferences=!1,this.letReferences=(0,h.default)(null),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=v.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(v.isFunction(this.parent)||v.isProgram(this.block))return void this.updateScopeInfo();if(this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.updateScopeInfo(t),this.loopLabel&&!v.isLabeledStatement(this.loopParent)?v.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.updateScopeInfo=function(e){var t=this.scope,r=t.getFunctionParent(),n=this.letReferences;for(var i in n){var s=n[i],a=t.getBinding(s.name);a&&("let"!==a.kind&&"const"!==a.kind||(a.kind="var",e?t.removeBinding(s.name):t.moveBindingTo(s.name,r)))}},e.prototype.remap=function(){var e=this.letReferences,t=this.scope;for(var r in e){var n=e[r];(t.parentHasBinding(r)||t.hasGlobal(r))&&(t.hasOwnBinding(r)&&t.rename(n.name),this.blockPath.scope.hasOwnBinding(r)&&this.blockPath.scope.rename(n.name))}},e.prototype.wrapClosure=function(){if(this.file.opts.throwIfClosureRequired)throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure (throwIfClosureRequired).");var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var r in t){var n=t[r];(this.scope.hasGlobal(n.name)||this.scope.parentHasBinding(n.name))&&(delete t[n.name],delete this.letReferences[n.name],this.scope.rename(n.name),this.letReferences[n.name]=n,t[n.name]=n)}this.has=this.checkLoop(),this.hoistVarDeclarations();var i=(0,E.default)(t),s=(0,E.default)(t),a=this.blockPath.isSwitchStatement(),o=v.functionExpression(null,i,v.blockStatement(a?[e]:e.body));o.shadow=!0,this.addContinuations(o);var u=o;this.loop&&(u=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(v.variableDeclaration("var",[v.variableDeclarator(u,o)])));var l=v.callExpression(u,s),c=this.scope.generateUidIdentifier("ret");y.default.hasType(o.body,this.scope,"YieldExpression",v.FUNCTION_TYPES)&&(o.generator=!0,l=v.yieldExpression(l,!0)),y.default.hasType(o.body,this.scope,"AwaitExpression",v.FUNCTION_TYPES)&&(o.async=!0,l=v.awaitExpression(l)),this.buildClosure(c,l),a?this.blockPath.replaceWithMultiple(this.body):e.body=this.body},e.prototype.buildClosure=function(e,t){var r=this.has;r.hasReturn||r.hasBreakContinue?this.buildHas(e,t):this.body.push(v.expressionStatement(t))},e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,P,t);for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:"value",n=arguments[3],i=void 0;e.static?(this.hasStaticDescriptors=!0,i=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,i=this.instanceMutatorMap);var s=m.push(i,e,r,this.file,n);return t&&(s.enumerable=v.booleanLiteral(!0)),s},e.prototype.constructorMeMaybe=function(){for(var e=!1,t=this.path.get("body.body"),r=t,n=Array.isArray(r),i=0,r=n?r:(0,a.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}if(e=s.equals("kind","constructor"))break}if(!e){var o=void 0,u=void 0;if(this.isDerived){var l=x().expression;o=l.params,u=l.body}else o=[],u=v.blockStatement([]);this.path.get("body").unshiftContainer("body",v.classMethod("constructor",v.identifier("constructor"),o,u))}},e.prototype.buildBody=function(){if(this.constructorMeMaybe(),this.pushBody(),this.verifyConstructor(),this.userConstructor){var e=this.constructorBody;e.body=e.body.concat(this.userConstructor.body.body),v.inherits(this.constructor,this.userConstructor),v.inherits(e,this.userConstructor.body)}this.pushDescriptors()},e.prototype.pushBody=function(){for(var e=this.path.get("body.body"),t=e,r=Array.isArray(t),n=0,t=r?t:(0,a.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i,o=s.node;if(s.isClassProperty())throw s.buildCodeFrameError("Missing class properties transform.");if(o.decorators)throw s.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");if(v.isClassMethod(o)){var u="constructor"===o.kind;if(u&&(s.traverse(A,this),!this.hasBareSuper&&this.isDerived))throw s.buildCodeFrameError("missing super() call in constructor");var l=new p.default({forceSuperMemoisation:u,methodPath:s,methodNode:o,objectRef:this.classRef,superRef:this.superName,isStatic:o.static,isLoose:this.isLoose,scope:this.scope,file:this.file},!0);l.replace(),u?this.pushConstructor(l,o,s):this.pushMethod(o,s)}}},e.prototype.clearDescriptors=function(){this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={}},e.prototype.pushDescriptors=function(){this.pushInherits();var e=this.body,t=void 0,r=void 0;if(this.hasInstanceDescriptors&&(t=m.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(r=m.toClassObject(this.staticMutatorMap)),t||r){t&&(t=m.toComputedObjectFromClass(t)),r&&(r=m.toComputedObjectFromClass(r));var n=v.nullLiteral(),i=[this.classRef,n,n,n,n];t&&(i[1]=t),r&&(i[2]=r),this.instanceInitializersId&&(i[3]=this.instanceInitializersId,e.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(i[4]=this.staticInitializersId,e.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var s=0,a=0;a=o.length)break;c=o[l++]}else{if(l=o.next(),l.done)break;c=l.value}var p=c;this.wrapSuperCall(p,i,s,r),n&&p.find(function(e){return e===t||(e.isLoop()||e.isConditional()?(n=!1,!0):void 0)})}for(var h=this.superThises,f=Array.isArray(h),d=0,h=f?h:(0,a.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if(d=h.next(),d.done)break;m=d.value}m.replaceWith(s)}var y=function(t){return v.callExpression(e.file.addHelper("possibleConstructorReturn"),[s].concat(t||[]))},g=r.get("body");g.length&&!g.pop().isReturnStatement()&&r.pushContainer("body",v.returnStatement(n?s:y()));for(var b=this.superReturns,x=Array.isArray(b),E=0,b=x?b:(0,a.default)(b);;){var A;if(x){if(E>=b.length)break;A=b[E++]}else{if(E=b.next(),E.done)break;A=E.value}var C=A;if(C.node.argument){var S=C.scope.generateDeclaredUidIdentifier("ret");C.get("argument").replaceWithMultiple([v.assignmentExpression("=",S,C.node.argument),y(S)])}else C.get("argument").replaceWith(y())}}},e.prototype.pushMethod=function(e,t){var r=t?t.scope:this.scope;"method"===e.kind&&this._processMethod(e,r)||this.pushToMap(e,!1,null,r)},e.prototype._processMethod=function(){return!1},e.prototype.pushConstructor=function(e,t,r){this.bareSupers=e.bareSupers,this.superReturns=e.returns,r.scope.hasOwnBinding(this.classRef.name)&&r.scope.rename(this.classRef.name);var n=this.constructor;this.userConstructorPath=r,this.userConstructor=t,this.hasConstructor=!0,v.inheritsComments(n,t),n._ignoreUserWhitespace=!0,n.params=t.params,v.inherits(n.body,t.body),n.body.directives=t.body.directives,this._pushConstructor()},e.prototype._pushConstructor=function(){this.pushedConstructor||(this.pushedConstructor=!0,(this.hasInstanceDescriptors||this.hasStaticDescriptors)&&this.pushDescriptors(),this.body.push(this.constructor),this.pushInherits())},e.prototype.pushInherits=function(){this.isDerived&&!this.pushedInherits&&(this.pushedInherits=!0,this.body.unshift(v.expressionStatement(v.callExpression(this.file.addHelper("inherits"),[this.classRef,this.superName]))))},e}();r.default=C,t.exports=r.default},{"babel-helper-define-map":96,"babel-helper-optimise-call-expression":99,"babel-helper-replace-supers":100,"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/classCallCheck":127,"babel-template":132,"babel-traverse":136,"babel-types":169}],112:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){function t(e){var t=e.node,r=e.scope,n=[],i=t.right;if(!a.isIdentifier(i)||!r.hasBinding(i.name)){var s=r.generateUidIdentifier("arr");n.push(a.variableDeclaration("var",[a.variableDeclarator(s,i)])),i=s}var u=r.generateUidIdentifier("i"),l=o({BODY:t.body,KEY:u,ARR:i});a.inherits(l,t),a.ensureBlock(l);var c=a.memberExpression(i,u,!0),p=t.left;return a.isVariableDeclaration(p)?(p.declarations[0].init=c,l.body.body.unshift(p)):l.body.body.unshift(a.expressionStatement(a.assignmentExpression("=",p,c))),e.parentPath.isLabeledStatement()&&(l=a.labeledStatement(e.parentPath.node.label,l)),n.push(l),n}function r(e,t){var r=e.node,n=e.scope,s=e.parent,o=r.left,l=void 0,c=void 0;if(a.isIdentifier(o)||a.isPattern(o)||a.isMemberExpression(o))c=o;else{if(!a.isVariableDeclaration(o))throw t.buildCodeFrameError(o,i.get("unknownForHead",o.type));c=n.generateUidIdentifier("ref"),l=a.variableDeclaration(o.kind,[a.variableDeclarator(o.declarations[0].id,c)])}var p=n.generateUidIdentifier("iterator"),h=n.generateUidIdentifier("isArray"),f=u({LOOP_OBJECT:p,IS_ARRAY:h,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c});l||f.body.body.shift();var d=a.isLabeledStatement(s),m=void 0;return d&&(m=a.labeledStatement(s.label,f)),{replaceParent:d,declar:l,node:m||f,loop:f}}function n(e,t){var r=e.node,n=e.scope,s=e.parent,o=r.left,u=void 0,c=n.generateUidIdentifier("step"),p=a.memberExpression(c,a.identifier("value"));if(a.isIdentifier(o)||a.isPattern(o)||a.isMemberExpression(o))u=a.expressionStatement(a.assignmentExpression("=",o,p));else{if(!a.isVariableDeclaration(o))throw t.buildCodeFrameError(o,i.get("unknownForHead",o.type));u=a.variableDeclaration(o.kind,[a.variableDeclarator(o.declarations[0].id,p)])}var h=n.generateUidIdentifier("iterator"),f=l({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:n.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:h,STEP_KEY:c,OBJECT:r.right,BODY:null}),d=a.isLabeledStatement(s),m=f[3].block.body,y=m[0];return d&&(m[0]=a.labeledStatement(s.label,y)),{replaceParent:d,declar:u,loop:y,node:f}}var i=e.messages,s=e.template,a=e.types,o=s("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n "),u=s("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n "),l=s("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n ");return{visitor:{ForOfStatement:function(e,i){if(e.get("right").isArrayExpression())return e.parentPath.isLabeledStatement()?e.parentPath.replaceWithMultiple(t(e)):e.replaceWithMultiple(t(e));var s=n;i.opts.loose&&(s=r);var o=e.node,u=s(e,i),l=u.declar,c=u.loop,p=c.body;e.ensureBlock(),l&&p.body.push(l),p.body=p.body.concat(o.body.body),a.inherits(c,o),a.inherits(c.body,o.body),u.replaceParent?(e.parentPath.replaceWithMultiple(u.node),e.remove()):e.replaceWithMultiple(u.node)}}}},t.exports=r.default},{}],113:[function(e,t,r){t.exports={default:e("core-js/library/fn/get-iterator"),__esModule:!0}},{"core-js/library/fn/get-iterator":188}],114:[function(e,t,r){t.exports={default:e("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":189}],115:[function(e,t,r){t.exports={default:e("core-js/library/fn/map"),__esModule:!0}},{"core-js/library/fn/map":190}],116:[function(e,t,r){t.exports={default:e("core-js/library/fn/number/max-safe-integer"),__esModule:!0}},{"core-js/library/fn/number/max-safe-integer":191}],117:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":192}],118:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":193}],119:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/get-own-property-symbols"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-symbols":194}],120:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":195}],121:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/set-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/set-prototype-of":196}],122:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":198}],123:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/for"),__esModule:!0}},{"core-js/library/fn/symbol/for":197}],124:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":199}],125:[function(e,t,r){t.exports={default:e("core-js/library/fn/weak-map"),__esModule:!0}},{"core-js/library/fn/weak-map":200}],126:[function(e,t,r){t.exports={default:e("core-js/library/fn/weak-set"),__esModule:!0}},{"core-js/library/fn/weak-set":201}],127:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},{}],128:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("../core-js/object/set-prototype-of"),s=n(i),a=e("../core-js/object/create"),o=n(a),u=e("../helpers/typeof"),l=n(u);r.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,l.default)(t)));e.prototype=(0,o.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(s.default?(0,s.default)(e,t):e.__proto__=t)}},{"../core-js/object/create":118,"../core-js/object/set-prototype-of":121,"../helpers/typeof":131}],129:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}},{}],130:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../helpers/typeof"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);r.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,i.default)(t))&&"function"!=typeof t?e:t}},{"../helpers/typeof":131}],131:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("../core-js/symbol/iterator"),s=n(i),a=e("../core-js/symbol"),o=n(a),u="function"==typeof o.default&&"symbol"==typeof s.default?function(e){return typeof e}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":typeof e};r.default="function"==typeof o.default&&"symbol"===u(s.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":void 0===e?"undefined":u(e)}},{"../core-js/symbol":122,"../core-js/symbol/iterator":124}],132:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){e=(0,l.default)(e);var r=e,n=r.program;return t.length&&(0,m.default)(e,A,null,t),n.body.length>1?n.body:n.body[0]}r.__esModule=!0;var a=e("babel-runtime/core-js/symbol"),o=i(a);r.default=function(e,t){var r=void 0;try{throw new Error}catch(e){e.stack&&(r=e.stack.split("\n").slice(1).join("\n"))}t=(0,p.default)({allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveComments:!1},t);var n=function(){var i=void 0;try{i=g.parse(e,t),i=m.default.removeProperties(i,{preserveComments:t.preserveComments}),m.default.cheap(i,function(e){e[x]=!0})}catch(e){throw e.stack=e.stack+"from\n"+r,e}return n=function(){return i},i};return function(){for(var e=arguments.length,t=Array(e),r=0;r=n.length)break;o=n[s++]}else{if(s=n.next(),s.done)break;o=s.value}if(e[o])return!0}return!1},e.prototype.create=function(e,t,r,n){return c.default.get({parentPath:this.parentPath,parent:e,container:t,key:r,listKey:n})},e.prototype.maybeQueue=function(e,t){if(this.trap)throw new Error("Infinite cycle detected");this.queue&&(t?this.queue.push(e):this.priorityQueue.push(e))},e.prototype.visitMultiple=function(e,t,r){if(0===e.length)return!1;for(var n=[],i=0;i=n.length)break;o=n[s++]}else{if(s=n.next(),s.done)break;o=s.value}var u=o;if(u.resync(),0!==u.contexts.length&&u.contexts[u.contexts.length-1]===this||u.pushContext(this),null!==u.key&&(f&&e.length>=1e4&&(this.trap=!0),!(t.indexOf(u.node)>=0))){if(t.push(u.node),u.visit()){r=!0;break}if(this.priorityQueue.length&&(r=this.visitQueue(this.priorityQueue),this.priorityQueue=[],this.queue=e,r))break}}for(var l=e,c=Array.isArray(l),p=0,l=c?l:(0,a.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if(p=l.next(),p.done)break;h=p.value}h.popContext()}return this.queue=null,r},e.prototype.visit=function(e,t){var r=e[t];return!!r&&(Array.isArray(r)?this.visitMultiple(r,e,t):this.visitSingle(e,t))},e}();r.default=d,t.exports=r.default}).call(this,e("_process"))},{"./path":143,_process:539,"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/classCallCheck":127,"babel-types":169}],135:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("babel-runtime/helpers/classCallCheck"),i=function(e){return e&&e.__esModule?e:{default:e}}(n),s=function e(t,r){(0,i.default)(this,e),this.file=t,this.options=r};r.default=s,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":127}],136:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n,i){if(e){if(t||(t={}),!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(g.get("traverseNeedsParent",e.type));m.explode(t),s.node(e,t,r,n,i)}}function a(e,t){e.node.type===t.type&&(t.has=!0,e.stop())}r.__esModule=!0,r.visitors=r.Hub=r.Scope=r.NodePath=void 0;var o=e("babel-runtime/core-js/get-iterator"),u=i(o),l=e("./path");Object.defineProperty(r,"NodePath",{enumerable:!0,get:function(){return i(l).default}});var c=e("./scope");Object.defineProperty(r,"Scope",{enumerable:!0,get:function(){return i(c).default}});var p=e("./hub");Object.defineProperty(r,"Hub",{enumerable:!0,get:function(){return i(p).default}}),r.default=s;var h=e("./context"),f=i(h),d=e("./visitors"),m=n(d),y=e("babel-messages"),g=n(y),b=e("lodash/includes"),v=i(b),x=e("babel-types"),E=n(x),A=e("./cache"),D=n(A);r.visitors=m,s.visitors=m,s.verify=m.verify,s.explode=m.explode,s.NodePath=e("./path"),s.Scope=e("./scope"),s.Hub=e("./hub"),s.cheap=function(e,t){return E.traverseFast(e,t)},s.node=function(e,t,r,n,i,s){var a=E.VISITOR_KEYS[e.type];if(a)for(var o=new f.default(r,t,n,i),l=a,c=Array.isArray(l),p=0,l=c?l:(0,u.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if(p=l.next(),p.done)break;h=p.value}var d=h;if((!s||!s[d])&&o.visit(e,d))return}},s.clearNode=function(e,t){E.removeProperties(e,t),D.path.delete(e)},s.removeProperties=function(e,t){return E.traverseFast(e,s.clearNode,t),e},s.hasType=function(e,t,r,n){if((0,v.default)(n,e.type))return!1;if(e.type===r)return!0;var i={has:!1,type:r};return s(e,{blacklist:n,enter:a},t,i),i.has},s.clearCache=function(){D.clear()},s.clearCache.clearPath=D.clearPath,s.clearCache.clearScope=D.clearScope,s.copyCache=function(e,t){D.path.has(e)&&D.path.set(t,D.path.get(e))}},{"./cache":133,"./context":134,"./hub":135,"./path":143,"./scope":155,"./visitors":157,"babel-messages":103,"babel-runtime/core-js/get-iterator":113,"babel-types":169,"lodash/includes":496}],137:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){for(var t=this;t=t.parentPath;)if(e(t))return t;return null}function s(e){var t=this;do{if(e(t))return t}while(t=t.parentPath);return null}function a(){return this.findParent(function(e){return e.isFunction()||e.isProgram()})}function o(){var e=this;do{if(Array.isArray(e.container))return e}while(e=e.parentPath)}function u(e){return this.getDeepestCommonAncestorFrom(e,function(e,t,r){for(var n=void 0,i=b.VISITOR_KEYS[e.type],s=r,a=Array.isArray(s),o=0,s=a?s:(0,y.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var l=u,c=l[t+1];if(n)if(c.listKey&&n.listKey===c.listKey&&c.keyh&&(n=c)}else n=c}return n})}function l(e,t){var r=this;if(!e.length)return this;if(1===e.length)return e[0];var n=1/0,i=void 0,s=void 0,a=e.map(function(e){var t=[];do{t.unshift(e)}while((e=e.parentPath)&&e!==r);return t.length=c.length)break;f=c[h++]}else{if(h=c.next(),h.done)break;f=h.value}var d=f;if(d[u]!==l)break e}i=u,s=l}if(s)return t?t(s,i,a):s;throw new Error("Couldn't find intersection")}function c(){var e=this,t=[];do{t.push(e)}while(e=e.parentPath);return t}function p(e){return e.isDescendant(this)}function h(e){return!!this.findParent(function(t){return t===e})}function f(){for(var e=this;e;){for(var t=arguments,r=Array.isArray(t),n=0,t=r?t:(0,y.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i;if(e.node.type===s)return!0}e=e.parentPath}return!1}function d(e){var t=this.isFunction()?this:this.findParent(function(e){return e.isFunction()});if(t){if(t.isFunctionExpression()||t.isFunctionDeclaration()){var r=t.node.shadow;if(r&&(!e||!1!==r[e]))return t}else if(t.isArrowFunctionExpression())return t;return null}}r.__esModule=!0;var m=e("babel-runtime/core-js/get-iterator"),y=n(m);r.findParent=i,r.find=s,r.getFunctionParent=a,r.getStatementParent=o,r.getEarliestCommonAncestorFrom=u,r.getDeepestCommonAncestorFrom=l,r.getAncestry=c,r.isAncestor=p,r.isDescendant=h,r.inType=f,r.inShadow=d;var g=e("babel-types"),b=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(g),v=e("./index");n(v)},{"./index":143,"babel-runtime/core-js/get-iterator":113,"babel-types":169}],138:[function(e,t,r){"use strict";function n(){if("string"!=typeof this.key){var e=this.node;if(e){var t=e.trailingComments,r=e.leadingComments;if(t||r){var n=this.getSibling(this.key-1),i=this.getSibling(this.key+1);n.node||(n=i),i.node||(i=n),n.addComments("trailing",r),i.addComments("leading",t)}}}}function i(e,t,r){this.addComments(e,[{type:r?"CommentLine":"CommentBlock",value:t}])}function s(e,t){if(t){var r=this.node;if(r){var n=e+"Comments";r[n]?r[n]=r[n].concat(t):r[n]=t}}}r.__esModule=!0,r.shareCommentsWithSiblings=n,r.addComment=i,r.addComments=s},{}],139:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=this.opts;return this.debug(function(){return e}),!(!this.node||!this._call(t[e]))||!!this.node&&this._call(t[this.node.type]&&t[this.node.type][e])}function s(e){if(!e)return!1;for(var t=e,r=Array.isArray(t),n=0,t=r?t:(0,S.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i;if(s){var a=this.node;if(!a)return!0;if(s.call(this.state,this,this.state))throw new Error("Unexpected return value from visitor method "+s);if(this.node!==a)return!0;if(this.shouldStop||this.shouldSkip||this.removed)return!0}}return!1}function a(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1}function o(){return!!this.node&&(!this.isBlacklisted()&&((!this.opts.shouldSkip||!this.opts.shouldSkip(this))&&(this.call("enter")||this.shouldSkip?(this.debug(function(){return"Skip..."}),this.shouldStop):(this.debug(function(){return"Recursing into..."}),w.default.node(this.node,this.opts,this.scope,this.state,this,this.skipKeys),this.call("exit"),this.shouldStop))))}function u(){this.shouldSkip=!0}function l(e){this.skipKeys[e]=!0}function c(){this.shouldStop=!0,this.shouldSkip=!0}function p(){if(!this.opts||!this.opts.noScope){var e=this.context&&this.context.scope;if(!e)for(var t=this.parentPath;t&&!e;){if(t.opts&&t.opts.noScope)return;e=t.scope,t=t.parentPath}this.scope=this.getScope(e),this.scope&&this.scope.init()}}function h(e){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},e&&(this.context=e,this.state=e.state,this.opts=e.opts),this.setScope(),this}function f(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())}function d(){this.parentPath&&(this.parent=this.parentPath.node)}function m(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:this;if(!e.removed)for(var t=this.contexts,r=t,n=Array.isArray(r),i=0,r=n?r:(0,S.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;a.maybeQueue(e)}}function D(){for(var e=this,t=this.contexts;!t.length;)e=e.parentPath,t=e.contexts;return t}r.__esModule=!0;var C=e("babel-runtime/core-js/get-iterator"),S=n(C);r.call=i,r._call=s,r.isBlacklisted=a,r.visit=o,r.skip=u,r.skipKey=l,r.stop=c,r.setScope=p,r.setContext=h,r.resync=f,r._resyncParent=d,r._resyncKey=m,r._resyncList=y,r._resyncRemoved=g,r.popContext=b,r.pushContext=v,r.setup=x,r.setKey=E,r.requeue=A,r._getQueueContexts=D;var _=e("../index"),w=n(_)},{"../index":136,"babel-runtime/core-js/get-iterator":113}],140:[function(e,t,r){"use strict";function n(){var e=this.node,t=void 0;if(this.isMemberExpression())t=e.property;else{if(!this.isProperty()&&!this.isMethod())throw new ReferenceError("todo");t=e.key}return e.computed||o.isIdentifier(t)&&(t=o.stringLiteral(t.name)),t}function i(){return o.ensureBlock(this.node)}function s(){if(this.isArrowFunctionExpression()){this.ensureBlock();var e=this.node;e.expression=!1,e.type="FunctionExpression",e.shadow=e.shadow||!0}}r.__esModule=!0,r.toComputedKey=n,r.ensureBlock=i,r.arrowFunctionToShadowed=s;var a=e("babel-types"),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(a)},{"babel-types":169}],141:[function(e,t,r){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(){var e=this.evaluate();if(e.confident)return!!e.value}function s(){function e(e){i&&(s=e,i=!1)}function r(t){var r=t.node;if(a.has(r)){var s=a.get(r);return s.resolved?s.value:void e(t)}var o={resolved:!1};a.set(r,o);var u=n(t);return i&&(o.resolved=!0,o.value=u),u}function n(n){if(i){var s=n.node;if(n.isSequenceExpression()){var a=n.get("expressions");return r(a[a.length-1])}if(n.isStringLiteral()||n.isNumericLiteral()||n.isBooleanLiteral())return s.value;if(n.isNullLiteral())return null;if(n.isTemplateLiteral()){for(var u="",c=0,p=n.get("expressions"),d=s.quasis,m=Array.isArray(d),y=0,d=m?d:(0,l.default)(d);;){var g;if(m){if(y>=d.length)break;g=d[y++]}else{if(y=d.next(),y.done)break;g=y.value}var b=g;if(!i)break;u+=b.value.cooked;var v=p[c++];v&&(u+=String(r(v)))}if(!i)return;return u}if(n.isConditionalExpression()){var x=r(n.get("test"));if(!i)return;return r(x?n.get("consequent"):n.get("alternate"))}if(n.isExpressionWrapper())return r(n.get("expression"));if(n.isMemberExpression()&&!n.parentPath.isCallExpression({callee:s})){var E=n.get("property"),A=n.get("object");if(A.isLiteral()&&E.isIdentifier()){var D=A.node.value,C=void 0===D?"undefined":(0,o.default)(D);if("number"===C||"string"===C)return D[E.node.name]}}if(n.isReferencedIdentifier()){var S=n.scope.getBinding(s.name);if(S&&S.constantViolations.length>0)return e(S.path);if(S&&n.node.start=P.length)break;j=P[O++]}else{if(O=P.next(),O.done)break;j=O.value}var N=j;if(N=N.evaluate(),!N.confident)return e(N);F.push(N.value)}return F}if(n.isObjectExpression()){for(var I={},L=n.get("properties"),M=L,R=Array.isArray(M),U=0,M=R?M:(0,l.default)(M);;){var V;if(R){if(U>=M.length)break;V=M[U++]}else{if(U=M.next(),U.done)break;V=U.value}var q=V;if(q.isObjectMethod()||q.isSpreadProperty())return e(q);var G=q.get("key"),X=G;if(q.node.computed){if(X=X.evaluate(),!X.confident)return e(G);X=X.value}else X=X.isIdentifier()?X.node.name:X.node.value;var J=q.get("value"),W=J.evaluate();if(!W.confident)return e(J);W=W.value,I[X]=W}return I}if(n.isLogicalExpression()){var K=i,z=r(n.get("left")),Y=i;i=K;var H=r(n.get("right")),$=i;switch(i=Y&&$,s.operator){case"||":if(z&&Y)return i=!0,z;if(!i)return;return z||H;case"&&":if((!z&&Y||!H&&$)&&(i=!0),!i)return;return z&&H}}if(n.isBinaryExpression()){var Q=r(n.get("left"));if(!i)return;var Z=r(n.get("right"));if(!i)return;switch(s.operator){case"-":return Q-Z;case"+":return Q+Z;case"/":return Q/Z;case"*":return Q*Z;case"%":return Q%Z;case"**":return Math.pow(Q,Z);case"<":return Q":return Q>Z;case"<=":return Q<=Z;case">=":return Q>=Z;case"==":return Q==Z;case"!=":return Q!=Z;case"===":return Q===Z;case"!==":return Q!==Z;case"|":return Q|Z;case"&":return Q&Z;case"^":return Q^Z;case"<<":return Q<>":return Q>>Z;case">>>":return Q>>>Z}}if(n.isCallExpression()){var ee=n.get("callee"),te=void 0,re=void 0;if(ee.isIdentifier()&&!n.scope.getBinding(ee.node.name,!0)&&h.indexOf(ee.node.name)>=0&&(re=t[s.callee.name]),ee.isMemberExpression()){var ne=ee.get("object"),ie=ee.get("property");if(ne.isIdentifier()&&ie.isIdentifier()&&h.indexOf(ne.node.name)>=0&&f.indexOf(ie.node.name)<0&&(te=t[ne.node.name],re=te[ie.node.name]),ne.isLiteral()&&ie.isIdentifier()){var se=(0,o.default)(ne.node.value);"string"!==se&&"number"!==se||(te=ne.node.value,re=te[ie.node.name])}}if(re){var ae=n.get("arguments").map(r);if(!i)return;return re.apply(te,ae)}}e(n)}}var i=!0,s=void 0,a=new p.default,u=r(this);return i||(u=void 0),{confident:i,deopt:s,value:u}}r.__esModule=!0;var a=e("babel-runtime/helpers/typeof"),o=n(a),u=e("babel-runtime/core-js/get-iterator"),l=n(u),c=e("babel-runtime/core-js/map"),p=n(c);r.evaluateTruthy=i,r.evaluate=s;var h=["String","Number","Math"],f=["random"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/map":115,"babel-runtime/helpers/typeof":131}],142:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e}function s(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0}function a(){var e=[],t=function(t){t&&(e=e.concat(t.getCompletionRecords()))};if(this.isIfStatement())t(this.get("consequent")),t(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())t(this.get("body"));else if(this.isProgram()||this.isBlockStatement())t(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(t(this.get("block")),t(this.get("handler")),t(this.get("finalizer"))):e.push(this)}return e}function o(e){return C.default.get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:e})}function u(){return this.getSibling(this.key-1)}function l(){return this.getSibling(this.key+1)}function c(){for(var e=this.key,t=this.getSibling(++e),r=[];t.node;)r.push(t),t=this.getSibling(++e);return r}function p(){for(var e=this.key,t=this.getSibling(--e),r=[];t.node;)r.push(t),t=this.getSibling(--e);return r}function h(e,t){!0===t&&(t=this.context);var r=e.split(".");return 1===r.length?this._getKey(e,t):this._getPattern(r,t)}function f(e,t){var r=this,n=this.node,i=n[e];return Array.isArray(i)?i.map(function(s,a){return C.default.get({listKey:e,parentPath:r,parent:n,container:i,key:a}).setContext(t)}):C.default.get({parentPath:this,parent:n,container:n,key:e}).setContext(t)}function d(e,t){for(var r=this,n=e,i=Array.isArray(n),s=0,n=i?n:(0,A.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;r="."===o?r.parentPath:Array.isArray(r)?r[o]:r.get(o,t)}return r}function m(e){return _.getBindingIdentifiers(this.node,e)}function y(e){return _.getOuterBindingIdentifiers(this.node,e)}function g(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this,n=[].concat(r),i=(0,x.default)(null);n.length;){var s=n.shift();if(s&&s.node){var a=_.getBindingIdentifiers.keys[s.node.type];if(s.isIdentifier())if(e){var o=i[s.node.name]=i[s.node.name]||[];o.push(s)}else i[s.node.name]=s;else if(s.isExportDeclaration()){var u=s.get("declaration");u.isDeclaration()&&n.push(u)}else{if(t){if(s.isFunctionDeclaration()){n.push(s.get("id"));continue}if(s.isFunctionExpression())continue}if(a)for(var l=0;l1&&void 0!==arguments[1]?arguments[1]:SyntaxError;return this.hub.file.buildCodeFrameError(this.node,e,t)},e.prototype.traverse=function(e,t){(0,y.default)(this.node,e,this.scope,t,this)},e.prototype.mark=function(e,t){this.hub.file.metadata.marked.push({type:e,message:t,loc:this.node.loc})},e.prototype.set=function(e,t){A.validate(this.node,e,t),this.node[e]=t},e.prototype.getPathLocation=function(){var e=[],t=this;do{var r=t.key;t.inList&&(r=t.listKey+"["+r+"]"),e.unshift(r)}while(t=t.parentPath);return e.join(".")},e.prototype.debug=function(e){C.enabled&&C(this.getPathLocation()+" "+this.type+": "+e())},e}();r.default=S,(0,b.default)(S.prototype,e("./ancestry")),(0,b.default)(S.prototype,e("./inference")),(0,b.default)(S.prototype,e("./replacement")),(0,b.default)(S.prototype,e("./evaluation")),(0,b.default)(S.prototype,e("./conversion")),(0,b.default)(S.prototype,e("./introspection")),(0,b.default)(S.prototype,e("./context")),(0,b.default)(S.prototype,e("./removal")),(0,b.default)(S.prototype,e("./modification")),(0,b.default)(S.prototype,e("./family")),(0,b.default)(S.prototype,e("./comments"));for(var _=A.TYPES,w=Array.isArray(_),k=0,_=w?_:(0,a.default)(_);;){var F;if("break"===function(){if(w){if(k>=_.length)return"break";F=_[k++]}else{if(k=_.next(),k.done)return"break";F=k.value}var e=F,t="is"+e;S.prototype[t]=function(e){return A[t](this.node,e)},S.prototype["assert"+e]=function(r){if(!this[t](r))throw new TypeError("Expected node path of type "+e)}}())break}for(var T in c){(function(e){if("_"===e[0])return"continue";A.TYPES.indexOf(e)<0&&A.TYPES.push(e);var t=c[e];S.prototype["is"+e]=function(e){return t.checkPath(this,e)}})(T)}t.exports=r.default},{"../cache":133,"../index":136,"../scope":155,"./ancestry":137,"./comments":138,"./context":139,"./conversion":140,"./evaluation":141,"./family":142,"./inference":144,"./introspection":147,"./lib/virtual-types":150,"./modification":151,"./removal":152,"./replacement":153,"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/classCallCheck":127,"babel-types":169,debug:296,invariant:307,"lodash/assign":477}],144:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(){if(this.typeAnnotation)return this.typeAnnotation;var e=this._getTypeAnnotation()||y.anyTypeAnnotation();return y.isTypeAnnotation(e)&&(e=e.typeAnnotation),this.typeAnnotation=e}function s(){var e=this.node;{if(e){if(e.typeAnnotation)return e.typeAnnotation;var t=d[e.type];return t?t.call(this,e):(t=d[this.parentPath.type],t&&t.validParent?this.parentPath.getTypeAnnotation():void 0)}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var r=this.parentPath.parentPath,n=r.parentPath;return"left"===r.key&&n.isForInStatement()?y.stringTypeAnnotation():"left"===r.key&&n.isForOfStatement()?y.anyTypeAnnotation():y.voidTypeAnnotation()}}}function a(e,t){return o(e,this.getTypeAnnotation(),t)}function o(e,t,r){if("string"===e)return y.isStringTypeAnnotation(t);if("number"===e)return y.isNumberTypeAnnotation(t);if("boolean"===e)return y.isBooleanTypeAnnotation(t);if("any"===e)return y.isAnyTypeAnnotation(t);if("mixed"===e)return y.isMixedTypeAnnotation(t);if("empty"===e)return y.isEmptyTypeAnnotation(t);if("void"===e)return y.isVoidTypeAnnotation(t);if(r)return!1;throw new Error("Unknown base type "+e)}function u(e){var t=this.getTypeAnnotation();if(y.isAnyTypeAnnotation(t))return!0;if(y.isUnionTypeAnnotation(t)){for(var r=t.types,n=Array.isArray(r),i=0,r=n?r:(0,h.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;if(y.isAnyTypeAnnotation(a)||o(e,a,!0))return!0}return!1}return o(e,t,!0)}function l(e){var t=this.getTypeAnnotation();if(e=e.getTypeAnnotation(),!y.isAnyTypeAnnotation(t)&&y.isFlowBaseAnnotation(t))return e.type===t.type}function c(e){var t=this.getTypeAnnotation();return y.isGenericTypeAnnotation(t)&&y.isIdentifier(t.id,{name:e})}r.__esModule=!0;var p=e("babel-runtime/core-js/get-iterator"),h=function(e){return e&&e.__esModule?e:{default:e}}(p);r.getTypeAnnotation=i,r._getTypeAnnotation=s,r.isBaseType=a,r.couldBeBaseType=u,r.baseTypeStrictlyMatches=l,r.isGenericType=c;var f=e("./inferers"),d=n(f),m=e("babel-types"),y=n(m)},{"./inferers":146,"babel-runtime/core-js/get-iterator":113,"babel-types":169}],145:[function(e,t,r){"use strict";function n(e,t){var r=e.scope.getBinding(t),n=[];e.typeAnnotation=p.unionTypeAnnotation(n);var s=[],a=i(r,e,s),u=o(e,t);if(u&&function(){var e=i(r,u.ifStatement);a=a.filter(function(t){return e.indexOf(t)<0}),n.push(u.typeAnnotation)}(),a.length){a=a.concat(s);for(var c=a,h=Array.isArray(c),f=0,c=h?c:(0,l.default)(c);;){var d;if(h){if(f>=c.length)break;d=c[f++]}else{if(f=c.next(),f.done)break;d=f.value}var m=d;n.push(m.getTypeAnnotation())}}if(n.length)return p.createUnionTypeAnnotation(n)}function i(e,t,r){var n=e.constantViolations.slice();return n.unshift(e.path),n.filter(function(e){e=e.resolve();var n=e._guessExecutionStatusRelativeTo(t);return r&&"function"===n&&r.push(e),"before"===n})}function s(e,t){var r=t.node.operator,n=t.get("right").resolve(),i=t.get("left").resolve(),s=void 0;if(i.isIdentifier({name:e})?s=n:n.isIdentifier({name:e})&&(s=i),s)return"==="===r?s.getTypeAnnotation():p.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(r)>=0?p.numberTypeAnnotation():void 0;if("==="===r){var a=void 0,o=void 0;if(i.isUnaryExpression({operator:"typeof"})?(a=i,o=n):n.isUnaryExpression({operator:"typeof"})&&(a=n,o=i),(o||a)&&(o=o.resolve(),o.isLiteral())){if("string"==typeof o.node.value&&a.get("argument").isIdentifier({name:e}))return p.createTypeAnnotationBasedOnTypeof(o.node.value)}}}function a(e){for(var t=void 0;t=e.parentPath;){if(t.isIfStatement()||t.isConditionalExpression())return"test"===e.key?void 0:t;e=t}}function o(e,t){var r=a(e);if(r){var n=r.get("test"),i=[n],u=[];do{var l=i.shift().resolve();if(l.isLogicalExpression()&&(i.push(l.get("left")),i.push(l.get("right"))),l.isBinaryExpression()){var c=s(t,l);c&&u.push(c)}}while(i.length);return u.length?{typeAnnotation:p.createUnionTypeAnnotation(u),ifStatement:r}:o(r,t)}}r.__esModule=!0;var u=e("babel-runtime/core-js/get-iterator"),l=function(e){return e&&e.__esModule?e:{default:e}}(u);r.default=function(e){if(this.isReferenced()){var t=this.scope.getBinding(e.name);return t?t.identifier.typeAnnotation?t.identifier.typeAnnotation:n(this,e.name):"undefined"===e.name?p.voidTypeAnnotation():"NaN"===e.name||"Infinity"===e.name?p.numberTypeAnnotation():void e.name}};var c=e("babel-types"),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(c);t.exports=r.default},{"babel-runtime/core-js/get-iterator":113,"babel-types":169}],146:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(){return this.get("id").isIdentifier()?this.get("init").getTypeAnnotation():void 0}function s(e){return e.typeAnnotation}function a(e){if(this.get("callee").isIdentifier())return F.genericTypeAnnotation(e.callee)}function o(){return F.stringTypeAnnotation()}function u(e){var t=e.operator;return"void"===t?F.voidTypeAnnotation():F.NUMBER_UNARY_OPERATORS.indexOf(t)>=0?F.numberTypeAnnotation():F.STRING_UNARY_OPERATORS.indexOf(t)>=0?F.stringTypeAnnotation():F.BOOLEAN_UNARY_OPERATORS.indexOf(t)>=0?F.booleanTypeAnnotation():void 0}function l(e){var t=e.operator;if(F.NUMBER_BINARY_OPERATORS.indexOf(t)>=0)return F.numberTypeAnnotation();if(F.BOOLEAN_BINARY_OPERATORS.indexOf(t)>=0)return F.booleanTypeAnnotation();if("+"===t){var r=this.get("right"),n=this.get("left");return n.isBaseType("number")&&r.isBaseType("number")?F.numberTypeAnnotation():n.isBaseType("string")||r.isBaseType("string")?F.stringTypeAnnotation():F.unionTypeAnnotation([F.stringTypeAnnotation(),F.numberTypeAnnotation()])}}function c(){return F.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])}function p(){return F.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])}function h(){return this.get("expressions").pop().getTypeAnnotation()}function f(){return this.get("right").getTypeAnnotation()}function d(e){var t=e.operator;if("++"===t||"--"===t)return F.numberTypeAnnotation()}function m(){return F.stringTypeAnnotation()}function y(){return F.numberTypeAnnotation()}function g(){return F.booleanTypeAnnotation()}function b(){return F.nullLiteralTypeAnnotation()}function v(){return F.genericTypeAnnotation(F.identifier("RegExp"))}function x(){return F.genericTypeAnnotation(F.identifier("Object"))}function E(){return F.genericTypeAnnotation(F.identifier("Array"))}function A(){return E()}function D(){return F.genericTypeAnnotation(F.identifier("Function"))}function C(){return _(this.get("callee"))}function S(){return _(this.get("tag"))}function _(e){if(e=e.resolve(),e.isFunction()){if(e.is("async"))return e.is("generator")?F.genericTypeAnnotation(F.identifier("AsyncIterator")):F.genericTypeAnnotation(F.identifier("Promise"));if(e.node.returnType)return e.node.returnType}}r.__esModule=!0,r.ClassDeclaration=r.ClassExpression=r.FunctionDeclaration=r.ArrowFunctionExpression=r.FunctionExpression=r.Identifier=void 0;var w=e("./inferer-reference");Object.defineProperty(r,"Identifier",{enumerable:!0,get:function(){return n(w).default}}),r.VariableDeclarator=i, +r.TypeCastExpression=s,r.NewExpression=a,r.TemplateLiteral=o,r.UnaryExpression=u,r.BinaryExpression=l,r.LogicalExpression=c,r.ConditionalExpression=p,r.SequenceExpression=h,r.AssignmentExpression=f,r.UpdateExpression=d,r.StringLiteral=m,r.NumericLiteral=y,r.BooleanLiteral=g,r.NullLiteral=b,r.RegExpLiteral=v,r.ObjectExpression=x,r.ArrayExpression=E,r.RestElement=A,r.CallExpression=C,r.TaggedTemplateExpression=S;var k=e("babel-types"),F=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(k);s.validParent=!0,A.validParent=!0,r.FunctionExpression=D,r.ArrowFunctionExpression=D,r.FunctionDeclaration=D,r.ClassExpression=D,r.ClassDeclaration=D},{"./inferer-reference":145,"babel-types":169}],147:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){function r(e){var t=n[s];return"*"===t||e===t}if(!this.isMemberExpression())return!1;for(var n=e.split("."),i=[this.node],s=0;i.length;){var a=i.shift();if(t&&s===n.length)return!0;if(k.isIdentifier(a)){if(!r(a.name))return!1}else if(k.isLiteral(a)){if(!r(a.value))return!1}else{if(k.isMemberExpression(a)){if(a.computed&&!k.isLiteral(a.property))return!1;i.unshift(a.property),i.unshift(a.object);continue}if(!k.isThisExpression(a))return!1;if(!r("this"))return!1}if(++s>n.length)return!1}return s===n.length}function s(e){var t=this.node&&this.node[e];return t&&Array.isArray(t)?!!t.length:!!t}function a(){return this.scope.isStatic(this.node)}function o(e){return!this.has(e)}function u(e,t){return this.node[e]===t}function l(e){return k.isType(this.type,e)}function c(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()}function p(e){return!("body"!==this.key||!this.parentPath.isArrowFunctionExpression())&&(this.isExpression()?k.isBlockStatement(e):!!this.isBlockStatement()&&k.isExpression(e))}function h(e){var t=this,r=!0;do{var n=t.container;if(t.isFunction()&&!r)return!!e;if(r=!1,Array.isArray(n)&&t.key!==n.length-1)return!1}while((t=t.parentPath)&&!t.isProgram());return!0}function f(){return!this.parentPath.isLabeledStatement()&&!k.isBlockStatement(this.container)&&(0,_.default)(k.STATEMENT_OR_BLOCK_KEYS,this.key)}function d(e,t){if(!this.isReferencedIdentifier())return!1;var r=this.scope.getBinding(this.node.name);if(!r||"module"!==r.kind)return!1;var n=r.path,i=n.parentPath;return!!i.isImportDeclaration()&&(i.node.source.value===e&&(!t||(!(!n.isImportDefaultSpecifier()||"default"!==t)||(!(!n.isImportNamespaceSpecifier()||"*"!==t)||!(!n.isImportSpecifier()||n.node.imported.name!==t)))))}function m(){var e=this.node;return e.end?this.hub.file.code.slice(e.start,e.end):""}function y(e){return"after"!==this._guessExecutionStatusRelativeTo(e)}function g(e){var t=e.scope.getFunctionParent(),r=this.scope.getFunctionParent();if(t.node!==r.node){var n=this._guessExecutionStatusRelativeToDifferentFunctions(t);if(n)return n;e=t.path}var i=e.getAncestry();if(i.indexOf(this)>=0)return"after";var s=this.getAncestry(),a=void 0,o=void 0,u=void 0;for(u=0;u=0){a=l;break}}if(!a)return"before";var c=i[o-1],p=s[u-1];return c&&p?c.listKey&&c.container===p.container?c.key>p.key?"before":"after":k.VISITOR_KEYS[c.type].indexOf(c.key)>k.VISITOR_KEYS[p.type].indexOf(p.key)?"before":"after":"before"}function b(e){var t=e.path;if(t.isFunctionDeclaration()){var r=t.scope.getBinding(t.node.id.name);if(!r.references)return"before";for(var n=r.referencePaths,i=n,s=Array.isArray(i),a=0,i=s?i:(0,C.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;if("callee"!==u.key||!u.parentPath.isCallExpression())return}for(var l=void 0,c=n,p=Array.isArray(c),h=0,c=p?c:(0,C.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if(h=c.next(),h.done)break;f=h.value}var d=f;if(!!!d.find(function(e){return e.node===t.node})){var m=this._guessExecutionStatusRelativeTo(d);if(l){if(l!==m)return}else l=m}}return l}}function v(e,t){return this._resolve(e,t)||this}function x(e,t){var r=this;if(!(t&&t.indexOf(this)>=0))if(t=t||[],t.push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){var n=this.scope.getBinding(this.node.name);if(!n)return;if(!n.constant)return;if("module"===n.kind)return;if(n.path!==this){var i=function(){var i=n.path.resolve(e,t);return r.find(function(e){return e.node===i.node})?{v:void 0}:{v:i}}();if("object"===(void 0===i?"undefined":(0,A.default)(i)))return i.v}}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){var s=this.toComputedKey();if(!k.isLiteral(s))return;var a=s.value,o=this.get("object").resolve(e,t);if(o.isObjectExpression())for(var u=o.get("properties"),l=u,c=Array.isArray(l),p=0,l=c?l:(0,C.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if(p=l.next(),p.done)break;h=p.value}var f=h;if(f.isProperty()){var d=f.get("key"),m=f.isnt("computed")&&d.isIdentifier({name:a});if(m=m||d.isLiteral({value:a}))return f.get("value").resolve(e,t)}}else if(o.isArrayExpression()&&!isNaN(+a)){var y=o.get("elements"),g=y[a];if(g)return g.resolve(e,t)}}}}r.__esModule=!0,r.is=void 0;var E=e("babel-runtime/helpers/typeof"),A=n(E),D=e("babel-runtime/core-js/get-iterator"),C=n(D);r.matchesPattern=i,r.has=s,r.isStatic=a,r.isnt=o,r.equals=u,r.isNodeType=l,r.canHaveVariableDeclarationOrExpression=c,r.canSwapBetweenExpressionAndStatement=p,r.isCompletionRecord=h,r.isStatementOrBlock=f,r.referencesImport=d,r.getSource=m,r.willIMaybeExecuteBefore=y,r._guessExecutionStatusRelativeTo=g,r._guessExecutionStatusRelativeToDifferentFunctions=b,r.resolve=v,r._resolve=x;var S=e("lodash/includes"),_=n(S),w=e("babel-types"),k=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(w);r.is=s},{"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/typeof":131,"babel-types":169,"lodash/includes":496}],148:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/core-js/get-iterator"),s=n(i),a=e("babel-runtime/helpers/classCallCheck"),o=n(a),u=e("babel-types"),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),c={ReferencedIdentifier:function(e,t){if(!e.isJSXIdentifier()||!u.react.isCompatTag(e.node.name)||e.parentPath.isJSXMemberExpression()){if("this"===e.node.name){var r=e.scope;do{if(r.path.isFunction()&&!r.path.isArrowFunctionExpression())break}while(r=r.parent);r&&t.breakOnScopePaths.push(r.path)}var n=e.scope.getBinding(e.node.name);n&&n===t.scope.getBinding(e.node.name)&&(t.bindings[e.node.name]=n)}}},p=function(){function e(t,r){(0,o.default)(this,e),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=r,this.path=t,this.attachAfter=!1}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var r=this.bindings[t];if(!e.bindingIdentifierEquals(t,r.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;if(this.scopes.push(e),this.breakOnScopePaths.indexOf(e.path)>=0)break}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this._getAttachmentPath();if(e){var t=e.scope;if(t.path===e&&(t=e.scope.parent),t.path.isProgram()||t.path.isFunction())for(var r in this.bindings)if(t.hasOwnBinding(r)){var n=this.bindings[r];if("param"!==n.kind&&this.getAttachmentParentForPath(n.path).key>e.key){this.attachAfter=!0,e=n.path;for(var i=n.constantViolations,a=Array.isArray(i),o=0,i=a?i:(0,s.default)(i);;){var u;if(a){if(o>=i.length)break;u=i[o++]}else{if(o=i.next(),o.done)break;u=o.value}var l=u;this.getAttachmentParentForPath(l).key>e.key&&(e=l)}}}return e}},e.prototype._getAttachmentPath=function(){var e=this.scopes,t=e.pop();if(t){if(t.path.isFunction()){if(this.hasOwnParamBindings(t)){if(this.scope===t)return;return t.path.get("body").get("body")[0]}return this.getNextScopeAttachmentParent()}return t.path.isProgram()?this.getNextScopeAttachmentParent():void 0}},e.prototype.getNextScopeAttachmentParent=function(){var e=this.scopes.pop();if(e)return this.getAttachmentParentForPath(e.path)},e.prototype.getAttachmentParentForPath=function(e){do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement()||e.isVariableDeclarator()&&null!==e.parentPath.node&&e.parentPath.node.declarations.length>1)return e}while(e=e.parentPath)},e.prototype.hasOwnParamBindings=function(e){for(var t in this.bindings)if(e.hasOwnBinding(t)){var r=this.bindings[t];if("param"===r.kind&&r.constant)return!0}return!1},e.prototype.run=function(){var e=this.path.node;if(!e._hoisted){e._hoisted=!0,this.path.traverse(c,this),this.getCompatibleScopes();var t=this.getAttachmentPath();if(t&&t.getFunctionParent()!==this.path.getFunctionParent()){var r=t.scope.generateUidIdentifier("ref"),n=l.variableDeclarator(r,this.path.node);t[this.attachAfter?"insertAfter":"insertBefore"]([t.isVariableDeclarator()?n:l.variableDeclaration("var",[n])]);var i=this.path.parentPath;i.isJSXElement()&&this.path.container===i.node.children&&(r=l.JSXExpressionContainer(r)),this.path.replaceWith(r)}}},e}();r.default=p,t.exports=r.default},{"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/classCallCheck":127,"babel-types":169}],149:[function(e,t,r){"use strict";r.__esModule=!0;r.hooks=[function(e,t){if("test"===e.key&&(t.isWhile()||t.isSwitchCase())||"declaration"===e.key&&t.isExportDeclaration()||"body"===e.key&&t.isLabeledStatement()||"declarations"===e.listKey&&t.isVariableDeclaration()&&1===t.node.declarations.length||"expression"===e.key&&t.isExpressionStatement())return t.remove(),!0},function(e,t){if(t.isSequenceExpression()&&1===t.node.expressions.length)return t.replaceWith(t.node.expressions[0]),!0},function(e,t){if(t.isBinary())return"left"===e.key?t.replaceWith(t.node.right):t.replaceWith(t.node.left),!0},function(e,t){if(t.isIfStatement()&&("consequent"===e.key||"alternate"===e.key)||"body"===e.key&&(t.isLoop()||t.isArrowFunctionExpression()))return e.replaceWith({type:"BlockStatement",body:[]}),!0}]},{}],150:[function(e,t,r){"use strict";r.__esModule=!0,r.Flow=r.Pure=r.Generated=r.User=r.Var=r.BlockScoped=r.Referenced=r.Scope=r.Expression=r.Statement=r.BindingIdentifier=r.ReferencedMemberExpression=r.ReferencedIdentifier=void 0;var n=e("babel-types"),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n);r.ReferencedIdentifier={types:["Identifier","JSXIdentifier"],checkPath:function(e,t){var r=e.node,s=e.parent;if(!i.isIdentifier(r,t)&&!i.isJSXMemberExpression(s,t)){if(!i.isJSXIdentifier(r,t))return!1;if(n.react.isCompatTag(r.name))return!1}return i.isReferenced(r,s)}},r.ReferencedMemberExpression={types:["MemberExpression"],checkPath:function(e){var t=e.node,r=e.parent;return i.isMemberExpression(t)&&i.isReferenced(t,r)}},r.BindingIdentifier={types:["Identifier"],checkPath:function(e){var t=e.node,r=e.parent;return i.isIdentifier(t)&&i.isBinding(t,r)}},r.Statement={types:["Statement"],checkPath:function(e){var t=e.node,r=e.parent;if(i.isStatement(t)){if(i.isVariableDeclaration(t)){if(i.isForXStatement(r,{left:t}))return!1;if(i.isForStatement(r,{init:t}))return!1}return!0}return!1}},r.Expression={types:["Expression"],checkPath:function(e){return e.isIdentifier()?e.isReferencedIdentifier():i.isExpression(e.node)}},r.Scope={types:["Scopable"],checkPath:function(e){return i.isScope(e.node,e.parent)}},r.Referenced={checkPath:function(e){return i.isReferenced(e.node,e.parent)}},r.BlockScoped={checkPath:function(e){return i.isBlockScoped(e.node)}},r.Var={types:["VariableDeclaration"],checkPath:function(e){return i.isVar(e.node)}},r.User={checkPath:function(e){return e.node&&!!e.node.loc}},r.Generated={checkPath:function(e){return!e.isUser()}},r.Pure={checkPath:function(e,t){return e.scope.isPure(e.node,t)}},r.Flow={types:["Flow","ImportDeclaration","ExportDeclaration","ImportSpecifier"],checkPath:function(e){var t=e.node;return!!i.isFlow(t)||(i.isImportDeclaration(t)?"type"===t.importKind||"typeof"===t.importKind:i.isExportDeclaration(t)?"type"===t.exportKind:!!i.isImportSpecifier(t)&&("type"===t.importKind||"typeof"===t.importKind))}}},{"babel-types":169}],151:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&e.push(this.node),this.replaceExpressionWithStatements(e);else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertBefore(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this._replaceWith(S.blockStatement(e))}return[this]}function s(e,t){this.updateSiblingKeys(e,t.length);for(var r=[],n=0;n=u.length)break;p=u[c++]}else{if(c=u.next(),c.done)break;p=c.value}var h=p;h.setScope(),h.debug(function(){return"Inserted."});for(var f=o,d=Array.isArray(f),m=0,f=d?f:(0,b.default)(f);;){var y;if(d){if(m>=f.length)break;y=f[m++]}else{if(m=f.next(),m.done)break;y=m.value}y.maybeQueue(h,!0)}}return r}function a(e){return this._containerInsert(this.key,e)}function o(e){return this._containerInsert(this.key+1,e)}function u(e){var t=e[e.length-1];(S.isIdentifier(t)||S.isExpressionStatement(t)&&S.isIdentifier(t.expression))&&!this.isCompletionRecord()&&e.pop()}function l(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var t=this.scope.generateDeclaredUidIdentifier();e.unshift(S.expressionStatement(S.assignmentExpression("=",t,this.node))),e.push(S.expressionStatement(t))}this.replaceExpressionWithStatements(e)}else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertAfter(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this._replaceWith(S.blockStatement(e))}return[this]}function c(e,t){if(this.parent)for(var r=v.path.get(this.parent),n=0;n=e&&(i.key+=t)}}function p(e){if(!e)return[];e.constructor!==Array&&(e=[e]);for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:this.scope;return new E.default(this,e).run()}r.__esModule=!0;var m=e("babel-runtime/helpers/typeof"),y=n(m),g=e("babel-runtime/core-js/get-iterator"),b=n(g);r.insertBefore=i,r._containerInsert=s,r._containerInsertBefore=a,r._containerInsertAfter=o,r._maybePopFromStatements=u,r.insertAfter=l,r.updateSiblingKeys=c,r._verifyNodeList=p,r.unshiftContainer=h,r.pushContainer=f,r.hoist=d;var v=e("../cache"),x=e("./lib/hoister"),E=n(x),A=e("./index"),D=n(A),C=e("babel-types"),S=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(C)},{"../cache":133,"./index":143,"./lib/hoister":148,"babel-runtime/core-js/get-iterator":113,"babel-runtime/helpers/typeof":131,"babel-types":169}],152:[function(e,t,r){"use strict";function n(){if(this._assertUnremoved(),this.resync(),this._callRemovalHooks())return void this._markRemoved();this.shareCommentsWithSiblings(),this._remove(),this._markRemoved()}function i(){for(var e=c.hooks,t=Array.isArray(e),r=0,e=t?e:(0,l.default)(e);;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if(r=e.next(),r.done)break;n=r.value}if(n(this,this.parentPath))return!0}}function s(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this._replaceWith(null)}function a(){this.shouldSkip=!0,this.removed=!0,this.node=null}function o(){if(this.removed)throw this.buildCodeFrameError("NodePath has been removed so is read-only.")}r.__esModule=!0;var u=e("babel-runtime/core-js/get-iterator"),l=function(e){return e&&e.__esModule?e:{default:e}}(u);r.remove=n,r._callRemovalHooks=i,r._remove=s,r._markRemoved=a,r._assertUnremoved=o;var c=e("./lib/removal-hooks")},{"./lib/removal-hooks":149,"babel-runtime/core-js/get-iterator":113}],153:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){this.resync(),e=this._verifyNodeList(e),x.inheritLeadingComments(e[0],this.node),x.inheritTrailingComments(e[e.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(e),this.node?this.requeue():this.remove()}function s(e){this.resync();try{e="("+e+")",e=(0,b.parse)(e)}catch(r){var t=r.loc;throw t&&(r.message+=" - make sure this is an expression.",r.message+="\n"+(0,f.default)(e,t.line,t.column+1)),r}return e=e.program.body[0].expression,m.default.removeProperties(e),this.replaceWith(e)}function a(e){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(e instanceof g.default&&(e=e.node),!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");if(this.node!==e){if(this.isProgram()&&!x.isProgram(e))throw new Error("You can only replace a Program root node with another Program node");if(Array.isArray(e))throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");if("string"==typeof e)throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");if(this.isNodeType("Statement")&&x.isExpression(e)&&(this.canHaveVariableDeclarationOrExpression()||this.canSwapBetweenExpressionAndStatement(e)||(e=x.expressionStatement(e))),this.isNodeType("Expression")&&x.isStatement(e)&&!this.canHaveVariableDeclarationOrExpression()&&!this.canSwapBetweenExpressionAndStatement(e))return this.replaceExpressionWithStatements([e]);var t=this.node;t&&(x.inheritsComments(e,t),x.removeComments(t)),this._replaceWith(e),this.type=e.type,this.setScope(),this.requeue()}}function o(e){if(!this.container)throw new ReferenceError("Container is falsy");this.inList?x.validate(this.parent,this.key,[e]):x.validate(this.parent,this.key,e),this.debug(function(){return"Replace with "+(e&&e.type)}),this.node=this.container[this.key]=e}function u(e){this.resync();var t=x.toSequenceExpression(e,this.scope);if(x.isSequenceExpression(t)){var r=t.expressions;r.length>=2&&this.parentPath.isExpressionStatement()&&this._maybePopFromStatements(r),1===r.length?this.replaceWith(r[0]):this.replaceWith(t)}else{if(!t){var n=x.functionExpression(null,[],x.blockStatement(e));n.shadow=!0,this.replaceWith(x.callExpression(n,[])),this.traverse(E);for(var i=this.get("callee").getCompletionRecords(),s=i,a=Array.isArray(s),o=0,s=a?s:(0,p.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var l=u;if(l.isExpressionStatement()){var c=l.findParent(function(e){return e.isLoop()});if(c){var h=c.getData("expressionReplacementReturnUid");if(h)h=x.identifier(h.name);else{var f=this.get("callee");h=f.scope.generateDeclaredUidIdentifier("ret"),f.get("body").pushContainer("body",x.returnStatement(h)),c.setData("expressionReplacementReturnUid",h)}l.get("expression").replaceWith(x.assignmentExpression("=",h,l.node.expression))}else l.replaceWith(x.returnStatement(l.node.expression))}}return this.node}this.replaceWith(t)}}function l(e){return this.resync(),Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.remove()):this.replaceWithMultiple(e):this.replaceWith(e)}r.__esModule=!0;var c=e("babel-runtime/core-js/get-iterator"),p=n(c);r.replaceWithMultiple=i,r.replaceWithSourceString=s,r.replaceWith=a,r._replaceWith=o,r.replaceExpressionWithStatements=u,r.replaceInline=l;var h=e("babel-code-frame"),f=n(h),d=e("../index"),m=n(d),y=e("./index"),g=n(y),b=e("babylon"),v=e("babel-types"),x=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(v),E={Function:function(e){e.skip()},VariableDeclaration:function(e){if("var"===e.node.kind){var t=e.getBindingIdentifiers();for(var r in t)e.scope.push({id:t[r]});for(var n=[],i=e.node.declarations,s=Array.isArray(i),a=0,i=s?i:(0,p.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;u.init&&n.push(x.expressionStatement(x.assignmentExpression("=",u.id,u.init)))}e.replaceWithMultiple(n)}}}},{"../index":136,"./index":143,"babel-code-frame":23,"babel-runtime/core-js/get-iterator":113,"babel-types":169,babylon:177}],154:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("babel-runtime/helpers/classCallCheck"),i=function(e){return e&&e.__esModule?e:{default:e}}(n),s=function(){function e(t){var r=t.existing,n=t.identifier,s=t.scope,a=t.path,o=t.kind;(0,i.default)(this,e),this.identifier=n,this.scope=s,this.path=a,this.kind=o,this.constantViolations=[],this.constant=!0,this.referencePaths=[],this.referenced=!1,this.references=0,this.clearValue(),r&&(this.constantViolations=[].concat(r.path,r.constantViolations,this.constantViolations))}return e.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},e.prototype.setValue=function(e){this.hasDeoptedValue||(this.hasValue=!0,this.value=e)},e.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},e.prototype.reassign=function(e){this.constant=!1,-1===this.constantViolations.indexOf(e)&&this.constantViolations.push(e)},e.prototype.reference=function(e){-1===this.referencePaths.indexOf(e)&&(this.referenced=!0,this.references++,this.referencePaths.push(e))},e.prototype.dereference=function(){this.references--,this.referenced=!!this.references},e}();r.default=s,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":127}],155:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){for(var n=N.scope.get(e.node)||[],i=n,s=Array.isArray(i),a=0,i=s?i:(0,y.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;if(u.parent===t&&u.path===e)return u}n.push(r),N.scope.has(e.node)||N.scope.set(e.node,n)}function a(e,t){if(j.isModuleDeclaration(e))if(e.source)a(e.source,t);else if(e.specifiers&&e.specifiers.length)for(var r=e.specifiers,n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var o=s;a(o,t)}else e.declaration&&a(e.declaration,t);else if(j.isModuleSpecifier(e))a(e.local,t);else if(j.isMemberExpression(e))a(e.object,t),a(e.property,t);else if(j.isIdentifier(e))t.push(e.name);else if(j.isLiteral(e))t.push(e.value);else if(j.isCallExpression(e))a(e.callee,t);else if(j.isObjectExpression(e)||j.isObjectPattern(e))for(var u=e.properties,l=Array.isArray(u),c=0,u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if(c=u.next(),c.done)break;p=c.value}var h=p;a(h.key||h.argument,t)}}r.__esModule=!0;var o=e("babel-runtime/core-js/object/keys"),u=i(o),l=e("babel-runtime/core-js/object/create"),c=i(l),p=e("babel-runtime/core-js/map"),h=i(p),f=e("babel-runtime/helpers/classCallCheck"),d=i(f),m=e("babel-runtime/core-js/get-iterator"),y=i(m),g=e("lodash/includes"),b=i(g),v=e("lodash/repeat"),x=i(v),E=e("./lib/renamer"),A=i(E),D=e("../index"),C=i(D),S=e("lodash/defaults"),_=i(S),w=e("babel-messages"),k=n(w),F=e("./binding"),T=i(F),P=e("globals"),B=i(P),O=e("babel-types"),j=n(O),N=e("../cache"),I=0,L={For:function(e){for(var t=j.FOR_INIT_KEYS,r=Array.isArray(t),n=0,t=r?t:(0,y.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i,a=e.get(s);a.isVar()&&e.scope.getFunctionParent().registerBinding("var",a)}},Declaration:function(e){e.isBlockScoped()||e.isExportDeclaration()&&e.get("declaration").isDeclaration()||e.scope.getFunctionParent().registerDeclaration(e)},ReferencedIdentifier:function(e,t){t.references.push(e)},ForXStatement:function(e,t){var r=e.get("left");(r.isPattern()||r.isIdentifier())&&t.constantViolations.push(r)},ExportDeclaration:{exit:function(e){var t=e.node,r=e.scope,n=t.declaration;if(j.isClassDeclaration(n)||j.isFunctionDeclaration(n)){var i=n.id;if(!i)return;var s=r.getBinding(i.name);s&&s.reference(e)}else if(j.isVariableDeclaration(n))for(var a=n.declarations,o=Array.isArray(a),u=0,a=o?a:(0,y.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if(u=a.next(),u.done)break;l=u.value}var c=l,p=j.getBindingIdentifiers(c);for(var h in p){var f=r.getBinding(h);f&&f.reference(e)}}}},LabeledStatement:function(e){e.scope.getProgramParent().addGlobal(e.node),e.scope.getBlockParent().registerDeclaration(e)},AssignmentExpression:function(e,t){t.assignments.push(e)},UpdateExpression:function(e,t){t.constantViolations.push(e.get("argument"))},UnaryExpression:function(e,t){"delete"===e.node.operator&&t.constantViolations.push(e.get("argument"))},BlockScoped:function(e){var t=e.scope;t.path===e&&(t=t.parent),t.getBlockParent().registerDeclaration(e)},ClassDeclaration:function(e){var t=e.node.id;if(t){var r=t.name;e.scope.bindings[r]=e.scope.getBinding(r)}},Block:function(e){for(var t=e.get("body"),r=t,n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;a.isFunctionDeclaration()&&e.scope.getBlockParent().registerDeclaration(a)}}},M=0,R=function(){function e(t,r){if((0,d.default)(this,e),r&&r.block===t.node)return r;var n=s(t,r,this);if(n)return n;this.uid=M++,this.parent=r,this.hub=t.hub,this.parentBlock=t.parent,this.block=t.node,this.path=t,this.labels=new h.default}return e.prototype.traverse=function(e,t,r){(0,C.default)(e,t,this,r,this.path)},e.prototype.generateDeclaredUidIdentifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp",t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp";return j.identifier(this.generateUid(e))},e.prototype.generateUid=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp";e=j.toIdentifier(e).replace(/^_+/,"").replace(/[0-9]+$/g,"");var t=void 0,r=0;do{t=this._generateUid(e,r),r++}while(this.hasLabel(t)||this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var n=this.getProgramParent();return n.references[t]=!0,n.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var r=e;return t>1&&(r+=t),"_"+r},e.prototype.generateUidIdentifierBasedOnNode=function(e,t){var r=e;j.isAssignmentExpression(e)?r=e.left:j.isVariableDeclarator(e)?r=e.id:(j.isObjectProperty(r)||j.isObjectMethod(r))&&(r=r.key);var n=[];a(r,n);var i=n.join("$");return i=i.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(i.slice(0,20))},e.prototype.isStatic=function(e){if(j.isThisExpression(e)||j.isSuper(e))return!0;if(j.isIdentifier(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},e.prototype.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t||this.push({id:r}),r},e.prototype.checkBlockScopedCollisions=function(e,t,r,n){if("param"!==t&&("hoisted"!==t||"let"!==e.kind)){if("let"===t||"let"===e.kind||"const"===e.kind||"module"===e.kind||"param"===e.kind&&("let"===t||"const"===t))throw this.hub.file.buildCodeFrameError(n,k.get("scopeDuplicateDeclaration",r),TypeError)}},e.prototype.rename=function(e,t,r){var n=this.getBinding(e);if(n)return t=t||this.generateUidIdentifier(e).name,new A.default(n,e,t).rename(r)},e.prototype._renameFromMap=function(e,t,r,n){e[t]&&(e[r]=n,e[t]=null)},e.prototype.dump=function(){var e=(0,x.default)("-",60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r in t.bindings){var n=t.bindings[r];console.log(" -",r,{constant:n.constant,references:n.references,violations:n.constantViolations.length,kind:n.kind})}}while(t=t.parent);console.log(e)},e.prototype.toArray=function(e,t){var r=this.hub.file;if(j.isIdentifier(e)){var n=this.getBinding(e.name);if(n&&n.constant&&n.path.isGenericType("Array"))return e}if(j.isArrayExpression(e))return e;if(j.isIdentifier(e,{name:"arguments"}))return j.callExpression(j.memberExpression(j.memberExpression(j.memberExpression(j.identifier("Array"),j.identifier("prototype")),j.identifier("slice")),j.identifier("call")),[e]);var i="toArray",s=[e];return!0===t?i="toConsumableArray":t&&(s.push(j.numericLiteral(t)),i="slicedToArray"),j.callExpression(r.addHelper(i),s)},e.prototype.hasLabel=function(e){return!!this.getLabel(e)},e.prototype.getLabel=function(e){return this.labels.get(e)},e.prototype.registerLabel=function(e){this.labels.set(e.node.label.name,e)},e.prototype.registerDeclaration=function(e){if(e.isLabeledStatement())this.registerLabel(e);else if(e.isFunctionDeclaration())this.registerBinding("hoisted",e.get("id"),e);else if(e.isVariableDeclaration())for(var t=e.get("declarations"),r=t,n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;this.registerBinding(e.node.kind,a)}else if(e.isClassDeclaration())this.registerBinding("let",e);else if(e.isImportDeclaration())for(var o=e.get("specifiers"),u=o,l=Array.isArray(u),c=0,u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if(c=u.next(),c.done)break;p=c.value}var h=p;this.registerBinding("module",h)}else if(e.isExportDeclaration()){var f=e.get("declaration");(f.isClassDeclaration()||f.isFunctionDeclaration()||f.isVariableDeclaration())&&this.registerDeclaration(f)}else this.registerBinding("unknown",e)},e.prototype.buildUndefinedNode=function(){return this.hasBinding("undefined")?j.unaryExpression("void",j.numericLiteral(0),!0):j.identifier("undefined")},e.prototype.registerConstantViolation=function(e){var t=e.getBindingIdentifiers();for(var r in t){var n=this.getBinding(r) +;n&&n.reassign(e)}},e.prototype.registerBinding=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if(!e)throw new ReferenceError("no `kind`");if(t.isVariableDeclaration())for(var n=t.get("declarations"),i=n,s=Array.isArray(i),a=0,i=s?i:(0,y.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;this.registerBinding(e,u)}else{var l=this.getProgramParent(),c=t.getBindingIdentifiers(!0);for(var p in c)for(var h=c[p],f=Array.isArray(h),d=0,h=f?h:(0,y.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if(d=h.next(),d.done)break;m=d.value}var g=m,b=this.getOwnBinding(p);if(b){if(b.identifier===g)continue;this.checkBlockScopedCollisions(b,e,p,g)}b&&b.path.isFlow()&&(b=null),l.references[p]=!0,this.bindings[p]=new T.default({identifier:g,existing:b,scope:this,path:r,kind:e})}}},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasUid=function(e){var t=this;do{if(t.uids[e])return!0}while(t=t.parent);return!1},e.prototype.hasGlobal=function(e){var t=this;do{if(t.globals[e])return!0}while(t=t.parent);return!1},e.prototype.hasReference=function(e){var t=this;do{if(t.references[e])return!0}while(t=t.parent);return!1},e.prototype.isPure=function(e,t){if(j.isIdentifier(e)){var r=this.getBinding(e.name);return!!r&&(!t||r.constant)}if(j.isClass(e))return!(e.superClass&&!this.isPure(e.superClass,t))&&this.isPure(e.body,t);if(j.isClassBody(e)){for(var n=e.body,i=Array.isArray(n),s=0,n=i?n:(0,y.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;if(!this.isPure(o,t))return!1}return!0}if(j.isBinary(e))return this.isPure(e.left,t)&&this.isPure(e.right,t);if(j.isArrayExpression(e)){for(var u=e.elements,l=Array.isArray(u),c=0,u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if(c=u.next(),c.done)break;p=c.value}var h=p;if(!this.isPure(h,t))return!1}return!0}if(j.isObjectExpression(e)){for(var f=e.properties,d=Array.isArray(f),m=0,f=d?f:(0,y.default)(f);;){var g;if(d){if(m>=f.length)break;g=f[m++]}else{if(m=f.next(),m.done)break;g=m.value}var b=g;if(!this.isPure(b,t))return!1}return!0}return j.isClassMethod(e)?!(e.computed&&!this.isPure(e.key,t))&&("get"!==e.kind&&"set"!==e.kind):j.isClassProperty(e)||j.isObjectProperty(e)?!(e.computed&&!this.isPure(e.key,t))&&this.isPure(e.value,t):j.isUnaryExpression(e)?this.isPure(e.argument,t):j.isPureish(e)},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e){var t=this;do{var r=t.data[e];if(null!=r)return r}while(t=t.parent)},e.prototype.removeData=function(e){var t=this;do{null!=t.data[e]&&(t.data[e]=null)}while(t=t.parent)},e.prototype.init=function(){this.references||this.crawl()},e.prototype.crawl=function(){I++,this._crawl(),I--},e.prototype._crawl=function(){var e=this.path;if(this.references=(0,c.default)(null),this.bindings=(0,c.default)(null),this.globals=(0,c.default)(null),this.uids=(0,c.default)(null),this.data=(0,c.default)(null),e.isLoop())for(var t=j.FOR_INIT_KEYS,r=Array.isArray(t),n=0,t=r?t:(0,y.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i,a=e.get(s);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}if(e.isFunctionExpression()&&e.has("id")&&(e.get("id").node[j.NOT_LOCAL_BINDING]||this.registerBinding("local",e.get("id"),e)),e.isClassExpression()&&e.has("id")&&(e.get("id").node[j.NOT_LOCAL_BINDING]||this.registerBinding("local",e)),e.isFunction())for(var o=e.get("params"),u=o,l=Array.isArray(u),p=0,u=l?u:(0,y.default)(u);;){var h;if(l){if(p>=u.length)break;h=u[p++]}else{if(p=u.next(),p.done)break;h=p.value}var f=h;this.registerBinding("param",f)}if(e.isCatchClause()&&this.registerBinding("let",e),!this.getProgramParent().crawling){var d={references:[],constantViolations:[],assignments:[]};this.crawling=!0,e.traverse(L,d),this.crawling=!1;for(var m=d.assignments,g=Array.isArray(m),b=0,m=g?m:(0,y.default)(m);;){var v;if(g){if(b>=m.length)break;v=m[b++]}else{if(b=m.next(),b.done)break;v=b.value}var x=v,E=x.getBindingIdentifiers(),A=void 0;for(var D in E)x.scope.getBinding(D)||(A=A||x.scope.getProgramParent(),A.addGlobal(E[D]));x.scope.registerConstantViolation(x)}for(var C=d.references,S=Array.isArray(C),_=0,C=S?C:(0,y.default)(C);;){var w;if(S){if(_>=C.length)break;w=C[_++]}else{if(_=C.next(),_.done)break;w=_.value}var k=w,F=k.scope.getBinding(k.node.name);F?F.reference(k):k.scope.getProgramParent().addGlobal(k.node)}for(var T=d.constantViolations,P=Array.isArray(T),B=0,T=P?T:(0,y.default)(T);;){var O;if(P){if(B>=T.length)break;O=T[B++]}else{if(B=T.next(),B.done)break;O=B.value}var N=O;N.scope.registerConstantViolation(N)}}},e.prototype.push=function(e){var t=this.path;t.isBlockStatement()||t.isProgram()||(t=this.getBlockParent().path),t.isSwitchStatement()&&(t=this.getFunctionParent().path),(t.isLoop()||t.isCatchClause()||t.isFunction())&&(j.ensureBlock(t.node),t=t.get("body"));var r=e.unique,n=e.kind||"var",i=null==e._blockHoist?2:e._blockHoist,s="declaration:"+n+":"+i,a=!r&&t.getData(s);if(!a){var o=j.variableDeclaration(n,[]);o._generated=!0,o._blockHoist=i;a=t.unshiftContainer("body",[o])[0],r||t.setData(s,a)}var u=j.variableDeclarator(e.id,e.init);a.node.declarations.push(u),this.registerBinding(n,a.get("declarations").pop())},e.prototype.getProgramParent=function(){var e=this;do{if(e.path.isProgram())return e}while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getFunctionParent=function(){var e=this;do{if(e.path.isFunctionParent())return e}while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getBlockParent=function(){var e=this;do{if(e.path.isBlockParent())return e}while(e=e.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},e.prototype.getAllBindings=function(){var e=(0,c.default)(null),t=this;do{(0,_.default)(e,t.bindings),t=t.parent}while(t);return e},e.prototype.getAllBindingsOfKind=function(){for(var e=(0,c.default)(null),t=arguments,r=Array.isArray(t),n=0,t=r?t:(0,y.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i,a=this;do{for(var o in a.bindings){var u=a.bindings[o];u.kind===s&&(e[o]=u)}a=a.parent}while(a)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.warnOnFlowBinding=function(e){return 0===I&&e&&e.path.isFlow()&&console.warn("\n You or one of the Babel plugins you are using are using Flow declarations as bindings.\n Support for this will be removed in version 6.8. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n "),e},e.prototype.getBinding=function(e){var t=this;do{var r=t.getOwnBinding(e);if(r)return this.warnOnFlowBinding(r)}while(t=t.parent)},e.prototype.getOwnBinding=function(e){return this.warnOnFlowBinding(this.bindings[e])},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBinding(e)},e.prototype.hasBinding=function(t,r){return!!t&&(!!this.hasOwnBinding(t)||(!!this.parentHasBinding(t,r)||(!!this.hasUid(t)||(!(r||!(0,b.default)(e.globals,t))||!(r||!(0,b.default)(e.contextVariables,t))))))},e.prototype.parentHasBinding=function(e,t){return this.parent&&this.parent.hasBinding(e,t)},e.prototype.moveBindingTo=function(e,t){var r=this.getBinding(e);r&&(r.scope.removeOwnBinding(e),r.scope=t,t.bindings[e]=r)},e.prototype.removeOwnBinding=function(e){delete this.bindings[e]},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e);var r=this;do{r.uids[e]&&(r.uids[e]=!1)}while(r=r.parent)},e}();R.globals=(0,u.default)(B.default.builtin),R.contextVariables=["arguments","undefined","Infinity","NaN"],r.default=R,t.exports=r.default},{"../cache":133,"../index":136,"./binding":154,"./lib/renamer":156,"babel-messages":103,"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/map":115,"babel-runtime/core-js/object/create":118,"babel-runtime/core-js/object/keys":120,"babel-runtime/helpers/classCallCheck":127,"babel-types":169,globals:303,"lodash/defaults":484,"lodash/includes":496,"lodash/repeat":519}],156:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=e("babel-runtime/helpers/classCallCheck"),s=n(i),a=e("../binding"),o=(n(a),e("babel-types")),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(o),l={ReferencedIdentifier:function(e,t){var r=e.node;r.name===t.oldName&&(r.name=t.newName)},Scope:function(e,t){e.scope.bindingIdentifierEquals(t.oldName,t.binding.identifier)||e.skip()},"AssignmentExpression|Declaration":function(e,t){var r=e.getOuterBindingIdentifiers();for(var n in r)n===t.oldName&&(r[n].name=t.newName)}},c=function(){function e(t,r,n){(0,s.default)(this,e),this.newName=n,this.oldName=r,this.binding=t}return e.prototype.maybeConvertFromExportDeclaration=function(e){var t=e.parentPath.isExportDeclaration()&&e.parentPath;if(t){var r=t.isExportDefaultDeclaration();r&&(e.isFunctionDeclaration()||e.isClassDeclaration())&&!e.node.id&&(e.node.id=e.scope.generateUidIdentifier("default"));var n=e.getOuterBindingIdentifiers(),i=[];for(var s in n){var a=s===this.oldName?this.newName:s,o=r?"default":s;i.push(u.exportSpecifier(u.identifier(a),u.identifier(o)))}if(i.length){var l=u.exportNamedDeclaration(null,i);e.isFunctionDeclaration()&&(l._blockHoist=3),t.insertAfter(l),t.replaceWith(e.node)}}},e.prototype.maybeConvertFromClassFunctionDeclaration=function(e){},e.prototype.maybeConvertFromClassFunctionExpression=function(e){},e.prototype.rename=function(e){var t=this.binding,r=this.oldName,n=this.newName,i=t.scope,s=t.path,a=s.find(function(e){return e.isDeclaration()||e.isFunctionExpression()});a&&this.maybeConvertFromExportDeclaration(a),i.traverse(e||i.block,l,this),e||(i.removeOwnBinding(r),i.bindings[n]=t,this.binding.identifier.name=n),t.type,a&&(this.maybeConvertFromClassFunctionDeclaration(a),this.maybeConvertFromClassFunctionExpression(a))},e}();r.default=c,t.exports=r.default},{"../binding":154,"babel-runtime/helpers/classCallCheck":127,"babel-types":169}],157:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){if(e._exploded)return e;e._exploded=!0;for(var t in e)if(!f(t)){var r=t.split("|");if(1!==r.length){var n=e[t];delete e[t];for(var i=r,s=Array.isArray(i),o=0,i=s?i:(0,x.default)(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if(o=i.next(),o.done)break;u=o.value}var l=u;e[l]=n}}}a(e),delete e.__esModule,c(e),p(e);for(var m=(0,b.default)(e),y=Array.isArray(m),g=0,m=y?m:(0,x.default)(m);;){var v;if(y){if(g>=m.length)break;v=m[g++]}else{if(g=m.next(),g.done)break;v=g.value}var E=v;if(!f(E)){var D=A[E];if(D){var C=e[E];for(var S in C)C[S]=h(D,C[S]);if(delete e[E],D.types)for(var w=D.types,F=Array.isArray(w),T=0,w=F?w:(0,x.default)(w);;){var P;if(F){if(T>=w.length)break;P=w[T++]}else{if(T=w.next(),T.done)break;P=T.value}var B=P;e[B]?d(e[B],C):e[B]=C}else d(e,C)}}}for(var O in e)if(!f(O)){var j=e[O],N=_.FLIPPED_ALIAS_KEYS[O],I=_.DEPRECATED_KEYS[O];if(I&&(console.trace("Visitor defined for "+O+" but it has been renamed to "+I),N=[I]),N){delete e[O];for(var L=N,M=Array.isArray(L),R=0,L=M?L:(0,x.default)(L);;){var U;if(M){if(R>=L.length)break;U=L[R++]}else{if(R=L.next(),R.done)break;U=R.value}var V=U,q=e[V];q?d(q,j):e[V]=(0,k.default)(j)}}}for(var G in e)f(G)||p(e[G]);return e}function a(e){if(!e._verified){if("function"==typeof e)throw new Error(C.get("traverseVerifyRootFunction"));for(var t in e)if("enter"!==t&&"exit"!==t||o(t,e[t]),!f(t)){if(_.TYPES.indexOf(t)<0)throw new Error(C.get("traverseVerifyNodeType",t));var r=e[t];if("object"===(void 0===r?"undefined":(0,y.default)(r)))for(var n in r){if("enter"!==n&&"exit"!==n)throw new Error(C.get("traverseVerifyVisitorProperty",t,n));o(t+"."+n,r[n])}}e._verified=!0}}function o(e,t){for(var r=[].concat(t),n=r,i=Array.isArray(n),s=0,n=i?n:(0,x.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;if("function"!=typeof o)throw new TypeError("Non-function found defined in "+e+" with type "+(void 0===o?"undefined":(0,y.default)(o)))}}function u(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],n={},i=0;i","<",">=","<="]),a=r.EQUALITY_BINARY_OPERATORS=["==","===","!=","!=="],o=r.COMPARISON_BINARY_OPERATORS=[].concat(a,["in","instanceof"]),u=r.BOOLEAN_BINARY_OPERATORS=[].concat(o,s),l=r.NUMBER_BINARY_OPERATORS=["-","/","%","*","**","&","|",">>",">>>","<<","^"],c=(r.BINARY_OPERATORS=["+"].concat(l,u),r.BOOLEAN_UNARY_OPERATORS=["delete","!"]),p=r.NUMBER_UNARY_OPERATORS=["+","-","++","--","~"],h=r.STRING_UNARY_OPERATORS=["typeof"];r.UNARY_OPERATORS=["void"].concat(c,p,h),r.INHERIT_KEYS={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]},r.BLOCK_SCOPED_SYMBOL=(0,i.default)("var used to be block scoped"),r.NOT_LOCAL_BINDING=(0,i.default)("should not be considered a local binding")},{"babel-runtime/core-js/symbol/for":123}],159:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.key||e.property;return e.computed||C.isIdentifier(t)&&(t=C.stringLiteral(t.name)),t}function s(e,t){function r(e){for(var s=!1,a=[],o=e,u=Array.isArray(o),l=0,o=u?o:(0,b.default)(o);;){var c;if(u){if(l>=o.length)break;c=o[l++]}else{if(l=o.next(),l.done)break;c=l.value}var p=c;if(C.isExpression(p))a.push(p);else if(C.isExpressionStatement(p))a.push(p.expression);else{if(C.isVariableDeclaration(p)){if("var"!==p.kind)return i=!0;for(var h=p.declarations,f=Array.isArray(h),d=0,h=f?h:(0,b.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if(d=h.next(),d.done)break;m=d.value}var y=m,g=C.getBindingIdentifiers(y);for(var v in g)n.push({kind:p.kind,id:g[v]});y.init&&a.push(C.assignmentExpression("=",y.id,y.init))}s=!0;continue}if(C.isIfStatement(p)){var x=p.consequent?r([p.consequent]):t.buildUndefinedNode(),E=p.alternate?r([p.alternate]):t.buildUndefinedNode();if(!x||!E)return i=!0;a.push(C.conditionalExpression(p.test,x,E))}else{if(!C.isBlockStatement(p)){if(C.isEmptyStatement(p)){s=!0;continue}return i=!0}a.push(r(p.body))}}s=!1}return(s||0===a.length)&&a.push(t.buildUndefinedNode()),1===a.length?a[0]:C.sequenceExpression(a)}if(e&&e.length){var n=[],i=!1,s=r(e);if(!i){for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:e.key,r=void 0;return"method"===e.kind?a.increment()+"":(r=C.isIdentifier(t)?t.name:C.isStringLiteral(t)?(0,y.default)(t.value):(0,y.default)(C.removePropertiesDeep(C.cloneDeep(t))),e.computed&&(r="["+r+"]"),e.static&&(r="static:"+r),r)}function o(e){return e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),C.isValidIdentifier(e)||(e="_"+e),e||"_"}function u(e){return e=o(e),"eval"!==e&&"arguments"!==e||(e="_"+e),e}function l(e,t){if(C.isStatement(e))return e;var r=!1,n=void 0;if(C.isClass(e))r=!0,n="ClassDeclaration";else if(C.isFunction(e))r=!0,n="FunctionDeclaration";else if(C.isAssignmentExpression(e))return C.expressionStatement(e);if(r&&!e.id&&(n=!1),!n){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=n,e}function c(e){if(C.isExpressionStatement(e)&&(e=e.expression),C.isExpression(e))return e;if(C.isClass(e)?e.type="ClassExpression":C.isFunction(e)&&(e.type="FunctionExpression"),!C.isExpression(e))throw new Error("cannot turn "+e.type+" to an expression");return e}function p(e,t){return C.isBlockStatement(e)?e:(C.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(C.isStatement(e)||(e=C.isFunction(t)?C.returnStatement(e):C.expressionStatement(e)),e=[e]),C.blockStatement(e))}function h(e){if(void 0===e)return C.identifier("undefined");if(!0===e||!1===e)return C.booleanLiteral(e);if(null===e)return C.nullLiteral();if("string"==typeof e)return C.stringLiteral(e);if("number"==typeof e)return C.numericLiteral(e);if((0,A.default)(e)){var t=e.source,r=e.toString().match(/\/([a-z]+|)$/)[1];return C.regExpLiteral(t,r)}if(Array.isArray(e))return C.arrayExpression(e.map(C.valueToNode));if((0,x.default)(e)){var n=[];for(var i in e){var s=void 0;s=C.isValidIdentifier(i)?C.identifier(i):C.stringLiteral(i),n.push(C.objectProperty(s,C.valueToNode(e[i])))}return C.objectExpression(n)}throw new Error("don't know how to turn this value into a node")}r.__esModule=!0;var f=e("babel-runtime/core-js/number/max-safe-integer"),d=n(f),m=e("babel-runtime/core-js/json/stringify"),y=n(m),g=e("babel-runtime/core-js/get-iterator"),b=n(g);r.toComputedKey=i,r.toSequenceExpression=s,r.toKeyAlias=a,r.toIdentifier=o,r.toBindingIdentifierName=u,r.toStatement=l,r.toExpression=c,r.toBlock=p,r.valueToNode=h;var v=e("lodash/isPlainObject"),x=n(v),E=e("lodash/isRegExp"),A=n(E),D=e("./index"),C=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(D);a.uid=0,a.increment=function(){return a.uid>=d.default?a.uid=0:a.uid++}},{"./index":169,"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/json/stringify":114,"babel-runtime/core-js/number/max-safe-integer":116,"lodash/isPlainObject":507,"lodash/isRegExp":508}],160:[function(e,t,r){"use strict";var n=e("../index"),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),s=e("../constants"),a=e("./index"),o=function(e){return e&&e.__esModule?e:{default:e}}(a);(0,o.default)("ArrayExpression",{fields:{elements:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeOrValueType)("null","Expression","SpreadElement"))),default:[]}},visitor:["elements"],aliases:["Expression"]}),(0,o.default)("AssignmentExpression",{fields:{operator:{validate:(0,a.assertValueType)("string")},left:{validate:(0,a.assertNodeType)("LVal")},right:{validate:(0,a.assertNodeType)("Expression")}},builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),(0,o.default)("BinaryExpression",{builder:["operator","left","right"],fields:{operator:{validate:a.assertOneOf.apply(void 0,s.BINARY_OPERATORS)},left:{validate:(0,a.assertNodeType)("Expression")},right:{validate:(0,a.assertNodeType)("Expression")}},visitor:["left","right"],aliases:["Binary","Expression"]}),(0,o.default)("Directive",{visitor:["value"],fields:{value:{validate:(0,a.assertNodeType)("DirectiveLiteral")}}}),(0,o.default)("DirectiveLiteral",{builder:["value"],fields:{value:{validate:(0,a.assertValueType)("string")}}}),(0,o.default)("BlockStatement",{builder:["body","directives"],visitor:["directives","body"],fields:{directives:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Directive"))),default:[]},body:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Statement")))}},aliases:["Scopable","BlockParent","Block","Statement"]}),(0,o.default)("BreakStatement",{visitor:["label"],fields:{label:{validate:(0,a.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),(0,o.default)("CallExpression",{visitor:["callee","arguments"],fields:{callee:{validate:(0,a.assertNodeType)("Expression")},arguments:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Expression","SpreadElement")))}},aliases:["Expression"]}),(0,o.default)("CatchClause",{visitor:["param","body"],fields:{param:{validate:(0,a.assertNodeType)("Identifier")},body:{validate:(0,a.assertNodeType)("BlockStatement")}},aliases:["Scopable"]}),(0,o.default)("ConditionalExpression",{visitor:["test","consequent","alternate"],fields:{test:{validate:(0,a.assertNodeType)("Expression")},consequent:{validate:(0,a.assertNodeType)("Expression")},alternate:{validate:(0,a.assertNodeType)("Expression")}},aliases:["Expression","Conditional"]}),(0,o.default)("ContinueStatement",{visitor:["label"],fields:{label:{validate:(0,a.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),(0,o.default)("DebuggerStatement",{aliases:["Statement"]}),(0,o.default)("DoWhileStatement",{visitor:["test","body"],fields:{test:{validate:(0,a.assertNodeType)("Expression")},body:{validate:(0,a.assertNodeType)("Statement")}},aliases:["Statement","BlockParent","Loop","While","Scopable"]}),(0,o.default)("EmptyStatement",{aliases:["Statement"]}),(0,o.default)("ExpressionStatement",{visitor:["expression"],fields:{expression:{validate:(0,a.assertNodeType)("Expression")}},aliases:["Statement","ExpressionWrapper"]}),(0,o.default)("File",{builder:["program","comments","tokens"],visitor:["program"],fields:{program:{validate:(0,a.assertNodeType)("Program")}}}),(0,o.default)("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,a.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,a.assertNodeType)("Expression")},body:{validate:(0,a.assertNodeType)("Statement")}}}),(0,o.default)("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"],fields:{init:{validate:(0,a.assertNodeType)("VariableDeclaration","Expression"),optional:!0},test:{validate:(0,a.assertNodeType)("Expression"),optional:!0},update:{validate:(0,a.assertNodeType)("Expression"),optional:!0},body:{validate:(0,a.assertNodeType)("Statement")}}}),(0,o.default)("FunctionDeclaration",{builder:["id","params","body","generator","async"],visitor:["id","params","body","returnType","typeParameters"],fields:{id:{validate:(0,a.assertNodeType)("Identifier")},params:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("LVal")))},body:{validate:(0,a.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,a.assertValueType)("boolean")},async:{default:!1,validate:(0,a.assertValueType)("boolean")}},aliases:["Scopable","Function","BlockParent","FunctionParent","Statement","Pureish","Declaration"]}),(0,o.default)("FunctionExpression",{inherits:"FunctionDeclaration",aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{id:{validate:(0,a.assertNodeType)("Identifier"),optional:!0},params:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("LVal")))},body:{validate:(0,a.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,a.assertValueType)("boolean")},async:{default:!1,validate:(0,a.assertValueType)("boolean")}}}),(0,o.default)("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression","LVal"],fields:{name:{validate:function(e,t,r){i.isValidIdentifier(r)}},decorators:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Decorator")))}}}),(0,o.default)("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement","Conditional"],fields:{test:{validate:(0,a.assertNodeType)("Expression")},consequent:{validate:(0,a.assertNodeType)("Statement")},alternate:{optional:!0,validate:(0,a.assertNodeType)("Statement")}}}),(0,o.default)("LabeledStatement",{visitor:["label","body"],aliases:["Statement"],fields:{label:{validate:(0,a.assertNodeType)("Identifier")},body:{validate:(0,a.assertNodeType)("Statement")}}}),(0,o.default)("StringLiteral",{builder:["value"],fields:{value:{validate:(0,a.assertValueType)("string")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,o.default)("NumericLiteral",{builder:["value"],deprecatedAlias:"NumberLiteral",fields:{value:{validate:(0,a.assertValueType)("number")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,o.default)("NullLiteral",{aliases:["Expression","Pureish","Literal","Immutable"]}),(0,o.default)("BooleanLiteral",{builder:["value"],fields:{value:{validate:(0,a.assertValueType)("boolean")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,o.default)("RegExpLiteral",{builder:["pattern","flags"],deprecatedAlias:"RegexLiteral",aliases:["Expression","Literal"],fields:{pattern:{validate:(0,a.assertValueType)("string")},flags:{validate:(0,a.assertValueType)("string"),default:""}}}),(0,o.default)("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"],fields:{operator:{validate:a.assertOneOf.apply(void 0,s.LOGICAL_OPERATORS)},left:{validate:(0,a.assertNodeType)("Expression")},right:{validate:(0,a.assertNodeType)("Expression")}}}),(0,o.default)("MemberExpression",{builder:["object","property","computed"],visitor:["object","property"],aliases:["Expression","LVal"],fields:{object:{validate:(0,a.assertNodeType)("Expression")},property:{validate:function(e,t,r){var n=e.computed?"Expression":"Identifier";(0,a.assertNodeType)(n)(e,t,r)}},computed:{default:!1}}}),(0,o.default)("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"],fields:{callee:{validate:(0,a.assertNodeType)("Expression")},arguments:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Expression","SpreadElement")))}}}),(0,o.default)("Program",{visitor:["directives","body"],builder:["body","directives"],fields:{directives:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Directive"))),default:[]},body:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Statement")))}},aliases:["Scopable","BlockParent","Block","FunctionParent"]}),(0,o.default)("ObjectExpression",{visitor:["properties"],aliases:["Expression"],fields:{properties:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("ObjectMethod","ObjectProperty","SpreadProperty")))}}}),(0,o.default)("ObjectMethod",{builder:["kind","key","params","body","computed"],fields:{kind:{validate:(0,a.chain)((0,a.assertValueType)("string"),(0,a.assertOneOf)("method","get","set")),default:"method"},computed:{validate:(0,a.assertValueType)("boolean"),default:!1},key:{validate:function(e,t,r){var n=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];a.assertNodeType.apply(void 0,n)(e,t,r)}},decorators:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Decorator")))},body:{validate:(0,a.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,a.assertValueType)("boolean")},async:{default:!1,validate:(0,a.assertValueType)("boolean")}},visitor:["key","params","body","decorators","returnType","typeParameters"],aliases:["UserWhitespacable","Function","Scopable","BlockParent","FunctionParent","Method","ObjectMember"]}),(0,o.default)("ObjectProperty",{builder:["key","value","computed","shorthand","decorators"],fields:{computed:{validate:(0,a.assertValueType)("boolean"),default:!1},key:{validate:function(e,t,r){var n=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];a.assertNodeType.apply(void 0,n)(e,t,r)}},value:{validate:(0,a.assertNodeType)("Expression")},shorthand:{validate:(0,a.assertValueType)("boolean"),default:!1},decorators:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Decorator"))),optional:!0}},visitor:["key","value","decorators"],aliases:["UserWhitespacable","Property","ObjectMember"]}),(0,o.default)("RestElement",{visitor:["argument","typeAnnotation"],aliases:["LVal"],fields:{argument:{validate:(0,a.assertNodeType)("LVal")},decorators:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Decorator")))}}}),(0,o.default)("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:(0,a.assertNodeType)("Expression"),optional:!0}}}),(0,o.default)("SequenceExpression",{visitor:["expressions"],fields:{expressions:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Expression")))}},aliases:["Expression"]}),(0,o.default)("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:(0,a.assertNodeType)("Expression"),optional:!0},consequent:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("Statement")))}}}),(0,o.default)("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:(0,a.assertNodeType)("Expression")},cases:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("SwitchCase")))}}}),(0,o.default)("ThisExpression",{aliases:["Expression"]}),(0,o.default)("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:(0,a.assertNodeType)("Expression")}}}),(0,o.default)("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{body:{validate:(0,a.assertNodeType)("BlockStatement")},handler:{optional:!0, +handler:(0,a.assertNodeType)("BlockStatement")},finalizer:{optional:!0,validate:(0,a.assertNodeType)("BlockStatement")}}}),(0,o.default)("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!0},argument:{validate:(0,a.assertNodeType)("Expression")},operator:{validate:a.assertOneOf.apply(void 0,s.UNARY_OPERATORS)}},visitor:["argument"],aliases:["UnaryLike","Expression"]}),(0,o.default)("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!1},argument:{validate:(0,a.assertNodeType)("Expression")},operator:{validate:a.assertOneOf.apply(void 0,s.UPDATE_OPERATORS)}},visitor:["argument"],aliases:["Expression"]}),(0,o.default)("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{kind:{validate:(0,a.chain)((0,a.assertValueType)("string"),(0,a.assertOneOf)("var","let","const"))},declarations:{validate:(0,a.chain)((0,a.assertValueType)("array"),(0,a.assertEach)((0,a.assertNodeType)("VariableDeclarator")))}}}),(0,o.default)("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:(0,a.assertNodeType)("LVal")},init:{optional:!0,validate:(0,a.assertNodeType)("Expression")}}}),(0,o.default)("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:(0,a.assertNodeType)("Expression")},body:{validate:(0,a.assertNodeType)("BlockStatement","Statement")}}}),(0,o.default)("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{object:(0,a.assertNodeType)("Expression")},body:{validate:(0,a.assertNodeType)("BlockStatement","Statement")}}})},{"../constants":158,"../index":169,"./index":164}],161:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern","LVal"],fields:{left:{validate:(0,n.assertNodeType)("Identifier")},right:{validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern","LVal"],fields:{elements:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Expression")))},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType","typeParameters"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{params:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("LVal")))},body:{validate:(0,n.assertNodeType)("BlockStatement","Expression")},async:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("ClassBody",{visitor:["body"],fields:{body:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ClassMethod","ClassProperty")))}}}),(0,i.default)("ClassDeclaration",{builder:["id","superClass","body","decorators"],visitor:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration","Pureish"],fields:{id:{validate:(0,n.assertNodeType)("Identifier")},body:{validate:(0,n.assertNodeType)("ClassBody")},superClass:{optional:!0,validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ClassExpression",{inherits:"ClassDeclaration",aliases:["Scopable","Class","Expression","Pureish"],fields:{id:{optional:!0,validate:(0,n.assertNodeType)("Identifier")},body:{validate:(0,n.assertNodeType)("ClassBody")},superClass:{optional:!0,validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ExportAllDeclaration",{visitor:["source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{source:{validate:(0,n.assertNodeType)("StringLiteral")}}}),(0,i.default)("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:(0,n.assertNodeType)("FunctionDeclaration","ClassDeclaration","Expression")}}}),(0,i.default)("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:(0,n.assertNodeType)("Declaration"),optional:!0},specifiers:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ExportSpecifier")))},source:{validate:(0,n.assertNodeType)("StringLiteral"),optional:!0}}}),(0,i.default)("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")},exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,n.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,n.assertNodeType)("Expression")},body:{validate:(0,n.assertNodeType)("Statement")}}}),(0,i.default)("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"],fields:{specifiers:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier")))},source:{validate:(0,n.assertNodeType)("StringLiteral")}}}),(0,i.default)("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")},imported:{validate:(0,n.assertNodeType)("Identifier")},importKind:{validate:(0,n.assertOneOf)(null,"type","typeof")}}}),(0,i.default)("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:(0,n.assertValueType)("string")},property:{validate:(0,n.assertValueType)("string")}}}),(0,i.default)("ClassMethod",{aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static"],visitor:["key","params","body","decorators","returnType","typeParameters"],fields:{kind:{validate:(0,n.chain)((0,n.assertValueType)("string"),(0,n.assertOneOf)("get","set","method","constructor")),default:"method"},computed:{default:!1,validate:(0,n.assertValueType)("boolean")},static:{default:!1,validate:(0,n.assertValueType)("boolean")},key:{validate:function(e,t,r){var i=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];n.assertNodeType.apply(void 0,i)(e,t,r)}},params:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("LVal")))},body:{validate:(0,n.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,n.assertValueType)("boolean")},async:{default:!1,validate:(0,n.assertValueType)("boolean")}}}),(0,i.default)("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern","LVal"],fields:{properties:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("RestProperty","Property")))},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("Super",{aliases:["Expression"]}),(0,i.default)("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"],fields:{tag:{validate:(0,n.assertNodeType)("Expression")},quasi:{validate:(0,n.assertNodeType)("TemplateLiteral")}}}),(0,i.default)("TemplateElement",{builder:["value","tail"],fields:{value:{},tail:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{quasis:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("TemplateElement")))},expressions:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Expression")))}}}),(0,i.default)("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:(0,n.assertValueType)("boolean"),default:!1},argument:{optional:!0,validate:(0,n.assertNodeType)("Expression")}}})},{"./index":164}],162:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("ForAwaitStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,n.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,n.assertNodeType)("Expression")},body:{validate:(0,n.assertNodeType)("Statement")}}}),(0,i.default)("BindExpression",{visitor:["object","callee"],aliases:["Expression"],fields:{}}),(0,i.default)("Import",{aliases:["Expression"]}),(0,i.default)("Decorator",{visitor:["expression"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("DoExpression",{visitor:["body"],aliases:["Expression"],fields:{body:{validate:(0,n.assertNodeType)("BlockStatement")}}}),(0,i.default)("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("RestProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("LVal")}}}),(0,i.default)("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}})},{"./index":164}],163:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"],fields:{}}),(0,i.default)("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("BooleanLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("NullLiteralTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],builder:["key","value","typeAnnotation","decorators","computed"],aliases:["Property"],fields:{computed:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareInterface",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareModuleExports",{visitor:["typeAnnotation"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("ExistentialTypeParam",{aliases:["Flow"]}),(0,i.default)("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"],fields:{}}),(0,i.default)("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),(0,i.default)("EmptyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),(0,i.default)("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("NumericLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("StringLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ThisTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow","ExpressionWrapper","Expression"],fields:{}}),(0,i.default)("TypeParameter",{visitor:["bound"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"],fields:{}}),(0,i.default)("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"],fields:{}}),(0,i.default)("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"],fields:{}}),(0,i.default)("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}})},{"./index":164}],164:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return Array.isArray(e)?"array":null===e?"null":void 0===e?"undefined":void 0===e?"undefined":(0,g.default)(e)}function s(e){function t(t,r,n){if(Array.isArray(n))for(var i=0;i=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var l=u;if(v.is(l,n)){i=!0;break}}if(!i)throw new TypeError("Property "+t+" of "+e.type+" expected node to be of a type "+(0,m.default)(r)+" but instead got "+(0,m.default)(n&&n.type))}for(var t=arguments.length,r=Array(t),n=0;n=a.length)break;l=a[u++]}else{if(u=a.next(),u.done)break;l=u.value}var c=l;if(i(n)===c||v.is(c,n)){s=!0;break}}if(!s)throw new TypeError("Property "+t+" of "+e.type+" expected node to be of a type "+(0,m.default)(r)+" but instead got "+(0,m.default)(n&&n.type))}for(var t=arguments.length,r=Array(t),n=0;n=e.length)break;i=e[n++]}else{if(n=e.next(),n.done)break;i=n.value}i.apply(void 0,arguments)}}for(var t=arguments.length,r=Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=t.inherits&&S[t.inherits]||{};t.fields=t.fields||r.fields||{},t.visitor=t.visitor||r.visitor||[],t.aliases=t.aliases||r.aliases||[],t.builder=t.builder||r.builder||t.visitor||[],t.deprecatedAlias&&(C[t.deprecatedAlias]=e);for(var n=t.visitor.concat(t.builder),s=Array.isArray(n),a=0,n=s?n:(0,f.default)(n);;){var o;if(s){if(a>=n.length)break;o=n[a++]}else{if(a=n.next(),a.done)break;o=a.value}var u=o;t.fields[u]=t.fields[u]||{}}for(var c in t.fields){var p=t.fields[c];-1===t.builder.indexOf(c)&&(p.optional=!0),void 0===p.default?p.default=null:p.validate||(p.validate=l(i(p.default)))}x[e]=t.visitor,D[e]=t.builder,A[e]=t.fields,E[e]=t.aliases,S[e]=t}r.__esModule=!0,r.DEPRECATED_KEYS=r.BUILDER_KEYS=r.NODE_FIELDS=r.ALIAS_KEYS=r.VISITOR_KEYS=void 0;var h=e("babel-runtime/core-js/get-iterator"),f=n(h),d=e("babel-runtime/core-js/json/stringify"),m=n(d),y=e("babel-runtime/helpers/typeof"),g=n(y);r.assertEach=s,r.assertOneOf=a,r.assertNodeType=o,r.assertNodeOrValueType=u,r.assertValueType=l,r.chain=c,r.default=p;var b=e("../index"),v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(b),x=r.VISITOR_KEYS={},E=r.ALIAS_KEYS={},A=r.NODE_FIELDS={},D=r.BUILDER_KEYS={},C=r.DEPRECATED_KEYS={},S={}},{"../index":169,"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/json/stringify":114,"babel-runtime/helpers/typeof":131}],165:[function(e,t,r){"use strict";e("./index"),e("./core"),e("./es2015"),e("./flow"),e("./jsx"),e("./misc"),e("./experimental")},{"./core":160,"./es2015":161,"./experimental":162,"./flow":163,"./index":164,"./jsx":166,"./misc":167}],166:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXNamespacedName")},value:{optional:!0,validate:(0,n.assertNodeType)("JSXElement","StringLiteral","JSXExpressionContainer")}}}),(0,i.default)("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXMemberExpression")}}}),(0,i.default)("JSXElement",{builder:["openingElement","closingElement","children","selfClosing"],visitor:["openingElement","children","closingElement"],aliases:["JSX","Immutable","Expression"],fields:{openingElement:{validate:(0,n.assertNodeType)("JSXOpeningElement")},closingElement:{optional:!0,validate:(0,n.assertNodeType)("JSXClosingElement")},children:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement")))}}}),(0,i.default)("JSXEmptyExpression",{aliases:["JSX","Expression"]}),(0,i.default)("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXSpreadChild",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXIdentifier",{builder:["name"],aliases:["JSX","Expression"],fields:{name:{validate:(0,n.assertValueType)("string")}}}),(0,i.default)("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"],fields:{object:{validate:(0,n.assertNodeType)("JSXMemberExpression","JSXIdentifier")},property:{validate:(0,n.assertNodeType)("JSXIdentifier")}}}),(0,i.default)("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"],fields:{namespace:{validate:(0,n.assertNodeType)("JSXIdentifier")},name:{validate:(0,n.assertNodeType)("JSXIdentifier")}}}),(0,i.default)("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","attributes"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXMemberExpression")},selfClosing:{default:!1,validate:(0,n.assertValueType)("boolean")},attributes:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("JSXAttribute","JSXSpreadAttribute")))}}}),(0,i.default)("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXText",{aliases:["JSX","Immutable"],builder:["value"],fields:{value:{validate:(0,n.assertValueType)("string")}}})},{"./index":164}],167:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("Noop",{visitor:[]}),(0,i.default)("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}})},{"./index":164}],168:[function(e,t,r){"use strict";function n(e){var t=i(e);return 1===t.length?t[0]:o.unionTypeAnnotation(t)}function i(e){for(var t={},r={},n=[],s=[],a=0;a=0)){if(o.isAnyTypeAnnotation(u))return[u];if(o.isFlowBaseAnnotation(u))r[u.type]=u;else if(o.isUnionTypeAnnotation(u))n.indexOf(u.types)<0&&(e=e.concat(u.types),n.push(u.types));else if(o.isGenericTypeAnnotation(u)){var l=u.id.name;if(t[l]){var c=t[l];c.typeParameters?u.typeParameters&&(c.typeParameters.params=i(c.typeParameters.params.concat(u.typeParameters.params))):c=u.typeParameters}else t[l]=u}else s.push(u)}}for(var p in r)s.push(r[p]);for(var h in t)s.push(t[h]);return s}function s(e){if("string"===e)return o.stringTypeAnnotation();if("number"===e)return o.numberTypeAnnotation();if("undefined"===e)return o.voidTypeAnnotation();if("boolean"===e)return o.booleanTypeAnnotation();if("function"===e)return o.genericTypeAnnotation(o.identifier("Function"));if("object"===e)return o.genericTypeAnnotation(o.identifier("Object"));if("symbol"===e)return o.genericTypeAnnotation(o.identifier("Symbol"));throw new Error("Invalid typeof value")}r.__esModule=!0,r.createUnionTypeAnnotation=n,r.removeTypeDuplicates=i,r.createTypeAnnotationBasedOnTypeof=s;var a=e("./index"),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(a)},{"./index":169}],169:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=H["is"+e];t||(t=H["is"+e]=function(t,r){return H.is(e,t,r)}),H["assert"+e]=function(r,n){if(n=n||{},!t(r,n))throw new Error("Expected type "+(0,N.default)(e)+" with option "+(0,N.default)(n))}}function s(e,t,r){return!!t&&(!!a(t.type,e)&&(void 0===r||H.shallowEqual(t,r)))}function a(e,t){if(e===t)return!0;if(H.ALIAS_KEYS[t])return!1;var r=H.FLIPPED_ALIAS_KEYS[t];if(r){if(r[0]===e)return!0;for(var n=r,i=Array.isArray(n),s=0,n=i?n:(0,P.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}if(e===a)return!0}}return!1}function o(e,t,r){if(e){var n=H.NODE_FIELDS[e.type];if(n){var i=n[t];i&&i.validate&&(i.optional&&null==r||i.validate(e,t,r))}}}function u(e,t){for(var r=(0,O.default)(t),n=r,i=Array.isArray(n),s=0,n=i?n:(0,P.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;if(e[o]!==t[o])return!1}return!0}function l(e,t,r){return e.object=H.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!r,e}function c(e,t){return e.object=H.memberExpression(t,e.object),e}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body";return e[t]=H.toBlock(e[t],e)}function h(e){if(!e)return e;var t={};for(var r in e)"_"!==r[0]&&(t[r]=e[r]);return t}function f(e){var t=h(e);return delete t.loc,t}function d(e){if(!e)return e;var t={};for(var r in e)if("_"!==r[0]){var n=e[r];n&&(n.type?n=H.cloneDeep(n):Array.isArray(n)&&(n=n.map(H.cloneDeep))),t[r]=n}return t}function m(e,t){var r=e.split(".");return function(e){if(!H.isMemberExpression(e))return!1;for(var n=[e],i=0;n.length;){var s=n.shift();if(t&&i===r.length)return!0;if(H.isIdentifier(s)){if(r[i]!==s.name)return!1}else{if(!H.isStringLiteral(s)){if(H.isMemberExpression(s)){if(s.computed&&!H.isStringLiteral(s.property))return!1;n.push(s.object),n.push(s.property);continue}return!1}if(r[i]!==s.value)return!1}if(++i>r.length)return!1}return!0}}function y(e){for(var t=H.COMMENT_KEYS,r=Array.isArray(t),n=0,t=r?t:(0,P.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}delete e[i]}return e}function g(e,t){return b(e,t),v(e,t),x(e,t),e}function b(e,t){E("trailingComments",e,t)}function v(e,t){E("leadingComments",e,t)}function x(e,t){E("innerComments",e,t)}function E(e,t,r){t&&r&&(t[e]=(0,W.default)([].concat(t[e],r[e]).filter(Boolean)))}function A(e,t){if(!e||!t)return e;for(var r=H.INHERIT_KEYS.optional,n=Array.isArray(r),i=0,r=n?r:(0,P.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;null==e[a]&&(e[a]=t[a])}for(var o in t)"_"===o[0]&&(e[o]=t[o]);for(var u=H.INHERIT_KEYS.force,l=Array.isArray(u),c=0,u=l?u:(0,P.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if(c=u.next(),c.done)break;p=c.value}var h=p;e[h]=t[h]}return H.inheritsComments(e,t),e}function D(e){if(!C(e))throw new TypeError("Not a valid node "+(e&&e.type))}function C(e){return!(!e||!K.VISITOR_KEYS[e.type])}function S(e,t,r){if(e){var n=H.VISITOR_KEYS[e.type];if(n){r=r||{},t(e,r);for(var i=n,s=Array.isArray(i),a=0,i=s?i:(0,P.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o,l=e[u];if(Array.isArray(l))for(var c=l,p=Array.isArray(c),h=0,c=p?c:(0,P.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if(h=c.next(),h.done)break;f=h.value}var d=f;S(d,t,r)}else S(l,t,r)}}}}function _(e,t){t=t||{};for(var r=t.preserveComments?Z:ee,n=r,i=Array.isArray(n),s=0,n=i?n:(0,P.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;null!=e[o]&&(e[o]=void 0)}for(var u in e)"_"===u[0]&&null!=e[u]&&(e[u]=void 0);for(var l=(0,F.default)(e),c=l,p=Array.isArray(c),h=0,c=p?c:(0,P.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if(h=c.next(),h.done)break;f=h.value}e[f]=null}}function w(e,t){return S(e,_,t),e}r.__esModule=!0,r.createTypeAnnotationBasedOnTypeof=r.removeTypeDuplicates=r.createUnionTypeAnnotation=r.valueToNode=r.toBlock=r.toExpression=r.toStatement=r.toBindingIdentifierName=r.toIdentifier=r.toKeyAlias=r.toSequenceExpression=r.toComputedKey=r.isNodesEquivalent=r.isImmutable=r.isScope=r.isSpecifierDefault=r.isVar=r.isBlockScoped=r.isLet=r.isValidIdentifier=r.isReferenced=r.isBinding=r.getOuterBindingIdentifiers=r.getBindingIdentifiers=r.TYPES=r.react=r.DEPRECATED_KEYS=r.BUILDER_KEYS=r.NODE_FIELDS=r.ALIAS_KEYS=r.VISITOR_KEYS=r.NOT_LOCAL_BINDING=r.BLOCK_SCOPED_SYMBOL=r.INHERIT_KEYS=r.UNARY_OPERATORS=r.STRING_UNARY_OPERATORS=r.NUMBER_UNARY_OPERATORS=r.BOOLEAN_UNARY_OPERATORS=r.BINARY_OPERATORS=r.NUMBER_BINARY_OPERATORS=r.BOOLEAN_BINARY_OPERATORS=r.COMPARISON_BINARY_OPERATORS=r.EQUALITY_BINARY_OPERATORS=r.BOOLEAN_NUMBER_BINARY_OPERATORS=r.UPDATE_OPERATORS=r.LOGICAL_OPERATORS=r.COMMENT_KEYS=r.FOR_INIT_KEYS=r.FLATTENABLE_KEYS=r.STATEMENT_OR_BLOCK_KEYS=void 0;var k=e("babel-runtime/core-js/object/get-own-property-symbols"),F=n(k),T=e("babel-runtime/core-js/get-iterator"),P=n(T),B=e("babel-runtime/core-js/object/keys"),O=n(B),j=e("babel-runtime/core-js/json/stringify"),N=n(j),I=e("./constants");Object.defineProperty(r,"STATEMENT_OR_BLOCK_KEYS",{enumerable:!0,get:function(){return I.STATEMENT_OR_BLOCK_KEYS}}),Object.defineProperty(r,"FLATTENABLE_KEYS",{enumerable:!0,get:function(){return I.FLATTENABLE_KEYS}}),Object.defineProperty(r,"FOR_INIT_KEYS",{enumerable:!0,get:function(){return I.FOR_INIT_KEYS}}),Object.defineProperty(r,"COMMENT_KEYS",{enumerable:!0,get:function(){return I.COMMENT_KEYS}}),Object.defineProperty(r,"LOGICAL_OPERATORS",{enumerable:!0,get:function(){return I.LOGICAL_OPERATORS}}),Object.defineProperty(r,"UPDATE_OPERATORS",{enumerable:!0,get:function(){return I.UPDATE_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_NUMBER_BINARY_OPERATORS",{enumerable:!0,get:function(){return I.BOOLEAN_NUMBER_BINARY_OPERATORS}}),Object.defineProperty(r,"EQUALITY_BINARY_OPERATORS",{enumerable:!0,get:function(){return I.EQUALITY_BINARY_OPERATORS}}),Object.defineProperty(r,"COMPARISON_BINARY_OPERATORS",{enumerable:!0,get:function(){return I.COMPARISON_BINARY_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_BINARY_OPERATORS",{enumerable:!0,get:function(){return I.BOOLEAN_BINARY_OPERATORS}}),Object.defineProperty(r,"NUMBER_BINARY_OPERATORS",{enumerable:!0,get:function(){return I.NUMBER_BINARY_OPERATORS}}),Object.defineProperty(r,"BINARY_OPERATORS",{enumerable:!0,get:function(){return I.BINARY_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_UNARY_OPERATORS",{enumerable:!0,get:function(){return I.BOOLEAN_UNARY_OPERATORS}}),Object.defineProperty(r,"NUMBER_UNARY_OPERATORS",{enumerable:!0,get:function(){return I.NUMBER_UNARY_OPERATORS}}),Object.defineProperty(r,"STRING_UNARY_OPERATORS",{enumerable:!0,get:function(){return I.STRING_UNARY_OPERATORS}}),Object.defineProperty(r,"UNARY_OPERATORS",{enumerable:!0,get:function(){return I.UNARY_OPERATORS}}),Object.defineProperty(r,"INHERIT_KEYS",{enumerable:!0,get:function(){return I.INHERIT_KEYS}}),Object.defineProperty(r,"BLOCK_SCOPED_SYMBOL",{enumerable:!0,get:function(){return I.BLOCK_SCOPED_SYMBOL}}),Object.defineProperty(r,"NOT_LOCAL_BINDING",{enumerable:!0,get:function(){return I.NOT_LOCAL_BINDING}}),r.is=s,r.isType=a,r.validate=o,r.shallowEqual=u,r.appendToMemberExpression=l,r.prependToMemberExpression=c,r.ensureBlock=p,r.clone=h,r.cloneWithoutLoc=f,r.cloneDeep=d,r.buildMatchMemberExpression=m,r.removeComments=y,r.inheritsComments=g,r.inheritTrailingComments=b,r.inheritLeadingComments=v,r.inheritInnerComments=x,r.inherits=A,r.assertNode=D,r.isNode=C,r.traverseFast=S,r.removeProperties=_,r.removePropertiesDeep=w;var L=e("./retrievers");Object.defineProperty(r,"getBindingIdentifiers",{enumerable:!0,get:function(){return L.getBindingIdentifiers}}),Object.defineProperty(r,"getOuterBindingIdentifiers",{enumerable:!0,get:function(){return L.getOuterBindingIdentifiers}});var M=e("./validators");Object.defineProperty(r,"isBinding",{enumerable:!0,get:function(){return M.isBinding}}),Object.defineProperty(r,"isReferenced",{enumerable:!0,get:function(){return M.isReferenced}}), +Object.defineProperty(r,"isValidIdentifier",{enumerable:!0,get:function(){return M.isValidIdentifier}}),Object.defineProperty(r,"isLet",{enumerable:!0,get:function(){return M.isLet}}),Object.defineProperty(r,"isBlockScoped",{enumerable:!0,get:function(){return M.isBlockScoped}}),Object.defineProperty(r,"isVar",{enumerable:!0,get:function(){return M.isVar}}),Object.defineProperty(r,"isSpecifierDefault",{enumerable:!0,get:function(){return M.isSpecifierDefault}}),Object.defineProperty(r,"isScope",{enumerable:!0,get:function(){return M.isScope}}),Object.defineProperty(r,"isImmutable",{enumerable:!0,get:function(){return M.isImmutable}}),Object.defineProperty(r,"isNodesEquivalent",{enumerable:!0,get:function(){return M.isNodesEquivalent}});var R=e("./converters");Object.defineProperty(r,"toComputedKey",{enumerable:!0,get:function(){return R.toComputedKey}}),Object.defineProperty(r,"toSequenceExpression",{enumerable:!0,get:function(){return R.toSequenceExpression}}),Object.defineProperty(r,"toKeyAlias",{enumerable:!0,get:function(){return R.toKeyAlias}}),Object.defineProperty(r,"toIdentifier",{enumerable:!0,get:function(){return R.toIdentifier}}),Object.defineProperty(r,"toBindingIdentifierName",{enumerable:!0,get:function(){return R.toBindingIdentifierName}}),Object.defineProperty(r,"toStatement",{enumerable:!0,get:function(){return R.toStatement}}),Object.defineProperty(r,"toExpression",{enumerable:!0,get:function(){return R.toExpression}}),Object.defineProperty(r,"toBlock",{enumerable:!0,get:function(){return R.toBlock}}),Object.defineProperty(r,"valueToNode",{enumerable:!0,get:function(){return R.valueToNode}});var U=e("./flow");Object.defineProperty(r,"createUnionTypeAnnotation",{enumerable:!0,get:function(){return U.createUnionTypeAnnotation}}),Object.defineProperty(r,"removeTypeDuplicates",{enumerable:!0,get:function(){return U.removeTypeDuplicates}}),Object.defineProperty(r,"createTypeAnnotationBasedOnTypeof",{enumerable:!0,get:function(){return U.createTypeAnnotationBasedOnTypeof}});var V=e("to-fast-properties"),q=n(V),G=e("lodash/clone"),X=n(G),J=e("lodash/uniq"),W=n(J);e("./definitions/init");var K=e("./definitions"),z=e("./react"),Y=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(z),H=r;r.VISITOR_KEYS=K.VISITOR_KEYS,r.ALIAS_KEYS=K.ALIAS_KEYS,r.NODE_FIELDS=K.NODE_FIELDS,r.BUILDER_KEYS=K.BUILDER_KEYS,r.DEPRECATED_KEYS=K.DEPRECATED_KEYS,r.react=Y;for(var $ in H.VISITOR_KEYS)i($);H.FLIPPED_ALIAS_KEYS={},(0,O.default)(H.ALIAS_KEYS).forEach(function(e){H.ALIAS_KEYS[e].forEach(function(t){(H.FLIPPED_ALIAS_KEYS[t]=H.FLIPPED_ALIAS_KEYS[t]||[]).push(e)})}),(0,O.default)(H.FLIPPED_ALIAS_KEYS).forEach(function(e){H[e.toUpperCase()+"_TYPES"]=H.FLIPPED_ALIAS_KEYS[e],i(e)});r.TYPES=(0,O.default)(H.VISITOR_KEYS).concat((0,O.default)(H.FLIPPED_ALIAS_KEYS)).concat((0,O.default)(H.DEPRECATED_KEYS));(0,O.default)(H.BUILDER_KEYS).forEach(function(e){function t(){if(arguments.length>r.length)throw new Error("t."+e+": Too many arguments passed. Received "+arguments.length+" but can receive no more than "+r.length);var t={};t.type=e;for(var n=0,i=r,s=Array.isArray(i),a=0,i=s?i:(0,P.default)(i);;){var u;if(s){if(a>=i.length)break;u=i[a++]}else{if(a=i.next(),a.done)break;u=a.value}var l=u,c=H.NODE_FIELDS[e][l],p=arguments[n++];void 0===p&&(p=(0,X.default)(c.default)),t[l]=p}for(var h in t)o(t,h,t[h]);return t}var r=H.BUILDER_KEYS[e];H[e]=t,H[e[0].toLowerCase()+e.slice(1)]=t});for(var Q in H.DEPRECATED_KEYS)!function(e){function t(t){return function(){return console.trace("The node type "+e+" has been renamed to "+r),t.apply(this,arguments)}}var r=H.DEPRECATED_KEYS[e];H[e]=H[e[0].toLowerCase()+e.slice(1)]=t(H[r]),H["is"+e]=t(H["is"+r]),H["assert"+e]=t(H["assert"+r])}(Q);(0,q.default)(H),(0,q.default)(H.VISITOR_KEYS);var Z=["tokens","start","end","loc","raw","rawValue"],ee=H.COMMENT_KEYS.concat(["comments"]).concat(Z)},{"./constants":158,"./converters":159,"./definitions":164,"./definitions/init":165,"./flow":168,"./react":170,"./retrievers":171,"./validators":172,"babel-runtime/core-js/get-iterator":113,"babel-runtime/core-js/json/stringify":114,"babel-runtime/core-js/object/get-own-property-symbols":119,"babel-runtime/core-js/object/keys":120,"lodash/clone":480,"lodash/uniq":529,"to-fast-properties":595}],170:[function(e,t,r){"use strict";function n(e){return!!e&&/^[a-z]|\-/.test(e)}function i(e,t){for(var r=e.value.split(/\r\n|\n|\r/),n=0,i=0;i=0)return!0}else if(s===e)return!0}return!1}function s(e,t){switch(t.type){case"BindExpression":return t.object===e||t.callee===e;case"MemberExpression":case"JSXMemberExpression":return!(t.property!==e||!t.computed)||t.object===e;case"MetaProperty":return!1;case"ObjectProperty":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var r=t.params,n=Array.isArray(r),i=0,r=n?r:(0,v.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}if(s===e)return!1}return t.id!==e;case"ExportSpecifier":return!t.source&&t.local===e;case"ExportNamespaceSpecifier":case"ExportDefaultSpecifier":return!1;case"JSXAttribute":return t.name!==e;case"ClassProperty":return t.key===e?t.computed:t.value===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"ClassMethod":case"ObjectMethod":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentExpression":case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1}return!0}function a(e){return"string"==typeof e&&!A.default.keyword.isReservedWordES6(e,!0)&&A.default.keyword.isIdentifierNameES6(e)}function o(e){return C.isVariableDeclaration(e)&&("var"!==e.kind||e[S.BLOCK_SCOPED_SYMBOL])}function u(e){return C.isFunctionDeclaration(e)||C.isClassDeclaration(e)||C.isLet(e)}function l(e){return C.isVariableDeclaration(e,{kind:"var"})&&!e[S.BLOCK_SCOPED_SYMBOL]}function c(e){return C.isImportDefaultSpecifier(e)||C.isIdentifier(e.imported||e.exported,{name:"default"})}function p(e,t){return(!C.isBlockStatement(e)||!C.isFunction(t,{body:e}))&&C.isScopable(e)}function h(e){return!!C.isType(e.type,"Immutable")||!!C.isIdentifier(e)&&"undefined"===e.name}function f(e,t){if("object"!==(void 0===e?"undefined":(0,g.default)(e))||"object"!==(void 0===e?"undefined":(0,g.default)(e))||null==e||null==t)return e===t;if(e.type!==t.type)return!1;for(var r=(0,m.default)(C.NODE_FIELDS[e.type]||e.type),n=r,i=Array.isArray(n),s=0,n=i?n:(0,v.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;if((0,g.default)(e[o])!==(0,g.default)(t[o]))return!1;if(Array.isArray(e[o])){if(!Array.isArray(t[o]))return!1;if(e[o].length!==t[o].length)return!1;for(var u=0;u=0}}function i(e,t){for(var r=65536,n=0;ne)return!1;if((r+=t[n+1])>=e)return!0}}function s(e){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&E.test(String.fromCharCode(e)):i(e,D)))}function a(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&A.test(String.fromCharCode(e)):i(e,D)||i(e,C))))}function o(e){var t={};for(var r in S)t[r]=e&&r in e?e[r]:S[r];return t}function u(e){return 10===e||13===e||8232===e||8233===e}function l(e,t){for(var r=1,n=0;;){L.lastIndex=n;var i=L.exec(e);if(!(i&&i.index>10),56320+(e-65536&1023))}function p(e,t,r,n){return e.type=t,e.end=r,e.loc.end=n,this.processComment(e),e}function h(e){return e[e.length-1]}function f(e){return e&&"Property"===e.type&&"init"===e.kind&&!1===e.method}function d(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?d(e.object)+"."+d(e.property):void 0}function m(e,t){return new z(t,e).parse()}function y(e,t){var r=new z(t,e);return r.options.strictMode&&(r.state.strict=!0),r.getExpression()}Object.defineProperty(r,"__esModule",{value:!0});var g={6:n("enum await"),strict:n("implements interface let package private protected public static yield"),strictBind:n("eval arguments")},b=n("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"),v="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",x="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",E=new RegExp("["+v+"]"),A=new RegExp("["+v+x+"]");v=x=null;var D=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],C=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],S={sourceType:"script",sourceFilename:void 0,startLine:1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,plugins:[],strictMode:null},_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},k=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},F=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},T=!0,P=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};w(this,e),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.rightAssociative=!!r.rightAssociative,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null},B=function(e){function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return w(this,t),n.keyword=r,F(this,e.call(this,r,n))}return k(t,e),t}(P),O=function(e){function t(r,n){return w(this,t),F(this,e.call(this,r,{beforeExpr:T,binop:n}))}return k(t,e),t}(P),j={num:new P("num",{startsExpr:!0}),regexp:new P("regexp",{startsExpr:!0}),string:new P("string",{startsExpr:!0}),name:new P("name",{startsExpr:!0}),eof:new P("eof"),bracketL:new P("[",{beforeExpr:T,startsExpr:!0}),bracketR:new P("]"),braceL:new P("{",{beforeExpr:T,startsExpr:!0}),braceBarL:new P("{|",{beforeExpr:T,startsExpr:!0}),braceR:new P("}"),braceBarR:new P("|}"),parenL:new P("(",{beforeExpr:T,startsExpr:!0}),parenR:new P(")"),comma:new P(",",{beforeExpr:T}),semi:new P(";",{beforeExpr:T}),colon:new P(":",{beforeExpr:T}),doubleColon:new P("::",{beforeExpr:T}),dot:new P("."),question:new P("?",{beforeExpr:T}),arrow:new P("=>",{beforeExpr:T}),template:new P("template"),ellipsis:new P("...",{beforeExpr:T}),backQuote:new P("`",{startsExpr:!0}),dollarBraceL:new P("${",{beforeExpr:T,startsExpr:!0}),at:new P("@"),eq:new P("=",{beforeExpr:T,isAssign:!0}),assign:new P("_=",{beforeExpr:T,isAssign:!0}),incDec:new P("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new P("prefix",{beforeExpr:T,prefix:!0,startsExpr:!0}),logicalOR:new O("||",1),logicalAND:new O("&&",2),bitwiseOR:new O("|",3),bitwiseXOR:new O("^",4),bitwiseAND:new O("&",5),equality:new O("==/!=",6),relational:new O("",7),bitShift:new O("<>",8),plusMin:new P("+/-",{beforeExpr:T,binop:9,prefix:!0,startsExpr:!0}),modulo:new O("%",10),star:new O("*",10),slash:new O("/",10),exponent:new P("**",{beforeExpr:T,binop:11,rightAssociative:!0})},N={break:new B("break"),case:new B("case",{beforeExpr:T}),catch:new B("catch"),continue:new B("continue"),debugger:new B("debugger"),default:new B("default",{beforeExpr:T}),do:new B("do",{isLoop:!0,beforeExpr:T}),else:new B("else",{beforeExpr:T}),finally:new B("finally"),for:new B("for",{isLoop:!0}),function:new B("function",{startsExpr:!0}),if:new B("if"),return:new B("return",{beforeExpr:T}),switch:new B("switch"),throw:new B("throw",{beforeExpr:T}),try:new B("try"),var:new B("var"),let:new B("let"),const:new B("const"),while:new B("while",{isLoop:!0}),with:new B("with"),new:new B("new",{beforeExpr:T,startsExpr:!0}),this:new B("this",{startsExpr:!0}),super:new B("super",{startsExpr:!0}),class:new B("class"),extends:new B("extends",{beforeExpr:T}),export:new B("export"),import:new B("import"),yield:new B("yield",{beforeExpr:T,startsExpr:!0}),null:new B("null",{startsExpr:!0}),true:new B("true",{startsExpr:!0}),false:new B("false",{startsExpr:!0}),in:new B("in",{beforeExpr:T,binop:7}),instanceof:new B("instanceof",{beforeExpr:T,binop:7}),typeof:new B("typeof",{beforeExpr:T,prefix:!0,startsExpr:!0}),void:new B("void",{beforeExpr:T,prefix:!0,startsExpr:!0}),delete:new B("delete",{beforeExpr:T,prefix:!0,startsExpr:!0})};Object.keys(N).forEach(function(e){j["_"+e]=N[e]});var I=/\r\n?|\n|\u2028|\u2029/,L=new RegExp(I.source,"g"),M=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,R=function e(t,r,n,i){w(this,e),this.token=t,this.isExpr=!!r,this.preserveSpace=!!n,this.override=i},U={braceStatement:new R("{",!1),braceExpression:new R("{",!0),templateQuasi:new R("${",!0),parenStatement:new R("(",!1),parenExpression:new R("(",!0),template:new R("`",!0,!0,function(e){return e.readTmplToken()}),functionExpression:new R("function",!0)};j.parenR.updateContext=j.braceR.updateContext=function(){if(1===this.state.context.length)return void(this.state.exprAllowed=!0);var e=this.state.context.pop();e===U.braceStatement&&this.curContext()===U.functionExpression?(this.state.context.pop(),this.state.exprAllowed=!1):e===U.templateQuasi?this.state.exprAllowed=!0:this.state.exprAllowed=!e.isExpr},j.name.updateContext=function(e){this.state.exprAllowed=!1,e!==j._let&&e!==j._const&&e!==j._var||I.test(this.input.slice(this.state.end))&&(this.state.exprAllowed=!0)},j.braceL.updateContext=function(e){this.state.context.push(this.braceIsBlock(e)?U.braceStatement:U.braceExpression),this.state.exprAllowed=!0},j.dollarBraceL.updateContext=function(){this.state.context.push(U.templateQuasi),this.state.exprAllowed=!0},j.parenL.updateContext=function(e){var t=e===j._if||e===j._for||e===j._with||e===j._while;this.state.context.push(t?U.parenStatement:U.parenExpression),this.state.exprAllowed=!0},j.incDec.updateContext=function(){},j._function.updateContext=function(){this.curContext()!==U.braceStatement&&this.state.context.push(U.functionExpression),this.state.exprAllowed=!1},j.backQuote.updateContext=function(){this.curContext()===U.template?this.state.context.pop():this.state.context.push(U.template),this.state.exprAllowed=!1};var V=function e(t,r){w(this,e),this.line=t,this.column=r},q=function e(t,r){w(this,e),this.start=t,this.end=r},G=function(){function e(){w(this,e)}return e.prototype.init=function(e,t){return this.strict=!1!==e.strictMode&&"module"===e.sourceType,this.input=t,this.potentialArrowAt=-1,this.inMethod=this.inFunction=this.inGenerator=this.inAsync=this.inPropertyName=this.inType=this.noAnonFunctionType=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=e.startLine,this.type=j.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[U.braceStatement],this.exprAllowed=!0,this.containsEsc=this.containsOctal=!1,this.octalPosition=null,this.exportedIdentifiers=[],this},e.prototype.curPosition=function(){return new V(this.curLine,this.pos-this.lineStart)},e.prototype.clone=function(t){var r=new e;for(var n in this){var i=this[n];t&&"context"!==n||!Array.isArray(i)||(i=i.slice()),r[n]=i}return r},e}(),X=function e(t){w(this,e),this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,this.loc=new q(t.startLoc,t.endLoc)},J=function(){function e(t,r){w(this,e),this.state=new G,this.state.init(t,r)}return e.prototype.next=function(){this.isLookahead||this.state.tokens.push(new X(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},e.prototype.eat=function(e){return!!this.match(e)&&(this.next(),!0)},e.prototype.match=function(e){return this.state.type===e},e.prototype.isKeyword=function(e){return b(e)},e.prototype.lookahead=function(){var e=this.state;this.state=e.clone(!0),this.isLookahead=!0,this.next(),this.isLookahead=!1;var t=this.state.clone(!0);return this.state=e,t},e.prototype.setStrict=function(e){if(this.state.strict=e,this.match(j.num)||this.match(j.string)){for(this.state.pos=this.state.start;this.state.pos=this.input.length?this.finishToken(j.eof):e.override?e.override(this):this.readToken(this.fullCharCodeAtPos())},e.prototype.readToken=function(e){return s(e)||92===e?this.readWord():this.getTokenFromCode(e)},e.prototype.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.state.pos);return e<=55295||e>=57344?e:(e<<10)+this.input.charCodeAt(this.state.pos+1)-56613888},e.prototype.pushComment=function(e,t,r,n,i,s){var a={type:e?"CommentBlock":"CommentLine",value:t,start:r,end:n,loc:new q(i,s)};this.isLookahead||(this.state.tokens.push(a),this.state.comments.push(a),this.addComment(a))},e.prototype.skipBlockComment=function(){var e=this.state.curPosition(),t=this.state.pos,r=this.input.indexOf("*/",this.state.pos+=2);-1===r&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=r+2,L.lastIndex=t;for(var n=void 0;(n=L.exec(this.input))&&n.index8&&e<14||e>=5760&&M.test(String.fromCharCode(e))))break e;++this.state.pos}}},e.prototype.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.updateContext(r)},e.prototype.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.state.pos+2);return 46===e&&46===t?(this.state.pos+=3,this.finishToken(j.ellipsis)):(++this.state.pos,this.finishToken(j.dot))},e.prototype.readToken_slash=function(){return this.state.exprAllowed?(++this.state.pos,this.readRegexp()):61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(j.assign,2):this.finishOp(j.slash,1)},e.prototype.readToken_mult_modulo=function(e){var t=42===e?j.star:j.modulo,r=1,n=this.input.charCodeAt(this.state.pos+1);return 42===n&&(r++,n=this.input.charCodeAt(this.state.pos+2),t=j.exponent),61===n&&(r++,t=j.assign),this.finishOp(t,r)},e.prototype.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?this.finishOp(124===e?j.logicalOR:j.logicalAND,2):61===t?this.finishOp(j.assign,2):124===e&&125===t&&this.hasPlugin("flow")?this.finishOp(j.braceBarR,2):this.finishOp(124===e?j.bitwiseOR:j.bitwiseAND,1)},e.prototype.readToken_caret=function(){return 61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(j.assign,2):this.finishOp(j.bitwiseXOR,1)},e.prototype.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?45===t&&62===this.input.charCodeAt(this.state.pos+2)&&I.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(j.incDec,2):61===t?this.finishOp(j.assign,2):this.finishOp(j.plusMin,1)},e.prototype.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.state.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+r)?this.finishOp(j.assign,r+1):this.finishOp(j.bitShift,r)):33===t&&60===e&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(r=2),this.finishOp(j.relational,r))},e.prototype.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(j.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===e&&62===t?(this.state.pos+=2,this.finishToken(j.arrow)):this.finishOp(61===e?j.eq:j.prefix,1)},e.prototype.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(j.parenL);case 41:return++this.state.pos,this.finishToken(j.parenR);case 59:return++this.state.pos,this.finishToken(j.semi);case 44:return++this.state.pos,this.finishToken(j.comma);case 91:return++this.state.pos,this.finishToken(j.bracketL);case 93:return++this.state.pos,this.finishToken(j.bracketR);case 123:return this.hasPlugin("flow")&&124===this.input.charCodeAt(this.state.pos+1)?this.finishOp(j.braceBarL,2):(++this.state.pos,this.finishToken(j.braceL));case 125:return++this.state.pos,this.finishToken(j.braceR);case 58:return this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(j.doubleColon,2):(++this.state.pos,this.finishToken(j.colon));case 63:return++this.state.pos,this.finishToken(j.question);case 64:return++this.state.pos,this.finishToken(j.at);case 96:return++this.state.pos,this.finishToken(j.backQuote);case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(j.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+c(e)+"'")},e.prototype.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);return this.state.pos+=t,this.finishToken(e,r)},e.prototype.readRegexp=function(){for(var e=this.state.pos,t=void 0,r=void 0;;){this.state.pos>=this.input.length&&this.raise(e,"Unterminated regular expression");var n=this.input.charAt(this.state.pos);if(I.test(n)&&this.raise(e,"Unterminated regular expression"),t)t=!1;else{if("["===n)r=!0;else if("]"===n&&r)r=!1;else if("/"===n&&!r)break;t="\\"===n}++this.state.pos}var i=this.input.slice(e,this.state.pos);++this.state.pos;var s=this.readWord1();if(s){/^[gmsiyu]*$/.test(s)||this.raise(e,"Invalid regular expression flag")}return this.finishToken(j.regexp,{pattern:i,flags:s})},e.prototype.readInt=function(e,t){for(var r=this.state.pos,n=0,i=0,s=null==t?1/0:t;i=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=e)break;++this.state.pos,n=n*e+o}return this.state.pos===r||null!=t&&this.state.pos-r!==t?null:n},e.prototype.readRadixNumber=function(e){this.state.pos+=2;var t=this.readInt(e) +;return null==t&&this.raise(this.state.start+2,"Expected number in radix "+e),s(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(j.num,t)},e.prototype.readNumber=function(e){var t=this.state.pos,r=48===this.input.charCodeAt(this.state.pos),n=!1;e||null!==this.readInt(10)||this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.state.pos);46===i&&(++this.state.pos,this.readInt(10),n=!0,i=this.input.charCodeAt(this.state.pos)),69!==i&&101!==i||(i=this.input.charCodeAt(++this.state.pos),43!==i&&45!==i||++this.state.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),n=!0),s(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var a=this.input.slice(t,this.state.pos),o=void 0;return n?o=parseFloat(a):r&&1!==a.length?/[89]/.test(a)||this.state.strict?this.raise(t,"Invalid number"):o=parseInt(a,8):o=parseInt(a,10),this.finishToken(j.num,o)},e.prototype.readCodePoint=function(){var e=this.input.charCodeAt(this.state.pos),t=void 0;if(123===e){var r=++this.state.pos;t=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos),++this.state.pos,t>1114111&&this.raise(r,"Code point out of bounds")}else t=this.readHexChar(4);return t},e.prototype.readString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.state.pos),t+=this.readEscapedChar(!1),r=this.state.pos):(u(n)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return t+=this.input.slice(r,this.state.pos++),this.finishToken(j.string,t)},e.prototype.readTmplToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var r=this.input.charCodeAt(this.state.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(j.template)?36===r?(this.state.pos+=2,this.finishToken(j.dollarBraceL)):(++this.state.pos,this.finishToken(j.backQuote)):(e+=this.input.slice(t,this.state.pos),this.finishToken(j.template,e));if(92===r)e+=this.input.slice(t,this.state.pos),e+=this.readEscapedChar(!0),t=this.state.pos;else if(u(r)){switch(e+=this.input.slice(t,this.state.pos),++this.state.pos,r){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}++this.state.curLine,this.state.lineStart=this.state.pos,t=this.state.pos}else++this.state.pos}},e.prototype.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return c(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(t>=48&&t<=55){var r=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=parseInt(r,8)),n>0&&(this.state.containsOctal||(this.state.containsOctal=!0,this.state.octalPosition=this.state.pos-2),(this.state.strict||e)&&this.raise(this.state.pos-2,"Octal literal in strict mode")),this.state.pos+=r.length-1,String.fromCharCode(n)}return String.fromCharCode(t)}},e.prototype.readHexChar=function(e){var t=this.state.pos,r=this.readInt(16,e);return null===r&&this.raise(t,"Bad character escape sequence"),r},e.prototype.readWord1=function(){this.state.containsEsc=!1;for(var e="",t=!0,r=this.state.pos;this.state.pos-1)||!!this.plugins[e]},t.prototype.extend=function(e,t){this[e]=t(this[e])},t.prototype.loadAllPlugins=function(){var e=this,t=Object.keys(W).filter(function(e){return"flow"!==e&&"estree"!==e});t.push("flow"),t.forEach(function(t){var r=W[t];r&&r(e)})},t.prototype.loadPlugins=function(e){if(e.indexOf("*")>=0)return this.loadAllPlugins(),{"*":!0};var t={};e.indexOf("flow")>=0&&(e=e.filter(function(e){return"flow"!==e}),e.push("flow")),e.indexOf("estree")>=0&&(e=e.filter(function(e){return"estree"!==e}),e.unshift("estree"));for(var r=e,n=Array.isArray(r),i=0,r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;if(!t[a]){t[a]=!0;var o=W[a];o&&o(this)}}return t},t.prototype.parse=function(){var e=this.startNode(),t=this.startNode();return this.nextToken(),this.parseTopLevel(e,t)},t}(J),Y=z.prototype;Y.addExtra=function(e,t,r){if(e){(e.extra=e.extra||{})[t]=r}},Y.isRelational=function(e){return this.match(j.relational)&&this.state.value===e},Y.expectRelational=function(e){this.isRelational(e)?this.next():this.unexpected(null,j.relational)},Y.isContextual=function(e){return this.match(j.name)&&this.state.value===e},Y.eatContextual=function(e){return this.state.value===e&&this.eat(j.name)},Y.expectContextual=function(e,t){this.eatContextual(e)||this.unexpected(null,t)},Y.canInsertSemicolon=function(){return this.match(j.eof)||this.match(j.braceR)||I.test(this.input.slice(this.state.lastTokEnd,this.state.start))},Y.isLineTerminator=function(){return this.eat(j.semi)||this.canInsertSemicolon()},Y.semicolon=function(){this.isLineTerminator()||this.unexpected(null,j.semi)},Y.expect=function(e,t){return this.eat(e)||this.unexpected(t,e)},Y.unexpected=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unexpected token";t&&"object"===(void 0===t?"undefined":_(t))&&t.label&&(t="Unexpected token, expected "+t.label),this.raise(null!=e?e:this.state.start,t)};var H=z.prototype;H.parseTopLevel=function(e,t){return t.sourceType=this.options.sourceType,this.parseBlockBody(t,!0,!0,j.eof),e.program=this.finishNode(t,"Program"),e.comments=this.state.comments,e.tokens=this.state.tokens,this.finishNode(e,"File")};var $={kind:"loop"},Q={kind:"switch"};H.stmtToDirective=function(e){var t=e.expression,r=this.startNodeAt(t.start,t.loc.start),n=this.startNodeAt(e.start,e.loc.start),i=this.input.slice(t.start,t.end),s=r.value=i.slice(1,-1);return this.addExtra(r,"raw",i),this.addExtra(r,"rawValue",s),n.value=this.finishNodeAt(r,"DirectiveLiteral",t.end,t.loc.end),this.finishNodeAt(n,"Directive",e.end,e.loc.end)},H.parseStatement=function(e,t){this.match(j.at)&&this.parseDecorators(!0);var r=this.state.type,n=this.startNode();switch(r){case j._break:case j._continue:return this.parseBreakContinueStatement(n,r.keyword);case j._debugger:return this.parseDebuggerStatement(n);case j._do:return this.parseDoStatement(n);case j._for:return this.parseForStatement(n);case j._function:return e||this.unexpected(),this.parseFunctionStatement(n);case j._class:return e||this.unexpected(),this.parseClass(n,!0);case j._if:return this.parseIfStatement(n);case j._return:return this.parseReturnStatement(n);case j._switch:return this.parseSwitchStatement(n);case j._throw:return this.parseThrowStatement(n);case j._try:return this.parseTryStatement(n);case j._let:case j._const:e||this.unexpected();case j._var:return this.parseVarStatement(n,r);case j._while:return this.parseWhileStatement(n);case j._with:return this.parseWithStatement(n);case j.braceL:return this.parseBlock();case j.semi:return this.parseEmptyStatement(n);case j._export:case j._import:if(this.hasPlugin("dynamicImport")&&this.lookahead().type===j.parenL)break;return this.options.allowImportExportEverywhere||(t||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===j._import?this.parseImport(n):this.parseExport(n);case j.name:if("async"===this.state.value){var i=this.state.clone();if(this.next(),this.match(j._function)&&!this.canInsertSemicolon())return this.expect(j._function),this.parseFunction(n,!0,!1,!0);this.state=i}}var s=this.state.value,a=this.parseExpression();return r===j.name&&"Identifier"===a.type&&this.eat(j.colon)?this.parseLabeledStatement(n,s,a):this.parseExpressionStatement(n,a)},H.takeDecorators=function(e){this.state.decorators.length&&(e.decorators=this.state.decorators,this.state.decorators=[])},H.parseDecorators=function(e){for(;this.match(j.at);){var t=this.parseDecorator();this.state.decorators.push(t)}e&&this.match(j._export)||this.match(j._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},H.parseDecorator=function(){this.hasPlugin("decorators")||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},H.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.isLineTerminator()?e.label=null:this.match(j.name)?(e.label=this.parseIdentifier(),this.semicolon()):this.unexpected();var n=void 0;for(n=0;n=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}a.name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var o=this.state.type.isLoop?"loop":this.match(j._switch)?"switch":null,u=this.state.labels.length-1;u>=0;u--){var l=this.state.labels[u];if(l.statementStart!==e.start)break;l.statementStart=this.state.start,l.kind=o}return this.state.labels.push({name:t,kind:o,statementStart:this.state.start}),e.body=this.parseStatement(!0),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},H.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},H.parseBlock=function(e){var t=this.startNode();return this.expect(j.braceL),this.parseBlockBody(t,e,!1,j.braceR),this.finishNode(t,"BlockStatement")},H.isValidDirective=function(e){return"ExpressionStatement"===e.type&&"StringLiteral"===e.expression.type&&!e.expression.extra.parenthesized},H.parseBlockBody=function(e,t,r,n){e.body=[],e.directives=[];for(var i=!1,s=void 0,a=void 0;!this.eat(n);){i||!this.state.containsOctal||a||(a=this.state.octalPosition);var o=this.parseStatement(!0,r);if(t&&!i&&this.isValidDirective(o)){var u=this.stmtToDirective(o);e.directives.push(u),void 0===s&&"use strict"===u.value.value&&(s=this.state.strict,this.setStrict(!0),a&&this.raise(a,"Octal literal in strict mode"))}else i=!0,e.body.push(o)}!1===s&&this.setStrict(!1)},H.parseFor=function(e,t){return e.init=t,this.expect(j.semi),e.test=this.match(j.semi)?null:this.parseExpression(),this.expect(j.semi),e.update=this.match(j.parenR)?null:this.parseExpression(),this.expect(j.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"ForStatement")},H.parseForIn=function(e,t,r){var n=void 0;return r?(this.eatContextual("of"),n="ForAwaitStatement"):(n=this.match(j._in)?"ForInStatement":"ForOfStatement",this.next()),e.left=t,e.right=this.parseExpression(),this.expect(j.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,n)},H.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r.keyword;;){var n=this.startNode();if(this.parseVarHead(n),this.eat(j.eq)?n.init=this.parseMaybeAssign(t):r!==j._const||this.match(j._in)||this.isContextual("of")?"Identifier"===n.id.type||t&&(this.match(j._in)||this.isContextual("of"))?n.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(j.comma))break}return e},H.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0,void 0,"variable declaration")},H.parseFunction=function(e,t,r,n,i){var s=this.state.inMethod;return this.state.inMethod=!1,this.initFunction(e,n),this.match(j.star)&&(e.async&&!this.hasPlugin("asyncGenerators")?this.unexpected():(e.generator=!0,this.next())),!t||i||this.match(j.name)||this.match(j._yield)||this.unexpected(),(this.match(j.name)||this.match(j._yield))&&(e.id=this.parseBindingIdentifier()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.state.inMethod=s,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},H.parseFunctionParams=function(e){this.expect(j.parenL),e.params=this.parseBindingList(j.parenR)},H.parseClass=function(e,t,r){return this.next(),this.takeDecorators(e),this.parseClassId(e,t,r),this.parseClassSuper(e),this.parseClassBody(e),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},H.isClassProperty=function(){return this.match(j.eq)||this.isLineTerminator()},H.isClassMutatorStarter=function(){return!1},H.parseClassBody=function(e){var t=this.state.strict;this.state.strict=!0;var r=!1,n=!1,i=[],s=this.startNode();for(s.body=[],this.expect(j.braceL);!this.eat(j.braceR);)if(this.eat(j.semi))i.length>0&&this.raise(this.state.lastTokEnd,"Decorators must not be followed by a semicolon");else if(this.match(j.at))i.push(this.parseDecorator());else{var a=this.startNode();i.length&&(a.decorators=i,i=[]);var o=!1,u=this.match(j.name)&&"static"===this.state.value,l=this.eat(j.star),c=!1,p=!1;if(this.parsePropertyName(a),a.static=u&&!this.match(j.parenL),a.static&&(l=this.eat(j.star),this.parsePropertyName(a)),!l){if(this.isClassProperty()){s.body.push(this.parseClassProperty(a));continue}"Identifier"===a.key.type&&!a.computed&&this.hasPlugin("classConstructorCall")&&"call"===a.key.name&&this.match(j.name)&&"constructor"===this.state.value&&(o=!0,this.parsePropertyName(a))}var h=!this.match(j.parenL)&&!a.computed&&"Identifier"===a.key.type&&"async"===a.key.name;if(h&&(this.hasPlugin("asyncGenerators")&&this.eat(j.star)&&(l=!0),p=!0,this.parsePropertyName(a)),a.kind="method",!a.computed){var f=a.key;p||l||this.isClassMutatorStarter()||"Identifier"!==f.type||this.match(j.parenL)||"get"!==f.name&&"set"!==f.name||(c=!0,a.kind=f.name,f=this.parsePropertyName(a));var d=!(o||a.static||"constructor"!==f.name&&"constructor"!==f.value);d&&(n&&this.raise(f.start,"Duplicate constructor in the same class"),c&&this.raise(f.start,"Constructor can't have get/set modifier"),l&&this.raise(f.start,"Constructor can't be a generator"),p&&this.raise(f.start,"Constructor can't be an async function"),a.kind="constructor",n=!0);var m=a.static&&("prototype"===f.name||"prototype"===f.value);m&&this.raise(f.start,"Classes may not have static property named prototype")}o&&(r&&this.raise(a.start,"Duplicate constructor call in the same class"),a.kind="constructorCall",r=!0),"constructor"!==a.kind&&"constructorCall"!==a.kind||!a.decorators||this.raise(a.start,"You can't attach decorators to a class constructor"),this.parseClassMethod(s,a,l,p),c&&this.checkGetterSetterParamCount(a)}i.length&&this.raise(this.state.start,"You have trailing decorators with no method"),e.body=this.finishNode(s,"ClassBody"),this.state.strict=t},H.parseClassProperty=function(e){return this.match(j.eq)?(this.hasPlugin("classProperties")||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.finishNode(e,"ClassProperty")},H.parseClassMethod=function(e,t,r,n){this.parseMethod(t,r,n),e.body.push(this.finishNode(t,"ClassMethod"))},H.parseClassId=function(e,t,r){this.match(j.name)?e.id=this.parseIdentifier():r||!t?e.id=null:this.unexpected()},H.parseClassSuper=function(e){e.superClass=this.eat(j._extends)?this.parseExprSubscripts():null},H.parseExport=function(e){if(this.next(),this.match(j.star)){var t=this.startNode();if(this.next(),!this.hasPlugin("exportExtensions")||!this.eatContextual("as"))return this.parseExportFrom(e,!0),this.finishNode(e,"ExportAllDeclaration");t.exported=this.parseIdentifier(),e.specifiers=[this.finishNode(t,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e,!0)}else if(this.hasPlugin("exportExtensions")&&this.isExportDefaultSpecifier()){var r=this.startNode();if(r.exported=this.parseIdentifier(!0),e.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")],this.match(j.comma)&&this.lookahead().type===j.star){this.expect(j.comma);var n=this.startNode();this.expect(j.star),this.expectContextual("as"),n.exported=this.parseIdentifier(),e.specifiers.push(this.finishNode(n,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e,!0)}else{if(this.eat(j._default)){var i=this.startNode(),s=!1;return this.eat(j._function)?i=this.parseFunction(i,!0,!1,!1,!0):this.match(j._class)?i=this.parseClass(i,!0,!0):(s=!0,i=this.parseMaybeAssign()),e.declaration=i,s&&this.semicolon(),this.checkExport(e,!0,!0),this.finishNode(e,"ExportDefaultDeclaration")}this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.declaration=this.parseExportDeclaration(e)):(e.declaration=null,e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e))}return this.checkExport(e,!0),this.finishNode(e,"ExportNamedDeclaration")},H.parseExportDeclaration=function(){return this.parseStatement(!0)},H.isExportDefaultSpecifier=function(){if(this.match(j.name))return"type"!==this.state.value&&"async"!==this.state.value&&"interface"!==this.state.value;if(!this.match(j._default))return!1;var e=this.lookahead();return e.type===j.comma||e.type===j.name&&"from"===e.value},H.parseExportSpecifiersMaybe=function(e){this.eat(j.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},H.parseExportFrom=function(e,t){this.eatContextual("from")?(e.source=this.match(j.string)?this.parseExprAtom():this.unexpected(),this.checkExport(e)):t?this.unexpected():e.source=null,this.semicolon()},H.shouldParseExportDeclaration=function(){return"var"===this.state.type.keyword||"const"===this.state.type.keyword||"let"===this.state.type.keyword||"function"===this.state.type.keyword||"class"===this.state.type.keyword||this.isContextual("async")},H.checkExport=function(e,t,r){if(t)if(r)this.checkDuplicateExports(e,"default");else if(e.specifiers&&e.specifiers.length)for(var n=e.specifiers,i=Array.isArray(n),s=0,n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;this.checkDuplicateExports(o,o.exported.name)}else if(e.declaration)if("FunctionDeclaration"===e.declaration.type||"ClassDeclaration"===e.declaration.type)this.checkDuplicateExports(e,e.declaration.id.name);else if("VariableDeclaration"===e.declaration.type)for(var u=e.declaration.declarations,l=Array.isArray(u),c=0,u=l?u:u[Symbol.iterator]();;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if(c=u.next(),c.done)break;p=c.value}var h=p;this.checkDeclaration(h.id)}if(this.state.decorators.length){var f=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&f||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},H.checkDeclaration=function(e){if("ObjectPattern"===e.type)for(var t=e.properties,r=Array.isArray(t),n=0,t=r?t:t[Symbol.iterator]();;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if(n=t.next(),n.done)break;i=n.value}var s=i;this.checkDeclaration(s)}else if("ArrayPattern"===e.type)for(var a=e.elements,o=Array.isArray(a),u=0,a=o?a:a[Symbol.iterator]();;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if(u=a.next(),u.done)break;l=u.value}var c=l;c&&this.checkDeclaration(c)}else"ObjectProperty"===e.type?this.checkDeclaration(e.value):"RestElement"===e.type||"RestProperty"===e.type?this.checkDeclaration(e.argument):"Identifier"===e.type&&this.checkDuplicateExports(e,e.name)},H.checkDuplicateExports=function(e,t){this.state.exportedIdentifiers.indexOf(t)>-1&&this.raiseDuplicateExportError(e,t),this.state.exportedIdentifiers.push(t)},H.raiseDuplicateExportError=function(e,t){this.raise(e.start,"default"===t?"Only one default export allowed per module.":"`"+t+"` has already been exported. Exported identifiers must be unique.")},H.parseExportSpecifiers=function(){var e=[],t=!0,r=void 0;for(this.expect(j.braceL);!this.eat(j.braceR);){if(t)t=!1;else if(this.expect(j.comma),this.eat(j.braceR))break;var n=this.match(j._default);n&&!r&&(r=!0);var i=this.startNode();i.local=this.parseIdentifier(n),i.exported=this.eatContextual("as")?this.parseIdentifier(!0):i.local.__clone(),e.push(this.finishNode(i,"ExportSpecifier"))}return r&&!this.isContextual("from")&&this.unexpected(),e},H.parseImport=function(e){return this.eat(j._import),this.match(j.string)?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.match(j.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},H.parseImportSpecifiers=function(e){var t=!0;if(this.match(j.name)){var r=this.state.start,n=this.state.startLoc;if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(),r,n)),!this.eat(j.comma))return}if(this.match(j.star)){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdentifier(),this.checkLVal(i.local,!0,void 0,"import namespace specifier"),void e.specifiers.push(this.finishNode(i,"ImportNamespaceSpecifier"))}for(this.expect(j.braceL);!this.eat(j.braceR);){if(t)t=!1;else if(this.eat(j.colon)&&this.unexpected(null,"ES2015 named imports do not destructure. Use another statement for destructuring after the import."),this.expect(j.comma),this.eat(j.braceR))break;this.parseImportSpecifier(e)}},H.parseImportSpecifier=function(e){var t=this.startNode();t.imported=this.parseIdentifier(!0),this.eatContextual("as")?t.local=this.parseIdentifier():(this.checkReservedWord(t.imported.name,t.start,!0,!0),t.local=t.imported.__clone()),this.checkLVal(t.local,!0,void 0,"import specifier"),e.specifiers.push(this.finishNode(t,"ImportSpecifier"))},H.parseImportSpecifierDefault=function(e,t,r){var n=this.startNodeAt(t,r);return n.local=e,this.checkLVal(n.local,!0,void 0,"default import specifier"),this.finishNode(n,"ImportDefaultSpecifier")};var ee=z.prototype;ee.toAssignable=function(e,t,r){if(e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var n=e.properties,i=Array.isArray(n),s=0,n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;"ObjectMethod"===o.type?"get"===o.kind||"set"===o.kind?this.raise(o.key.start,"Object pattern can't contain getter or setter"):this.raise(o.key.start,"Object pattern can't contain methods"):this.toAssignable(o,t,"object destructuring pattern")}break;case"ObjectProperty":this.toAssignable(e.value,t,r);break;case"SpreadProperty":e.type="RestProperty";break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t,r);break;case"AssignmentExpression":"="===e.operator?(e.type="AssignmentPattern",delete e.operator):this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:var u="Invalid left-hand side"+(r?" in "+r:"expression");this.raise(e.start,u)}return e},ee.toAssignableList=function(e,t,r){var n=e.length;if(n){var i=e[n-1];if(i&&"RestElement"===i.type)--n;else if(i&&"SpreadElement"===i.type){i.type="RestElement";var s=i.argument;this.toAssignable(s,t,r),"Identifier"!==s.type&&"MemberExpression"!==s.type&&"ArrayPattern"!==s.type&&this.unexpected(s.start),--n}}for(var a=0;a=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var l=u +;"ObjectProperty"===l.type&&(l=l.value),this.checkLVal(l,t,r,"object destructuring pattern")}break;case"ArrayPattern":for(var c=e.elements,p=Array.isArray(c),h=0,c=p?c:c[Symbol.iterator]();;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if(h=c.next(),h.done)break;f=h.value}var d=f;d&&this.checkLVal(d,t,r,"array destructuring pattern")}break;case"AssignmentPattern":this.checkLVal(e.left,t,r,"assignment pattern");break;case"RestProperty":this.checkLVal(e.argument,t,r,"rest property");break;case"RestElement":this.checkLVal(e.argument,t,r,"rest element");break;default:var m=(t?"Binding invalid":"Invalid")+" left-hand side"+(n?" in "+n:"expression");this.raise(e.start,m)}};var te=z.prototype;te.checkPropClash=function(e,t){if(!e.computed&&!e.kind){var r=e.key;"__proto__"===("Identifier"===r.type?r.name:String(r.value))&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}},te.getExpression=function(){this.nextToken();var e=this.parseExpression();return this.match(j.eof)||this.unexpected(),e},te.parseExpression=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeAssign(e,t);if(this.match(j.comma)){var s=this.startNodeAt(r,n);for(s.expressions=[i];this.eat(j.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return i},te.parseMaybeAssign=function(e,t,r,n){var i=this.state.start,s=this.state.startLoc;if(this.match(j._yield)&&this.state.inGenerator){var a=this.parseYield();return r&&(a=r.call(this,a,i,s)),a}var o=void 0;t?o=!1:(t={start:0},o=!0),(this.match(j.parenL)||this.match(j.name))&&(this.state.potentialArrowAt=this.state.start);var u=this.parseMaybeConditional(e,t,n);if(r&&(u=r.call(this,u,i,s)),this.state.type.isAssign){var l=this.startNodeAt(i,s);if(l.operator=this.state.value,l.left=this.match(j.eq)?this.toAssignable(u,void 0,"assignment expression"):u,t.start=0,this.checkLVal(u,void 0,void 0,"assignment expression"),u.extra&&u.extra.parenthesized){var c=void 0;"ObjectPattern"===u.type?c="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===u.type&&(c="`([a]) = 0` use `([a] = 0)`"),c&&this.raise(u.start,"You're trying to assign to a parenthesized expression, eg. instead of "+c)}return this.next(),l.right=this.parseMaybeAssign(e),this.finishNode(l,"AssignmentExpression")}return o&&t.start&&this.unexpected(t.start),u},te.parseMaybeConditional=function(e,t,r){var n=this.state.start,i=this.state.startLoc,s=this.parseExprOps(e,t);return t&&t.start?s:this.parseConditional(s,e,n,i,r)},te.parseConditional=function(e,t,r,n){if(this.eat(j.question)){var i=this.startNodeAt(r,n);return i.test=e,i.consequent=this.parseMaybeAssign(),this.expect(j.colon),i.alternate=this.parseMaybeAssign(t),this.finishNode(i,"ConditionalExpression")}return e},te.parseExprOps=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeUnary(t);return t&&t.start?i:this.parseExprOp(i,r,n,-1,e)},te.parseExprOp=function(e,t,r,n,i){var s=this.state.type.binop;if(!(null==s||i&&this.match(j._in))&&s>n){var a=this.startNodeAt(t,r);a.left=e,a.operator=this.state.value,"**"!==a.operator||"UnaryExpression"!==e.type||!e.extra||e.extra.parenthesizedArgument||e.extra.parenthesized||this.raise(e.argument.start,"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");var o=this.state.type;this.next();var u=this.state.start,l=this.state.startLoc;return a.right=this.parseExprOp(this.parseMaybeUnary(),u,l,o.rightAssociative?s-1:s,i),this.finishNode(a,o===j.logicalOR||o===j.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(a,t,r,n,i)}return e},te.parseMaybeUnary=function(e){if(this.state.type.prefix){var t=this.startNode(),r=this.match(j.incDec);t.operator=this.state.value,t.prefix=!0,this.next();var n=this.state.type;return t.argument=this.parseMaybeUnary(),this.addExtra(t,"parenthesizedArgument",!(n!==j.parenL||t.argument.extra&&t.argument.extra.parenthesized)),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(t.argument,void 0,void 0,"prefix operation"):this.state.strict&&"delete"===t.operator&&"Identifier"===t.argument.type&&this.raise(t.start,"Deleting local variable in strict mode"),this.finishNode(t,r?"UpdateExpression":"UnaryExpression")}var i=this.state.start,s=this.state.startLoc,a=this.parseExprSubscripts(e);if(e&&e.start)return a;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var o=this.startNodeAt(i,s);o.operator=this.state.value,o.prefix=!1,o.argument=a,this.checkLVal(a,void 0,void 0,"postfix operation"),this.next(),a=this.finishNode(o,"UpdateExpression")}return a},te.parseExprSubscripts=function(e){var t=this.state.start,r=this.state.startLoc,n=this.state.potentialArrowAt,i=this.parseExprAtom(e);return"ArrowFunctionExpression"===i.type&&i.start===n?i:e&&e.start?i:this.parseSubscripts(i,t,r)},te.parseSubscripts=function(e,t,r,n){for(;;){if(!n&&this.eat(j.doubleColon)){var i=this.startNodeAt(t,r);return i.object=e,i.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(i,"BindExpression"),t,r,n)}if(this.eat(j.dot)){var s=this.startNodeAt(t,r);s.object=e,s.property=this.parseIdentifier(!0),s.computed=!1,e=this.finishNode(s,"MemberExpression")}else if(this.eat(j.bracketL)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseExpression(),a.computed=!0,this.expect(j.bracketR),e=this.finishNode(a,"MemberExpression")}else if(!n&&this.match(j.parenL)){var o=this.state.potentialArrowAt===e.start&&"Identifier"===e.type&&"async"===e.name&&!this.canInsertSemicolon();this.next();var u=this.startNodeAt(t,r);if(u.callee=e,u.arguments=this.parseCallExpressionArguments(j.parenR,o),"Import"===u.callee.type&&1!==u.arguments.length&&this.raise(u.start,"import() requires exactly one argument"),e=this.finishNode(u,"CallExpression"),o&&this.shouldParseAsyncArrow())return this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,r),u);this.toReferencedList(u.arguments)}else{if(!this.match(j.backQuote))return e;var l=this.startNodeAt(t,r);l.tag=e,l.quasi=this.parseTemplate(),e=this.finishNode(l,"TaggedTemplateExpression")}}},te.parseCallExpressionArguments=function(e,t){for(var r=[],n=void 0,i=!0;!this.eat(e);){if(i)i=!1;else if(this.expect(j.comma),this.eat(e))break;this.match(j.parenL)&&!n&&(n=this.state.start),r.push(this.parseExprListItem(!1,t?{start:0}:void 0,t?{start:0}:void 0))}return t&&n&&this.shouldParseAsyncArrow()&&this.unexpected(),r},te.shouldParseAsyncArrow=function(){return this.match(j.arrow)},te.parseAsyncArrowFromCallExpression=function(e,t){return this.expect(j.arrow),this.parseArrowExpression(e,t.arguments,!0)},te.parseNoCallExpr=function(){var e=this.state.start,t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,!0)},te.parseExprAtom=function(e){var t=this.state.potentialArrowAt===this.state.start,r=void 0;switch(this.state.type){case j._super:return this.state.inMethod||this.options.allowSuperOutsideMethod||this.raise(this.state.start,"'super' outside of function or class"),r=this.startNode(),this.next(),this.match(j.parenL)||this.match(j.bracketL)||this.match(j.dot)||this.unexpected(),this.match(j.parenL)&&"constructor"!==this.state.inMethod&&!this.options.allowSuperOutsideMethod&&this.raise(r.start,"super() outside of class constructor"),this.finishNode(r,"Super");case j._import:return this.hasPlugin("dynamicImport")||this.unexpected(),r=this.startNode(),this.next(),this.match(j.parenL)||this.unexpected(null,j.parenL),this.finishNode(r,"Import");case j._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case j._yield:this.state.inGenerator&&this.unexpected();case j.name:r=this.startNode();var n="await"===this.state.value&&this.state.inAsync,i=this.shouldAllowYieldIdentifier(),s=this.parseIdentifier(n||i);if("await"===s.name){if(this.state.inAsync||this.inModule)return this.parseAwait(r)}else{if("async"===s.name&&this.match(j._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(r,!1,!1,!0);if(t&&"async"===s.name&&this.match(j.name)){var a=[this.parseIdentifier()];return this.expect(j.arrow),this.parseArrowExpression(r,a,!0)}}return t&&!this.canInsertSemicolon()&&this.eat(j.arrow)?this.parseArrowExpression(r,[s]):s;case j._do:if(this.hasPlugin("doExpressions")){var o=this.startNode();this.next();var u=this.state.inFunction,l=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,o.body=this.parseBlock(!1,!0),this.state.inFunction=u,this.state.labels=l,this.finishNode(o,"DoExpression")}case j.regexp:var c=this.state.value;return r=this.parseLiteral(c.value,"RegExpLiteral"),r.pattern=c.pattern,r.flags=c.flags,r;case j.num:return this.parseLiteral(this.state.value,"NumericLiteral");case j.string:return this.parseLiteral(this.state.value,"StringLiteral");case j._null:return r=this.startNode(),this.next(),this.finishNode(r,"NullLiteral");case j._true:case j._false:return r=this.startNode(),r.value=this.match(j._true),this.next(),this.finishNode(r,"BooleanLiteral");case j.parenL:return this.parseParenAndDistinguishExpression(null,null,t);case j.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(j.bracketR,!0,e),this.toReferencedList(r.elements),this.finishNode(r,"ArrayExpression");case j.braceL:return this.parseObj(!1,e);case j._function:return this.parseFunctionExpression();case j.at:this.parseDecorators();case j._class:return r=this.startNode(),this.takeDecorators(r),this.parseClass(r,!1);case j._new:return this.parseNew();case j.backQuote:return this.parseTemplate();case j.doubleColon:r=this.startNode(),this.next(),r.object=null;var p=r.callee=this.parseNoCallExpr();if("MemberExpression"===p.type)return this.finishNode(r,"BindExpression");this.raise(p.start,"Binding should be performed on object property.");default:this.unexpected()}},te.parseFunctionExpression=function(){var e=this.startNode(),t=this.parseIdentifier(!0);return this.state.inGenerator&&this.eat(j.dot)&&this.hasPlugin("functionSent")?this.parseMetaProperty(e,t,"sent"):this.parseFunction(e,!1)},te.parseMetaProperty=function(e,t,r){return e.meta=t,e.property=this.parseIdentifier(!0),e.property.name!==r&&this.raise(e.property.start,"The only valid meta property for new is "+t.name+"."+r),this.finishNode(e,"MetaProperty")},te.parseLiteral=function(e,t,r,n){r=r||this.state.start,n=n||this.state.startLoc;var i=this.startNodeAt(r,n);return this.addExtra(i,"rawValue",e),this.addExtra(i,"raw",this.input.slice(r,this.state.end)),i.value=e,this.next(),this.finishNode(i,t)},te.parseParenExpression=function(){this.expect(j.parenL);var e=this.parseExpression();return this.expect(j.parenR),e},te.parseParenAndDistinguishExpression=function(e,t,r){e=e||this.state.start,t=t||this.state.startLoc;var n=void 0;this.expect(j.parenL);for(var i=this.state.start,s=this.state.startLoc,a=[],o={start:0},u={start:0},l=!0,c=void 0,p=void 0;!this.match(j.parenR);){if(l)l=!1;else if(this.expect(j.comma,u.start||null),this.match(j.parenR)){p=this.state.start;break}if(this.match(j.ellipsis)){var h=this.state.start,f=this.state.startLoc;c=this.state.start,a.push(this.parseParenItem(this.parseRest(),f,h));break}a.push(this.parseMaybeAssign(!1,o,this.parseParenItem,u))}var d=this.state.start,m=this.state.startLoc;this.expect(j.parenR);var y=this.startNodeAt(e,t);if(r&&this.shouldParseArrow()&&(y=this.parseArrow(y))){for(var g=a,b=Array.isArray(g),v=0,g=b?g:g[Symbol.iterator]();;){var x;if(b){if(v>=g.length)break;x=g[v++]}else{if(v=g.next(),v.done)break;x=v.value}var E=x;E.extra&&E.extra.parenthesized&&this.unexpected(E.extra.parenStart)}return this.parseArrowExpression(y,a)}return a.length||this.unexpected(this.state.lastTokStart),p&&this.unexpected(p),c&&this.unexpected(c),o.start&&this.unexpected(o.start),u.start&&this.unexpected(u.start),a.length>1?(n=this.startNodeAt(i,s),n.expressions=a,this.toReferencedList(n.expressions),this.finishNodeAt(n,"SequenceExpression",d,m)):n=a[0],this.addExtra(n,"parenthesized",!0),this.addExtra(n,"parenStart",e),n},te.shouldParseArrow=function(){return!this.canInsertSemicolon()},te.parseArrow=function(e){if(this.eat(j.arrow))return e},te.parseParenItem=function(e){return e},te.parseNew=function(){var e=this.startNode(),t=this.parseIdentifier(!0);return this.eat(j.dot)?this.parseMetaProperty(e,t,"target"):(e.callee=this.parseNoCallExpr(),this.eat(j.parenL)?(e.arguments=this.parseExprList(j.parenR),this.toReferencedList(e.arguments)):e.arguments=[],this.finishNode(e,"NewExpression"))},te.parseTemplateElement=function(){var e=this.startNode();return e.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),e.tail=this.match(j.backQuote),this.finishNode(e,"TemplateElement")},te.parseTemplate=function(){var e=this.startNode();this.next(),e.expressions=[];var t=this.parseTemplateElement();for(e.quasis=[t];!t.tail;)this.expect(j.dollarBraceL),e.expressions.push(this.parseExpression()),this.expect(j.braceR),e.quasis.push(t=this.parseTemplateElement());return this.next(),this.finishNode(e,"TemplateLiteral")},te.parseObj=function(e,t){var r=[],n=Object.create(null),i=!0,s=this.startNode();s.properties=[],this.next();for(var a=null;!this.eat(j.braceR);){if(i)i=!1;else if(this.expect(j.comma),this.eat(j.braceR))break;for(;this.match(j.at);)r.push(this.parseDecorator());var o=this.startNode(),u=!1,l=!1,c=void 0,p=void 0;if(r.length&&(o.decorators=r,r=[]),this.hasPlugin("objectRestSpread")&&this.match(j.ellipsis)){if(o=this.parseSpread(e?{start:0}:void 0),o.type=e?"RestProperty":"SpreadProperty",e&&this.toAssignable(o.argument,!0,"object pattern"),s.properties.push(o),!e)continue;var h=this.state.start;if(null===a){if(this.eat(j.braceR))break;if(this.match(j.comma)&&this.lookahead().type===j.braceR)continue;a=h;continue}this.unexpected(a,"Cannot have multiple rest elements when destructuring")}if(o.method=!1,o.shorthand=!1,(e||t)&&(c=this.state.start,p=this.state.startLoc),e||(u=this.eat(j.star)),!e&&this.isContextual("async")){u&&this.unexpected();var f=this.parseIdentifier();this.match(j.colon)||this.match(j.parenL)||this.match(j.braceR)||this.match(j.eq)||this.match(j.comma)?(o.key=f,o.computed=!1):(l=!0,this.hasPlugin("asyncGenerators")&&(u=this.eat(j.star)),this.parsePropertyName(o))}else this.parsePropertyName(o);this.parseObjPropValue(o,c,p,u,l,e,t),this.checkPropClash(o,n),o.shorthand&&this.addExtra(o,"shorthand",!0),s.properties.push(o)}return null!==a&&this.unexpected(a,"The rest element has to be the last element when destructuring"),r.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(s,e?"ObjectPattern":"ObjectExpression")},te.isGetterOrSetterMethod=function(e,t){return!t&&!e.computed&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)&&(this.match(j.string)||this.match(j.num)||this.match(j.bracketL)||this.match(j.name)||this.state.type.keyword)},te.checkGetterSetterParamCount=function(e){var t="get"===e.kind?0:1;if(e.params.length!==t){var r=e.start;"get"===e.kind?this.raise(r,"getter should have no params"):this.raise(r,"setter should have exactly one param")}},te.parseObjectMethod=function(e,t,r,n){return r||t||this.match(j.parenL)?(n&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,t,r),this.finishNode(e,"ObjectMethod")):this.isGetterOrSetterMethod(e,n)?((t||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),this.parseMethod(e),this.checkGetterSetterParamCount(e),this.finishNode(e,"ObjectMethod")):void 0},te.parseObjectProperty=function(e,t,r,n,i){return this.eat(j.colon)?(e.value=n?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,i),this.finishNode(e,"ObjectProperty")):e.computed||"Identifier"!==e.key.type?void 0:(n?(this.checkReservedWord(e.key.name,e.key.start,!0,!0),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):this.match(j.eq)&&i?(i.start||(i.start=this.state.start),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):e.value=e.key.__clone(),e.shorthand=!0,this.finishNode(e,"ObjectProperty"))},te.parseObjPropValue=function(e,t,r,n,i,s,a){var o=this.parseObjectMethod(e,n,i,s)||this.parseObjectProperty(e,t,r,s,a);return o||this.unexpected(),o},te.parsePropertyName=function(e){if(this.eat(j.bracketL))e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(j.bracketR);else{e.computed=!1;var t=this.state.inPropertyName;this.state.inPropertyName=!0,e.key=this.match(j.num)||this.match(j.string)?this.parseExprAtom():this.parseIdentifier(!0),this.state.inPropertyName=t}return e.key},te.initFunction=function(e,t){e.id=null,e.generator=!1,e.expression=!1,e.async=!!t},te.parseMethod=function(e,t,r){var n=this.state.inMethod;return this.state.inMethod=e.kind||!0,this.initFunction(e,r),this.expect(j.parenL),e.params=this.parseBindingList(j.parenR),e.generator=!!t,this.parseFunctionBody(e),this.state.inMethod=n,e},te.parseArrowExpression=function(e,t,r){return this.initFunction(e,r),e.params=this.toAssignableList(t,!0,"arrow function parameters"),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},te.isStrictBody=function(e,t){if(!t&&e.body.directives.length)for(var r=e.body.directives,n=Array.isArray(r),i=0,r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;if("use strict"===a.value.value)return!0}return!1},te.parseFunctionBody=function(e,t){var r=t&&!this.match(j.braceL),n=this.state.inAsync;if(this.state.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var i=this.state.inFunction,s=this.state.inGenerator,a=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=e.generator,this.state.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.state.inFunction=i,this.state.inGenerator=s,this.state.labels=a}this.state.inAsync=n;var o=this.isStrictBody(e,r),u=this.state.strict||t||o;if(o&&e.id&&"Identifier"===e.id.type&&"yield"===e.id.name&&this.raise(e.id.start,"Binding yield in strict mode"),u){var l=Object.create(null),c=this.state.strict;o&&(this.state.strict=!0),e.id&&this.checkLVal(e.id,!0,void 0,"function name");for(var p=e.params,h=Array.isArray(p),f=0,p=h?p:p[Symbol.iterator]();;){var d;if(h){if(f>=p.length)break;d=p[f++]}else{if(f=p.next(),f.done)break;d=f.value}var m=d;o&&"Identifier"!==m.type&&this.raise(m.start,"Non-simple parameter in strict mode"),this.checkLVal(m,!0,l,"function parameter list")}this.state.strict=c}},te.parseExprList=function(e,t,r){for(var n=[],i=!0;!this.eat(e);){if(i)i=!1;else if(this.expect(j.comma),this.eat(e))break;n.push(this.parseExprListItem(t,r))}return n},te.parseExprListItem=function(e,t,r){return e&&this.match(j.comma)?null:this.match(j.ellipsis)?this.parseSpread(t):this.parseMaybeAssign(!1,t,this.parseParenItem,r)},te.parseIdentifier=function(e){var t=this.startNode();return e||this.checkReservedWord(this.state.value,this.state.start,!!this.state.type.keyword,!1),this.match(j.name)?t.name=this.state.value:this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),!e&&"await"===t.name&&this.state.inAsync&&this.raise(t.start,"invalid use of await inside of an async function"),t.loc.identifierName=t.name,this.next(),this.finishNode(t,"Identifier")},te.checkReservedWord=function(e,t,r,n){(this.isReservedWord(e)||r&&this.isKeyword(e))&&this.raise(t,e+" is a reserved word"),this.state.strict&&(g.strict(e)||n&&g.strictBind(e))&&this.raise(t,e+" is a reserved word in strict mode")},te.parseAwait=function(e){return this.state.inAsync||this.unexpected(),this.match(j.star)&&this.raise(e.start,"await* has been removed from the async functions proposal. Use Promise.all() instead."),e.argument=this.parseMaybeUnary(),this.finishNode(e,"AwaitExpression")},te.parseYield=function(){var e=this.startNode();return this.next(),this.match(j.semi)||this.canInsertSemicolon()||!this.match(j.star)&&!this.state.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(j.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")};var re=z.prototype,ne=["leadingComments","trailingComments","innerComments"],ie=function(){function e(t,r,n){w(this,e),this.type="",this.start=t,this.end=0,this.loc=new q(r),n&&(this.loc.filename=n)}return e.prototype.__clone=function(){var t=new e;for(var r in this)ne.indexOf(r)<0&&(t[r]=this[r]);return t},e}();re.startNode=function(){return new ie(this.state.start,this.state.startLoc,this.filename)},re.startNodeAt=function(e,t){return new ie(e,t,this.filename)},re.finishNode=function(e,t){return p.call(this,e,t,this.state.lastTokEnd,this.state.lastTokEndLoc)},re.finishNodeAt=function(e,t,r,n){return p.call(this,e,t,r,n)},z.prototype.raise=function(e,t){var r=l(this.input,e);t+=" ("+r.line+":"+r.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=r,n};var se=z.prototype;se.addComment=function(e){this.filename&&(e.loc.filename=this.filename),this.state.trailingComments.push(e),this.state.leadingComments.push(e)},se.processComment=function(e){if(!("Program"===e.type&&e.body.length>0)){var t=this.state.commentStack,r=void 0,n=void 0,i=void 0,s=void 0;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=e.end?(n=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var a=h(t);t.length>0&&a.trailingComments&&a.trailingComments[0].start>=e.end&&(n=a.trailingComments,a.trailingComments=null)}for(;t.length>0&&h(t).start>=e.start;)r=t.pop();if(r){if(r.leadingComments)if(r!==e&&h(r.leadingComments).end<=e.start)e.leadingComments=r.leadingComments,r.leadingComments=null;else for(i=r.leadingComments.length-2;i>=0;--i)if(r.leadingComments[i].end<=e.start){e.leadingComments=r.leadingComments.splice(0,i+1);break}}else if(this.state.leadingComments.length>0)if(h(this.state.leadingComments).end<=e.start){if(this.state.commentPreviousNode)for(s=0;s0&&(e.leadingComments=this.state.leadingComments,this.state.leadingComments=[])}else{for(i=0;ie.start);i++);e.leadingComments=this.state.leadingComments.slice(0,i),0===e.leadingComments.length&&(e.leadingComments=null),n=this.state.leadingComments.slice(i),0===n.length&&(n=null)}this.state.commentPreviousNode=e,n&&(n.length&&n[0].start>=e.start&&h(n).end<=e.end?e.innerComments=n:e.trailingComments=n),t.push(e)}};var ae=z.prototype;ae.estreeParseRegExpLiteral=function(e){var t=e.pattern,r=e.flags,n=null;try{n=new RegExp(t,r)}catch(e){}var i=this.estreeParseLiteral(n);return i.regex={pattern:t,flags:r},i},ae.estreeParseLiteral=function(e){return this.parseLiteral(e,"Literal")},ae.directiveToStmt=function(e){var t=e.value,r=this.startNodeAt(e.start,e.loc.start),n=this.startNodeAt(t.start,t.loc.start);return n.value=t.value,n.raw=t.extra.raw,r.expression=this.finishNodeAt(n,"Literal",t.end,t.loc.end),r.directive=t.extra.raw.slice(1,-1),this.finishNodeAt(r,"ExpressionStatement",e.end,e.loc.end)};var oe=function(e){e.extend("checkDeclaration",function(e){return function(t){f(t)?this.checkDeclaration(t.value):e.call(this,t)}}),e.extend("checkGetterSetterParamCount",function(){return function(e){var t="get"===e.kind?0:1;if(e.value.params.length!==t){var r=e.start;"get"===e.kind?this.raise(r,"getter should have no params"):this.raise(r,"setter should have exactly one param")}}}),e.extend("checkLVal",function(e){return function(t,r,n){var i=this;switch(t.type){case"ObjectPattern":t.properties.forEach(function(e){i.checkLVal("Property"===e.type?e.value:e,r,n,"object destructuring pattern")});break;default:for(var s=arguments.length,a=Array(s>3?s-3:0),o=3;o0)for(var r=e.body.body,n=Array.isArray(r),i=0,r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if(i=r.next(),i.done)break;s=i.value}var a=s;if("ExpressionStatement"!==a.type||"Literal"!==a.expression.type)break;if("use strict"===a.expression.value)return!0}return!1}}),e.extend("isValidDirective",function(){return function(e){return!("ExpressionStatement"!==e.type||"Literal"!==e.expression.type||"string"!=typeof e.expression.value||e.expression.extra&&e.expression.extra.parenthesized)}}),e.extend("parseBlockBody",function(e){return function(t){for(var r=this,n=arguments.length,i=Array(n>1?n-1:0),s=1;s1?r-1:0),i=1;i1?n-1:0),s=1;s2?n-2:0),s=2;s=a.length)break;l=a[u++]}else{if(u=a.next(),u.done)break;l=u.value}var c=l;"get"===c.kind||"set"===c.kind?this.raise(c.key.start,"Object pattern can't contain getter or setter"):c.method?this.raise(c.key.start,"Object pattern can't contain methods"):this.toAssignable(c,r,"object destructuring pattern")}return t}return e.call.apply(e,[this,t,r].concat(i))}})},ue=["any","mixed","empty","bool","boolean","number","string","void","null"],le=z.prototype;le.flowParseTypeInitialiser=function(e){var t=this.state.inType;this.state.inType=!0,this.expect(e||j.colon);var r=this.flowParseType();return this.state.inType=t,r},le.flowParsePredicate=function(){var e=this.startNode(),t=this.state.startLoc,r=this.state.start;this.expect(j.modulo);var n=this.state.startLoc;return this.expectContextual("checks"),t.line===n.line&&t.column===n.column-1||this.raise(r,"Spaces between ´%´ and ´checks´ are not allowed here."),this.eat(j.parenL)?(e.expression=this.parseExpression(),this.expect(j.parenR),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")},le.flowParseTypeAndPredicateInitialiser=function(){var e=this.state.inType;this.state.inType=!0,this.expect(j.colon);var t=null,r=null;return this.match(j.modulo)?(this.state.inType=e,r=this.flowParsePredicate()):(t=this.flowParseType(),this.state.inType=e,this.match(j.modulo)&&(r=this.flowParsePredicate())),[t,r]},le.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},le.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdentifier(),r=this.startNode(),n=this.startNode();this.isRelational("<")?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(j.parenL);var i=this.flowParseFunctionTypeParams();r.params=i.params,r.rest=i.rest,this.expect(j.parenR);var s=null,a=this.flowParseTypeAndPredicateInitialiser();return r.returnType=a[0],s=a[1],n.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),n.predicate=s,t.typeAnnotation=this.finishNode(n,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},le.flowParseDeclare=function(e){return this.match(j._class)?this.flowParseDeclareClass(e):this.match(j._function)?this.flowParseDeclareFunction(e):this.match(j._var)?this.flowParseDeclareVariable(e):this.isContextual("module")?this.lookahead().type===j.dot?this.flowParseDeclareModuleExports(e):this.flowParseDeclareModule(e):this.isContextual("type")?this.flowParseDeclareTypeAlias(e):this.isContextual("interface")?this.flowParseDeclareInterface(e):void this.unexpected()},le.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},le.flowParseDeclareModule=function(e){this.next(),this.match(j.string)?e.id=this.parseExprAtom():e.id=this.parseIdentifier();var t=e.body=this.startNode(),r=t.body=[];for(this.expect(j.braceL);!this.match(j.braceR);){var n=this.startNode();if(this.match(j._import)){var i=this.lookahead();"type"!==i.value&&"typeof"!==i.value&&this.unexpected(null,"Imports within a `declare module` body must always be `import type` or `import typeof`"),this.parseImport(n)}else this.expectContextual("declare","Only declares and type imports are allowed inside declare module"),n=this.flowParseDeclare(n,!0);r.push(n)}return this.expect(j.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},le.flowParseDeclareModuleExports=function(e){return this.expectContextual("module"),this.expect(j.dot),this.expectContextual("exports"),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")},le.flowParseDeclareTypeAlias=function(e){return this.next(),this.flowParseTypeAlias(e),this.finishNode(e,"DeclareTypeAlias")},le.flowParseDeclareInterface=function(e){return this.next(),this.flowParseInterfaceish(e),this.finishNode(e,"DeclareInterface")},le.flowParseInterfaceish=function(e,t){if(e.id=this.parseIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],e.mixins=[],this.eat(j._extends))do{e.extends.push(this.flowParseInterfaceExtends())}while(this.eat(j.comma));if(this.isContextual("mixins")){this.next();do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(j.comma))}e.body=this.flowParseObjectType(t)},le.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")},le.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},le.flowParseRestrictedIdentifier=function(e){ +return ue.indexOf(this.state.value)>-1&&this.raise(this.state.start,"Cannot overwrite primitive type "+this.state.value),this.parseIdentifier(e)},le.flowParseTypeAlias=function(e){return e.id=this.flowParseRestrictedIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(j.eq),this.semicolon(),this.finishNode(e,"TypeAlias")},le.flowParseTypeParameter=function(){var e=this.startNode(),t=this.flowParseVariance(),r=this.flowParseTypeAnnotatableIdentifier();return e.name=r.name,e.variance=t,e.bound=r.typeAnnotation,this.match(j.eq)&&(this.eat(j.eq),e.default=this.flowParseType()),this.finishNode(e,"TypeParameter")},le.flowParseTypeParameterDeclaration=function(){var e=this.state.inType,t=this.startNode();t.params=[],this.state.inType=!0,this.isRelational("<")||this.match(j.jsxTagStart)?this.next():this.unexpected();do{t.params.push(this.flowParseTypeParameter()),this.isRelational(">")||this.expect(j.comma)}while(!this.isRelational(">"));return this.expectRelational(">"),this.state.inType=e,this.finishNode(t,"TypeParameterDeclaration")},le.flowParseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseType()),this.isRelational(">")||this.expect(j.comma);return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")},le.flowParseObjectPropertyKey=function(){return this.match(j.num)||this.match(j.string)?this.parseExprAtom():this.parseIdentifier(!0)},le.flowParseObjectTypeIndexer=function(e,t,r){return e.static=t,this.expect(j.bracketL),this.lookahead().type===j.colon?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(j.bracketR),e.value=this.flowParseTypeInitialiser(),e.variance=r,this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},le.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(j.parenL);this.match(j.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(j.parenR)||this.expect(j.comma);return this.eat(j.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),this.expect(j.parenR),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},le.flowParseObjectTypeMethod=function(e,t,r,n){var i=this.startNodeAt(e,t);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e,t)),i.static=r,i.key=n,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},le.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e.static=t,e.value=this.flowParseObjectTypeMethodish(r),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},le.flowParseObjectType=function(e,t){var r=this.state.inType;this.state.inType=!0;var n=this.startNode(),i=void 0,s=void 0,a=!1;n.callProperties=[],n.properties=[],n.indexers=[];var o=void 0,u=void 0;for(t&&this.match(j.braceBarL)?(this.expect(j.braceBarL),o=j.braceBarR,u=!0):(this.expect(j.braceL),o=j.braceR,u=!1),n.exact=u;!this.match(o);){var l=!1,c=this.state.start,p=this.state.startLoc;i=this.startNode(),e&&this.isContextual("static")&&this.lookahead().type!==j.colon&&(this.next(),a=!0);var h=this.state.start,f=this.flowParseVariance();this.match(j.bracketL)?n.indexers.push(this.flowParseObjectTypeIndexer(i,a,f)):this.match(j.parenL)||this.isRelational("<")?(f&&this.unexpected(h),n.callProperties.push(this.flowParseObjectTypeCallProperty(i,a))):(s=this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(j.parenL)?(f&&this.unexpected(h),n.properties.push(this.flowParseObjectTypeMethod(c,p,a,s))):(this.eat(j.question)&&(l=!0),i.key=s,i.value=this.flowParseTypeInitialiser(),i.optional=l,i.static=a,i.variance=f,this.flowObjectTypeSemicolon(),n.properties.push(this.finishNode(i,"ObjectTypeProperty")))),a=!1}this.expect(o);var d=this.finishNode(n,"ObjectTypeAnnotation");return this.state.inType=r,d},le.flowObjectTypeSemicolon=function(){this.eat(j.semi)||this.eat(j.comma)||this.match(j.braceR)||this.match(j.braceBarR)||this.unexpected()},le.flowParseQualifiedTypeIdentifier=function(e,t,r){e=e||this.state.start,t=t||this.state.startLoc;for(var n=r||this.parseIdentifier();this.eat(j.dot);){var i=this.startNodeAt(e,t);i.qualification=n,i.id=this.parseIdentifier(),n=this.finishNode(i,"QualifiedTypeIdentifier")}return n},le.flowParseGenericType=function(e,t,r){var n=this.startNodeAt(e,t);return n.typeParameters=null,n.id=this.flowParseQualifiedTypeIdentifier(e,t,r),this.isRelational("<")&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},le.flowParseTypeofType=function(){var e=this.startNode();return this.expect(j._typeof),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},le.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(j.bracketL);this.state.pos0&&void 0!==arguments[0]?arguments[0]:[],t={params:e,rest:null};!this.match(j.parenR)&&!this.match(j.ellipsis);)t.params.push(this.flowParseFunctionTypeParam()),this.match(j.parenR)||this.expect(j.comma);return this.eat(j.ellipsis)&&(t.rest=this.flowParseFunctionTypeParam()),t},le.flowIdentToTypeAnnotation=function(e,t,r,n){switch(n.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"void":return this.finishNode(r,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"empty":return this.finishNode(r,"EmptyTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");default:return this.flowParseGenericType(e,t,n)}},le.flowParsePrimaryType=function(){var e=this.state.start,t=this.state.startLoc,r=this.startNode(),n=void 0,i=void 0,s=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case j.name:return this.flowIdentToTypeAnnotation(e,t,r,this.parseIdentifier());case j.braceL:return this.flowParseObjectType(!1,!1);case j.braceBarL:return this.flowParseObjectType(!1,!0);case j.bracketL:return this.flowParseTupleType();case j.relational:if("<"===this.state.value)return r.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(j.parenL),n=this.flowParseFunctionTypeParams(),r.params=n.params,r.rest=n.rest,this.expect(j.parenR),this.expect(j.arrow),r.returnType=this.flowParseType(),this.finishNode(r,"FunctionTypeAnnotation");break;case j.parenL:if(this.next(),!this.match(j.parenR)&&!this.match(j.ellipsis))if(this.match(j.name)){var o=this.lookahead().type;s=o!==j.question&&o!==j.colon}else s=!0;if(s){if(this.state.noAnonFunctionType=!1,i=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(j.comma)||this.match(j.parenR)&&this.lookahead().type===j.arrow))return this.expect(j.parenR),i;this.eat(j.comma)}return n=i?this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(i)]):this.flowParseFunctionTypeParams(),r.params=n.params,r.rest=n.rest,this.expect(j.parenR),this.expect(j.arrow),r.returnType=this.flowParseType(),r.typeParameters=null,this.finishNode(r,"FunctionTypeAnnotation");case j.string:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case j._true:case j._false:return r.value=this.match(j._true),this.next(),this.finishNode(r,"BooleanLiteralTypeAnnotation");case j.plusMin:if("-"===this.state.value)return this.next(),this.match(j.num)||this.unexpected(null,"Unexpected token, expected number"),this.parseLiteral(-this.state.value,"NumericLiteralTypeAnnotation",r.start,r.loc.start);this.unexpected();case j.num:return this.parseLiteral(this.state.value,"NumericLiteralTypeAnnotation");case j._null:return r.value=this.match(j._null),this.next(),this.finishNode(r,"NullLiteralTypeAnnotation");case j._this:return r.value=this.match(j._this),this.next(),this.finishNode(r,"ThisTypeAnnotation");case j.star:return this.next(),this.finishNode(r,"ExistentialTypeParam");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},le.flowParsePostfixType=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.flowParsePrimaryType();!this.canInsertSemicolon()&&this.match(j.bracketL);){var n=this.startNodeAt(e,t);n.elementType=r,this.expect(j.bracketL),this.expect(j.bracketR),r=this.finishNode(n,"ArrayTypeAnnotation")}return r},le.flowParsePrefixType=function(){var e=this.startNode();return this.eat(j.question)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()},le.flowParseAnonFunctionWithoutParens=function(){var e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(j.arrow)){var t=this.startNodeAt(e.start,e.loc);return t.params=[this.reinterpretTypeAsFunctionTypeParam(e)],t.rest=null,t.returnType=this.flowParseType(),t.typeParameters=null,this.finishNode(t,"FunctionTypeAnnotation")}return e},le.flowParseIntersectionType=function(){var e=this.startNode();this.eat(j.bitwiseAND);var t=this.flowParseAnonFunctionWithoutParens();for(e.types=[t];this.eat(j.bitwiseAND);)e.types.push(this.flowParseAnonFunctionWithoutParens());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},le.flowParseUnionType=function(){var e=this.startNode();this.eat(j.bitwiseOR);var t=this.flowParseIntersectionType();for(e.types=[t];this.eat(j.bitwiseOR);)e.types.push(this.flowParseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},le.flowParseType=function(){var e=this.state.inType;this.state.inType=!0;var t=this.flowParseUnionType();return this.state.inType=e,t},le.flowParseTypeAnnotation=function(){var e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")},le.flowParseTypeAndPredicateAnnotation=function(){var e=this.startNode(),t=this.flowParseTypeAndPredicateInitialiser();return e.typeAnnotation=t[0],e.predicate=t[1],this.finishNode(e,"TypeAnnotation")},le.flowParseTypeAnnotatableIdentifier=function(){var e=this.flowParseRestrictedIdentifier();return this.match(j.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(e,e.type)),e},le.typeCastToParameter=function(e){return e.expression.typeAnnotation=e.typeAnnotation,this.finishNodeAt(e.expression,e.expression.type,e.typeAnnotation.end,e.typeAnnotation.loc.end)},le.flowParseVariance=function(){var e=null;return this.match(j.plusMin)&&("+"===this.state.value?e="plus":"-"===this.state.value&&(e="minus"),this.next()),e};var ce=function(e){e.extend("parseFunctionBody",function(e){return function(t,r){return this.match(j.colon)&&!r&&(t.returnType=this.flowParseTypeAndPredicateAnnotation()),e.call(this,t,r)}}),e.extend("parseStatement",function(e){return function(t,r){if(this.state.strict&&this.match(j.name)&&"interface"===this.state.value){var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t,r)}}),e.extend("parseExpressionStatement",function(e){return function(t,r){if("Identifier"===r.type)if("declare"===r.name){if(this.match(j._class)||this.match(j.name)||this.match(j._function)||this.match(j._var))return this.flowParseDeclare(t)}else if(this.match(j.name)){if("interface"===r.name)return this.flowParseInterface(t);if("type"===r.name)return this.flowParseTypeAlias(t)}return e.call(this,t,r)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||this.isContextual("interface")||e.call(this)}}),e.extend("parseConditional",function(e){return function(t,r,n,i,s){if(s&&this.match(j.question)){var a=this.state.clone();try{return e.call(this,t,r,n,i)}catch(e){if(e instanceof SyntaxError)return this.state=a,s.start=e.pos||this.state.start,t;throw e}}return e.call(this,t,r,n,i)}}),e.extend("parseParenItem",function(e){return function(t,r,n){if(t=e.call(this,t,r,n),this.eat(j.question)&&(t.optional=!0),this.match(j.colon)){var i=this.startNodeAt(r,n);return i.expression=t,i.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(i,"TypeCastExpression")}return t}}),e.extend("parseExport",function(e){return function(t){return t=e.call(this,t),"ExportNamedDeclaration"===t.type&&(t.exportKind=t.exportKind||"value"),t}}),e.extend("parseExportDeclaration",function(e){return function(t){if(this.isContextual("type")){t.exportKind="type";var r=this.startNode();return this.next(),this.match(j.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(r)}if(this.isContextual("interface")){t.exportKind="type";var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t)}}),e.extend("parseClassId",function(e){return function(t){e.apply(this,arguments),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}}),e.extend("isKeyword",function(e){return function(t){return(!this.state.inType||"void"!==t)&&e.call(this,t)}}),e.extend("readToken",function(e){return function(t){return!this.state.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(j.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){if(!this.state.inType)return e.call(this)}}),e.extend("toAssignable",function(e){return function(t,r,n){return"TypeCastExpression"===t.type?e.call(this,this.typeCastToParameter(t),r,n):e.call(this,t,r,n)}}),e.extend("toAssignableList",function(e){return function(t,r,n){for(var i=0;i2?n-2:0),s=2;s1114111||fe(a)!=a)throw RangeError("Invalid code point: "+a);a<=65535?e.push(a):(a-=65536,t=55296+(a>>10),r=a%1024+56320,e.push(t,r)),(n+1==i||e.length>16384)&&(s+=he.apply(null,e),e.length=0)}return s}}var de=pe,me={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},ye=/^[\da-fA-F]+$/,ge=/^\d+$/;U.j_oTag=new R("...",!0,!0),j.jsxName=new P("jsxName"),j.jsxText=new P("jsxText",{beforeExpr:!0}),j.jsxTagStart=new P("jsxTagStart",{startsExpr:!0}),j.jsxTagEnd=new P("jsxTagEnd"),j.jsxTagStart.updateContext=function(){this.state.context.push(U.j_expr),this.state.context.push(U.j_oTag),this.state.exprAllowed=!1},j.jsxTagEnd.updateContext=function(e){var t=this.state.context.pop();t===U.j_oTag&&e===j.slash||t===U.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===U.j_expr):this.state.exprAllowed=!0};var be=z.prototype;be.jsxReadToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:return this.state.pos===this.state.start?60===r&&this.state.exprAllowed?(++this.state.pos,this.finishToken(j.jsxTagStart)):this.getTokenFromCode(r):(e+=this.input.slice(t,this.state.pos),this.finishToken(j.jsxText,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:u(r)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}},be.jsxReadNewLine=function(e){var t=this.input.charCodeAt(this.state.pos),r=void 0;return++this.state.pos,13===t&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,r=e?"\n":"\r\n"):r=String.fromCharCode(t),++this.state.curLine,this.state.lineStart=this.state.pos,r},be.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;38===n?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):u(n)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}return t+=this.input.slice(r,this.state.pos++),this.finishToken(j.string,t)},be.jsxReadEntity=function(){for(var e="",t=0,r=void 0,n=this.input[this.state.pos],i=++this.state.pos;this.state.pos")}return r.openingElement=i,r.closingElement=s,r.children=n,this.match(j.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(r,"JSXElement")},be.jsxParseElement=function(){var e=this.state.start,t=this.state.startLoc;return this.next(),this.jsxParseElementAt(e,t)};var ve=function(e){e.extend("parseExprAtom",function(e){return function(t){if(this.match(j.jsxText)){var r=this.parseLiteral(this.state.value,"JSXText");return r.extra=null,r}return this.match(j.jsxTagStart)?this.jsxParseElement():e.call(this,t)}}),e.extend("readToken",function(e){return function(t){if(this.state.inPropertyName)return e.call(this,t);var r=this.curContext();if(r===U.j_expr)return this.jsxReadToken();if(r===U.j_oTag||r===U.j_cTag){if(s(t))return this.jsxReadWord();if(62===t)return++this.state.pos,this.finishToken(j.jsxTagEnd);if((34===t||39===t)&&r===U.j_oTag)return this.jsxReadString(t)}return 60===t&&this.state.exprAllowed?(++this.state.pos,this.finishToken(j.jsxTagStart)):e.call(this,t)}}),e.extend("updateContext",function(e){return function(t){if(this.match(j.braceL)){var r=this.curContext();r===U.j_oTag?this.state.context.push(U.braceExpression):r===U.j_expr?this.state.context.push(U.templateQuasi):e.call(this,t),this.state.exprAllowed=!0}else{if(!this.match(j.slash)||t!==j.jsxTagStart)return e.call(this,t);this.state.context.length-=2,this.state.context.push(U.j_cTag),this.state.exprAllowed=!1}}})};W.estree=oe,W.flow=ce,W.jsx=ve,r.parse=m,r.parseExpression=y,r.tokTypes=j},{}],178:[function(e,t,r){function n(e,t,r){e instanceof RegExp&&(e=i(e,r)),t instanceof RegExp&&(t=i(t,r));var n=s(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function i(e,t){var r=t.match(e);return r?r[0]:null}function s(e,t,r){var n,i,s,a,o,u=r.indexOf(e),l=r.indexOf(t,u+1),c=u;if(u>=0&&l>0){for(n=[],s=r.length;c>=0&&!o;)c==u?(n.push(c), +u=r.indexOf(e,c+1)):1==n.length?o=[n.pop(),l]:(i=n.pop(),i=0?u:l;n.length&&(o=[s,a])}return o}t.exports=n,n.range=s},{}],179:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-n(e)}function s(e){var t,r,i,s,a,o,u=e.length;a=n(e),o=new p(3*u/4-a),i=a>0?u-4:u;var l=0;for(t=0,r=0;t>16&255,o[l++]=s>>8&255,o[l++]=255&s;return 2===a?(s=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,o[l++]=255&s):1===a&&(s=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,o[l++]=s>>8&255,o[l++]=255&s),o}function a(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function o(e,t,r){for(var n,i=[],s=t;su?u:a+16383));return 1===n?(t=e[r-1],i+=l[t>>2],i+=l[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=l[t>>10],i+=l[t>>4&63],i+=l[t<<2&63],i+="="),s.push(i),s.join("")}r.byteLength=i,r.toByteArray=s,r.fromByteArray=u;for(var l=[],c=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=h.length;f=t}function h(e,t){var r=[],i=d("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),m=s||o,y=/^(.*,)+(.+)?$/.test(i.body);if(!m&&!y)return i.post.match(/,.*\}/)?(e=i.pre+"{"+i.body+g+i.post,h(e)):[e];var b;if(m)b=i.body.split(/\.\./);else if(b=a(i.body),1===b.length&&(b=h(b[0],!1).map(u),1===b.length)){var v=i.post.length?h(i.post,!1):[""];return v.map(function(e){return i.pre+b[0]+e})}var x,E=i.pre,v=i.post.length?h(i.post,!1):[""];if(m){var A=n(b[0]),D=n(b[1]),C=Math.max(b[0].length,b[1].length),S=3==b.length?Math.abs(n(b[2])):1,_=c;D0){var P=new Array(T+1).join("0");F=k<0?"-"+P+F.slice(1):P+F}}x.push(F)}}else x=f(b,function(e){return h(e,!1)});for(var B=0;Ba)throw new RangeError("size is too large");var n=r,s=t;void 0===s&&(n=void 0,s=0);var o=new i(e);if("string"==typeof s)for(var u=new i(s,n),l=u.length,c=-1;++ca)throw new RangeError("size is too large");return new i(e)},r.from=function(e,r,n){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,r,n);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,r);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var s=r;if(1===arguments.length)return new i(e);void 0===s&&(s=0);var a=n;if(void 0===a&&(a=e.byteLength-s),s>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(a>e.byteLength-s)throw new RangeError("'length' is out of bounds");return new i(e.slice(s,s+a))}if(i.isBuffer(e)){var o=new i(e.length);return e.copy(o,0,0,e.length),o}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},r.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new s(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:184}],184:[function(e,t,r){"use strict";function n(e){if(e>Y)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(e)}return s(e,t,r)}function s(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return e instanceof ArrayBuffer?p(e,t,r):"string"==typeof e?l(e,t):h(e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function o(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function u(e){return a(e),n(e<0?0:0|f(e))}function l(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(e,t),s=n(r),a=s.write(e,t);return a!==r&&(s=s.slice(0,a)),s}function c(e){for(var t=e.length<0?0:0|f(e.length),r=n(t),i=0;i=Y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y.toString(16)+" bytes");return 0|e}function d(e){return+e!=e&&(e=0),i.alloc(+e)}function m(e,t){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return V(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return F(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return _(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){function s(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,u/=2,r/=2}var l;if(i){var c=-1;for(l=r;lo&&(r=o-u),l=r;l>=0;l--){for(var p=!0,h=0;hi&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var a=0;a239?4:s>223?3:s>191?2:1;if(i+o<=r){var u,l,c,p;switch(o){case 1:s<128&&(a=s);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&s)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&s)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&s)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=o}return k(n)}function k(e){var t=e.length;if(t<=H)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,s,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,n,i){return t=+t,r>>>=0,i||N(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,i){return t=+t,r>>>=0,i||N(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function M(e){if(e=R(e).replace($,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function R(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function q(e){for(var t=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function X(e){return K.toByteArray(M(e))}function J(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function W(e){return e!==e}var K=e("base64-js"),z=e("ieee754");r.Buffer=i,r.SlowBuffer=d,r.INSPECT_MAX_BYTES=50;var Y=2147483647;r.kMaxLength=Y,i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return s(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return o(e,t,r)},i.allocUnsafe=function(e){return u(e)},i.allocUnsafeSlow=function(e){return u(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,s=0,a=Math.min(r,n);s0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var a=s-n,o=r-t,u=Math.min(a,o),l=this.slice(n,s),c=e.slice(t,r),p=0;p>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return x(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return A(this,e,t,r);case"latin1":case"binary":return D(this,e,t,r);case"base64":return C(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||O(e,t,this.length);for(var n=this[e],i=1,s=0;++s>>=0,t>>>=0,r||O(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);for(var n=this[e],i=1,s=0;++s=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),z.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),z.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),z.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),z.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){j(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!n){j(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);j(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);j(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(s<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a1)for(var n=1;n0;i--)if(t=n[i],~t.indexOf("sourceMappingURL=data:"))return r.fromComment(t)}var u=e("fs"),l=e("path"),c=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+;)?base64,(.*)$/gm,p=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;a.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},a.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},a.prototype.toComment=function(e){var t=this.toBase64(),r="sourceMappingURL=data:application/json;base64,"+t;return e&&e.multiline?"/*# "+r+" */":"//# "+r},a.prototype.toObject=function(){return JSON.parse(this.toJSON())},a.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)},a.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},a.prototype.getProperty=function(e){return this.sourcemap[e]},r.fromObject=function(e){return new a(e)},r.fromJSON=function(e){return new a(e,{isJSON:!0})},r.fromBase64=function(e){return new a(e,{isEncoded:!0})},r.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new a(e,{isEncoded:!0,hasComment:!0})},r.fromMapFileComment=function(e,t){return new a(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},r.fromSource=function(e,t){if(t){var n=o(e);return n||null}var i=e.match(c);return c.lastIndex=0,i?r.fromComment(i.pop()):null},r.fromMapFileSource=function(e,t){var n=e.match(p);return p.lastIndex=0,n?r.fromMapFileComment(n.pop(),t):null},r.removeComments=function(e){return c.lastIndex=0,e.replace(c,"")},r.removeMapFileComments=function(e){return p.lastIndex=0,e.replace(p,"")},Object.defineProperty(r,"commentRegex",{get:function(){return c.lastIndex=0,c}}),Object.defineProperty(r,"mapFileCommentRegex",{get:function(){return p.lastIndex=0,p}})}).call(this,e("buffer").Buffer)},{buffer:184,fs:182,path:535}],188:[function(e,t,r){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.get-iterator")},{"../modules/core.get-iterator":277,"../modules/es6.string.iterator":286,"../modules/web.dom.iterable":293}],189:[function(e,t,r){var n=e("../../modules/_core"),i=n.JSON||(n.JSON={stringify:JSON.stringify});t.exports=function(e){return i.stringify.apply(i,arguments)}},{"../../modules/_core":217}],190:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.map"),e("../modules/es7.map.to-json"),t.exports=e("../modules/_core").Map},{"../modules/_core":217,"../modules/es6.map":279,"../modules/es6.object.to-string":285,"../modules/es6.string.iterator":286,"../modules/es7.map.to-json":290,"../modules/web.dom.iterable":293}],191:[function(e,t,r){e("../../modules/es6.number.max-safe-integer"),t.exports=9007199254740991},{"../../modules/es6.number.max-safe-integer":280}],192:[function(e,t,r){e("../../modules/es6.object.assign"),t.exports=e("../../modules/_core").Object.assign},{"../../modules/_core":217,"../../modules/es6.object.assign":281}],193:[function(e,t,r){e("../../modules/es6.object.create");var n=e("../../modules/_core").Object;t.exports=function(e,t){return n.create(e,t)}},{"../../modules/_core":217,"../../modules/es6.object.create":282}],194:[function(e,t,r){e("../../modules/es6.symbol"),t.exports=e("../../modules/_core").Object.getOwnPropertySymbols},{"../../modules/_core":217,"../../modules/es6.symbol":287}],195:[function(e,t,r){e("../../modules/es6.object.keys"),t.exports=e("../../modules/_core").Object.keys},{"../../modules/_core":217,"../../modules/es6.object.keys":283}],196:[function(e,t,r){e("../../modules/es6.object.set-prototype-of"),t.exports=e("../../modules/_core").Object.setPrototypeOf},{"../../modules/_core":217,"../../modules/es6.object.set-prototype-of":284}],197:[function(e,t,r){e("../../modules/es6.symbol"),t.exports=e("../../modules/_core").Symbol.for},{"../../modules/_core":217,"../../modules/es6.symbol":287}],198:[function(e,t,r){e("../../modules/es6.symbol"),e("../../modules/es6.object.to-string"),e("../../modules/es7.symbol.async-iterator"),e("../../modules/es7.symbol.observable"),t.exports=e("../../modules/_core").Symbol},{"../../modules/_core":217,"../../modules/es6.object.to-string":285,"../../modules/es6.symbol":287,"../../modules/es7.symbol.async-iterator":291,"../../modules/es7.symbol.observable":292}],199:[function(e,t,r){e("../../modules/es6.string.iterator"),e("../../modules/web.dom.iterable"),t.exports=e("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":274,"../../modules/es6.string.iterator":286,"../../modules/web.dom.iterable":293}],200:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/web.dom.iterable"),e("../modules/es6.weak-map"),t.exports=e("../modules/_core").WeakMap},{"../modules/_core":217,"../modules/es6.object.to-string":285,"../modules/es6.weak-map":288,"../modules/web.dom.iterable":293}],201:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/web.dom.iterable"),e("../modules/es6.weak-set"), +t.exports=e("../modules/_core").WeakSet},{"../modules/_core":217,"../modules/es6.object.to-string":285,"../modules/es6.weak-set":289,"../modules/web.dom.iterable":293}],202:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],203:[function(e,t,r){t.exports=function(){}},{}],204:[function(e,t,r){t.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},{}],205:[function(e,t,r){var n=e("./_is-object");t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":235}],206:[function(e,t,r){var n=e("./_for-of");t.exports=function(e,t){var r=[];return n(e,!1,r.push,r,t),r}},{"./_for-of":226}],207:[function(e,t,r){var n=e("./_to-iobject"),i=e("./_to-length"),s=e("./_to-index");t.exports=function(e){return function(t,r,a){var o,u=n(t),l=i(u.length),c=s(a,l);if(e&&r!=r){for(;l>c;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},{"./_to-index":266,"./_to-iobject":268,"./_to-length":269}],208:[function(e,t,r){var n=e("./_ctx"),i=e("./_iobject"),s=e("./_to-object"),a=e("./_to-length"),o=e("./_array-species-create");t.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,p=6==e,h=5==e||p,f=t||o;return function(t,o,d){for(var m,y,g=s(t),b=i(g),v=n(o,d,3),x=a(b.length),E=0,A=r?f(t,x):u?f(t,0):void 0;x>E;E++)if((h||E in b)&&(m=b[E],y=v(m,E,g),e))if(r)A[E]=y;else if(y)switch(e){case 3:return!0;case 5:return m;case 6:return E;case 2:A.push(m)}else if(c)return!1;return p?-1:l||c?c:A}}},{"./_array-species-create":210,"./_ctx":218,"./_iobject":232,"./_to-length":269,"./_to-object":270}],209:[function(e,t,r){var n=e("./_is-object"),i=e("./_is-array"),s=e("./_wks")("species");t.exports=function(e){var t;return i(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[s])&&(t=void 0)),void 0===t?Array:t}},{"./_is-array":234,"./_is-object":235,"./_wks":275}],210:[function(e,t,r){var n=e("./_array-species-constructor");t.exports=function(e,t){return new(n(e))(t)}},{"./_array-species-constructor":209}],211:[function(e,t,r){var n=e("./_cof"),i=e("./_wks")("toStringTag"),s="Arguments"==n(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};t.exports=function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=a(t=Object(e),i))?r:s?n(t):"Object"==(o=n(t))&&"function"==typeof t.callee?"Arguments":o}},{"./_cof":212,"./_wks":275}],212:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],213:[function(e,t,r){"use strict";var n=e("./_object-dp").f,i=e("./_object-create"),s=e("./_redefine-all"),a=e("./_ctx"),o=e("./_an-instance"),u=e("./_defined"),l=e("./_for-of"),c=e("./_iter-define"),p=e("./_iter-step"),h=e("./_set-species"),f=e("./_descriptors"),d=e("./_meta").fastKey,m=f?"_s":"size",y=function(e,t){var r,n=d(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(e,t,r,c){var p=e(function(e,n){o(e,p,t,"_i"),e._i=i(null),e._f=void 0,e._l=void 0,e[m]=0,void 0!=n&&l(n,r,e[c],e)});return s(p.prototype,{clear:function(){for(var e=this,t=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete t[r.i];e._f=e._l=void 0,e[m]=0},delete:function(e){var t=this,r=y(t,e);if(r){var n=r.n,i=r.p;delete t._i[r.i],r.r=!0,i&&(i.n=n),n&&(n.p=i),t._f==r&&(t._f=n),t._l==r&&(t._l=i),t[m]--}return!!r},forEach:function(e){o(this,p,"forEach");for(var t,r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.n:this._f;)for(r(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!y(this,e)}}),f&&n(p.prototype,"size",{get:function(){return u(this[m])}}),p},def:function(e,t,r){var n,i,s=y(e,t);return s?s.v=r:(e._l=s={i:i=d(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=s),n&&(n.n=s),e[m]++,"F"!==i&&(e._i[i]=s)),e},getEntry:y,setStrong:function(e,t,r){c(e,t,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?p(0,r.k):"values"==t?p(0,r.v):p(0,[r.k,r.v]):(e._t=void 0,p(1))},r?"entries":"values",!r,!0),h(t)}}},{"./_an-instance":204,"./_ctx":218,"./_defined":219,"./_descriptors":220,"./_for-of":226,"./_iter-define":238,"./_iter-step":239,"./_meta":243,"./_object-create":245,"./_object-dp":246,"./_redefine-all":258,"./_set-species":261}],214:[function(e,t,r){var n=e("./_classof"),i=e("./_array-from-iterable");t.exports=function(e){return function(){if(n(this)!=e)throw TypeError(e+"#toJSON isn't generic");return i(this)}}},{"./_array-from-iterable":206,"./_classof":211}],215:[function(e,t,r){"use strict";var n=e("./_redefine-all"),i=e("./_meta").getWeak,s=e("./_an-object"),a=e("./_is-object"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_array-methods"),c=e("./_has"),p=l(5),h=l(6),f=0,d=function(e){return e._l||(e._l=new m)},m=function(){this.a=[]},y=function(e,t){return p(e.a,function(e){return e[0]===t})};m.prototype={get:function(e){var t=y(this,e);if(t)return t[1]},has:function(e){return!!y(this,e)},set:function(e,t){var r=y(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=h(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(e,t,r,s){var l=e(function(e,n){o(e,l,t,"_i"),e._i=f++,e._l=void 0,void 0!=n&&u(n,r,e[s],e)});return n(l.prototype,{delete:function(e){if(!a(e))return!1;var t=i(e);return!0===t?d(this).delete(e):t&&c(t,this._i)&&delete t[this._i]},has:function(e){if(!a(e))return!1;var t=i(e);return!0===t?d(this).has(e):t&&c(t,this._i)}}),l},def:function(e,t,r){var n=i(s(t),!0);return!0===n?d(e).set(t,r):n[e._i]=r,e},ufstore:d}},{"./_an-instance":204,"./_an-object":205,"./_array-methods":208,"./_for-of":226,"./_has":228,"./_is-object":235,"./_meta":243,"./_redefine-all":258}],216:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_export"),s=e("./_meta"),a=e("./_fails"),o=e("./_hide"),u=e("./_redefine-all"),l=e("./_for-of"),c=e("./_an-instance"),p=e("./_is-object"),h=e("./_set-to-string-tag"),f=e("./_object-dp").f,d=e("./_array-methods")(0),m=e("./_descriptors");t.exports=function(e,t,r,y,g,b){var v=n[e],x=v,E=g?"set":"add",A=x&&x.prototype,D={};return m&&"function"==typeof x&&(b||A.forEach&&!a(function(){(new x).entries().next()}))?(x=t(function(t,r){c(t,x,e,"_c"),t._c=new v,void 0!=r&&l(r,g,t[E],t)}),d("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in A&&(!b||"clear"!=e)&&o(x.prototype,e,function(r,n){if(c(this,x,e),!t&&b&&!p(r))return"get"==e&&void 0;var i=this._c[e](0===r?0:r,n);return t?this:i})}),"size"in A&&f(x.prototype,"size",{get:function(){return this._c.size}})):(x=y.getConstructor(t,e,g,E),u(x.prototype,r),s.NEED=!0),h(x,e),D[e]=x,i(i.G+i.W+i.F,D),b||y.setStrong(x,e,g),x}},{"./_an-instance":204,"./_array-methods":208,"./_descriptors":220,"./_export":224,"./_fails":225,"./_for-of":226,"./_global":227,"./_hide":229,"./_is-object":235,"./_meta":243,"./_object-dp":246,"./_redefine-all":258,"./_set-to-string-tag":262}],217:[function(e,t,r){var n=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},{}],218:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":202}],219:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],220:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":225}],221:[function(e,t,r){var n=e("./_is-object"),i=e("./_global").document,s=n(i)&&n(i.createElement);t.exports=function(e){return s?i.createElement(e):{}}},{"./_global":227,"./_is-object":235}],222:[function(e,t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],223:[function(e,t,r){var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie");t.exports=function(e){var t=n(e),r=i.f;if(r)for(var a,o=r(e),u=s.f,l=0;o.length>l;)u.call(e,a=o[l++])&&t.push(a);return t}},{"./_object-gops":251,"./_object-keys":254,"./_object-pie":255}],224:[function(e,t,r){var n=e("./_global"),i=e("./_core"),s=e("./_ctx"),a=e("./_hide"),o=function(e,t,r){var u,l,c,p=e&o.F,h=e&o.G,f=e&o.S,d=e&o.P,m=e&o.B,y=e&o.W,g=h?i:i[t]||(i[t]={}),b=g.prototype,v=h?n:f?n[t]:(n[t]||{}).prototype;h&&(r=t);for(u in r)(l=!p&&v&&void 0!==v[u])&&u in g||(c=l?v[u]:r[u],g[u]=h&&"function"!=typeof v[u]?r[u]:m&&l?s(c,n):y&&v[u]==c?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(c):d&&"function"==typeof c?s(Function.call,c):c,d&&((g.virtual||(g.virtual={}))[u]=c,e&o.R&&b&&!b[u]&&a(b,u,c)))};o.F=1,o.G=2,o.S=4,o.P=8,o.B=16,o.W=32,o.U=64,o.R=128,t.exports=o},{"./_core":217,"./_ctx":218,"./_global":227,"./_hide":229}],225:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],226:[function(e,t,r){var n=e("./_ctx"),i=e("./_iter-call"),s=e("./_is-array-iter"),a=e("./_an-object"),o=e("./_to-length"),u=e("./core.get-iterator-method"),l={},c={},r=t.exports=function(e,t,r,p,h){var f,d,m,y,g=h?function(){return e}:u(e),b=n(r,p,t?2:1),v=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(s(g)){for(f=o(e.length);f>v;v++)if((y=t?b(a(d=e[v])[0],d[1]):b(e[v]))===l||y===c)return y}else for(m=g.call(e);!(d=m.next()).done;)if((y=i(m,b,d.value,t))===l||y===c)return y};r.BREAK=l,r.RETURN=c},{"./_an-object":205,"./_ctx":218,"./_is-array-iter":233,"./_iter-call":236,"./_to-length":269,"./core.get-iterator-method":276}],227:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],228:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],229:[function(e,t,r){var n=e("./_object-dp"),i=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":220,"./_object-dp":246,"./_property-desc":257}],230:[function(e,t,r){t.exports=e("./_global").document&&document.documentElement},{"./_global":227}],231:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":220,"./_dom-create":221,"./_fails":225}],232:[function(e,t,r){var n=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{"./_cof":212}],233:[function(e,t,r){var n=e("./_iterators"),i=e("./_wks")("iterator"),s=Array.prototype;t.exports=function(e){return void 0!==e&&(n.Array===e||s[i]===e)}},{"./_iterators":240,"./_wks":275}],234:[function(e,t,r){var n=e("./_cof");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"./_cof":212}],235:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],236:[function(e,t,r){var n=e("./_an-object");t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var s=e.return;throw void 0!==s&&n(s.call(e)),t}}},{"./_an-object":205}],237:[function(e,t,r){"use strict";var n=e("./_object-create"),i=e("./_property-desc"),s=e("./_set-to-string-tag"),a={};e("./_hide")(a,e("./_wks")("iterator"),function(){return this}),t.exports=function(e,t,r){e.prototype=n(a,{next:i(1,r)}),s(e,t+" Iterator")}},{"./_hide":229,"./_object-create":245,"./_property-desc":257,"./_set-to-string-tag":262,"./_wks":275}],238:[function(e,t,r){"use strict";var n=e("./_library"),i=e("./_export"),s=e("./_redefine"),a=e("./_hide"),o=e("./_has"),u=e("./_iterators"),l=e("./_iter-create"),c=e("./_set-to-string-tag"),p=e("./_object-gpo"),h=e("./_wks")("iterator"),f=!([].keys&&"next"in[].keys()),d=function(){return this};t.exports=function(e,t,r,m,y,g,b){l(r,t,m);var v,x,E,A=function(e){if(!f&&e in _)return _[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},D=t+" Iterator",C="values"==y,S=!1,_=e.prototype,w=_[h]||_["@@iterator"]||y&&_[y],k=w||A(y),F=y?C?A("entries"):k:void 0,T="Array"==t?_.entries||w:w;if(T&&(E=p(T.call(new e)))!==Object.prototype&&(c(E,D,!0),n||o(E,h)||a(E,h,d)),C&&w&&"values"!==w.name&&(S=!0,k=function(){return w.call(this)}),n&&!b||!f&&!S&&_[h]||a(_,h,k),u[t]=k,u[D]=d,y)if(v={values:C?k:A("values"),keys:g?k:A("keys"),entries:F},b)for(x in v)x in _||s(_,x,v[x]);else i(i.P+i.F*(f||S),t,v);return v}},{"./_export":224,"./_has":228,"./_hide":229,"./_iter-create":237,"./_iterators":240,"./_library":242,"./_object-gpo":252,"./_redefine":259,"./_set-to-string-tag":262,"./_wks":275}],239:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],240:[function(e,t,r){t.exports={}},{}],241:[function(e,t,r){var n=e("./_object-keys"),i=e("./_to-iobject");t.exports=function(e,t){for(var r,s=i(e),a=n(s),o=a.length,u=0;o>u;)if(s[r=a[u++]]===t)return r}},{"./_object-keys":254,"./_to-iobject":268}],242:[function(e,t,r){t.exports=!0},{}],243:[function(e,t,r){var n=e("./_uid")("meta"),i=e("./_is-object"),s=e("./_has"),a=e("./_object-dp").f,o=0,u=Object.isExtensible||function(){return!0},l=!e("./_fails")(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,n,{value:{i:"O"+ ++o,w:{}}})},p=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,n)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[n].i},h=function(e,t){if(!s(e,n)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[n].w},f=function(e){return l&&d.NEED&&u(e)&&!s(e,n)&&c(e),e},d=t.exports={KEY:n,NEED:!1,fastKey:p,getWeak:h,onFreeze:f}},{"./_fails":225,"./_has":228,"./_is-object":235,"./_object-dp":246,"./_uid":272}],244:[function(e,t,r){"use strict";var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie"),a=e("./_to-object"),o=e("./_iobject"),u=Object.assign;t.exports=!u||e("./_fails")(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n})?function(e,t){for(var r=a(e),u=arguments.length,l=1,c=i.f,p=s.f;u>l;)for(var h,f=o(arguments[l++]),d=c?n(f).concat(c(f)):n(f),m=d.length,y=0;m>y;)p.call(f,h=d[y++])&&(r[h]=f[h]);return r}:u},{"./_fails":225,"./_iobject":232,"./_object-gops":251,"./_object-keys":254,"./_object-pie":255,"./_to-object":270}],245:[function(e,t,r){var n=e("./_an-object"),i=e("./_object-dps"),s=e("./_enum-bug-keys"),a=e("./_shared-key")("IE_PROTO"),o=function(){},u=function(){var t,r=e("./_dom-create")("iframe"),n=s.length;for(r.style.display="none",e("./_html").appendChild(r),r.src="javascript:",t=r.contentWindow.document,t.open(),t.write(""),t.close(),u=t.F;n--;)delete u.prototype[s[n]];return u()};t.exports=Object.create||function(e,t){var r;return null!==e?(o.prototype=n(e),r=new o,o.prototype=null,r[a]=e):r=u(),void 0===t?r:i(r,t)}},{"./_an-object":205,"./_dom-create":221,"./_enum-bug-keys":222,"./_html":230,"./_object-dps":247,"./_shared-key":263}],246:[function(e,t,r){var n=e("./_an-object"),i=e("./_ie8-dom-define"),s=e("./_to-primitive"),a=Object.defineProperty;r.f=e("./_descriptors")?Object.defineProperty:function(e,t,r){if(n(e),t=s(t,!0),n(r),i)try{return a(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},{"./_an-object":205,"./_descriptors":220,"./_ie8-dom-define":231,"./_to-primitive":271}],247:[function(e,t,r){var n=e("./_object-dp"),i=e("./_an-object"),s=e("./_object-keys");t.exports=e("./_descriptors")?Object.defineProperties:function(e,t){i(e);for(var r,a=s(t),o=a.length,u=0;o>u;)n.f(e,r=a[u++],t[r]);return e}},{"./_an-object":205,"./_descriptors":220,"./_object-dp":246,"./_object-keys":254}],248:[function(e,t,r){var n=e("./_object-pie"),i=e("./_property-desc"),s=e("./_to-iobject"),a=e("./_to-primitive"),o=e("./_has"),u=e("./_ie8-dom-define"),l=Object.getOwnPropertyDescriptor;r.f=e("./_descriptors")?l:function(e,t){if(e=s(e),t=a(t,!0),u)try{return l(e,t)}catch(e){}if(o(e,t))return i(!n.f.call(e,t),e[t])}},{"./_descriptors":220,"./_has":228,"./_ie8-dom-define":231,"./_object-pie":255,"./_property-desc":257,"./_to-iobject":268,"./_to-primitive":271}],249:[function(e,t,r){var n=e("./_to-iobject"),i=e("./_object-gopn").f,s={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],o=function(e){try{return i(e)}catch(e){return a.slice()}};t.exports.f=function(e){return a&&"[object Window]"==s.call(e)?o(e):i(n(e))}},{"./_object-gopn":250,"./_to-iobject":268}],250:[function(e,t,r){var n=e("./_object-keys-internal"),i=e("./_enum-bug-keys").concat("length","prototype");r.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},{"./_enum-bug-keys":222,"./_object-keys-internal":253}],251:[function(e,t,r){r.f=Object.getOwnPropertySymbols},{}],252:[function(e,t,r){var n=e("./_has"),i=e("./_to-object"),s=e("./_shared-key")("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(e){return e=i(e),n(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},{"./_has":228,"./_shared-key":263,"./_to-object":270}],253:[function(e,t,r){var n=e("./_has"),i=e("./_to-iobject"),s=e("./_array-includes")(!1),a=e("./_shared-key")("IE_PROTO");t.exports=function(e,t){var r,o=i(e),u=0,l=[];for(r in o)r!=a&&n(o,r)&&l.push(r);for(;t.length>u;)n(o,r=t[u++])&&(~s(l,r)||l.push(r));return l}},{"./_array-includes":207,"./_has":228,"./_shared-key":263,"./_to-iobject":268}],254:[function(e,t,r){var n=e("./_object-keys-internal"),i=e("./_enum-bug-keys");t.exports=Object.keys||function(e){return n(e,i)}},{"./_enum-bug-keys":222,"./_object-keys-internal":253}],255:[function(e,t,r){r.f={}.propertyIsEnumerable},{}],256:[function(e,t,r){var n=e("./_export"),i=e("./_core"),s=e("./_fails");t.exports=function(e,t){var r=(i.Object||{})[e]||Object[e],a={};a[e]=t(r),n(n.S+n.F*s(function(){r(1)}),"Object",a)}},{"./_core":217,"./_export":224,"./_fails":225}],257:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],258:[function(e,t,r){var n=e("./_hide");t.exports=function(e,t,r){for(var i in t)r&&e[i]?e[i]=t[i]:n(e,i,t[i]);return e}},{"./_hide":229}],259:[function(e,t,r){t.exports=e("./_hide")},{"./_hide":229}],260:[function(e,t,r){var n=e("./_is-object"),i=e("./_an-object"),s=function(e,t){if(i(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r,n){try{n=e("./_ctx")(Function.call,e("./_object-gopd").f(Object.prototype,"__proto__").set,2),n(t,[]),r=!(t instanceof Array)}catch(e){r=!0}return function(e,t){return s(e,t),r?e.__proto__=t:n(e,t),e}}({},!1):void 0),check:s}},{"./_an-object":205,"./_ctx":218,"./_is-object":235,"./_object-gopd":248}],261:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_core"),s=e("./_object-dp"),a=e("./_descriptors"),o=e("./_wks")("species");t.exports=function(e){var t="function"==typeof i[e]?i[e]:n[e];a&&t&&!t[o]&&s.f(t,o,{configurable:!0,get:function(){return this}})}},{"./_core":217,"./_descriptors":220,"./_global":227,"./_object-dp":246,"./_wks":275}],262:[function(e,t,r){var n=e("./_object-dp").f,i=e("./_has"),s=e("./_wks")("toStringTag");t.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,s)&&n(e,s,{configurable:!0,value:t})}},{"./_has":228,"./_object-dp":246,"./_wks":275}],263:[function(e,t,r){var n=e("./_shared")("keys"),i=e("./_uid");t.exports=function(e){return n[e]||(n[e]=i(e))}},{"./_shared":264,"./_uid":272}],264:[function(e,t,r){var n=e("./_global"),i=n["__core-js_shared__"]||(n["__core-js_shared__"]={});t.exports=function(e){return i[e]||(i[e]={})}},{"./_global":227}],265:[function(e,t,r){var n=e("./_to-integer"),i=e("./_defined");t.exports=function(e){return function(t,r){var s,a,o=String(i(t)),u=n(r),l=o.length;return u<0||u>=l?e?"":void 0:(s=o.charCodeAt(u),s<55296||s>56319||u+1===l||(a=o.charCodeAt(u+1))<56320||a>57343?e?o.charAt(u):s:e?o.slice(u,u+2):a-56320+(s-55296<<10)+65536)}}},{"./_defined":219,"./_to-integer":267}],266:[function(e,t,r){var n=e("./_to-integer"),i=Math.max,s=Math.min;t.exports=function(e,t){return e=n(e),e<0?i(e+t,0):s(e,t)}},{"./_to-integer":267}],267:[function(e,t,r){var n=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},{}],268:[function(e,t,r){var n=e("./_iobject"),i=e("./_defined");t.exports=function(e){return n(i(e))}},{"./_defined":219,"./_iobject":232}],269:[function(e,t,r){var n=e("./_to-integer"),i=Math.min;t.exports=function(e){return e>0?i(n(e),9007199254740991):0}},{"./_to-integer":267}],270:[function(e,t,r){var n=e("./_defined");t.exports=function(e){return Object(n(e))}},{"./_defined":219}],271:[function(e,t,r){var n=e("./_is-object");t.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":235}],272:[function(e,t,r){var n=0,i=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},{}],273:[function(e,t,r){var n=e("./_global"),i=e("./_core"),s=e("./_library"),a=e("./_wks-ext"),o=e("./_object-dp").f;t.exports=function(e){var t=i.Symbol||(i.Symbol=s?{}:n.Symbol||{});"_"==e.charAt(0)||e in t||o(t,e,{value:a.f(e)})}},{"./_core":217,"./_global":227,"./_library":242,"./_object-dp":246,"./_wks-ext":274}],274:[function(e,t,r){r.f=e("./_wks")},{"./_wks":275}],275:[function(e,t,r){var n=e("./_shared")("wks"),i=e("./_uid"),s=e("./_global").Symbol,a="function"==typeof s;(t.exports=function(e){return n[e]||(n[e]=a&&s[e]||(a?s:i)("Symbol."+e))}).store=n},{"./_global":227,"./_shared":264,"./_uid":272}],276:[function(e,t,r){var n=e("./_classof"),i=e("./_wks")("iterator"),s=e("./_iterators");t.exports=e("./_core").getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||s[n(e)]}},{"./_classof":211,"./_core":217,"./_iterators":240,"./_wks":275}],277:[function(e,t,r){var n=e("./_an-object"),i=e("./core.get-iterator-method");t.exports=e("./_core").getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return n(t.call(e))}},{"./_an-object":205,"./_core":217,"./core.get-iterator-method":276}],278:[function(e,t,r){"use strict";var n=e("./_add-to-unscopables"),i=e("./_iter-step"),s=e("./_iterators"),a=e("./_to-iobject");t.exports=e("./_iter-define")(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,r):"values"==t?i(0,e[r]):i(0,[r,e[r]])},"values"),s.Arguments=s.Array,n("keys"),n("values"),n("entries")},{"./_add-to-unscopables":203,"./_iter-define":238,"./_iter-step":239,"./_iterators":240,"./_to-iobject":268}],279:[function(e,t,r){"use strict";var n=e("./_collection-strong");t.exports=e("./_collection")("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=n.getEntry(this,e);return t&&t.v},set:function(e,t){return n.def(this,0===e?0:e,t)}},n,!0)},{"./_collection":216,"./_collection-strong":213}],280:[function(e,t,r){var n=e("./_export");n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{"./_export":224}],281:[function(e,t,r){var n=e("./_export");n(n.S+n.F,"Object",{assign:e("./_object-assign")})},{"./_export":224,"./_object-assign":244}],282:[function(e,t,r){var n=e("./_export");n(n.S,"Object",{create:e("./_object-create")})},{"./_export":224,"./_object-create":245}],283:[function(e,t,r){var n=e("./_to-object"),i=e("./_object-keys");e("./_object-sap")("keys",function(){return function(e){return i(n(e))}})},{"./_object-keys":254,"./_object-sap":256,"./_to-object":270}],284:[function(e,t,r){var n=e("./_export");n(n.S,"Object",{setPrototypeOf:e("./_set-proto").set})},{"./_export":224,"./_set-proto":260}],285:[function(e,t,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],286:[function(e,t,r){"use strict";var n=e("./_string-at")(!0);e("./_iter-define")(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},{"./_iter-define":238,"./_string-at":265}],287:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_has"),s=e("./_descriptors"),a=e("./_export"),o=e("./_redefine"),u=e("./_meta").KEY,l=e("./_fails"),c=e("./_shared"),p=e("./_set-to-string-tag"),h=e("./_uid"),f=e("./_wks"),d=e("./_wks-ext"),m=e("./_wks-define"),y=e("./_keyof"),g=e("./_enum-keys"),b=e("./_is-array"),v=e("./_an-object"),x=e("./_to-iobject"),E=e("./_to-primitive"),A=e("./_property-desc"),D=e("./_object-create"),C=e("./_object-gopn-ext"),S=e("./_object-gopd"),_=e("./_object-dp"),w=e("./_object-keys"),k=S.f,F=_.f,T=C.f,P=n.Symbol,B=n.JSON,O=B&&B.stringify,j=f("_hidden"),N=f("toPrimitive"),I={}.propertyIsEnumerable,L=c("symbol-registry"),M=c("symbols"),R=c("op-symbols"),U=Object.prototype,V="function"==typeof P,q=n.QObject,G=!q||!q.prototype||!q.prototype.findChild,X=s&&l(function(){return 7!=D(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=k(U,t);n&&delete U[t],F(e,t,r),n&&e!==U&&F(U,t,n)}:F,J=function(e){var t=M[e]=D(P.prototype);return t._k=e,t},W=V&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},K=function(e,t,r){return e===U&&K(R,t,r),v(e),t=E(t,!0),v(r),i(M,t)?(r.enumerable?(i(e,j)&&e[j][t]&&(e[j][t]=!1),r=D(r,{enumerable:A(0,!1)})):(i(e,j)||F(e,j,A(1,{})),e[j][t]=!0),X(e,t,r)):F(e,t,r)},z=function(e,t){v(e);for(var r,n=g(t=x(t)),i=0,s=n.length;s>i;)K(e,r=n[i++],t[r]);return e},Y=function(e,t){return void 0===t?D(e):z(D(e),t)},H=function(e){var t=I.call(this,e=E(e,!0));return!(this===U&&i(M,e)&&!i(R,e))&&(!(t||!i(this,e)||!i(M,e)||i(this,j)&&this[j][e])||t)},$=function(e,t){if(e=x(e),t=E(t,!0),e!==U||!i(M,t)||i(R,t)){var r=k(e,t);return!r||!i(M,t)||i(e,j)&&e[j][t]||(r.enumerable=!0),r}},Q=function(e){for(var t,r=T(x(e)),n=[],s=0;r.length>s;)i(M,t=r[s++])||t==j||t==u||n.push(t);return n},Z=function(e){for(var t,r=e===U,n=T(r?R:x(e)),s=[],a=0;n.length>a;)!i(M,t=n[a++])||r&&!i(U,t)||s.push(M[t]);return s};V||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=h(arguments.length>0?arguments[0]:void 0),t=function(r){this===U&&t.call(R,r),i(this,j)&&i(this[j],e)&&(this[j][e]=!1),X(this,e,A(1,r))};return s&&G&&X(U,e,{configurable:!0,set:t}),J(e)},o(P.prototype,"toString",function(){return this._k}),S.f=$,_.f=K,e("./_object-gopn").f=C.f=Q,e("./_object-pie").f=H,e("./_object-gops").f=Z,s&&!e("./_library")&&o(U,"propertyIsEnumerable",H,!0),d.f=function(e){return J(f(e))}),a(a.G+a.W+a.F*!V,{Symbol:P});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)f(ee[te++]);for(var ee=w(f.store),te=0;ee.length>te;)m(ee[te++]);a(a.S+a.F*!V,"Symbol",{for:function(e){return i(L,e+="")?L[e]:L[e]=P(e)},keyFor:function(e){if(W(e))return y(L,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){G=!0},useSimple:function(){G=!1}}),a(a.S+a.F*!V,"Object",{create:Y,defineProperty:K,defineProperties:z,getOwnPropertyDescriptor:$,getOwnPropertyNames:Q,getOwnPropertySymbols:Z}),B&&a(a.S+a.F*(!V||l(function(){var e=P();return"[null]"!=O([e])||"{}"!=O({a:e})||"{}"!=O(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!W(e)){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);return t=n[1],"function"==typeof t&&(r=t),!r&&b(t)||(t=function(e,t){if(r&&(t=r.call(this,e,t)),!W(t))return t}),n[1]=t,O.apply(B,n)}}}),P.prototype[N]||e("./_hide")(P.prototype,N,P.prototype.valueOf),p(P,"Symbol"),p(Math,"Math",!0),p(n.JSON,"JSON",!0)},{"./_an-object":205,"./_descriptors":220,"./_enum-keys":223,"./_export":224,"./_fails":225,"./_global":227,"./_has":228,"./_hide":229,"./_is-array":234,"./_keyof":241,"./_library":242,"./_meta":243,"./_object-create":245,"./_object-dp":246,"./_object-gopd":248,"./_object-gopn":250,"./_object-gopn-ext":249,"./_object-gops":251,"./_object-keys":254,"./_object-pie":255,"./_property-desc":257,"./_redefine":259,"./_set-to-string-tag":262,"./_shared":264,"./_to-iobject":268,"./_to-primitive":271,"./_uid":272,"./_wks":275,"./_wks-define":273,"./_wks-ext":274}],288:[function(e,t,r){"use strict";var n,i=e("./_array-methods")(0),s=e("./_redefine"),a=e("./_meta"),o=e("./_object-assign"),u=e("./_collection-weak"),l=e("./_is-object"),c=a.getWeak,p=Object.isExtensible,h=u.ufstore,f={},d=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},m={get:function(e){if(l(e)){var t=c(e);return!0===t?h(this).get(e):t?t[this._i]:void 0}},set:function(e,t){return u.def(this,e,t)}},y=t.exports=e("./_collection")("WeakMap",d,m,u,!0,!0);7!=(new y).set((Object.freeze||Object)(f),7).get(f)&&(n=u.getConstructor(d),o(n.prototype,m),a.NEED=!0,i(["delete","has","get","set"],function(e){var t=y.prototype,r=t[e];s(t,e,function(t,i){if(l(t)&&!p(t)){this._f||(this._f=new n);var s=this._f[e](t,i);return"set"==e?this:s}return r.call(this,t,i)})}))},{"./_array-methods":208,"./_collection":216,"./_collection-weak":215,"./_is-object":235,"./_meta":243,"./_object-assign":244,"./_redefine":259}],289:[function(e,t,r){"use strict";var n=e("./_collection-weak");e("./_collection")("WeakSet",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return n.def(this,e,!0)}},n,!1,!0)},{"./_collection":216,"./_collection-weak":215}],290:[function(e,t,r){var n=e("./_export");n(n.P+n.R,"Map",{toJSON:e("./_collection-to-json")("Map")})},{"./_collection-to-json":214,"./_export":224}],291:[function(e,t,r){e("./_wks-define")("asyncIterator")},{"./_wks-define":273}],292:[function(e,t,r){e("./_wks-define")("observable")},{"./_wks-define":273}],293:[function(e,t,r){e("./es6.array.iterator");for(var n=e("./_global"),i=e("./_hide"),s=e("./_iterators"),a=e("./_wks")("toStringTag"),o=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],u=0;u<5;u++){var l=o[u],c=n[l],p=c&&c.prototype;p&&!p[a]&&i(p,a,l),s[l]=s.Array}},{"./_global":227,"./_hide":229,"./_iterators":240,"./_wks":275,"./es6.array.iterator":278}],294:[function(e,t,r){(function(e){function t(e){return Array.isArray?Array.isArray(e):"[object Array]"===y(e)}function n(e){return"boolean"==typeof e}function i(e){return null===e}function s(e){return null==e}function a(e){return"number"==typeof e}function o(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function l(e){return void 0===e}function c(e){return"[object RegExp]"===y(e)}function p(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===y(e)}function f(e){return"[object Error]"===y(e)||e instanceof Error}function d(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function y(e){return Object.prototype.toString.call(e)}r.isArray=t,r.isBoolean=n,r.isNull=i,r.isNullOrUndefined=s,r.isNumber=a,r.isString=o,r.isSymbol=u,r.isUndefined=l,r.isRegExp=c,r.isObject=p,r.isDate=h,r.isError=f,r.isFunction=d,r.isPrimitive=m, +r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":308}],295:[function(e,t,r){t.exports=e("./src/node")},{"./src/node":298}],296:[function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),t){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,s=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(s=i))}),e.splice(s,0,n)}}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(e){try{null==e?r.storage.removeItem("debug"):r.storage.debug=e}catch(e){}}function u(){var e;try{e=r.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}r=t.exports=e("./debug"),r.log=a,r.formatArgs=s,r.save=o,r.load=u,r.useColors=i,r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},r.enable(u())}).call(this,e("_process"))},{"./debug":297,_process:539}],297:[function(e,t,r){function n(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return r.colors[Math.abs(n)%r.colors.length]}function i(e){function t(){if(t.enabled){var e=t,n=+new Date,i=n-(l||n);e.diff=i,e.prev=l,e.curr=n,l=n;for(var s=new Array(arguments.length),a=0;ar||a===r&&o>n)&&(r=a,n=o,t=Number(i))}return t}var i=e("repeating");t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var t,r,s=0,a=0,o=0,u={};e.split(/\n/g).forEach(function(e){if(e){var n,i=e.match(/^(?:( )+|\t+)/);i?(n=i[0].length,i[1]?a++:s++):n=0;var l=n-o;o=n,l?(r=l>0,t=u[r?l:-l],t?t[0]++:t=u[l]=[1,0]):t&&(t[1]+=Number(r))}});var l,c,p=n(u);return p?a>=s?(l="space",c=i(" ",p)):(l="tab",c=i("\t",p)):(l=null,c=""),{amount:p,type:l,indent:c}}},{repeating:588}],300:[function(e,t,r){"use strict";t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}},{}],301:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function s(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(r=this._events[e],o(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),l=r.slice(),n=l.length,u=0;u0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,s,o;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(o=s;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){n=o;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],302:[function(e,t,r){t.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,DataView:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},es5:{Array:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,propertyIsEnumerable:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,toLocaleString:!1,toString:!1,TypeError:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1},es6:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,DataView:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},browser:{addEventListener:!1,alert:!1,AnalyserNode:!1,Animation:!1,AnimationEffectReadOnly:!1,AnimationEffectTiming:!1,AnimationEffectTimingReadOnly:!1,AnimationEvent:!1,AnimationPlaybackEvent:!1,AnimationTimeline:!1,applicationCache:!1,ApplicationCache:!1,ApplicationCacheErrorEvent:!1,atob:!1,Attr:!1,Audio:!1,AudioBuffer:!1,AudioBufferSourceNode:!1,AudioContext:!1,AudioDestinationNode:!1,AudioListener:!1,AudioNode:!1,AudioParam:!1,AudioProcessingEvent:!1,AutocompleteErrorEvent:!1,BarProp:!1,BatteryManager:!1,BeforeUnloadEvent:!1,BiquadFilterNode:!1,Blob:!1,blur:!1,btoa:!1,Cache:!1,caches:!1,CacheStorage:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CDATASection:!1,ChannelMergerNode:!1,ChannelSplitterNode:!1,CharacterData:!1,clearInterval:!1,clearTimeout:!1,clientInformation:!1,ClientRect:!1,ClientRectList:!1,ClipboardEvent:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,ConvolverNode:!1,Credential:!1,CredentialsContainer:!1,crypto:!1,Crypto:!1,CryptoKey:!1,CSS:!1,CSSAnimation:!1,CSSFontFaceRule:!1,CSSImportRule:!1,CSSKeyframeRule:!1,CSSKeyframesRule:!1,CSSMediaRule:!1,CSSPageRule:!1,CSSRule:!1,CSSRuleList:!1,CSSStyleDeclaration:!1,CSSStyleRule:!1,CSSStyleSheet:!1,CSSSupportsRule:!1,CSSTransition:!1,CSSUnknownRule:!1,CSSViewportRule:!1,customElements:!1,CustomEvent:!1,DataTransfer:!1,DataTransferItem:!1,DataTransferItemList:!1,Debug:!1,defaultStatus:!1,defaultstatus:!1,DelayNode:!1,DeviceMotionEvent:!1,DeviceOrientationEvent:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DocumentTimeline:!1,DocumentType:!1,DOMError:!1,DOMException:!1,DOMImplementation:!1,DOMParser:!1,DOMSettableTokenList:!1,DOMStringList:!1,DOMStringMap:!1,DOMTokenList:!1,DragEvent:!1,DynamicsCompressorNode:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,EventSource:!1,EventTarget:!1,external:!1,FederatedCredential:!1,fetch:!1,File:!1,FileError:!1,FileList:!1,FileReader:!1,find:!1,focus:!1,FocusEvent:!1,FontFace:!1,FormData:!1,frameElement:!1,frames:!1,GainNode:!1,Gamepad:!1,GamepadButton:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,Headers:!1,history:!1,History:!1,HTMLAllCollection:!1,HTMLAnchorElement:!1,HTMLAppletElement:!1,HTMLAreaElement:!1,HTMLAudioElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLContentElement:!1,HTMLDataListElement:!1,HTMLDetailsElement:!1,HTMLDialogElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLDocument:!1,HTMLElement:!1,HTMLEmbedElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormControlsCollection:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLKeygenElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMarqueeElement:!1,HTMLMediaElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLMeterElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLOptionsCollection:!1,HTMLOutputElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPictureElement:!1,HTMLPreElement:!1,HTMLProgressElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLShadowElement:!1,HTMLSourceElement:!1,HTMLSpanElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLTrackElement:!1,HTMLUListElement:!1,HTMLUnknownElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,ImageBitmap:!1,ImageData:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,InputMethodContext:!1,IntersectionObserver:!1,IntersectionObserverEntry:!1,Intl:!1,KeyboardEvent:!1,KeyframeEffect:!1,KeyframeEffectReadOnly:!1,length:!1,localStorage:!1,location:!1,Location:!1,locationbar:!1,matchMedia:!1,MediaElementAudioSourceNode:!1,MediaEncryptedEvent:!1,MediaError:!1,MediaKeyError:!1,MediaKeyEvent:!1,MediaKeyMessageEvent:!1,MediaKeys:!1,MediaKeySession:!1,MediaKeyStatusMap:!1,MediaKeySystemAccess:!1,MediaList:!1,MediaQueryList:!1,MediaQueryListEvent:!1,MediaSource:!1,MediaRecorder:!1,MediaStream:!1,MediaStreamAudioDestinationNode:!1,MediaStreamAudioSourceNode:!1,MediaStreamEvent:!1,MediaStreamTrack:!1,menubar:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MIDIAccess:!1,MIDIConnectionEvent:!1,MIDIInput:!1,MIDIInputMap:!1,MIDIMessageEvent:!1,MIDIOutput:!1,MIDIOutputMap:!1,MIDIPort:!1,MimeType:!1,MimeTypeArray:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationEvent:!1,MutationObserver:!1,MutationRecord:!1,name:!1,NamedNodeMap:!1,navigator:!1,Navigator:!1,Node:!1,NodeFilter:!1,NodeIterator:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,OfflineAudioContext:!1,offscreenBuffering:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,OscillatorNode:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PasswordCredential:!1,Path2D:!1,performance:!1,Performance:!1,PerformanceEntry:!1,PerformanceMark:!1,PerformanceMeasure:!1,PerformanceNavigation:!1,PerformanceResourceTiming:!1,PerformanceTiming:!1,PeriodicWave:!1,Permissions:!1,PermissionStatus:!1,personalbar:!1,Plugin:!1,PluginArray:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProcessingInstruction:!1,ProgressEvent:!1,PromiseRejectionEvent:!1,prompt:!1,PushManager:!1,PushSubscription:!1,RadioNodeList:!1,Range:!1,ReadableByteStream:!1,ReadableStream:!1,removeEventListener:!1,Request:!1,requestAnimationFrame:!1,requestIdleCallback:!1,resizeBy:!1,resizeTo:!1,Response:!1,RTCIceCandidate:!1,RTCSessionDescription:!1,RTCPeerConnection:!1,screen:!1,Screen:!1,screenLeft:!1,ScreenOrientation:!1,screenTop:!1,screenX:!1,screenY:!1,ScriptProcessorNode:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,SecurityPolicyViolationEvent:!1,Selection:!1,self:!1,ServiceWorker:!1,ServiceWorkerContainer:!1,ServiceWorkerRegistration:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,ShadowRoot:!1,SharedKeyframeList:!1,SharedWorker:!1,showModalDialog:!1,SiteBoundCredential:!1,speechSynthesis:!1,SpeechSynthesisEvent:!1,SpeechSynthesisUtterance:!1,status:!1,statusbar:!1,stop:!1,Storage:!1,StorageEvent:!1,styleMedia:!1,StyleSheet:!1,StyleSheetList:!1,SubtleCrypto:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDiscardElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEDropShadowElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGeometryElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGGraphicsElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,SVGZoomEvent:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TextEvent:!1,TextMetrics:!1,TextTrack:!1,TextTrackCue:!1,TextTrackCueList:!1,TextTrackList:!1,TimeEvent:!1,TimeRanges:!1,toolbar:!1,top:!1,Touch:!1,TouchEvent:!1,TouchList:!1,TrackEvent:!1,TransitionEvent:!1,TreeWalker:!1,UIEvent:!1,URL:!1,URLSearchParams:!1,ValidityState:!1,VTTCue:!1,WaveShaperNode:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLDocument:!1,XMLHttpRequest:!1,XMLHttpRequestEventTarget:!1,XMLHttpRequestProgressEvent:!1,XMLHttpRequestUpload:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1,XSLTProcessor:!1},worker:{applicationCache:!1,atob:!1,Blob:!1,BroadcastChannel:!1,btoa:!1,Cache:!1,caches:!1,clearInterval:!1,clearTimeout:!1,close:!0,console:!1,fetch:!1,FileReaderSync:!1,FormData:!1,Headers:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,ImageData:!1,importScripts:!0,indexedDB:!1,location:!1,MessageChannel:!1,MessagePort:!1,name:!1,navigator:!1,Notification:!1,onclose:!0,onconnect:!0,onerror:!0,onlanguagechange:!0,onmessage:!0,onoffline:!0,ononline:!0,onrejectionhandled:!0,onunhandledrejection:!0,performance:!1,Performance:!1,PerformanceEntry:!1,PerformanceMark:!1,PerformanceMeasure:!1,PerformanceNavigation:!1,PerformanceResourceTiming:!1,PerformanceTiming:!1,postMessage:!0,Promise:!1,Request:!1,Response:!1,self:!0,ServiceWorkerRegistration:!1,setInterval:!1,setTimeout:!1,TextDecoder:!1,TextEncoder:!1,URL:!1,URLSearchParams:!1,WebSocket:!1,Worker:!1,XMLHttpRequest:!1},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,exports:!0,GLOBAL:!1,global:!1,Intl:!1,module:!1,process:!1,require:!1,root:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},commonjs:{exports:!0,module:!1,require:!1,global:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,mocha:!1,run:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},jest:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,check:!1,describe:!1,expect:!1,gen:!1,it:!1,fdescribe:!1,fit:!1,jest:!1,pit:!1,require:!1,test:!1,xdescribe:!1,xit:!1,xtest:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notOk:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,throws:!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},nashorn:{__DIR__:!1,__FILE__:!1,__LINE__:!1,com:!1,edu:!1,exit:!1,Java:!1,java:!1,javafx:!1,JavaImporter:!1,javax:!1,JSAdapter:!1,load:!1,loadWithNewGlobal:!1,org:!1,Packages:!1,print:!1,quit:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,ln:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,set:!1,target:!1,tempdir:!1,test:!1,touch:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,AccountsClient:!1,AccountsServer:!1,AccountsCommon:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,DDPRateLimiter:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,ServiceConfiguration:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,ISODate:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,NumberInt:!1,NumberLong:!1,ObjectId:!1,PlanCache:!1,print:!1,printjson:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1},applescript:{$:!1,Application:!1,Automation:!1,console:!1,delay:!1,Library:!1,ObjC:!1,ObjectSpecifier:!1,Path:!1,Progress:!1,Ref:!1},serviceworker:{caches:!1,Cache:!1,CacheStorage:!1,Client:!1,clients:!1,Clients:!1,ExtendableEvent:!1,ExtendableMessageEvent:!1,FetchEvent:!1,importScripts:!1,registration:!1,self:!1,ServiceWorker:!1,ServiceWorkerContainer:!1,ServiceWorkerGlobalScope:!1,ServiceWorkerMessageEvent:!1,ServiceWorkerRegistration:!1,skipWaiting:!1,WindowClient:!1},atomtest:{advanceClock:!1,fakeClearInterval:!1,fakeClearTimeout:!1,fakeSetInterval:!1,fakeSetTimeout:!1,resetTimeouts:!1,waitsForPromise:!1},embertest:{andThen:!1,click:!1,currentPath:!1,currentRouteName:!1,currentURL:!1,fillIn:!1,find:!1,findWithAssert:!1,keyEvent:!1,pauseTest:!1,resumeTest:!1,triggerEvent:!1,visit:!1},protractor:{$:!1,$$:!1,browser:!1,By:!1,by:!1,DartObject:!1,element:!1,protractor:!1},"shared-node-browser":{clearInterval:!1,clearTimeout:!1,console:!1,setInterval:!1,setTimeout:!1},webextensions:{browser:!1,chrome:!1,opr:!1},greasemonkey:{GM_addStyle:!1,GM_deleteValue:!1,GM_getResourceText:!1,GM_getResourceURL:!1,GM_getValue:!1,GM_info:!1,GM_listValues:!1,GM_log:!1,GM_openInTab:!1,GM_registerMenuCommand:!1,GM_setClipboard:!1,GM_setValue:!1,GM_xmlhttpRequest:!1,unsafeWindow:!1}}},{}],303:[function(e,t,r){t.exports=e("./globals.json")},{"./globals.json":302}],304:[function(e,t,r){"use strict";var n=e("ansi-regex"),i=new RegExp(n().source);t.exports=i.test.bind(i)},{"ansi-regex":1}],305:[function(e,t,r){r.read=function(e,t,r,n,i){var s,a,o=8*i-n-1,u=(1<>1,c=-7,p=r?i-1:0,h=r?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+e[t+p],p+=h,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+e[t+p],p+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=l}return(f?-1:1)*a*Math.pow(2,s-n)},r.write=function(e,t,r,n,i,s){var a,o,u,l=8*s-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+p>=1?h/u:h*Math.pow(2,1-p),t*u>=2&&(a++,u/=2),a+p>=c?(o=0,a=c):a+p>=1?(o=(t*u-1)*Math.pow(2,i),a+=p):(o=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<0;e[r+f]=255&a,f+=d,a/=256,l-=8);e[r+f-d]|=128*m}},{}],306:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],307:[function(e,t,r){"use strict";var n=function(e,t,r,n,i,s,a,o){if(void 0===t)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,i,s,a,o],c=0;u=new Error(t.replace(/%s/g,function(){return l[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};t.exports=n},{}],308:[function(e,t,r){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function i(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}t.exports=function(e){return null!=e&&(n(e)||i(e)||!!e._isBuffer)}},{}],309:[function(e,t,r){"use strict";var n=e("number-is-nan");t.exports=Number.isFinite||function(e){return!("number"!=typeof e||n(e)||e===1/0||e===-1/0)}},{"number-is-nan":533}],310:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],311:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}), +r.default=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g,r.matchToToken=function(e){var t={type:"invalid",value:e[0]};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},{}],312:[function(e,t,r){(function(e){!function(n){var i="object"==typeof r&&r,s="object"==typeof t&&t&&t.exports==i&&t,a="object"==typeof e&&e;a.global!==a&&a.window!==a||(n=a);var o={},u=o.hasOwnProperty,l=function(e,t){var r;for(r in e)u.call(e,r)&&t(r,e[r])},c=function(e,t){return t?(l(t,function(t,r){e[t]=r}),e):e},p=function(e,t){for(var r=e.length,n=-1;++n=55296&&j<=56319&&R>M+1&&(N=L.charCodeAt(M+1))>=56320&&N<=57343){I=1024*(j-55296)+N-56320+65536;var V=I.toString(16);u||(V=V.toUpperCase()),i+="\\u{"+V+"}",M++}else{if(!t.escapeEverything){if(D.test(U)){i+=U;continue}if('"'==U){i+=s==U?'\\"':U;continue}if("'"==U){i+=s==U?"\\'":U;continue}}if("\0"!=U||n||A.test(L.charAt(M+1)))if(E.test(U))i+=x[U];else{var q=U.charCodeAt(0),V=q.toString(16);u||(V=V.toUpperCase());var G=V.length>2||n,X="\\"+(G?"u":"x")+("0000"+V).slice(G?-4:-2);i+=X}else i+="\\0"}}return t.wrap&&(i=s+i+s),t.escapeEtago?i.replace(/<\/(script|style)/gi,"<\\/$1"):i};C.version="1.3.0","function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return C}):i&&!i.nodeType?s?s.exports=C:i.jsesc=C:n.jsesc=C}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],313:[function(e,t,r){var n="object"==typeof r?r:{};n.parse=function(){"use strict";var e,t,r,n,i,s,a={"'":"'",'"':'"',"\\":"\\","/":"/","\n":"",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},o=[" ","\t","\r","\n","\v","\f"," ","\ufeff"],u=function(e){return""===e?"EOF":"'"+e+"'"},l=function(n){var s=new SyntaxError;throw s.message=n+" at line "+t+" column "+r+" of the JSON5 data. Still to read: "+JSON.stringify(i.substring(e-1,e+19)),s.at=e,s.lineNumber=t,s.columnNumber=r,s},c=function(s){return s&&s!==n&&l("Expected "+u(s)+" instead of "+u(n)),n=i.charAt(e),e++,r++,("\n"===n||"\r"===n&&"\n"!==p())&&(t++,r=0),n},p=function(){return i.charAt(e)},h=function(){var e=n;for("_"!==n&&"$"!==n&&(n<"a"||n>"z")&&(n<"A"||n>"Z")&&l("Bad identifier as unquoted key");c()&&("_"===n||"$"===n||n>="a"&&n<="z"||n>="A"&&n<="Z"||n>="0"&&n<="9");)e+=n;return e},f=function(){var e,t="",r="",i=10;if("-"!==n&&"+"!==n||(t=n,c(n)),"I"===n)return e=v(),("number"!=typeof e||isNaN(e))&&l("Unexpected word for number"),"-"===t?-e:e;if("N"===n)return e=v(),isNaN(e)||l("expected word to be NaN"),e;switch("0"===n&&(r+=n,c(),"x"===n||"X"===n?(r+=n,c(),i=16):n>="0"&&n<="9"&&l("Octal literal")),i){case 10:for(;n>="0"&&n<="9";)r+=n,c();if("."===n)for(r+=".";c()&&n>="0"&&n<="9";)r+=n;if("e"===n||"E"===n)for(r+=n,c(),"-"!==n&&"+"!==n||(r+=n,c());n>="0"&&n<="9";)r+=n,c();break;case 16:for(;n>="0"&&n<="9"||n>="A"&&n<="F"||n>="a"&&n<="f";)r+=n,c()}if(e="-"===t?-r:+r,isFinite(e))return e;l("Bad number")},d=function(){var e,t,r,i,s="";if('"'===n||"'"===n)for(r=n;c();){if(n===r)return c(),s;if("\\"===n)if(c(),"u"===n){for(i=0,t=0;t<4&&(e=parseInt(c(),16),isFinite(e));t+=1)i=16*i+e;s+=String.fromCharCode(i)}else if("\r"===n)"\n"===p()&&c();else{if("string"!=typeof a[n])break;s+=a[n]}else{if("\n"===n)break;s+=n}}l("Bad string")},m=function(){"/"!==n&&l("Not an inline comment");do{if(c(),"\n"===n||"\r"===n)return void c()}while(n)},y=function(){"*"!==n&&l("Not a block comment");do{for(c();"*"===n;)if(c("*"),"/"===n)return void c("/")}while(n);l("Unterminated block comment")},g=function(){"/"!==n&&l("Not a comment"),c("/"),"/"===n?m():"*"===n?y():l("Unrecognized comment")},b=function(){for(;n;)if("/"===n)g();else{if(!(o.indexOf(n)>=0))return;c()}},v=function(){switch(n){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null;case"I":return c("I"),c("n"),c("f"),c("i"),c("n"),c("i"),c("t"),c("y"),1/0;case"N":return c("N"),c("a"),c("N"),NaN}l("Unexpected "+u(n))},x=function(){var e=[];if("["===n)for(c("["),b();n;){if("]"===n)return c("]"),e;if(","===n?l("Missing array element"):e.push(s()),b(),","!==n)return c("]"),e;c(","),b()}l("Bad array")},E=function(){var e,t={};if("{"===n)for(c("{"),b();n;){if("}"===n)return c("}"),t;if(e='"'===n||"'"===n?d():h(),b(),c(":"),t[e]=s(),b(),","!==n)return c("}"),t;c(","),b()}l("Bad object")};return s=function(){switch(b(),n){case"{":return E();case"[":return x();case'"':case"'":return d();case"-":case"+":case".":return f();default:return n>="0"&&n<="9"?f():v()}},function(a,o){var u;return i=String(a),e=0,t=1,r=1,n=" ",u=s(),b(),n&&l("Syntax error"),"function"==typeof o?function e(t,r){var n,i,s=t[r];if(s&&"object"==typeof s)for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=e(s,n),void 0!==i?s[n]=i:delete s[n]);return o.call(t,r,s)}({"":u},""):u}}(),n.stringify=function(e,t,r){function i(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e||"$"===e}function s(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||"$"===e}function a(e){if("string"!=typeof e)return!1;if(!s(e[0]))return!1;for(var t=1,r=e.length;t10&&(e=e.substring(0,10));for(var n=r?"":"\n",i=0;i=0?i:void 0:i};n.isWord=a;var d,m=[];r&&("string"==typeof r?d=r:"number"==typeof r&&r>=0&&(d=c(" ",r,!0)));var y=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},b={"":e};return void 0===e?f(b,"",!0):h(b,"",!0)}},{}],314:[function(e,t,r){var n=e("./_getNative"),i=e("./_root"),s=n(i,"DataView");t.exports=s},{"./_getNative":418,"./_root":462}],315:[function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1}var i=e("./_baseIndexOf");t.exports=n},{"./_baseIndexOf":357}],332:[function(e,t,r){function n(e,t,r){for(var n=-1,i=null==e?0:e.length;++n=t?e:t)),e}t.exports=n},{}],345:[function(e,t,r){function n(e,t,r,P,B,O){var j,N=t&D,I=t&C,L=t&S;if(r&&(j=B?r(e,P,B,O):r(e)),void 0!==j)return j;if(!E(e))return e;var M=v(e);if(M){if(j=y(e),!N)return c(e,j)}else{var R=m(e),U=R==w||R==k;if(x(e))return l(e,N);if(R==F||R==_||U&&!B){if(j=I||U?{}:b(e),!N)return I?h(e,u(j,e)):p(e,o(j,e))}else{if(!T[R])return B?e:{};j=g(e,R,n,N)}}O||(O=new i);var V=O.get(e);if(V)return V;O.set(e,j);var q=L?I?d:f:I?keysIn:A,G=M?void 0:q(e);return s(G||e,function(i,s){G&&(s=i,i=e[s]),a(j,s,n(i,t,r,s,e,O))}),j}var i=e("./_Stack"),s=e("./_arrayEach"),a=e("./_assignValue"),o=e("./_baseAssign"),u=e("./_baseAssignIn"),l=e("./_cloneBuffer"),c=e("./_copyArray"),p=e("./_copySymbols"),h=e("./_copySymbolsIn"),f=e("./_getAllKeys"),d=e("./_getAllKeysIn"),m=e("./_getTag"),y=e("./_initCloneArray"),g=e("./_initCloneByTag"),b=e("./_initCloneObject"),v=e("./isArray"),x=e("./isBuffer"),E=e("./isObject"),A=e("./keys"),D=1,C=2,S=4,_="[object Arguments]",w="[object Function]",k="[object GeneratorFunction]",F="[object Object]",T={};T[_]=T["[object Array]"]=T["[object ArrayBuffer]"]=T["[object DataView]"]=T["[object Boolean]"]=T["[object Date]"]=T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Map]"]=T["[object Number]"]=T[F]=T["[object RegExp]"]=T["[object Set]"]=T["[object String]"]=T["[object Symbol]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T["[object Error]"]=T[w]=T["[object WeakMap]"]=!1,t.exports=n},{"./_Stack":322,"./_arrayEach":329,"./_assignValue":339,"./_baseAssign":341,"./_baseAssignIn":342,"./_cloneBuffer":389,"./_copyArray":398,"./_copySymbols":400,"./_copySymbolsIn":401,"./_getAllKeys":414,"./_getAllKeysIn":415,"./_getTag":423,"./_initCloneArray":431,"./_initCloneByTag":432,"./_initCloneObject":433,"./isArray":498,"./isBuffer":501,"./isObject":505,"./keys":512}],346:[function(e,t,r){var n=e("./isObject"),i=Object.create,s=function(){function e(){}return function(t){if(!n(t))return{};if(i)return i(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();t.exports=s},{"./isObject":505}],347:[function(e,t,r){var n=e("./_baseForOwn"),i=e("./_createBaseEach"),s=i(n);t.exports=s},{"./_baseForOwn":351,"./_createBaseEach":404}],348:[function(e,t,r){function n(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s0&&r(c)?t>1?n(c,t-1,r,a,o):i(o,c):a||(o[o.length]=c)}return o}var i=e("./_arrayPush"),s=e("./_isFlattenable");t.exports=n},{"./_arrayPush":335,"./_isFlattenable":434}],350:[function(e,t,r){var n=e("./_createBaseFor"),i=n();t.exports=i},{"./_createBaseFor":405}],351:[function(e,t,r){function n(e,t){return e&&i(e,t,s)}var i=e("./_baseFor"),s=e("./keys");t.exports=n},{"./_baseFor":350,"./keys":512}],352:[function(e,t,r){function n(e,t){t=i(t,e);for(var r=0,n=t.length;null!=e&&ri)return r;do{t%2&&(r+=e),(t=s(t/2))&&(e+=e)}while(t);return r}var i=9007199254740991,s=Math.floor;t.exports=n},{}],378:[function(e,t,r){function n(e,t){return a(s(e,t,i),e+"")}var i=e("./identity"),s=e("./_overRest"),a=e("./_setToString");t.exports=n},{"./_overRest":461,"./_setToString":466,"./identity":495}],379:[function(e,t,r){var n=e("./constant"),i=e("./_defineProperty"),s=e("./identity"),a=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:s;t.exports=a},{"./_defineProperty":409,"./constant":483,"./identity":495}],380:[function(e,t,r){function n(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}t.exports=n},{}],381:[function(e,t,r){function n(e,t){for(var r=-1,n=Array(e);++r=c){var y=t?null:u(e);if(y)return l(y);f=!1,p=o,m=new i}else m=t?[]:d;e:for(;++nt||a&&o&&l&&!u&&!c||n&&o&&l||!r&&l||!s)return 1;if(!n&&!a&&!c&&e=u)return l;return l*("desc"==r[n]?-1:1)}}return e.index-t.index}var i=e("./_compareAscending");t.exports=n},{"./_compareAscending":396}],398:[function(e,t,r){function n(e,t){var r=-1,n=e.length +;for(t||(t=Array(n));++r1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&s(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n-1?o[u?t[l]:l]:void 0}}var i=e("./_baseIteratee"),s=e("./isArrayLike"),a=e("./keys");t.exports=n},{"./_baseIteratee":366,"./isArrayLike":499,"./keys":512}],407:[function(e,t,r){var n=e("./_Set"),i=e("./noop"),s=e("./_setToArray"),a=n&&1/s(new n([,-0]))[1]==1/0?function(e){return new n(e)}:i;t.exports=a},{"./_Set":320,"./_setToArray":465,"./noop":517}],408:[function(e,t,r){function n(e,t,r,n){return void 0===e||i(e,s[r])&&!a.call(n,r)?t:e}var i=e("./eq"),s=Object.prototype,a=s.hasOwnProperty;t.exports=n},{"./eq":485}],409:[function(e,t,r){var n=e("./_getNative"),i=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();t.exports=i},{"./_getNative":418}],410:[function(e,t,r){function n(e,t,r,n,l,c){var p=r&o,h=e.length,f=t.length;if(h!=f&&!(p&&f>h))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var m=-1,y=!0,g=r&u?new i:void 0;for(c.set(e,t),c.set(t,e);++m-1&&e%1==0&&e-1}var i=e("./_assocIndexOf");t.exports=n},{"./_assocIndexOf":340}],446:[function(e,t,r){function n(e,t){var r=this.__data__,n=i(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var i=e("./_assocIndexOf");t.exports=n},{"./_assocIndexOf":340}],447:[function(e,t,r){function n(){this.size=0,this.__data__={hash:new i,map:new(a||s),string:new i}}var i=e("./_Hash"),s=e("./_ListCache"),a=e("./_Map");t.exports=n},{"./_Hash":315,"./_ListCache":316,"./_Map":317}],448:[function(e,t,r){function n(e){var t=i(this,e).delete(e);return this.size-=t?1:0,t}var i=e("./_getMapData");t.exports=n},{"./_getMapData":416}],449:[function(e,t,r){function n(e){return i(this,e).get(e)}var i=e("./_getMapData");t.exports=n},{"./_getMapData":416}],450:[function(e,t,r){function n(e){return i(this,e).has(e)}var i=e("./_getMapData");t.exports=n},{"./_getMapData":416}],451:[function(e,t,r){function n(e,t){var r=i(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var i=e("./_getMapData");t.exports=n},{"./_getMapData":416}],452:[function(e,t,r){function n(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}t.exports=n},{}],453:[function(e,t,r){function n(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}t.exports=n},{}],454:[function(e,t,r){function n(e){var t=i(e,function(e){return r.size===s&&r.clear(),e}),r=t.cache;return t}var i=e("./memoize"),s=500;t.exports=n},{"./memoize":515}],455:[function(e,t,r){var n=e("./_getNative"),i=n(Object,"create");t.exports=i},{"./_getNative":418}],456:[function(e,t,r){var n=e("./_overArg"),i=n(Object.keys,Object);t.exports=i},{"./_overArg":460}],457:[function(e,t,r){function n(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}t.exports=n},{}],458:[function(e,t,r){var n=e("./_freeGlobal"),i="object"==typeof r&&r&&!r.nodeType&&r,s=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===i,o=a&&n.process,u=function(){try{return o&&o.binding&&o.binding("util")}catch(e){}}();t.exports=u},{"./_freeGlobal":413}],459:[function(e,t,r){function n(e){return s.call(e)}var i=Object.prototype,s=i.toString;t.exports=n},{}],460:[function(e,t,r){function n(e,t){return function(r){return e(t(r))}}t.exports=n},{}],461:[function(e,t,r){function n(e,t,r){return t=s(void 0===t?e.length-1:t,0),function(){for(var n=arguments,a=-1,o=s(n.length-t,0),u=Array(o);++a0){if(++t>=i)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var i=800,s=16,a=Date.now;t.exports=n},{}],468:[function(e,t,r){function n(){this.__data__=new i,this.size=0}var i=e("./_ListCache");t.exports=n},{"./_ListCache":316}],469:[function(e,t,r){function n(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}t.exports=n},{}],470:[function(e,t,r){function n(e){return this.__data__.get(e)}t.exports=n},{}],471:[function(e,t,r){function n(e){return this.__data__.has(e)}t.exports=n},{}],472:[function(e,t,r){function n(e,t){var r=this.__data__;if(r instanceof i){var n=r.__data__;if(!s||n.length-1:!!c&&i(e,t,r)>-1}var i=e("./_baseIndexOf"),s=e("./isArrayLike"),a=e("./isString"),o=e("./toInteger"),u=e("./values"),l=Math.max;t.exports=n},{"./_baseIndexOf":357,"./isArrayLike":499,"./isString":509,"./toInteger":525,"./values":530}],497:[function(e,t,r){var n=e("./_baseIsArguments"),i=e("./isObjectLike"),s=Object.prototype,a=s.hasOwnProperty,o=s.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!o.call(e,"callee")};t.exports=u},{"./_baseIsArguments":358,"./isObjectLike":506}],498:[function(e,t,r){var n=Array.isArray;t.exports=n},{}],499:[function(e,t,r){function n(e){return null!=e&&s(e.length)&&!i(e)}var i=e("./isFunction"),s=e("./isLength");t.exports=n},{"./isFunction":502,"./isLength":504}],500:[function(e,t,r){function n(e){return s(e)&&i(e)}var i=e("./isArrayLike"),s=e("./isObjectLike");t.exports=n},{"./isArrayLike":499,"./isObjectLike":506}],501:[function(e,t,r){var n=e("./_root"),i=e("./stubFalse"),s="object"==typeof r&&r&&!r.nodeType&&r,a=s&&"object"==typeof t&&t&&!t.nodeType&&t,o=a&&a.exports===s,u=o?n.Buffer:void 0,l=u?u.isBuffer:void 0,c=l||i;t.exports=c},{"./_root":462,"./stubFalse":523}],502:[function(e,t,r){function n(e){if(!s(e))return!1;var t=i(e);return t==o||t==u||t==a||t==l}var i=e("./_baseGetTag"),s=e("./isObject"),a="[object AsyncFunction]",o="[object Function]",u="[object GeneratorFunction]",l="[object Proxy]";t.exports=n},{"./_baseGetTag":354,"./isObject":505}],503:[function(e,t,r){function n(e){return"number"==typeof e&&e==i(e)}var i=e("./toInteger");t.exports=n},{"./toInteger":525}],504:[function(e,t,r){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}var i=9007199254740991;t.exports=n},{}],505:[function(e,t,r){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}t.exports=n},{}],506:[function(e,t,r){function n(e){return null!=e&&"object"==typeof e}t.exports=n},{}],507:[function(e,t,r){function n(e){if(!a(e)||i(e)!=o)return!1;var t=s(e);if(null===t)return!0;var r=p.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==h}var i=e("./_baseGetTag"),s=e("./_getPrototype"),a=e("./isObjectLike"),o="[object Object]",u=Function.prototype,l=Object.prototype,c=u.toString,p=l.hasOwnProperty,h=c.call(Object);t.exports=n},{"./_baseGetTag":354,"./_getPrototype":419,"./isObjectLike":506}],508:[function(e,t,r){var n=e("./_baseIsRegExp"),i=e("./_baseUnary"),s=e("./_nodeUtil"),a=s&&s.isRegExp,o=a?i(a):n;t.exports=o},{"./_baseIsRegExp":364,"./_baseUnary":383,"./_nodeUtil":458}],509:[function(e,t,r){function n(e){return"string"==typeof e||!s(e)&&a(e)&&i(e)==o}var i=e("./_baseGetTag"),s=e("./isArray"),a=e("./isObjectLike"),o="[object String]";t.exports=n},{"./_baseGetTag":354,"./isArray":498,"./isObjectLike":506}],510:[function(e,t,r){function n(e){return"symbol"==typeof e||s(e)&&i(e)==a}var i=e("./_baseGetTag"),s=e("./isObjectLike"),a="[object Symbol]";t.exports=n},{"./_baseGetTag":354,"./isObjectLike":506}],511:[function(e,t,r){var n=e("./_baseIsTypedArray"),i=e("./_baseUnary"),s=e("./_nodeUtil"),a=s&&s.isTypedArray,o=a?i(a):n;t.exports=o},{"./_baseIsTypedArray":365,"./_baseUnary":383,"./_nodeUtil":458}],512:[function(e,t,r){function n(e){return a(e)?i(e):s(e)}var i=e("./_arrayLikeKeys"),s=e("./_baseKeys"),a=e("./isArrayLike");t.exports=n},{"./_arrayLikeKeys":333,"./_baseKeys":367,"./isArrayLike":499}],513:[function(e,t,r){function n(e){return a(e)?i(e,!0):s(e)}var i=e("./_arrayLikeKeys"),s=e("./_baseKeysIn"),a=e("./isArrayLike");t.exports=n},{"./_arrayLikeKeys":333,"./_baseKeysIn":368,"./isArrayLike":499}],514:[function(e,t,r){function n(e,t){return(o(e)?i:a)(e,s(t,3))}var i=e("./_arrayMap"),s=e("./_baseIteratee"),a=e("./_baseMap"),o=e("./isArray");t.exports=n},{"./_arrayMap":334,"./_baseIteratee":366,"./_baseMap":369,"./isArray":498}],515:[function(e,t,r){function n(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(s);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=e.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(n.Cache||i),r}var i=e("./_MapCache"),s="Expected a function";n.Cache=i,t.exports=n},{"./_MapCache":318}],516:[function(e,t,r){var n=e("./_baseMerge"),i=e("./_createAssigner"),s=i(function(e,t,r,i){n(e,t,r,i)});t.exports=s},{"./_baseMerge":372,"./_createAssigner":403}],517:[function(e,t,r){function n(){}t.exports=n},{}],518:[function(e,t,r){function n(e){return a(e)?i(o(e)):s(e)}var i=e("./_baseProperty"),s=e("./_basePropertyDeep"),a=e("./_isKey"),o=e("./_toKey");t.exports=n},{"./_baseProperty":375,"./_basePropertyDeep":376,"./_isKey":437,"./_toKey":475}],519:[function(e,t,r){function n(e,t,r){return t=(r?s(e,t,r):void 0===t)?1:a(t),i(o(e),t)}var i=e("./_baseRepeat"),s=e("./_isIterateeCall"),a=e("./toInteger"),o=e("./toString");t.exports=n},{"./_baseRepeat":377,"./_isIterateeCall":436,"./toInteger":525,"./toString":528}],520:[function(e,t,r){var n=e("./_baseFlatten"),i=e("./_baseOrderBy"),s=e("./_baseRest"),a=e("./_isIterateeCall"),o=s(function(e,t){if(null==e)return[];var r=t.length;return r>1&&a(e,t[0],t[1])?t=[]:r>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),i(e,n(t,1),[])});t.exports=o},{"./_baseFlatten":349,"./_baseOrderBy":374,"./_baseRest":378,"./_isIterateeCall":436}],521:[function(e,t,r){function n(e,t,r){return e=o(e),r=null==r?0:i(a(r),0,e.length),t=s(t),e.slice(r,r+t.length)==t}var i=e("./_baseClamp"),s=e("./_baseToString"),a=e("./toInteger"),o=e("./toString");t.exports=n},{"./_baseClamp":344,"./_baseToString":382,"./toInteger":525,"./toString":528}],522:[function(e,t,r){function n(){return[]}t.exports=n},{}],523:[function(e,t,r){function n(){return!1}t.exports=n},{}],524:[function(e,t,r){function n(e){if(!e)return 0===e?e:0;if((e=i(e))===s||e===-s){return(e<0?-1:1)*a}return e===e?e:0}var i=e("./toNumber"),s=1/0,a=1.7976931348623157e308;t.exports=n},{"./toNumber":526}],525:[function(e,t,r){function n(e){var t=i(e),r=t%1;return t===t?r?t-r:t:0}var i=e("./toFinite");t.exports=n},{"./toFinite":524}],526:[function(e,t,r){function n(e){if("number"==typeof e)return e;if(s(e))return a;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var r=l.test(e);return r||c.test(e)?p(e.slice(2),r?2:8):u.test(e)?a:+e}var i=e("./isObject"),s=e("./isSymbol"),a=NaN,o=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,p=parseInt;t.exports=n},{"./isObject":505,"./isSymbol":510}],527:[function(e,t,r){function n(e){return i(e,s(e))}var i=e("./_copyObject"),s=e("./keysIn");t.exports=n},{"./_copyObject":399,"./keysIn":513}],528:[function(e,t,r){function n(e){return null==e?"":i(e)}var i=e("./_baseToString");t.exports=n},{"./_baseToString":382}],529:[function(e,t,r){function n(e){return e&&e.length?i(e):[]}var i=e("./_baseUniq");t.exports=n},{"./_baseUniq":384}],530:[function(e,t,r){function n(e){return null==e?[]:i(e,s(e))}var i=e("./_baseValues"),s=e("./keys");t.exports=n},{"./_baseValues":385,"./keys":512}],531:[function(e,t,r){function n(e,t){return t=t||{},function(r,n,i){return s(r,e,t)}}function i(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function s(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new a(t,r).match(e))}function a(e,t){if(!(this instanceof a))return new a(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==m.sep&&(e=e.split(m.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function o(){if(!this._made){var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(C)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r}}function u(){var e=this.pattern,t=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,s=e.length;i65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return y;if(""===e)return"";for(var i,s,a="",o=!!n.nocase,u=!1,l=[],c=[],p=!1,h=-1,d=-1,m="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this,E=0,A=e.length;E-1;P--){ +var B=c[P],O=a.slice(0,B.reStart),j=a.slice(B.reStart,B.reEnd-8),N=a.slice(B.reEnd-8,B.reEnd),I=a.slice(B.reEnd);N+=I;var L=O.split("(").length-1,M=I;for(E=0;E=0&&!(i=e[s]);s--);for(s=0;s>> no match, partial?",e,c,t,p),c!==a))}var f;if("string"==typeof u?(f=n.nocase?l.toLowerCase()===u.toLowerCase():l===u,this.debug("string match",u,l,f)):(f=l.match(u),this.debug("pattern match",u,l,f)),!f)return!1}if(i===a&&s===o)return!0;if(i===a)return r;if(s===o){return i===a-1&&""===e[i]}throw new Error("wtf?")}},{"brace-expansion":180,path:535}],532:[function(e,t,r){function n(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*p;case"days":case"day":case"d":return r*c;case"hours":case"hour":case"hrs":case"hr":case"h":return r*l;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function i(e){return e>=c?Math.round(e/c)+"d":e>=l?Math.round(e/l)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function s(e){return a(e,c,"day")||a(e,l,"hour")||a(e,u,"minute")||a(e,o,"second")||e+" ms"}function a(e,t,r){if(!(e0)return n(e);if("number"===r&&!1===isNaN(e))return t.long?s(e):i(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],533:[function(e,t,r){"use strict";t.exports=Number.isNaN||function(e){return e!==e}},{}],534:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n"},{}],535:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;s--){var a=s>=0?arguments[s]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),s="/"===a(e,-1);return e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),s=n(t.split("/")),a=Math.min(i.length,s.length),o=a,u=0;un&&(t[n]=t[r]),++n);return t.length=n,t},r.makeAccessor=l},{}],538:[function(e,t,r){(function(e){"use strict";function r(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var s,a,o=arguments.length;switch(o){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,r)});case 3:return e.nextTick(function(){t.call(null,r,n)});case 4:return e.nextTick(function(){t.call(null,r,n,i)});default:for(s=new Array(o-1),a=0;a1)for(var r=1;r0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||i||n||(r=t.decoder.write(r),l=!t.objectMode&&0===r.length),i||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&h(e))),d(e,t)}else i||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length=V?e=V:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var r=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function p(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(M("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?T(f,e):f(e))}function f(e){M("emit readable"),e.emit("readable"),x(e)}function d(e,t){t.readingMore||(t.readingMore=!0,T(m,e,t))}function m(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=A(e,t.buffer,t.decoder),r}function A(e,t,r){var n;return es.length?s.length:e;if(a===s.length?i+=s:i+=s.slice(0,e),0===(e-=a)){a===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(a));break}++n}return t.length-=n,i}function C(e,t){var r=N.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var s=n.data,a=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,a),0===(e-=a)){a===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(a));break}++i}return t.length-=i,r}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,T(_,t,e))}function _(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function w(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return M("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):h(this),null;if(0===(e=l(e,t))&&t.ended)return 0===t.length&&S(this),null;var n=t.needReadable;M("need readable",n),(0===t.length||t.length-e0?E(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&S(this)),null!==i&&this.emit("data",i),i},s.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},s.prototype.pipe=function(e,t){function i(e){M("onunpipe"),e===h&&a()}function s(){M("onend"),e.end()}function a(){M("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",g),e.removeListener("error",u),e.removeListener("unpipe",i),h.removeListener("end",s),h.removeListener("end",a),h.removeListener("data",o),b=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||g()}function o(t){M("ondata"),v=!1,!1!==e.write(t)||v||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&-1!==k(f.pipes,e))&&!b&&(M("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,v=!0),h.pause())}function u(t){M("onerror",t),p(),e.removeListener("error",u),0===O(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){M("onfinish"),e.removeListener("close",l),p()}function p(){M("unpipe"),h.unpipe(e)}var h=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,M("pipe count=%d opts=%j",f.pipesCount,t);var d=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,m=d?s:a;f.endEmitted?T(m):h.once("end",m),e.on("unpipe",i);var g=y(h);e.on("drain",g);var b=!1,v=!1;return h.on("data",o),n(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",h),f.flowing||(M("pipe resume"),h.resume()),e},s.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:C;a.WritableState=s;var _=e("core-util-is");_.inherits=e("inherits");var w,k={deprecate:e("util-deprecate")};!function(){try{w=e("stream")}catch(e){}finally{w||(w=e("events").EventEmitter)}}();var F=e("buffer").Buffer,T=e("buffer-shims");_.inherits(a,w),s.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(s.prototype,"buffer",{get:k.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var P;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(e){return!!P.call(this,e)||e&&e._writableState instanceof s}})):P=function(e){return e instanceof this},a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,r){var i=this._writableState,s=!1,a=F.isBuffer(e);return"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=n),i.ended?o(this,r):(a||u(this,i,e,r))&&(i.pendingcb++,s=c(this,i,a,e,t,r)),s},a.prototype.cork=function(){this._writableState.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||E(this,n,r)}}).call(this,e("_process"))},{"./_stream_duplex":541,_process:539,buffer:184,"buffer-shims":183,"core-util-is":294,events:301,inherits:306,"process-nextick-args":538,"util-deprecate":598}],546:[function(e,t,r){"use strict";function n(){this.head=null,this.tail=null,this.length=0}var i=(e("buffer").Buffer,e("buffer-shims"));t.exports=n,n.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},n.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},n.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},n.prototype.clear=function(){this.head=this.tail=null,this.length=0},n.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},n.prototype.concat=function(e){if(0===this.length)return i.alloc(0) +;if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t}},{buffer:184,"buffer-shims":183}],547:[function(e,t,r){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":542}],548:[function(e,t,r){(function(n){var i=function(){try{return e("stream")}catch(e){}}();r=t.exports=e("./lib/_stream_readable.js"),r.Stream=i||r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),!n.browser&&"disable"===n.env.READABLE_STREAM&&i&&(t.exports=i)}).call(this,e("_process"))},{"./lib/_stream_duplex.js":541,"./lib/_stream_passthrough.js":542,"./lib/_stream_readable.js":543,"./lib/_stream_transform.js":544,"./lib/_stream_writable.js":545,_process:539}],549:[function(e,t,r){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":544}],550:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":545}],551:[function(e,t,r){function n(e,t,r){if(e){if(x.fixFaultyLocations(e,t),r){if(d.Node.check(e)&&d.SourceLocation.check(e.loc)){for(var i=r.length-1;i>=0&&!(E(r[i].loc.end,e.loc.start)<=0);--i);return void r.splice(i+1,0,e)}}else if(e[A])return e[A];var s;if(m.check(e))s=Object.keys(e);else{if(!y.check(e))return;s=f.getFieldNames(e)}r||Object.defineProperty(e,A,{value:r=[],enumerable:!1});for(var i=0,a=s.length;i>1,l=s[u];if(E(l.loc.start,t.loc.start)<=0&&E(t.loc.end,l.loc.end)<=0)return void i(t.enclosingNode=l,t,r);if(E(l.loc.end,t.loc.start)<=0){var c=l;a=u+1}else{if(!(E(t.loc.end,l.loc.start)<=0))throw new Error("Comment location overlaps with node location");var p=l;o=u}}c&&(t.precedingNode=c),p&&(t.followingNode=p)}function s(e,t){var r=e.length;if(0!==r){for(var n=e[0].precedingNode,i=e[0].followingNode,s=i.loc.start,a=r;a>0;--a){var u=e[a-1];h.strictEqual(u.precedingNode,n),h.strictEqual(u.followingNode,i);var c=t.sliceString(u.loc.end,s);if(/\S/.test(c))break;s=u.loc.start}for(;a<=r&&(u=e[a])&&("Line"===u.type||"CommentLine"===u.type)&&u.loc.start.column>i.loc.start.column;)++a;e.forEach(function(e,t){t0){var d=n[f-1];h.strictEqual(d.precedingNode===e.precedingNode,d.followingNode===e.followingNode),d.followingNode!==e.followingNode&&s(n,r)}n.push(e)}else if(a)s(n,r),l(a,e);else if(p)s(n,r),o(p,e);else{if(!c)throw new Error("AST contains no nodes at all?");s(n,r),u(c,e)}}),s(n,r),e.forEach(function(e){delete e.precedingNode,delete e.enclosingNode,delete e.followingNode})}},r.printComments=function(e,t){var r=e.getValue(),n=t(e),i=d.Node.check(r)&&f.getFieldValue(r,"comments");if(!i||0===i.length)return n;var s=[],a=[n];return e.each(function(e){var n=e.getValue(),i=f.getFieldValue(n,"leading"),o=f.getFieldValue(n,"trailing");i||o&&!d.Statement.check(r)&&"Block"!==n.type&&"CommentBlock"!==n.type?s.push(c(e,t)):o&&a.push(p(e,t))},"comments"),s.push.apply(s,a),v(s)}},{"./lines":553,"./types":559,"./util":560,assert:3,private:537}],552:[function(e,t,r){function n(e){o.ok(this instanceof n),this.stack=[e]}function i(e,t){for(var r=e.stack,n=r.length-1;n>=0;n-=2){var i=r[n];if(l.Node.check(i)&&--t<0)return i}return null}function s(e){return l.BinaryExpression.check(e)||l.LogicalExpression.check(e)}function a(e){return!!l.CallExpression.check(e)||(c.check(e)?e.some(a):!!l.Node.check(e)&&u.someField(e,function(e,t){return a(t)}))}var o=e("assert"),u=e("./types"),l=u.namedTypes,c=(l.Node,u.builtInTypes.array),p=u.builtInTypes.number,h=n.prototype;t.exports=n,n.from=function(e){if(e instanceof n)return e.copy();if(e instanceof u.NodePath){for(var t,r=Object.create(n.prototype),i=[e.value];t=e.parentPath;e=t)i.push(e.name,t.value);return r.stack=i.reverse(),r}return new n(e)},h.copy=function(){var e=Object.create(n.prototype);return e.stack=this.stack.slice(0),e},h.getName=function(){var e=this.stack,t=e.length;return t>1?e[t-2]:null},h.getValue=function(){var e=this.stack;return e[e.length-1]},h.getNode=function(e){return i(this,~~e)},h.getParentNode=function(e){return i(this,1+~~e)},h.getRootValue=function(){var e=this.stack;return e.length%2==0?e[1]:e[0]},h.call=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,s=1;sh)return!0;if(u===h&&"right"===r)return o.strictEqual(t.right,n),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ReturnStatement":case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==r;default:return!0}case"YieldExpression":switch(t.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"IntersectionTypeAnnotation":case"UnionTypeAnnotation":return"NullableTypeAnnotation"===t.type;case"Literal":return"MemberExpression"===t.type&&p.check(n.value)&&"object"===r&&t.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===r&&t.callee===n;case"ConditionalExpression":return"test"===r&&t.test===n;case"MemberExpression":return"object"===r&&t.object===n;default:return!1}case"ArrowFunctionExpression":return!(!l.CallExpression.check(t)||"callee"!==r)||(!(!l.MemberExpression.check(t)||"object"!==r)||s(t));case"ObjectExpression":if("ArrowFunctionExpression"===t.type&&"body"===r)return!0;default:if("NewExpression"===t.type&&"callee"===r&&t.callee===n)return a(n)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var f={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%","**"]].forEach(function(e,t){e.forEach(function(e){f[e]=t})}),h.canBeFirstInStatement=function(){var e=this.getNode();return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},h.firstInStatement=function(){for(var e,t,r,n,i=this.stack,a=i.length-1;a>=0;a-=2)if(l.Node.check(i[a])&&(r=e,n=t,e=i[a-1],t=i[a]),t&&n){if(l.BlockStatement.check(t)&&"body"===e&&0===r)return o.strictEqual(t.body[0],n),!0;if(l.ExpressionStatement.check(t)&&"expression"===r)return o.strictEqual(t.expression,n),!0;if(l.SequenceExpression.check(t)&&"expressions"===e&&0===r)o.strictEqual(t.expressions[0],n);else if(l.CallExpression.check(t)&&"callee"===r)o.strictEqual(t.callee,n);else if(l.MemberExpression.check(t)&&"object"===r)o.strictEqual(t.object,n);else if(l.ConditionalExpression.check(t)&&"test"===r)o.strictEqual(t.test,n);else if(s(t)&&"left"===r)o.strictEqual(t.left,n);else{if(!l.UnaryExpression.check(t)||t.prefix||"argument"!==r)return!1;o.strictEqual(t.argument,n)}}return!0}},{"./types":559,assert:3}],553:[function(e,t,r){function n(e){return e[f]}function i(e,t){c.ok(this instanceof i),c.ok(e.length>0),t?m.assert(t):t=null,Object.defineProperty(this,f,{value:{infos:e,mappings:[],name:t,cachedSourceMap:null}}),t&&n(this).mappings.push(new g(this,{start:this.firstPos(),end:this.lastPos()}))}function s(e){return{line:e.line,indent:e.indent,locked:e.locked,sliceStart:e.sliceStart,sliceEnd:e.sliceEnd}}function a(e,t){for(var r=0,n=e.length,i=0;i0);var s=Math.ceil(r/t)*t;s===r?r+=t:r=s;break;case 11:case 12:case 13:case 65279:break;case 32:default:r+=1}return r}function o(e,t){if(e instanceof i)return e;e+="";var r=t&&t.tabWidth,n=e.indexOf("\t")<0,s=!(!t||!t.locked),o=!t&&n&&e.length<=E;if(c.ok(r||n,"No tab width specified but encountered tabs in string\n"+e),o&&x.call(v,e))return v[e];var u=new i(e.split(D).map(function(e){var t=A.exec(e)[0];return{line:e,indent:a(t,r),locked:s,sliceStart:t.length,sliceEnd:e.length}}),h(t).sourceFileName);return o&&(v[e]=u),u}function u(e){return!/\S/.test(e)}function l(e,t,r){var n=e.sliceStart,i=e.sliceEnd,s=Math.max(e.indent,0),a=s+i-n;return void 0===r&&(r=a),t=Math.max(t,0),r=Math.min(r,a),r=Math.max(r,t),r=0),c.ok(n<=i),c.strictEqual(a,s+i-n),e.indent===s&&e.sliceStart===n&&e.sliceEnd===i?e:{line:e.line,indent:s,locked:!1,sliceStart:n,sliceEnd:i}}var c=e("assert"),p=e("source-map"),h=e("./options").normalize,f=e("private").makeUniqueKey(),d=e("./types"),m=d.builtInTypes.string,y=e("./util").comparePos,g=e("./mapping");r.Lines=i;var b=i.prototype;Object.defineProperties(b,{length:{get:function(){return n(this).infos.length}},name:{get:function(){return n(this).name}}});var v={},x=v.hasOwnProperty,E=10;r.countSpaces=a;var A=/^\s*/,D=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;r.fromString=o,b.toString=function(e){return this.sliceString(this.firstPos(),this.lastPos(),e)},b.getSourceMap=function(e,t){function r(r){return r=r||{},m.assert(e),r.file=e,t&&(m.assert(t),r.sourceRoot=t),r}if(!e)return null;var i=this,s=n(i);if(s.cachedSourceMap)return r(s.cachedSourceMap.toJSON());var a=new p.SourceMapGenerator(r()),o={};return s.mappings.forEach(function(e){for(var t=e.sourceLines.skipSpaces(e.sourceLoc.start)||e.sourceLines.lastPos(),r=i.skipSpaces(e.targetLoc.start)||i.lastPos();y(t,e.sourceLoc.end)<0&&y(r,e.targetLoc.end)<0;){var n=e.sourceLines.charAt(t),s=i.charAt(r);c.strictEqual(n,s);var u=e.sourceLines.name;if(a.addMapping({source:u,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column}}),!x.call(o,u)){var l=e.sourceLines.toString();a.setSourceContent(u,l),o[u]=l}i.nextPos(r,!0),e.sourceLines.nextPos(t,!0)}}),s.cachedSourceMap=a,a.toJSON()},b.bootstrapCharAt=function(e){c.strictEqual(typeof e,"object"),c.strictEqual(typeof e.line,"number"),c.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,n=this.toString().split(D),i=n[t-1];return void 0===i?"":r===i.length&&t=i.length?"":i.charAt(r)},b.charAt=function(e){c.strictEqual(typeof e,"object"),c.strictEqual(typeof e.line,"number"),c.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,i=n(this),s=i.infos,a=s[t-1],o=r;if(void 0===a||o<0)return"";var u=this.getIndentAt(t);return o=a.sliceEnd?"":a.line.charAt(o))},b.stripMargin=function(e,t){if(0===e)return this;if(c.ok(e>0,"negative margin: "+e),t&&1===this.length)return this;var r=n(this),a=new i(r.infos.map(function(r,n){return r.line&&(n>0||!t)&&(r=s(r),r.indent=Math.max(0,r.indent-e)),r}));if(r.mappings.length>0){var o=n(a).mappings;c.strictEqual(o.length,0),r.mappings.forEach(function(r){o.push(r.indent(e,t,!0))})}return a},b.indent=function(e){if(0===e)return this;var t=n(this),r=new i(t.infos.map(function(t){return t.line&&!t.locked&&(t=s(t),t.indent+=e),t}));if(t.mappings.length>0){var a=n(r).mappings;c.strictEqual(a.length,0),t.mappings.forEach(function(t){a.push(t.indent(e))})}return r},b.indentTail=function(e){if(0===e)return this;if(this.length<2)return this;var t=n(this),r=new i(t.infos.map(function(t,r){return r>0&&t.line&&!t.locked&&(t=s(t),t.indent+=e),t}));if(t.mappings.length>0){var a=n(r).mappings;c.strictEqual(a.length,0),t.mappings.forEach(function(t){a.push(t.indent(e,!0))})}return r},b.lockIndentTail=function(){return this.length<2?this:new i(n(this).infos.map(function(e,t){return e=s(e),e.locked=t>0,e}))},b.getIndentAt=function(e){c.ok(e>=1,"no line "+e+" (line numbers start from 1)");var t=n(this),r=t.infos[e-1];return Math.max(r.indent,0)},b.guessTabWidth=function(){var e=n(this);if(x.call(e,"cachedTabWidth"))return e.cachedTabWidth;for(var t=[],r=0,i=1,s=this.length;i<=s;++i){var a=e.infos[i-1];if(!u(a.line.slice(a.sliceStart,a.sliceEnd))){var o=Math.abs(a.indent-r);t[o]=1+~~t[o],r=a.indent}}for(var l=-1,c=2,p=1;pl&&(l=t[p],c=p);return e.cachedTabWidth=c},b.startsWithComment=function(){var e=n(this);if(0===e.infos.length)return!1;var t=e.infos[0],r=t.sliceStart,i=t.sliceEnd,s=t.line.slice(r,i).trim();return 0===s.length||"//"===s.slice(0,2)||"/*"===s.slice(0,2)},b.isOnlyWhitespace=function(){return u(this.toString())},b.isPrecededOnlyByWhitespace=function(e){var t=n(this),r=t.infos[e.line-1],i=Math.max(r.indent,0),s=e.column-i;if(s<=0)return!0;var a=r.sliceStart,o=Math.min(a+s,r.sliceEnd);return u(r.line.slice(a,o))},b.getLineLength=function(e){var t=n(this),r=t.infos[e-1];return this.getIndentAt(e)+r.sliceEnd-r.sliceStart},b.nextPos=function(e,t){var r=Math.max(e.line,0);return Math.max(e.column,0)0){var o=n(a).mappings;c.strictEqual(o.length,0),r.mappings.forEach(function(r){var n=r.slice(this,e,t);n&&o.push(n)},this)}return a},b.bootstrapSliceString=function(e,t,r){return this.slice(e,t).toString(r)},b.sliceString=function(e,t,r){if(!t){if(!e)return this;t=this.lastPos()}r=h(r);for(var i=n(this).infos,s=[],o=r.tabWidth,c=e.line;c<=t.line;++c){var p=i[c-1];c===e.line?p=c===t.line?l(p,e.column,t.column):l(p,e.column):c===t.line&&(p=l(p,0,t.column));var f=Math.max(p.indent,0),d=p.line.slice(0,p.sliceStart);if(r.reuseWhitespace&&u(d)&&a(d,r.tabWidth)===f)s.push(p.line.slice(0,p.sliceEnd));else{var m=0,y=f;r.useTabs&&(m=Math.floor(f/o),y-=m*o);var g="";m>0&&(g+=new Array(m+1).join("\t")),y>0&&(g+=new Array(y+1).join(" ")),g+=p.line.slice(p.sliceStart,p.sliceEnd),s.push(g)}}return s.join(r.lineTerminator)},b.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1},b.join=function(e){function t(e){if(null!==e){if(a){var t=e.infos[0],r=new Array(t.indent+1).join(" "),n=c.length,i=Math.max(a.indent,0)+a.sliceEnd-a.sliceStart;a.line=a.line.slice(0,a.sliceEnd)+r+t.line.slice(t.sliceStart,t.sliceEnd),a.locked=a.locked||t.locked,a.sliceEnd=a.line.length,e.mappings.length>0&&e.mappings.forEach(function(e){p.push(e.add(n,i))})}else e.mappings.length>0&&p.push.apply(p,e.mappings);e.infos.forEach(function(e,t){(!a||t>0)&&(a=s(e),c.push(a))})}}function r(e,r){r>0&&t(l),t(e)}var a,u=this,l=n(u),c=[],p=[];if(e.map(function(e){var t=o(e);return t.isEmpty()?null:n(t)}).forEach(u.isEmpty()?t:r),c.length<1)return C;var h=new i(c);return n(h).mappings=p,h},r.concat=function(e){return C.join(e)},b.concat=function(e){var t=arguments,r=[this];return r.push.apply(r,t),c.strictEqual(r.length,t.length+1),C.join(r)};var C=o("")},{"./mapping":554,"./options":555,"./types":559,"./util":560,assert:3,private:537,"source-map":573}],554:[function(e,t,r){function n(e,t,r){o.ok(this instanceof n),o.ok(e instanceof h.Lines),c.assert(t),r?o.ok(l.check(r.start.line)&&l.check(r.start.column)&&l.check(r.end.line)&&l.check(r.end.column)):r=t,Object.defineProperties(this,{sourceLines:{value:e},sourceLoc:{value:t},targetLoc:{value:r}})}function i(e,t,r){return{line:e.line+t-1,column:1===e.line?e.column+r:e.column}}function s(e,t,r){return{line:e.line-t+1,column:e.line===t?e.column-r:e.column}}function a(e,t,r,n,i){o.ok(e instanceof h.Lines),o.ok(r instanceof h.Lines),p.assert(t),p.assert(n),p.assert(i);var s=f(n,i);if(0===s)return t;if(s<0){var a=e.skipSpaces(t),u=r.skipSpaces(n),l=i.line-u.line;for(a.line+=l,u.line+=l,l>0?(a.column=0,u.column=0):o.strictEqual(l,0);f(u,i)<0&&r.nextPos(u,!0);)o.ok(e.nextPos(a,!0)),o.strictEqual(e.charAt(a),r.charAt(u))}else{var a=e.skipSpaces(t,!0),u=r.skipSpaces(n,!0),l=i.line-u.line;for(a.line+=l,u.line+=l,l<0?(a.column=e.getLineLength(a.line),u.column=r.getLineLength(u.line)):o.strictEqual(l,0);f(i,u)<0&&r.prevPos(u,!0);)o.ok(e.prevPos(a,!0)),o.strictEqual(e.charAt(a),r.charAt(u))}return a}var o=e("assert"),u=e("./types"),l=(u.builtInTypes.string,u.builtInTypes.number),c=u.namedTypes.SourceLocation,p=u.namedTypes.Position,h=e("./lines"),f=e("./util").comparePos,d=n.prototype;t.exports=n,d.slice=function(e,t,r){function i(n){var i=l[n],s=c[n],p=t;return"end"===n?p=r:o.strictEqual(n,"start"),a(u,i,e,s,p)}o.ok(e instanceof h.Lines),p.assert(t),r?p.assert(r):r=e.lastPos();var u=this.sourceLines,l=this.sourceLoc,c=this.targetLoc;if(f(t,c.start)<=0)if(f(c.end,r)<=0)c={start:s(c.start,t.line,t.column),end:s(c.end,t.line,t.column)};else{if(f(r,c.start)<=0)return null;l={start:l.start,end:i("end")},c={start:s(c.start,t.line,t.column),end:s(r,t.line,t.column)}}else{if(f(c.end,t)<=0)return null;f(c.end,r)<=0?(l={start:i("start"),end:l.end},c={start:{line:1,column:0},end:s(c.end,t.line,t.column)}):(l={start:i("start"),end:i("end")},c={start:{line:1,column:0},end:s(r,t.line,t.column)})}return new n(this.sourceLines,l,c)},d.add=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:i(this.targetLoc.start,e,t),end:i(this.targetLoc.end,e,t)})},d.subtract=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:s(this.targetLoc.start,e,t),end:s(this.targetLoc.end,e,t)})},d.indent=function(e,t,r){if(0===e)return this;var i=this.targetLoc,s=i.start.line,a=i.end.line;if(t&&1===s&&1===a)return this;if(i={start:i.start,end:i.end},!t||s>1){var o=i.start.column+e;i.start={line:s,column:r?Math.max(0,o):o}}if(!t||a>1){var u=i.end.column+e;i.end={line:a,column:r?Math.max(0,u):u}}return new n(this.sourceLines,this.sourceLoc,i)}},{"./lines":553,"./types":559,"./util":560,assert:3}],555:[function(e,t,r){var n={parser:e("esprima"),tabWidth:4,useTabs:!1,reuseWhitespace:!0,lineTerminator:e("os").EOL,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:!1,tolerant:!0,quote:null,trailingComma:!1,arrayBracketSpacing:!1,objectCurlySpacing:!0,arrowParensAlways:!1,flowObjectCommas:!0},i=n.hasOwnProperty;r.normalize=function(e){function t(t){return i.call(e,t)?e[t]:n[t]}return e=e||n,{tabWidth:+t("tabWidth"),useTabs:!!t("useTabs"),reuseWhitespace:!!t("reuseWhitespace"),lineTerminator:t("lineTerminator"),wrapColumn:Math.max(t("wrapColumn"),0),sourceFileName:t("sourceFileName"),sourceMapName:t("sourceMapName"),sourceRoot:t("sourceRoot"),inputSourceMap:t("inputSourceMap"),parser:t("esprima")||t("parser"),range:t("range"),tolerant:t("tolerant"),quote:t("quote"),trailingComma:t("trailingComma"),arrayBracketSpacing:t("arrayBracketSpacing"),objectCurlySpacing:t("objectCurlySpacing"),arrowParensAlways:t("arrowParensAlways"),flowObjectCommas:t("flowObjectCommas")}}},{esprima:562,os:534}],556:[function(e,t,r){function n(e){i.ok(this instanceof n),this.lines=e,this.indent=0}var i=e("assert"),s=e("./types"),a=(s.namedTypes,s.builders),o=s.builtInTypes.object,u=s.builtInTypes.array,l=(s.builtInTypes.function,e("./patcher").Patcher,e("./options").normalize),c=e("./lines").fromString,p=e("./comments").attach,h=e("./util");r.parse=function(e,t){t=l(t);var r=c(e,t),i=r.toString({tabWidth:t.tabWidth,reuseWhitespace:!1,useTabs:!1}),s=[],o=t.parser.parse(i,{jsx:!0,loc:!0,locations:!0,range:t.range,comment:!0,onComment:s,tolerant:t.tolerant,ecmaVersion:6,sourceType:"module"});h.fixFaultyLocations(o,r),o.loc=o.loc||{start:r.firstPos(),end:r.lastPos()},o.loc.lines=r,o.loc.indent=0;var u=h.getTrueLoc(o,r);o.loc.start=u.start,o.loc.end=u.end,o.comments&&(s=o.comments,delete o.comments);var f=o;if("Program"===f.type){var f=a.file(o,t.sourceFileName||null);f.loc={lines:r,indent:0,start:r.firstPos(),end:r.lastPos()}}else"File"===f.type&&(o=f.program);return p(s,o.body.length?f.program:f,r),new n(r).copy(f)},n.prototype.copy=function(e){if(u.check(e))return e.map(this.copy,this);if(!o.check(e))return e;h.fixFaultyLocations(e,this.lines);var t=Object.create(Object.getPrototypeOf(e),{original:{value:e,configurable:!1,enumerable:!1,writable:!0}}),r=e.loc,n=this.indent,i=n;r&&(("Block"===e.type||"Line"===e.type||"CommentBlock"===e.type||"CommentLine"===e.type||this.lines.isPrecededOnlyByWhitespace(r.start))&&(i=this.indent=r.start.column),r.lines=this.lines,r.indent=i);for(var s=Object.keys(e),a=s.length,l=0;l0||(n(i,e.start),s.push(e.lines),i=e.end)}),n(i,t.end),y.concat(s)}}function i(e){var t=[];return e.comments&&e.comments.length>0&&e.comments.forEach(function(e){(e.leading||e.trailing)&&t.push(e)}),t}function s(e,t,r){var n=A.copyPos(t.start),i=e.prevPos(n)&&e.charAt(n),s=r.charAt(r.firstPos());return i&&k.test(i)&&s&&k.test(s)}function a(e,t,r){var n=e.charAt(t.end),i=r.lastPos(),s=r.prevPos(i)&&r.charAt(i);return s&&k.test(s)&&n&&k.test(n)}function o(e,t){var r=e.getValue();b.assert(r);var n=r.original;if(b.assert(n),m.deepEqual(t,[]),r.type!==n.type)return!1;var i=new C(n),s=d(e,i,t);return s||(t.length=0),s}function u(e,t,r){var n=e.getValue();return n===t.getValue()||(_.check(n)?l(e,t,r):!!S.check(n)&&c(e,t,r))}function l(e,t,r){var n=e.getValue(),i=t.getValue();_.assert(n);var s=n.length;if(!_.check(i)||i.length!==s)return!1;for(var a=0;aa)}var m=e("assert"),y=e("./lines"),g=e("./types"),b=(g.getFieldValue,g.namedTypes.Printable),v=g.namedTypes.Expression,x=g.namedTypes.ReturnStatement,E=g.namedTypes.SourceLocation,A=e("./util"),D=A.comparePos,C=e("./fast-path"),S=g.builtInTypes.object,_=g.builtInTypes.array,w=g.builtInTypes.string,k=/[0-9a-z_$]/i;r.Patcher=n;var F=n.prototype;F.tryToReprintComments=function(e,t,r){var n=this;if(!e.comments&&!t.comments)return!0;var s=C.from(e),a=C.from(t);s.stack.push("comments",i(e)),a.stack.push("comments",i(t));var o=[],u=l(s,a,o);return u&&o.length>0&&o.forEach(function(e){var t=e.oldPath.getValue();m.ok(t.leading||t.trailing),n.replace(t.loc,r(e.newPath).indentTail(t.loc.indent))}),u},F.deleteComments=function(e){if(e.comments){var t=this;e.comments.forEach(function(r){r.leading?t.replace({start:r.loc.start,end:e.loc.lines.skipSpaces(r.loc.end,!1,!1)},""):r.trailing&&t.replace({start:e.loc.lines.skipSpaces(r.loc.start,!0,!1),end:r.loc.end},"")})}},r.getReprinter=function(e){m.ok(e instanceof C);var t=e.getValue();if(b.check(t)){var r=t.original,i=r&&r.loc,u=i&&i.lines,l=[];if(u&&o(e,l))return function(e){var t=new n(u);return l.forEach(function(r){var n=r.newPath.getValue(),i=r.oldPath.getValue();E.assert(i.loc,!0);var o=!t.tryToReprintComments(n,i,e);o&&t.deleteComments(i);var l=e(r.newPath,o).indentTail(i.loc.indent),c=s(u,i.loc,l),p=a(u,i.loc,l);if(c||p){var h=[];c&&h.push(" "),h.push(l),p&&h.push(" "),l=y.concat(h)}t.replace(i.loc,l)}),t.get(i).indentTail(-r.loc.indent)}}};var T={line:1,column:0},P=/\S/},{"./fast-path":552,"./lines":553,"./types":559,"./util":560,assert:3}],558:[function(e,t,r){function n(e,t){D.ok(this instanceof n),B.assert(e),this.code=e,t&&(O.assert(t),this.map=t)}function i(e){function t(e){return D.ok(e instanceof j),C(e,r)}function r(e,r){if(r)return t(e);if(D.ok(e instanceof j),!c){var n=p.tabWidth,i=e.getNode().loc;if(i&&i.lines&&i.lines.guessTabWidth){p.tabWidth=i.lines.guessTabWidth();var s=o(e);return p.tabWidth=n,s}}return o(e)}function o(e){var t=F(e);return t?s(e,t(r)):u(e)}function u(e,r){return r?C(e,u):a(e,p,t)}function l(e){return a(e,p,l)}D.ok(this instanceof i);var c=e&&e.tabWidth,p=k(e);D.notStrictEqual(p,e),p.sourceFileName=null,this.print=function(e){if(!e)return M;var t=r(j.from(e),!0);return new n(t.toString(p),N.composeSourceMaps(p.inputSourceMap,t.getSourceMap(p.sourceMapName,p.sourceRoot)))},this.printGenerically=function(e){if(!e)return M;var t=j.from(e),r=p.reuseWhitespace;p.reuseWhitespace=!1;var i=new n(l(t).toString(p));return p.reuseWhitespace=r,i}}function s(e,t){return e.needsParens()?w(["(",t,")"]):t}function a(e,t,r){D.ok(e instanceof j);var n=e.getValue(),i=[],s=!1,a=o(e,t,r);return!n||a.isEmpty()?a:(n.decorators&&n.decorators.length>0&&!N.getParentExportDeclaration(e)?e.each(function(e){i.push(r(e),"\n")},"decorators"):N.isExportDeclaration(n)&&n.declaration&&n.declaration.decorators?e.each(function(e){i.push(r(e),"\n")},"declaration","decorators"):s=e.needsParens(),s&&i.unshift("("),i.push(a),s&&i.push(")"),w(i))}function o(e,t,r){var n=e.getValue();if(!n)return _("");if("string"==typeof n)return _(n,t);P.Printable.assert(n);var i=[];switch(n.type){case"File":return e.call(r,"program");case"Program":return n.directives&&e.each(function(e){i.push(r(e),";\n")},"directives"),i.push(e.call(function(e){return u(e,t,r)},"body")),w(i);case"Noop":case"EmptyStatement":return _("");case"ExpressionStatement":return w([e.call(r,"expression"),";"]);case"ParenthesizedExpression":return w(["(",e.call(r,"expression"),")"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return _(" ").join([e.call(r,"left"),n.operator,e.call(r,"right")]);case"AssignmentPattern":return w([e.call(r,"left")," = ",e.call(r,"right")]);case"MemberExpression":i.push(e.call(r,"object"));var s=e.call(r,"property");return n.computed?i.push("[",s,"]"):i.push(".",s),w(i);case"MetaProperty":return w([e.call(r,"meta"),".",e.call(r,"property")]);case"BindExpression":return n.object&&i.push(e.call(r,"object")),i.push("::",e.call(r,"callee")),w(i);case"Path":return _(".").join(n.body);case"Identifier":return w([_(n.name,t),e.call(r,"typeAnnotation")]);case"SpreadElement":case"SpreadElementPattern":case"RestProperty":case"SpreadProperty":case"SpreadPropertyPattern":case"RestElement":return w(["...",e.call(r,"argument")]);case"FunctionDeclaration":case"FunctionExpression":return n.async&&i.push("async "),i.push("function"),n.generator&&i.push("*"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),i.push("(",f(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),w(i);case"ArrowFunctionExpression":return n.async&&i.push("async "),n.typeParameters&&i.push(e.call(r,"typeParameters")),t.arrowParensAlways||1!==n.params.length||n.rest||"Identifier"!==n.params[0].type||n.params[0].typeAnnotation||n.returnType?i.push("(",f(e,t,r),")",e.call(r,"returnType")):i.push(e.call(r,"params",0)),i.push(" => ",e.call(r,"body")),w(i);case"MethodDefinition": +return n.static&&i.push("static "),i.push(c(e,t,r)),w(i);case"YieldExpression":return i.push("yield"),n.delegate&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),w(i);case"AwaitExpression":return i.push("await"),n.all&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),w(i);case"ModuleDeclaration":return i.push("module",e.call(r,"id")),n.source?(D.ok(!n.body),i.push("from",e.call(r,"source"))):i.push(e.call(r,"body")),_(" ").join(i);case"ImportSpecifier":return n.imported?(i.push(e.call(r,"imported")),n.local&&n.local.name!==n.imported.name&&i.push(" as ",e.call(r,"local"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),w(i);case"ExportSpecifier":return n.local?(i.push(e.call(r,"local")),n.exported&&n.exported.name!==n.local.name&&i.push(" as ",e.call(r,"exported"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),w(i);case"ExportBatchSpecifier":return _("*");case"ImportNamespaceSpecifier":return i.push("* as "),n.local?i.push(e.call(r,"local")):n.id&&i.push(e.call(r,"id")),w(i);case"ImportDefaultSpecifier":return n.local?e.call(r,"local"):e.call(r,"id");case"ExportDeclaration":case"ExportDefaultDeclaration":case"ExportNamedDeclaration":return m(e,t,r);case"ExportAllDeclaration":return i.push("export *"),n.exported&&i.push(" as ",e.call(r,"exported")),i.push(" from ",e.call(r,"source")),w(i);case"ExportNamespaceSpecifier":return w(["* as ",e.call(r,"exported")]);case"ExportDefaultSpecifier":return e.call(r,"exported");case"Import":return _("import",t);case"ImportDeclaration":if(i.push("import "),n.importKind&&"value"!==n.importKind&&i.push(n.importKind+" "),n.specifiers&&n.specifiers.length>0){var a=!1;e.each(function(e){e.getName()>0&&i.push(", ");var n=e.getValue();P.ImportDefaultSpecifier.check(n)||P.ImportNamespaceSpecifier.check(n)?D.strictEqual(a,!1):(P.ImportSpecifier.assert(n),a||(a=!0,i.push(t.objectCurlySpacing?"{ ":"{"))),i.push(r(e))},"specifiers"),a&&i.push(t.objectCurlySpacing?" }":"}"),i.push(" from ")}return i.push(e.call(r,"source"),";"),w(i);case"BlockStatement":var o=e.call(function(e){return u(e,t,r)},"body");return!o.isEmpty()||n.directives&&0!==n.directives.length?(i.push("{\n"),n.directives&&e.each(function(e){i.push(r(e).indent(t.tabWidth),";",n.directives.length>1||!o.isEmpty()?"\n":"")},"directives"),i.push(o.indent(t.tabWidth)),i.push("\n}"),w(i)):_("{}");case"ReturnStatement":if(i.push("return"),n.argument){var l=e.call(r,"argument");l.startsWithComment()||l.length>1&&P.JSXElement&&P.JSXElement.check(n.argument)?i.push(" (\n",l.indent(t.tabWidth),"\n)"):i.push(" ",l)}return i.push(";"),w(i);case"CallExpression":return w([e.call(r,"callee"),h(e,t,r)]);case"ObjectExpression":case"ObjectPattern":case"ObjectTypeAnnotation":var b=!1,x="ObjectTypeAnnotation"===n.type,A=t.flowObjectCommas?",":x?";":",",C=[];x&&C.push("indexers","callProperties"),C.push("properties");var S=0;C.forEach(function(e){S+=n[e].length});var k=x&&1===S||0===S,F=n.exact?"{|":"{",T=n.exact?"|}":"}";i.push(k?F:F+"\n");var B=i.length-1,O=0;return C.forEach(function(n){e.each(function(e){var n=r(e);k||(n=n.indent(t.tabWidth));var s=!x&&n.length>1;s&&b&&i.push("\n"),i.push(n),O0&&i.push(" "):n=n.indent(t.tabWidth),i.push(n),(r1?i.push(_(",\n").join(L).indentTail(n.kind.length+1)):i.push(L[0]);var U=e.getParentNode();return P.ForStatement.check(U)||P.ForInStatement.check(U)||P.ForOfStatement&&P.ForOfStatement.check(U)||P.ForAwaitStatement&&P.ForAwaitStatement.check(U)||i.push(";"),w(i);case"VariableDeclarator":return n.init?_(" = ").join([e.call(r,"id"),e.call(r,"init")]):e.call(r,"id");case"WithStatement":return w(["with (",e.call(r,"object"),") ",e.call(r,"body")]);case"IfStatement":var V=g(e.call(r,"consequent"),t),i=["if (",e.call(r,"test"),")",V];return n.alternate&&i.push(v(V)?" else":"\nelse",g(e.call(r,"alternate"),t)),w(i);case"ForStatement":var q=e.call(r,"init"),G=q.length>1?";\n":"; ",X=_(G).join([q,e.call(r,"test"),e.call(r,"update")]).indentTail("for (".length),J=w(["for (",X,")"]),W=g(e.call(r,"body"),t),i=[J];return J.length>1&&(i.push("\n"),W=W.trimLeft()),i.push(W),w(i);case"WhileStatement":return w(["while (",e.call(r,"test"),")",g(e.call(r,"body"),t)]);case"ForInStatement":return w([n.each?"for each (":"for (",e.call(r,"left")," in ",e.call(r,"right"),")",g(e.call(r,"body"),t)]);case"ForOfStatement":return w(["for (",e.call(r,"left")," of ",e.call(r,"right"),")",g(e.call(r,"body"),t)]);case"ForAwaitStatement":return w(["for await (",e.call(r,"left")," of ",e.call(r,"right"),")",g(e.call(r,"body"),t)]);case"DoWhileStatement":var K=w(["do",g(e.call(r,"body"),t)]),i=[K];return v(K)?i.push(" while"):i.push("\nwhile"),i.push(" (",e.call(r,"test"),");"),w(i);case"DoExpression":var z=e.call(function(e){return u(e,t,r)},"body");return w(["do {\n",z.indent(t.tabWidth),"\n}"]);case"BreakStatement":return i.push("break"),n.label&&i.push(" ",e.call(r,"label")),i.push(";"),w(i);case"ContinueStatement":return i.push("continue"),n.label&&i.push(" ",e.call(r,"label")),i.push(";"),w(i);case"LabeledStatement":return w([e.call(r,"label"),":\n",e.call(r,"body")]);case"TryStatement":return i.push("try ",e.call(r,"block")),n.handler?i.push(" ",e.call(r,"handler")):n.handlers&&e.each(function(e){i.push(" ",r(e))},"handlers"),n.finalizer&&i.push(" finally ",e.call(r,"finalizer")),w(i);case"CatchClause":return i.push("catch (",e.call(r,"param")),n.guard&&i.push(" if ",e.call(r,"guard")),i.push(") ",e.call(r,"body")),w(i);case"ThrowStatement":return w(["throw ",e.call(r,"argument"),";"]);case"SwitchStatement":return w(["switch (",e.call(r,"discriminant"),") {\n",_("\n").join(e.map(r,"cases")),"\n}"]);case"SwitchCase":return n.test?i.push("case ",e.call(r,"test"),":"):i.push("default:"),n.consequent.length>0&&i.push("\n",e.call(function(e){return u(e,t,r)},"consequent").indent(t.tabWidth)),w(i);case"DebuggerStatement":return _("debugger;");case"JSXAttribute":return i.push(e.call(r,"name")),n.value&&i.push("=",e.call(r,"value")),w(i);case"JSXIdentifier":return _(n.name,t);case"JSXNamespacedName":return _(":").join([e.call(r,"namespace"),e.call(r,"name")]);case"JSXMemberExpression":return _(".").join([e.call(r,"object"),e.call(r,"property")]);case"JSXSpreadAttribute":return w(["{...",e.call(r,"argument"),"}"]);case"JSXExpressionContainer":return w(["{",e.call(r,"expression"),"}"]);case"JSXElement":var Y=e.call(r,"openingElement");if(n.openingElement.selfClosing)return D.ok(!n.closingElement),Y;var H=w(e.map(function(e){var t=e.getValue();if(P.Literal.check(t)&&"string"==typeof t.value){if(/\S/.test(t.value))return t.value.replace(/^\s+|\s+$/g,"");if(/\n/.test(t.value))return"\n"}return r(e)},"children")).indentTail(t.tabWidth),$=e.call(r,"closingElement");return w([Y,H,$]);case"JSXOpeningElement":i.push("<",e.call(r,"name"));var Q=[];e.each(function(e){Q.push(" ",r(e))},"attributes");var Z=w(Q);return(Z.length>1||Z.getLineLength(1)>t.wrapColumn)&&(Q.forEach(function(e,t){" "===e&&(D.strictEqual(t%2,0),Q[t]="\n")}),Z=w(Q).indentTail(t.tabWidth)),i.push(Z,n.selfClosing?" />":">"),w(i);case"JSXClosingElement":return w([""]);case"JSXText":return _(n.value,t);case"JSXEmptyExpression":return _("");case"TypeAnnotatedIdentifier":return w([e.call(r,"annotation")," ",e.call(r,"identifier")]);case"ClassBody":return 0===n.body.length?_("{}"):w(["{\n",e.call(function(e){return u(e,t,r)},"body").indent(t.tabWidth),"\n}"]);case"ClassPropertyDefinition":return i.push("static ",e.call(r,"definition")),P.MethodDefinition.check(n.definition)||i.push(";"),w(i);case"ClassProperty":n.static&&i.push("static ");var j=e.call(r,"key");return n.computed?j=w(["[",j,"]"]):"plus"===n.variance?j=w(["+",j]):"minus"===n.variance&&(j=w(["-",j])),i.push(j),n.typeAnnotation&&i.push(e.call(r,"typeAnnotation")),n.value&&i.push(" = ",e.call(r,"value")),i.push(";"),w(i);case"ClassDeclaration":case"ClassExpression":return i.push("class"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),n.superClass&&i.push(" extends ",e.call(r,"superClass"),e.call(r,"superTypeParameters")),n.implements&&n.implements.length>0&&i.push(" implements ",_(", ").join(e.map(r,"implements"))),i.push(" ",e.call(r,"body")),w(i);case"TemplateElement":return _(n.value.raw,t).lockIndentTail();case"TemplateLiteral":var ee=e.map(r,"expressions");return i.push("`"),e.each(function(e){var t=e.getName();i.push(r(e)),t ":": ",e.call(r,"returnType")),w(i);case"FunctionTypeParam":return w([e.call(r,"name"),n.optional?"?":"",": ",e.call(r,"typeAnnotation")]);case"GenericTypeAnnotation":return w([e.call(r,"id"),e.call(r,"typeParameters")]);case"DeclareInterface":i.push("declare ");case"InterfaceDeclaration":return i.push(_("interface ",t),e.call(r,"id"),e.call(r,"typeParameters")," "),n.extends&&i.push("extends ",_(", ").join(e.map(r,"extends"))),i.push(" ",e.call(r,"body")),w(i);case"ClassImplements":case"InterfaceExtends":return w([e.call(r,"id"),e.call(r,"typeParameters")]);case"IntersectionTypeAnnotation":return _(" & ").join(e.map(r,"types"));case"NullableTypeAnnotation":return w(["?",e.call(r,"typeAnnotation")]);case"NullLiteralTypeAnnotation":return _("null",t);case"ThisTypeAnnotation":return _("this",t);case"NumberTypeAnnotation":return _("number",t);case"ObjectTypeCallProperty":return e.call(r,"value");case"ObjectTypeIndexer":var ne="plus"===n.variance?"+":"minus"===n.variance?"-":"";return w([ne,"[",e.call(r,"id"),": ",e.call(r,"key"),"]: ",e.call(r,"value")]);case"ObjectTypeProperty":var ne="plus"===n.variance?"+":"minus"===n.variance?"-":"";return w([ne,e.call(r,"key"),n.optional?"?":"",": ",e.call(r,"value")]);case"QualifiedTypeIdentifier":return w([e.call(r,"qualification"),".",e.call(r,"id")]);case"StringLiteralTypeAnnotation":return _(E(n.value,t),t);case"NumberLiteralTypeAnnotation":case"NumericLiteralTypeAnnotation":return D.strictEqual(typeof n.value,"number"),_(JSON.stringify(n.value),t);case"StringTypeAnnotation":return _("string",t);case"DeclareTypeAlias":i.push("declare ");case"TypeAlias":return w(["type ",e.call(r,"id"),e.call(r,"typeParameters")," = ",e.call(r,"right"),";"]);case"TypeCastExpression":return w(["(",e.call(r,"expression"),e.call(r,"typeAnnotation"),")"]);case"TypeParameterDeclaration":case"TypeParameterInstantiation":return w(["<",_(", ").join(e.map(r,"params")),">"]);case"TypeParameter":switch(n.variance){case"plus":i.push("+");break;case"minus":i.push("-")}return i.push(e.call(r,"name")),n.bound&&i.push(e.call(r,"bound")),n.default&&i.push("=",e.call(r,"default")),w(i);case"TypeofTypeAnnotation":return w([_("typeof ",t),e.call(r,"argument")]);case"UnionTypeAnnotation":return _(" | ").join(e.map(r,"types"));case"VoidTypeAnnotation":return _("void",t);case"NullTypeAnnotation":return _("null",t);case"ClassHeritage":case"ComprehensionBlock":case"ComprehensionExpression":case"Glob":case"GeneratorExpression":case"LetStatement":case"LetExpression":case"GraphExpression":case"GraphIndexExpression":case"XMLDefaultDeclaration":case"XMLAnyName":case"XMLQualifiedIdentifier":case"XMLFunctionQualifiedIdentifier":case"XMLAttributeSelector":case"XMLFilterExpression":case"XML":case"XMLElement":case"XMLList":case"XMLEscape":case"XMLText":case"XMLStartTag":case"XMLEndTag":case"XMLPointTag":case"XMLName":case"XMLAttribute":case"XMLCdata":case"XMLComment":case"XMLProcessingInstruction":default:throw new Error("unknown type: "+JSON.stringify(n.type))}return p}function u(e,t,r){var n=(P.ClassBody&&P.ClassBody.check(e.getParentNode()),[]),i=!1,s=!1;e.each(function(e){var t=(e.getName(),e.getValue());t&&"EmptyStatement"!==t.type&&(P.Comment.check(t)?i=!0:P.Statement.check(t)?s=!0:B.assert(t),n.push({node:t,printed:r(e)}))}),i&&D.strictEqual(s,!1,"Comments may appear as statements in otherwise empty statement lists, but may not coexist with non-Comment nodes.");var a=null,o=n.length,u=[];return n.forEach(function(e,r){var n,i,s=e.printed,c=e.node,p=s.length>1,h=r>0,f=rr.length?n:r}function c(e,t,r){var n=e.getNode(),i=n.kind,s=[];"ObjectMethod"===n.type||"ClassMethod"===n.type?n.value=n:P.FunctionExpression.assert(n.value),n.value.async&&s.push("async "),i&&"init"!==i&&"method"!==i&&"constructor"!==i?(D.ok("get"===i||"set"===i),s.push(i," ")):n.value.generator&&s.push("*");var a=e.call(r,"key");return n.computed&&(a=w(["[",a,"]"])),s.push(a,e.call(r,"value","typeParameters"),"(",e.call(function(e){return f(e,t,r)},"value"),")",e.call(r,"value","returnType")," ",e.call(r,"value","body")),w(s)}function h(e,t,r){var n=e.map(r,"arguments"),i=N.isTrailingCommaEnabled(t,"parameters"),s=_(", ").join(n);return s.getLineLength(1)>t.wrapColumn?(s=_(",\n").join(n),w(["(\n",s.indent(t.tabWidth),i?",\n)":"\n)"])):w(["(",s,")"])}function f(e,t,r){var n=e.getValue();P.Function.assert(n);var i=e.map(r,"params");n.defaults&&e.each(function(e){var t=e.getName(),n=i[t];n&&e.getValue()&&(i[t]=w([n," = ",r(e)]))},"defaults"),n.rest&&i.push(w(["...",e.call(r,"rest")]));var s=_(", ").join(i);return s.length>1||s.getLineLength(1)>t.wrapColumn?(s=_(",\n").join(i),s=w(N.isTrailingCommaEnabled(t,"parameters")&&!n.rest&&"RestElement"!==n.params[n.params.length-1].type?[s,",\n"]:[s,"\n"]),w(["\n",s.indent(t.tabWidth)])):s}function d(e,t,r){var n=e.getValue(),i=[];if(n.async&&i.push("async "),n.generator&&i.push("*"),n.method||"get"===n.kind||"set"===n.kind)return c(e,t,r);var s=e.call(r,"key");return n.computed?i.push("[",s,"]"):i.push(s),i.push("(",f(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),w(i)}function m(e,t,r){var n=e.getValue(),i=["export "],s=t.objectCurlySpacing;P.Declaration.assert(n),(n.default||"ExportDefaultDeclaration"===n.type)&&i.push("default "),n.declaration?i.push(e.call(r,"declaration")):n.specifiers&&n.specifiers.length>0&&(1===n.specifiers.length&&"ExportBatchSpecifier"===n.specifiers[0].type?i.push("*"):i.push(s?"{ ":"{",_(", ").join(e.map(r,"specifiers")),s?" }":"}"),n.source&&i.push(" from ",e.call(r,"source")));var a=w(i);return";"===b(a)||n.declaration&&("FunctionDeclaration"===n.declaration.type||"ClassDeclaration"===n.declaration.type)||(a=w([a,";"])),a}function y(e,t){var r=N.getParentExportDeclaration(e);return r?D.strictEqual(r.type,"DeclareExportDeclaration"):t.unshift("declare "),w(t)}function g(e,t){return w(e.length>1?[" ",e]:["\n",A(e).indent(t.tabWidth)])}function b(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function v(e){return"}"===b(e)}function x(e){return e.replace(/['"]/g,function(e){return'"'===e?"'":'"'})}function E(e,t){switch(B.assert(e),t.quote){case"auto":var r=JSON.stringify(e),n=x(JSON.stringify(x(e)));return r.length>n.length?n:r;case"single":return x(JSON.stringify(x(e)));case"double":default:return JSON.stringify(e)}}function A(e){var t=b(e);return!t||"\n};".indexOf(t)<0?w([e,";"]):e}var D=e("assert"),C=(e("source-map"),e("./comments").printComments),S=e("./lines"),_=S.fromString,w=S.concat,k=e("./options").normalize,F=e("./patcher").getReprinter,T=e("./types"),P=T.namedTypes,B=T.builtInTypes.string,O=T.builtInTypes.object,j=e("./fast-path"),N=e("./util"),I=n.prototype,L=!1;I.toString=function(){return L||(console.warn("Deprecation warning: recast.print now returns an object with a .code property. You appear to be treating the object as a string, which might still work but is strongly discouraged."),L=!0),this.code};var M=new n("");r.Printer=i},{"./comments":551,"./fast-path":552,"./lines":553,"./options":555,"./patcher":557,"./types":559,"./util":560,assert:3,"source-map":573}],559:[function(e,t,r){t.exports=e("ast-types")},{"ast-types":22}],560:[function(e,t,r){function n(){for(var e={},t=arguments.length,r=0;r=0;--i){var s=this.leading[i];t.end.offset>=s.start&&(r.unshift(s.comment),this.leading.splice(i,1),this.trailing.splice(i,1))}r.length&&(e.innerComments=r)}},e.prototype.findTrailingComments=function(e,t){var r=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var i=this.trailing[n];i.start>=t.end.offset&&r.unshift(i.comment)}return this.trailing.length=0,r}var s=this.stack[this.stack.length-1];if(s&&s.node.trailingComments){var a=s.node.trailingComments[0];a&&a.range[0]>=t.end.offset&&(r=s.node.trailingComments,delete s.node.trailingComments)}return r},e.prototype.findLeadingComments=function(e,t){for(var r,n=[];this.stack.length>0;){var i=this.stack[this.stack.length-1];if(!(i&&i.start>=t.start.offset))break;r=this.stack.pop().node}if(r){for(var s=r.leadingComments?r.leadingComments.length:0,a=s-1;a>=0;--a){var o=r.leadingComments[a];o.range[1]<=t.start.offset&&(n.unshift(o),r.leadingComments.splice(a,1))}return r.leadingComments&&0===r.leadingComments.length&&delete r.leadingComments,n}for(var a=this.leading.length-1;a>=0;--a){var i=this.leading[a];i.start<=t.start.offset&&(n.unshift(i.comment),this.leading.splice(a,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===n.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var r=this.findTrailingComments(e,t),i=this.findLeadingComments(e,t);i.length>0&&(e.leadingComments=i),r.length>0&&(e.trailingComments=r),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var r="L"===e.type[0]?"Line":"Block",n={type:r,value:e.value};if(e.range&&(n.range=e.range),e.loc&&(n.loc=e.loc),this.comments.push(n),this.attach){var i={comment:{type:r,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(i.comment.loc=e.loc),e.type=r,this.leading.push(i),this.trailing.push(i)}},e.prototype.visit=function(e,t){"LineComment"===e.type?this.visitComment(e,t):"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=i},function(e,t){"use strict";t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,r){"use strict";var n=r(4),i=r(5),s=r(6),a=r(7),o=r(8),u=r(2),l=r(10),c=function(){function e(e,t,r){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=r,this.errorHandler=new s.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.sourceType=t&&"module"===t.sourceType?"module":"script",this.lookahead=null,this.hasLineTerminator=!1,this.context={allowIn:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:"module"===this.sourceType},this.tokens=[],this.startMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.lastMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.nextToken(),this.lastMarker={index:this.scanner.index,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],r=1;r0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,r=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var i=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=r,this.context.firstCoverInitializedNameError=n,i},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,r=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var i=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&r,this.context.firstCoverInitializedNameError=n||this.context.firstCoverInitializedNameError,i},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(this.lookahead.type===a.Token.EOF||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.lineNumber=this.startMarker.lineNumber,this.lastMarker.lineStart=this.startMarker.lineStart)},e.prototype.parsePrimaryExpression=function(){var e,t,r,n=this.createNode();switch(this.lookahead.type){case a.Token.Identifier:"module"===this.sourceType&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.finalize(n,new l.Identifier(this.nextToken().value));break;case a.Token.NumericLiteral:case a.Token.StringLiteral:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),r=this.getTokenRaw(t),e=this.finalize(n,new l.Literal(t.value,r));break;case a.Token.BooleanLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),t.value="true"===t.value,r=this.getTokenRaw(t),e=this.finalize(n,new l.Literal(t.value,r));break;case a.Token.NullLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),t.value=null,r=this.getTokenRaw(t),e=this.finalize(n,new l.Literal(t.value,r));break;case a.Token.Template:e=this.parseTemplateLiteral();break;case a.Token.Punctuator:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),r=this.getTokenRaw(t),e=this.finalize(n,new l.RegexLiteral(t.value,r,t.regex));break;default:this.throwUnexpectedToken(this.nextToken())}break;case a.Token.Keyword:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(n,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(n,new l.ThisExpression)):this.matchKeyword("class")?e=this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new l.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var r=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(r)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new l.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!1;var r=this.parseFormalParameters(),n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new l.FunctionExpression(null,r.params,n,!1))},e.prototype.parseObjectPropertyKey=function(){var e=this.createNode(),t=this.nextToken(),r=null;switch(t.type){case a.Token.StringLiteral:case a.Token.NumericLiteral:this.context.strict&&t.octal&&this.tolerateUnexpectedToken(t,i.Messages.StrictOctalLiteral);var n=this.getTokenRaw(t);r=this.finalize(e,new l.Literal(t.value,n));break;case a.Token.Identifier:case a.Token.BooleanLiteral:case a.Token.NullLiteral:case a.Token.Keyword:r=this.finalize(e,new l.Identifier(t.value));break;case a.Token.Punctuator:"["===t.value?(r=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):this.throwUnexpectedToken(t);break;default:this.throwUnexpectedToken(t)}return r},e.prototype.isPropertyKey=function(e,t){return e.type===u.Syntax.Identifier&&e.name===t||e.type===u.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,r,n,s=this.createNode(),o=this.lookahead,u=!1,c=!1,p=!1;o.type===a.Token.Identifier?(this.nextToken(),r=this.finalize(s,new l.Identifier(o.value))):this.match("*")?this.nextToken():(u=this.match("["),r=this.parseObjectPropertyKey());var h=this.qualifiedPropertyName(this.lookahead);if(o.type===a.Token.Identifier&&"get"===o.value&&h)t="get",u=this.match("["),r=this.parseObjectPropertyKey(),this.context.allowYield=!1,n=this.parseGetterMethod();else if(o.type===a.Token.Identifier&&"set"===o.value&&h)t="set",u=this.match("["),r=this.parseObjectPropertyKey(),n=this.parseSetterMethod();else if(o.type===a.Token.Punctuator&&"*"===o.value&&h)t="init",u=this.match("["),r=this.parseObjectPropertyKey(),n=this.parseGeneratorMethod(),c=!0;else if(r||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":"))!u&&this.isPropertyKey(r,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),n=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))n=this.parsePropertyMethodFunction(),c=!0;else if(o.type===a.Token.Identifier){var f=this.finalize(s,new l.Identifier(o.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),p=!0;var d=this.isolateCoverGrammar(this.parseAssignmentExpression);n=this.finalize(s,new l.AssignmentPattern(f,d))}else p=!0,n=f}else this.throwUnexpectedToken(this.nextToken());return this.finalize(s,new l.Property(t,r,u,n,c,p))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],r={value:!1};!this.match("}");)t.push(this.parseObjectProperty(r)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new l.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){n.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),r={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(r,t.tail))},e.prototype.parseTemplateElement=function(){this.lookahead.type!==a.Token.Template&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),r={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(r,t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],r=[],n=this.parseTemplateHead();for(r.push(n);!n.tail;)t.push(this.parseExpression()),n=this.parseTemplateElement(),r.push(n);return this.finalize(e,new l.TemplateLiteral(r,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case u.Syntax.Identifier:case u.Syntax.MemberExpression:case u.Syntax.RestElement:case u.Syntax.AssignmentPattern:break;case u.Syntax.SpreadElement:e.type=u.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case u.Syntax.ArrayExpression:e.type=u.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[]};else{var t=this.lookahead,r=[];if(this.match("..."))e=this.parseRestElement(r),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e]};else{var n=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var i=[];for(this.context.isAssignmentTarget=!1,i.push(e);this.startMarker.index")||this.expect("=>"),this.context.isBindingElement=!1;for(var s=0;s")&&(e.type===u.Syntax.Identifier&&"yield"===e.name&&(n=!0,e={type:"ArrowParameterPlaceHolder",params:[e]}),!n)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===u.Syntax.SequenceExpression)for(var s=0;s0){this.nextToken(),r.prec=n,this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var i=[e,this.lookahead],s=t,a=this.isolateCoverGrammar(this.parseExponentiationExpression),o=[s,r,a];;){if((n=this.binaryPrecedence(this.lookahead))<=0)break;for(;o.length>2&&n<=o[o.length-2].prec;){a=o.pop();var u=o.pop().value;s=o.pop(),i.pop();var c=this.startNode(i[i.length-1]);o.push(this.finalize(c,new l.BinaryExpression(u,s,a)))}r=this.nextToken(),r.prec=n,o.push(r),i.push(this.lookahead),o.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=o.length-1;for(t=o[p],i.pop();p>1;){var c=this.startNode(i.pop());t=this.finalize(c,new l.BinaryExpression(o[p-1].value,o[p-2],t)),p-=2}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var r=this.context.allowIn;this.context.allowIn=!0;var n=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=r,this.expect(":");var i=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new l.ConditionalExpression(t,n,i)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case u.Syntax.Identifier:this.validateParam(e,t,t.name);break;case u.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case u.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case u.Syntax.ArrayPattern:for(var r=0;r")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var n=this.reinterpretAsCoverFormalsList(e);if(n){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var s=this.context.strict,a=this.context.allowYield;this.context.allowYield=!0;var o=this.startNode(t);this.expect("=>");var c=this.match("{")?this.parseFunctionSourceElements():this.isolateCoverGrammar(this.parseAssignmentExpression),p=c.type!==u.Syntax.BlockStatement;this.context.strict&&n.firstRestricted&&this.throwUnexpectedToken(n.firstRestricted,n.message),this.context.strict&&n.stricted&&this.tolerateUnexpectedToken(n.stricted,n.message),e=this.finalize(o,new l.ArrowFunctionExpression(n.params,c,p)),this.context.strict=s,this.context.allowYield=a}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===u.Syntax.Identifier){var h=e;this.scanner.isRestrictedWord(h.name)&&this.tolerateUnexpectedToken(r,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(h.name)&&this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),r=this.nextToken();var f=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new l.AssignmentExpression(r.value,e,f)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var r=[];for(r.push(t);this.startMarker.index",t.TokenName[r.Identifier]="Identifier",t.TokenName[r.Keyword]="Keyword",t.TokenName[r.NullLiteral]="Null",t.TokenName[r.NumericLiteral]="Numeric",t.TokenName[r.Punctuator]="Punctuator",t.TokenName[r.StringLiteral]="String",t.TokenName[r.RegularExpression]="RegularExpression",t.TokenName[r.Template]="Template" +},function(e,t,r){"use strict";function n(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function i(e){return"01234567".indexOf(e)}var s=r(4),a=r(5),o=r(9),u=r(7),l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){void 0===e&&(e=a.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,a.Messages.UnexpectedTokenIllegal)},e.prototype.skipSingleLineComment=function(e){var t,r,n;for(this.trackComment&&(t=[],r=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var s={multiLine:!1,slice:[r+e,this.index-1],range:[r,this.index-1],loc:n};t.push(s)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t}}if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};var s={multiLine:!1,slice:[r+e,this.index],range:[r,this.index],loc:n};t.push(s)}return t},e.prototype.skipMultiLineComment=function(){var e,t,r;for(this.trackComment&&(e=[],t=this.index-2,r={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(n))13===n&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===n){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){r.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:r};e.push(i)}return e}++this.index}else++this.index}if(this.trackComment){r.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:r};e.push(i)}return this.tolerateUnexpectedToken(),e},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(r))++this.index;else if(o.Character.isLineTerminator(r))++this.index,13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===r)if(47===(r=this.source.charCodeAt(this.index+1))){this.index+=2;var n=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(n)),t=!0}else{if(42!==r)break;this.index+=2;var n=this.skipMultiLineComment();this.trackComment&&(e=e.concat(n))}else if(t&&45===r){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3;var n=this.skipSingleLineComment(3);this.trackComment&&(e=e.concat(n))}else{if(60!==r)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4;var n=this.skipSingleLineComment(4);this.trackComment&&(e=e.concat(n))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var r=this.source.charCodeAt(e+1);if(r>=56320&&r<=57343){t=1024*(t-55296)+r-56320+65536}}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,r=0,i=0;i1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e=this.codePointAt(this.index),t=o.Character.fromCodePoint(e);this.index+=t.length;var r;for(92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,r=this.scanUnicodeCodePointEscape()):(r=this.scanHexEscape("u"),e=r.charCodeAt(0),r&&"\\"!==r&&o.Character.isIdentifierStart(e)||this.throwUnexpectedToken()),t=r);!this.eof()&&(e=this.codePointAt(this.index),o.Character.isIdentifierPart(e));)r=o.Character.fromCodePoint(e),t+=r,this.index+=r.length,92===e&&(t=t.substr(0,t.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,r=this.scanUnicodeCodePointEscape()):(r=this.scanHexEscape("u"),e=r.charCodeAt(0),r&&"\\"!==r&&o.Character.isIdentifierPart(e)||this.throwUnexpectedToken()),t+=r);return t},e.prototype.octalToDecimal=function(e){var t="0"!==e,r=i(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,r=8*r+i(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(r=8*r+i(this.source[this.index++]))),{code:r,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,r=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();return e=1===r.length?u.Token.Identifier:this.isKeyword(r)?u.Token.Keyword:"null"===r?u.Token.NullLiteral:"true"===r||"false"===r?u.Token.BooleanLiteral:u.Token.Identifier,{type:e,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e={type:u.Token.Punctuator,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index},t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:t=this.source.substr(this.index,4),">>>="===t?this.index+=4:(t=t.substr(0,3),"==="===t||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:(t=t.substr(0,2),"&&"===t||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)))}return this.index===e.start&&this.throwUnexpectedToken(),e.end=this.index,e.value=t,e},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:u.Token.NumericLiteral,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,r="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)r+=this.source[this.index++];return 0===r.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:u.Token.NumericLiteral,value:parseInt(r,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var r="",n=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(n=!0,r="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];return n||0!==r.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:u.Token.NumericLiteral,value:parseInt(r,8),octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,function(e,t,r){var i=parseInt(t||r,16);return i>1114111&&n.throwUnexpectedToken(a.Messages.InvalidRegExp),i<=65535?String.fromCharCode(i):"￿"}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(r)}catch(e){this.throwUnexpectedToken(a.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];s.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],r=!1,n=!1;!this.eof();)if(e=this.source[this.index++],t+=e,"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(a.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(a.Messages.UnterminatedRegExp);else if(r)"]"===e&&(r=!1);else{if("/"===e){n=!0;break}"["===e&&(r=!0)}return n||this.throwUnexpectedToken(a.Messages.UnterminatedRegExp),{value:t.substr(1,t.length-2),literal:t}},e.prototype.scanRegExpFlags=function(){for(var e="",t="";!this.eof();){var r=this.source[this.index];if(!o.Character.isIdentifierPart(r.charCodeAt(0)))break;if(++this.index,"\\"!==r||this.eof())t+=r,e+=r;else if("u"===(r=this.source[this.index])){++this.index;var n=this.index;if(r=this.scanHexEscape("u"))for(t+=r,e+="\\u";n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";var r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&r.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){ +return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&r.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,r){"use strict";var n=r(2),i=function(){function e(e){this.type=n.Syntax.ArrayExpression,this.elements=e}return e}();t.ArrayExpression=i;var s=function(){function e(e){this.type=n.Syntax.ArrayPattern,this.elements=e}return e}();t.ArrayPattern=s;var a=function(){function e(e,t,r){this.type=n.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=r}return e}();t.ArrowFunctionExpression=a;var o=function(){function e(e,t,r){this.type=n.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=r}return e}();t.AssignmentExpression=o;var u=function(){function e(e,t){this.type=n.Syntax.AssignmentPattern,this.left=e,this.right=t}return e}();t.AssignmentPattern=u;var l=function(){function e(e,t,r){var i="||"===e||"&&"===e;this.type=i?n.Syntax.LogicalExpression:n.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=r}return e}();t.BinaryExpression=l;var c=function(){function e(e){this.type=n.Syntax.BlockStatement,this.body=e}return e}();t.BlockStatement=c;var p=function(){function e(e){this.type=n.Syntax.BreakStatement,this.label=e}return e}();t.BreakStatement=p;var h=function(){function e(e,t){this.type=n.Syntax.CallExpression,this.callee=e,this.arguments=t}return e}();t.CallExpression=h;var f=function(){function e(e,t){this.type=n.Syntax.CatchClause,this.param=e,this.body=t}return e}();t.CatchClause=f;var d=function(){function e(e){this.type=n.Syntax.ClassBody,this.body=e}return e}();t.ClassBody=d;var m=function(){function e(e,t,r){this.type=n.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=r}return e}();t.ClassDeclaration=m;var y=function(){function e(e,t,r){this.type=n.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=r}return e}();t.ClassExpression=y;var g=function(){function e(e,t){this.type=n.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t}return e}();t.ComputedMemberExpression=g;var b=function(){function e(e,t,r){this.type=n.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=r}return e}();t.ConditionalExpression=b;var v=function(){function e(e){this.type=n.Syntax.ContinueStatement,this.label=e}return e}();t.ContinueStatement=v;var x=function(){function e(){this.type=n.Syntax.DebuggerStatement}return e}();t.DebuggerStatement=x;var E=function(){function e(e,t){this.type=n.Syntax.ExpressionStatement,this.expression=e,this.directive=t}return e}();t.Directive=E;var A=function(){function e(e,t){this.type=n.Syntax.DoWhileStatement,this.body=e,this.test=t}return e}();t.DoWhileStatement=A;var D=function(){function e(){this.type=n.Syntax.EmptyStatement}return e}();t.EmptyStatement=D;var C=function(){function e(e){this.type=n.Syntax.ExportAllDeclaration,this.source=e}return e}();t.ExportAllDeclaration=C;var S=function(){function e(e){this.type=n.Syntax.ExportDefaultDeclaration,this.declaration=e}return e}();t.ExportDefaultDeclaration=S;var _=function(){function e(e,t,r){this.type=n.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=r}return e}();t.ExportNamedDeclaration=_;var w=function(){function e(e,t){this.type=n.Syntax.ExportSpecifier,this.exported=t,this.local=e}return e}();t.ExportSpecifier=w;var k=function(){function e(e){this.type=n.Syntax.ExpressionStatement,this.expression=e}return e}();t.ExpressionStatement=k;var F=function(){function e(e,t,r){this.type=n.Syntax.ForInStatement,this.left=e,this.right=t,this.body=r,this.each=!1}return e}();t.ForInStatement=F;var T=function(){function e(e,t,r){this.type=n.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=r}return e}();t.ForOfStatement=T;var P=function(){function e(e,t,r,i){this.type=n.Syntax.ForStatement,this.init=e,this.test=t,this.update=r,this.body=i}return e}();t.ForStatement=P;var B=function(){function e(e,t,r,i){this.type=n.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=r,this.generator=i,this.expression=!1}return e}();t.FunctionDeclaration=B;var O=function(){function e(e,t,r,i){this.type=n.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=r,this.generator=i,this.expression=!1}return e}();t.FunctionExpression=O;var j=function(){function e(e){this.type=n.Syntax.Identifier,this.name=e}return e}();t.Identifier=j;var N=function(){function e(e,t,r){this.type=n.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=r}return e}();t.IfStatement=N;var I=function(){function e(e,t){this.type=n.Syntax.ImportDeclaration,this.specifiers=e,this.source=t}return e}();t.ImportDeclaration=I;var L=function(){function e(e){this.type=n.Syntax.ImportDefaultSpecifier,this.local=e}return e}();t.ImportDefaultSpecifier=L;var M=function(){function e(e){this.type=n.Syntax.ImportNamespaceSpecifier,this.local=e}return e}();t.ImportNamespaceSpecifier=M;var R=function(){function e(e,t){this.type=n.Syntax.ImportSpecifier,this.local=e,this.imported=t}return e}();t.ImportSpecifier=R;var U=function(){function e(e,t){this.type=n.Syntax.LabeledStatement,this.label=e,this.body=t}return e}();t.LabeledStatement=U;var V=function(){function e(e,t){this.type=n.Syntax.Literal,this.value=e,this.raw=t}return e}();t.Literal=V;var q=function(){function e(e,t){this.type=n.Syntax.MetaProperty,this.meta=e,this.property=t}return e}();t.MetaProperty=q;var G=function(){function e(e,t,r,i,s){this.type=n.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=r,this.kind=i,this.static=s}return e}();t.MethodDefinition=G;var X=function(){function e(e,t){this.type=n.Syntax.NewExpression,this.callee=e,this.arguments=t}return e}();t.NewExpression=X;var J=function(){function e(e){this.type=n.Syntax.ObjectExpression,this.properties=e}return e}();t.ObjectExpression=J;var W=function(){function e(e){this.type=n.Syntax.ObjectPattern,this.properties=e}return e}();t.ObjectPattern=W;var K=function(){function e(e,t){this.type=n.Syntax.Program,this.body=e,this.sourceType=t}return e}();t.Program=K;var z=function(){function e(e,t,r,i,s,a){this.type=n.Syntax.Property,this.key=t,this.computed=r,this.value=i,this.kind=e,this.method=s,this.shorthand=a}return e}();t.Property=z;var Y=function(){function e(e,t,r){this.type=n.Syntax.Literal,this.value=e,this.raw=t,this.regex=r}return e}();t.RegexLiteral=Y;var H=function(){function e(e){this.type=n.Syntax.RestElement,this.argument=e}return e}();t.RestElement=H;var $=function(){function e(e){this.type=n.Syntax.ReturnStatement,this.argument=e}return e}();t.ReturnStatement=$;var Q=function(){function e(e){this.type=n.Syntax.SequenceExpression,this.expressions=e}return e}();t.SequenceExpression=Q;var Z=function(){function e(e){this.type=n.Syntax.SpreadElement,this.argument=e}return e}();t.SpreadElement=Z;var ee=function(){function e(e,t){this.type=n.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t}return e}();t.StaticMemberExpression=ee;var te=function(){function e(){this.type=n.Syntax.Super}return e}();t.Super=te;var re=function(){function e(e,t){this.type=n.Syntax.SwitchCase,this.test=e,this.consequent=t}return e}();t.SwitchCase=re;var ne=function(){function e(e,t){this.type=n.Syntax.SwitchStatement,this.discriminant=e,this.cases=t}return e}();t.SwitchStatement=ne;var ie=function(){function e(e,t){this.type=n.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t}return e}();t.TaggedTemplateExpression=ie;var se=function(){function e(e,t){this.type=n.Syntax.TemplateElement,this.value=e,this.tail=t}return e}();t.TemplateElement=se;var ae=function(){function e(e,t){this.type=n.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t}return e}();t.TemplateLiteral=ae;var oe=function(){function e(){this.type=n.Syntax.ThisExpression}return e}();t.ThisExpression=oe;var ue=function(){function e(e){this.type=n.Syntax.ThrowStatement,this.argument=e}return e}();t.ThrowStatement=ue;var le=function(){function e(e,t,r){this.type=n.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=r}return e}();t.TryStatement=le;var ce=function(){function e(e,t){this.type=n.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0}return e}();t.UnaryExpression=ce;var pe=function(){function e(e,t,r){this.type=n.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=r}return e}();t.UpdateExpression=pe;var he=function(){function e(e,t){this.type=n.Syntax.VariableDeclaration,this.declarations=e,this.kind=t}return e}();t.VariableDeclaration=he;var fe=function(){function e(e,t){this.type=n.Syntax.VariableDeclarator,this.id=e,this.init=t}return e}();t.VariableDeclarator=fe;var de=function(){function e(e,t){this.type=n.Syntax.WhileStatement,this.test=e,this.body=t}return e}();t.WhileStatement=de;var me=function(){function e(e,t){this.type=n.Syntax.WithStatement,this.object=e,this.body=t}return e}();t.WithStatement=me;var ye=function(){function e(e,t){this.type=n.Syntax.YieldExpression,this.argument=e,this.delegate=t}return e}();t.YieldExpression=ye},function(e,t,r){"use strict";function n(e){var t;switch(e.type){case c.JSXSyntax.JSXIdentifier:t=e.name;break;case c.JSXSyntax.JSXNamespacedName:var r=e;t=n(r.namespace)+":"+n(r.name);break;case c.JSXSyntax.JSXMemberExpression:var i=e;t=n(i.object)+"."+n(i.property)}return t}var i,s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=r(9),o=r(7),u=r(3),l=r(12),c=r(13),p=r(10),h=r(14);!function(e){e[e.Identifier=100]="Identifier",e[e.Text=101]="Text"}(i||(i={})),o.TokenName[i.Identifier]="JSXIdentifier",o.TokenName[i.Text]="JSXText";var f=function(e){function t(t,r,n){e.call(this,t,r,n)}return s(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.lineNumber,this.scanner.lineStart=this.startMarker.lineStart},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",r=!0,n=!1,i=!1,s=!1;!this.scanner.eof()&&r&&!n;){var o=this.scanner.source[this.scanner.index];if(o===e)break;if(n=";"===o,t+=o,++this.scanner.index,!n)switch(t.length){case 2:i="#"===o;break;case 3:i&&(s="x"===o,r=s||a.Character.isDecimalDigit(o.charCodeAt(0)),i=i&&!s);break;default:r=r&&!(i&&!a.Character.isDecimalDigit(o.charCodeAt(0))),r=r&&!(s&&!a.Character.isHexDigit(o.charCodeAt(0)))}}if(r&&n&&t.length>2){var u=t.substr(1,t.length-2);i&&u.length>1?t=String.fromCharCode(parseInt(u.substr(1),10)):s&&u.length>2?t=String.fromCharCode(parseInt("0"+u.substr(1),16)):i||s||!l.XHTMLEntities[u]||(t=l.XHTMLEntities[u])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e){var t=this.scanner.source[this.scanner.index++];return{type:o.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===e||39===e){for(var r=this.scanner.index,n=this.scanner.source[this.scanner.index++],s="";!this.scanner.eof();){var u=this.scanner.source[this.scanner.index++];if(u===n)break;s+="&"===u?this.scanXHTMLEntity(n):u}return{type:o.Token.StringLiteral,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(46===e){var l=this.scanner.source.charCodeAt(this.scanner.index+1),c=this.scanner.source.charCodeAt(this.scanner.index+2),t=46===l&&46===c?"...":".",r=this.scanner.index;return this.scanner.index+=t.length,{type:o.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(96===e)return{type:o.Token.Template,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(a.Character.isIdentifierStart(e)&&92!==e){var r=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var u=this.scanner.source.charCodeAt(this.scanner.index);if(a.Character.isIdentifierPart(u)&&92!==u)++this.scanner.index;else{if(45!==u)break;++this.scanner.index}}var p=this.scanner.source.slice(r,this.scanner.index);return{type:i.Identifier,value:p,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}this.scanner.throwUnexpectedToken()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var r=this.scanner.source[this.scanner.index];if("{"===r||"<"===r)break;++this.scanner.index,t+=r,a.Character.isLineTerminator(r.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===r&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart;var n={type:i.Text,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n},t.prototype.peekJSXToken=function(){var e=this.scanner.index,t=this.scanner.lineNumber,r=this.scanner.lineStart;this.scanner.scanComments();var n=this.lexJSX();return this.scanner.index=e,this.scanner.lineNumber=t,this.scanner.lineStart=r,n},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();t.type===o.Token.Punctuator&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return t.type===o.Token.Punctuator&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return t.type!==i.Identifier&&this.throwUnexpectedToken(t),this.finalize(e,new h.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=t;this.expectJSX(":");var n=this.parseJSXIdentifier();t=this.finalize(e,new h.JSXNamespacedName(r,n))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var i=t;this.expectJSX(".");var s=this.parseJSXIdentifier();t=this.finalize(e,new h.JSXMemberExpression(i,s))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),r=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=r;this.expectJSX(":");var i=this.parseJSXIdentifier();e=this.finalize(t,new h.JSXNamespacedName(n,i))}else e=r;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();t.type!==o.Token.StringLiteral&&this.throwUnexpectedToken(t);var r=this.getTokenRaw(t);return this.finalize(e,new p.Literal(t.value,r))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new h.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),r=null;return this.matchJSX("=")&&(this.expectJSX("="),r=this.parseJSXAttributeValue()),this.finalize(e,new h.JSXAttribute(t,r))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new h.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),r=this.parseJSXAttributes(),n=this.matchJSX("/");return n&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new h.JSXOpeningElement(t,n,r))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new h.JSXClosingElement(t))}var r=this.parseJSXElementName(),n=this.parseJSXAttributes(),i=this.matchJSX("/");return i&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new h.JSXOpeningElement(r,i,n))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.finalize(e,new h.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e=this.createJSXNode();this.expectJSX("{");var t;return this.matchJSX("}")?(t=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),t=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(e,new h.JSXExpressionContainer(t))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),r=this.nextJSXText();if(r.start0))break;var a=this.finalize(e.node,new h.JSXElement(e.opening,e.children,e.closing));e=t.pop(),e.children.push(a)}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),r=[],n=null;if(!t.selfClosing){var i=this.parseComplexJSXElement({node:e,opening:t,closing:n,children:r});r=i.children,n=i.closing}return this.finalize(e,new h.JSXElement(t,r,n))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t){"use strict";t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,r){"use strict";var n=r(13),i=function(){function e(e){this.type=n.JSXSyntax.JSXClosingElement,this.name=e}return e}();t.JSXClosingElement=i;var s=function(){function e(e,t,r){this.type=n.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=r}return e}();t.JSXElement=s;var a=function(){function e(){this.type=n.JSXSyntax.JSXEmptyExpression}return e}();t.JSXEmptyExpression=a;var o=function(){function e(e){this.type=n.JSXSyntax.JSXExpressionContainer,this.expression=e}return e}();t.JSXExpressionContainer=o;var u=function(){function e(e){this.type=n.JSXSyntax.JSXIdentifier,this.name=e}return e}();t.JSXIdentifier=u;var l=function(){function e(e,t){this.type=n.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t}return e}();t.JSXMemberExpression=l;var c=function(){function e(e,t){this.type=n.JSXSyntax.JSXAttribute,this.name=e,this.value=t}return e}();t.JSXAttribute=c;var p=function(){function e(e,t){this.type=n.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t}return e}();t.JSXNamespacedName=p;var h=function(){function e(e,t,r){this.type=n.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=r}return e}();t.JSXOpeningElement=h;var f=function(){function e(e){this.type=n.JSXSyntax.JSXSpreadAttribute,this.argument=e}return e}();t.JSXSpreadAttribute=f;var d=function(){function e(e,t){this.type=n.JSXSyntax.JSXText,this.value=e,this.raw=t}return e}();t.JSXText=d},function(e,t,r){"use strict";var n=r(8),i=r(6),s=r(7),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var r=this.values[this.paren-1];t="if"===r||"while"===r||"for"===r||"with"===r;break;case"}":if(t=!1,"function"===this.values[this.curly-3]){var n=this.values[this.curly-4];t=!!n&&!this.beforeFunctionExpression(n)}else if("function"===this.values[this.curly-4]){var i=this.values[this.curly-5];t=!i||!this.beforeFunctionExpression(i)}}return t},e.prototype.push=function(e){e.type===s.Token.Punctuator||e.type===s.Token.Keyword?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),o=function(){function e(e,t){this.errorHandler=new i.ErrorHandler,this.errorHandler.tolerant=!!t&&("boolean"==typeof t.tolerant&&t.tolerant),this.scanner=new n.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&("boolean"==typeof t.comment&&t.comment),this.trackRange=!!t&&("boolean"==typeof t.range&&t.range),this.trackLoc=!!t&&("boolean"==typeof t.loc&&t.loc),this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t=0,s=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=e("./runtime"),i)n.regeneratorRuntime=s;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./runtime":577}],577:[function(e,t,r){(function(e,r){!function(r){"use strict";function n(e,t,r,n){var i=t&&t.prototype instanceof s?t:s,a=Object.create(i.prototype),o=new d(n||[]);return a._invoke=c(e,r,o),a}function i(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function s(){}function a(){}function o(){}function u(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(t){function r(e,n,s,a){var o=i(t[e],t,n);if("throw"!==o.type){var u=o.arg,l=u.value;return l&&"object"==typeof l&&v.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){u.value=e,s(u)},a)}a(o.arg)}function n(e,t){function n(){return new Promise(function(n,i){r(e,t,n,i)})}return s=s?s.then(n,n):n()}"object"==typeof e&&e.domain&&(r=e.domain.bind(r));var s;this._invoke=n}function c(e,t,r){var n=S;return function(s,a){if(n===w)throw new Error("Generator is already running");if(n===k){if("throw"===s)throw a;return y()}for(r.method=s,r.arg=a;;){var o=r.delegate;if(o){var u=p(o,r);if(u){if(u===F)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===S)throw n=k,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=w;var l=i(e,t,r);if("normal"===l.type){if(n=r.done?k:_,l.arg===F)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=k,r.method="throw",r.arg=l.arg)}}}function p(e,t){var r=e.iterator[t.method];if(r===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,p(e,t),"throw"===t.method))return F;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return F}var n=i(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,F;var s=n.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,F):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,F)}function h(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function f(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(h,this),this.reset(!0)}function m(e){if(e){var t=e[E];if(t)return t.call(e);if("function"==typeof e.next)return e +;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var i=this.tryEntries[n],s=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=v.call(i,"catchLoc"),o=v.call(i,"finallyLoc");if(a&&o){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),f(r),F}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;f(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:m(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=g),F}}}("object"==typeof r?r:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:539}],578:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){h.default.ok(this instanceof s),d.assertIdentifier(e),this.nextTempId=0,this.contextId=e,this.listing=[],this.marked=[!0],this.finalLoc=a(),this.tryEntries=[],this.leapManager=new y.LeapManager(this)}function a(){return d.numericLiteral(-1)}function o(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+(0,c.default)(e))}function u(e){var t=e.type;return"normal"===t?!E.call(e,"target"):"break"===t||"continue"===t?!E.call(e,"value")&&d.isLiteral(e.target):("return"===t||"throw"===t)&&(E.call(e,"value")&&!E.call(e,"target"))}var l=e("babel-runtime/core-js/json/stringify"),c=i(l),p=e("assert"),h=i(p),f=e("babel-types"),d=n(f),m=e("./leap"),y=n(m),g=e("./meta"),b=n(g),v=e("./util"),x=n(v),E=Object.prototype.hasOwnProperty,A=s.prototype;r.Emitter=s,A.mark=function(e){d.assertLiteral(e);var t=this.listing.length;return-1===e.value?e.value=t:h.default.strictEqual(e.value,t),this.marked[t]=!0,e},A.emit=function(e){d.isExpression(e)&&(e=d.expressionStatement(e)),d.assertStatement(e),this.listing.push(e)},A.emitAssign=function(e,t){return this.emit(this.assign(e,t)),e},A.assign=function(e,t){return d.expressionStatement(d.assignmentExpression("=",e,t))},A.contextProperty=function(e,t){return d.memberExpression(this.contextId,t?d.stringLiteral(e):d.identifier(e),!!t)},A.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},A.setReturnValue=function(e){d.assertExpression(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},A.clearPendingException=function(e,t){d.assertLiteral(e);var r=d.callExpression(this.contextProperty("catch",!0),[e]);t?this.emitAssign(t,r):this.emit(r)},A.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(d.breakStatement())},A.jumpIf=function(e,t){d.assertExpression(e),d.assertLiteral(t),this.emit(d.ifStatement(e,d.blockStatement([this.assign(this.contextProperty("next"),t),d.breakStatement()])))},A.jumpIfNot=function(e,t){d.assertExpression(e),d.assertLiteral(t);var r=void 0;r=d.isUnaryExpression(e)&&"!"===e.operator?e.argument:d.unaryExpression("!",e),this.emit(d.ifStatement(r,d.blockStatement([this.assign(this.contextProperty("next"),t),d.breakStatement()])))},A.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)},A.getContextFunction=function(e){return d.functionExpression(e||null,[this.contextId],d.blockStatement([this.getDispatchLoop()]),!1,!1)},A.getDispatchLoop=function(){var e=this,t=[],r=void 0,n=!1;return e.listing.forEach(function(i,s){e.marked.hasOwnProperty(s)&&(t.push(d.switchCase(d.numericLiteral(s),r=[])),n=!1),n||(r.push(i),d.isCompletionStatement(i)&&(n=!0))}),this.finalLoc.value=this.listing.length,t.push(d.switchCase(this.finalLoc,[]),d.switchCase(d.stringLiteral("end"),[d.returnStatement(d.callExpression(this.contextProperty("stop"),[]))])),d.whileStatement(d.numericLiteral(1),d.switchStatement(d.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),t))},A.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return d.arrayExpression(this.tryEntries.map(function(t){var r=t.firstLoc.value;h.default.ok(r>=e,"try entries out of order"),e=r;var n=t.catchEntry,i=t.finallyEntry,s=[t.firstLoc,n?n.firstLoc:null];return i&&(s[2]=i.firstLoc,s[3]=i.afterLoc),d.arrayExpression(s)}))},A.explode=function(e,t){var r=e.node,n=this;if(d.assertNode(r),d.isDeclaration(r))throw o(r);if(d.isStatement(r))return n.explodeStatement(e);if(d.isExpression(r))return n.explodeExpression(e,t);switch(r.type){case"Program":return e.get("body").map(n.explodeStatement,n);case"VariableDeclarator":throw o(r);case"Property":case"SwitchCase":case"CatchClause":throw new Error(r.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+(0,c.default)(r.type))}},A.explodeStatement=function(e,t){var r=e.node,n=this,i=void 0,s=void 0,o=void 0;if(d.assertStatement(r),t?d.assertIdentifier(t):t=null,d.isBlockStatement(r))return void e.get("body").forEach(function(e){n.explodeStatement(e)});if(!b.containsLeap(r))return void n.emit(r);switch(r.type){case"ExpressionStatement":n.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":s=a(),n.leapManager.withEntry(new y.LabeledEntry(s,r.label),function(){n.explodeStatement(e.get("body"),r.label)}),n.mark(s);break;case"WhileStatement":i=a(),s=a(),n.mark(i),n.jumpIfNot(n.explodeExpression(e.get("test")),s),n.leapManager.withEntry(new y.LoopEntry(s,i,t),function(){n.explodeStatement(e.get("body"))}),n.jump(i),n.mark(s);break;case"DoWhileStatement":var u=a(),l=a();s=a(),n.mark(u),n.leapManager.withEntry(new y.LoopEntry(s,l,t),function(){n.explode(e.get("body"))}),n.mark(l),n.jumpIf(n.explodeExpression(e.get("test")),u),n.mark(s);break;case"ForStatement":o=a();var p=a();s=a(),r.init&&n.explode(e.get("init"),!0),n.mark(o),r.test&&n.jumpIfNot(n.explodeExpression(e.get("test")),s),n.leapManager.withEntry(new y.LoopEntry(s,p,t),function(){n.explodeStatement(e.get("body"))}),n.mark(p),r.update&&n.explode(e.get("update"),!0),n.jump(o),n.mark(s);break;case"TypeCastExpression":return n.explodeExpression(e.get("expression"));case"ForInStatement":o=a(),s=a();var f=n.makeTempVar();n.emitAssign(f,d.callExpression(x.runtimeProperty("keys"),[n.explodeExpression(e.get("right"))])),n.mark(o);var m=n.makeTempVar();n.jumpIf(d.memberExpression(d.assignmentExpression("=",m,d.callExpression(f,[])),d.identifier("done"),!1),s),n.emitAssign(r.left,d.memberExpression(m,d.identifier("value"),!1)),n.leapManager.withEntry(new y.LoopEntry(s,o,t),function(){n.explodeStatement(e.get("body"))}),n.jump(o),n.mark(s);break;case"BreakStatement":n.emitAbruptCompletion({type:"break",target:n.leapManager.getBreakLoc(r.label)});break;case"ContinueStatement":n.emitAbruptCompletion({type:"continue",target:n.leapManager.getContinueLoc(r.label)});break;case"SwitchStatement":var g=n.emitAssign(n.makeTempVar(),n.explodeExpression(e.get("discriminant")));s=a();for(var v=a(),E=v,A=[],C=r.cases||[],S=C.length-1;S>=0;--S){var _=C[S];d.assertSwitchCase(_),_.test?E=d.conditionalExpression(d.binaryExpression("===",g,_.test),A[S]=a(),E):A[S]=v}var w=e.get("discriminant");w.replaceWith(E),n.jump(n.explodeExpression(w)),n.leapManager.withEntry(new y.SwitchEntry(s),function(){e.get("cases").forEach(function(e){var t=e.key;n.mark(A[t]),e.get("consequent").forEach(function(e){n.explodeStatement(e)})})}),n.mark(s),-1===v.value&&(n.mark(v),h.default.strictEqual(s.value,v.value));break;case"IfStatement":var k=r.alternate&&a();s=a(),n.jumpIfNot(n.explodeExpression(e.get("test")),k||s),n.explodeStatement(e.get("consequent")),k&&(n.jump(s),n.mark(k),n.explodeStatement(e.get("alternate"))),n.mark(s);break;case"ReturnStatement":n.emitAbruptCompletion({type:"return",value:n.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error("WithStatement not supported in generator functions.");case"TryStatement":s=a();var F=r.handler,T=F&&a(),P=T&&new y.CatchEntry(T,F.param),B=r.finalizer&&a(),O=B&&new y.FinallyEntry(B,s),j=new y.TryEntry(n.getUnmarkedCurrentLoc(),P,O);n.tryEntries.push(j),n.updateContextPrevLoc(j.firstLoc),n.leapManager.withEntry(j,function(){if(n.explodeStatement(e.get("block")),T){B?n.jump(B):n.jump(s),n.updateContextPrevLoc(n.mark(T));var t=e.get("handler.body"),r=n.makeTempVar();n.clearPendingException(j.firstLoc,r),t.traverse(D,{safeParam:r,catchParamName:F.param.name}),n.leapManager.withEntry(P,function(){n.explodeStatement(t)})}B&&(n.updateContextPrevLoc(n.mark(B)),n.leapManager.withEntry(O,function(){n.explodeStatement(e.get("finalizer"))}),n.emit(d.returnStatement(d.callExpression(n.contextProperty("finish"),[O.firstLoc]))))}),n.mark(s);break;case"ThrowStatement":n.emit(d.throwStatement(n.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+(0,c.default)(r.type))}};var D={Identifier:function(e,t){e.node.name===t.catchParamName&&x.isReference(e)&&e.replaceWith(t.safeParam)},Scope:function(e,t){e.scope.hasOwnBinding(t.catchParamName)&&e.skip()}};A.emitAbruptCompletion=function(e){u(e)||h.default.ok(!1,"invalid completion record: "+(0,c.default)(e)),h.default.notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=[d.stringLiteral(e.type)];"break"===e.type||"continue"===e.type?(d.assertLiteral(e.target),t[1]=e.target):"return"!==e.type&&"throw"!==e.type||e.value&&(d.assertExpression(e.value),t[1]=e.value),this.emit(d.returnStatement(d.callExpression(this.contextProperty("abrupt"),t)))},A.getUnmarkedCurrentLoc=function(){return d.numericLiteral(this.listing.length)},A.updateContextPrevLoc=function(e){e?(d.assertLiteral(e),-1===e.value?e.value=this.listing.length:h.default.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},A.explodeExpression=function(e,t){function r(e){if(d.assertExpression(e),!t)return e;s.emit(e)}function n(e,t,r){h.default.ok(!r||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var n=s.explodeExpression(t,r);return r||(e||l&&!d.isLiteral(n))&&(n=s.emitAssign(e||s.makeTempVar(),n)),n}var i=e.node;if(!i)return i;d.assertExpression(i);var s=this,o=void 0,u=void 0;if(!b.containsLeap(i))return r(i);var l=b.containsLeap.onlyChildren(i);switch(i.type){case"MemberExpression":return r(d.memberExpression(s.explodeExpression(e.get("object")),i.computed?n(null,e.get("property")):i.property,i.computed));case"CallExpression":var p=e.get("callee"),f=e.get("arguments"),m=void 0,y=[],g=!1;if(f.forEach(function(e){g=g||b.containsLeap(e.node)}),d.isMemberExpression(p.node))if(g){var v=n(s.makeTempVar(),p.get("object")),x=p.node.computed?n(null,p.get("property")):p.node.property;y.unshift(v),m=d.memberExpression(d.memberExpression(v,x,p.node.computed),d.identifier("call"),!1)}else m=s.explodeExpression(p);else m=n(null,p),d.isMemberExpression(m)&&(m=d.sequenceExpression([d.numericLiteral(0),m]));return f.forEach(function(e){y.push(n(null,e))}),r(d.callExpression(m,y));case"NewExpression":return r(d.newExpression(n(null,e.get("callee")),e.get("arguments").map(function(e){return n(null,e)})));case"ObjectExpression":return r(d.objectExpression(e.get("properties").map(function(e){return e.isObjectProperty()?d.objectProperty(e.node.key,n(null,e.get("value")),e.node.computed):e.node})));case"ArrayExpression":return r(d.arrayExpression(e.get("elements").map(function(e){return n(null,e)})));case"SequenceExpression":var E=i.expressions.length-1;return e.get("expressions").forEach(function(e){e.key===E?o=s.explodeExpression(e,t):s.explodeExpression(e,!0)}),o;case"LogicalExpression":u=a(),t||(o=s.makeTempVar());var A=n(o,e.get("left"));return"&&"===i.operator?s.jumpIfNot(A,u):(h.default.strictEqual(i.operator,"||"),s.jumpIf(A,u)),n(o,e.get("right"),t),s.mark(u),o;case"ConditionalExpression":var D=a();u=a();var C=s.explodeExpression(e.get("test"));return s.jumpIfNot(C,D),t||(o=s.makeTempVar()),n(o,e.get("consequent"),t),s.jump(u),s.mark(D),n(o,e.get("alternate"),t),s.mark(u),o;case"UnaryExpression":return r(d.unaryExpression(i.operator,s.explodeExpression(e.get("argument")),!!i.prefix));case"BinaryExpression":return r(d.binaryExpression(i.operator,n(null,e.get("left")),n(null,e.get("right"))));case"AssignmentExpression":return r(d.assignmentExpression(i.operator,s.explodeExpression(e.get("left")),s.explodeExpression(e.get("right"))));case"UpdateExpression":return r(d.updateExpression(i.operator,s.explodeExpression(e.get("argument")),i.prefix));case"YieldExpression":u=a();var S=i.argument&&s.explodeExpression(e.get("argument"));if(S&&i.delegate){var _=s.makeTempVar();return s.emit(d.returnStatement(d.callExpression(s.contextProperty("delegateYield"),[S,d.stringLiteral(_.property.name),u]))),s.mark(u),_}return s.emitAssign(s.contextProperty("next"),u),s.emit(d.returnStatement(S||null)),s.mark(u),s.contextProperty("sent");default:throw new Error("unknown Expression of type "+(0,c.default)(i.type))}}},{"./leap":581,"./meta":582,"./util":584,assert:3,"babel-runtime/core-js/json/stringify":114,"babel-types":169}],579:[function(e,t,r){"use strict";var n=e("babel-runtime/core-js/object/keys"),i=function(e){return e&&e.__esModule?e:{default:e}}(n),s=e("babel-types"),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),o=Object.prototype.hasOwnProperty;r.hoist=function(e){function t(e,t){a.assertVariableDeclaration(e);var n=[];return e.declarations.forEach(function(e){r[e.id.name]=a.identifier(e.id.name),e.init?n.push(a.assignmentExpression("=",e.id,e.init)):t&&n.push(e.id)}),0===n.length?null:1===n.length?n[0]:a.sequenceExpression(n)}a.assertFunction(e.node);var r={};e.get("body").traverse({VariableDeclaration:{exit:function(e){var r=t(e.node,!1);null===r?e.remove():e.replaceWith(a.expressionStatement(r)),e.skip()}},ForStatement:function(e){var r=e.node.init;a.isVariableDeclaration(r)&&e.get("init").replaceWith(t(r,!1))},ForXStatement:function(e){var r=e.get("left");r.isVariableDeclaration()&&r.replaceWith(t(r.node,!0))},FunctionDeclaration:function(e){var t=e.node;r[t.id.name]=t.id;var n=a.expressionStatement(a.assignmentExpression("=",t.id,a.functionExpression(t.id,t.params,t.body,t.generator,t.expression)));e.parentPath.isBlockStatement()?(e.parentPath.unshiftContainer("body",n),e.remove()):e.replaceWith(n),e.skip()},FunctionExpression:function(e){e.skip()}});var n={};e.get("params").forEach(function(e){var t=e.node;a.isIdentifier(t)&&(n[t.name]=t)});var s=[];return(0,i.default)(r).forEach(function(e){o.call(n,e)||s.push(a.variableDeclarator(r[e],null))}),0===s.length?null:a.variableDeclaration("var",s)}},{"babel-runtime/core-js/object/keys":120,"babel-types":169}],580:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(){return e("./visit")}},{"./visit":585}],581:[function(e,t,r){"use strict";function n(){f.default.ok(this instanceof n)}function i(e){n.call(this),m.assertLiteral(e),this.returnLoc=e}function s(e,t,r){n.call(this),m.assertLiteral(e),m.assertLiteral(t),r?m.assertIdentifier(r):r=null,this.breakLoc=e,this.continueLoc=t,this.label=r}function a(e){n.call(this),m.assertLiteral(e),this.breakLoc=e}function o(e,t,r){n.call(this),m.assertLiteral(e),t?f.default.ok(t instanceof u):t=null,r?f.default.ok(r instanceof l):r=null,f.default.ok(t||r),this.firstLoc=e,this.catchEntry=t,this.finallyEntry=r}function u(e,t){n.call(this),m.assertLiteral(e),m.assertIdentifier(t),this.firstLoc=e,this.paramId=t}function l(e,t){n.call(this),m.assertLiteral(e),m.assertLiteral(t),this.firstLoc=e,this.afterLoc=t}function c(e,t){n.call(this),m.assertLiteral(e),m.assertIdentifier(t),this.breakLoc=e,this.label=t}function p(t){f.default.ok(this instanceof p);var r=e("./emit").Emitter;f.default.ok(t instanceof r),this.emitter=t,this.entryStack=[new i(t.finalLoc)]}var h=e("assert"),f=function(e){return e&&e.__esModule?e:{default:e}}(h),d=e("babel-types"),m=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(d),y=e("util");(0,y.inherits)(i,n),r.FunctionEntry=i,(0,y.inherits)(s,n),r.LoopEntry=s,(0,y.inherits)(a,n),r.SwitchEntry=a,(0,y.inherits)(o,n),r.TryEntry=o,(0,y.inherits)(u,n),r.CatchEntry=u,(0,y.inherits)(l,n),r.FinallyEntry=l,(0,y.inherits)(c,n),r.LabeledEntry=c;var g=p.prototype;r.LeapManager=p,g.withEntry=function(e,t){f.default.ok(e instanceof n),this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();f.default.strictEqual(r,e)}},g._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var n=this.entryStack[r],i=n[e];if(i)if(t){if(n.label&&n.label.name===t.name)return i}else if(!(n instanceof c))return i}return null},g.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},g.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{"./emit":578,assert:3,"babel-types":169,util:601}],582:[function(e,t,r){"use strict";function n(e,t){function r(e){function t(e){return r||(Array.isArray(e)?e.some(t):o.isNode(e)&&(s.default.strictEqual(r,!1),r=n(e))),r}o.assertNode(e);var r=!1,i=o.VISITOR_KEYS[e.type];if(i)for(var a=0;a0&&(a.node.body=l);var c=s(e);p.assertIdentifier(r.id);var d=p.identifier(r.id.name+"$"),y=(0,h.hoist)(e);if(o(e,i)){y=y||p.variableDeclaration("var",[]);var b=p.identifier("arguments");b._shadowedFunctionLiteral=e,y.declarations.push(p.variableDeclarator(i,b))}var v=new f.Emitter(n);v.explode(e.get("body")),y&&y.declarations.length>0&&u.push(y);var A=[v.getContextFunction(d),r.generator?c:p.nullLiteral(),p.thisExpression()],D=v.getTryLocsList();D&&A.push(D);var C=p.callExpression(g.runtimeProperty(r.async?"async":"wrap"),A);u.push(p.returnStatement(C)),r.body=p.blockStatement(u);var S=a.node.directives;S&&(r.body.directives=S);var _=r.generator;_&&(r.generator=!1),r.async&&(r.async=!1),_&&p.isExpression(r)&&e.replaceWith(p.callExpression(g.runtimeProperty("mark"),[r])),e.requeue()}}};var v={"FunctionExpression|FunctionDeclaration":function(e){e.skip()},Identifier:function(e,t){"arguments"===e.node.name&&g.isReference(e)&&(e.replaceWith(t.argsId),t.didRenameArguments=!0)}},x={MetaProperty:function(e){var t=e.node;"function"===t.meta.name&&"sent"===t.property.name&&e.replaceWith(p.memberExpression(this.context,p.identifier("_sent")))}},E={Function:function(e){e.skip()},AwaitExpression:function(e){var t=e.node.argument;e.replaceWith(p.yieldExpression(p.callExpression(g.runtimeProperty("awrap"),[t]),!1))}}},{"./emit":578,"./hoist":579,"./replaceShorthandObjectMethod":583,"./util":584,assert:3,"babel-types":169,private:537}],586:[function(e,t,r){var n=(e("assert"),e("recast").types),i=n.namedTypes,s=n.builders,a=Object.prototype.hasOwnProperty;r.defaults=function(e){for(var t,r=arguments.length,n=1;n>=1);return r}},{"is-finite":309}],589:[function(e,t,r){"use strict";t.exports=function(e){var t=/^\\\\\?\\/.test(e),r=/[^\x00-\x80]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},{}],590:[function(e,t,r){function n(){i.call(this)}t.exports=n;var i=e("events").EventEmitter;e("inherits")(n,i),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function r(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function n(){l.readable&&l.resume&&l.resume()}function s(){c||(c=!0,e.end())}function a(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function o(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){l.removeListener("data",r),e.removeListener("drain",n),l.removeListener("end",s),l.removeListener("close",a),l.removeListener("error",o),e.removeListener("error",o),l.removeListener("end",u),l.removeListener("close",u),e.removeListener("close",u)}var l=this;l.on("data",r),e.on("drain",n),e._isStdio||t&&!1===t.end||(l.on("end",s),l.on("close",a));var c=!1;return l.on("error",o),e.on("error",o),l.on("end",u),l.on("close",u),e.on("close",u),e.emit("pipe",l),e}},{events:301,inherits:306,"readable-stream/duplex.js":540,"readable-stream/passthrough.js":547,"readable-stream/readable.js":548,"readable-stream/transform.js":549,"readable-stream/writable.js":550}],591:[function(e,t,r){function n(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function s(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var o=e("buffer").Buffer,u=o.isEncoding||function(e){switch(e&&e.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!0;default:return!1}},l=r.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),n(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new o(6),this.charReceived=0,this.charLength=0};l.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,n=t.charCodeAt(i);if(n>=55296&&n<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),e.copy(this.charBuffer,0,0,s),t.substring(0,i)}return t},l.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},l.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}},{buffer:184}],592:[function(e,t,r){"use strict";var n=e("ansi-regex")();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{"ansi-regex":1}], +593:[function(e,t,r){(function(e){"use strict";var r=e.argv,n=r.indexOf("--"),i=function(e){e="--"+e;var t=r.indexOf(e);return-1!==t&&(-1===n||t=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(t)?n.showHidden=t:t&&r._extend(n,t),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),u(n,e,n.depth)}function s(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function a(e,t){return e}function o(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,n){if(e.customInspect&&t&&_(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return v(i)||(i=u(e,i,n)),i}var s=l(e,t);if(s)return s;var a=Object.keys(t),m=o(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),S(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(t);if(0===a.length){if(_(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(A(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(C(t))return e.stylize(Date.prototype.toString.call(t),"date");if(S(t))return c(t)}var g="",b=!1,x=["{","}"];if(d(t)&&(b=!0,x=["[","]"]),_(t)){g=" [Function"+(t.name?": "+t.name:"")+"]"}if(A(t)&&(g=" "+RegExp.prototype.toString.call(t)),C(t)&&(g=" "+Date.prototype.toUTCString.call(t)),S(t)&&(g=" "+c(t)),0===a.length&&(!b||0==t.length))return x[0]+g+x[1];if(n<0)return A(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var E;return E=b?p(e,t,n,m,a):a.map(function(r){return h(e,t,n,m,r,b)}),e.seen.pop(),f(E,g,x)}function l(e,t){if(E(t))return e.stylize("undefined","undefined");if(v(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return b(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i){for(var s=[],a=0,o=t.length;a-1&&(o=s?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),E(a)){if(s&&i.match(/^\d+$/))return o;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+o}function f(e,t,r){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function d(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function y(e){return null===e}function g(e){return null==e}function b(e){return"number"==typeof e}function v(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function E(e){return void 0===e}function A(e){return D(e)&&"[object RegExp]"===k(e)}function D(e){return"object"==typeof e&&null!==e}function C(e){return D(e)&&"[object Date]"===k(e)}function S(e){return D(e)&&("[object Error]"===k(e)||e instanceof Error)}function _(e){return"function"==typeof e}function w(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function k(e){return Object.prototype.toString.call(e)}function F(e){return e<10?"0"+e.toString(10):e.toString(10)}function T(){var e=new Date,t=[F(e.getHours()),F(e.getMinutes()),F(e.getSeconds())].join(":");return[e.getDate(),j[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.format=function(e){if(!v(e)){for(var t=[],r=0;r=s)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),o=n[r];r=4\" eslint lib/*.js lib/compile/*.js spec scripts", + "test-spec": "mocha spec/*.spec.js -R spec", + "test-fast": "AJV_FAST_TEST=true npm run test-spec", + "test-debug": "mocha spec/*.spec.js --debug-brk -R spec", + "test-cov": "nyc npm run test-spec", + "test-ts": "tsc --target ES5 --noImplicitAny lib/ajv.d.ts", + "bundle": "node ./scripts/bundle.js . Ajv pure_getters", + "bundle-regenerator": "node ./scripts/bundle.js regenerator", + "bundle-nodent": "node ./scripts/bundle.js nodent", + "bundle-all": "del-cli dist && npm run bundle && npm run bundle-regenerator && npm run bundle-nodent", + "bundle-beautify": "node ./scripts/bundle.js js-beautify", + "build": "del-cli lib/dotjs/*.js && node scripts/compile-dots.js", + "test-karma": "karma start --single-run --browsers PhantomJS", + "test-browser": "del-cli .browser && npm run bundle-all && scripts/prepare-tests && npm run test-karma", + "test": "npm run jshint && npm run eslint && npm run test-ts && npm run build && npm run test-cov && if-node-version 4 npm run test-browser", + "prepublish": "npm run build && npm run bundle-all", + "watch": "watch 'npm run build' ./lib/dot" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/epoberezkin/ajv.git" + }, + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/epoberezkin/ajv/issues" + }, + "homepage": "https://github.com/epoberezkin/ajv", + "tonicExampleFilename": ".tonic_example.js", + "dependencies": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + }, + "devDependencies": { + "bluebird": "^3.1.5", + "brfs": "^1.4.3", + "browserify": "^14.1.0", + "chai": "^3.5.0", + "coveralls": "^2.11.4", + "del-cli": "^0.2.1", + "dot": "^1.0.3", + "eslint": "^3.2.2", + "gh-pages-generator": "^0.2.0", + "glob": "^7.0.0", + "if-node-version": "^1.0.0", + "js-beautify": "^1.5.6", + "jshint": "^2.8.0", + "json-schema-test": "^1.1.1", + "karma": "^1.0.0", + "karma-chrome-launcher": "^2.0.0", + "karma-mocha": "^1.1.1", + "karma-phantomjs-launcher": "^1.0.0", + "karma-sauce-launcher": "^1.1.0", + "mocha": "^3.0.0", + "nodent": "^3.0.17", + "nyc": "^10.0.0", + "phantomjs-prebuilt": "^2.1.4", + "pre-commit": "^1.1.1", + "regenerator": "0.9.7", + "require-globify": "^1.3.0", + "typescript": "^2.0.3", + "uglify-js": "^2.6.1", + "watch": "^1.0.0" + } +} diff --git a/node_modules/ajv/scripts/.eslintrc.yml b/node_modules/ajv/scripts/.eslintrc.yml new file mode 100644 index 000000000..493d7d312 --- /dev/null +++ b/node_modules/ajv/scripts/.eslintrc.yml @@ -0,0 +1,3 @@ +rules: + no-console: 0 + no-empty: [2, allowEmptyCatch: true] diff --git a/node_modules/ajv/scripts/bundle.js b/node_modules/ajv/scripts/bundle.js new file mode 100644 index 000000000..b3a9890c5 --- /dev/null +++ b/node_modules/ajv/scripts/bundle.js @@ -0,0 +1,54 @@ +'use strict'; + +var fs = require('fs') + , path = require('path') + , browserify = require('browserify') + , uglify = require('uglify-js'); + +var pkg = process.argv[2] + , standalone = process.argv[3] + , compress = process.argv[4]; + +var packageDir = path.join(__dirname, '..'); +if (pkg != '.') packageDir = path.join(packageDir, 'node_modules', pkg); + +var json = require(path.join(packageDir, 'package.json')); + +var distDir = path.join(__dirname, '..', 'dist'); +if (!fs.existsSync(distDir)) fs.mkdirSync(distDir); + +var bOpts = {}; +if (standalone) bOpts.standalone = standalone; + +browserify(bOpts) +.require(path.join(packageDir, json.main), {expose: json.name}) +.bundle(function (err, buf) { + if (err) { + console.error('browserify error:', err); + process.exit(1); + } + + var outputFile = path.join(distDir, json.name); + var outputBundle = outputFile + '.bundle.js'; + fs.writeFileSync(outputBundle, buf); + var uglifyOpts = { + warnings: true, + compress: {}, + output: { + preamble: '/* ' + json.name + ' ' + json.version + ': ' + json.description + ' */' + } + }; + if (compress) { + var compressOpts = compress.split(','); + for (var i=0; i]+ajv_logo[^>]+>//" index.md + git config user.email "$GIT_USER_EMAIL" + git config user.name "$GIT_USER_NAME" + git add . + git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER" + git push --quiet origin gh-pages > /dev/null 2>&1 + } +fi diff --git a/node_modules/ansi-regex/index.js b/node_modules/ansi-regex/index.js new file mode 100644 index 000000000..b9574ed7e --- /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 000000000..654d0bfe9 --- /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 000000000..eb44fb5c1 --- /dev/null +++ b/node_modules/ansi-regex/package.json @@ -0,0 +1,64 @@ +{ + "name": "ansi-regex", + "version": "2.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Appelman (jbnicolai.com)", + "JD Ballard (github.com/qix-)" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava --verbose", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js" + ], + "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" + ], + "devDependencies": { + "ava": "0.17.0", + "xo": "0.16.0" + }, + "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 000000000..6a928edf0 --- /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 000000000..78945278f --- /dev/null +++ b/node_modules/ansi-styles/index.js @@ -0,0 +1,65 @@ +'use strict'; + +function assembleStyles () { + var styles = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + 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] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } + }; + + // fix humans + styles.colors.grey = styles.colors.gray; + + Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; + + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\u001b[' + style[0] + 'm', + close: '\u001b[' + style[1] + 'm' + }; + }); + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + }); + + return styles; +} + +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 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/ansi-styles/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-styles/package.json b/node_modules/ansi-styles/package.json new file mode 100644 index 000000000..78c535f74 --- /dev/null +++ b/node_modules/ansi-styles/package.json @@ -0,0 +1,50 @@ +{ + "name": "ansi-styles", + "version": "2.2.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Appelman (jbnicolai.com)" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md new file mode 100644 index 000000000..3f933f616 --- /dev/null +++ b/node_modules/ansi-styles/readme.md @@ -0,0 +1,86 @@ +# 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. + +![](screenshot.png) + + +## Install + +``` +$ npm install --save ansi-styles +``` + + +## Usage + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.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` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` + + +## 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. + +- `ansi.modifiers` +- `ansi.colors` +- `ansi.bgColors` + + +###### Example + +```js +console.log(ansi.colors.green.open); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/argparse/CHANGELOG.md b/node_modules/argparse/CHANGELOG.md new file mode 100644 index 000000000..a43c628cc --- /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 000000000..1afdae558 --- /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 000000000..7fa6c4050 --- /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 000000000..3bbc14320 --- /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/package.json b/node_modules/argparse/package.json new file mode 100644 index 000000000..62fba0a9f --- /dev/null +++ b/node_modules/argparse/package.json @@ -0,0 +1,34 @@ +{ + "name": "argparse", + "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library", + "version": "1.0.10", + "keywords": [ + "cli", + "parser", + "argparse", + "option", + "args" + ], + "contributors": [ + "Eugene Shkuropat", + "Paul Jacobson" + ], + "files": [ + "index.js", + "lib/" + ], + "license": "MIT", + "repository": "nodeca/argparse", + "scripts": { + "test": "make test" + }, + "dependencies": { + "sprintf-js": "~1.0.2" + }, + "devDependencies": { + "eslint": "^2.13.1", + "istanbul": "^0.4.5", + "mocha": "^3.1.0", + "ndoc": "^5.0.1" + } +} diff --git a/node_modules/array-buffer-byte-length/.eslintrc b/node_modules/array-buffer-byte-length/.eslintrc new file mode 100644 index 000000000..fe2fefe96 --- /dev/null +++ b/node_modules/array-buffer-byte-length/.eslintrc @@ -0,0 +1,9 @@ +{ + "root": true, + + "extends": "@ljharb", + + "globals": { + "DataView": false, + }, +} diff --git a/node_modules/array-buffer-byte-length/.github/FUNDING.yml b/node_modules/array-buffer-byte-length/.github/FUNDING.yml new file mode 100644 index 000000000..b3b30fa8b --- /dev/null +++ b/node_modules/array-buffer-byte-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/array-buffer-byte-length +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/array-buffer-byte-length/.nycrc b/node_modules/array-buffer-byte-length/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/array-buffer-byte-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/array-buffer-byte-length/CHANGELOG.md b/node_modules/array-buffer-byte-length/CHANGELOG.md new file mode 100644 index 000000000..dad50cd02 --- /dev/null +++ b/node_modules/array-buffer-byte-length/CHANGELOG.md @@ -0,0 +1,43 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/inspect-js/array-buffer-byte-length/compare/v1.0.1...v1.0.2) - 2024-12-19 + +### Commits + +- [types] use shared config [`b15321c`](https://github.com/inspect-js/array-buffer-byte-length/commit/b15321cf546dae5d3bc2b354fb8e2a4629d6afb3) +- [actions] split out node 10-20, and 20+ [`fa1eb7d`](https://github.com/inspect-js/array-buffer-byte-length/commit/fa1eb7df107d382b47d7b9e7a07e1c4588e81cbd) +- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`53e3f93`](https://github.com/inspect-js/array-buffer-byte-length/commit/53e3f93c456b7a8a8217a832b48c416962a176e0) +- [Tests] replace `aud` with `npm audit` [`2d1b66f`](https://github.com/inspect-js/array-buffer-byte-length/commit/2d1b66ff6417b825f58adf859b540c2303d2dbde) +- [Refactor] use `call-bound` directly [`433be34`](https://github.com/inspect-js/array-buffer-byte-length/commit/433be3427e20526d74ab1faaaf0117aaf967f406) +- [Deps] update `call-bind`, `is-array-buffer` [`4ff7467`](https://github.com/inspect-js/array-buffer-byte-length/commit/4ff74673567dcae00e5a8c5d4d0f8c23b29c9a0a) +- [Dev Deps] update `tape`, `typescript` [`42c9f19`](https://github.com/inspect-js/array-buffer-byte-length/commit/42c9f1998fe8630634388b6db2c0563be05c6897) +- [Tests] add attw [`29a72f1`](https://github.com/inspect-js/array-buffer-byte-length/commit/29a72f12eb83dcfaef6a6bed0403e56699669f27) +- [Deps] update `call-bind` [`1e9e902`](https://github.com/inspect-js/array-buffer-byte-length/commit/1e9e90292388a609aa0e722bddbc9313a575ef10) +- [types] remove incorrect overload [`b509518`](https://github.com/inspect-js/array-buffer-byte-length/commit/b509518bc188f79c46aa851311f20c188faa0678) +- [Dev Deps] add missing peer dep [`31962b6`](https://github.com/inspect-js/array-buffer-byte-length/commit/31962b631a173696ceef94e9d00edf13af87d305) + +## [v1.0.1](https://github.com/inspect-js/array-buffer-byte-length/compare/v1.0.0...v1.0.1) - 2024-02-03 + +### Commits + +- [patch] add types [`598d446`](https://github.com/inspect-js/array-buffer-byte-length/commit/598d446f45c8f4246493b2a1fa2b32cd0c669602) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `object-inspect`, `tape` [`2572345`](https://github.com/inspect-js/array-buffer-byte-length/commit/257234593f576a7cbb1dce1b21d52abeb68db34d) +- [Tests] add coverage [`d27357d`](https://github.com/inspect-js/array-buffer-byte-length/commit/d27357de558c3272341e252c3acc010d38edeb0f) +- [Deps] update `call-bind`, `is-array-buffer` [`2ea13ad`](https://github.com/inspect-js/array-buffer-byte-length/commit/2ea13adc85b7d775d1649ac8e9469ac380cb3665) +- [meta] add missing `engines.node` [`380e96d`](https://github.com/inspect-js/array-buffer-byte-length/commit/380e96d1c91dd579df0261950b46b62d4fed7a23) +- [Deps] update `is-array-buffer` [`cfa7093`](https://github.com/inspect-js/array-buffer-byte-length/commit/cfa7093daaeeccbaa5228a22e6ec32a307d81549) +- [meta] add `sideEffects` flag [`7297ddd`](https://github.com/inspect-js/array-buffer-byte-length/commit/7297dddd40a8f310bb69726a7a6edfae6111b8de) + +## v1.0.0 - 2023-02-28 + +### Commits + +- Initial implementation, tests, readme [`2db6cad`](https://github.com/inspect-js/array-buffer-byte-length/commit/2db6cad79270ab1966f5ea80160abbcd4534c91d) +- Initial commit [`b2a0c9c`](https://github.com/inspect-js/array-buffer-byte-length/commit/b2a0c9c2246514b7999d331aad868c4f32326db7) +- npm init [`376acdb`](https://github.com/inspect-js/array-buffer-byte-length/commit/376acdbd4435cb1d4c31d107cacb3b86f2363aee) +- Only apps should have lockfiles [`70cf325`](https://github.com/inspect-js/array-buffer-byte-length/commit/70cf32526fc727d0d16a12d85a4bddea70075e31) diff --git a/node_modules/array-buffer-byte-length/LICENSE b/node_modules/array-buffer-byte-length/LICENSE new file mode 100644 index 000000000..5ea30366f --- /dev/null +++ b/node_modules/array-buffer-byte-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-buffer-byte-length/README.md b/node_modules/array-buffer-byte-length/README.md new file mode 100644 index 000000000..64836c231 --- /dev/null +++ b/node_modules/array-buffer-byte-length/README.md @@ -0,0 +1,40 @@ +# array-buffer-byte-length [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method. + +## Example + +```js +const assert = require('assert'); +const byteLength = require('array-buffer-byte-length'); + +assert.equal(byteLength([]), NaN, 'an array is not an ArrayBuffer, yields NaN'); + +assert.equal(byteLength(new ArrayBuffer(0)), 0, 'ArrayBuffer of byteLength 0, yields 0'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/array-buffer-byte-length +[npm-version-svg]: https://versionbadg.es/inspect-js/array-buffer-byte-length.svg +[deps-svg]: https://david-dm.org/inspect-js/array-buffer-byte-length.svg +[deps-url]: https://david-dm.org/inspect-js/array-buffer-byte-length +[dev-deps-svg]: https://david-dm.org/inspect-js/array-buffer-byte-length/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/array-buffer-byte-length#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/array-buffer-byte-length.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/array-buffer-byte-length.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/array-buffer-byte-length.svg +[downloads-url]: https://npm-stat.com/charts.html?package=array-buffer-byte-length +[codecov-image]: https://codecov.io/gh/inspect-js/array-buffer-byte-length/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/array-buffer-byte-length/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/array-buffer-byte-length +[actions-url]: https://github.com/inspect-js/array-buffer-byte-length/actions diff --git a/node_modules/array-buffer-byte-length/index.d.ts b/node_modules/array-buffer-byte-length/index.d.ts new file mode 100644 index 000000000..b8594b49d --- /dev/null +++ b/node_modules/array-buffer-byte-length/index.d.ts @@ -0,0 +1,4 @@ +declare function arrayBufferByteLength(buffer: ArrayBuffer): number; +declare function arrayBufferByteLength(buffer: unknown): typeof NaN; + +export = arrayBufferByteLength; diff --git a/node_modules/array-buffer-byte-length/index.js b/node_modules/array-buffer-byte-length/index.js new file mode 100644 index 000000000..de1be39ef --- /dev/null +++ b/node_modules/array-buffer-byte-length/index.js @@ -0,0 +1,14 @@ +'use strict'; + +var callBound = require('call-bound'); +var $byteLength = callBound('ArrayBuffer.prototype.byteLength', true); + +var isArrayBuffer = require('is-array-buffer'); + +/** @type {import('.')} */ +module.exports = function byteLength(ab) { + if (!isArrayBuffer(ab)) { + return NaN; + } + return $byteLength ? $byteLength(ab) : ab.byteLength; +}; // in node < 0.11, byteLength is an own nonconfigurable property diff --git a/node_modules/array-buffer-byte-length/package.json b/node_modules/array-buffer-byte-length/package.json new file mode 100644 index 000000000..f97c95215 --- /dev/null +++ b/node_modules/array-buffer-byte-length/package.json @@ -0,0 +1,94 @@ +{ + "name": "array-buffer-byte-length", + "version": "1.0.2", + "description": "Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "keywords": [ + "shim", + "polyfill", + "ArrayBuffer", + "byteLength", + "byte", + "length", + "es-shim API", + "es-shims" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/array-buffer-byte-length.git" + }, + "bugs": { + "url": "https://github.com/inspect-js/array-buffer-byte-length/issues" + }, + "homepage": "https://github.com/inspect-js/array-buffer-byte-length#readme", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.8.0", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "testling": { + "files": "test/index.js" + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/array-buffer-byte-length/test/index.js b/node_modules/array-buffer-byte-length/test/index.js new file mode 100644 index 000000000..fb328d10b --- /dev/null +++ b/node_modules/array-buffer-byte-length/test/index.js @@ -0,0 +1,29 @@ +'use strict'; + +var test = require('tape'); +var forEach = require('for-each'); +var v = require('es-value-fixtures'); +var inspect = require('object-inspect'); + +var byteLength = require('../'); + +test('byteLength', function (t) { + forEach(v.objects.concat(v.primitives), function (nonAB) { + t.equal(byteLength(nonAB), NaN, inspect(nonAB) + ' is not an ArrayBuffer, and yields NaN'); + }); + + t.test('ArrayBuffers', { skip: typeof ArrayBuffer !== 'function' }, function (st) { + var ab32 = new ArrayBuffer(32); + st.equal(byteLength(ab32), 32, 'works on an ArrayBuffer of length 32: ' + inspect(ab32)); + + var ab0 = new ArrayBuffer(0); + st.equal(byteLength(ab0), 0, 'works on an ArrayBuffer of length 0: ' + inspect(ab0)); + + var dv = new DataView(ab32); + st.equal(byteLength(dv), NaN, 'a DataView returns NaN'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/array-buffer-byte-length/tsconfig.json b/node_modules/array-buffer-byte-length/tsconfig.json new file mode 100644 index 000000000..b9fbbf12f --- /dev/null +++ b/node_modules/array-buffer-byte-length/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ES2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/arraybuffer.prototype.slice/.editorconfig b/node_modules/arraybuffer.prototype.slice/.editorconfig new file mode 100644 index 000000000..eaa214161 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/arraybuffer.prototype.slice/.eslintrc b/node_modules/arraybuffer.prototype.slice/.eslintrc new file mode 100644 index 000000000..963e2a847 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/.eslintrc @@ -0,0 +1,34 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "max-params": 0, + "max-statements": 0, + "multiline-comment-style": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "IsSharedArrayBuffer", + "ToIntegerOrInfinity", + "GetIntrinsic", + "IsDetachedBuffer", + "SpeciesConstructor", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "globals": { + "ArrayBuffer": false, + "Uint8Array": false, + }, + "rules": { + "max-lines-per-function": 0, + }, + }, + ], +} diff --git a/node_modules/arraybuffer.prototype.slice/.nycrc b/node_modules/arraybuffer.prototype.slice/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/arraybuffer.prototype.slice/CHANGELOG.md b/node_modules/arraybuffer.prototype.slice/CHANGELOG.md new file mode 100644 index 000000000..5ba5072d2 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/CHANGELOG.md @@ -0,0 +1,52 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.4](https://github.com/es-shims/ArrayBuffer.prototype.slice/compare/v1.0.3...v1.0.4) - 2024-12-15 + +### Commits + +- [actions] split out node 10-20, and 20+ [`5e59635`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/5e59635c948994b613c544b4e94fe93536d6b213) +- [Deps] update `call-bind`, `es-abstract`, `get-intrinsic` [`0afbb59`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/0afbb5942574055a8a3afdf0f69f60313e3f1af2) +- [Dev Deps] update `@es-shims/api`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`d76caf4`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/d76caf4880ef358cf5384a6eb29d0f2f67e4d3a8) +- [Deps] update `call-bind`, `es-abstract`, `es-errors`, `get-intrinsic` [`2b374a2`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/2b374a2d4078d9122ac30bdecd8a8fae740aa74c) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `object-inspect`, `tape` [`a24fd39`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/a24fd39370d891ea3439f9d7a1c42183c0aa1bf7) +- [Tests] replace `aud` with `npm audit` [`c704fb0`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/c704fb0b1651ceb56b609a5b4646a993fc868219) +- [Deps] remove unused dependency [`0274b32`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/0274b32ab1d345fbf70745a79dd7a44f844179bb) +- [Dev Deps] add missing peer dep [`673f754`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/673f754797dd0c40801cca2f32ff08b372448c6b) + +## [v1.0.3](https://github.com/es-shims/ArrayBuffer.prototype.slice/compare/v1.0.2...v1.0.3) - 2024-02-04 + +### Commits + +- [Deps] update `array-buffer-byte-length`, `call-bind`, `define-properties`, `es-abstract`, `get-intrinsic`, `is-array-buffer` [`d9b6859`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/d9b68591ff509613d0dfc4036539ba4e0dc34931) +- [Dev Deps] update `aud`, `npmignore`, `object-inspect`, `tape` [`38cb58d`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/38cb58dfa3f3c8b11bfb2144f8e7cc74dd461f5e) +- [Refactor] use `es-errors` where possible, so things that only need those do not need `get-intrinsic` [`5c07bef`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/5c07befd134cae93ad5f9ab307ff67691ff5155b) + +## [v1.0.2](https://github.com/es-shims/ArrayBuffer.prototype.slice/compare/v1.0.1...v1.0.2) - 2023-09-05 + +### Commits + +- [Deps] update `es-abstract` [`a9ab0d2`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/a9ab0d2551bb301b740e333ea3795fad23fcbe40) +- [Dev Deps] update `tape` [`6b24af5`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/6b24af585dc9176c8ac3fd482cb1d5257e550a09) +- [Fix] move `es-abstract` to runtime deps [`63a8397`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/63a8397623d7749856f6392ae93bf87152c3916c) + +## [v1.0.1](https://github.com/es-shims/ArrayBuffer.prototype.slice/compare/v1.0.0...v1.0.1) - 2023-07-11 + +### Commits + +- [Fix] node < 0.11 has an own nonconfigurable `slice` property; use it [`554823c`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/554823c92ce16d6b7184a7d0ccfe315b663584d7) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `es-abstract`, `tape` [`53b0421`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/53b04217048c645306597e2cfc55adb69c384146) +- [Deps] update `define-properties`, `get-intrinsic` [`4966b02`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/4966b02bc25ac006709b29ca370b9f6e159f723a) + +## v1.0.0 - 2023-07-09 + +### Commits + +- Initial implementation, tests, readme [`36b4b5e`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/36b4b5eedfa225c3086e9453b9db0088c299640a) +- Initial commit [`51499df`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/51499dfac7d8c67c2928cb47363a4de7ff17904a) +- npm init [`8ec604e`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/8ec604e7d3ef8d4c27376b09645f779c2244b08f) +- Only apps should have lockfiles [`ac54435`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/ac54435161d4415e2122e3a682499f3a6df2f6de) diff --git a/node_modules/arraybuffer.prototype.slice/LICENSE b/node_modules/arraybuffer.prototype.slice/LICENSE new file mode 100644 index 000000000..eb970aa5c --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 ECMAScript Shims + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/arraybuffer.prototype.slice/README.md b/node_modules/arraybuffer.prototype.slice/README.md new file mode 100644 index 000000000..503585715 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/README.md @@ -0,0 +1,61 @@ +# ArrayBuffer.prototype.slice [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES spec-compliant `ArrayBuffer.prototype.slice` shim. Invoke its "shim" method to shim ArrayBuffer.prototype.slice if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice). + +Most common usage: +```js +var assert = require('assert'); +var slice = require('arraybuffer.prototype.slice'); + +var ab = new ArrayBuffer(1); +var arr = new Uint8Array(ab); +arr[0] = 123; + +var ab2 = slice(ab); + +var arr2 = new Uint8Array(ab2); +arr2[0] = 234; + +assert.deepEqual(arr, new Uint8Array([123])); +assert.deepEqual(arr2, new Uint8Array([234])); + +if (!ArrayBuffer.prototype.transfer) { + slice.shim(); +} + +var ab2 = ab.slice(); + +var arr2 = new Uint8Array(ab2); +arr2[0] = 234; + +assert.deepEqual(arr, new Uint8Array([123])); +assert.deepEqual(arr2, new Uint8Array([234])); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/arraybuffer.prototype.slice +[npm-version-svg]: https://versionbadg.es/es-shims/ArrayBuffer.prototype.slice.svg +[deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice.svg +[deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice +[dev-deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/arraybuffer.prototype.slice.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/arraybuffer.prototype.slice.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/arraybuffer.prototype.slice.svg +[downloads-url]: https://npm-stat.com/charts.html?package=arraybuffer.prototype.slice +[codecov-image]: https://codecov.io/gh/es-shims/ArrayBuffer.prototype.slice/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/ArrayBuffer.prototype.slice/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/ArrayBuffer.prototype.slice +[actions-url]: https://github.com/es-shims/ArrayBuffer.prototype.slice/actions diff --git a/node_modules/arraybuffer.prototype.slice/auto.js b/node_modules/arraybuffer.prototype.slice/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/arraybuffer.prototype.slice/implementation.js b/node_modules/arraybuffer.prototype.slice/implementation.js new file mode 100644 index 000000000..49ed96441 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/implementation.js @@ -0,0 +1,84 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true); +var $Uint8Array = GetIntrinsic('%Uint8Array%', true); + +var IsDetachedBuffer = require('es-abstract/2024/IsDetachedBuffer'); +var IsSharedArrayBuffer = require('es-abstract/2024/IsSharedArrayBuffer'); +var max = require('es-abstract/2024/max'); +var min = require('es-abstract/2024/min'); +var SpeciesConstructor = require('es-abstract/2024/SpeciesConstructor'); +var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity'); + +var arrayBufferByteLength = require('array-buffer-byte-length'); +var isArrayBuffer = require('is-array-buffer'); +var $TypeError = require('es-errors/type'); + +module.exports = function slice(start, end) { + var O = this; // step 1 + + if (!isArrayBuffer(O) || IsSharedArrayBuffer(O) || IsDetachedBuffer(O)) { + throw new $TypeError('receiver must be a non-detached, non-shared ArrayBuffer'); // steps 2-4 + } + + var len = arrayBufferByteLength(O); // step 5 + + var relativeStart = ToIntegerOrInfinity(start); // step 6 + + var first; + if (relativeStart === -Infinity) { + first = 0; // step 7 + } else if (relativeStart < 0) { + first = max(len + relativeStart, 0); // step 8 + } else { + first = min(relativeStart, len); // step 9 + } + + var relativeEnd = typeof end === 'undefined' ? len : ToIntegerOrInfinity(end); // step 10 + + var final; + if (relativeEnd === -Infinity) { + final = 0; // step 11 + } else if (relativeEnd < 0) { + final = max(len + relativeEnd, 0); // step 12 + } else { + final = min(relativeEnd, len); // step 13 + } + + var newLen = max(final - first, 0); // step 14 + + var Ctor = SpeciesConstructor(O, $ArrayBuffer); // step 15 + + var new$ = new Ctor(newLen); // step 16 + + if (!isArrayBuffer(new$) || IsSharedArrayBuffer(new$) || IsDetachedBuffer(new$)) { + throw new $TypeError('Species constructor must produce a non-detached, non-shared Array Buffer'); // steps 17-19 + } + + if (new$ === O) { + throw new $TypeError('new ArrayBuffer should not have been the same as the receiver'); // step 20 + } + + if (arrayBufferByteLength(new$) < newLen) { + throw new $TypeError('new ArrayBuffer\'s byteLength must be at least the requested length'); // step 21 + } + + if (IsDetachedBuffer(O)) { + throw new $TypeError('receiver became an detached ArrayBuffer'); // step 23 + } + + /* + 24. Let fromBuf be O.[[ArrayBufferData]]. + 25. Let toBuf be new.[[ArrayBufferData]]. + 26. Perform CopyDataBlockBytes(toBuf, 0, fromBuf, first, newLen). + */ + var sourceArr = new $Uint8Array(O); + var destArr = new $Uint8Array(new$); + for (var i = start, ii = 0; i < end; i++, ii++) { + destArr[ii] = sourceArr[i]; + } + + return new$; // step 27 +}; diff --git a/node_modules/arraybuffer.prototype.slice/index.js b/node_modules/arraybuffer.prototype.slice/index.js new file mode 100644 index 000000000..517c4147e --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); + +define(bound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = bound; diff --git a/node_modules/arraybuffer.prototype.slice/package.json b/node_modules/arraybuffer.prototype.slice/package.json new file mode 100644 index 000000000..c4d6c9e96 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/package.json @@ -0,0 +1,102 @@ +{ + "name": "arraybuffer.prototype.slice", + "version": "1.0.4", + "description": "ES spec-compliant shim for ArrayBuffer.prototype.slice", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "main": "index.js", + "exports": { + ".": "./index.js", + "./auto": "./auto.js", + "./polyfill": "./polyfill.js", + "./implementation": "./implementation.js", + "./shim": "./shim.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "evalmd README.md && es-shim-api --bound", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/es-shims/ArrayBuffer.prototype.slice.git" + }, + "homepage": "https://github.com/es-shims/ArrayBuffer.prototype.slice#readme", + "bugs": { + "url": "https://github.com/es-shims/ArrayBuffer.prototype.slice/issues" + }, + "keywords": [ + "javascript", + "ecmascript", + "ArrayBuffer.prototype.slice", + "polyfill", + "shim", + "ArrayBuffer", + "array", + "buffer", + "ArrayBuffer#slice", + "slice", + "typed array", + "es-shim API" + ], + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "testling": { + "files": "test/index.js" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/arraybuffer.prototype.slice/polyfill.js b/node_modules/arraybuffer.prototype.slice/polyfill.js new file mode 100644 index 000000000..a4a90ca16 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/polyfill.js @@ -0,0 +1,21 @@ +'use strict'; + +var callBind = require('call-bind'); + +var implementation = require('./implementation'); + +var ownSlice = typeof ArrayBuffer === 'function' && new ArrayBuffer(0).slice; +var ownSliceBound = ownSlice && callBind(ownSlice); +var ownSliceWrapper = ownSliceBound && function slice(start, end) { + /* eslint no-invalid-this: 0 */ + if (arguments.length < 2) { + return ownSliceBound(this, arguments.length > 0 ? start : 0); + } + return ownSliceBound(this, start, end); +}; + +module.exports = function getPolyfill() { + return (typeof ArrayBuffer === 'function' && ArrayBuffer.prototype.slice) + || ownSliceWrapper + || implementation; +}; diff --git a/node_modules/arraybuffer.prototype.slice/shim.js b/node_modules/arraybuffer.prototype.slice/shim.js new file mode 100644 index 000000000..cb52c0710 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/shim.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); + +var getPolyfill = require('./polyfill'); + +module.exports = function shimArrayBufferSlice() { + if (typeof ArrayBuffer === 'function') { + var polyfill = getPolyfill(); + define( + ArrayBuffer.prototype, + { slice: polyfill }, + { slice: function () { return ArrayBuffer.prototype.slice !== polyfill; } } + ); + } + + return polyfill; +}; diff --git a/node_modules/arraybuffer.prototype.slice/test/implementation.js b/node_modules/arraybuffer.prototype.slice/test/implementation.js new file mode 100644 index 000000000..7d97bb77c --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/test/implementation.js @@ -0,0 +1,32 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) { + st.test('bad array/this value', { skip: !hasStrictMode }, function (s2t) { + /* eslint no-useless-call: 0 */ + s2t['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + s2t['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + s2t.end(); + }); + + runTests(callBind(implementation), st); + + st.end(); + }); + + t.test('no ArrayBuffer support', { skip: typeof ArrayBuffer !== 'undefined' }, function (st) { + st['throws']( + function () { implementation.call({}); }, + SyntaxError, + 'ArrayBuffer is not supported' + ); + }); + + t.end(); +}); diff --git a/node_modules/arraybuffer.prototype.slice/test/index.js b/node_modules/arraybuffer.prototype.slice/test/index.js new file mode 100644 index 000000000..0e9dd102c --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/test/index.js @@ -0,0 +1,29 @@ +'use strict'; + +var index = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) { + st.test('bad array/this value', function (s2t) { + s2t['throws'](function () { index(undefined); }, TypeError, 'undefined is not an object'); + s2t['throws'](function () { index(null); }, TypeError, 'null is not an object'); + s2t.end(); + }); + + runTests(index, st); + + st.end(); + }); + + t.test('no ArrayBuffer support', { skip: typeof ArrayBuffer !== 'undefined' }, function (st) { + st['throws']( + function () { index({}); }, + SyntaxError, + 'ArrayBuffer is not supported' + ); + }); + + t.end(); +}); diff --git a/node_modules/arraybuffer.prototype.slice/test/shimmed.js b/node_modules/arraybuffer.prototype.slice/test/shimmed.js new file mode 100644 index 000000000..8dd4f7214 --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/test/shimmed.js @@ -0,0 +1,54 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); +var hasStrictMode = require('has-strict-mode')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.test('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) { + var method = ArrayBuffer.prototype.slice; + + st.equal(method.length, 2, 'ArrayBuffer#slice has a length of 2'); + + st.test('Function name', { skip: !functionsHaveNames }, function (s2t) { + s2t.equal(method.name, 'slice', 'ArrayBuffer#slice name "slice"'); + s2t.end(); + }); + + st.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(ArrayBuffer.prototype, 'slice'), 'ArrayBuffer#slice is not enumerable'); + et.end(); + }); + + st.test('bad array/this value', { skip: !hasStrictMode }, function (s2t) { + /* eslint no-useless-call: 0 */ + s2t['throws'](function () { return method.call(undefined); }, TypeError, 'undefined is not an object'); + s2t['throws'](function () { return method.call(null); }, TypeError, 'null is not an object'); + s2t.end(); + }); + + t.test('has the correct descriptor', { skip: !Object.getOwnPropertyDescriptor }, function (s2t) { + var descriptor = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'slice'); + + s2t.equal(descriptor.configurable, true); + s2t.equal(descriptor.enumerable, false); + s2t.equal(typeof descriptor.value, 'function'); + s2t.equal(descriptor.writable, true); + s2t.end(); + }); + + runTests(callBind(method), st); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/arraybuffer.prototype.slice/test/tests.js b/node_modules/arraybuffer.prototype.slice/test/tests.js new file mode 100644 index 000000000..4128b1b9f --- /dev/null +++ b/node_modules/arraybuffer.prototype.slice/test/tests.js @@ -0,0 +1,81 @@ +'use strict'; + +var inspect = require('object-inspect'); +var IsDetachedBuffer = require('es-abstract/2024/IsDetachedBuffer'); + +var forEach = require('for-each'); +var v = require('es-value-fixtures'); + +var byteLength = require('array-buffer-byte-length'); + +module.exports = function runTests(slice, t) { + forEach(v.primitives.concat(v.objects), function (nonAB) { + t['throws']( + function () { slice(nonAB); }, + TypeError, + inspect(nonAB) + ' is not an ArrayBuffer' + ); + }); + + t.test('ArrayBuffers', { skip: typeof ArrayBuffer === 'undefined' }, function (st) { + var ab = new ArrayBuffer(0); + + st.equal(IsDetachedBuffer(ab), false, 'ArrayBuffer is not detached'); + + try { + var nb = slice(ab); + } catch (e) { + if (e instanceof SyntaxError) { + st.skip('Detaching ArrayBuffer is not supported'); + return st.end(); + } + console.log(e.stack); + } + + st.notEqual(nb, ab, 'new ArrayBuffer is not the same as the original'); + st.equal(IsDetachedBuffer(ab), false, 'old ArrayBuffer is not detached'); + st.equal(IsDetachedBuffer(nb), false, 'new ArrayBuffer is not detached'); + + var ab2 = new ArrayBuffer(8); + st.equal(byteLength(ab2), 8, 'original ArrayBuffer has length 8'); + try { + var nbLen = slice(ab2, 4); + } catch (e) { + if (e instanceof SyntaxError) { + st.skip('Detaching ArrayBuffer is not supported'); + return st.end(); + } + } + st.equal(IsDetachedBuffer(ab2), false, 'old ArrayBuffer is not detached'); + st.equal(IsDetachedBuffer(nbLen), false, 'new ArrayBuffer is not detached'); + + st.equal(byteLength(ab2), 8, 'original ArrayBuffer has length 8'); + st.equal(byteLength(nbLen), 4, 'newly sliced ArrayBuffer has length 4'); + + var one = new ArrayBuffer(1); + var arr = new Uint8Array(one); + arr[0] = 123; + + var two = slice(one); + + var arr2 = new Uint8Array(two); + arr2[0] = 234; + + st.deepEqual(arr, new Uint8Array([123]), 'original buffer is unchanged'); + st.deepEqual(arr2, new Uint8Array([234]), 'sliced buffer is changed'); + + return st.end(); + }); + + t.test('SharedArrayBuffers', { skip: typeof SharedArrayBuffer === 'undefined' }, function (st) { + var sab = new SharedArrayBuffer(0); + + st['throws']( + function () { slice(sab); }, + TypeError, + inspect(sab) + ' is not an ArrayBuffer' + ); + + st.end(); + }); +}; diff --git a/node_modules/assign-symbols/LICENSE b/node_modules/assign-symbols/LICENSE new file mode 100644 index 000000000..65f90aca8 --- /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 000000000..422729d45 --- /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 000000000..c08a232b7 --- /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 000000000..7f77b58d1 --- /dev/null +++ b/node_modules/assign-symbols/package.json @@ -0,0 +1,40 @@ +{ + "name": "assign-symbols", + "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.", + "version": "1.0.0", + "homepage": "https://github.com/jonschlinkert/assign-symbols", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/assign-symbols", + "bugs": { + "url": "https://github.com/jonschlinkert/assign-symbols/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "mocha": "^3.0.0" + }, + "keywords": [ + "assign", + "symbols" + ], + "verb": { + "related": { + "list": [ + "assign-deep", + "mixin-deep", + "merge-deep", + "extend-shallow", + "clone-deep" + ] + } + } +} diff --git a/node_modules/async-function/.eslintrc b/node_modules/async-function/.eslintrc new file mode 100644 index 000000000..2e3c83be9 --- /dev/null +++ b/node_modules/async-function/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "overrides": [ + { + "files": "./index.js", + "extends": "@ljharb/eslint-config/node/8" + }, + { + "files": "./require.mjs", + "extends": "@ljharb/eslint-config/node/16", + }, + ], +} diff --git a/node_modules/async-function/.github/FUNDING.yml b/node_modules/async-function/.github/FUNDING.yml new file mode 100644 index 000000000..dfc72fe06 --- /dev/null +++ b/node_modules/async-function/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/async-function +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/async-function/.nycrc b/node_modules/async-function/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/async-function/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/async-function/CHANGELOG.md b/node_modules/async-function/CHANGELOG.md new file mode 100644 index 000000000..b656257f9 --- /dev/null +++ b/node_modules/async-function/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2025-01-22 + +### Commits + +- Initial implementation, tests, readme, types [`8ad64e4`](https://github.com/ljharb/async-function/commit/8ad64e45668359cf032e095afcbe6ef0d291d6b4) +- Initial commit [`36dac0d`](https://github.com/ljharb/async-function/commit/36dac0de439b8b6d7af6a246cf984b087efaaf87) +- [meta] reformat `package.json` [`11ff004`](https://github.com/ljharb/async-function/commit/11ff0044813122c6d22e3bf360af979f7c3f7fc8) +- first publish [`5ed020c`](https://github.com/ljharb/async-function/commit/5ed020c7852e90f280517a06e4a4d3cb1d295e40) +- Only apps should have lockfiles [`b746134`](https://github.com/ljharb/async-function/commit/b74613407f749720b7d02b26b9fb2093a0124878) diff --git a/node_modules/async-function/LICENSE b/node_modules/async-function/LICENSE new file mode 100644 index 000000000..a88aff075 --- /dev/null +++ b/node_modules/async-function/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 EduardoRFS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-function/README.md b/node_modules/async-function/README.md new file mode 100644 index 000000000..8de7a0cf8 --- /dev/null +++ b/node_modules/async-function/README.md @@ -0,0 +1,51 @@ +# async-function [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A function that returns the normally hidden `AsyncFunction` constructor, when available. + +## Getting started + +```sh +npm install --save async-function +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const AsyncFunction = require('async-function')(); + +const fn = new AsyncFunction('return 1'); + +assert.equal(fn.toString(), 'async function anonymous(\n) {\nreturn 1\n}'); + +fn().then(x => { + assert.equal(x, 1); +}); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/async-function +[npm-version-svg]: https://versionbadg.es/ljharb/async-function.svg +[deps-svg]: https://david-dm.org/ljharb/async-function.svg +[deps-url]: https://david-dm.org/ljharb/async-function +[dev-deps-svg]: https://david-dm.org/ljharb/async-function/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/async-function#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/async-function.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/async-function.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/async-function.svg +[downloads-url]: https://npm-stat.com/charts.html?package=async-function +[codecov-image]: https://codecov.io/gh/ljharb/async-function/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/async-function/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/async-function +[actions-url]: https://github.com/ljharb/async-function/actions diff --git a/node_modules/async-function/index.d.mts b/node_modules/async-function/index.d.mts new file mode 100644 index 000000000..fba3c9486 --- /dev/null +++ b/node_modules/async-function/index.d.mts @@ -0,0 +1,3 @@ +import getAsyncFunction = require('.'); + +export default getAsyncFunction; \ No newline at end of file diff --git a/node_modules/async-function/index.d.ts b/node_modules/async-function/index.d.ts new file mode 100644 index 000000000..36a2c0d4b --- /dev/null +++ b/node_modules/async-function/index.d.ts @@ -0,0 +1,13 @@ +declare namespace getAsyncFunction { + type AsyncFunction = (...args: any[]) => Promise; + + interface AsyncFunctionConstructor extends FunctionConstructor { + new (...args: string[]): AsyncFunction; + (...args: string[]): AsyncFunction; + readonly prototype: AsyncFunction; + } +} + +declare function getAsyncFunction(): getAsyncFunction.AsyncFunctionConstructor | false; + +export = getAsyncFunction; \ No newline at end of file diff --git a/node_modules/async-function/index.js b/node_modules/async-function/index.js new file mode 100644 index 000000000..e784f647e --- /dev/null +++ b/node_modules/async-function/index.js @@ -0,0 +1,8 @@ +'use strict'; + +// eslint-disable-next-line no-extra-parens, no-empty-function +const cached = /** @type {import('.').AsyncFunctionConstructor} */ (async function () {}.constructor); + +/** @type {import('.')} */ +module.exports = () => cached; + diff --git a/node_modules/async-function/index.mjs b/node_modules/async-function/index.mjs new file mode 100644 index 000000000..fdec9169a --- /dev/null +++ b/node_modules/async-function/index.mjs @@ -0,0 +1,4 @@ +import getAsyncFunction from './index.js'; + +/** @type {import('./index.d.mts').default} */ +export default getAsyncFunction; diff --git a/node_modules/async-function/legacy.js b/node_modules/async-function/legacy.js new file mode 100644 index 000000000..9efd971ab --- /dev/null +++ b/node_modules/async-function/legacy.js @@ -0,0 +1,18 @@ +'use strict'; + +/** @type {import('.').AsyncFunctionConstructor | false} */ +var cached; + +/** @type {import('.')} */ +module.exports = function getAsyncFunction() { + if (typeof cached === 'undefined') { + try { + // eslint-disable-next-line no-new-func + cached = Function('return async function () {}')().constructor; + } catch (e) { + cached = false; + } + } + return cached; +}; + diff --git a/node_modules/async-function/package.json b/node_modules/async-function/package.json new file mode 100644 index 000000000..807170cec --- /dev/null +++ b/node_modules/async-function/package.json @@ -0,0 +1,86 @@ +{ + "name": "async-function", + "version": "1.0.0", + "description": "A function that returns the normally hidden `AsyncFunction` constructor", + "main": "./legacy.js", + "jsnext:main": "./index.mjs", + "module": "./index.mjs", + "exports": { + ".": [ + { + "module-sync": "./require.mjs", + "import": "./index.mjs", + "default": "./index.js" + }, + "./index.js" + ], + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "posttest": "npx npm@\">=10.2\" audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/async-function.git" + }, + "keywords": [ + "async", + "await", + "function", + "native" + ], + "author": "Jordan Harbamd ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/async-function/issues" + }, + "homepage": "https://github.com/ljharb/async-function#readme", + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.3", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.3", + "@types/semver": "^6.2.7", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "get-proto": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.1", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "testling": { + "files": "test/index.js" + } +} diff --git a/node_modules/async-function/require.mjs b/node_modules/async-function/require.mjs new file mode 100644 index 000000000..59e79a436 --- /dev/null +++ b/node_modules/async-function/require.mjs @@ -0,0 +1,5 @@ +import getAsyncFunction from './index.js'; + +export default getAsyncFunction; + +export { getAsyncFunction as 'module.exports' }; diff --git a/node_modules/async-function/test/index.js b/node_modules/async-function/test/index.js new file mode 100644 index 000000000..fc98706db --- /dev/null +++ b/node_modules/async-function/test/index.js @@ -0,0 +1,40 @@ +'use strict'; + +var test = require('tape'); +var getProto = require('get-proto'); +var semver = require('semver'); + +var getAsyncFunction = require('../'); + +test('getAsyncFunction', function (t) { + var result = getAsyncFunction(); + + /* eslint-env browser */ + if (typeof window === 'undefined' && typeof process !== 'undefined') { + t.equal( + !!result, + semver.satisfies(process.version, '>= 7.6'), + 'result is present or absent as expected for node ' + process.version + ); + } + + t.test('exists', { skip: !result }, function (st) { + if (result && getProto) { // TS can't infer `skip`, or that getProto definitely exists if AsyncFunction exists + st.equal(typeof result, 'function', 'is a function'); + st.equal(getProto(result), Function, 'extends Function'); + + return result('a', 'return a')(42).then(function (a) { + st.equal(a, 42, 'returns an async function'); + }); + } + return st.fail('should never get here'); + }); + + t.test('does not exist', { skip: !!result }, function (st) { + st.equal(result, false, 'is false'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/async-function/tsconfig.json b/node_modules/async-function/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/async-function/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/available-typed-arrays/.eslintrc b/node_modules/available-typed-arrays/.eslintrc new file mode 100644 index 000000000..3b5d9e90e --- /dev/null +++ b/node_modules/available-typed-arrays/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/available-typed-arrays/.github/FUNDING.yml b/node_modules/available-typed-arrays/.github/FUNDING.yml new file mode 100644 index 000000000..14abc7253 --- /dev/null +++ b/node_modules/available-typed-arrays/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/available-typed-arrays +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/available-typed-arrays/.nycrc b/node_modules/available-typed-arrays/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/available-typed-arrays/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/available-typed-arrays/CHANGELOG.md b/node_modules/available-typed-arrays/CHANGELOG.md new file mode 100644 index 000000000..f5ade9a28 --- /dev/null +++ b/node_modules/available-typed-arrays/CHANGELOG.md @@ -0,0 +1,100 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.7](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.6...v1.0.7) - 2024-02-19 + +### Commits + +- [Refactor] use `possible-typed-array-names` [`ac86abf`](https://github.com/inspect-js/available-typed-arrays/commit/ac86abfd64c4b633fd6523cc4193f1913fd22666) + +## [v1.0.6](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.5...v1.0.6) - 2024-01-31 + +### Commits + +- [actions] reuse common workflows [`1850353`](https://github.com/inspect-js/available-typed-arrays/commit/1850353ded0ceb4d02d9d05649da5b7f3a28c89f) +- [meta] use `npmignore` to autogenerate an npmignore file [`5c7de12`](https://github.com/inspect-js/available-typed-arrays/commit/5c7de120d22a5c35f703ba3f0b5287e5c5f38af6) +- [patch] add types [`fcfb0ea`](https://github.com/inspect-js/available-typed-arrays/commit/fcfb0ea21c9dc8459d68f8bb26679abb0bec71ca) +- [actions] update codecov uploader [`d844945`](https://github.com/inspect-js/available-typed-arrays/commit/d84494596881a298aabde9bd87e538ce10c6cd01) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `array.prototype.every`, `safe-publish-latest`, `tape` [`a2be6f4`](https://github.com/inspect-js/available-typed-arrays/commit/a2be6f482010e920692d8f65fe1f193dbb73004d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`b283a3e`](https://github.com/inspect-js/available-typed-arrays/commit/b283a3e2176fbe8e431a27e20df21c831f216d5a) +- [actions] update rebase action to use reusable workflow [`0ad1f2d`](https://github.com/inspect-js/available-typed-arrays/commit/0ad1f2d82b11713ee48d9b37cb73fcc891bd9f4a) +- [Dev Deps] update `@ljharb/eslint-config`, `array.prototype.every`, `aud`, `tape` [`cd36e81`](https://github.com/inspect-js/available-typed-arrays/commit/cd36e8131076dd4e67a88b259f829067fa56c139) +- [meta] simplify "exports" [`f696e5f`](https://github.com/inspect-js/available-typed-arrays/commit/f696e5ff9ded838e192ade4e8550a890c4f35eb0) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`bf20080`](https://github.com/inspect-js/available-typed-arrays/commit/bf200809aea3107b31fc8817122c693e099be30e) + +## [v1.0.5](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.4...v1.0.5) - 2021-08-30 + +### Fixed + +- [Refactor] use `globalThis` if available [`#12`](https://github.com/inspect-js/available-typed-arrays/issues/12) + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`1199790`](https://github.com/inspect-js/available-typed-arrays/commit/1199790ab5841517ad04827fab3f135d2dc5cfb7) + +## [v1.0.4](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.3...v1.0.4) - 2021-05-25 + +### Commits + +- [Refactor] Remove `array.prototype.filter` dependency [`f39c90e`](https://github.com/inspect-js/available-typed-arrays/commit/f39c90ecb1907de28ee2d3577b7da37ae12aac56) +- [Dev Deps] update `eslint`, `auto-changelog` [`b2e3a03`](https://github.com/inspect-js/available-typed-arrays/commit/b2e3a035e8cd3ddfd7b565249e1651c6419a34d0) +- [meta] create `FUNDING.yml` [`8c0e758`](https://github.com/inspect-js/available-typed-arrays/commit/8c0e758c6ec80adbb3770554653cdc3aa16beb55) +- [Tests] fix harmony test matrix [`ef96549`](https://github.com/inspect-js/available-typed-arrays/commit/ef96549df171776267529413240a2219cb59d5ce) +- [meta] add `sideEffects` flag [`288cca0`](https://github.com/inspect-js/available-typed-arrays/commit/288cca0fbd214bec706447851bb8bccc4b899a48) + +## [v1.0.3](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.2...v1.0.3) - 2021-05-19 + +### Commits + +- [Tests] migrate tests to Github Actions [`3ef082c`](https://github.com/inspect-js/available-typed-arrays/commit/3ef082caaa153b49f4c37c85bbd5c4b13fe4f638) +- [meta] do not publish github action workflow files [`fd95ffd`](https://github.com/inspect-js/available-typed-arrays/commit/fd95ffdaca759eca81cb4c5d5772ee863dfea501) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`eb6bd65`](https://github.com/inspect-js/available-typed-arrays/commit/eb6bd659a31c92a6a178c71a89fe0d5261413e6c) +- [Tests] run `nyc` on all tests [`636c946`](https://github.com/inspect-js/available-typed-arrays/commit/636c94657b532599ef90a214aaa12639d11b0161) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`70a3b61`](https://github.com/inspect-js/available-typed-arrays/commit/70a3b61367b318fb883c2f35b8f2d539849a23b6) +- [actions] add "Allow Edits" workflow [`bd09c45`](https://github.com/inspect-js/available-typed-arrays/commit/bd09c45299e396fa5bbd5be4c58b1aedcb372a82) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `array.prototype.every`, `aud`, `tape` [`8f97523`](https://github.com/inspect-js/available-typed-arrays/commit/8f9752308390a79068cd431436bbfd77bca15647) +- [readme] fix URLs [`75418e2`](https://github.com/inspect-js/available-typed-arrays/commit/75418e20b57f4ad5e65d8c2e1864efd14eaa2e65) +- [readme] add actions and codecov badges [`4a8bc30`](https://github.com/inspect-js/available-typed-arrays/commit/4a8bc30af2ce1f48e2b28ab3db5be9589bd6f2d0) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`65198ac`](https://github.com/inspect-js/available-typed-arrays/commit/65198ace335a013ef49b6bd722bc80bbbc6be784) +- [actions] update workflows [`7f816eb`](https://github.com/inspect-js/available-typed-arrays/commit/7f816eb231131e53ced2572ba6c6c6a00f975789) +- [Refactor] use `array.prototype.filter` instead of `array-filter` [`2dd1038`](https://github.com/inspect-js/available-typed-arrays/commit/2dd1038d71ce48b5650687691cf8fe09795a6d30) +- [actions] switch Automatic Rease workflow to `pull_request_target` event [`9b45e91`](https://github.com/inspect-js/available-typed-arrays/commit/9b45e914fcb08bdaaaa0166b41716e51f400d1c6) +- [Dev Deps] update `auto-changelog`, `tape` [`0003a5b`](https://github.com/inspect-js/available-typed-arrays/commit/0003a5b122a0724db5499c114104eeeb396b2f67) +- [meta] use `prepublishOnly` script for npm 7+ [`d884dd1`](https://github.com/inspect-js/available-typed-arrays/commit/d884dd1c1117411f35d9fbc07f513a1a85ccdead) +- [readme] remove travis badge [`9da2b3c`](https://github.com/inspect-js/available-typed-arrays/commit/9da2b3c29706340fada995137aba12cfae4d6f37) +- [Dev Deps] update `auto-changelog`; add `aud` [`41b1336`](https://github.com/inspect-js/available-typed-arrays/commit/41b13369c71b0e3e57b9de0f4fb1e4d67950d74a) +- [Tests] only audit prod deps [`2571826`](https://github.com/inspect-js/available-typed-arrays/commit/2571826a5d121eeeeccf4c711e3f9e4616685d50) + +## [v1.0.2](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.1...v1.0.2) - 2020-01-26 + +### Commits + +- [actions] add automatic rebasing / merge commit blocking [`3229a74`](https://github.com/inspect-js/available-typed-arrays/commit/3229a74bda60f24e2257efc40ddff9a3ce98de76) +- [Dev Deps] update `@ljharb/eslint-config` [`9579abe`](https://github.com/inspect-js/available-typed-arrays/commit/9579abecc196088561d3aedf27cad45b56f8e18b) +- [Fix] remove `require` condition to avoid experimental warning [`2cade6b`](https://github.com/inspect-js/available-typed-arrays/commit/2cade6b56d6a508a950c7da27d038bee496e716b) + +## [v1.0.1](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.0...v1.0.1) - 2020-01-24 + +### Commits + +- [meta] add "exports" [`5942917`](https://github.com/inspect-js/available-typed-arrays/commit/5942917aafb56c6bce80f01b7ae6a9b46bc72c69) + +## v1.0.0 - 2020-01-24 + +### Commits + +- Initial commit [`2bc5144`](https://github.com/inspect-js/available-typed-arrays/commit/2bc514459c9f65756adfbd9964abf433183d78f6) +- readme [`31e4796`](https://github.com/inspect-js/available-typed-arrays/commit/31e4796379eba4a16d3c6a8e9baf6eb3f39e33d1) +- npm init [`9194266`](https://github.com/inspect-js/available-typed-arrays/commit/9194266b471a2a2dd5e6969bc40358ceb346e21e) +- Tests [`b539830`](https://github.com/inspect-js/available-typed-arrays/commit/b539830c3213f90de42b4d6e62803f52daf61a6d) +- Implementation [`6577df2`](https://github.com/inspect-js/available-typed-arrays/commit/6577df244ea146ef5ec16858044c8955e0fc445c) +- [meta] add `auto-changelog` [`7b43310`](https://github.com/inspect-js/available-typed-arrays/commit/7b43310be76f00fe60b74a2fd6d0e46ac1d01f3e) +- [Tests] add `npm run lint` [`dedfbc1`](https://github.com/inspect-js/available-typed-arrays/commit/dedfbc1592f86ac1636267d3965f2345df43815b) +- [Tests] use shared travis-ci configs [`c459d78`](https://github.com/inspect-js/available-typed-arrays/commit/c459d78bf2efa9d777f88599ae71a796dbfcb70f) +- Only apps should have lockfiles [`d294668`](https://github.com/inspect-js/available-typed-arrays/commit/d294668422cf35f5e7716a85bfd204e62b01c056) +- [meta] add `funding` field [`6e70bc1`](https://github.com/inspect-js/available-typed-arrays/commit/6e70bc1fb199c7898165aaf05c25bb49f4062e53) +- [meta] add `safe-publish-latest` [`dd89ca2`](https://github.com/inspect-js/available-typed-arrays/commit/dd89ca2c6842f0f3e82958df2b2bd0fc0c929c51) diff --git a/node_modules/available-typed-arrays/LICENSE b/node_modules/available-typed-arrays/LICENSE new file mode 100644 index 000000000..707437b57 --- /dev/null +++ b/node_modules/available-typed-arrays/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/available-typed-arrays/README.md b/node_modules/available-typed-arrays/README.md new file mode 100644 index 000000000..df6f5864a --- /dev/null +++ b/node_modules/available-typed-arrays/README.md @@ -0,0 +1,55 @@ +# available-typed-arrays [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Returns an array of Typed Array names that are available in the current environment. + +## Example + +```js +var availableTypedArrays = require('available-typed-arrays'); +var assert = require('assert'); + +assert.deepStrictEqual( + availableTypedArrays().sort(), + [ + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array', + 'BigInt64Array', + 'BigUint64Array' + ].sort() +); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/available-typed-arrays +[2]: https://versionbadg.es/inspect-js/available-typed-arrays.svg +[5]: https://david-dm.org/inspect-js/available-typed-arrays.svg +[6]: https://david-dm.org/inspect-js/available-typed-arrays +[7]: https://david-dm.org/inspect-js/available-typed-arrays/dev-status.svg +[8]: https://david-dm.org/inspect-js/available-typed-arrays#info=devDependencies +[11]: https://nodei.co/npm/available-typed-arrays.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/available-typed-arrays.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/available-typed-arrays.svg +[downloads-url]: https://npm-stat.com/charts.html?package=available-typed-arrays +[codecov-image]: https://codecov.io/gh/inspect-js/available-typed-arrays/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/available-typed-arrays/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/available-typed-arrays +[actions-url]: https://github.com/inspect-js/available-typed-arrays/actions diff --git a/node_modules/available-typed-arrays/index.d.ts b/node_modules/available-typed-arrays/index.d.ts new file mode 100644 index 000000000..c21e1c495 --- /dev/null +++ b/node_modules/available-typed-arrays/index.d.ts @@ -0,0 +1,8 @@ +type AllPossibleTypedArrays = typeof import('possible-typed-array-names'); + +declare function availableTypedArrays(): + | [] + | AllPossibleTypedArrays + | Omit; + +export = availableTypedArrays; diff --git a/node_modules/available-typed-arrays/index.js b/node_modules/available-typed-arrays/index.js new file mode 100644 index 000000000..125f000cc --- /dev/null +++ b/node_modules/available-typed-arrays/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var possibleNames = require('possible-typed-array-names'); + +var g = typeof globalThis === 'undefined' ? global : globalThis; + +/** @type {import('.')} */ +module.exports = function availableTypedArrays() { + var /** @type {ReturnType} */ out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + // @ts-expect-error + out[out.length] = possibleNames[i]; + } + } + return out; +}; diff --git a/node_modules/available-typed-arrays/package.json b/node_modules/available-typed-arrays/package.json new file mode 100644 index 000000000..9b4e245e2 --- /dev/null +++ b/node_modules/available-typed-arrays/package.json @@ -0,0 +1,93 @@ +{ + "name": "available-typed-arrays", + "version": "1.0.7", + "description": "Returns an array of Typed Array names that are available in the current environment", + "main": "index.js", + "type": "commonjs", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test:harmony": "nyc node --harmony --es-staging test", + "test": "npm run tests-only && npm run test:harmony", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/available-typed-arrays.git" + }, + "keywords": [ + "typed", + "arrays", + "Float32Array", + "Float64Array", + "Int8Array", + "Int16Array", + "Int32Array", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "BigInt64Array", + "BigUint64Array" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/available-typed-arrays/issues" + }, + "homepage": "https://github.com/inspect-js/available-typed-arrays#readme", + "engines": { + "node": ">= 0.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/array.prototype.every": "^1.1.1", + "@types/isarray": "^2.0.2", + "@types/tape": "^5.6.4", + "array.prototype.every": "^1.1.5", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "isarray": "^2.0.5", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "^5.4.0-dev.20240131" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + } +} diff --git a/node_modules/available-typed-arrays/test/index.js b/node_modules/available-typed-arrays/test/index.js new file mode 100644 index 000000000..21c986dc8 --- /dev/null +++ b/node_modules/available-typed-arrays/test/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var test = require('tape'); +var isArray = require('isarray'); +var every = require('array.prototype.every'); + +var availableTypedArrays = require('../'); + +test('available typed arrays', function (t) { + t.equal(typeof availableTypedArrays, 'function', 'is a function'); + + var arrays = availableTypedArrays(); + t.equal(isArray(arrays), true, 'returns an array'); + + t.equal(every(arrays, function (array) { return typeof array === 'string'; }), true, 'contains only strings'); + + t.end(); +}); diff --git a/node_modules/available-typed-arrays/tsconfig.json b/node_modules/available-typed-arrays/tsconfig.json new file mode 100644 index 000000000..fdab34fe3 --- /dev/null +++ b/node_modules/available-typed-arrays/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + //"skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/bail/index.js b/node_modules/bail/index.js new file mode 100644 index 000000000..ef5e8807a --- /dev/null +++ b/node_modules/bail/index.js @@ -0,0 +1,9 @@ +'use strict' + +module.exports = bail + +function bail(err) { + if (err) { + throw err + } +} diff --git a/node_modules/bail/license b/node_modules/bail/license new file mode 100644 index 000000000..32e7a3d93 --- /dev/null +++ b/node_modules/bail/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/bail/package.json b/node_modules/bail/package.json new file mode 100644 index 000000000..8f8539d32 --- /dev/null +++ b/node_modules/bail/package.json @@ -0,0 +1,72 @@ +{ + "name": "bail", + "version": "1.0.5", + "description": "Throw a given error", + "license": "MIT", + "keywords": [ + "fail", + "bail", + "throw", + "callback", + "error" + ], + "repository": "wooorm/bail", + "bugs": "https://github.com/wooorm/bail/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": {}, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify index.js -s bail -o bail.js", + "build-mangle": "browserify index.js -s bail -p tinyify -o bail.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "bail.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + } +} diff --git a/node_modules/bail/readme.md b/node_modules/bail/readme.md new file mode 100644 index 000000000..8e7b0863c --- /dev/null +++ b/node_modules/bail/readme.md @@ -0,0 +1,84 @@ +# bail + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +:warning: Throw a given error. + +## Install + +[npm][]: + +```sh +npm install bail +``` + +## Use + +```js +var bail = require('bail') + +bail() + +bail(new Error('failure')) +// Error: failure +// at repl:1:6 +// at REPLServer.defaultEval (repl.js:154:27) +// … +``` + +## API + +### `bail([err])` + +Throw a given error. + +###### Parameters + +* `err` (`Error?`) — Optional error. + +###### Throws + +* `Error` — Given error, if any. + +## Related + +* [`noop`][noop] +* [`noop2`][noop2] +* [`noop3`][noop3] + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/bail.svg + +[build]: https://travis-ci.org/wooorm/bail + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/bail.svg + +[coverage]: https://codecov.io/github/wooorm/bail + +[downloads-badge]: https://img.shields.io/npm/dm/bail.svg + +[downloads]: https://www.npmjs.com/package/bail + +[size-badge]: https://img.shields.io/bundlephobia/minzip/bail.svg + +[size]: https://bundlephobia.com/result?p=bail + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[noop]: https://www.npmjs.com/package/noop + +[noop2]: https://www.npmjs.com/package/noop2 + +[noop3]: https://www.npmjs.com/package/noop3 diff --git a/node_modules/balanced-match/.github/FUNDING.yml b/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 000000000..cea8b16e9 --- /dev/null +++ b/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md new file mode 100644 index 000000000..2cdc8e414 --- /dev/null +++ b/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md new file mode 100644 index 000000000..d2a48b6b4 --- /dev/null +++ b/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/balanced-match/index.js b/node_modules/balanced-match/index.js new file mode 100644 index 000000000..c67a64608 --- /dev/null +++ b/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json new file mode 100644 index 000000000..ce6073e04 --- /dev/null +++ b/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/node_modules/boundary/README.md b/node_modules/boundary/README.md new file mode 100644 index 000000000..e2d48af97 --- /dev/null +++ b/node_modules/boundary/README.md @@ -0,0 +1,74 @@ +boundary +============== + + +## About + +Provides binary search functions. + +## Installation + +```sh +npm install boundary +``` + +## Usage + +```js +function lessThan(v1, v2) { + return v1 < v2; +} + +// boundary.upperBound(sortedArray, value, compare = lessThan); +assert(upperBound([ 0, 0, 2, 3, 4 ], -1) === 0); +assert(upperBound([ 0, 0, 2, 3, 4 ], 0) === 2); +assert(upperBound([ 0, 0, 2, 3, 4 ], 1) === 2); +assert(upperBound([ 0, 0, 2, 3, 4 ], 2) === 3); +assert(upperBound([ 0, 0, 2, 3, 4 ], 3) === 4); +assert(upperBound([ 0, 0, 2, 3, 4 ], 4) === 5); +assert(upperBound([ 0, 0, 2, 3, 4 ], 5) === 5); + +// boundary.lowerBound(sortedArray, value, compare = lessThan); +assert(lowerBound([ 0, 0, 2, 3, 4 ], -1) === 0); +assert(lowerBound([ 0, 0, 2, 3, 4 ], 0) === 0); +assert(lowerBound([ 0, 0, 2, 3, 4 ], 1) === 2); +assert(lowerBound([ 0, 0, 2, 3, 4 ], 2) === 2); +assert(lowerBound([ 0, 0, 2, 3, 4 ], 3) === 3); +assert(lowerBound([ 0, 0, 2, 3, 4 ], 4) === 4); +assert(lowerBound([ 0, 0, 2, 3, 4 ], 5) === 5); + +// boundary.binarySearch(sortedArray, value, compare = lessThan); +assert(binarySearch([ 0, 0, 2, 3, 4 ], -1) === false); +assert(binarySearch([ 0, 0, 2, 3, 4 ], 0) === true); +assert(binarySearch([ 0, 0, 2, 3, 4 ], 1) === false); +assert(binarySearch([ 0, 0, 2, 3, 4 ], 2) === true); +assert(binarySearch([ 0, 0, 2, 3, 4 ], 3) === true); +assert(binarySearch([ 0, 0, 2, 3, 4 ], 4) === true); +assert(binarySearch([ 0, 0, 2, 3, 4 ], 5) === false); +``` + +### License + +Copyright (C) 2012-2014 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 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 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/boundary/package.json b/node_modules/boundary/package.json new file mode 100644 index 000000000..3734d7d55 --- /dev/null +++ b/node_modules/boundary/package.json @@ -0,0 +1,50 @@ +{ + "name": "boundary", + "version": "1.0.1", + "description": "Provides boundary functions, (upper-bound and lower-bound).", + "author": "Yusuke SUZUKI", + "homepage": "https://github.com/Constellation/boundary", + "repository": { + "type": "git", + "url": "https://github.com/Constellation/boundary.git" + }, + "main": "lib/index.js", + "maintainers": [ + { + "name": "Yusuke SUZUKI", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "files": [ + "lib" + ], + "scripts": { + "test": "gulp test" + }, + "dependencies": {}, + "devDependencies": { + "gulp": "^3.8.10", + "gulp-6to5": "^1.0.2", + "gulp-bump": "^0.1.11", + "gulp-espower": "^0.10.0", + "gulp-filter": "^2.0.0", + "gulp-git": "^0.5.5", + "gulp-mocha": "^2.0.0", + "gulp-sourcemaps": "^1.2.8", + "gulp-tag-version": "^1.2.1", + "power-assert": "^0.10.0" + }, + "keywords": [ + "algorithm" + ], + "bugs": { + "url": "https://github.com/Constellation/boundary/issues" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/Constellation/boundary/raw/master/LICENSE.BSD" + } + ] +} diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE new file mode 100644 index 000000000..de3226673 --- /dev/null +++ b/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md new file mode 100644 index 000000000..6b4e0e164 --- /dev/null +++ b/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js new file mode 100644 index 000000000..e8476477d --- /dev/null +++ b/node_modules/brace-expansion/index.js @@ -0,0 +1,200 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,(?!,).*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.max(Math.abs(numeric(n[2])), 1) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json new file mode 100644 index 000000000..b791a0500 --- /dev/null +++ b/node_modules/brace-expansion/package.json @@ -0,0 +1,50 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.13", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh", + "bench": "matcha test/perf/bench.js" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "publishConfig": { + "tag": "1.x" + } +} diff --git a/node_modules/buffer-from/LICENSE b/node_modules/buffer-from/LICENSE new file mode 100644 index 000000000..e4bf1d69b --- /dev/null +++ b/node_modules/buffer-from/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016, 2018 Linus Unnebäck + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/buffer-from/index.js b/node_modules/buffer-from/index.js new file mode 100644 index 000000000..e1a58b5e8 --- /dev/null +++ b/node_modules/buffer-from/index.js @@ -0,0 +1,72 @@ +/* eslint-disable node/no-deprecated-api */ + +var toString = Object.prototype.toString + +var isModern = ( + typeof Buffer !== 'undefined' && + typeof Buffer.alloc === 'function' && + typeof Buffer.allocUnsafe === 'function' && + typeof Buffer.from === 'function' +) + +function isArrayBuffer (input) { + return toString.call(input).slice(8, -1) === 'ArrayBuffer' +} + +function fromArrayBuffer (obj, byteOffset, length) { + byteOffset >>>= 0 + + var maxLength = obj.byteLength - byteOffset + + if (maxLength < 0) { + throw new RangeError("'offset' is out of bounds") + } + + if (length === undefined) { + length = maxLength + } else { + length >>>= 0 + + if (length > maxLength) { + throw new RangeError("'length' is out of bounds") + } + } + + return isModern + ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) + : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + return isModern + ? Buffer.from(string, encoding) + : new Buffer(string, encoding) +} + +function bufferFrom (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (isArrayBuffer(value)) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + return isModern + ? Buffer.from(value) + : new Buffer(value) +} + +module.exports = bufferFrom diff --git a/node_modules/buffer-from/package.json b/node_modules/buffer-from/package.json new file mode 100644 index 000000000..6ac5327bf --- /dev/null +++ b/node_modules/buffer-from/package.json @@ -0,0 +1,19 @@ +{ + "name": "buffer-from", + "version": "1.1.2", + "license": "MIT", + "repository": "LinusU/buffer-from", + "files": [ + "index.js" + ], + "scripts": { + "test": "standard && node test" + }, + "devDependencies": { + "standard": "^12.0.1" + }, + "keywords": [ + "buffer", + "buffer from" + ] +} diff --git a/node_modules/buffer-from/readme.md b/node_modules/buffer-from/readme.md new file mode 100644 index 000000000..9880a558a --- /dev/null +++ b/node_modules/buffer-from/readme.md @@ -0,0 +1,69 @@ +# Buffer From + +A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available. + +## Installation + +```sh +npm install --save buffer-from +``` + +## Usage + +```js +const bufferFrom = require('buffer-from') + +console.log(bufferFrom([1, 2, 3, 4])) +//=> + +const arr = new Uint8Array([1, 2, 3, 4]) +console.log(bufferFrom(arr.buffer, 1, 2)) +//=> + +console.log(bufferFrom('test', 'utf8')) +//=> + +const buf = bufferFrom('test') +console.log(bufferFrom(buf)) +//=> +``` + +## API + +### bufferFrom(array) + +- `array` <Array> + +Allocates a new `Buffer` using an `array` of octets. + +### bufferFrom(arrayBuffer[, byteOffset[, length]]) + +- `arrayBuffer` <ArrayBuffer> The `.buffer` property of a TypedArray or ArrayBuffer +- `byteOffset` <Integer> Where to start copying from `arrayBuffer`. **Default:** `0` +- `length` <Integer> How many bytes to copy from `arrayBuffer`. **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. + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +### bufferFrom(buffer) + +- `buffer` <Buffer> An existing `Buffer` to copy data from + +Copies the passed `buffer` data onto a new `Buffer` instance. + +### bufferFrom(string[, encoding]) + +- `string` <String> A string to encode. +- `encoding` <String> The encoding of `string`. **Default:** `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `string`. If +provided, the `encoding` parameter identifies the character encoding of +`string`. + +## See also + +- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc` +- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe` diff --git a/node_modules/call-bind-apply-helpers/.eslintrc b/node_modules/call-bind-apply-helpers/.eslintrc new file mode 100644 index 000000000..201e859be --- /dev/null +++ b/node_modules/call-bind-apply-helpers/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + "no-extra-parens": 0, + "no-magic-numbers": 0, + }, +} diff --git a/node_modules/call-bind-apply-helpers/.github/FUNDING.yml b/node_modules/call-bind-apply-helpers/.github/FUNDING.yml new file mode 100644 index 000000000..0011e9d65 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bind-apply-helpers +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/call-bind-apply-helpers/.nycrc b/node_modules/call-bind-apply-helpers/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/call-bind-apply-helpers/CHANGELOG.md b/node_modules/call-bind-apply-helpers/CHANGELOG.md new file mode 100644 index 000000000..24849428b --- /dev/null +++ b/node_modules/call-bind-apply-helpers/CHANGELOG.md @@ -0,0 +1,30 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12 + +### Commits + +- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1) + +## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08 + +### Commits + +- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8) +- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75) +- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940) + +## v1.0.0 - 2024-12-05 + +### Commits + +- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04) +- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f) +- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603) +- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930) diff --git a/node_modules/call-bind-apply-helpers/LICENSE b/node_modules/call-bind-apply-helpers/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/call-bind-apply-helpers/README.md b/node_modules/call-bind-apply-helpers/README.md new file mode 100644 index 000000000..8fc0dae1b --- /dev/null +++ b/node_modules/call-bind-apply-helpers/README.md @@ -0,0 +1,62 @@ +# call-bind-apply-helpers [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Helper functions around Function call/apply/bind, for use in `call-bind`. + +The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`. +Please use `call-bind` unless you have a very good reason not to. + +## Getting started + +```sh +npm install --save call-bind-apply-helpers +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBindBasic = require('call-bind-apply-helpers'); + +function f(a, b) { + assert.equal(this, 1); + assert.equal(a, 2); + assert.equal(b, 3); + assert.equal(arguments.length, 2); +} + +const fBound = callBindBasic([f, 1]); + +delete Function.prototype.call; +delete Function.prototype.bind; + +fBound(2, 3); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bind-apply-helpers +[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg +[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg +[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers +[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers +[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers +[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions diff --git a/node_modules/call-bind-apply-helpers/actualApply.d.ts b/node_modules/call-bind-apply-helpers/actualApply.d.ts new file mode 100644 index 000000000..b87286a21 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/actualApply.d.ts @@ -0,0 +1 @@ +export = Reflect.apply; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/actualApply.js b/node_modules/call-bind-apply-helpers/actualApply.js new file mode 100644 index 000000000..ffa51355d --- /dev/null +++ b/node_modules/call-bind-apply-helpers/actualApply.js @@ -0,0 +1,10 @@ +'use strict'; + +var bind = require('function-bind'); + +var $apply = require('./functionApply'); +var $call = require('./functionCall'); +var $reflectApply = require('./reflectApply'); + +/** @type {import('./actualApply')} */ +module.exports = $reflectApply || bind.call($call, $apply); diff --git a/node_modules/call-bind-apply-helpers/applyBind.d.ts b/node_modules/call-bind-apply-helpers/applyBind.d.ts new file mode 100644 index 000000000..d176c1ab3 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/applyBind.d.ts @@ -0,0 +1,19 @@ +import actualApply from './actualApply'; + +type TupleSplitHead = T['length'] extends N + ? T + : T extends [...infer R, any] + ? TupleSplitHead + : never + +type TupleSplitTail = O['length'] extends N + ? T + : T extends [infer F, ...infer R] + ? TupleSplitTail<[...R], N, [...O, F]> + : never + +type TupleSplit = [TupleSplitHead, TupleSplitTail] + +declare function applyBind(...args: TupleSplit, 2>[1]): ReturnType; + +export = applyBind; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/applyBind.js b/node_modules/call-bind-apply-helpers/applyBind.js new file mode 100644 index 000000000..d2b772314 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/applyBind.js @@ -0,0 +1,10 @@ +'use strict'; + +var bind = require('function-bind'); +var $apply = require('./functionApply'); +var actualApply = require('./actualApply'); + +/** @type {import('./applyBind')} */ +module.exports = function applyBind() { + return actualApply(bind, $apply, arguments); +}; diff --git a/node_modules/call-bind-apply-helpers/functionApply.d.ts b/node_modules/call-bind-apply-helpers/functionApply.d.ts new file mode 100644 index 000000000..1f6e11b3d --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionApply.d.ts @@ -0,0 +1 @@ +export = Function.prototype.apply; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/functionApply.js b/node_modules/call-bind-apply-helpers/functionApply.js new file mode 100644 index 000000000..c71df9c2b --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionApply.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./functionApply')} */ +module.exports = Function.prototype.apply; diff --git a/node_modules/call-bind-apply-helpers/functionCall.d.ts b/node_modules/call-bind-apply-helpers/functionCall.d.ts new file mode 100644 index 000000000..15e93df35 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionCall.d.ts @@ -0,0 +1 @@ +export = Function.prototype.call; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/functionCall.js b/node_modules/call-bind-apply-helpers/functionCall.js new file mode 100644 index 000000000..7a8d87357 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionCall.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./functionCall')} */ +module.exports = Function.prototype.call; diff --git a/node_modules/call-bind-apply-helpers/index.d.ts b/node_modules/call-bind-apply-helpers/index.d.ts new file mode 100644 index 000000000..541516bd0 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/index.d.ts @@ -0,0 +1,64 @@ +type RemoveFromTuple< + Tuple extends readonly unknown[], + RemoveCount extends number, + Index extends 1[] = [] +> = Index["length"] extends RemoveCount + ? Tuple + : Tuple extends [infer First, ...infer Rest] + ? RemoveFromTuple + : Tuple; + +type ConcatTuples< + Prefix extends readonly unknown[], + Suffix extends readonly unknown[] +> = [...Prefix, ...Suffix]; + +type ExtractFunctionParams = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R + ? { thisArg: TThis; params: P; returnType: R } + : never; + +type BindFunction< + T extends (this: any, ...args: any[]) => any, + TThis, + TBoundArgs extends readonly unknown[], + ReceiverBound extends boolean +> = ExtractFunctionParams extends { + thisArg: infer OrigThis; + params: infer P extends readonly unknown[]; + returnType: infer R; +} + ? ReceiverBound extends true + ? (...args: RemoveFromTuple>) => R extends [OrigThis, ...infer Rest] + ? [TThis, ...Rest] // Replace `this` with `thisArg` + : R + : >>( + thisArg: U, + ...args: RemainingArgs + ) => R extends [OrigThis, ...infer Rest] + ? [U, ...ConcatTuples] // Preserve bound args in return type + : R + : never; + +declare function callBind< + const T extends (this: any, ...args: any[]) => any, + Extracted extends ExtractFunctionParams, + const TBoundArgs extends Partial & readonly unknown[], + const TThis extends Extracted["thisArg"] +>( + args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs] +): BindFunction; + +declare function callBind< + const T extends (this: any, ...args: any[]) => any, + Extracted extends ExtractFunctionParams, + const TBoundArgs extends Partial & readonly unknown[] +>( + args: [fn: T, ...boundArgs: TBoundArgs] +): BindFunction; + +declare function callBind( + args: [fn: Exclude, ...rest: TArgs] +): never; + +// export as namespace callBind; +export = callBind; diff --git a/node_modules/call-bind-apply-helpers/index.js b/node_modules/call-bind-apply-helpers/index.js new file mode 100644 index 000000000..2f6dab4c1 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var bind = require('function-bind'); +var $TypeError = require('es-errors/type'); + +var $call = require('./functionCall'); +var $actualApply = require('./actualApply'); + +/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ +module.exports = function callBindBasic(args) { + if (args.length < 1 || typeof args[0] !== 'function') { + throw new $TypeError('a function is required'); + } + return $actualApply(bind, $call, args); +}; diff --git a/node_modules/call-bind-apply-helpers/package.json b/node_modules/call-bind-apply-helpers/package.json new file mode 100644 index 000000000..923b8be2f --- /dev/null +++ b/node_modules/call-bind-apply-helpers/package.json @@ -0,0 +1,85 @@ +{ + "name": "call-bind-apply-helpers", + "version": "1.0.2", + "description": "Helper functions around Function call/apply/bind, for use in `call-bind`", + "main": "index.js", + "exports": { + ".": "./index.js", + "./actualApply": "./actualApply.js", + "./applyBind": "./applyBind.js", + "./functionApply": "./functionApply.js", + "./functionCall": "./functionCall.js", + "./reflectApply": "./reflectApply.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bind-apply-helpers.git" + }, + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bind-apply-helpers/issues" + }, + "homepage": "https://github.com/ljharb/call-bind-apply-helpers#readme", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.3", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.3", + "@types/for-each": "^0.3.3", + "@types/function-bind": "^1.1.10", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.7.1", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.5", + "has-strict-mode": "^1.1.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/call-bind-apply-helpers/reflectApply.d.ts b/node_modules/call-bind-apply-helpers/reflectApply.d.ts new file mode 100644 index 000000000..6b2ae764c --- /dev/null +++ b/node_modules/call-bind-apply-helpers/reflectApply.d.ts @@ -0,0 +1,3 @@ +declare const reflectApply: false | typeof Reflect.apply; + +export = reflectApply; diff --git a/node_modules/call-bind-apply-helpers/reflectApply.js b/node_modules/call-bind-apply-helpers/reflectApply.js new file mode 100644 index 000000000..3d03caa69 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/reflectApply.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./reflectApply')} */ +module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; diff --git a/node_modules/call-bind-apply-helpers/test/index.js b/node_modules/call-bind-apply-helpers/test/index.js new file mode 100644 index 000000000..1cdc89ed4 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/test/index.js @@ -0,0 +1,63 @@ +'use strict'; + +var callBind = require('../'); +var hasStrictMode = require('has-strict-mode')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var v = require('es-value-fixtures'); + +var test = require('tape'); + +test('callBindBasic', function (t) { + forEach(v.nonFunctions, function (nonFunction) { + t['throws']( + // @ts-expect-error + function () { callBind([nonFunction]); }, + TypeError, + inspect(nonFunction) + ' is not a function' + ); + }); + + var sentinel = { sentinel: true }; + /** @type {(this: T, a: A, b: B) => [T | undefined, A, B]} */ + var func = function (a, b) { + // eslint-disable-next-line no-invalid-this + return [!hasStrictMode && this === global ? undefined : this, a, b]; + }; + t.equal(func.length, 2, 'original function length is 2'); + + /** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */ + var bound = callBind([func]); + /** type {((a: number, b: number) => [typeof sentinel, typeof a, typeof b])} */ + var boundR = callBind([func, sentinel]); + /** type {((b: number) => [typeof sentinel, number, typeof b])} */ + var boundArg = callBind([func, sentinel, /** @type {const} */ (1)]); + + // @ts-expect-error + t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args'); + + // @ts-expect-error + t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); + // @ts-expect-error + t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func too few args'); + // @ts-expect-error + t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); + // @ts-expect-error + t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); + + t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); + t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with right args'); + t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); + t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); + + // @ts-expect-error + t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); + // @ts-expect-error + t.deepEqual(bound(1, 2, 3, 4), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); + // @ts-expect-error + t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); + // @ts-expect-error + t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); + + t.end(); +}); diff --git a/node_modules/call-bind-apply-helpers/tsconfig.json b/node_modules/call-bind-apply-helpers/tsconfig.json new file mode 100644 index 000000000..aef999308 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} \ No newline at end of file diff --git a/node_modules/call-bind/.eslintignore b/node_modules/call-bind/.eslintignore new file mode 100644 index 000000000..404abb221 --- /dev/null +++ b/node_modules/call-bind/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/call-bind/.eslintrc b/node_modules/call-bind/.eslintrc new file mode 100644 index 000000000..dfa9a6cdc --- /dev/null +++ b/node_modules/call-bind/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + "no-magic-numbers": 0, + }, +} diff --git a/node_modules/call-bind/.github/FUNDING.yml b/node_modules/call-bind/.github/FUNDING.yml new file mode 100644 index 000000000..c70c2ecdb --- /dev/null +++ b/node_modules/call-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/call-bind/.nycrc b/node_modules/call-bind/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/call-bind/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/call-bind/CHANGELOG.md b/node_modules/call-bind/CHANGELOG.md new file mode 100644 index 000000000..be0de99f1 --- /dev/null +++ b/node_modules/call-bind/CHANGELOG.md @@ -0,0 +1,106 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.8](https://github.com/ljharb/call-bind/compare/v1.0.7...v1.0.8) - 2024-12-05 + +### Commits + +- [Refactor] extract out some helpers and avoid get-intrinsic usage [`407fd5e`](https://github.com/ljharb/call-bind/commit/407fd5eec34ec58394522a6ce3badfa4788fd5ae) +- [Refactor] replace code with extracted `call-bind-apply-helpers` [`81018fb`](https://github.com/ljharb/call-bind/commit/81018fb78902ff5acbc6c09300780e97f0db6a34) +- [Tests] use `set-function-length/env` [`0fc311d`](https://github.com/ljharb/call-bind/commit/0fc311de0e115cfa6b02969b23a42ad45aadf224) +- [actions] split out node 10-20, and 20+ [`77a0cad`](https://github.com/ljharb/call-bind/commit/77a0cad75f83f5b8050dc13baef4fa2cff537fa3) +- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `gopd`, `object-inspect`, `tape` [`a145d10`](https://github.com/ljharb/call-bind/commit/a145d10fe847f350e11094f8541848b028ee8c91) +- [Tests] replace `aud` with `npm audit` [`30ca3dd`](https://github.com/ljharb/call-bind/commit/30ca3dd7234648eb029947477d06b17879e10727) +- [Deps] update `set-function-length` [`57c79a3`](https://github.com/ljharb/call-bind/commit/57c79a3666022ea797cc2a4a3b43fe089bc97d1b) +- [Dev Deps] add missing peer dep [`601cfa5`](https://github.com/ljharb/call-bind/commit/601cfa5540066b6206039ceb9496cecbd134ff7b) + +## [v1.0.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03) +- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590) + +## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05 + +### Commits + +- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa) +- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5) +- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582) + +## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19 + +### Commits + +- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d) +- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871) + +## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19 + +## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19 + +### Commits + +- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453) +- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5) +- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90) +- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4) +- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11) +- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223) +- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5) +- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05) +- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329) +- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958) +- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5) +- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3) +- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91) +- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60) + +## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11 + +### Commits + +- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d) + +## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08 + +### Commits + +- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1) +- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e) +- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb) +- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71) +- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee) +- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2) +- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8) +- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6) + +## v1.0.0 - 2020-10-30 + +### Commits + +- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50) +- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df) +- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65) +- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13) +- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4) +- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717) +- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af) +- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650) +- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f) diff --git a/node_modules/call-bind/LICENSE b/node_modules/call-bind/LICENSE new file mode 100644 index 000000000..48f05d01d --- /dev/null +++ b/node_modules/call-bind/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/call-bind/README.md b/node_modules/call-bind/README.md new file mode 100644 index 000000000..48e9047f0 --- /dev/null +++ b/node_modules/call-bind/README.md @@ -0,0 +1,64 @@ +# call-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly `.call.bind()` a function. + +## Getting started + +```sh +npm install --save call-bind +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBind = require('call-bind'); +const callBound = require('call-bind/callBound'); + +function f(a, b) { + assert.equal(this, 1); + assert.equal(a, 2); + assert.equal(b, 3); + assert.equal(arguments.length, 2); +} + +const fBound = callBind(f); + +const slice = callBound('Array.prototype.slice'); + +delete Function.prototype.call; +delete Function.prototype.bind; + +fBound(1, 2, 3); + +assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bind +[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg +[deps-svg]: https://david-dm.org/ljharb/call-bind.svg +[deps-url]: https://david-dm.org/ljharb/call-bind +[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bind +[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind +[actions-url]: https://github.com/ljharb/call-bind/actions diff --git a/node_modules/call-bind/callBound.js b/node_modules/call-bind/callBound.js new file mode 100644 index 000000000..8374adfd0 --- /dev/null +++ b/node_modules/call-bind/callBound.js @@ -0,0 +1,15 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBind = require('./'); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; diff --git a/node_modules/call-bind/index.js b/node_modules/call-bind/index.js new file mode 100644 index 000000000..b64233939 --- /dev/null +++ b/node_modules/call-bind/index.js @@ -0,0 +1,24 @@ +'use strict'; + +var setFunctionLength = require('set-function-length'); + +var $defineProperty = require('es-define-property'); + +var callBindBasic = require('call-bind-apply-helpers'); +var applyBind = require('call-bind-apply-helpers/applyBind'); + +module.exports = function callBind(originalFunction) { + var func = callBindBasic(arguments); + var adjustedLength = originalFunction.length - (arguments.length - 1); + return setFunctionLength( + func, + 1 + (adjustedLength > 0 ? adjustedLength : 0), + true + ); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} diff --git a/node_modules/call-bind/package.json b/node_modules/call-bind/package.json new file mode 100644 index 000000000..3642a3714 --- /dev/null +++ b/node_modules/call-bind/package.json @@ -0,0 +1,93 @@ +{ + "name": "call-bind", + "version": "1.0.8", + "description": "Robustly `.call.bind()` a function", + "main": "index.js", + "exports": { + ".": "./index.js", + "./callBound": "./callBound.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bind.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "callbind", + "callbound", + "call", + "bind", + "bound", + "call-bind", + "call-bound", + "function", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bind/issues" + }, + "homepage": "https://github.com/ljharb/call-bind#readme", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/call-bind/test/callBound.js b/node_modules/call-bind/test/callBound.js new file mode 100644 index 000000000..c32319d70 --- /dev/null +++ b/node_modules/call-bind/test/callBound.js @@ -0,0 +1,54 @@ +'use strict'; + +var test = require('tape'); + +var callBound = require('../callBound'); + +test('callBound', function (t) { + // static primitive + t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); + t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); + + // static non-function object + t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); + t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); + t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); + t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); + + // static function + t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); + t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); + + // prototype primitive + t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); + t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); + + // prototype function + t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself'); + t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); + t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); + t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); + + t['throws']( + function () { callBound('does not exist'); }, + SyntaxError, + 'nonexistent intrinsic throws' + ); + t['throws']( + function () { callBound('does not exist', true); }, + SyntaxError, + 'allowMissing arg still throws for unknown intrinsic' + ); + + t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { + st['throws']( + function () { callBound('WeakRef'); }, + TypeError, + 'real but absent intrinsic throws' + ); + st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/call-bind/test/index.js b/node_modules/call-bind/test/index.js new file mode 100644 index 000000000..f6d096a70 --- /dev/null +++ b/node_modules/call-bind/test/index.js @@ -0,0 +1,74 @@ +'use strict'; + +var callBind = require('../'); +var hasStrictMode = require('has-strict-mode')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var v = require('es-value-fixtures'); + +var test = require('tape'); + +/* + * older engines have length nonconfigurable + * in io.js v3, it is configurable except on bound functions, hence the .bind() + */ +var boundFnsHaveConfigurableLengths = require('set-function-length/env').boundFnsHaveConfigurableLengths; + +test('callBind', function (t) { + forEach(v.nonFunctions, function (nonFunction) { + t['throws']( + function () { callBind(nonFunction); }, + TypeError, + inspect(nonFunction) + ' is not a function' + ); + }); + + var sentinel = { sentinel: true }; + var func = function (a, b) { + // eslint-disable-next-line no-invalid-this + return [!hasStrictMode && this === global ? undefined : this, a, b]; + }; + t.equal(func.length, 2, 'original function length is 2'); + t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); + t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); + t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); + + var bound = callBind(func); + t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !boundFnsHaveConfigurableLengths }); + t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args'); + t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args'); + t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); + + var boundR = callBind(func, sentinel); + t.equal(boundR.length, func.length, 'function length is preserved', { skip: !boundFnsHaveConfigurableLengths }); + t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); + t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); + t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); + + var boundArg = callBind(func, sentinel, 1); + t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: !boundFnsHaveConfigurableLengths }); + t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); + t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); + t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); + + t.test('callBind.apply', function (st) { + var aBound = callBind.apply(func); + st.deepEqual(aBound(sentinel), [sentinel, undefined, undefined], 'apply-bound func with no args'); + st.deepEqual(aBound(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); + st.deepEqual(aBound(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); + + var aBoundArg = callBind.apply(func); + st.deepEqual(aBoundArg(sentinel, [1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with too many args'); + st.deepEqual(aBoundArg(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); + st.deepEqual(aBoundArg(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); + + var aBoundR = callBind.apply(func, sentinel); + st.deepEqual(aBoundR([1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with receiver and too many args'); + st.deepEqual(aBoundR([1, 2], 4), [sentinel, 1, 2], 'apply-bound func with receiver and right args'); + st.deepEqual(aBoundR([1], 4), [sentinel, 1, undefined], 'apply-bound func with receiver and too few args'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/call-bound/.eslintrc b/node_modules/call-bound/.eslintrc new file mode 100644 index 000000000..2612ed8fe --- /dev/null +++ b/node_modules/call-bound/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/call-bound/.github/FUNDING.yml b/node_modules/call-bound/.github/FUNDING.yml new file mode 100644 index 000000000..2a2a13571 --- /dev/null +++ b/node_modules/call-bound/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bound +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/call-bound/.nycrc b/node_modules/call-bound/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/call-bound/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/call-bound/CHANGELOG.md b/node_modules/call-bound/CHANGELOG.md new file mode 100644 index 000000000..8bde4e9a5 --- /dev/null +++ b/node_modules/call-bound/CHANGELOG.md @@ -0,0 +1,42 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.4](https://github.com/ljharb/call-bound/compare/v1.0.3...v1.0.4) - 2025-03-03 + +### Commits + +- [types] improve types [`e648922`](https://github.com/ljharb/call-bound/commit/e6489222a9e54f350fbf952ceabe51fd8b6027ff) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`a42a5eb`](https://github.com/ljharb/call-bound/commit/a42a5ebe6c1b54fcdc7997c7dc64fdca9e936719) +- [Deps] update `call-bind-apply-helpers`, `get-intrinsic` [`f529eac`](https://github.com/ljharb/call-bound/commit/f529eac132404c17156bbc23ab2297a25d0f20b8) + +## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15 + +### Commits + +- [Refactor] use `call-bind-apply-helpers` instead of `call-bind` [`5e0b134`](https://github.com/ljharb/call-bound/commit/5e0b13496df14fb7d05dae9412f088da8d3f75be) +- [Deps] update `get-intrinsic` [`41fc967`](https://github.com/ljharb/call-bound/commit/41fc96732a22c7b7e8f381f93ccc54bb6293be2e) +- [readme] fix example [`79a0137`](https://github.com/ljharb/call-bound/commit/79a0137723f7c6d09c9c05452bbf8d5efb5d6e49) +- [meta] add `sideEffects` flag [`08b07be`](https://github.com/ljharb/call-bound/commit/08b07be7f1c03f67dc6f3cdaf0906259771859f7) + +## [v1.0.2](https://github.com/ljharb/call-bound/compare/v1.0.1...v1.0.2) - 2024-12-10 + +### Commits + +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `gopd` [`e6a5ffe`](https://github.com/ljharb/call-bound/commit/e6a5ffe849368fe4f74dfd6cdeca1b9baa39e8d5) +- [Deps] update `call-bind`, `get-intrinsic` [`2aeb5b5`](https://github.com/ljharb/call-bound/commit/2aeb5b521dc2b2683d1345c753ea1161de2d1c14) +- [types] improve return type [`1a0c9fe`](https://github.com/ljharb/call-bound/commit/1a0c9fe3114471e7ca1f57d104e2efe713bb4871) + +## v1.0.1 - 2024-12-05 + +### Commits + +- Initial implementation, tests, readme, types [`6d94121`](https://github.com/ljharb/call-bound/commit/6d94121a9243602e506334069f7a03189fe3363d) +- Initial commit [`0eae867`](https://github.com/ljharb/call-bound/commit/0eae867334ea025c33e6e91cdecfc9df96680cf9) +- npm init [`71b2479`](https://github.com/ljharb/call-bound/commit/71b2479c6723e0b7d91a6b663613067e98b7b275) +- Only apps should have lockfiles [`c3754a9`](https://github.com/ljharb/call-bound/commit/c3754a949b7f9132b47e2d18c1729889736741eb) +- [actions] skip `npm ls` in node < 10 [`74275a5`](https://github.com/ljharb/call-bound/commit/74275a5186b8caf6309b6b97472bdcb0df4683a8) +- [Dev Deps] add missing peer dep [`1354de8`](https://github.com/ljharb/call-bound/commit/1354de8679413e4ae9c523d85f76fa7a5e032d97) diff --git a/node_modules/call-bound/LICENSE b/node_modules/call-bound/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/call-bound/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/call-bound/README.md b/node_modules/call-bound/README.md new file mode 100644 index 000000000..a44e43e56 --- /dev/null +++ b/node_modules/call-bound/README.md @@ -0,0 +1,53 @@ +# call-bound [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`. + +## Getting started + +```sh +npm install --save call-bound +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBound = require('call-bound'); + +const slice = callBound('Array.prototype.slice'); + +delete Function.prototype.call; +delete Function.prototype.bind; +delete Array.prototype.slice; + +assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bound +[npm-version-svg]: https://versionbadg.es/ljharb/call-bound.svg +[deps-svg]: https://david-dm.org/ljharb/call-bound.svg +[deps-url]: https://david-dm.org/ljharb/call-bound +[dev-deps-svg]: https://david-dm.org/ljharb/call-bound/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bound#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bound.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bound.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bound.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bound +[codecov-image]: https://codecov.io/gh/ljharb/call-bound/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bound/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bound +[actions-url]: https://github.com/ljharb/call-bound/actions diff --git a/node_modules/call-bound/index.d.ts b/node_modules/call-bound/index.d.ts new file mode 100644 index 000000000..5562f00ed --- /dev/null +++ b/node_modules/call-bound/index.d.ts @@ -0,0 +1,94 @@ +type Intrinsic = typeof globalThis; + +type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`; + +type IntrinsicPath = IntrinsicName | `${StripPercents}.${string}` | `%${StripPercents}.${string}%`; + +type AllowMissing = boolean; + +type StripPercents = T extends `%${infer U}%` ? U : T; + +type BindMethodPrecise = + F extends (this: infer This, ...args: infer Args) => infer R + ? (obj: This, ...args: Args) => R + : F extends { + (this: infer This1, ...args: infer Args1): infer R1; + (this: infer This2, ...args: infer Args2): infer R2 + } + ? { + (obj: This1, ...args: Args1): R1; + (obj: This2, ...args: Args2): R2 + } + : never + +// Extract method type from a prototype +type GetPrototypeMethod = + (typeof globalThis)[T] extends { prototype: any } + ? M extends keyof (typeof globalThis)[T]['prototype'] + ? (typeof globalThis)[T]['prototype'][M] + : never + : never + +// Get static property/method +type GetStaticMember = + P extends keyof (typeof globalThis)[T] ? (typeof globalThis)[T][P] : never + +// Type that maps string path to actual bound function or value with better precision +type BoundIntrinsic = + S extends `${infer Obj}.prototype.${infer Method}` + ? Obj extends keyof typeof globalThis + ? BindMethodPrecise> + : unknown + : S extends `${infer Obj}.${infer Prop}` + ? Obj extends keyof typeof globalThis + ? GetStaticMember + : unknown + : unknown + +declare function arraySlice(array: readonly T[], start?: number, end?: number): T[]; +declare function arraySlice(array: ArrayLike, start?: number, end?: number): T[]; +declare function arraySlice(array: IArguments, start?: number, end?: number): T[]; + +// Special cases for methods that need explicit typing +interface SpecialCases { + '%Object.prototype.isPrototypeOf%': (thisArg: {}, obj: unknown) => boolean; + '%String.prototype.replace%': { + (str: string, searchValue: string | RegExp, replaceValue: string): string; + (str: string, searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string + }; + '%Object.prototype.toString%': (obj: {}) => string; + '%Object.prototype.hasOwnProperty%': (obj: {}, v: PropertyKey) => boolean; + '%Array.prototype.slice%': typeof arraySlice; + '%Array.prototype.map%': (array: readonly T[], callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any) => U[]; + '%Array.prototype.filter%': (array: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any) => T[]; + '%Array.prototype.indexOf%': (array: readonly T[], searchElement: T, fromIndex?: number) => number; + '%Function.prototype.apply%': (fn: (...args: A) => R, thisArg: any, args: A) => R; + '%Function.prototype.call%': (fn: (...args: A) => R, thisArg: any, ...args: A) => R; + '%Function.prototype.bind%': (fn: (...args: A) => R, thisArg: any, ...args: A) => (...remainingArgs: A) => R; + '%Promise.prototype.then%': { + (promise: Promise, onfulfilled: (value: T) => R | PromiseLike): Promise; + (promise: Promise, onfulfilled: ((value: T) => R | PromiseLike) | undefined | null, onrejected: (reason: any) => R | PromiseLike): Promise; + }; + '%RegExp.prototype.test%': (regexp: RegExp, str: string) => boolean; + '%RegExp.prototype.exec%': (regexp: RegExp, str: string) => RegExpExecArray | null; + '%Error.prototype.toString%': (error: Error) => string; + '%TypeError.prototype.toString%': (error: TypeError) => string; + '%String.prototype.split%': ( + obj: unknown, + splitter: string | RegExp | { + [Symbol.split](string: string, limit?: number): string[]; + }, + limit?: number | undefined + ) => string[]; +} + +/** + * Returns a bound function for a prototype method, or a value for a static property. + * + * @param name - The name of the intrinsic (e.g. 'Array.prototype.slice') + * @param {AllowMissing} [allowMissing] - Whether to allow missing intrinsics (default: false) + */ +declare function callBound, S extends IntrinsicPath>(name: K, allowMissing?: AllowMissing): SpecialCases[`%${StripPercents}%`]; +declare function callBound, S extends IntrinsicPath>(name: S, allowMissing?: AllowMissing): BoundIntrinsic; + +export = callBound; diff --git a/node_modules/call-bound/index.js b/node_modules/call-bound/index.js new file mode 100644 index 000000000..e9ade749d --- /dev/null +++ b/node_modules/call-bound/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBindBasic = require('call-bind-apply-helpers'); + +/** @type {(thisArg: string, searchString: string, position?: number) => number} */ +var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); + +/** @type {import('.')} */ +module.exports = function callBoundIntrinsic(name, allowMissing) { + /* eslint no-extra-parens: 0 */ + + var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing)); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBindBasic(/** @type {const} */ ([intrinsic])); + } + return intrinsic; +}; diff --git a/node_modules/call-bound/package.json b/node_modules/call-bound/package.json new file mode 100644 index 000000000..d542db430 --- /dev/null +++ b/node_modules/call-bound/package.json @@ -0,0 +1,99 @@ +{ + "name": "call-bound", + "version": "1.0.4", + "description": "Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bound.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "callbind", + "callbound", + "call", + "bind", + "bound", + "call-bind", + "call-bound", + "function", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bound/issues" + }, + "homepage": "https://github.com/ljharb/call-bound#readme", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.3.0", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.3", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.7.1", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "has-strict-mode": "^1.1.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/call-bound/test/index.js b/node_modules/call-bound/test/index.js new file mode 100644 index 000000000..a2fc9f0f2 --- /dev/null +++ b/node_modules/call-bound/test/index.js @@ -0,0 +1,61 @@ +'use strict'; + +var test = require('tape'); + +var callBound = require('../'); + +/** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */ + +test('callBound', function (t) { + // static primitive + t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); + t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); + + // static non-function object + t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); + t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); + t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); + t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); + + // static function + t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); + t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); + + // prototype primitive + t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); + t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); + + var x = callBound('Object.prototype.toString'); + var y = callBound('%Object.prototype.toString%'); + + // prototype function + t.notEqual(x, Object.prototype.toString, 'Object.prototype.toString does not yield itself'); + t.notEqual(y, Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); + t.equal(x(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); + t.equal(y(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); + + t['throws']( + // @ts-expect-error + function () { callBound('does not exist'); }, + SyntaxError, + 'nonexistent intrinsic throws' + ); + t['throws']( + // @ts-expect-error + function () { callBound('does not exist', true); }, + SyntaxError, + 'allowMissing arg still throws for unknown intrinsic' + ); + + t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { + st['throws']( + function () { callBound('WeakRef'); }, + TypeError, + 'real but absent intrinsic throws' + ); + st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/call-bound/tsconfig.json b/node_modules/call-bound/tsconfig.json new file mode 100644 index 000000000..8976d98b8 --- /dev/null +++ b/node_modules/call-bound/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ESNext", + "lib": ["es2024"], + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/chalk/index.js b/node_modules/chalk/index.js new file mode 100644 index 000000000..2d85a9174 --- /dev/null +++ b/node_modules/chalk/index.js @@ -0,0 +1,116 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); +var ansiStyles = require('ansi-styles'); +var stripAnsi = require('strip-ansi'); +var hasAnsi = require('has-ansi'); +var supportsColor = require('supports-color'); +var defineProps = Object.defineProperties; +var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM); + +function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; +} + +// use bright blue on Windows as the normal blue color is illegible +if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001b[94m'; +} + +var styles = (function () { + var ret = {}; + + Object.keys(ansiStyles).forEach(function (key) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + ret[key] = { + get: function () { + return build.call(this, this._styles.concat(key)); + } + }; + }); + + return ret; +})(); + +var proto = defineProps(function chalk() {}, styles); + +function build(_styles) { + var builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder.enabled = this.enabled; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + /* eslint-disable no-proto */ + builder.__proto__ = proto; + + return builder; +} + +function applyStyle() { + // support varags, but simply cast to string in case there's only one arg + var args = arguments; + var argsLen = args.length; + var str = argsLen !== 0 && String(arguments[0]); + + if (argsLen > 1) { + // don't slice `arguments`, it prevents v8 optimizations + for (var a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || !str) { + return str; + } + + var nestedStyles = this._styles; + var i = nestedStyles.length; + + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + var originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) { + ansiStyles.dim.open = ''; + } + + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + } + + // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue. + ansiStyles.dim.open = originalDim; + + return str; +} + +function init() { + var ret = {}; + + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function () { + return build.call(this, [name]); + } + }; + }); + + return ret; +} + +defineProps(Chalk.prototype, init()); + +module.exports = new Chalk(); +module.exports.styles = ansiStyles; +module.exports.hasColor = hasAnsi; +module.exports.stripColor = stripAnsi; +module.exports.supportsColor = supportsColor; diff --git a/node_modules/chalk/license b/node_modules/chalk/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/chalk/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/chalk/node_modules/strip-ansi/index.js b/node_modules/chalk/node_modules/strip-ansi/index.js new file mode 100644 index 000000000..099480fbf --- /dev/null +++ b/node_modules/chalk/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/chalk/node_modules/strip-ansi/license b/node_modules/chalk/node_modules/strip-ansi/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/chalk/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/chalk/node_modules/strip-ansi/package.json b/node_modules/chalk/node_modules/strip-ansi/package.json new file mode 100644 index 000000000..301685ba3 --- /dev/null +++ b/node_modules/chalk/node_modules/strip-ansi/package.json @@ -0,0 +1,57 @@ +{ + "name": "strip-ansi", + "version": "3.0.1", + "description": "Strip ANSI escape codes", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Boy Nicolai Appelman (jbna.nl)", + "JD Ballard (github.com/qix-)" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/chalk/node_modules/strip-ansi/readme.md b/node_modules/chalk/node_modules/strip-ansi/readme.md new file mode 100644 index 000000000..cb7d9ff7e --- /dev/null +++ b/node_modules/chalk/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/chalk/package.json b/node_modules/chalk/package.json new file mode 100644 index 000000000..2b5881e9a --- /dev/null +++ b/node_modules/chalk/package.json @@ -0,0 +1,70 @@ +{ + "name": "chalk", + "version": "1.1.3", + "description": "Terminal string styling done right. Much color.", + "license": "MIT", + "repository": "chalk/chalk", + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Appelman (jbnicolai.com)", + "JD Ballard (github.com/qix-)" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && mocha", + "bench": "matcha benchmark.js", + "coverage": "nyc npm test && nyc report", + "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "str", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "devDependencies": { + "coveralls": "^2.11.2", + "matcha": "^0.6.0", + "mocha": "*", + "nyc": "^3.0.0", + "require-uncached": "^1.0.2", + "resolve-from": "^1.0.0", + "semver": "^4.3.3", + "xo": "*" + }, + "xo": { + "envs": [ + "node", + "mocha" + ] + } +} diff --git a/node_modules/chalk/readme.md b/node_modules/chalk/readme.md new file mode 100644 index 000000000..5cf111e35 --- /dev/null +++ b/node_modules/chalk/readme.md @@ -0,0 +1,213 @@ +

+
+
+ chalk +
+
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) +[![Coverage Status](https://coveralls.io/repos/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/r/chalk/chalk?branch=master) +[![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) + + +[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. + +**Chalk is a clean and focused alternative.** + +![](https://github.com/chalk/ansi-styles/raw/master/screenshot.png) + + +## Why + +- Highly performant +- Doesn't extend `String.prototype` +- Expressive API +- Ability to nest styles +- Clean and focused +- Auto-detects color support +- Actively maintained +- [Used by ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015 + + +## Install + +``` +$ npm install --save chalk +``` + + +## Usage + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +var chalk = require('chalk'); + +// style a string +chalk.blue('Hello world!'); + +// combine styled and normal strings +chalk.blue('Hello') + 'World' + chalk.red('!'); + +// compose multiple styles using the chainable API +chalk.blue.bgRed.bold('Hello world!'); + +// pass in multiple arguments +chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'); + +// nest styles +chalk.red('Hello', chalk.underline.bgBlue('world') + '!'); + +// nest styles of the same type even (color, underline, background) +chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +); +``` + +Easily define your own themes. + +```js +var chalk = require('chalk'); +var error = chalk.bold.red; +console.log(error('Error!')); +``` + +Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data). + +```js +var name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> Hello Sindre +``` + + +## API + +### chalk.` + + diff --git a/node_modules/md5/dist/md5.min.js b/node_modules/md5/dist/md5.min.js new file mode 100644 index 000000000..250ab7356 --- /dev/null +++ b/node_modules/md5/dist/md5.min.js @@ -0,0 +1,7 @@ +var MD5=function(r){function n(o){if(t[o])return t[o].exports;var e=t[o]={i:o,l:!1,exports:{}};return r[o].call(e.exports,e,e.exports,n),e.l=!0,e.exports}var t={};return n.m=r,n.c=t,n.i=function(r){return r},n.d=function(r,t,o){n.o(r,t)||Object.defineProperty(r,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(t,"a",t),t},n.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},n.p="",n(n.s=4)}([function(r,n){var t={utf8:{stringToBytes:function(r){return t.bin.stringToBytes(unescape(encodeURIComponent(r)))},bytesToString:function(r){return decodeURIComponent(escape(t.bin.bytesToString(r)))}},bin:{stringToBytes:function(r){for(var n=[],t=0;t>>24)|4278255360&(f[h]<<24|f[h]>>>8);f[s>>>5]|=128<>>9<<4)]=s;for(var p=i._ff,y=i._gg,v=i._hh,d=i._ii,h=0;h>>0,a=a+T>>>0,l=l+x>>>0,g=g+B>>>0}return n.endian([c,a,l,g])};i._ff=function(r,n,t,o,e,u,i){var f=r+(n&t|~n&o)+(e>>>0)+i;return(f<>>32-u)+n},i._gg=function(r,n,t,o,e,u,i){var f=r+(n&o|t&~o)+(e>>>0)+i;return(f<>>32-u)+n},i._hh=function(r,n,t,o,e,u,i){var f=r+(n^t^o)+(e>>>0)+i;return(f<>>32-u)+n},i._ii=function(r,n,t,o,e,u,i){var f=r+(t^(n|~o))+(e>>>0)+i;return(f<>>32-u)+n},i._blocksize=16,i._digestsize=16,r.exports=function(r,t){if(void 0===r||null===r)throw new Error("Illegal argument "+r);var o=n.wordsToBytes(i(r,t));return t&&t.asBytes?o:t&&t.asString?u.bytesToString(o):n.bytesToHex(o)}}()},function(r,n){!function(){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(r,n){return r<>>32-n},rotr:function(r,n){return r<<32-n|r>>>n},endian:function(r){if(r.constructor==Number)return 16711935&t.rotl(r,8)|4278255360&t.rotl(r,24);for(var n=0;n0;r--)n.push(Math.floor(256*Math.random()));return n},bytesToWords:function(r){for(var n=[],t=0,o=0;t>>5]|=r[t]<<24-o%32;return n},wordsToBytes:function(r){for(var n=[],t=0;t<32*r.length;t+=8)n.push(r[t>>>5]>>>24-t%32&255);return n},bytesToHex:function(r){for(var n=[],t=0;t>>4).toString(16)),n.push((15&r[t]).toString(16));return n.join("")},hexToBytes:function(r){for(var n=[],t=0;t>>6*(3-u)&63)):t.push("=");return t.join("")},base64ToBytes:function(r){r=r.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],o=0,e=0;o>>6-2*e);return t}};r.exports=t}()},function(r,n){function t(r){return!!r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r)}function o(r){return"function"==typeof r.readFloatLE&&"function"==typeof r.slice&&t(r.slice(0,0))}/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +r.exports=function(r){return null!=r&&(t(r)||o(r)||!!r._isBuffer)}},function(r,n,t){r.exports=t(1)}]); \ No newline at end of file diff --git a/node_modules/md5/md5.js b/node_modules/md5/md5.js new file mode 100644 index 000000000..0f8905a63 --- /dev/null +++ b/node_modules/md5/md5.js @@ -0,0 +1,160 @@ +(function(){ + var crypt = require('crypt'), + utf8 = require('charenc').utf8, + isBuffer = require('is-buffer'), + bin = require('charenc').bin, + + // The core + md5 = function (message, options) { + // Convert to byte array + if (message.constructor == String) + if (options && options.encoding === 'binary') + message = bin.stringToBytes(message); + else + message = utf8.stringToBytes(message); + else if (isBuffer(message)) + message = Array.prototype.slice.call(message, 0); + else if (!Array.isArray(message) && message.constructor !== Uint8Array) + message = message.toString(); + // else, assume byte array already + + var m = crypt.bytesToWords(message), + l = message.length * 8, + a = 1732584193, + b = -271733879, + c = -1732584194, + d = 271733878; + + // Swap endian + for (var i = 0; i < m.length; i++) { + m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | + ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; + } + + // Padding + m[l >>> 5] |= 0x80 << (l % 32); + m[(((l + 64) >>> 9) << 4) + 14] = l; + + // Method shortcuts + var FF = md5._ff, + GG = md5._gg, + HH = md5._hh, + II = md5._ii; + + for (var i = 0; i < m.length; i += 16) { + + var aa = a, + bb = b, + cc = c, + dd = d; + + a = FF(a, b, c, d, m[i+ 0], 7, -680876936); + d = FF(d, a, b, c, m[i+ 1], 12, -389564586); + c = FF(c, d, a, b, m[i+ 2], 17, 606105819); + b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); + a = FF(a, b, c, d, m[i+ 4], 7, -176418897); + d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); + c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); + b = FF(b, c, d, a, m[i+ 7], 22, -45705983); + a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); + d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); + c = FF(c, d, a, b, m[i+10], 17, -42063); + b = FF(b, c, d, a, m[i+11], 22, -1990404162); + a = FF(a, b, c, d, m[i+12], 7, 1804603682); + d = FF(d, a, b, c, m[i+13], 12, -40341101); + c = FF(c, d, a, b, m[i+14], 17, -1502002290); + b = FF(b, c, d, a, m[i+15], 22, 1236535329); + + a = GG(a, b, c, d, m[i+ 1], 5, -165796510); + d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); + c = GG(c, d, a, b, m[i+11], 14, 643717713); + b = GG(b, c, d, a, m[i+ 0], 20, -373897302); + a = GG(a, b, c, d, m[i+ 5], 5, -701558691); + d = GG(d, a, b, c, m[i+10], 9, 38016083); + c = GG(c, d, a, b, m[i+15], 14, -660478335); + b = GG(b, c, d, a, m[i+ 4], 20, -405537848); + a = GG(a, b, c, d, m[i+ 9], 5, 568446438); + d = GG(d, a, b, c, m[i+14], 9, -1019803690); + c = GG(c, d, a, b, m[i+ 3], 14, -187363961); + b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); + a = GG(a, b, c, d, m[i+13], 5, -1444681467); + d = GG(d, a, b, c, m[i+ 2], 9, -51403784); + c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); + b = GG(b, c, d, a, m[i+12], 20, -1926607734); + + a = HH(a, b, c, d, m[i+ 5], 4, -378558); + d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); + c = HH(c, d, a, b, m[i+11], 16, 1839030562); + b = HH(b, c, d, a, m[i+14], 23, -35309556); + a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); + d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); + c = HH(c, d, a, b, m[i+ 7], 16, -155497632); + b = HH(b, c, d, a, m[i+10], 23, -1094730640); + a = HH(a, b, c, d, m[i+13], 4, 681279174); + d = HH(d, a, b, c, m[i+ 0], 11, -358537222); + c = HH(c, d, a, b, m[i+ 3], 16, -722521979); + b = HH(b, c, d, a, m[i+ 6], 23, 76029189); + a = HH(a, b, c, d, m[i+ 9], 4, -640364487); + d = HH(d, a, b, c, m[i+12], 11, -421815835); + c = HH(c, d, a, b, m[i+15], 16, 530742520); + b = HH(b, c, d, a, m[i+ 2], 23, -995338651); + + a = II(a, b, c, d, m[i+ 0], 6, -198630844); + d = II(d, a, b, c, m[i+ 7], 10, 1126891415); + c = II(c, d, a, b, m[i+14], 15, -1416354905); + b = II(b, c, d, a, m[i+ 5], 21, -57434055); + a = II(a, b, c, d, m[i+12], 6, 1700485571); + d = II(d, a, b, c, m[i+ 3], 10, -1894986606); + c = II(c, d, a, b, m[i+10], 15, -1051523); + b = II(b, c, d, a, m[i+ 1], 21, -2054922799); + a = II(a, b, c, d, m[i+ 8], 6, 1873313359); + d = II(d, a, b, c, m[i+15], 10, -30611744); + c = II(c, d, a, b, m[i+ 6], 15, -1560198380); + b = II(b, c, d, a, m[i+13], 21, 1309151649); + a = II(a, b, c, d, m[i+ 4], 6, -145523070); + d = II(d, a, b, c, m[i+11], 10, -1120210379); + c = II(c, d, a, b, m[i+ 2], 15, 718787259); + b = II(b, c, d, a, m[i+ 9], 21, -343485551); + + a = (a + aa) >>> 0; + b = (b + bb) >>> 0; + c = (c + cc) >>> 0; + d = (d + dd) >>> 0; + } + + return crypt.endian([a, b, c, d]); + }; + + // Auxiliary functions + md5._ff = function (a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + md5._gg = function (a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + md5._hh = function (a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + md5._ii = function (a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + + // Package private blocksize + md5._blocksize = 16; + md5._digestsize = 16; + + module.exports = function (message, options) { + if (message === undefined || message === null) + throw new Error('Illegal argument ' + message); + + var digestbytes = crypt.wordsToBytes(md5(message, options)); + return options && options.asBytes ? digestbytes : + options && options.asString ? bin.bytesToString(digestbytes) : + crypt.bytesToHex(digestbytes); + }; + +})(); diff --git a/node_modules/md5/package.json b/node_modules/md5/package.json new file mode 100644 index 000000000..7618a073e --- /dev/null +++ b/node_modules/md5/package.json @@ -0,0 +1,38 @@ +{ + "name": "md5", + "description": "js function for hashing messages with MD5", + "version": "2.3.0", + "author": "Paul Vorbach (http://paul.vorba.ch)", + "contributors": [ + "salba" + ], + "tags": [ + "md5", + "hash", + "encryption", + "message digest" + ], + "repository": { + "type": "git", + "url": "git://github.com/pvorb/node-md5.git" + }, + "bugs": { + "url": "https://github.com/pvorb/node-md5/issues" + }, + "main": "md5.js", + "scripts": { + "test": "mocha", + "webpack": "webpack -p" + }, + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + }, + "devDependencies": { + "mocha": "~2.3.4", + "webpack": "~2.4.1" + }, + "optionalDependencies": {}, + "license": "BSD-3-Clause" +} diff --git a/node_modules/md5/test.js b/node_modules/md5/test.js new file mode 100644 index 000000000..db78c2549 --- /dev/null +++ b/node_modules/md5/test.js @@ -0,0 +1,75 @@ +var md5 = require('./md5.js'); +var assert = require('assert'); + +describe('md5', function () { + + it('should throw an error for an undefined value', function() { + assert.throws(function() { + md5(undefined); + }); + }); + + it('should allow the hashing of the string `undefined`', function() { + assert.equal('5e543256c480ac577d30f76f9120eb74', md5('undefined')); + }); + + it('should throw an error for `null`', function() { + assert.throws(function() { + md5(null); + }); + }); + + it('should return the expected MD5 hash for "message"', function() { + assert.equal('78e731027d8fd50ed642340b7c9a63b3', md5('message')); + }); + + it('should not return the same hash for random numbers twice', function() { + var msg1 = Math.floor((Math.random() * 100000) + 1) + (new Date).getTime(); + var msg2 = Math.floor((Math.random() * 100000) + 1) + (new Date).getTime(); + + if (msg1 !== msg2) { + assert.notEqual(md5(msg1), md5(msg2)); + } else { + assert.equal(md5(msg1), md5(msg1)); + } + }); + + it('should support Node.js Buffers', function() { + var buffer = new Buffer('message áßäöü', 'utf8'); + + assert.equal(md5(buffer), md5('message áßäöü')); + }) + + it('should be able to use a binary encoded string', function() { + var hash1 = md5('abc', { asString: true }); + var hash2 = md5(hash1 + 'a', { asString: true, encoding : 'binary' }); + var hash3 = md5(hash1 + 'a', { encoding : 'binary' }); + assert.equal(hash3, '131f0ac52813044f5110e4aec638c169'); + }); + + it('should support Uint8Array', function() { + // Polyfills + if (!Array.from) { + Array.from = function(src, fn) { + var result = new Array(src.length); + for (var i = 0; i < src.length; ++i) + result[i] = fn(src[i]); + return result; + }; + } + if (!Uint8Array.from) { + Uint8Array.from = function(src) { + var result = new Uint8Array(src.length); + for (var i = 0; i < src.length; ++i) + result[i] = src[i]; + return result; + }; + } + + var message = 'foobarbaz'; + var u8arr = Uint8Array.from( + Array.from(message, function(c) { return c.charCodeAt(0); })); + var u8aHash = md5(u8arr); + assert.equal(u8aHash, md5(message)); + }); +}); diff --git a/node_modules/md5/webpack.config.js b/node_modules/md5/webpack.config.js new file mode 100644 index 000000000..310eb3759 --- /dev/null +++ b/node_modules/md5/webpack.config.js @@ -0,0 +1,13 @@ +const {resolve} = require('path'); + +module.exports = { + entry: [ + './md5.js' + ], + output: { + path: resolve('./dist'), + filename: 'md5.min.js', + libraryTarget: "var", + library: "MD5" + } +}; \ No newline at end of file diff --git a/node_modules/mdurl/CHANGELOG.md b/node_modules/mdurl/CHANGELOG.md new file mode 100644 index 000000000..ed33c7893 --- /dev/null +++ b/node_modules/mdurl/CHANGELOG.md @@ -0,0 +1,16 @@ +1.0.1 / 2015-09-15 +------------------ + +- Fixed closure compiler compatibility (#1). + + +1.0.0 / 2015-03-04 +------------------ + +- Added `.decode()`, `.parse()`, `.format()`. + + +0.0.1 / 2015-03-02 +------------------ + +- First release. diff --git a/node_modules/mdurl/LICENSE b/node_modules/mdurl/LICENSE new file mode 100644 index 000000000..3b2c7bfb1 --- /dev/null +++ b/node_modules/mdurl/LICENSE @@ -0,0 +1,45 @@ +Copyright (c) 2015 Vitaly Puzrin, Alex Kocharin. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +-------------------------------------------------------------------------------- + +.parse() is based on Joyent's node.js `url` code: + +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/mdurl/README.md b/node_modules/mdurl/README.md new file mode 100644 index 000000000..72aebef09 --- /dev/null +++ b/node_modules/mdurl/README.md @@ -0,0 +1,102 @@ +# mdurl + +[![Build Status](https://img.shields.io/travis/markdown-it/mdurl/master.svg?style=flat)](https://travis-ci.org/markdown-it/mdurl) +[![NPM version](https://img.shields.io/npm/v/mdurl.svg?style=flat)](https://www.npmjs.org/package/mdurl) + +> URL utilities for [markdown-it](https://github.com/markdown-it/markdown-it) parser. + + +## API + +### .encode(str [, exclude, keepEncoded]) -> String + +Percent-encode a string, avoiding double encoding. Don't touch `/a-zA-Z0-9/` + +excluded chars + `/%[a-fA-F0-9]{2}/` (if not disabled). Broken surrorates are +replaced with `U+FFFD`. + +Params: + +- __str__ - input string. +- __exclude__ - optional, `;/?:@&=+$,-_.!~*'()#`. Additional chars to keep intact + (except `/a-zA-Z0-9/`). +- __keepEncoded__ - optional, `true`. By default it skips already encoded sequences + (`/%[a-fA-F0-9]{2}/`). If set to `false`, `%` will be encoded. + + +### encode.defaultChars, encode.componentChars + +You can use these constants as second argument to `encode` function. + + - `encode.defaultChars` is the same exclude set as in the standard `encodeURI()` function + - `encode.componentChars` is the same exclude set as in the `encodeURIComponent()` function + +For example, `encode('something', encode.componentChars, true)` is roughly the equivalent of +the `encodeURIComponent()` function (except `encode()` doesn't throw). + + +### .decode(str [, exclude]) -> String + +Decode percent-encoded string. Invalid percent-encoded sequences (e.g. `%2G`) +are left as is. Invalid UTF-8 characters are replaced with `U+FFFD`. + + +Params: + +- __str__ - input string. +- __exclude__ - set of characters to leave encoded, optional, `;/?:@&=+$,#`. + + +### decode.defaultChars, decode.componentChars + +You can use these constants as second argument to `decode` function. + + - `decode.defaultChars` is the same exclude set as in the standard `decodeURI()` function + - `decode.componentChars` is the same exclude set as in the `decodeURIComponent()` function + +For example, `decode('something', decode.defaultChars)` has the same behavior as +`decodeURI('something')` on a correctly encoded input. + + +### .parse(url, slashesDenoteHost) -> urlObs + +Parse url string. Similar to node's [url.parse](http://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost), but without any +normalizations and query string parse. + + - __url__ - input url (string) + - __slashesDenoteHost__ - if url starts with `//`, expect a hostname after it. Optional, `false`. + +Result (hash): + +- protocol +- slashes +- auth +- port +- hostname +- hash +- search +- pathname + +Difference with node's `url`: + +1. No leading slash in paths, e.g. in `url.parse('http://foo?bar')` pathname is + ``, not `/` +2. Backslashes are not replaced with slashes, so `http:\\example.org\` is + treated like a relative path +3. Trailing colon is treated like a part of the path, i.e. in + `http://example.org:foo` pathname is `:foo` +4. Nothing is URL-encoded in the resulting object, (in joyent/node some chars + in auth and paths are encoded) +5. `url.parse()` does not have `parseQueryString` argument +6. Removed extraneous result properties: `host`, `path`, `query`, etc., + which can be constructed using other parts of the url. + + +### .format(urlObject) + +Format an object previously obtained with `.parse()` function. Similar to node's +[url.format](http://nodejs.org/api/url.html#url_url_format_urlobj). + + +## License + +[MIT](https://github.com/markdown-it/mdurl/blob/master/LICENSE) diff --git a/node_modules/mdurl/decode.js b/node_modules/mdurl/decode.js new file mode 100644 index 000000000..189d7b9c5 --- /dev/null +++ b/node_modules/mdurl/decode.js @@ -0,0 +1,122 @@ + +'use strict'; + + +/* eslint-disable no-bitwise */ + +var decodeCache = {}; + +function getDecodeCache(exclude) { + var i, ch, cache = decodeCache[exclude]; + if (cache) { return cache; } + + cache = decodeCache[exclude] = []; + + for (i = 0; i < 128; i++) { + ch = String.fromCharCode(i); + cache.push(ch); + } + + for (i = 0; i < exclude.length; i++) { + ch = exclude.charCodeAt(i); + cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2); + } + + return cache; +} + + +// Decode percent-encoded string. +// +function decode(string, exclude) { + var cache; + + if (typeof exclude !== 'string') { + exclude = decode.defaultChars; + } + + cache = getDecodeCache(exclude); + + return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) { + var i, l, b1, b2, b3, b4, chr, + result = ''; + + for (i = 0, l = seq.length; i < l; i += 3) { + b1 = parseInt(seq.slice(i + 1, i + 3), 16); + + if (b1 < 0x80) { + result += cache[b1]; + continue; + } + + if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) { + // 110xxxxx 10xxxxxx + b2 = parseInt(seq.slice(i + 4, i + 6), 16); + + if ((b2 & 0xC0) === 0x80) { + chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F); + + if (chr < 0x80) { + result += '\ufffd\ufffd'; + } else { + result += String.fromCharCode(chr); + } + + i += 3; + continue; + } + } + + if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) { + // 1110xxxx 10xxxxxx 10xxxxxx + b2 = parseInt(seq.slice(i + 4, i + 6), 16); + b3 = parseInt(seq.slice(i + 7, i + 9), 16); + + if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) { + chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F); + + if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) { + result += '\ufffd\ufffd\ufffd'; + } else { + result += String.fromCharCode(chr); + } + + i += 6; + continue; + } + } + + if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) { + // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx + b2 = parseInt(seq.slice(i + 4, i + 6), 16); + b3 = parseInt(seq.slice(i + 7, i + 9), 16); + b4 = parseInt(seq.slice(i + 10, i + 12), 16); + + if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) { + chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F); + + if (chr < 0x10000 || chr > 0x10FFFF) { + result += '\ufffd\ufffd\ufffd\ufffd'; + } else { + chr -= 0x10000; + result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF)); + } + + i += 9; + continue; + } + } + + result += '\ufffd'; + } + + return result; + }); +} + + +decode.defaultChars = ';/?:@&=+$,#'; +decode.componentChars = ''; + + +module.exports = decode; diff --git a/node_modules/mdurl/encode.js b/node_modules/mdurl/encode.js new file mode 100644 index 000000000..6dff4f96e --- /dev/null +++ b/node_modules/mdurl/encode.js @@ -0,0 +1,98 @@ + +'use strict'; + + +var encodeCache = {}; + + +// Create a lookup array where anything but characters in `chars` string +// and alphanumeric chars is percent-encoded. +// +function getEncodeCache(exclude) { + var i, ch, cache = encodeCache[exclude]; + if (cache) { return cache; } + + cache = encodeCache[exclude] = []; + + for (i = 0; i < 128; i++) { + ch = String.fromCharCode(i); + + if (/^[0-9a-z]$/i.test(ch)) { + // always allow unencoded alphanumeric characters + cache.push(ch); + } else { + cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2)); + } + } + + for (i = 0; i < exclude.length; i++) { + cache[exclude.charCodeAt(i)] = exclude[i]; + } + + return cache; +} + + +// Encode unsafe characters with percent-encoding, skipping already +// encoded sequences. +// +// - string - string to encode +// - exclude - list of characters to ignore (in addition to a-zA-Z0-9) +// - keepEscaped - don't encode '%' in a correct escape sequence (default: true) +// +function encode(string, exclude, keepEscaped) { + var i, l, code, nextCode, cache, + result = ''; + + if (typeof exclude !== 'string') { + // encode(string, keepEscaped) + keepEscaped = exclude; + exclude = encode.defaultChars; + } + + if (typeof keepEscaped === 'undefined') { + keepEscaped = true; + } + + cache = getEncodeCache(exclude); + + for (i = 0, l = string.length; i < l; i++) { + code = string.charCodeAt(i); + + if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { + if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { + result += string.slice(i, i + 3); + i += 2; + continue; + } + } + + if (code < 128) { + result += cache[code]; + continue; + } + + if (code >= 0xD800 && code <= 0xDFFF) { + if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) { + nextCode = string.charCodeAt(i + 1); + if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) { + result += encodeURIComponent(string[i] + string[i + 1]); + i++; + continue; + } + } + result += '%EF%BF%BD'; + continue; + } + + result += encodeURIComponent(string[i]); + } + + return result; +} + +encode.defaultChars = ";/?:@&=+$,-_.!~*'()#"; +encode.componentChars = "-_.!~*'()"; + + +module.exports = encode; diff --git a/node_modules/mdurl/format.js b/node_modules/mdurl/format.js new file mode 100644 index 000000000..c4eb9f4a9 --- /dev/null +++ b/node_modules/mdurl/format.js @@ -0,0 +1,25 @@ + +'use strict'; + + +module.exports = function format(url) { + var result = ''; + + result += url.protocol || ''; + result += url.slashes ? '//' : ''; + result += url.auth ? url.auth + '@' : ''; + + if (url.hostname && url.hostname.indexOf(':') !== -1) { + // ipv6 address + result += '[' + url.hostname + ']'; + } else { + result += url.hostname || ''; + } + + result += url.port ? ':' + url.port : ''; + result += url.pathname || ''; + result += url.search || ''; + result += url.hash || ''; + + return result; +}; diff --git a/node_modules/mdurl/index.js b/node_modules/mdurl/index.js new file mode 100644 index 000000000..194abff59 --- /dev/null +++ b/node_modules/mdurl/index.js @@ -0,0 +1,7 @@ +'use strict'; + + +module.exports.encode = require('./encode'); +module.exports.decode = require('./decode'); +module.exports.format = require('./format'); +module.exports.parse = require('./parse'); diff --git a/node_modules/mdurl/package.json b/node_modules/mdurl/package.json new file mode 100644 index 000000000..017d740b0 --- /dev/null +++ b/node_modules/mdurl/package.json @@ -0,0 +1,16 @@ +{ + "name": "mdurl", + "version": "1.0.1", + "description": "URL utilities for markdown-it", + "repository": "markdown-it/mdurl", + "license": "MIT", + "scripts": { + "test": "make test" + }, + "devDependencies": { + "mocha": "*", + "eslint": "0.13.0", + "eslint-plugin-nodeca": "^1.0.0", + "istanbul": "*" + } +} diff --git a/node_modules/mdurl/parse.js b/node_modules/mdurl/parse.js new file mode 100644 index 000000000..6c33ac128 --- /dev/null +++ b/node_modules/mdurl/parse.js @@ -0,0 +1,312 @@ +// 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'; + +// +// Changes from joyent/node: +// +// 1. No leading slash in paths, +// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/` +// +// 2. Backslashes are not replaced with slashes, +// so `http:\\example.org\` is treated like a relative path +// +// 3. Trailing colon is treated like a part of the path, +// i.e. in `http://example.org:foo` pathname is `:foo` +// +// 4. Nothing is URL-encoded in the resulting object, +// (in joyent/node some chars in auth and paths are encoded) +// +// 5. `url.parse()` does not have `parseQueryString` argument +// +// 6. Removed extraneous result properties: `host`, `path`, `query`, etc., +// which can be constructed using other parts of the url. +// + + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.pathname = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ], + + // RFC 2396: characters not allowed for various reasons. + unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = [ '\'' ].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape), + hostEndingChars = [ '/', '?', '#' ], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + /* eslint-disable no-script-url */ + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }; + /* eslint-enable no-script-url */ + +function urlParse(url, slashesDenoteHost) { + if (url && url instanceof Url) { return url; } + + var u = new Url(); + u.parse(url, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, slashesDenoteHost) { + var i, l, lowerProto, hec, slashes, + rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + lowerProto = proto.toLowerCase(); + this.protocol = proto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (i = 0; i < hostEndingChars.length; i++) { + hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { + hostEnd = hec; + } + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = auth; + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (i = 0; i < nonHostChars.length; i++) { + hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { + hostEnd = hec; + } + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) { + hostEnd = rest.length; + } + + if (rest[hostEnd - 1] === ':') { hostEnd--; } + var host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(host); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) { continue; } + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + } + } + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + rest = rest.slice(0, qm); + } + if (rest) { this.pathname = rest; } + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = ''; + } + + return this; +}; + +Url.prototype.parseHost = function(host) { + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) { this.hostname = host; } +}; + +module.exports = urlParse; diff --git a/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE new file mode 100644 index 000000000..19129e315 --- /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 000000000..2e9bd0f48 --- /dev/null +++ b/node_modules/minimatch/README.md @@ -0,0 +1,224 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](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.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +## 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 000000000..caf56073e --- /dev/null +++ b/node_modules/minimatch/minimatch.js @@ -0,0 +1,947 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return require('path') } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +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) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + 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 + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + 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 = function debug() { console.error.apply(console, arguments) } + + 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 + + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// 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) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + 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) { + /* istanbul ignore next */ + 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\]" + // 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) /* istanbul ignore next - should be impossible */ { + // 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) /* istanbul ignore next - should be impossible */ { + 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 = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.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. + /* istanbul ignore if */ + 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 + /* istanbul ignore if */ + 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') { + 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 /* istanbul ignore 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/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + 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 000000000..f339044fc --- /dev/null +++ b/node_modules/minimatch/package.json @@ -0,0 +1,33 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "3.0.8", + "publishConfig": { + "tag": "v3.0-legacy" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "devDependencies": { + "tap": "^15.1.6" + }, + "license": "ISC", + "files": [ + "minimatch.js" + ] +} diff --git a/node_modules/minimist/.eslintrc b/node_modules/minimist/.eslintrc new file mode 100644 index 000000000..bd1a5e046 --- /dev/null +++ b/node_modules/minimist/.eslintrc @@ -0,0 +1,29 @@ +{ + "root": true, + + "extends": "@ljharb/eslint-config/node/0.4", + + "rules": { + "array-element-newline": 0, + "complexity": 0, + "func-style": [2, "declaration"], + "max-lines-per-function": 0, + "max-nested-callbacks": 1, + "max-statements-per-line": 1, + "max-statements": 0, + "multiline-comment-style": 0, + "no-continue": 1, + "no-param-reassign": 1, + "no-restricted-syntax": 1, + "object-curly-newline": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "camelcase": 0, + }, + }, + ] +} diff --git a/node_modules/minimist/.github/FUNDING.yml b/node_modules/minimist/.github/FUNDING.yml new file mode 100644 index 000000000..a9366222e --- /dev/null +++ b/node_modules/minimist/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/minimist +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/minimist/.nycrc b/node_modules/minimist/.nycrc new file mode 100644 index 000000000..55c3d2936 --- /dev/null +++ b/node_modules/minimist/.nycrc @@ -0,0 +1,14 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "example", + "test" + ] +} diff --git a/node_modules/minimist/CHANGELOG.md b/node_modules/minimist/CHANGELOG.md new file mode 100644 index 000000000..c9a1e15e6 --- /dev/null +++ b/node_modules/minimist/CHANGELOG.md @@ -0,0 +1,298 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.8](https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] Fix long option followed by single dash [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) +- [Fix] Fix handling of short option with non-trivial equals [`#5`](https://github.com/minimistjs/minimist/issues/5) +- [Tests] Remove duplicate test [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- Merge tag 'v0.2.3' [`a026794`](https://github.com/minimistjs/minimist/commit/a0267947c7870fc5847cf2d437fbe33f392767da) +- [eslint] fix indentation and whitespace [`5368ca4`](https://github.com/minimistjs/minimist/commit/5368ca4147e974138a54cc0dc4cea8f756546b70) +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`62fde7d`](https://github.com/minimistjs/minimist/commit/62fde7d935f83417fb046741531a9e2346a36976) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`3124ed3`](https://github.com/minimistjs/minimist/commit/3124ed3e46306301ebb3c834874ce0241555c2c4) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) +- [actions] Avoid 0.6 tests due to build failures [`ba92fe6`](https://github.com/minimistjs/minimist/commit/ba92fe6ebbdc0431cca9a2ea8f27beb492f5e4ec) +- [Dev Deps] update `tape` [`950eaa7`](https://github.com/minimistjs/minimist/commit/950eaa74f112e04d23e9c606c67472c46739b473) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) +- Merge tag 'v0.2.2' [`980d7ac`](https://github.com/minimistjs/minimist/commit/980d7ac61a0b4bd552711251ac107d506b23e41f) + +## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`0ebf4eb`](https://github.com/minimistjs/minimist/commit/0ebf4ebcd5f7787a5524d31a849ef41316b83c3c) +- [actions] add reusable workflows [`e115b63`](https://github.com/minimistjs/minimist/commit/e115b63fa9d3909f33b00a2db647ff79068388de) +- [eslint] add eslint; rules to enable later are warnings [`f58745b`](https://github.com/minimistjs/minimist/commit/f58745b9bb84348e1be72af7dbba5840c7c13013) +- [Dev Deps] switch from `covert` to `nyc` [`ab03356`](https://github.com/minimistjs/minimist/commit/ab033567b9c8b31117cb026dc7f1e592ce455c65) +- [readme] rename and add badges [`236f4a0`](https://github.com/minimistjs/minimist/commit/236f4a07e4ebe5ee44f1496ec6974991ab293ffd) +- [meta] create FUNDING.yml; add `funding` in package.json [`783a49b`](https://github.com/minimistjs/minimist/commit/783a49bfd47e8335d3098a8cac75662cf71eb32a) +- [meta] use `npmignore` to autogenerate an npmignore file [`f81ece6`](https://github.com/minimistjs/minimist/commit/f81ece6aaec2fa14e69ff4f1e0407a8c4e2635a2) +- Only apps should have lockfiles [`56cad44`](https://github.com/minimistjs/minimist/commit/56cad44c7f879b9bb5ec18fcc349308024a89bfc) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`49c5f9f`](https://github.com/minimistjs/minimist/commit/49c5f9fb7e6a92db9eb340cc679de92fb3aacded) +- [Tests] add `aud` in `posttest` [`228ae93`](https://github.com/minimistjs/minimist/commit/228ae938f3cd9db9dfd8bd7458b076a7b2aef280) +- [meta] add `safe-publish-latest` [`01fc23f`](https://github.com/minimistjs/minimist/commit/01fc23f5104f85c75059972e01dd33796ab529ff) +- [meta] update repo URLs [`6b164c7`](https://github.com/minimistjs/minimist/commit/6b164c7d68e0b6bf32f894699effdfb7c63041dd) + +## [v1.2.6](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6) - 2022-03-21 + +### Commits + +- test from prototype pollution PR [`bc8ecee`](https://github.com/minimistjs/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb) +- isConstructorOrProto adapted from PR [`c2b9819`](https://github.com/minimistjs/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d) +- security notice for additional prototype pollution issue [`ef88b93`](https://github.com/minimistjs/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2) + +## [v1.2.5](https://github.com/minimistjs/minimist/compare/v1.2.4...v1.2.5) - 2020-03-12 + +## [v1.2.4](https://github.com/minimistjs/minimist/compare/v1.2.3...v1.2.4) - 2020-03-11 + +### Commits + +- security notice [`4cf1354`](https://github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11f) +- additional test for constructor prototype pollution [`1043d21`](https://github.com/minimistjs/minimist/commit/1043d212c3caaf871966e710f52cfdf02f9eea4b) + +## [v1.2.3](https://github.com/minimistjs/minimist/compare/v1.2.2...v1.2.3) - 2020-03-10 + +### Commits + +- more failing proto pollution tests [`13c01a5`](https://github.com/minimistjs/minimist/commit/13c01a5327736903704984b7f65616b8476850cc) +- even more aggressive checks for protocol pollution [`38a4d1c`](https://github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9ab) + +## [v1.2.2](https://github.com/minimistjs/minimist/compare/v1.2.1...v1.2.2) - 2020-03-10 + +### Commits + +- failing test for protocol pollution [`0efed03`](https://github.com/minimistjs/minimist/commit/0efed0340ec8433638758f7ca0c77cb20a0bfbab) +- cleanup [`67d3722`](https://github.com/minimistjs/minimist/commit/67d3722413448d00a62963d2d30c34656a92d7e2) +- console.dir -> console.log [`47acf72`](https://github.com/minimistjs/minimist/commit/47acf72c715a630bf9ea013867f47f1dd69dfc54) +- don't assign onto __proto__ [`63e7ed0`](https://github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94) + +## [v1.2.1](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.1) - 2020-03-10 + +### Merged + +- move the `opts['--']` example back where it belongs [`#63`](https://github.com/minimistjs/minimist/pull/63) + +### Commits + +- add test [`6be5dae`](https://github.com/minimistjs/minimist/commit/6be5dae35a32a987bcf4137fcd6c19c5200ee909) +- fix bad boolean regexp [`ac3fc79`](https://github.com/minimistjs/minimist/commit/ac3fc796e63b95128fdbdf67ea7fad71bd59aa76) + +## [v1.2.0](https://github.com/minimistjs/minimist/compare/v1.1.3...v1.2.0) - 2015-08-24 + +### Commits + +- failing -k=v short test [`63416b8`](https://github.com/minimistjs/minimist/commit/63416b8cd1d0d70e4714564cce465a36e4dd26d7) +- kv short fix [`6bbe145`](https://github.com/minimistjs/minimist/commit/6bbe14529166245e86424f220a2321442fe88dc3) +- failing kv short test [`f72ab7f`](https://github.com/minimistjs/minimist/commit/f72ab7f4572adc52902c9b6873cc969192f01b10) +- fixed kv test [`f5a48c3`](https://github.com/minimistjs/minimist/commit/f5a48c3e50e40ca54f00c8e84de4b4d6e9897fa8) +- enforce space between arg key and value [`86b321a`](https://github.com/minimistjs/minimist/commit/86b321affe648a8e016c095a4f0efa9d9074f502) + +## [v1.1.3](https://github.com/minimistjs/minimist/compare/v1.1.2...v1.1.3) - 2015-08-06 + +### Commits + +- add failing test - boolean alias array [`0fa3c5b`](https://github.com/minimistjs/minimist/commit/0fa3c5b3dd98551ddecf5392831b4c21211743fc) +- fix boolean values with multiple aliases [`9c0a6e7`](https://github.com/minimistjs/minimist/commit/9c0a6e7de25a273b11bbf9a7464f0bd833779795) + +## [v1.1.2](https://github.com/minimistjs/minimist/compare/v1.1.1...v1.1.2) - 2015-07-22 + +### Commits + +- Convert boolean arguments to boolean values [`8f3dc27`](https://github.com/minimistjs/minimist/commit/8f3dc27cf833f1d54671b6d0bcb55c2fe19672a9) +- use non-ancient npm, node 0.12 and iojs [`61ed1d0`](https://github.com/minimistjs/minimist/commit/61ed1d034b9ec7282764ce76f3992b1a0b4906ae) +- an older npm for 0.8 [`25cf778`](https://github.com/minimistjs/minimist/commit/25cf778b1220e7838a526832ad6972f75244054f) + +## [v1.1.1](https://github.com/minimistjs/minimist/compare/v1.1.0...v1.1.1) - 2015-03-10 + +### Commits + +- check that they type of a value is a boolean, not just that it is currently set to a boolean [`6863198`](https://github.com/minimistjs/minimist/commit/6863198e36139830ff1f20ffdceaddd93f2c1db9) +- upgrade tape, fix type issues from old tape version [`806712d`](https://github.com/minimistjs/minimist/commit/806712df91604ed02b8e39aa372b84aea659ee34) +- test for setting a boolean to a null default [`8c444fe`](https://github.com/minimistjs/minimist/commit/8c444fe89384ded7d441c120915ea60620b01dd3) +- if the previous value was a boolean, without an default (or with an alias) don't make an array either [`e5f419a`](https://github.com/minimistjs/minimist/commit/e5f419a3b5b3bc3f9e5ac71b7040621af70ed2dd) + +## [v1.1.0](https://github.com/minimistjs/minimist/compare/v1.0.0...v1.1.0) - 2014-08-10 + +### Commits + +- add support for handling "unknown" options not registered with the parser. [`6f3cc5d`](https://github.com/minimistjs/minimist/commit/6f3cc5d4e84524932a6ef2ce3592acc67cdd4383) +- reformat package.json [`02ed371`](https://github.com/minimistjs/minimist/commit/02ed37115194d3697ff358e8e25e5e66bab1d9f8) +- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df) +- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498) + +## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.3...v1.0.0) - 2014-08-10 + +### Commits + +- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9) +- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e) + +## [v0.2.3](https://github.com/minimistjs/minimist/compare/v0.2.2...v0.2.3) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) + +## [v0.2.2](https://github.com/minimistjs/minimist/compare/v0.2.1...v0.2.2) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) + +## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12 + +## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19 + +### Commits + +- support all-boolean mode [`450a97f`](https://github.com/minimistjs/minimist/commit/450a97f6e2bc85c7a4a13185c19a818d9a5ebe69) + +## [v0.1.0](https://github.com/minimistjs/minimist/compare/v0.0.10...v0.1.0) - 2014-05-12 + +### Commits + +- Provide a mechanism to segregate -- arguments [`ce4a1e6`](https://github.com/minimistjs/minimist/commit/ce4a1e63a7e8d5ab88d2a3768adefa6af98a445a) +- documented argv['--'] [`14db0e6`](https://github.com/minimistjs/minimist/commit/14db0e6dbc6d2b9e472adaa54dad7004b364634f) +- Adding a test-case for notFlags segregation [`715c1e3`](https://github.com/minimistjs/minimist/commit/715c1e3714be223f998f6c537af6b505f0236c16) + +## [v0.0.10](https://github.com/minimistjs/minimist/compare/v0.0.9...v0.0.10) - 2014-05-11 + +### Commits + +- dedicated boolean test [`46e448f`](https://github.com/minimistjs/minimist/commit/46e448f9f513cfeb2bcc8b688b9b47ba1e515c2b) +- dedicated num test [`9bf2d36`](https://github.com/minimistjs/minimist/commit/9bf2d36f1d3b8795be90b8f7de0a937f098aa394) +- aliased values treated as strings [`1ab743b`](https://github.com/minimistjs/minimist/commit/1ab743bad4484d69f1259bed42f9531de01119de) +- cover the case of already numbers, at 100% coverage [`b2bb044`](https://github.com/minimistjs/minimist/commit/b2bb04436599d77a2ce029e8e555e25b3aa55d13) +- another test for higher coverage [`3662624`](https://github.com/minimistjs/minimist/commit/3662624be976d5489d486a856849c048d13be903) + +## [v0.0.9](https://github.com/minimistjs/minimist/compare/v0.0.8...v0.0.9) - 2014-05-08 + +### Commits + +- Eliminate `longest` fn. [`824f642`](https://github.com/minimistjs/minimist/commit/824f642038d1b02ede68b6261d1d65163390929a) + +## [v0.0.8](https://github.com/minimistjs/minimist/compare/v0.0.7...v0.0.8) - 2014-02-20 + +### Commits + +- return '' if flag is string and empty [`fa63ed4`](https://github.com/minimistjs/minimist/commit/fa63ed4651a4ef4eefddce34188e0d98d745a263) +- handle joined single letters [`66c248f`](https://github.com/minimistjs/minimist/commit/66c248f0241d4d421d193b022e9e365f11178534) + +## [v0.0.7](https://github.com/minimistjs/minimist/compare/v0.0.6...v0.0.7) - 2014-02-08 + +### Commits + +- another swap of .test for .match [`d1da408`](https://github.com/minimistjs/minimist/commit/d1da40819acbe846d89a5c02721211e3c1260dde) + +## [v0.0.6](https://github.com/minimistjs/minimist/compare/v0.0.5...v0.0.6) - 2014-02-08 + +### Commits + +- use .test() instead of .match() to not crash on non-string values in the arguments array [`7e0d1ad`](https://github.com/minimistjs/minimist/commit/7e0d1add8c9e5b9b20a4d3d0f9a94d824c578da1) + +## [v0.0.5](https://github.com/minimistjs/minimist/compare/v0.0.4...v0.0.5) - 2013-09-18 + +### Commits + +- Improve '--' handling. [`b11822c`](https://github.com/minimistjs/minimist/commit/b11822c09cc9d2460f30384d12afc0b953c037a4) + +## [v0.0.4](https://github.com/minimistjs/minimist/compare/v0.0.3...v0.0.4) - 2013-09-17 + +## [v0.0.3](https://github.com/minimistjs/minimist/compare/v0.0.2...v0.0.3) - 2013-09-12 + +### Commits + +- failing test for single dash preceeding a double dash [`b465514`](https://github.com/minimistjs/minimist/commit/b465514b82c9ae28972d714facd951deb2ad762b) +- fix for the dot test [`6a095f1`](https://github.com/minimistjs/minimist/commit/6a095f1d364c8fab2d6753d2291a0649315d297a) + +## [v0.0.2](https://github.com/minimistjs/minimist/compare/v0.0.1...v0.0.2) - 2013-08-28 + +### Commits + +- allow dotted aliases & defaults [`321c33e`](https://github.com/minimistjs/minimist/commit/321c33e755485faaeb44eeb1c05d33b2e0a5a7c4) +- use a better version of ff [`e40f611`](https://github.com/minimistjs/minimist/commit/e40f61114cf7be6f7947f7b3eed345853a67dbbb) + +## [v0.0.1](https://github.com/minimistjs/minimist/compare/v0.0.0...v0.0.1) - 2013-06-25 + +### Commits + +- remove trailing commas [`6ff0fa0`](https://github.com/minimistjs/minimist/commit/6ff0fa055064f15dbe06d50b89d5173a6796e1db) + +## v0.0.0 - 2013-06-25 + +### Commits + +- half of the parse test ported [`3079326`](https://github.com/minimistjs/minimist/commit/307932601325087de6cf94188eb798ffc4f3088a) +- stripped down code and a passing test from optimist [`7cced88`](https://github.com/minimistjs/minimist/commit/7cced88d82e399d1a03ed23eb667f04d3f320d10) +- ported parse tests completely over [`9448754`](https://github.com/minimistjs/minimist/commit/944875452e0820df6830b1408c26a0f7d3e1db04) +- docs, package.json [`a5bf46a`](https://github.com/minimistjs/minimist/commit/a5bf46ac9bb3bd114a9c340276c62c1091e538d5) +- move more short tests into short.js [`503edb5`](https://github.com/minimistjs/minimist/commit/503edb5c41d89c0d40831ee517154fc13b0f18b9) +- default bool test was wrong, not the code [`1b9f5db`](https://github.com/minimistjs/minimist/commit/1b9f5db4741b49962846081b68518de824992097) +- passing long tests ripped out of parse.js [`7972c4a`](https://github.com/minimistjs/minimist/commit/7972c4aff1f4803079e1668006658e2a761a0428) +- badges [`84c0370`](https://github.com/minimistjs/minimist/commit/84c037063664d42878aace715fe6572ce01b6f3b) +- all the tests now ported, some failures [`64239ed`](https://github.com/minimistjs/minimist/commit/64239edfe92c711c4eb0da254fcdfad2a5fdb605) +- failing short test [`f8a5341`](https://github.com/minimistjs/minimist/commit/f8a534112dd1138d2fad722def56a848480c446f) +- fixed the numeric test [`6b034f3`](https://github.com/minimistjs/minimist/commit/6b034f37c79342c60083ed97fd222e16928aac51) diff --git a/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE new file mode 100644 index 000000000..ee27ba4b4 --- /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/README.md b/node_modules/minimist/README.md new file mode 100644 index 000000000..74da3234b --- /dev/null +++ b/node_modules/minimist/README.md @@ -0,0 +1,121 @@ +# minimist [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +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.6 or later: + +* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) +* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) + +# 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 + +[package-url]: https://npmjs.org/package/minimist +[npm-version-svg]: https://versionbadg.es/minimistjs/minimist.svg +[npm-badge-png]: https://nodei.co/npm/minimist.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/minimist.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/minimist.svg +[downloads-url]: https://npm-stat.com/charts.html?package=minimist +[codecov-image]: https://codecov.io/gh/minimistjs/minimist/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/minimistjs/minimist/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/minimistjs/minimist +[actions-url]: https://github.com/minimistjs/minimist/actions diff --git a/node_modules/minimist/example/parse.js b/node_modules/minimist/example/parse.js new file mode 100644 index 000000000..9d90ffb26 --- /dev/null +++ b/node_modules/minimist/example/parse.js @@ -0,0 +1,4 @@ +'use strict'; + +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 000000000..f020f3940 --- /dev/null +++ b/node_modules/minimist/index.js @@ -0,0 +1,263 @@ +'use strict'; + +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); +} + +function isConstructorOrProto(obj, key) { + return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__'; +} + +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 = {}; + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + 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]) { + [].concat(aliases[key]).forEach(function (k) { + flags.strings[k] = true; + }); + } + }); + + var defaults = opts.default || {}; + + var argv = { _: [] }; + + function argDefined(key, arg) { + return (flags.allBools && (/^--[^=]+$/).test(arg)) + || flags.strings[key] + || flags.bools[key] + || aliases[key]; + } + + function setKey(obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length - 1; i++) { + var key = keys[i]; + if (isConstructorOrProto(o, key)) { 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 lastKey = keys[keys.length - 1]; + if (isConstructorOrProto(o, lastKey)) { return; } + if ( + o === Object.prototype + || o === Number.prototype + || o === String.prototype + ) { + o = {}; + } + if (o === Array.prototype) { o = []; } + if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') { + o[lastKey] = value; + } else if (Array.isArray(o[lastKey])) { + o[lastKey].push(value); + } else { + o[lastKey] = [o[lastKey], value]; + } + } + + 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); + }); + } + + 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('--')); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var key; + var next; + + 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]*)$/); + key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } else if ((/^--no-.+/).test(arg)) { + key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } else if ((/^--.+/).test(arg)) { + key = arg.match(/^--(.+)/)[1]; + next = args[i + 1]; + if ( + next !== undefined + && !(/^(-|--)[^-]/).test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, next, arg); + i += 1; + } else if ((/^(true|false)$/).test(next)) { + setArg(key, next === 'true', arg); + i += 1; + } 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++) { + next = arg.slice(j + 2); + + if (next === '-') { + setArg(letters[j], next, arg); + continue; + } + + if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') { + setArg(letters[j], next.slice(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); + } + } + + 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 += 1; + } else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) { + setArg(key, args[i + 1] === 'true', arg); + i += 1; + } 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 (k) { + if (!hasKey(argv, k.split('.'))) { + setKey(argv, k.split('.'), defaults[k]); + + (aliases[k] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[k]); + }); + } + }); + + if (opts['--']) { + argv['--'] = notFlags.slice(); + } else { + notFlags.forEach(function (k) { + argv._.push(k); + }); + } + + return argv; +}; diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json new file mode 100644 index 000000000..c10a33444 --- /dev/null +++ b/node_modules/minimist/package.json @@ -0,0 +1,75 @@ +{ + "name": "minimist", + "version": "1.2.8", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.1", + "aud": "^2.0.2", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.3" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/minimistjs/minimist.git" + }, + "homepage": "https://github.com/minimistjs/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js new file mode 100644 index 000000000..befa0c997 --- /dev/null +++ b/node_modules/minimist/test/all_bool.js @@ -0,0 +1,34 @@ +'use strict'; + +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 000000000..e58d47e44 --- /dev/null +++ b/node_modules/minimist/test/bool.js @@ -0,0 +1,177 @@ +'use strict'; + +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 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(); +}); diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js new file mode 100644 index 000000000..707881771 --- /dev/null +++ b/node_modules/minimist/test/dash.js @@ -0,0 +1,43 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(6); + t.deepEqual(parse(['-n', '-']), { n: '-', _: [] }); + t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] }); + 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(2); + 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'] } + ); +}); + +test('--- option value', function (t) { + // A multi-dash value is largely an edge case, but check the behaviour is as expected, + // and in particular the same for short option and long option (as made consistent in Jan 2023). + t.plan(2); + t.deepEqual(parse(['-n', '---']), { n: '---', _: [] }); + t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] }); +}); + diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js new file mode 100644 index 000000000..4e9f6250f --- /dev/null +++ b/node_modules/minimist/test/default_bool.js @@ -0,0 +1,37 @@ +'use strict'; + +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 argvLong = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argvLong.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 000000000..126ff033b --- /dev/null +++ b/node_modules/minimist/test/dotted.js @@ -0,0 +1,24 @@ +'use strict'; + +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 000000000..6d1b53a7a --- /dev/null +++ b/node_modules/minimist/test/kv_short.js @@ -0,0 +1,32 @@ +'use strict'; + +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', _: [] }); +}); + +test('short with embedded equals -k=a=b', function (t) { + t.plan(1); + + var argv = parse(['-k=a=b']); + t.deepEqual(argv, { k: 'a=b', _: [] }); +}); + +test('short with later equals like -ab=c', function (t) { + t.plan(1); + + var argv = parse(['-ab=c']); + t.deepEqual(argv, { a: true, b: 'c', _: [] }); +}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js new file mode 100644 index 000000000..9fef51f1f --- /dev/null +++ b/node_modules/minimist/test/long.js @@ -0,0 +1,33 @@ +'use strict'; + +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 000000000..074393eca --- /dev/null +++ b/node_modules/minimist/test/num.js @@ -0,0 +1,38 @@ +'use strict'; + +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 000000000..65d9d9092 --- /dev/null +++ b/node_modules/minimist/test/parse.js @@ -0,0 +1,209 @@ +'use strict'; + +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'); + + var z = parse(['-s123'], { + alias: { str: ['s', 'S'] }, + string: ['str'], + }); + + t.deepEqual( + z, + { _: [], s: '123', S: '123', str: '123' }, + 'opt.string works with multiple aliases' + ); + 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 000000000..32965d130 --- /dev/null +++ b/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,11 @@ +'use strict'; + +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 000000000..6e629dd34 --- /dev/null +++ b/node_modules/minimist/test/proto.js @@ -0,0 +1,64 @@ +'use strict'; + +/* eslint no-proto: 0 */ + +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(); +}); + +test('proto pollution (constructor function)', function (t) { + var argv = parse(['--_.concat.constructor.prototype.y', '123']); + function fnToBeTested() {} + t.equal(fnToBeTested.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +// powered by snyk - https://github.com/backstage/backstage/issues/10343 +test('proto pollution (constructor function) snyk', function (t) { + var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); + t.equal(function () {}.foo, 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 000000000..4a7b84385 --- /dev/null +++ b/node_modules/minimist/test/short.js @@ -0,0 +1,69 @@ +'use strict'; + +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 000000000..52a6a9190 --- /dev/null +++ b/node_modules/minimist/test/stop_early.js @@ -0,0 +1,17 @@ +'use strict'; + +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 000000000..4f2e0ca44 --- /dev/null +++ b/node_modules/minimist/test/unknown.js @@ -0,0 +1,104 @@ +'use strict'; + +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, + }; + parse(aliased, opts); + 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, + }; + parse(aliased, opts); + 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, + }; + parse(aliased, opts); + 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 000000000..4fdaf1d39 --- /dev/null +++ b/node_modules/minimist/test/whitespace.js @@ -0,0 +1,10 @@ +'use strict'; + +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/mkdirp/LICENSE b/node_modules/mkdirp/LICENSE new file mode 100644 index 000000000..432d1aeb0 --- /dev/null +++ b/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 license: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/mkdirp/index.js b/node_modules/mkdirp/index.js new file mode 100644 index 000000000..0890ac3bd --- /dev/null +++ b/node_modules/mkdirp/index.js @@ -0,0 +1,102 @@ +var path = require('path'); +var fs = require('fs'); +var _0777 = parseInt('0777', 8); + +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + +function mkdirP (p, opts, f, made) { + if (typeof opts === 'function') { + f = opts; + opts = {}; + } + else if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 + } + if (!made) made = null; + + var cb = f || /* istanbul ignore next */ function () {}; + p = path.resolve(p); + + xfs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + /* istanbul ignore if */ + if (path.dirname(p) === p) return cb(er); + mkdirP(path.dirname(p), opts, function (er, made) { + /* istanbul ignore if */ + if (er) cb(er, made); + else mkdirP(p, opts, cb, made); + }); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + } + }); +} + +mkdirP.sync = function sync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 + } + if (!made) made = null; + + p = path.resolve(p); + + try { + xfs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = xfs.statSync(p); + } + catch (err1) /* istanbul ignore next */ { + throw err0; + } + /* istanbul ignore if */ + if (!stat.isDirectory()) throw err0; + break; + } + } + + return made; +}; diff --git a/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json new file mode 100644 index 000000000..951e58da9 --- /dev/null +++ b/node_modules/mkdirp/package.json @@ -0,0 +1,33 @@ +{ + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "0.5.6", + "publishConfig": { + "tag": "legacy" + }, + "author": "James Halliday (http://substack.net)", + "main": "index.js", + "keywords": [ + "mkdir", + "directory" + ], + "repository": { + "type": "git", + "url": "https://github.com/substack/node-mkdirp.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "minimist": "^1.2.6" + }, + "devDependencies": { + "tap": "^16.0.1" + }, + "bin": "bin/cmd.js", + "license": "MIT", + "files": [ + "bin", + "index.js" + ] +} diff --git a/node_modules/mkdirp/readme.markdown b/node_modules/mkdirp/readme.markdown new file mode 100644 index 000000000..fc314bfbd --- /dev/null +++ b/node_modules/mkdirp/readme.markdown @@ -0,0 +1,100 @@ +# mkdirp + +Like `mkdir -p`, but in node.js! + +[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) + +# example + +## pow.js + +```js +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); +``` + +Output + +``` +pow! +``` + +And now /tmp/foo/bar/baz exists, huzzah! + +# methods + +```js +var mkdirp = require('mkdirp'); +``` + +## mkdirp(dir, opts, cb) + +Create a new directory and any necessary subdirectories at `dir` with octal +permission string `opts.mode`. If `opts` is a non-object, it will be treated as +the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777`. + +`cb(err, made)` fires with the error or the first directory `made` +that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and +`opts.fs.stat(path, cb)`. + +## mkdirp.sync(dir, opts) + +Synchronously create a new directory and any necessary subdirectories at `dir` +with octal permission string `opts.mode`. If `opts` is a non-object, it will be +treated as the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777`. + +Returns the first directory that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and +`opts.fs.statSync(path)`. + +# usage + +This package also ships with a `mkdirp` command. + +``` +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + +``` + +# install + +With [npm](http://npmjs.org) do: + +``` +npm install mkdirp +``` + +to get the library, or + +``` +npm install -g mkdirp +``` + +to get the command. + +# license + +MIT diff --git a/node_modules/ms/index.js b/node_modules/ms/index.js new file mode 100644 index 000000000..ea734fb73 --- /dev/null +++ b/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/ms/license.md b/node_modules/ms/license.md new file mode 100644 index 000000000..fa5d39b62 --- /dev/null +++ b/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Vercel, 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 000000000..49971890d --- /dev/null +++ b/node_modules/ms/package.json @@ -0,0 +1,38 @@ +{ + "name": "ms", + "version": "2.1.3", + "description": "Tiny millisecond conversion utility", + "repository": "vercel/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.18.2", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1", + "prettier": "2.0.5" + } +} diff --git a/node_modules/ms/readme.md b/node_modules/ms/readme.md new file mode 100644 index 000000000..0fc1abb3b --- /dev/null +++ b/node_modules/ms/readme.md @@ -0,0 +1,59 @@ +# ms + +![CI](https://github.com/vercel/ms/workflows/CI/badge.svg) + +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/normalize-package-data/AUTHORS b/node_modules/normalize-package-data/AUTHORS new file mode 100644 index 000000000..66282ba1d --- /dev/null +++ b/node_modules/normalize-package-data/AUTHORS @@ -0,0 +1,4 @@ +# Names sorted by how much code was originally theirs. +Isaac Z. Schlueter +Meryn Stol +Robert Kowalski diff --git a/node_modules/normalize-package-data/LICENSE b/node_modules/normalize-package-data/LICENSE new file mode 100644 index 000000000..6ed662cd5 --- /dev/null +++ b/node_modules/normalize-package-data/LICENSE @@ -0,0 +1,30 @@ +This package contains code originally written by Isaac Z. Schlueter. +Used with permission. + +Copyright (c) Meryn Stol ("Author") +All rights reserved. + +The BSD License + +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 AUTHOR 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 AUTHOR 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/normalize-package-data/README.md b/node_modules/normalize-package-data/README.md new file mode 100644 index 000000000..d2bd7bc7f --- /dev/null +++ b/node_modules/normalize-package-data/README.md @@ -0,0 +1,106 @@ +# normalize-package-data [![Build Status](https://travis-ci.org/npm/normalize-package-data.png?branch=master)](https://travis-ci.org/npm/normalize-package-data) + +normalize-package-data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry. + +normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools. + +## Installation + +``` +npm install normalize-package-data +``` + +## Usage + +Basic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`. + +```javascript +normalizeData = require('normalize-package-data') +packageData = require("./package.json") +normalizeData(packageData) +// packageData is now normalized +``` + +#### Strict mode + +You may activate strict validation by passing true as the second argument. + +```javascript +normalizeData = require('normalize-package-data') +packageData = require("./package.json") +normalizeData(packageData, true) +// packageData is now normalized +``` + +If strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace. + +#### Warnings + +Optionally, you may pass a "warning" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data. + +```javascript +normalizeData = require('normalize-package-data') +packageData = require("./package.json") +warnFn = function(msg) { console.error(msg) } +normalizeData(packageData, warnFn) +// packageData is now normalized. Any number of warnings may have been logged. +``` + +You may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third. + +When `private` field is set to `true`, warnings will be suppressed. + +### Potential exceptions + +If the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback. + +## What normalization (currently) entails + +* The value of `name` field gets trimmed (unless in strict mode). +* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver). +* If `name` and/or `version` fields are missing, they are set to empty strings. +* If `files` field is not an array, it will be removed. +* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value. +* If `man` field is a string, it will become an array with the original string as its sole member. +* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`. +* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties. +* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`. +* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs. +* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched. +* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved. +* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shorcut was previously expanded to a URL. +* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`. +* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`. +* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git+https://github.com/[owner-name]/[repo-name].git +* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value. +* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. +* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed. +* If `homepage` field is not a string, it will be removed. +* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`. +* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]#readme . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. + +### Rules for name field + +If `name` field is given, the value of the name field must be a string. The string may not: + +* start with a period. +* contain the following characters: `/@\s+%` +* contain any characters that would need to be encoded for use in urls. +* resemble the word `node_modules` or `favicon.ico` (case doesn't matter). + +### Rules for version field + +If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver). + +### Rules for license field + +The `license` field should be a valid *SPDX license expression* or one of the special values allowed by [validate-npm-package-license](https://npmjs.com/package/validate-npm-package-license). See [documentation for the license field in package.json](https://docs.npmjs.com/files/package.json#license). + +## Credits + +This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson. + +## License + +normalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). +Copyright (c) 2013 Meryn Stol diff --git a/node_modules/normalize-package-data/package.json b/node_modules/normalize-package-data/package.json new file mode 100644 index 000000000..dea34bb7f --- /dev/null +++ b/node_modules/normalize-package-data/package.json @@ -0,0 +1,31 @@ +{ + "name": "normalize-package-data", + "version": "2.5.0", + "author": "Meryn Stol ", + "description": "Normalizes data that can be found in package.json files.", + "license": "BSD-2-Clause", + "repository": { + "type": "git", + "url": "git://github.com/npm/normalize-package-data.git" + }, + "main": "lib/normalize.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "devDependencies": { + "async": "^2.6.1", + "tap": "^12.4.0", + "underscore": "^1.8.3" + }, + "files": [ + "lib/*.js", + "lib/*.json", + "AUTHORS" + ] +} diff --git a/node_modules/number-is-nan/index.js b/node_modules/number-is-nan/index.js new file mode 100644 index 000000000..79be4b9cb --- /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 000000000..654d0bfe9 --- /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 000000000..d2f51d4b1 --- /dev/null +++ b/node_modules/number-is-nan/package.json @@ -0,0 +1,35 @@ +{ + "name": "number-is-nan", + "version": "1.0.1", + "description": "ES2015 Number.isNaN() ponyfill", + "license": "MIT", + "repository": "sindresorhus/number-is-nan", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "es2015", + "ecmascript", + "ponyfill", + "polyfill", + "shim", + "number", + "is", + "nan", + "not" + ], + "devDependencies": { + "ava": "*" + } +} diff --git a/node_modules/number-is-nan/readme.md b/node_modules/number-is-nan/readme.md new file mode 100644 index 000000000..246350871 --- /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-assign/index.js b/node_modules/object-assign/index.js new file mode 100644 index 000000000..0930cf889 --- /dev/null +++ b/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json new file mode 100644 index 000000000..503eb1e6d --- /dev/null +++ b/node_modules/object-assign/package.json @@ -0,0 +1,42 @@ +{ + "name": "object-assign", + "version": "4.1.1", + "description": "ES2015 `Object.assign()` ponyfill", + "license": "MIT", + "repository": "sindresorhus/object-assign", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava", + "bench": "matcha bench.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + } +} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md new file mode 100644 index 000000000..1be09d35c --- /dev/null +++ b/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/object-inspect/.eslintrc b/node_modules/object-inspect/.eslintrc new file mode 100644 index 000000000..21f903923 --- /dev/null +++ b/node_modules/object-inspect/.eslintrc @@ -0,0 +1,53 @@ +{ + "root": true, + "extends": "@ljharb", + "rules": { + "complexity": 0, + "func-style": [2, "declaration"], + "indent": [2, 4], + "max-lines": 1, + "max-lines-per-function": 1, + "max-params": [2, 4], + "max-statements": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": 0, + "no-param-reassign": 1, + "strict": 0, // TODO + }, + "overrides": [ + { + "files": ["test/**", "test-*", "example/**"], + "extends": "@ljharb/eslint-config/tests", + "rules": { + "id-length": 0, + }, + }, + { + "files": ["example/**"], + "rules": { + "no-console": 0, + }, + }, + { + "files": ["test/browser/**"], + "env": { + "browser": true, + }, + }, + { + "files": ["test/bigint*"], + "rules": { + "new-cap": [2, { "capIsNewExceptions": ["BigInt"] }], + }, + }, + { + "files": "index.js", + "globals": { + "HTMLElement": false, + }, + "rules": { + "no-use-before-define": 1, + }, + }, + ], +} diff --git a/node_modules/object-inspect/.github/FUNDING.yml b/node_modules/object-inspect/.github/FUNDING.yml new file mode 100644 index 000000000..730276bd1 --- /dev/null +++ b/node_modules/object-inspect/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/object-inspect +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/object-inspect/.nycrc b/node_modules/object-inspect/.nycrc new file mode 100644 index 000000000..58a5db783 --- /dev/null +++ b/node_modules/object-inspect/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "instrumentation": false, + "sourceMap": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "example", + "test", + "test-core-js.js" + ] +} diff --git a/node_modules/object-inspect/CHANGELOG.md b/node_modules/object-inspect/CHANGELOG.md new file mode 100644 index 000000000..bdf900274 --- /dev/null +++ b/node_modules/object-inspect/CHANGELOG.md @@ -0,0 +1,424 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.13.4](https://github.com/inspect-js/object-inspect/compare/v1.13.3...v1.13.4) - 2025-02-04 + +### Commits + +- [Fix] avoid being fooled by a `Symbol.toStringTag` [`fa5870d`](https://github.com/inspect-js/object-inspect/commit/fa5870da468a525d2f20193700f70752f506cbf7) +- [Tests] fix tests in node v6.0 - v6.4 [`2abfe1b`](https://github.com/inspect-js/object-inspect/commit/2abfe1bc3c69f9293c07c5cd65a9d7d87a628b84) +- [Dev Deps] update `es-value-fixtures`, `for-each`, `has-symbols` [`3edfb01`](https://github.com/inspect-js/object-inspect/commit/3edfb01cc8cce220fba0dfdfe2dc8bc955758cdd) + +## [v1.13.3](https://github.com/inspect-js/object-inspect/compare/v1.13.2...v1.13.3) - 2024-11-09 + +### Commits + +- [actions] split out node 10-20, and 20+ [`44395a8`](https://github.com/inspect-js/object-inspect/commit/44395a8fc1deda6718a5e125e86b9ffcaa1c7580) +- [Fix] `quoteStyle`: properly escape only the containing quotes [`5137f8f`](https://github.com/inspect-js/object-inspect/commit/5137f8f7bea69a7fc671bb683fd35f244f38fc52) +- [Refactor] clean up `quoteStyle` code [`450680c`](https://github.com/inspect-js/object-inspect/commit/450680cd50de4e689ee3b8e1d6db3a1bcf3fc18c) +- [Tests] add `quoteStyle` escaping tests [`e997c59`](https://github.com/inspect-js/object-inspect/commit/e997c595aeaea84fd98ca35d7e1c3b5ab3ae26e0) +- [Dev Deps] update `auto-changelog`, `es-value-fixtures`, `tape` [`d5a469c`](https://github.com/inspect-js/object-inspect/commit/d5a469c99ec07ccaeafc36ac4b36a93285086d48) +- [Tests] replace `aud` with `npm audit` [`fb7815f`](https://github.com/inspect-js/object-inspect/commit/fb7815f9b72cae277a04f65bbb0543f85b88be62) +- [Dev Deps] update `mock-property` [`11c817b`](https://github.com/inspect-js/object-inspect/commit/11c817bf10392aa017755962ba6bc89d731359ee) + +## [v1.13.2](https://github.com/inspect-js/object-inspect/compare/v1.13.1...v1.13.2) - 2024-06-21 + +### Commits + +- [readme] update badges [`8a51e6b`](https://github.com/inspect-js/object-inspect/commit/8a51e6bedaf389ec40cc4659e9df53e8543d176e) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`ef05f58`](https://github.com/inspect-js/object-inspect/commit/ef05f58c9761a41416ab907299bf0fa79517014b) +- [Dev Deps] update `error-cause`, `has-tostringtag`, `tape` [`c0c6c26`](https://github.com/inspect-js/object-inspect/commit/c0c6c26c44cee6671f7c5d43d2b91d27c5c00d90) +- [Fix] Don't throw when `global` is not defined [`d4d0965`](https://github.com/inspect-js/object-inspect/commit/d4d096570f7dbd0e03266a96de11d05eb7b63e0f) +- [meta] add missing `engines.node` [`17a352a`](https://github.com/inspect-js/object-inspect/commit/17a352af6fe1ba6b70a19081674231eb1a50c940) +- [Dev Deps] update `globalthis` [`9c08884`](https://github.com/inspect-js/object-inspect/commit/9c08884aa662a149e2f11403f413927736b97da7) +- [Dev Deps] update `error-cause` [`6af352d`](https://github.com/inspect-js/object-inspect/commit/6af352d7c3929a4cc4c55768c27bf547a5e900f4) +- [Dev Deps] update `npmignore` [`94e617d`](https://github.com/inspect-js/object-inspect/commit/94e617d38831722562fa73dff4c895746861d267) +- [Dev Deps] update `mock-property` [`2ac24d7`](https://github.com/inspect-js/object-inspect/commit/2ac24d7e58cd388ad093c33249e413e05bbfd6c3) +- [Dev Deps] update `tape` [`46125e5`](https://github.com/inspect-js/object-inspect/commit/46125e58f1d1dcfb170ed3d1ea69da550ea8d77b) + +## [v1.13.1](https://github.com/inspect-js/object-inspect/compare/v1.13.0...v1.13.1) - 2023-10-19 + +### Commits + +- [Fix] in IE 8, global can !== window despite them being prototypes of each other [`30d0859`](https://github.com/inspect-js/object-inspect/commit/30d0859dc4606cf75c2410edcd5d5c6355f8d372) + +## [v1.13.0](https://github.com/inspect-js/object-inspect/compare/v1.12.3...v1.13.0) - 2023-10-14 + +### Commits + +- [New] add special handling for the global object [`431bab2`](https://github.com/inspect-js/object-inspect/commit/431bab21a490ee51d35395966a504501e8c685da) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`fd4f619`](https://github.com/inspect-js/object-inspect/commit/fd4f6193562b4b0e95dcf5c0201b4e8cbbc4f58d) +- [Dev Deps] update `mock-property`, `tape` [`b453f6c`](https://github.com/inspect-js/object-inspect/commit/b453f6ceeebf8a1b738a1029754092e0367a4134) +- [Dev Deps] update `error-cause` [`e8ffc57`](https://github.com/inspect-js/object-inspect/commit/e8ffc577d73b92bb6a4b00c44f14e3319e374888) +- [Dev Deps] update `tape` [`054b8b9`](https://github.com/inspect-js/object-inspect/commit/054b8b9b98633284cf989e582450ebfbbe53503c) +- [Dev Deps] temporarily remove `aud` due to breaking change in transitive deps [`2476845`](https://github.com/inspect-js/object-inspect/commit/2476845e0678dd290c541c81cd3dec8420782c52) +- [Dev Deps] pin `glob`, since v10.3.8+ requires a broken `jackspeak` [`383fa5e`](https://github.com/inspect-js/object-inspect/commit/383fa5eebc0afd705cc778a4b49d8e26452e49a8) +- [Dev Deps] pin `jackspeak` since 2.1.2+ depends on npm aliases, which kill the install process in npm < 6 [`68c244c`](https://github.com/inspect-js/object-inspect/commit/68c244c5174cdd877e5dcb8ee90aa3f44b2f25be) + +## [v1.12.3](https://github.com/inspect-js/object-inspect/compare/v1.12.2...v1.12.3) - 2023-01-12 + +### Commits + +- [Fix] in eg FF 24, collections lack forEach [`75fc226`](https://github.com/inspect-js/object-inspect/commit/75fc22673c82d45f28322b1946bb0eb41b672b7f) +- [actions] update rebase action to use reusable workflow [`250a277`](https://github.com/inspect-js/object-inspect/commit/250a277a095e9dacc029ab8454dcfc15de549dcd) +- [Dev Deps] update `aud`, `es-value-fixtures`, `tape` [`66a19b3`](https://github.com/inspect-js/object-inspect/commit/66a19b3209ccc3c5ef4b34c3cb0160e65d1ce9d5) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `error-cause` [`c43d332`](https://github.com/inspect-js/object-inspect/commit/c43d3324b48384a16fd3dc444e5fc589d785bef3) +- [Tests] add `@pkgjs/support` to `postlint` [`e2618d2`](https://github.com/inspect-js/object-inspect/commit/e2618d22a7a3fa361b6629b53c1752fddc9c4d80) + +## [v1.12.2](https://github.com/inspect-js/object-inspect/compare/v1.12.1...v1.12.2) - 2022-05-26 + +### Commits + +- [Fix] use `util.inspect` for a custom inspection symbol method [`e243bf2`](https://github.com/inspect-js/object-inspect/commit/e243bf2eda6c4403ac6f1146fddb14d12e9646c1) +- [meta] add support info [`ca20ba3`](https://github.com/inspect-js/object-inspect/commit/ca20ba35713c17068ca912a86c542f5e8acb656c) +- [Fix] ignore `cause` in node v16.9 and v16.10 where it has a bug [`86aa553`](https://github.com/inspect-js/object-inspect/commit/86aa553a4a455562c2c56f1540f0bf857b9d314b) + +## [v1.12.1](https://github.com/inspect-js/object-inspect/compare/v1.12.0...v1.12.1) - 2022-05-21 + +### Commits + +- [Tests] use `mock-property` [`4ec8893`](https://github.com/inspect-js/object-inspect/commit/4ec8893ea9bfd28065ca3638cf6762424bf44352) +- [meta] use `npmignore` to autogenerate an npmignore file [`07f868c`](https://github.com/inspect-js/object-inspect/commit/07f868c10bd25a9d18686528339bb749c211fc9a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`b05244b`](https://github.com/inspect-js/object-inspect/commit/b05244b4f331e00c43b3151bc498041be77ccc91) +- [Dev Deps] update `@ljharb/eslint-config`, `error-cause`, `es-value-fixtures`, `functions-have-names`, `tape` [`d037398`](https://github.com/inspect-js/object-inspect/commit/d037398dcc5d531532e4c19c4a711ed677f579c1) +- [Fix] properly handle callable regexes in older engines [`848fe48`](https://github.com/inspect-js/object-inspect/commit/848fe48bd6dd0064ba781ee6f3c5e54a94144c37) + +## [v1.12.0](https://github.com/inspect-js/object-inspect/compare/v1.11.1...v1.12.0) - 2021-12-18 + +### Commits + +- [New] add `numericSeparator` boolean option [`2d2d537`](https://github.com/inspect-js/object-inspect/commit/2d2d537f5359a4300ce1c10241369f8024f89e11) +- [Robustness] cache more prototype methods [`191533d`](https://github.com/inspect-js/object-inspect/commit/191533da8aec98a05eadd73a5a6e979c9c8653e8) +- [New] ensure an Error’s `cause` is displayed [`53bc2ce`](https://github.com/inspect-js/object-inspect/commit/53bc2cee4e5a9cc4986f3cafa22c0685f340715e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`bc164b6`](https://github.com/inspect-js/object-inspect/commit/bc164b6e2e7d36b263970f16f54de63048b84a36) +- [Robustness] cache `RegExp.prototype.test` [`a314ab8`](https://github.com/inspect-js/object-inspect/commit/a314ab8271b905cbabc594c82914d2485a8daf12) +- [meta] fix auto-changelog settings [`5ed0983`](https://github.com/inspect-js/object-inspect/commit/5ed0983be72f73e32e2559997517a95525c7e20d) + +## [v1.11.1](https://github.com/inspect-js/object-inspect/compare/v1.11.0...v1.11.1) - 2021-12-05 + +### Commits + +- [meta] add `auto-changelog` [`7dbdd22`](https://github.com/inspect-js/object-inspect/commit/7dbdd228401d6025d8b7391476d88aee9ea9bbdf) +- [actions] reuse common workflows [`c8823bc`](https://github.com/inspect-js/object-inspect/commit/c8823bc0a8790729680709d45fb6e652432e91aa) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`7532b12`](https://github.com/inspect-js/object-inspect/commit/7532b120598307497b712890f75af8056f6d37a6) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`94abb5d`](https://github.com/inspect-js/object-inspect/commit/94abb5d4e745bf33253942dea86b3e538d2ff6c6) +- [actions] update codecov uploader [`5ed5102`](https://github.com/inspect-js/object-inspect/commit/5ed51025267a00e53b1341357315490ac4eb0874) +- [Dev Deps] update `eslint`, `tape` [`37b2ad2`](https://github.com/inspect-js/object-inspect/commit/37b2ad26c08d94bfd01d5d07069a0b28ef4e2ad7) +- [meta] add `sideEffects` flag [`d341f90`](https://github.com/inspect-js/object-inspect/commit/d341f905ef8bffa6a694cda6ddc5ba343532cd4f) + +## [v1.11.0](https://github.com/inspect-js/object-inspect/compare/v1.10.3...v1.11.0) - 2021-07-12 + +### Commits + +- [New] `customInspect`: add `symbol` option, to mimic modern util.inspect behavior [`e973a6e`](https://github.com/inspect-js/object-inspect/commit/e973a6e21f8140c5837cf25e9d89bdde88dc3120) +- [Dev Deps] update `eslint` [`05f1cb3`](https://github.com/inspect-js/object-inspect/commit/05f1cb3cbcfe1f238e8b51cf9bc294305b7ed793) + +## [v1.10.3](https://github.com/inspect-js/object-inspect/compare/v1.10.2...v1.10.3) - 2021-05-07 + +### Commits + +- [Fix] handle core-js Symbol shams [`4acfc2c`](https://github.com/inspect-js/object-inspect/commit/4acfc2c4b503498759120eb517abad6d51c9c5d6) +- [readme] update badges [`95c323a`](https://github.com/inspect-js/object-inspect/commit/95c323ad909d6cbabb95dd6015c190ba6db9c1f2) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`cb38f48`](https://github.com/inspect-js/object-inspect/commit/cb38f485de6ec7a95109b5a9bbd0a1deba2f6611) + +## [v1.10.2](https://github.com/inspect-js/object-inspect/compare/v1.10.1...v1.10.2) - 2021-04-17 + +### Commits + +- [Fix] use a robust check for a boxed Symbol [`87f12d6`](https://github.com/inspect-js/object-inspect/commit/87f12d6e69ce530be04659c81a4cd502943acac5) + +## [v1.10.1](https://github.com/inspect-js/object-inspect/compare/v1.10.0...v1.10.1) - 2021-04-17 + +### Commits + +- [Fix] use a robust check for a boxed bigint [`d5ca829`](https://github.com/inspect-js/object-inspect/commit/d5ca8298b6d2e5c7b9334a5b21b96ed95d225c91) + +## [v1.10.0](https://github.com/inspect-js/object-inspect/compare/v1.9.0...v1.10.0) - 2021-04-17 + +### Commits + +- [Tests] increase coverage [`d8abb8a`](https://github.com/inspect-js/object-inspect/commit/d8abb8a62c2f084919df994a433b346e0d87a227) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`4bfec2e`](https://github.com/inspect-js/object-inspect/commit/4bfec2e30aaef6ddef6cbb1448306f9f8b9520b7) +- [New] respect `Symbol.toStringTag` on objects [`799b58f`](https://github.com/inspect-js/object-inspect/commit/799b58f536a45e4484633a8e9daeb0330835f175) +- [Fix] do not allow Symbol.toStringTag to masquerade as builtins [`d6c5b37`](https://github.com/inspect-js/object-inspect/commit/d6c5b37d7e94427796b82432fb0c8964f033a6ab) +- [New] add `WeakRef` support [`b6d898e`](https://github.com/inspect-js/object-inspect/commit/b6d898ee21868c780a7ee66b28532b5b34ed7f09) +- [meta] do not publish github action workflow files [`918cdfc`](https://github.com/inspect-js/object-inspect/commit/918cdfc4b6fe83f559ff6ef04fe66201e3ff5cbd) +- [meta] create `FUNDING.yml` [`0bb5fc5`](https://github.com/inspect-js/object-inspect/commit/0bb5fc516dbcd2cd728bd89cee0b580acc5ce301) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`22c8dc0`](https://github.com/inspect-js/object-inspect/commit/22c8dc0cac113d70f4781e49a950070923a671be) +- [meta] use `prepublishOnly` script for npm 7+ [`e52ee09`](https://github.com/inspect-js/object-inspect/commit/e52ee09e8050b8dbac94ef57f786675567728223) +- [Dev Deps] update `eslint` [`7c4e6fd`](https://github.com/inspect-js/object-inspect/commit/7c4e6fdedcd27cc980e13c9ad834d05a96f3d40c) + +## [v1.9.0](https://github.com/inspect-js/object-inspect/compare/v1.8.0...v1.9.0) - 2020-11-30 + +### Commits + +- [Tests] migrate tests to Github Actions [`d262251`](https://github.com/inspect-js/object-inspect/commit/d262251e13e16d3490b5473672f6b6d6ff86675d) +- [New] add enumerable own Symbols to plain object output [`ee60c03`](https://github.com/inspect-js/object-inspect/commit/ee60c033088cff9d33baa71e59a362a541b48284) +- [Tests] add passing tests [`01ac3e4`](https://github.com/inspect-js/object-inspect/commit/01ac3e4b5a30f97875a63dc9b1416b3bd626afc9) +- [actions] add "Require Allow Edits" action [`c2d7746`](https://github.com/inspect-js/object-inspect/commit/c2d774680cde4ca4af332d84d4121b26f798ba9e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `core-js` [`70058de`](https://github.com/inspect-js/object-inspect/commit/70058de1579fc54d1d15ed6c2dbe246637ce70ff) +- [Fix] hex characters in strings should be uppercased, to match node `assert` [`6ab8faa`](https://github.com/inspect-js/object-inspect/commit/6ab8faaa0abc08fe7a8e2afd8b39c6f1f0e00113) +- [Tests] run `nyc` on all tests [`4c47372`](https://github.com/inspect-js/object-inspect/commit/4c473727879ddc8e28b599202551ddaaf07b6210) +- [Tests] node 0.8 has an unpredictable property order; fix `groups` test by removing property [`f192069`](https://github.com/inspect-js/object-inspect/commit/f192069a978a3b60e6f0e0d45ac7df260ab9a778) +- [New] add enumerable properties to Function inspect result, per node’s `assert` [`fd38e1b`](https://github.com/inspect-js/object-inspect/commit/fd38e1bc3e2a1dc82091ce3e021917462eee64fc) +- [Tests] fix tests for node < 10, due to regex match `groups` [`2ac6462`](https://github.com/inspect-js/object-inspect/commit/2ac6462cc4f72eaa0b63a8cfee9aabe3008b2330) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`44b59e2`](https://github.com/inspect-js/object-inspect/commit/44b59e2676a7f825ef530dfd19dafb599e3b9456) +- [Robustness] cache `Symbol.prototype.toString` [`f3c2074`](https://github.com/inspect-js/object-inspect/commit/f3c2074d8f32faf8292587c07c9678ea931703dd) +- [Dev Deps] update `eslint` [`9411294`](https://github.com/inspect-js/object-inspect/commit/94112944b9245e3302e25453277876402d207e7f) +- [meta] `require-allow-edits` no longer requires an explicit github token [`36c0220`](https://github.com/inspect-js/object-inspect/commit/36c02205de3c2b0e84d53777c5c9fd54a36c48ab) +- [actions] update rebase checkout action to v2 [`55a39a6`](https://github.com/inspect-js/object-inspect/commit/55a39a64e944f19c6a7d8efddf3df27700f20d14) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`f59fd3c`](https://github.com/inspect-js/object-inspect/commit/f59fd3cf406c3a7c7ece140904a80bbc6bacfcca) +- [Dev Deps] update `eslint` [`a492bec`](https://github.com/inspect-js/object-inspect/commit/a492becec644b0155c9c4bc1caf6f9fac11fb2c7) + +## [v1.8.0](https://github.com/inspect-js/object-inspect/compare/v1.7.0...v1.8.0) - 2020-06-18 + +### Fixed + +- [New] add `indent` option [`#27`](https://github.com/inspect-js/object-inspect/issues/27) + +### Commits + +- [Tests] add codecov [`4324cbb`](https://github.com/inspect-js/object-inspect/commit/4324cbb1a2bd7710822a4151ff373570db22453e) +- [New] add `maxStringLength` option [`b3995cb`](https://github.com/inspect-js/object-inspect/commit/b3995cb71e15b5ee127a3094c43994df9d973502) +- [New] add `customInspect` option, to disable custom inspect methods [`28b9179`](https://github.com/inspect-js/object-inspect/commit/28b9179ee802bb3b90810100c11637db90c2fb6d) +- [Tests] add Date and RegExp tests [`3b28eca`](https://github.com/inspect-js/object-inspect/commit/3b28eca57b0367aeadffac604ea09e8bdae7d97b) +- [actions] add automatic rebasing / merge commit blocking [`0d9c6c0`](https://github.com/inspect-js/object-inspect/commit/0d9c6c044e83475ff0bfffb9d35b149834c83a2e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `tape`; add `aud` [`7c204f2`](https://github.com/inspect-js/object-inspect/commit/7c204f22b9e41bc97147f4d32d4cb045b17769a6) +- [readme] fix repo URLs, remove testling [`34ca9a0`](https://github.com/inspect-js/object-inspect/commit/34ca9a0dabfe75bd311f806a326fadad029909a3) +- [Fix] when truncating a deep array, note it as `[Array]` instead of just `[Object]` [`f74c82d`](https://github.com/inspect-js/object-inspect/commit/f74c82dd0b35386445510deb250f34c41be3ec0e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`1a8a5ea`](https://github.com/inspect-js/object-inspect/commit/1a8a5ea069ea2bee89d77caedad83ffa23d35711) +- [Fix] do not be fooled by a function’s own `toString` method [`7cb5c65`](https://github.com/inspect-js/object-inspect/commit/7cb5c657a976f94715c19c10556a30f15bb7d5d7) +- [patch] indicate explicitly that anon functions are anonymous, to match node [`81ebdd4`](https://github.com/inspect-js/object-inspect/commit/81ebdd4215005144074bbdff3f6bafa01407910a) +- [Dev Deps] loosen the `core-js` dep [`e7472e8`](https://github.com/inspect-js/object-inspect/commit/e7472e8e242117670560bd995830c2a4d12080f5) +- [Dev Deps] update `tape` [`699827e`](https://github.com/inspect-js/object-inspect/commit/699827e6b37258b5203c33c78c009bf4b0e6a66d) +- [meta] add `safe-publish-latest` [`c5d2868`](https://github.com/inspect-js/object-inspect/commit/c5d2868d6eb33c472f37a20f89ceef2787046088) +- [Dev Deps] update `@ljharb/eslint-config` [`9199501`](https://github.com/inspect-js/object-inspect/commit/919950195d486114ccebacbdf9d74d7f382693b0) + +## [v1.7.0](https://github.com/inspect-js/object-inspect/compare/v1.6.0...v1.7.0) - 2019-11-10 + +### Commits + +- [Tests] use shared travis-ci configs [`19899ed`](https://github.com/inspect-js/object-inspect/commit/19899edbf31f4f8809acf745ce34ad1ce1bfa63b) +- [Tests] add linting [`a00f057`](https://github.com/inspect-js/object-inspect/commit/a00f057d917f66ea26dd37769c6b810ec4af97e8) +- [Tests] lint last file [`2698047`](https://github.com/inspect-js/object-inspect/commit/2698047b58af1e2e88061598ef37a75f228dddf6) +- [Tests] up to `node` `v12.7`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`589e87a`](https://github.com/inspect-js/object-inspect/commit/589e87a99cadcff4b600e6a303418e9d922836e8) +- [New] add support for `WeakMap` and `WeakSet` [`3ddb3e4`](https://github.com/inspect-js/object-inspect/commit/3ddb3e4e0c8287130c61a12e0ed9c104b1549306) +- [meta] clean up license so github can detect it properly [`27527bb`](https://github.com/inspect-js/object-inspect/commit/27527bb801520c9610c68cc3b55d6f20a2bee56d) +- [Tests] cover `util.inspect.custom` [`36d47b9`](https://github.com/inspect-js/object-inspect/commit/36d47b9c59056a57ef2f1491602c726359561800) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `tape` [`b614eaa`](https://github.com/inspect-js/object-inspect/commit/b614eaac901da0e5c69151f534671f990a94cace) +- [Tests] fix coverage thresholds [`7b7b176`](https://github.com/inspect-js/object-inspect/commit/7b7b176e15f8bd6e8b2f261ff5a493c2fe78d9c2) +- [Tests] bigint tests now can run on unflagged node [`063af31`](https://github.com/inspect-js/object-inspect/commit/063af31ce9cd13c202e3b67c07ba06dc9b7c0f81) +- [Refactor] add early bailout to `isMap` and `isSet` checks [`fc51047`](https://github.com/inspect-js/object-inspect/commit/fc5104714a3671d37e225813db79470d6335683b) +- [meta] add `funding` field [`7f9953a`](https://github.com/inspect-js/object-inspect/commit/7f9953a113eec7b064a6393cf9f90ba15f1d131b) +- [Tests] Fix invalid strict-mode syntax with hexadecimal [`a8b5425`](https://github.com/inspect-js/object-inspect/commit/a8b542503b4af1599a275209a1a99f5fdedb1ead) +- [Dev Deps] update `@ljharb/eslint-config` [`98df157`](https://github.com/inspect-js/object-inspect/commit/98df1577314d9188a3fc3f17fdcf2fba697ae1bd) +- add copyright to LICENSE [`bb69fd0`](https://github.com/inspect-js/object-inspect/commit/bb69fd017a062d299e44da1f9b2c7dcd67f621e6) +- [Tests] use `npx aud` in `posttest` [`4838353`](https://github.com/inspect-js/object-inspect/commit/4838353593974cf7f905b9ef04c03c094f0cdbe2) +- [Tests] move `0.6` to allowed failures, because it won‘t build on travis [`1bff32a`](https://github.com/inspect-js/object-inspect/commit/1bff32aa52e8aea687f0856b28ba754b3e43ebf7) + +## [v1.6.0](https://github.com/inspect-js/object-inspect/compare/v1.5.0...v1.6.0) - 2018-05-02 + +### Commits + +- [New] add support for boxed BigInt primitives [`356c66a`](https://github.com/inspect-js/object-inspect/commit/356c66a410e7aece7162c8319880a5ef647beaa9) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9` [`c77b65b`](https://github.com/inspect-js/object-inspect/commit/c77b65bba593811b906b9ec57561c5cba92e2db3) +- [New] Add support for upcoming `BigInt` [`1ac548e`](https://github.com/inspect-js/object-inspect/commit/1ac548e4b27e26466c28c9a5e63e5d4e0591c31f) +- [Tests] run bigint tests in CI with --harmony-bigint flag [`d31b738`](https://github.com/inspect-js/object-inspect/commit/d31b73831880254b5c6cf5691cda9a149fbc5f04) +- [Dev Deps] update `core-js`, `tape` [`ff9eff6`](https://github.com/inspect-js/object-inspect/commit/ff9eff67113341ee1aaf80c1c22d683f43bfbccf) +- [Docs] fix example to use `safer-buffer` [`48cae12`](https://github.com/inspect-js/object-inspect/commit/48cae12a73ec6cacc955175bc56bbe6aee6a211f) + +## [v1.5.0](https://github.com/inspect-js/object-inspect/compare/v1.4.1...v1.5.0) - 2017-12-25 + +### Commits + +- [New] add `quoteStyle` option [`f5a72d2`](https://github.com/inspect-js/object-inspect/commit/f5a72d26edb3959b048f74c056ca7100a6b091e4) +- [Tests] add more test coverage [`30ebe4e`](https://github.com/inspect-js/object-inspect/commit/30ebe4e1fa943b99ecbb85be7614256d536e2759) +- [Tests] require 0.6 to pass [`99a008c`](https://github.com/inspect-js/object-inspect/commit/99a008ccace189a60fd7da18bf00e32c9572b980) + +## [v1.4.1](https://github.com/inspect-js/object-inspect/compare/v1.4.0...v1.4.1) - 2017-12-19 + +### Commits + +- [Tests] up to `node` `v9.3`, `v8.9`, `v6.12` [`6674476`](https://github.com/inspect-js/object-inspect/commit/6674476cc56acaac1bde96c84fed5ef631911906) +- [Fix] `inspect(Object(-0))` should be “Object(-0)”, not “Object(0)” [`d0a031f`](https://github.com/inspect-js/object-inspect/commit/d0a031f1cbb3024ee9982bfe364dd18a7e4d1bd3) + +## [v1.4.0](https://github.com/inspect-js/object-inspect/compare/v1.3.0...v1.4.0) - 2017-10-24 + +### Commits + +- [Tests] add `npm run coverage` [`3b48fb2`](https://github.com/inspect-js/object-inspect/commit/3b48fb25db037235eeb808f0b2830aad7aa36f70) +- [Tests] remove commented-out osx builds [`71e24db`](https://github.com/inspect-js/object-inspect/commit/71e24db8ad6ee3b9b381c5300b0475f2ba595a73) +- [New] add support for `util.inspect.custom`, in node only. [`20cca77`](https://github.com/inspect-js/object-inspect/commit/20cca7762d7e17f15b21a90793dff84acce155df) +- [Tests] up to `node` `v8.6`; use `nvm install-latest-npm` to ensure new npm doesn’t break old node [`252952d`](https://github.com/inspect-js/object-inspect/commit/252952d230d8065851dd3d4d5fe8398aae068529) +- [Tests] up to `node` `v8.8` [`4aa868d`](https://github.com/inspect-js/object-inspect/commit/4aa868d3a62914091d489dd6ec6eed194ee67cd3) +- [Dev Deps] update `core-js`, `tape` [`59483d1`](https://github.com/inspect-js/object-inspect/commit/59483d1df418f852f51fa0db7b24aa6b0209a27a) + +## [v1.3.0](https://github.com/inspect-js/object-inspect/compare/v1.2.2...v1.3.0) - 2017-07-31 + +### Fixed + +- [Fix] Map/Set: work around core-js bug < v2.5.0 [`#9`](https://github.com/inspect-js/object-inspect/issues/9) + +### Commits + +- [New] add support for arrays with additional object keys [`0d19937`](https://github.com/inspect-js/object-inspect/commit/0d199374ee37959e51539616666f420ccb29acb9) +- [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`; fix new npm breaking on older nodes [`e24784a`](https://github.com/inspect-js/object-inspect/commit/e24784a90c49117787157a12a63897c49cf89bbb) +- Only apps should have lockfiles [`c6faebc`](https://github.com/inspect-js/object-inspect/commit/c6faebcb2ee486a889a4a1c4d78c0776c7576185) +- [Dev Deps] update `tape` [`7345a0a`](https://github.com/inspect-js/object-inspect/commit/7345a0aeba7e91b888a079c10004d17696a7f586) + +## [v1.2.2](https://github.com/inspect-js/object-inspect/compare/v1.2.1...v1.2.2) - 2017-03-24 + +### Commits + +- [Tests] up to `node` `v7.7`, `v6.10`, `v4.8`; improve test matrix [`a2ddc15`](https://github.com/inspect-js/object-inspect/commit/a2ddc15a1f2c65af18076eea1c0eb9cbceb478a0) +- [Tests] up to `node` `v7.0`, `v6.9`, `v5.12`, `v4.6`, `io.js` `v3.3`; improve test matrix [`a48949f`](https://github.com/inspect-js/object-inspect/commit/a48949f6b574b2d4d2298109d8e8d0eb3e7a83e7) +- [Performance] check for primitive types as early as possible. [`3b8092a`](https://github.com/inspect-js/object-inspect/commit/3b8092a2a4deffd0575f94334f00194e2d48dad3) +- [Refactor] remove unneeded `else`s. [`7255034`](https://github.com/inspect-js/object-inspect/commit/725503402e08de4f96f6bf2d8edef44ac36f26b6) +- [Refactor] avoid recreating `lowbyte` function every time. [`81edd34`](https://github.com/inspect-js/object-inspect/commit/81edd3475bd15bdd18e84de7472033dcf5004aaa) +- [Fix] differentiate -0 from 0 [`521d345`](https://github.com/inspect-js/object-inspect/commit/521d3456b009da7bf1c5785c8a9df5a9f8718264) +- [Refactor] move object key gathering into separate function [`aca6265`](https://github.com/inspect-js/object-inspect/commit/aca626536eaeef697196c6e9db3e90e7e0355b6a) +- [Refactor] consolidate wrapping logic for boxed primitives into a function. [`4e440cd`](https://github.com/inspect-js/object-inspect/commit/4e440cd9065df04802a2a1dead03f48c353ca301) +- [Robustness] use `typeof` instead of comparing to literal `undefined` [`5ca6f60`](https://github.com/inspect-js/object-inspect/commit/5ca6f601937506daff8ed2fcf686363b55807b69) +- [Refactor] consolidate Map/Set notations. [`4e576e5`](https://github.com/inspect-js/object-inspect/commit/4e576e5d7ed2f9ec3fb7f37a0d16732eb10758a9) +- [Tests] ensure that this function remains anonymous, despite ES6 name inference. [`7540ae5`](https://github.com/inspect-js/object-inspect/commit/7540ae591278756db614fa4def55ca413150e1a3) +- [Refactor] explicitly coerce Error objects to strings. [`7f4ca84`](https://github.com/inspect-js/object-inspect/commit/7f4ca8424ee8dc2c0ca5a422d94f7fac40327261) +- [Refactor] split up `var` declarations for debuggability [`6f2c11e`](https://github.com/inspect-js/object-inspect/commit/6f2c11e6a85418586a00292dcec5e97683f89bc3) +- [Robustness] cache `Object.prototype.toString` [`df44a20`](https://github.com/inspect-js/object-inspect/commit/df44a20adfccf31529d60d1df2079bfc3c836e27) +- [Dev Deps] update `tape` [`3ec714e`](https://github.com/inspect-js/object-inspect/commit/3ec714eba57bc3f58a6eb4fca1376f49e70d300a) +- [Dev Deps] update `tape` [`beb72d9`](https://github.com/inspect-js/object-inspect/commit/beb72d969653747d7cde300393c28755375329b0) + +## [v1.2.1](https://github.com/inspect-js/object-inspect/compare/v1.2.0...v1.2.1) - 2016-04-09 + +### Fixed + +- [Fix] fix Boolean `false` object inspection. [`#7`](https://github.com/substack/object-inspect/pull/7) + +## [v1.2.0](https://github.com/inspect-js/object-inspect/compare/v1.1.0...v1.2.0) - 2016-04-09 + +### Fixed + +- [New] add support for inspecting String/Number/Boolean objects. [`#6`](https://github.com/inspect-js/object-inspect/issues/6) + +### Commits + +- [Dev Deps] update `tape` [`742caa2`](https://github.com/inspect-js/object-inspect/commit/742caa262cf7af4c815d4821c8bd0129c1446432) + +## [v1.1.0](https://github.com/inspect-js/object-inspect/compare/1.0.2...v1.1.0) - 2015-12-14 + +### Merged + +- [New] add ES6 Map/Set support. [`#4`](https://github.com/inspect-js/object-inspect/pull/4) + +### Fixed + +- [New] add ES6 Map/Set support. [`#3`](https://github.com/inspect-js/object-inspect/issues/3) + +### Commits + +- Update `travis.yml` to test on bunches of `iojs` and `node` versions. [`4c1fd65`](https://github.com/inspect-js/object-inspect/commit/4c1fd65cc3bd95307e854d114b90478324287fd2) +- [Dev Deps] update `tape` [`88a907e`](https://github.com/inspect-js/object-inspect/commit/88a907e33afbe408e4b5d6e4e42a33143f88848c) + +## [1.0.2](https://github.com/inspect-js/object-inspect/compare/1.0.1...1.0.2) - 2015-08-07 + +### Commits + +- [Fix] Cache `Object.prototype.hasOwnProperty` in case it's deleted later. [`1d0075d`](https://github.com/inspect-js/object-inspect/commit/1d0075d3091dc82246feeb1f9871cb2b8ed227b3) +- [Dev Deps] Update `tape` [`ca8d5d7`](https://github.com/inspect-js/object-inspect/commit/ca8d5d75635ddbf76f944e628267581e04958457) +- gitignore node_modules since this is a reusable modules. [`ed41407`](https://github.com/inspect-js/object-inspect/commit/ed41407811743ca530cdeb28f982beb96026af82) + +## [1.0.1](https://github.com/inspect-js/object-inspect/compare/1.0.0...1.0.1) - 2015-07-19 + +### Commits + +- Make `inspect` work with symbol primitives and objects, including in node 0.11 and 0.12. [`ddf1b94`](https://github.com/inspect-js/object-inspect/commit/ddf1b94475ab951f1e3bccdc0a48e9073cfbfef4) +- bump tape [`103d674`](https://github.com/inspect-js/object-inspect/commit/103d67496b504bdcfdd765d303a773f87ec106e2) +- use newer travis config [`d497276`](https://github.com/inspect-js/object-inspect/commit/d497276c1da14234bb5098a59cf20de75fbc316a) + +## [1.0.0](https://github.com/inspect-js/object-inspect/compare/0.4.0...1.0.0) - 2014-08-05 + +### Commits + +- error inspect works properly [`260a22d`](https://github.com/inspect-js/object-inspect/commit/260a22d134d3a8a482c67d52091c6040c34f4299) +- seen coverage [`57269e8`](https://github.com/inspect-js/object-inspect/commit/57269e8baa992a7439047f47325111fdcbcb8417) +- htmlelement instance coverage [`397ffe1`](https://github.com/inspect-js/object-inspect/commit/397ffe10a1980350868043ef9de65686d438979f) +- more element coverage [`6905cc2`](https://github.com/inspect-js/object-inspect/commit/6905cc2f7df35600177e613b0642b4df5efd3eca) +- failing test for type errors [`385b615`](https://github.com/inspect-js/object-inspect/commit/385b6152e49b51b68449a662f410b084ed7c601a) +- fn name coverage [`edc906d`](https://github.com/inspect-js/object-inspect/commit/edc906d40fca6b9194d304062c037ee8e398c4c2) +- server-side element test [`362d1d3`](https://github.com/inspect-js/object-inspect/commit/362d1d3e86f187651c29feeb8478110afada385b) +- custom inspect fn [`e89b0f6`](https://github.com/inspect-js/object-inspect/commit/e89b0f6fe6d5e03681282af83732a509160435a6) +- fixed browser test [`b530882`](https://github.com/inspect-js/object-inspect/commit/b5308824a1c8471c5617e394766a03a6977102a9) +- depth test, matches node [`1cfd9e0`](https://github.com/inspect-js/object-inspect/commit/1cfd9e0285a4ae1dff44101ad482915d9bf47e48) +- exercise hasOwnProperty path [`8d753fb`](https://github.com/inspect-js/object-inspect/commit/8d753fb362a534fa1106e4d80f2ee9bea06a66d9) +- more cases covered for errors [`c5c46a5`](https://github.com/inspect-js/object-inspect/commit/c5c46a569ec4606583497e8550f0d8c7ad39a4a4) +- \W obj key test case [`b0eceee`](https://github.com/inspect-js/object-inspect/commit/b0eceeea6e0eb94d686c1046e99b9e25e5005f75) +- coverage for explicit depth param [`e12b91c`](https://github.com/inspect-js/object-inspect/commit/e12b91cd59683362f3a0e80f46481a0211e26c15) + +## [0.4.0](https://github.com/inspect-js/object-inspect/compare/0.3.1...0.4.0) - 2014-03-21 + +### Commits + +- passing lowbyte interpolation test [`b847511`](https://github.com/inspect-js/object-inspect/commit/b8475114f5def7e7961c5353d48d3d8d9a520985) +- lowbyte test [`4a2b0e1`](https://github.com/inspect-js/object-inspect/commit/4a2b0e142667fc933f195472759385ac08f3946c) + +## [0.3.1](https://github.com/inspect-js/object-inspect/compare/0.3.0...0.3.1) - 2014-03-04 + +### Commits + +- sort keys [`a07b19c`](https://github.com/inspect-js/object-inspect/commit/a07b19cc3b1521a82d4fafb6368b7a9775428a05) + +## [0.3.0](https://github.com/inspect-js/object-inspect/compare/0.2.0...0.3.0) - 2014-03-04 + +### Commits + +- [] and {} instead of [ ] and { } [`654c44b`](https://github.com/inspect-js/object-inspect/commit/654c44b2865811f3519e57bb8526e0821caf5c6b) + +## [0.2.0](https://github.com/inspect-js/object-inspect/compare/0.1.3...0.2.0) - 2014-03-04 + +### Commits + +- failing holes test [`99cdfad`](https://github.com/inspect-js/object-inspect/commit/99cdfad03c6474740275a75636fe6ca86c77737a) +- regex already work [`e324033`](https://github.com/inspect-js/object-inspect/commit/e324033267025995ec97d32ed0a65737c99477a6) +- failing undef/null test [`1f88a00`](https://github.com/inspect-js/object-inspect/commit/1f88a00265d3209719dda8117b7e6360b4c20943) +- holes in the all example [`7d345f3`](https://github.com/inspect-js/object-inspect/commit/7d345f3676dcbe980cff89a4f6c243269ebbb709) +- check for .inspect(), fixes Buffer use-case [`c3f7546`](https://github.com/inspect-js/object-inspect/commit/c3f75466dbca125347d49847c05262c292f12b79) +- fixes for holes [`ce25f73`](https://github.com/inspect-js/object-inspect/commit/ce25f736683de4b92ff27dc5471218415e2d78d8) +- weird null behavior [`405c1ea`](https://github.com/inspect-js/object-inspect/commit/405c1ea72cd5a8cf3b498c3eaa903d01b9fbcab5) +- tape is actually a devDependency, upgrade [`703b0ce`](https://github.com/inspect-js/object-inspect/commit/703b0ce6c5817b4245a082564bccd877e0bb6990) +- put date in the example [`a342219`](https://github.com/inspect-js/object-inspect/commit/a3422190eeaa013215f46df2d0d37b48595ac058) +- passing the null test [`4ab737e`](https://github.com/inspect-js/object-inspect/commit/4ab737ebf862a75d247ebe51e79307a34d6380d4) + +## [0.1.3](https://github.com/inspect-js/object-inspect/compare/0.1.1...0.1.3) - 2013-07-26 + +### Commits + +- special isElement() check [`882768a`](https://github.com/inspect-js/object-inspect/commit/882768a54035d30747be9de1baf14e5aa0daa128) +- oh right old IEs don't have indexOf either [`36d1275`](https://github.com/inspect-js/object-inspect/commit/36d12756c38b08a74370b0bb696c809e529913a5) + +## [0.1.1](https://github.com/inspect-js/object-inspect/compare/0.1.0...0.1.1) - 2013-07-26 + +### Commits + +- tests! [`4422fd9`](https://github.com/inspect-js/object-inspect/commit/4422fd95532c2745aa6c4f786f35f1090be29998) +- fix for ie<9, doesn't have hasOwnProperty [`6b7d611`](https://github.com/inspect-js/object-inspect/commit/6b7d61183050f6da801ea04473211da226482613) +- fix for all IEs: no f.name [`4e0c2f6`](https://github.com/inspect-js/object-inspect/commit/4e0c2f6dfd01c306d067d7163319acc97c94ee50) +- badges [`5ed0d88`](https://github.com/inspect-js/object-inspect/commit/5ed0d88e4e407f9cb327fa4a146c17921f9680f3) + +## [0.1.0](https://github.com/inspect-js/object-inspect/compare/0.0.0...0.1.0) - 2013-07-26 + +### Commits + +- [Function] for functions [`ad5c485`](https://github.com/inspect-js/object-inspect/commit/ad5c485098fc83352cb540a60b2548ca56820e0b) + +## 0.0.0 - 2013-07-26 + +### Commits + +- working browser example [`34be6b6`](https://github.com/inspect-js/object-inspect/commit/34be6b6548f9ce92bdc3c27572857ba0c4a1218d) +- package.json etc [`cad51f2`](https://github.com/inspect-js/object-inspect/commit/cad51f23fc6bcf1a456ed6abe16088256c2f632f) +- docs complete [`b80cce2`](https://github.com/inspect-js/object-inspect/commit/b80cce2490c4e7183a9ee11ea89071f0abec4446) +- circular example [`4b4a7b9`](https://github.com/inspect-js/object-inspect/commit/4b4a7b92209e4e6b4630976cb6bcd17d14165a59) +- string rep [`7afb479`](https://github.com/inspect-js/object-inspect/commit/7afb479baa798d27f09e0a178b72ea327f60f5c8) diff --git a/node_modules/object-inspect/LICENSE b/node_modules/object-inspect/LICENSE new file mode 100644 index 000000000..ca64cc1e6 --- /dev/null +++ b/node_modules/object-inspect/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-inspect/example/all.js b/node_modules/object-inspect/example/all.js new file mode 100644 index 000000000..2f3355c50 --- /dev/null +++ b/node_modules/object-inspect/example/all.js @@ -0,0 +1,23 @@ +'use strict'; + +var inspect = require('../'); +var Buffer = require('safer-buffer').Buffer; + +var holes = ['a', 'b']; +holes[4] = 'e'; +holes[6] = 'g'; + +var obj = { + a: 1, + b: [3, 4, undefined, null], + c: undefined, + d: null, + e: { + regex: /^x/i, + buf: Buffer.from('abc'), + holes: holes + }, + now: new Date() +}; +obj.self = obj; +console.log(inspect(obj)); diff --git a/node_modules/object-inspect/example/circular.js b/node_modules/object-inspect/example/circular.js new file mode 100644 index 000000000..487a7c169 --- /dev/null +++ b/node_modules/object-inspect/example/circular.js @@ -0,0 +1,6 @@ +'use strict'; + +var inspect = require('../'); +var obj = { a: 1, b: [3, 4] }; +obj.c = obj; +console.log(inspect(obj)); diff --git a/node_modules/object-inspect/example/fn.js b/node_modules/object-inspect/example/fn.js new file mode 100644 index 000000000..9b5db8de0 --- /dev/null +++ b/node_modules/object-inspect/example/fn.js @@ -0,0 +1,5 @@ +'use strict'; + +var inspect = require('../'); +var obj = [1, 2, function f(n) { return n + 5; }, 4]; +console.log(inspect(obj)); diff --git a/node_modules/object-inspect/example/inspect.js b/node_modules/object-inspect/example/inspect.js new file mode 100644 index 000000000..e2df7c9f4 --- /dev/null +++ b/node_modules/object-inspect/example/inspect.js @@ -0,0 +1,10 @@ +'use strict'; + +/* eslint-env browser */ +var inspect = require('../'); + +var d = document.createElement('div'); +d.setAttribute('id', 'beep'); +d.innerHTML = 'woooiiiii'; + +console.log(inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }])); diff --git a/node_modules/object-inspect/index.js b/node_modules/object-inspect/index.js new file mode 100644 index 000000000..a4b2d4cd8 --- /dev/null +++ b/node_modules/object-inspect/index.js @@ -0,0 +1,544 @@ +var hasMap = typeof Map === 'function' && Map.prototype; +var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; +var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; +var mapForEach = hasMap && Map.prototype.forEach; +var hasSet = typeof Set === 'function' && Set.prototype; +var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; +var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; +var setForEach = hasSet && Set.prototype.forEach; +var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype; +var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; +var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype; +var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; +var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype; +var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; +var booleanValueOf = Boolean.prototype.valueOf; +var objectToString = Object.prototype.toString; +var functionToString = Function.prototype.toString; +var $match = String.prototype.match; +var $slice = String.prototype.slice; +var $replace = String.prototype.replace; +var $toUpperCase = String.prototype.toUpperCase; +var $toLowerCase = String.prototype.toLowerCase; +var $test = RegExp.prototype.test; +var $concat = Array.prototype.concat; +var $join = Array.prototype.join; +var $arrSlice = Array.prototype.slice; +var $floor = Math.floor; +var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; +var gOPS = Object.getOwnPropertySymbols; +var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null; +var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object'; +// ie, `has-tostringtag/shams +var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') + ? Symbol.toStringTag + : null; +var isEnumerable = Object.prototype.propertyIsEnumerable; + +var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ( + [].__proto__ === Array.prototype // eslint-disable-line no-proto + ? function (O) { + return O.__proto__; // eslint-disable-line no-proto + } + : null +); + +function addNumericSeparator(num, str) { + if ( + num === Infinity + || num === -Infinity + || num !== num + || (num && num > -1000 && num < 1000) + || $test.call(/e/, str) + ) { + return str; + } + var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; + if (typeof num === 'number') { + var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) + if (int !== num) { + var intStr = String(int); + var dec = $slice.call(str, intStr.length + 1); + return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); + } + } + return $replace.call(str, sepRegex, '$&_'); +} + +var utilInspect = require('./util.inspect'); +var inspectCustom = utilInspect.custom; +var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; + +var quotes = { + __proto__: null, + 'double': '"', + single: "'" +}; +var quoteREs = { + __proto__: null, + 'double': /(["\\])/g, + single: /(['\\])/g +}; + +module.exports = function inspect_(obj, options, depth, seen) { + var opts = options || {}; + + if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) { + throw new TypeError('option "quoteStyle" must be "single" or "double"'); + } + if ( + has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' + ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity + : opts.maxStringLength !== null + ) + ) { + throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); + } + var customInspect = has(opts, 'customInspect') ? opts.customInspect : true; + if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') { + throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); + } + + if ( + has(opts, 'indent') + && opts.indent !== null + && opts.indent !== '\t' + && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0) + ) { + throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); + } + if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') { + throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); + } + var numericSeparator = opts.numericSeparator; + + if (typeof obj === 'undefined') { + return 'undefined'; + } + if (obj === null) { + return 'null'; + } + if (typeof obj === 'boolean') { + return obj ? 'true' : 'false'; + } + + if (typeof obj === 'string') { + return inspectString(obj, opts); + } + if (typeof obj === 'number') { + if (obj === 0) { + return Infinity / obj > 0 ? '0' : '-0'; + } + var str = String(obj); + return numericSeparator ? addNumericSeparator(obj, str) : str; + } + if (typeof obj === 'bigint') { + var bigIntStr = String(obj) + 'n'; + return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; + } + + var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; + if (typeof depth === 'undefined') { depth = 0; } + if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { + return isArray(obj) ? '[Array]' : '[Object]'; + } + + var indent = getIndent(opts, depth); + + if (typeof seen === 'undefined') { + seen = []; + } else if (indexOf(seen, obj) >= 0) { + return '[Circular]'; + } + + function inspect(value, from, noIndent) { + if (from) { + seen = $arrSlice.call(seen); + seen.push(from); + } + if (noIndent) { + var newOpts = { + depth: opts.depth + }; + if (has(opts, 'quoteStyle')) { + newOpts.quoteStyle = opts.quoteStyle; + } + return inspect_(value, newOpts, depth + 1, seen); + } + return inspect_(value, opts, depth + 1, seen); + } + + if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable + var name = nameOf(obj); + var keys = arrObjKeys(obj, inspect); + return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); + } + if (isSymbol(obj)) { + var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); + return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString; + } + if (isElement(obj)) { + var s = '<' + $toLowerCase.call(String(obj.nodeName)); + var attrs = obj.attributes || []; + for (var i = 0; i < attrs.length; i++) { + s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); + } + s += '>'; + if (obj.childNodes && obj.childNodes.length) { s += '...'; } + s += ''; + return s; + } + if (isArray(obj)) { + if (obj.length === 0) { return '[]'; } + var xs = arrObjKeys(obj, inspect); + if (indent && !singleLineValues(xs)) { + return '[' + indentedJoin(xs, indent) + ']'; + } + return '[ ' + $join.call(xs, ', ') + ' ]'; + } + if (isError(obj)) { + var parts = arrObjKeys(obj, inspect); + if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) { + return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; + } + if (parts.length === 0) { return '[' + String(obj) + ']'; } + return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; + } + if (typeof obj === 'object' && customInspect) { + if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) { + return utilInspect(obj, { depth: maxDepth - depth }); + } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') { + return obj.inspect(); + } + } + if (isMap(obj)) { + var mapParts = []; + if (mapForEach) { + mapForEach.call(obj, function (value, key) { + mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); + }); + } + return collectionOf('Map', mapSize.call(obj), mapParts, indent); + } + if (isSet(obj)) { + var setParts = []; + if (setForEach) { + setForEach.call(obj, function (value) { + setParts.push(inspect(value, obj)); + }); + } + return collectionOf('Set', setSize.call(obj), setParts, indent); + } + if (isWeakMap(obj)) { + return weakCollectionOf('WeakMap'); + } + if (isWeakSet(obj)) { + return weakCollectionOf('WeakSet'); + } + if (isWeakRef(obj)) { + return weakCollectionOf('WeakRef'); + } + if (isNumber(obj)) { + return markBoxed(inspect(Number(obj))); + } + if (isBigInt(obj)) { + return markBoxed(inspect(bigIntValueOf.call(obj))); + } + if (isBoolean(obj)) { + return markBoxed(booleanValueOf.call(obj)); + } + if (isString(obj)) { + return markBoxed(inspect(String(obj))); + } + // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other + /* eslint-env browser */ + if (typeof window !== 'undefined' && obj === window) { + return '{ [object Window] }'; + } + if ( + (typeof globalThis !== 'undefined' && obj === globalThis) + || (typeof global !== 'undefined' && obj === global) + ) { + return '{ [object globalThis] }'; + } + if (!isDate(obj) && !isRegExp(obj)) { + var ys = arrObjKeys(obj, inspect); + var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; + var protoTag = obj instanceof Object ? '' : 'null prototype'; + var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; + var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; + var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); + if (ys.length === 0) { return tag + '{}'; } + if (indent) { + return tag + '{' + indentedJoin(ys, indent) + '}'; + } + return tag + '{ ' + $join.call(ys, ', ') + ' }'; + } + return String(obj); +}; + +function wrapQuotes(s, defaultStyle, opts) { + var style = opts.quoteStyle || defaultStyle; + var quoteChar = quotes[style]; + return quoteChar + s + quoteChar; +} + +function quote(s) { + return $replace.call(String(s), /"/g, '"'); +} + +function canTrustToString(obj) { + return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined')); +} +function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); } +function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); } +function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); } +function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); } +function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); } +function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); } +function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); } + +// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives +function isSymbol(obj) { + if (hasShammedSymbols) { + return obj && typeof obj === 'object' && obj instanceof Symbol; + } + if (typeof obj === 'symbol') { + return true; + } + if (!obj || typeof obj !== 'object' || !symToString) { + return false; + } + try { + symToString.call(obj); + return true; + } catch (e) {} + return false; +} + +function isBigInt(obj) { + if (!obj || typeof obj !== 'object' || !bigIntValueOf) { + return false; + } + try { + bigIntValueOf.call(obj); + return true; + } catch (e) {} + return false; +} + +var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; +function has(obj, key) { + return hasOwn.call(obj, key); +} + +function toStr(obj) { + return objectToString.call(obj); +} + +function nameOf(f) { + if (f.name) { return f.name; } + var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); + if (m) { return m[1]; } + return null; +} + +function indexOf(xs, x) { + if (xs.indexOf) { return xs.indexOf(x); } + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) { return i; } + } + return -1; +} + +function isMap(x) { + if (!mapSize || !x || typeof x !== 'object') { + return false; + } + try { + mapSize.call(x); + try { + setSize.call(x); + } catch (s) { + return true; + } + return x instanceof Map; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakMap(x) { + if (!weakMapHas || !x || typeof x !== 'object') { + return false; + } + try { + weakMapHas.call(x, weakMapHas); + try { + weakSetHas.call(x, weakSetHas); + } catch (s) { + return true; + } + return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakRef(x) { + if (!weakRefDeref || !x || typeof x !== 'object') { + return false; + } + try { + weakRefDeref.call(x); + return true; + } catch (e) {} + return false; +} + +function isSet(x) { + if (!setSize || !x || typeof x !== 'object') { + return false; + } + try { + setSize.call(x); + try { + mapSize.call(x); + } catch (m) { + return true; + } + return x instanceof Set; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakSet(x) { + if (!weakSetHas || !x || typeof x !== 'object') { + return false; + } + try { + weakSetHas.call(x, weakSetHas); + try { + weakMapHas.call(x, weakMapHas); + } catch (s) { + return true; + } + return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isElement(x) { + if (!x || typeof x !== 'object') { return false; } + if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { + return true; + } + return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function'; +} + +function inspectString(str, opts) { + if (str.length > opts.maxStringLength) { + var remaining = str.length - opts.maxStringLength; + var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); + return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; + } + var quoteRE = quoteREs[opts.quoteStyle || 'single']; + quoteRE.lastIndex = 0; + // eslint-disable-next-line no-control-regex + var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte); + return wrapQuotes(s, 'single', opts); +} + +function lowbyte(c) { + var n = c.charCodeAt(0); + var x = { + 8: 'b', + 9: 't', + 10: 'n', + 12: 'f', + 13: 'r' + }[n]; + if (x) { return '\\' + x; } + return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); +} + +function markBoxed(str) { + return 'Object(' + str + ')'; +} + +function weakCollectionOf(type) { + return type + ' { ? }'; +} + +function collectionOf(type, size, entries, indent) { + var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); + return type + ' (' + size + ') {' + joinedEntries + '}'; +} + +function singleLineValues(xs) { + for (var i = 0; i < xs.length; i++) { + if (indexOf(xs[i], '\n') >= 0) { + return false; + } + } + return true; +} + +function getIndent(opts, depth) { + var baseIndent; + if (opts.indent === '\t') { + baseIndent = '\t'; + } else if (typeof opts.indent === 'number' && opts.indent > 0) { + baseIndent = $join.call(Array(opts.indent + 1), ' '); + } else { + return null; + } + return { + base: baseIndent, + prev: $join.call(Array(depth + 1), baseIndent) + }; +} + +function indentedJoin(xs, indent) { + if (xs.length === 0) { return ''; } + var lineJoiner = '\n' + indent.prev + indent.base; + return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; +} + +function arrObjKeys(obj, inspect) { + var isArr = isArray(obj); + var xs = []; + if (isArr) { + xs.length = obj.length; + for (var i = 0; i < obj.length; i++) { + xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; + } + } + var syms = typeof gOPS === 'function' ? gOPS(obj) : []; + var symMap; + if (hasShammedSymbols) { + symMap = {}; + for (var k = 0; k < syms.length; k++) { + symMap['$' + syms[k]] = syms[k]; + } + } + + for (var key in obj) { // eslint-disable-line no-restricted-syntax + if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue + if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue + if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) { + // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section + continue; // eslint-disable-line no-restricted-syntax, no-continue + } else if ($test.call(/[^\w$]/, key)) { + xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); + } else { + xs.push(key + ': ' + inspect(obj[key], obj)); + } + } + if (typeof gOPS === 'function') { + for (var j = 0; j < syms.length; j++) { + if (isEnumerable.call(obj, syms[j])) { + xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); + } + } + } + return xs; +} diff --git a/node_modules/object-inspect/package-support.json b/node_modules/object-inspect/package-support.json new file mode 100644 index 000000000..5cc12d058 --- /dev/null +++ b/node_modules/object-inspect/package-support.json @@ -0,0 +1,20 @@ +{ + "versions": [ + { + "version": "*", + "target": { + "node": "all" + }, + "response": { + "type": "time-permitting" + }, + "backing": { + "npm-funding": true, + "donations": [ + "https://github.com/ljharb", + "https://tidelift.com/funding/github/npm/object-inspect" + ] + } + } + ] +} diff --git a/node_modules/object-inspect/package.json b/node_modules/object-inspect/package.json new file mode 100644 index 000000000..9fd97ff75 --- /dev/null +++ b/node_modules/object-inspect/package.json @@ -0,0 +1,105 @@ +{ + "name": "object-inspect", + "version": "1.13.4", + "description": "string representations of objects in node and the browser", + "main": "index.js", + "sideEffects": false, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.1", + "@pkgjs/support": "^0.0.6", + "auto-changelog": "^2.5.0", + "core-js": "^2.6.12", + "error-cause": "^1.0.8", + "es-value-fixtures": "^1.7.1", + "eslint": "=8.8.0", + "for-each": "^0.3.4", + "functions-have-names": "^1.2.3", + "glob": "=10.3.7", + "globalthis": "^1.0.4", + "has-symbols": "^1.1.0", + "has-tostringtag": "^1.0.2", + "in-publish": "^2.0.1", + "jackspeak": "=2.1.1", + "make-arrow-function": "^1.2.0", + "mock-property": "^1.1.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "safer-buffer": "^2.1.2", + "semver": "^6.3.1", + "string.prototype.repeat": "^1.0.0", + "tape": "^5.9.0" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "lint": "eslint --ext=js,mjs .", + "postlint": "npx @pkgjs/support validate", + "test": "npm run tests-only && npm run test:corejs", + "tests-only": "nyc tape 'test/*.js'", + "test:corejs": "nyc tape test-core-js.js 'test/*.js'", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": [ + "test/*.js", + "test/browser/*.js" + ], + "browsers": [ + "ie/6..latest", + "chrome/latest", + "firefox/latest", + "safari/latest", + "opera/latest", + "iphone/latest", + "ipad/latest", + "android/latest" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/inspect-js/object-inspect.git" + }, + "homepage": "https://github.com/inspect-js/object-inspect", + "keywords": [ + "inspect", + "util.inspect", + "object", + "stringify", + "pretty" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "browser": { + "./util.inspect.js": false + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "./test-core-js.js" + ] + }, + "support": true, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/object-inspect/readme.markdown b/node_modules/object-inspect/readme.markdown new file mode 100644 index 000000000..f91617df3 --- /dev/null +++ b/node_modules/object-inspect/readme.markdown @@ -0,0 +1,84 @@ +# object-inspect [![Version Badge][npm-version-svg]][package-url] + +string representations of objects in node and the browser + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +# example + +## circular + +``` js +var inspect = require('object-inspect'); +var obj = { a: 1, b: [3,4] }; +obj.c = obj; +console.log(inspect(obj)); +``` + +## dom element + +``` js +var inspect = require('object-inspect'); + +var d = document.createElement('div'); +d.setAttribute('id', 'beep'); +d.innerHTML = 'woooiiiii'; + +console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ])); +``` + +output: + +``` +[
...
, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ] +``` + +# methods + +``` js +var inspect = require('object-inspect') +``` + +## var s = inspect(obj, opts={}) + +Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`. + +Additional options: + - `quoteStyle`: must be "single" or "double", if present. Default `'single'` for strings, `'double'` for HTML elements. + - `maxStringLength`: must be `0`, a positive integer, `Infinity`, or `null`, if present. Default `Infinity`. + - `customInspect`: When `true`, a custom inspect method function will be invoked (either undere the `util.inspect.custom` symbol, or the `inspect` property). When the string `'symbol'`, only the symbol method will be invoked. Default `true`. + - `indent`: must be "\t", `null`, or a positive integer. Default `null`. + - `numericSeparator`: must be a boolean, if present. Default `false`. If `true`, all numbers will be printed with numeric separators (eg, `1234.5678` will be printed as `'1_234.567_8'`) + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install object-inspect +``` + +# license + +MIT + +[package-url]: https://npmjs.org/package/object-inspect +[npm-version-svg]: https://versionbadg.es/inspect-js/object-inspect.svg +[deps-svg]: https://david-dm.org/inspect-js/object-inspect.svg +[deps-url]: https://david-dm.org/inspect-js/object-inspect +[dev-deps-svg]: https://david-dm.org/inspect-js/object-inspect/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/object-inspect#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/object-inspect.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/object-inspect.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/object-inspect.svg +[downloads-url]: https://npm-stat.com/charts.html?package=object-inspect +[codecov-image]: https://codecov.io/gh/inspect-js/object-inspect/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/object-inspect/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/object-inspect +[actions-url]: https://github.com/inspect-js/object-inspect/actions diff --git a/node_modules/object-inspect/test-core-js.js b/node_modules/object-inspect/test-core-js.js new file mode 100644 index 000000000..e53c40022 --- /dev/null +++ b/node_modules/object-inspect/test-core-js.js @@ -0,0 +1,26 @@ +'use strict'; + +require('core-js'); + +var inspect = require('./'); +var test = require('tape'); + +test('Maps', function (t) { + t.equal(inspect(new Map([[1, 2]])), 'Map (1) {1 => 2}'); + t.end(); +}); + +test('WeakMaps', function (t) { + t.equal(inspect(new WeakMap([[{}, 2]])), 'WeakMap { ? }'); + t.end(); +}); + +test('Sets', function (t) { + t.equal(inspect(new Set([[1, 2]])), 'Set (1) {[ 1, 2 ]}'); + t.end(); +}); + +test('WeakSets', function (t) { + t.equal(inspect(new WeakSet([[1, 2]])), 'WeakSet { ? }'); + t.end(); +}); diff --git a/node_modules/object-inspect/test/bigint.js b/node_modules/object-inspect/test/bigint.js new file mode 100644 index 000000000..4ecc31df8 --- /dev/null +++ b/node_modules/object-inspect/test/bigint.js @@ -0,0 +1,58 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) { + t.test('primitives', function (st) { + st.plan(3); + + st.equal(inspect(BigInt(-256)), '-256n'); + st.equal(inspect(BigInt(0)), '0n'); + st.equal(inspect(BigInt(256)), '256n'); + }); + + t.test('objects', function (st) { + st.plan(3); + + st.equal(inspect(Object(BigInt(-256))), 'Object(-256n)'); + st.equal(inspect(Object(BigInt(0))), 'Object(0n)'); + st.equal(inspect(Object(BigInt(256))), 'Object(256n)'); + }); + + t.test('syntactic primitives', function (st) { + st.plan(3); + + /* eslint-disable no-new-func */ + st.equal(inspect(Function('return -256n')()), '-256n'); + st.equal(inspect(Function('return 0n')()), '0n'); + st.equal(inspect(Function('return 256n')()), '256n'); + }); + + t.test('toStringTag', { skip: !hasToStringTag }, function (st) { + st.plan(1); + + var faker = {}; + faker[Symbol.toStringTag] = 'BigInt'; + st.equal( + inspect(faker), + '{ [Symbol(Symbol.toStringTag)]: \'BigInt\' }', + 'object lying about being a BigInt inspects as an object' + ); + }); + + t.test('numericSeparator', function (st) { + st.equal(inspect(BigInt(0), { numericSeparator: false }), '0n', '0n, numericSeparator false'); + st.equal(inspect(BigInt(0), { numericSeparator: true }), '0n', '0n, numericSeparator true'); + + st.equal(inspect(BigInt(1234), { numericSeparator: false }), '1234n', '1234n, numericSeparator false'); + st.equal(inspect(BigInt(1234), { numericSeparator: true }), '1_234n', '1234n, numericSeparator true'); + st.equal(inspect(BigInt(-1234), { numericSeparator: false }), '-1234n', '1234n, numericSeparator false'); + st.equal(inspect(BigInt(-1234), { numericSeparator: true }), '-1_234n', '1234n, numericSeparator true'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/browser/dom.js b/node_modules/object-inspect/test/browser/dom.js new file mode 100644 index 000000000..210c0b233 --- /dev/null +++ b/node_modules/object-inspect/test/browser/dom.js @@ -0,0 +1,15 @@ +var inspect = require('../../'); +var test = require('tape'); + +test('dom element', function (t) { + t.plan(1); + + var d = document.createElement('div'); + d.setAttribute('id', 'beep'); + d.innerHTML = 'woooiiiii'; + + t.equal( + inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }]), + '[
...
, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]' + ); +}); diff --git a/node_modules/object-inspect/test/circular.js b/node_modules/object-inspect/test/circular.js new file mode 100644 index 000000000..5df4233cb --- /dev/null +++ b/node_modules/object-inspect/test/circular.js @@ -0,0 +1,16 @@ +var inspect = require('../'); +var test = require('tape'); + +test('circular', function (t) { + t.plan(2); + var obj = { a: 1, b: [3, 4] }; + obj.c = obj; + t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }'); + + var double = {}; + double.a = [double]; + double.b = {}; + double.b.inner = double.b; + double.b.obj = double; + t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }'); +}); diff --git a/node_modules/object-inspect/test/deep.js b/node_modules/object-inspect/test/deep.js new file mode 100644 index 000000000..99ce32a08 --- /dev/null +++ b/node_modules/object-inspect/test/deep.js @@ -0,0 +1,12 @@ +var inspect = require('../'); +var test = require('tape'); + +test('deep', function (t) { + t.plan(4); + var obj = [[[[[[500]]]]]]; + t.equal(inspect(obj), '[ [ [ [ [ [Array] ] ] ] ] ]'); + t.equal(inspect(obj, { depth: 4 }), '[ [ [ [ [Array] ] ] ] ]'); + t.equal(inspect(obj, { depth: 2 }), '[ [ [Array] ] ]'); + + t.equal(inspect([[[{ a: 1 }]]], { depth: 3 }), '[ [ [ [Object] ] ] ]'); +}); diff --git a/node_modules/object-inspect/test/element.js b/node_modules/object-inspect/test/element.js new file mode 100644 index 000000000..47fa9e240 --- /dev/null +++ b/node_modules/object-inspect/test/element.js @@ -0,0 +1,53 @@ +var inspect = require('../'); +var test = require('tape'); + +test('element', function (t) { + t.plan(3); + var elem = { + nodeName: 'div', + attributes: [{ name: 'class', value: 'row' }], + getAttribute: function (key) { return key; }, + childNodes: [] + }; + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); + t.deepEqual(inspect(obj, { quoteStyle: 'single' }), "[ 1,
, 3 ]"); + t.deepEqual(inspect(obj, { quoteStyle: 'double' }), '[ 1,
, 3 ]'); +}); + +test('element no attr', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + getAttribute: function (key) { return key; }, + childNodes: [] + }; + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); +}); + +test('element with contents', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + getAttribute: function (key) { return key; }, + childNodes: [{ nodeName: 'b' }] + }; + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
...
, 3 ]'); +}); + +test('element instance', function (t) { + t.plan(1); + var h = global.HTMLElement; + global.HTMLElement = function (name, attr) { + this.nodeName = name; + this.attributes = attr; + }; + global.HTMLElement.prototype.getAttribute = function () {}; + + var elem = new global.HTMLElement('div', []); + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); + global.HTMLElement = h; +}); diff --git a/node_modules/object-inspect/test/err.js b/node_modules/object-inspect/test/err.js new file mode 100644 index 000000000..cc1d884ab --- /dev/null +++ b/node_modules/object-inspect/test/err.js @@ -0,0 +1,48 @@ +var test = require('tape'); +var ErrorWithCause = require('error-cause/Error'); + +var inspect = require('../'); + +test('type error', function (t) { + t.plan(1); + var aerr = new TypeError(); + aerr.foo = 555; + aerr.bar = [1, 2, 3]; + + var berr = new TypeError('tuv'); + berr.baz = 555; + + var cerr = new SyntaxError(); + cerr.message = 'whoa'; + cerr['a-b'] = 5; + + var withCause = new ErrorWithCause('foo', { cause: 'bar' }); + var withCausePlus = new ErrorWithCause('foo', { cause: 'bar' }); + withCausePlus.foo = 'bar'; + var withUndefinedCause = new ErrorWithCause('foo', { cause: undefined }); + var withEnumerableCause = new Error('foo'); + withEnumerableCause.cause = 'bar'; + + var obj = [ + new TypeError(), + new TypeError('xxx'), + aerr, + berr, + cerr, + withCause, + withCausePlus, + withUndefinedCause, + withEnumerableCause + ]; + t.equal(inspect(obj), '[ ' + [ + '[TypeError]', + '[TypeError: xxx]', + '{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }', + '{ [TypeError: tuv] baz: 555 }', + '{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }', + 'cause' in Error.prototype ? '[Error: foo]' : '{ [Error: foo] [cause]: \'bar\' }', + '{ [Error: foo] ' + ('cause' in Error.prototype ? '' : '[cause]: \'bar\', ') + 'foo: \'bar\' }', + 'cause' in Error.prototype ? '[Error: foo]' : '{ [Error: foo] [cause]: undefined }', + '{ [Error: foo] cause: \'bar\' }' + ].join(', ') + ' ]'); +}); diff --git a/node_modules/object-inspect/test/fakes.js b/node_modules/object-inspect/test/fakes.js new file mode 100644 index 000000000..a65c08c15 --- /dev/null +++ b/node_modules/object-inspect/test/fakes.js @@ -0,0 +1,29 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var hasToStringTag = require('has-tostringtag/shams')(); +var forEach = require('for-each'); + +test('fakes', { skip: !hasToStringTag }, function (t) { + forEach([ + 'Array', + 'Boolean', + 'Date', + 'Error', + 'Number', + 'RegExp', + 'String' + ], function (expected) { + var faker = {}; + faker[Symbol.toStringTag] = expected; + + t.equal( + inspect(faker), + '{ [Symbol(Symbol.toStringTag)]: \'' + expected + '\' }', + 'faker masquerading as ' + expected + ' is not shown as one' + ); + }); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/fn.js b/node_modules/object-inspect/test/fn.js new file mode 100644 index 000000000..de3ca625e --- /dev/null +++ b/node_modules/object-inspect/test/fn.js @@ -0,0 +1,76 @@ +var inspect = require('../'); +var test = require('tape'); +var arrow = require('make-arrow-function')(); +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); + +test('function', function (t) { + t.plan(1); + var obj = [1, 2, function f(n) { return n; }, 4]; + t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]'); +}); + +test('function name', function (t) { + t.plan(1); + var f = (function () { + return function () {}; + }()); + f.toString = function toStr() { return 'function xxx () {}'; }; + var obj = [1, 2, f, 4]; + t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)] { toString: [Function: toStr] }, 4 ]'); +}); + +test('anon function', function (t) { + var f = (function () { + return function () {}; + }()); + var obj = [1, 2, f, 4]; + t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)], 4 ]'); + + t.end(); +}); + +test('arrow function', { skip: !arrow }, function (t) { + t.equal(inspect(arrow), '[Function (anonymous)]'); + + t.end(); +}); + +test('truly nameless function', { skip: !arrow || !functionsHaveConfigurableNames }, function (t) { + function f() {} + Object.defineProperty(f, 'name', { value: false }); + t.equal(f.name, false); + t.equal( + inspect(f), + '[Function: f]', + 'named function with falsy `.name` does not hide its original name' + ); + + function g() {} + Object.defineProperty(g, 'name', { value: true }); + t.equal(g.name, true); + t.equal( + inspect(g), + '[Function: true]', + 'named function with truthy `.name` hides its original name' + ); + + var anon = function () {}; // eslint-disable-line func-style + Object.defineProperty(anon, 'name', { value: null }); + t.equal(anon.name, null); + t.equal( + inspect(anon), + '[Function (anonymous)]', + 'anon function with falsy `.name` does not hide its anonymity' + ); + + var anon2 = function () {}; // eslint-disable-line func-style + Object.defineProperty(anon2, 'name', { value: 1 }); + t.equal(anon2.name, 1); + t.equal( + inspect(anon2), + '[Function: 1]', + 'anon function with truthy `.name` hides its anonymity' + ); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/global.js b/node_modules/object-inspect/test/global.js new file mode 100644 index 000000000..c57216aeb --- /dev/null +++ b/node_modules/object-inspect/test/global.js @@ -0,0 +1,17 @@ +'use strict'; + +var inspect = require('../'); + +var test = require('tape'); +var globalThis = require('globalthis')(); + +test('global object', function (t) { + /* eslint-env browser */ + var expected = typeof window === 'undefined' ? 'globalThis' : 'Window'; + t.equal( + inspect([globalThis]), + '[ { [object ' + expected + '] } ]' + ); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/has.js b/node_modules/object-inspect/test/has.js new file mode 100644 index 000000000..01800dee6 --- /dev/null +++ b/node_modules/object-inspect/test/has.js @@ -0,0 +1,15 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var mockProperty = require('mock-property'); + +test('when Object#hasOwnProperty is deleted', function (t) { + t.plan(1); + var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays + + t.teardown(mockProperty(Array.prototype, 1, { value: 2 })); // this is needed to account for "in" vs "hasOwnProperty" + t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true })); + + t.equal(inspect(arr), '[ 1, , 3 ]'); +}); diff --git a/node_modules/object-inspect/test/holes.js b/node_modules/object-inspect/test/holes.js new file mode 100644 index 000000000..87fc8c84a --- /dev/null +++ b/node_modules/object-inspect/test/holes.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var inspect = require('../'); + +var xs = ['a', 'b']; +xs[5] = 'f'; +xs[7] = 'j'; +xs[8] = 'k'; + +test('holes', function (t) { + t.plan(1); + t.equal( + inspect(xs), + "[ 'a', 'b', , , , 'f', , 'j', 'k' ]" + ); +}); diff --git a/node_modules/object-inspect/test/indent-option.js b/node_modules/object-inspect/test/indent-option.js new file mode 100644 index 000000000..89d8fcedf --- /dev/null +++ b/node_modules/object-inspect/test/indent-option.js @@ -0,0 +1,271 @@ +var test = require('tape'); +var forEach = require('for-each'); + +var inspect = require('../'); + +test('bad indent options', function (t) { + forEach([ + undefined, + true, + false, + -1, + 1.2, + Infinity, + -Infinity, + NaN + ], function (indent) { + t['throws']( + function () { inspect('', { indent: indent }); }, + TypeError, + inspect(indent) + ' is invalid' + ); + }); + + t.end(); +}); + +test('simple object with indent', function (t) { + t.plan(2); + + var obj = { a: 1, b: 2 }; + + var expectedSpaces = [ + '{', + ' a: 1,', + ' b: 2', + '}' + ].join('\n'); + var expectedTabs = [ + '{', + ' a: 1,', + ' b: 2', + '}' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('two deep object with indent', function (t) { + t.plan(2); + + var obj = { a: 1, b: { c: 3, d: 4 } }; + + var expectedSpaces = [ + '{', + ' a: 1,', + ' b: {', + ' c: 3,', + ' d: 4', + ' }', + '}' + ].join('\n'); + var expectedTabs = [ + '{', + ' a: 1,', + ' b: {', + ' c: 3,', + ' d: 4', + ' }', + '}' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('simple array with all single line elements', function (t) { + t.plan(2); + + var obj = [1, 2, 3, 'asdf\nsdf']; + + var expected = '[ 1, 2, 3, \'asdf\\nsdf\' ]'; + + t.equal(inspect(obj, { indent: 2 }), expected, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expected, 'tabs'); +}); + +test('array with complex elements', function (t) { + t.plan(2); + + var obj = [1, { a: 1, b: { c: 1 } }, 'asdf\nsdf']; + + var expectedSpaces = [ + '[', + ' 1,', + ' {', + ' a: 1,', + ' b: {', + ' c: 1', + ' }', + ' },', + ' \'asdf\\nsdf\'', + ']' + ].join('\n'); + var expectedTabs = [ + '[', + ' 1,', + ' {', + ' a: 1,', + ' b: {', + ' c: 1', + ' }', + ' },', + ' \'asdf\\nsdf\'', + ']' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('values', function (t) { + t.plan(2); + var obj = [{}, [], { 'a-b': 5 }]; + + var expectedSpaces = [ + '[', + ' {},', + ' [],', + ' {', + ' \'a-b\': 5', + ' }', + ']' + ].join('\n'); + var expectedTabs = [ + '[', + ' {},', + ' [],', + ' {', + ' \'a-b\': 5', + ' }', + ']' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('Map', { skip: typeof Map !== 'function' }, function (t) { + var map = new Map(); + map.set({ a: 1 }, ['b']); + map.set(3, NaN); + + var expectedStringSpaces = [ + 'Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + '}' + ].join('\n'); + var expectedStringTabs = [ + 'Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + '}' + ].join('\n'); + var expectedStringTabsDoubleQuotes = [ + 'Map (2) {', + ' { a: 1 } => [ "b" ],', + ' 3 => NaN', + '}' + ].join('\n'); + + t.equal( + inspect(map, { indent: 2 }), + expectedStringSpaces, + 'Map keys are not indented (two)' + ); + t.equal( + inspect(map, { indent: '\t' }), + expectedStringTabs, + 'Map keys are not indented (tabs)' + ); + t.equal( + inspect(map, { indent: '\t', quoteStyle: 'double' }), + expectedStringTabsDoubleQuotes, + 'Map keys are not indented (tabs + double quotes)' + ); + + t.equal(inspect(new Map(), { indent: 2 }), 'Map (0) {}', 'empty Map should show as empty (two)'); + t.equal(inspect(new Map(), { indent: '\t' }), 'Map (0) {}', 'empty Map should show as empty (tabs)'); + + var nestedMap = new Map(); + nestedMap.set(nestedMap, map); + var expectedNestedSpaces = [ + 'Map (1) {', + ' [Circular] => Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + ' }', + '}' + ].join('\n'); + var expectedNestedTabs = [ + 'Map (1) {', + ' [Circular] => Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + ' }', + '}' + ].join('\n'); + t.equal(inspect(nestedMap, { indent: 2 }), expectedNestedSpaces, 'Map containing a Map should work (two)'); + t.equal(inspect(nestedMap, { indent: '\t' }), expectedNestedTabs, 'Map containing a Map should work (tabs)'); + + t.end(); +}); + +test('Set', { skip: typeof Set !== 'function' }, function (t) { + var set = new Set(); + set.add({ a: 1 }); + set.add(['b']); + var expectedStringSpaces = [ + 'Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + '}' + ].join('\n'); + var expectedStringTabs = [ + 'Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + '}' + ].join('\n'); + t.equal(inspect(set, { indent: 2 }), expectedStringSpaces, 'new Set([{ a: 1 }, ["b"]]) should show size and contents (two)'); + t.equal(inspect(set, { indent: '\t' }), expectedStringTabs, 'new Set([{ a: 1 }, ["b"]]) should show size and contents (tabs)'); + + t.equal(inspect(new Set(), { indent: 2 }), 'Set (0) {}', 'empty Set should show as empty (two)'); + t.equal(inspect(new Set(), { indent: '\t' }), 'Set (0) {}', 'empty Set should show as empty (tabs)'); + + var nestedSet = new Set(); + nestedSet.add(set); + nestedSet.add(nestedSet); + var expectedNestedSpaces = [ + 'Set (2) {', + ' Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + ' },', + ' [Circular]', + '}' + ].join('\n'); + var expectedNestedTabs = [ + 'Set (2) {', + ' Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + ' },', + ' [Circular]', + '}' + ].join('\n'); + t.equal(inspect(nestedSet, { indent: 2 }), expectedNestedSpaces, 'Set containing a Set should work (two)'); + t.equal(inspect(nestedSet, { indent: '\t' }), expectedNestedTabs, 'Set containing a Set should work (tabs)'); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/inspect.js b/node_modules/object-inspect/test/inspect.js new file mode 100644 index 000000000..1abf81b1f --- /dev/null +++ b/node_modules/object-inspect/test/inspect.js @@ -0,0 +1,139 @@ +var test = require('tape'); +var hasSymbols = require('has-symbols/shams')(); +var utilInspect = require('../util.inspect'); +var repeat = require('string.prototype.repeat'); + +var inspect = require('..'); + +test('inspect', function (t) { + t.plan(5); + + var obj = [{ inspect: function xyzInspect() { return '!XYZ¡'; } }, []]; + var stringResult = '[ !XYZ¡, [] ]'; + var falseResult = '[ { inspect: [Function: xyzInspect] }, [] ]'; + + t.equal(inspect(obj), stringResult); + t.equal(inspect(obj, { customInspect: true }), stringResult); + t.equal(inspect(obj, { customInspect: 'symbol' }), falseResult); + t.equal(inspect(obj, { customInspect: false }), falseResult); + t['throws']( + function () { inspect(obj, { customInspect: 'not a boolean or "symbol"' }); }, + TypeError, + '`customInspect` must be a boolean or the string "symbol"' + ); +}); + +test('inspect custom symbol', { skip: !hasSymbols || !utilInspect || !utilInspect.custom }, function (t) { + t.plan(4); + + var obj = { inspect: function stringInspect() { return 'string'; } }; + obj[utilInspect.custom] = function custom() { return 'symbol'; }; + + var symbolResult = '[ symbol, [] ]'; + var stringResult = '[ string, [] ]'; + var falseResult = '[ { inspect: [Function: stringInspect]' + (utilInspect.custom ? ', [' + inspect(utilInspect.custom) + ']: [Function: custom]' : '') + ' }, [] ]'; + + var symbolStringFallback = utilInspect.custom ? symbolResult : stringResult; + var symbolFalseFallback = utilInspect.custom ? symbolResult : falseResult; + + t.equal(inspect([obj, []]), symbolStringFallback); + t.equal(inspect([obj, []], { customInspect: true }), symbolStringFallback); + t.equal(inspect([obj, []], { customInspect: 'symbol' }), symbolFalseFallback); + t.equal(inspect([obj, []], { customInspect: false }), falseResult); +}); + +test('symbols', { skip: !hasSymbols }, function (t) { + t.plan(2); + + var obj = { a: 1 }; + obj[Symbol('test')] = 2; + obj[Symbol.iterator] = 3; + Object.defineProperty(obj, Symbol('non-enum'), { + enumerable: false, + value: 4 + }); + + if (typeof Symbol.iterator === 'symbol') { + t.equal(inspect(obj), '{ a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }', 'object with symbols'); + t.equal(inspect([obj, []]), '[ { a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }, [] ]', 'object with symbols in array'); + } else { + // symbol sham key ordering is unreliable + t.match( + inspect(obj), + /^(?:{ a: 1, \[Symbol\(test\)\]: 2, \[Symbol\(Symbol.iterator\)\]: 3 }|{ a: 1, \[Symbol\(Symbol.iterator\)\]: 3, \[Symbol\(test\)\]: 2 })$/, + 'object with symbols (nondeterministic symbol sham key ordering)' + ); + t.match( + inspect([obj, []]), + /^\[ (?:{ a: 1, \[Symbol\(test\)\]: 2, \[Symbol\(Symbol.iterator\)\]: 3 }|{ a: 1, \[Symbol\(Symbol.iterator\)\]: 3, \[Symbol\(test\)\]: 2 }), \[\] \]$/, + 'object with symbols in array (nondeterministic symbol sham key ordering)' + ); + } +}); + +test('maxStringLength', function (t) { + t['throws']( + function () { inspect('', { maxStringLength: -1 }); }, + TypeError, + 'maxStringLength must be >= 0, or Infinity, not negative' + ); + + var str = repeat('a', 1e8); + + t.equal( + inspect([str], { maxStringLength: 10 }), + '[ \'aaaaaaaaaa\'... 99999990 more characters ]', + 'maxStringLength option limits output' + ); + + t.equal( + inspect(['f'], { maxStringLength: null }), + '[ \'\'... 1 more character ]', + 'maxStringLength option accepts `null`' + ); + + t.equal( + inspect([str], { maxStringLength: Infinity }), + '[ \'' + str + '\' ]', + 'maxStringLength option accepts ∞' + ); + + t.end(); +}); + +test('inspect options', { skip: !utilInspect.custom }, function (t) { + var obj = {}; + obj[utilInspect.custom] = function () { + return JSON.stringify(arguments); + }; + t.equal( + inspect(obj), + utilInspect(obj, { depth: 5 }), + 'custom symbols will use node\'s inspect' + ); + t.equal( + inspect(obj, { depth: 2 }), + utilInspect(obj, { depth: 2 }), + 'a reduced depth will be passed to node\'s inspect' + ); + t.equal( + inspect({ d1: obj }, { depth: 3 }), + '{ d1: ' + utilInspect(obj, { depth: 2 }) + ' }', + 'deep objects will receive a reduced depth' + ); + t.equal( + inspect({ d1: obj }, { depth: 1 }), + '{ d1: [Object] }', + 'unlike nodejs inspect, customInspect will not be used once the depth is exceeded.' + ); + t.end(); +}); + +test('inspect URL', { skip: typeof URL === 'undefined' }, function (t) { + t.match( + inspect(new URL('https://nodejs.org')), + /nodejs\.org/, // Different environments stringify it differently + 'url can be inspected' + ); + t.end(); +}); diff --git a/node_modules/object-inspect/test/lowbyte.js b/node_modules/object-inspect/test/lowbyte.js new file mode 100644 index 000000000..68a345d85 --- /dev/null +++ b/node_modules/object-inspect/test/lowbyte.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var inspect = require('../'); + +var obj = { x: 'a\r\nb', y: '\x05! \x1f \x12' }; + +test('interpolate low bytes', function (t) { + t.plan(1); + t.equal( + inspect(obj), + "{ x: 'a\\r\\nb', y: '\\x05! \\x1F \\x12' }" + ); +}); diff --git a/node_modules/object-inspect/test/number.js b/node_modules/object-inspect/test/number.js new file mode 100644 index 000000000..8f287e8e2 --- /dev/null +++ b/node_modules/object-inspect/test/number.js @@ -0,0 +1,58 @@ +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); + +var inspect = require('../'); + +test('negative zero', function (t) { + t.equal(inspect(0), '0', 'inspect(0) === "0"'); + t.equal(inspect(Object(0)), 'Object(0)', 'inspect(Object(0)) === "Object(0)"'); + + t.equal(inspect(-0), '-0', 'inspect(-0) === "-0"'); + t.equal(inspect(Object(-0)), 'Object(-0)', 'inspect(Object(-0)) === "Object(-0)"'); + + t.end(); +}); + +test('numericSeparator', function (t) { + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { inspect(true, { numericSeparator: nonBoolean }); }, + TypeError, + inspect(nonBoolean) + ' is not a boolean' + ); + }); + + t.test('3 digit numbers', function (st) { + var failed = false; + for (var i = -999; i < 1000; i += 1) { + var actual = inspect(i); + var actualSepNo = inspect(i, { numericSeparator: false }); + var actualSepYes = inspect(i, { numericSeparator: true }); + var expected = String(i); + if (actual !== expected || actualSepNo !== expected || actualSepYes !== expected) { + failed = true; + t.equal(actual, expected); + t.equal(actualSepNo, expected); + t.equal(actualSepYes, expected); + } + } + + st.notOk(failed, 'all 3 digit numbers passed'); + + st.end(); + }); + + t.equal(inspect(1e3), '1000', '1000'); + t.equal(inspect(1e3, { numericSeparator: false }), '1000', '1000, numericSeparator false'); + t.equal(inspect(1e3, { numericSeparator: true }), '1_000', '1000, numericSeparator true'); + t.equal(inspect(-1e3), '-1000', '-1000'); + t.equal(inspect(-1e3, { numericSeparator: false }), '-1000', '-1000, numericSeparator false'); + t.equal(inspect(-1e3, { numericSeparator: true }), '-1_000', '-1000, numericSeparator true'); + + t.equal(inspect(1234.5678, { numericSeparator: true }), '1_234.567_8', 'fractional numbers get separators'); + t.equal(inspect(1234.56789, { numericSeparator: true }), '1_234.567_89', 'fractional numbers get separators'); + t.equal(inspect(1234.567891, { numericSeparator: true }), '1_234.567_891', 'fractional numbers get separators'); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/quoteStyle.js b/node_modules/object-inspect/test/quoteStyle.js new file mode 100644 index 000000000..da23e630c --- /dev/null +++ b/node_modules/object-inspect/test/quoteStyle.js @@ -0,0 +1,26 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); + +test('quoteStyle option', function (t) { + t['throws'](function () { inspect(null, { quoteStyle: false }); }, 'false is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: true }); }, 'true is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: '' }); }, '"" is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: {} }); }, '{} is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: [] }); }, '[] is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: 42 }); }, '42 is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: NaN }); }, 'NaN is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: function () {} }); }, 'a function is not a valid value'); + + t.equal(inspect('"', { quoteStyle: 'single' }), '\'"\'', 'double quote, quoteStyle: "single"'); + t.equal(inspect('"', { quoteStyle: 'double' }), '"\\""', 'double quote, quoteStyle: "double"'); + + t.equal(inspect('\'', { quoteStyle: 'single' }), '\'\\\'\'', 'single quote, quoteStyle: "single"'); + t.equal(inspect('\'', { quoteStyle: 'double' }), '"\'"', 'single quote, quoteStyle: "double"'); + + t.equal(inspect('`', { quoteStyle: 'single' }), '\'`\'', 'backtick, quoteStyle: "single"'); + t.equal(inspect('`', { quoteStyle: 'double' }), '"`"', 'backtick, quoteStyle: "double"'); + + t.end(); +}); diff --git a/node_modules/object-inspect/test/toStringTag.js b/node_modules/object-inspect/test/toStringTag.js new file mode 100644 index 000000000..95f82703d --- /dev/null +++ b/node_modules/object-inspect/test/toStringTag.js @@ -0,0 +1,40 @@ +'use strict'; + +var test = require('tape'); +var hasToStringTag = require('has-tostringtag/shams')(); + +var inspect = require('../'); + +test('Symbol.toStringTag', { skip: !hasToStringTag }, function (t) { + t.plan(4); + + var obj = { a: 1 }; + t.equal(inspect(obj), '{ a: 1 }', 'object, no Symbol.toStringTag'); + + obj[Symbol.toStringTag] = 'foo'; + t.equal(inspect(obj), '{ a: 1, [Symbol(Symbol.toStringTag)]: \'foo\' }', 'object with Symbol.toStringTag'); + + t.test('null objects', { skip: 'toString' in { __proto__: null } }, function (st) { + st.plan(2); + + var dict = { __proto__: null, a: 1 }; + st.equal(inspect(dict), '[Object: null prototype] { a: 1 }', 'null object with Symbol.toStringTag'); + + dict[Symbol.toStringTag] = 'Dict'; + st.equal(inspect(dict), '[Dict: null prototype] { a: 1, [Symbol(Symbol.toStringTag)]: \'Dict\' }', 'null object with Symbol.toStringTag'); + }); + + t.test('instances', function (st) { + st.plan(4); + + function C() { + this.a = 1; + } + st.equal(Object.prototype.toString.call(new C()), '[object Object]', 'instance, no toStringTag, Object.prototype.toString'); + st.equal(inspect(new C()), 'C { a: 1 }', 'instance, no toStringTag'); + + C.prototype[Symbol.toStringTag] = 'Class!'; + st.equal(Object.prototype.toString.call(new C()), '[object Class!]', 'instance, with toStringTag, Object.prototype.toString'); + st.equal(inspect(new C()), 'C [Class!] { a: 1 }', 'instance, with toStringTag'); + }); +}); diff --git a/node_modules/object-inspect/test/undef.js b/node_modules/object-inspect/test/undef.js new file mode 100644 index 000000000..e3f496122 --- /dev/null +++ b/node_modules/object-inspect/test/undef.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var inspect = require('../'); + +var obj = { a: 1, b: [3, 4, undefined, null], c: undefined, d: null }; + +test('undef and null', function (t) { + t.plan(1); + t.equal( + inspect(obj), + '{ a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null }' + ); +}); diff --git a/node_modules/object-inspect/test/values.js b/node_modules/object-inspect/test/values.js new file mode 100644 index 000000000..15986cd0e --- /dev/null +++ b/node_modules/object-inspect/test/values.js @@ -0,0 +1,261 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var mockProperty = require('mock-property'); +var hasSymbols = require('has-symbols/shams')(); +var hasToStringTag = require('has-tostringtag/shams')(); +var forEach = require('for-each'); +var semver = require('semver'); + +test('values', function (t) { + t.plan(1); + var obj = [{}, [], { 'a-b': 5 }]; + t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]'); +}); + +test('arrays with properties', function (t) { + t.plan(1); + var arr = [3]; + arr.foo = 'bar'; + var obj = [1, 2, arr]; + obj.baz = 'quux'; + obj.index = -1; + t.equal(inspect(obj), '[ 1, 2, [ 3, foo: \'bar\' ], baz: \'quux\', index: -1 ]'); +}); + +test('has', function (t) { + t.plan(1); + t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true })); + + t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }'); +}); + +test('indexOf seen', function (t) { + t.plan(1); + var xs = [1, 2, 3, {}]; + xs.push(xs); + + var seen = []; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[ 1, 2, 3, {}, [Circular] ]' + ); +}); + +test('seen seen', function (t) { + t.plan(1); + var xs = [1, 2, 3]; + + var seen = [xs]; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[Circular]' + ); +}); + +test('seen seen seen', function (t) { + t.plan(1); + var xs = [1, 2, 3]; + + var seen = [5, xs]; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[Circular]' + ); +}); + +test('symbols', { skip: !hasSymbols }, function (t) { + var sym = Symbol('foo'); + t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"'); + if (typeof sym === 'symbol') { + // Symbol shams are incapable of differentiating boxed from unboxed symbols + t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"'); + } + + t.test('toStringTag', { skip: !hasToStringTag }, function (st) { + st.plan(1); + + var faker = {}; + faker[Symbol.toStringTag] = 'Symbol'; + st.equal( + inspect(faker), + '{ [Symbol(Symbol.toStringTag)]: \'Symbol\' }', + 'object lying about being a Symbol inspects as an object' + ); + }); + + t.end(); +}); + +test('Map', { skip: typeof Map !== 'function' }, function (t) { + var map = new Map(); + map.set({ a: 1 }, ['b']); + map.set(3, NaN); + var expectedString = 'Map (2) {' + inspect({ a: 1 }) + ' => ' + inspect(['b']) + ', 3 => NaN}'; + t.equal(inspect(map), expectedString, 'new Map([[{ a: 1 }, ["b"]], [3, NaN]]) should show size and contents'); + t.equal(inspect(new Map()), 'Map (0) {}', 'empty Map should show as empty'); + + var nestedMap = new Map(); + nestedMap.set(nestedMap, map); + t.equal(inspect(nestedMap), 'Map (1) {[Circular] => ' + expectedString + '}', 'Map containing a Map should work'); + + t.end(); +}); + +test('WeakMap', { skip: typeof WeakMap !== 'function' }, function (t) { + var map = new WeakMap(); + map.set({ a: 1 }, ['b']); + var expectedString = 'WeakMap { ? }'; + t.equal(inspect(map), expectedString, 'new WeakMap([[{ a: 1 }, ["b"]]]) should not show size or contents'); + t.equal(inspect(new WeakMap()), 'WeakMap { ? }', 'empty WeakMap should not show as empty'); + + t.end(); +}); + +test('Set', { skip: typeof Set !== 'function' }, function (t) { + var set = new Set(); + set.add({ a: 1 }); + set.add(['b']); + var expectedString = 'Set (2) {' + inspect({ a: 1 }) + ', ' + inspect(['b']) + '}'; + t.equal(inspect(set), expectedString, 'new Set([{ a: 1 }, ["b"]]) should show size and contents'); + t.equal(inspect(new Set()), 'Set (0) {}', 'empty Set should show as empty'); + + var nestedSet = new Set(); + nestedSet.add(set); + nestedSet.add(nestedSet); + t.equal(inspect(nestedSet), 'Set (2) {' + expectedString + ', [Circular]}', 'Set containing a Set should work'); + + t.end(); +}); + +test('WeakSet', { skip: typeof WeakSet !== 'function' }, function (t) { + var map = new WeakSet(); + map.add({ a: 1 }); + var expectedString = 'WeakSet { ? }'; + t.equal(inspect(map), expectedString, 'new WeakSet([{ a: 1 }]) should not show size or contents'); + t.equal(inspect(new WeakSet()), 'WeakSet { ? }', 'empty WeakSet should not show as empty'); + + t.end(); +}); + +test('WeakRef', { skip: typeof WeakRef !== 'function' }, function (t) { + var ref = new WeakRef({ a: 1 }); + var expectedString = 'WeakRef { ? }'; + t.equal(inspect(ref), expectedString, 'new WeakRef({ a: 1 }) should not show contents'); + + t.end(); +}); + +test('FinalizationRegistry', { skip: typeof FinalizationRegistry !== 'function' }, function (t) { + var registry = new FinalizationRegistry(function () {}); + var expectedString = 'FinalizationRegistry [FinalizationRegistry] {}'; + t.equal(inspect(registry), expectedString, 'new FinalizationRegistry(function () {}) should work normallys'); + + t.end(); +}); + +test('Strings', function (t) { + var str = 'abc'; + + t.equal(inspect(str), "'" + str + "'", 'primitive string shows as such'); + t.equal(inspect(str, { quoteStyle: 'single' }), "'" + str + "'", 'primitive string shows as such, single quoted'); + t.equal(inspect(str, { quoteStyle: 'double' }), '"' + str + '"', 'primitive string shows as such, double quoted'); + t.equal(inspect(Object(str)), 'Object(' + inspect(str) + ')', 'String object shows as such'); + t.equal(inspect(Object(str), { quoteStyle: 'single' }), 'Object(' + inspect(str, { quoteStyle: 'single' }) + ')', 'String object shows as such, single quoted'); + t.equal(inspect(Object(str), { quoteStyle: 'double' }), 'Object(' + inspect(str, { quoteStyle: 'double' }) + ')', 'String object shows as such, double quoted'); + + t.end(); +}); + +test('Numbers', function (t) { + var num = 42; + + t.equal(inspect(num), String(num), 'primitive number shows as such'); + t.equal(inspect(Object(num)), 'Object(' + inspect(num) + ')', 'Number object shows as such'); + + t.end(); +}); + +test('Booleans', function (t) { + t.equal(inspect(true), String(true), 'primitive true shows as such'); + t.equal(inspect(Object(true)), 'Object(' + inspect(true) + ')', 'Boolean object true shows as such'); + + t.equal(inspect(false), String(false), 'primitive false shows as such'); + t.equal(inspect(Object(false)), 'Object(' + inspect(false) + ')', 'Boolean false object shows as such'); + + t.end(); +}); + +test('Date', function (t) { + var now = new Date(); + t.equal(inspect(now), String(now), 'Date shows properly'); + t.equal(inspect(new Date(NaN)), 'Invalid Date', 'Invalid Date shows properly'); + + t.end(); +}); + +test('RegExps', function (t) { + t.equal(inspect(/a/g), '/a/g', 'regex shows properly'); + t.equal(inspect(new RegExp('abc', 'i')), '/abc/i', 'new RegExp shows properly'); + + var match = 'abc abc'.match(/[ab]+/); + delete match.groups; // for node < 10 + t.equal(inspect(match), '[ \'ab\', index: 0, input: \'abc abc\' ]', 'RegExp match object shows properly'); + + t.end(); +}); + +test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, function (t) { + var target = { proxy: true }; + var fake = new Proxy(target, { has: function () { return false; } }); + + // needed to work around a weird difference in node v6.0 - v6.4 where non-present properties are not logged + var isNode60 = semver.satisfies(process.version, '6.0 - 6.4'); + + forEach([ + 'Boolean', + 'Number', + 'String', + 'Symbol', + 'Date' + ], function (tag) { + target[Symbol.toStringTag] = tag; + + t.equal( + inspect(fake), + '{ ' + (isNode60 ? '' : 'proxy: true, ') + '[Symbol(Symbol.toStringTag)]: \'' + tag + '\' }', + 'Proxy for + ' + tag + ' shows as the target, which has no slots' + ); + }); + + t.end(); +}); + +test('fakers', { skip: !hasToStringTag }, function (t) { + var target = { proxy: false }; + + forEach([ + 'Boolean', + 'Number', + 'String', + 'Symbol', + 'Date' + ], function (tag) { + target[Symbol.toStringTag] = tag; + + t.equal( + inspect(target), + '{ proxy: false, [Symbol(Symbol.toStringTag)]: \'' + tag + '\' }', + 'Object pretending to be ' + tag + ' does not trick us' + ); + }); + + t.end(); +}); diff --git a/node_modules/object-inspect/util.inspect.js b/node_modules/object-inspect/util.inspect.js new file mode 100644 index 000000000..7784fab55 --- /dev/null +++ b/node_modules/object-inspect/util.inspect.js @@ -0,0 +1 @@ +module.exports = require('util').inspect; diff --git a/node_modules/object-is/.eslintrc b/node_modules/object-is/.eslintrc new file mode 100644 index 000000000..3b5d9e90e --- /dev/null +++ b/node_modules/object-is/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/object-is/.nycrc b/node_modules/object-is/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/object-is/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/object-is/CHANGELOG.md b/node_modules/object-is/CHANGELOG.md new file mode 100644 index 000000000..1de939e60 --- /dev/null +++ b/node_modules/object-is/CHANGELOG.md @@ -0,0 +1,175 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.6](https://github.com/es-shims/object-is/compare/v1.1.5...v1.1.6) - 2024-02-27 + +### Commits + +- [actions] reuse common workflows [`f8d0c06`](https://github.com/es-shims/object-is/commit/f8d0c0617901b4b220f2bbbaff8c9ec7f22891c6) +- [actions] use `node/install` instead of `node/run` [`90fc019`](https://github.com/es-shims/object-is/commit/90fc01955dc677fef745f0dc4164e2144b047997) +- [actions] update workflows [`37339d8`](https://github.com/es-shims/object-is/commit/37339d870aacad9f524cb685c0075aed78e9bd6e) +- [meta] use `npmignore` to autogenerate an npmignore file [`a257c19`](https://github.com/es-shims/object-is/commit/a257c19d55c275ac44892b1d2d98a5d06e976943) +- [readme] fix badges [`50af053`](https://github.com/es-shims/object-is/commit/50af053d4d8ee02657d71f784c31b372905187a7) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`86058c6`](https://github.com/es-shims/object-is/commit/86058c65153dea90d18ff969244bdc610f382046) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `has-symbols`, `tape` [`d5484eb`](https://github.com/es-shims/object-is/commit/d5484eb02a44482de29ce95ccfd01e885d0ff83b) +- [actions] update rebase action to use reusable workflow [`68075c5`](https://github.com/es-shims/object-is/commit/68075c5bd0e35b51e815e7fd95bb90cc54deb699) +- [actions] update codecov uploader [`f12fbb2`](https://github.com/es-shims/object-is/commit/f12fbb2f23b43c2d982fd00c95ff98b01e8747a1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `has-symbols`, `tape` [`43eb235`](https://github.com/es-shims/object-is/commit/43eb235ffa1dd258ff5ef990fd2f0ce78ce40ccc) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`f306966`](https://github.com/es-shims/object-is/commit/f306966e53fac2e24dd11dfe6cf31a8ae20a08da) +- [readme] add actions and codecov badges [`e443b4a`](https://github.com/es-shims/object-is/commit/e443b4a3d0b01683cb6fec59916ad4ec463e9de7) +- [readme] remove travis badge [`5165adc`](https://github.com/es-shims/object-is/commit/5165adccf9e8373f38a01e7a5887b42a4229ca2b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`e7ccf56`](https://github.com/es-shims/object-is/commit/e7ccf56f84434f6671fae1d1fe4945f5b3a84120) +- [Deps] update `call-bind`, `define-properties` [`a3052db`](https://github.com/es-shims/object-is/commit/a3052db9e272c5d544553a7f43c916689e8cca9a) +- [readme] fix URLs [`ac37ea6`](https://github.com/es-shims/object-is/commit/ac37ea68b2a11ef7ebff694e6c4f308c735240ea) +- [readme] assert.notOk -> assert.equal [`7fe769f`](https://github.com/es-shims/object-is/commit/7fe769fc8293d8756ed2d31c4d12afc0581498b7) +- [Deps] update `call-bind` [`b965cd3`](https://github.com/es-shims/object-is/commit/b965cd319e1c397a5ef7dc6dffc9a5bd4329d408) +- [Dev Deps] update `tape` [`a737830`](https://github.com/es-shims/object-is/commit/a737830a051cdc650c3bfb78b085586c9fd7cd13) +- [Deps] update `define-properties`, `es-abstract` [`441eafb`](https://github.com/es-shims/object-is/commit/441eafbca4e32d76dc16bea6b73ee794296e2c0c) + +## [v1.1.5](https://github.com/es-shims/object-is/compare/v1.1.4...v1.1.5) - 2021-02-20 + +### Commits + +- [meta] do not publish github action workflow files [`ec00b0f`](https://github.com/es-shims/object-is/commit/ec00b0f3a5096a7d57884e201c76ded3052a1b9c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`279645e`](https://github.com/es-shims/object-is/commit/279645e330da410da9776455274aa6b3c89b585b) +- [actions] update workflows [`6b4ef5a`](https://github.com/es-shims/object-is/commit/6b4ef5a219fc3982433fc3df2ad9d57994be0761) +- [Dev Deps] update `eslint`, `functions-have-names`, `tape` [`f5fd32a`](https://github.com/es-shims/object-is/commit/f5fd32ace61d4643fe0bf67ca83a6674a65906be) +- [Deps] update `call-bind` [`0fafc13`](https://github.com/es-shims/object-is/commit/0fafc13ec1a20d3075512ae9d2c0b0ee252169a9) +- [Deps] update `call-bind` [`e28a929`](https://github.com/es-shims/object-is/commit/e28a929b71fc1939a4c4d5c92ca0c04a0b27ff81) +- [readme] Add note about es-shim API [`f903cc1`](https://github.com/es-shims/object-is/commit/f903cc11186e0d5c6c4173821d6b7bf2a49f6c01) + +## [v1.1.4](https://github.com/es-shims/object-is/compare/v1.1.3...v1.1.4) - 2020-11-26 + +### Commits + +- [Tests] migrate tests to Github Actions [`958ab26`](https://github.com/es-shims/object-is/commit/958ab266fd68396781c076d8a5ee4ba292561362) +- [Tests] add `shimmed` and `implementation` and `index` tests; run `es-shim-api` in postlint; use `tape` runner [`b918fb8`](https://github.com/es-shims/object-is/commit/b918fb849023032d2da61ead95f31b0a03371131) +- [Tests] run `nyc` on all tests [`8f62816`](https://github.com/es-shims/object-is/commit/8f6281683ad58ffe9b5809c2a9e7bb65db344c9c) +- [actions] add "Allow Edits" workflow [`aa419f0`](https://github.com/es-shims/object-is/commit/aa419f0ea2b497844365f9f51a746fa2a57bb6ee) +- [Deps] use `call-bind` instead of `es-abstract` [`4991728`](https://github.com/es-shims/object-is/commit/49917288eddfce31949f5a3351f0e0bb67929a2b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`3ce2ef5`](https://github.com/es-shims/object-is/commit/3ce2ef5e834bf22566ea5741178cd76bb35f8a89) +- [meta] ignore coverage output [`d778383`](https://github.com/es-shims/object-is/commit/d778383fde9222bc5349dd4adcaab9f5ef10254e) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`e0d9b41`](https://github.com/es-shims/object-is/commit/e0d9b41a73f51f1c8b9d9b402da5f754926bc280) + +## [v1.1.3](https://github.com/es-shims/object-is/compare/v1.1.2...v1.1.3) - 2020-09-30 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`6f1217f`](https://github.com/es-shims/object-is/commit/6f1217fc82cbe25d3911cad2d3298a8f3f51bd7f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog` [`68d8ab0`](https://github.com/es-shims/object-is/commit/68d8ab07275949aa78f20f0e6270c0a26aba2647) +- [Deps] update `es-abstract` [`d665d57`](https://github.com/es-shims/object-is/commit/d665d570e416f039bbbc577f0c2c77104302d227) +- [Deps] update `es-abstract` [`61b4d08`](https://github.com/es-shims/object-is/commit/61b4d0893212b08ec89ba8c388948fa4377f7a43) + +## [v1.1.2](https://github.com/es-shims/object-is/compare/v1.1.1...v1.1.2) - 2020-04-14 + +### Commits + +- [Fix] avoid mutating the builtin `Object.is` in the main entry point [`5988702`](https://github.com/es-shims/object-is/commit/59887020544021d7cf8e72cd84c4d67abcf558c5) + +## [v1.1.1](https://github.com/es-shims/object-is/compare/v1.1.0...v1.1.1) - 2020-04-14 + +### Fixed + +- [Deps] add missing `define-properties` [`#10`](https://github.com/es-shims/object-is/issues/10) + +## [v1.1.0](https://github.com/es-shims/object-is/compare/v1.0.2...v1.1.0) - 2020-04-14 + +### Commits + +- [New] convert to `es-shim-api` interface [`c8b6e9f`](https://github.com/es-shims/object-is/commit/c8b6e9f249438bfd9dfa315415eddd3a1d436d15) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`222a2a9`](https://github.com/es-shims/object-is/commit/222a2a9a2eb08be844bf4c619d1eb711d743c6f3) +- [Dev Deps] update `auto-changelog`, `tape` [`1ea6a92`](https://github.com/es-shims/object-is/commit/1ea6a92153695074c4e3f2e2e0ec26b83f6b091a) +- [Dev Deps] update `auto-changelog`; add `aud` [`1d129e0`](https://github.com/es-shims/object-is/commit/1d129e0dfe386a1e39fa4f3ff991198e885299b1) +- [Tests] only audit prod deps [`ad12386`](https://github.com/es-shims/object-is/commit/ad1238688dcfe9170217b6b9a02122369979d221) + +## [v1.0.2](https://github.com/es-shims/object-is/compare/v1.0.1...v1.0.2) - 2019-12-15 + +### Commits + +- [Tests] use shared travis-ci configs [`eb56ddf`](https://github.com/es-shims/object-is/commit/eb56ddf82bd08f56bd50db7333f2a7b6cef2452a) +- [Tests] up to `node` `v12.6`, `v11.15`, `v10.16`, `v9.11`, `v8.16`, `v7.10`, `v6.17`, `v5.12`, `4.9`; use `nvm install-latest-npm` [`a5bb4e3`](https://github.com/es-shims/object-is/commit/a5bb4e3663902dda4eb9c748aecd04532428594a) +- [Tests] remove `jscs` [`1929690`](https://github.com/es-shims/object-is/commit/19296907bbb9864518ccb2364a44f9adda9c910c) +- Using my standard jscs.json file. [`a7621dc`](https://github.com/es-shims/object-is/commit/a7621dcafbdf4befa4bb97c4e132f30fd486addf) +- [meta] run `auto-changelog` [`5c551c4`](https://github.com/es-shims/object-is/commit/5c551c406f8a72d53f8f4bbabc89f0c1892bf262) +- Update `tape`, `covert`, `jscs` [`bd84112`](https://github.com/es-shims/object-is/commit/bd8411263e754f5a464b6d55c01ecd3b1f4c7437) +- [meta] move repo to es-shims org [`15d3cdc`](https://github.com/es-shims/object-is/commit/15d3cdcbd4b78c8dee80507ac8a5f4cff7ab42d4) +- Test up to `io.js` `v2.2` [`d1d2de4`](https://github.com/es-shims/object-is/commit/d1d2de48f72853552e3d3a751b3f178c5dc10ef5) +- Update `tape`, `jscs` [`b40e85f`](https://github.com/es-shims/object-is/commit/b40e85f77cc906fc54246cf672a78b902bd65aab) +- Add `npm run eslint` [`a80ee81`](https://github.com/es-shims/object-is/commit/a80ee81d12d8fb4120bf590c4d4622fb5dc3f67b) +- Only apps should have lockfiles [`f70677a`](https://github.com/es-shims/object-is/commit/f70677adbe0a765ee26e214a95a97d0ddf88f31e) +- [actions] add automatic rebasing / merge commit blocking [`27780d3`](https://github.com/es-shims/object-is/commit/27780d330cbaf3ef96479b5a0a3fe55f71b54bb6) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`cf886ce`](https://github.com/es-shims/object-is/commit/cf886ced70afff6c5a66be6f9ddba2d330034c70) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols` [`b70e146`](https://github.com/es-shims/object-is/commit/b70e146496488ac5e1a48651cb94292e67051e48) +- [meta] add version scripts [`25a5308`](https://github.com/es-shims/object-is/commit/25a5308bfcc41733a86ce0461ef69a2459215b5b) +- [Tests] up to `node` `v12.10` [`b6e934c`](https://github.com/es-shims/object-is/commit/b6e934ca8f0e65dac7ed3c30b2b7907d39e36f6b) +- [Dev Deps] update `tape`, `jscs` [`df38b5a`](https://github.com/es-shims/object-is/commit/df38b5a856071aaa4d6b8e089a48d80775cb1ed9) +- Adding license and downloads badges [`c743f09`](https://github.com/es-shims/object-is/commit/c743f0907b0bab73a0821541190a865a5c3e5da9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`41d1c5b`](https://github.com/es-shims/object-is/commit/41d1c5b8173f6543e01940b18daee93c586058d0) +- Add tests for Symbols. [`8189ca7`](https://github.com/es-shims/object-is/commit/8189ca73b647a13f63162bc8ed14040386972530) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`698c449`](https://github.com/es-shims/object-is/commit/698c449a8fdc6634747765333cdd8071119932b8) +- Add `npm run security` [`1fe530a`](https://github.com/es-shims/object-is/commit/1fe530abd3164eb70dedd959a25f3b1ad0d02c01) +- Test up to `io.js` `v3.0` [`cd6ac03`](https://github.com/es-shims/object-is/commit/cd6ac034cda66916319c68aeea190e5817de106c) +- [Refactor] no-else-return [`a590382`](https://github.com/es-shims/object-is/commit/a590382d69134915f37039ae6841c9fffbdd5b81) +- [docs] clean up some links [`422df90`](https://github.com/es-shims/object-is/commit/422df90523f4d7f2463e404d394f656232f0fc7c) +- All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`8684418`](https://github.com/es-shims/object-is/commit/8684418131004859fe18443d4f57f28510b72e13) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`6b618ac`](https://github.com/es-shims/object-is/commit/6b618acfa5bcab8d1684d926728000afb4f1ee52) +- [readme] prefer ES2015 over ES6 [`9aae9f9`](https://github.com/es-shims/object-is/commit/9aae9f9d1b4e699364f4822534b89887abb9089f) +- [meta] use keepachangelog with auto-changelog [`3abdcd9`](https://github.com/es-shims/object-is/commit/3abdcd915bc647a5f01af2422fa4a37b2980f946) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`65da8bb`](https://github.com/es-shims/object-is/commit/65da8bba76d4b0e95f95d2a6b98d7bfe5b294ff0) +- [Tests] use `has-symbols` [`9c88ec7`](https://github.com/es-shims/object-is/commit/9c88ec729227f35dc18fe52131c11afd296a042e) +- Update `tape`, `jscs` [`abc6021`](https://github.com/es-shims/object-is/commit/abc6021a0be38921688182e0f95376597056f6cd) +- Update `jscs` [`f85f0ba`](https://github.com/es-shims/object-is/commit/f85f0ba49809030c09dfda4af0022c4122438f90) +- Update `tape`, `jscs` [`9c8b28b`](https://github.com/es-shims/object-is/commit/9c8b28bf52521b70fdacdaba1035e101aa0a1240) +- Using single quotes. [`46a566e`](https://github.com/es-shims/object-is/commit/46a566efbc6366aa44ef9ac8b47668ede5830d50) +- [meta] add `funding` field [`f71e665`](https://github.com/es-shims/object-is/commit/f71e66510676f9bfeb6e81a05821161953879270) +- [Dev Deps] update `tape` [`694a94e`](https://github.com/es-shims/object-is/commit/694a94e83b4d415b1e43adb8011ad33351945105) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`4b29a71`](https://github.com/es-shims/object-is/commit/4b29a718b459ecde3512c4dd6577a2a5e95b7cc6) +- Update `jscs` [`204e6fe`](https://github.com/es-shims/object-is/commit/204e6febc368ca94091ac0b5ec0254c33b0ee462) +- Lock covert to v1.0.0. [`efc5a21`](https://github.com/es-shims/object-is/commit/efc5a21e1d0cc463ec7c7ef2f75a317085093d5e) +- Updating tape [`d1ff721`](https://github.com/es-shims/object-is/commit/d1ff721d2bdec538112cdbbfedcf06d578093831) +- Updating jscs [`35b4df9`](https://github.com/es-shims/object-is/commit/35b4df90d0c97a4f004f0188940b2e602b645c16) +- Updating jscs [`46c3b9d`](https://github.com/es-shims/object-is/commit/46c3b9d31a7f8ce43c496e0304b22ce142311917) +- Updating jscs [`75c9b8b`](https://github.com/es-shims/object-is/commit/75c9b8b45022d5e9b44b0c9a055974185b550a57) + +## [v1.0.1](https://github.com/es-shims/object-is/compare/v1.0.0...v1.0.1) - 2014-08-27 + +### Merged + +- Use svg instead of png to get better image quality [`#2`](https://github.com/es-shims/object-is/pull/2) + +### Commits + +- Adding `npm run lint` [`af5dedd`](https://github.com/es-shims/object-is/commit/af5dedd2f40df7584c856576123a2d2852dd9694) +- Using an easier isNaN check [`89474ae`](https://github.com/es-shims/object-is/commit/89474ae3e26eb857d89b01c1f3b20f859bd0f161) +- Oops, run quiet coverage as part of tests [`5149e18`](https://github.com/es-shims/object-is/commit/5149e1876808e67a016fd913f6d99481bf7091f2) +- Run linter as part of tests [`d5eee8a`](https://github.com/es-shims/object-is/commit/d5eee8a43b95c619cf3b06ef3d64cefc865f33f3) +- Updating covert [`0b862da`](https://github.com/es-shims/object-is/commit/0b862dad7873b9aab74d2f4262b5b587120c169b) +- Updating tape [`484e6ca`](https://github.com/es-shims/object-is/commit/484e6cab0d5734b8c9f23ceada58e93b09dc15ee) + +## [v1.0.0](https://github.com/es-shims/object-is/compare/v0.0.0...v1.0.0) - 2014-08-01 + +### Commits + +- Make sure old and unstable nodes don't break Travis [`c8d3dfe`](https://github.com/es-shims/object-is/commit/c8d3dfe4c0f6dc76a5b0cc22a6a6401fa1105cea) +- Bumping to v1.0.0. [`8811835`](https://github.com/es-shims/object-is/commit/8811835bff203cf0dc0dee1342beeb749ea63e10) +- Updating tape [`0767579`](https://github.com/es-shims/object-is/commit/0767579b3cbf59e49c73c131186bfcbad4448020) +- Updating covert [`6b67a0b`](https://github.com/es-shims/object-is/commit/6b67a0b4b6933ea23c74c24037f3f515942a005a) +- Run code coverage in tests [`8b5d70d`](https://github.com/es-shims/object-is/commit/8b5d70d9cbf6194d69ee22b8433fe4e0a3d7507e) +- Updating tape [`57b019c`](https://github.com/es-shims/object-is/commit/57b019c8b74030601dc71dc38cd2c41cf5b735d4) +- Updating tape [`91d94f9`](https://github.com/es-shims/object-is/commit/91d94f9b06c4a86942b077979536a8c2994ab374) + +## v0.0.0 - 2014-02-17 + +### Commits + +- package.json [`b724e50`](https://github.com/es-shims/object-is/commit/b724e50ea4a151f46ff5344f9dc3f00d48e60695) +- read me [`62470f5`](https://github.com/es-shims/object-is/commit/62470f58dbef4ba0b96c6c000b2802e328c54be6) +- Tests. [`639e212`](https://github.com/es-shims/object-is/commit/639e212c478afcb8c9a24753aa8fc2b2fdcfb925) +- Initial commit [`8e95b37`](https://github.com/es-shims/object-is/commit/8e95b3744c07594c49372c5732d96235f0b7d9d6) +- Implementation. [`47780bc`](https://github.com/es-shims/object-is/commit/47780bc0f483eeabd853877fa33295976cf201ae) +- Travis CI [`baaf8c7`](https://github.com/es-shims/object-is/commit/baaf8c70bc7fd88cf149af9b0c992febb5e89514) +- Covert is broken in node 0.6 [`ee040b2`](https://github.com/es-shims/object-is/commit/ee040b2f3a917da9a33a287daf8470e95db271e1) diff --git a/node_modules/object-is/LICENSE b/node_modules/object-is/LICENSE new file mode 100644 index 000000000..47b7b5078 --- /dev/null +++ b/node_modules/object-is/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-is/README.md b/node_modules/object-is/README.md new file mode 100644 index 000000000..a2854fd73 --- /dev/null +++ b/node_modules/object-is/README.md @@ -0,0 +1,60 @@ +# object-is [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +ES2015-compliant shim for Object.is - differentiates between -0 and +0, and can compare to NaN. + +Essentially, Object.is returns the same value as === - but true for NaN, and false for -0 and +0. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262). + +## Example + +```js +Object.is = require('object-is'); +var assert = require('assert'); + +assert.ok(Object.is()); +assert.ok(Object.is(undefined)); +assert.ok(Object.is(undefined, undefined)); +assert.ok(Object.is(null, null)); +assert.ok(Object.is(true, true)); +assert.ok(Object.is(false, false)); +assert.ok(Object.is('foo', 'foo')); + +var arr = [1, 2]; +assert.ok(Object.is(arr, arr)); +assert.equal(Object.is(arr, [1, 2]), false); + +assert.ok(Object.is(0, 0)); +assert.ok(Object.is(-0, -0)); +assert.equal(Object.is(0, -0), false); + +assert.ok(Object.is(NaN, NaN)); +assert.ok(Object.is(Infinity, Infinity)); +assert.ok(Object.is(-Infinity, -Infinity)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/object-is +[npm-version-svg]: https://versionbadg.es/es-shims/object-is.svg +[deps-svg]: https://david-dm.org/es-shims/object-is.svg +[deps-url]: https://david-dm.org/es-shims/object-is +[dev-deps-svg]: https://david-dm.org/es-shims/object-is/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/object-is#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/object-is.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/object-is.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/object-is.svg +[downloads-url]: https://npm-stat.com/charts.html?package=object-is +[codecov-image]: https://codecov.io/gh/es-shims/object-is/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/object-is/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/object-is +[actions-url]: https://github.com/es-shims/object-is/actions diff --git a/node_modules/object-is/auto.js b/node_modules/object-is/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/object-is/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/object-is/implementation.js b/node_modules/object-is/implementation.js new file mode 100644 index 000000000..7b3a5652e --- /dev/null +++ b/node_modules/object-is/implementation.js @@ -0,0 +1,19 @@ +'use strict'; + +var numberIsNaN = function (value) { + return value !== value; +}; + +module.exports = function is(a, b) { + if (a === 0 && b === 0) { + return 1 / a === 1 / b; + } + if (a === b) { + return true; + } + if (numberIsNaN(a) && numberIsNaN(b)) { + return true; + } + return false; +}; + diff --git a/node_modules/object-is/index.js b/node_modules/object-is/index.js new file mode 100644 index 000000000..abf0449c9 --- /dev/null +++ b/node_modules/object-is/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var polyfill = callBind(getPolyfill(), Object); + +define(polyfill, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = polyfill; diff --git a/node_modules/object-is/package.json b/node_modules/object-is/package.json new file mode 100644 index 000000000..b5e50d4b7 --- /dev/null +++ b/node_modules/object-is/package.json @@ -0,0 +1,96 @@ +{ + "name": "object-is", + "version": "1.1.6", + "description": "ES2015-compliant shim for Object.is - differentiates between -0 and +0", + "author": "Jordan Harband", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/es-shims/object-is.git" + }, + "bugs": { + "url": "https://github.com/es-shims/object-is/issues" + }, + "homepage": "https://github.com/es-shims/object-is", + "keywords": [ + "is", + "Object.is", + "equality", + "sameValueZero", + "ES6", + "ES2015", + "shim", + "polyfill", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "devDependencies": { + "@es-shims/api": "^2.4.2", + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "functions-have-names": "^1.2.3", + "has-symbols": "^1.0.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5" + }, + "testling": { + "files": "test.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..12.0", + "opera/15.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/object-is/polyfill.js b/node_modules/object-is/polyfill.js new file mode 100644 index 000000000..96cd58a48 --- /dev/null +++ b/node_modules/object-is/polyfill.js @@ -0,0 +1,7 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + return typeof Object.is === 'function' ? Object.is : implementation; +}; diff --git a/node_modules/object-is/shim.js b/node_modules/object-is/shim.js new file mode 100644 index 000000000..e6650d385 --- /dev/null +++ b/node_modules/object-is/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var getPolyfill = require('./polyfill'); +var define = require('define-properties'); + +module.exports = function shimObjectIs() { + var polyfill = getPolyfill(); + define(Object, { is: polyfill }, { + is: function testObjectIs() { + return Object.is !== polyfill; + } + }); + return polyfill; +}; diff --git a/node_modules/object-is/test/implementation.js b/node_modules/object-is/test/implementation.js new file mode 100644 index 000000000..76de8be56 --- /dev/null +++ b/node_modules/object-is/test/implementation.js @@ -0,0 +1,12 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + runTests(callBind(implementation, Object), t); + + t.end(); +}); diff --git a/node_modules/object-is/test/index.js b/node_modules/object-is/test/index.js new file mode 100644 index 000000000..39f34b307 --- /dev/null +++ b/node_modules/object-is/test/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var index = require('../'); +var test = require('tape'); + +var runTests = require('./tests'); + +test('as a function', function (t) { + runTests(index, t); + + t.end(); +}); diff --git a/node_modules/object-is/test/shimmed.js b/node_modules/object-is/test/shimmed.js new file mode 100644 index 000000000..eb8de9714 --- /dev/null +++ b/node_modules/object-is/test/shimmed.js @@ -0,0 +1,28 @@ +'use strict'; + +require('../auto'); + +var runTests = require('./tests'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +test('shimmed', function (t) { + t.equal(Object.is.length, 2, 'Object.is has a length of 2'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.is.name, 'is', 'Object.is has name "is"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'is'), 'Object.is is not enumerable'); + et.end(); + }); + + runTests(callBind(Object.is, Object), t); + + t.end(); +}); diff --git a/node_modules/object-is/test/tests.js b/node_modules/object-is/test/tests.js new file mode 100644 index 000000000..c9af9f27f --- /dev/null +++ b/node_modules/object-is/test/tests.js @@ -0,0 +1,57 @@ +'use strict'; + +var hasSymbols = require('has-symbols')(); + +module.exports = function runTests(is, t) { + t.test('works with primitives', function (st) { + st.ok(is(), 'two absent args are the same'); + st.ok(is(undefined), 'undefined & one absent arg are the same'); + st.ok(is(undefined, undefined), 'undefined is undefined'); + st.ok(is(null, null), 'null is null'); + st.ok(is(true, true), 'true is true'); + st.ok(is(false, false), 'false is false'); + st.notOk(is(true, false), 'true is not false'); + st.end(); + }); + + t.test('works with NaN', function (st) { + st.ok(is(NaN, NaN), 'NaN is NaN'); + st.end(); + }); + + t.test('differentiates zeroes', function (st) { + st.ok(is(0, 0), '+0 is +0'); + st.ok(is(-0, -0), '-0 is -0'); + st.notOk(is(0, -0), '+0 is not -0'); + st.end(); + }); + + t.test('nonzero numbers', function (st) { + st.ok(is(Infinity, Infinity), 'infinity is infinity'); + st.ok(is(-Infinity, -Infinity), 'infinity is infinity'); + st.ok(is(42, 42), '42 is 42'); + st.notOk(is(42, -42), '42 is not -42'); + st.end(); + }); + + t.test('strings', function (st) { + st.ok(is('', ''), 'empty string is empty string'); + st.ok(is('foo', 'foo'), 'string is string'); + st.notOk(is('foo', 'bar'), 'string is not different string'); + st.end(); + }); + + t.test('objects', function (st) { + var obj = {}; + st.ok(is(obj, obj), 'object is same object'); + st.notOk(is(obj, {}), 'object is not different object'); + st.end(); + }); + + t.test('Symbols', { skip: !hasSymbols }, function (st) { + st.ok(is(Symbol.iterator, Symbol.iterator), 'Symbol.iterator is itself'); + st.notOk(is(Symbol(), Symbol()), 'different Symbols are not equal'); + st.notOk(is(Symbol.iterator, Object(Symbol.iterator)), 'Symbol.iterator is not boxed form of itself'); + st.end(); + }); +}; diff --git a/node_modules/object-keys/.editorconfig b/node_modules/object-keys/.editorconfig new file mode 100644 index 000000000..eaa214161 --- /dev/null +++ b/node_modules/object-keys/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/object-keys/.eslintrc b/node_modules/object-keys/.eslintrc new file mode 100644 index 000000000..9a8d5b0e9 --- /dev/null +++ b/node_modules/object-keys/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 23], + "id-length": [2, { "min": 1, "max": 40 }], + "max-params": [2, 3], + "max-statements": [2, 23], + "max-statements-per-line": [2, { "max": 2 }], + "no-extra-parens": [1], + "no-invalid-this": [1], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "LabeledStatement", "WithStatement"], + "operator-linebreak": [2, "after"] + } +} diff --git a/node_modules/object-keys/.travis.yml b/node_modules/object-keys/.travis.yml new file mode 100644 index 000000000..94a6ce42d --- /dev/null +++ b/node_modules/object-keys/.travis.yml @@ -0,0 +1,277 @@ +language: node_js +os: + - linux +node_js: + - "11.8" + - "10.15" + - "9.11" + - "8.15" + - "7.10" + - "6.16" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "11.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.14" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.14" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.15" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.14" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true + - env: POSTTEST=true diff --git a/node_modules/object-keys/CHANGELOG.md b/node_modules/object-keys/CHANGELOG.md new file mode 100644 index 000000000..b7d92df24 --- /dev/null +++ b/node_modules/object-keys/CHANGELOG.md @@ -0,0 +1,232 @@ +1.1.1 / 2019-04-06 +================= + * [Fix] exclude deprecated Firefox keys (#53) + +1.1.0 / 2019-02-10 +================= + * [New] [Refactor] move full implementation to `implementation` entry point + * [Refactor] only evaluate the implementation if `Object.keys` is not present + * [Tests] up to `node` `v11.8`, `v10.15`, `v8.15`, `v6.16` + * [Tests] remove jscs + * [Tests] switch to `npm audit` from `nsp` + +1.0.12 / 2018-06-18 +================= + * [Fix] avoid accessing `window.applicationCache`, to avoid issues with latest Chrome on HTTP (#46) + +1.0.11 / 2016-07-05 +================= + * [Fix] exclude keys regarding the style (eg. `pageYOffset`) on `window` to avoid reflow (#32) + +1.0.10 / 2016-07-04 +================= + * [Fix] exclude `height` and `width` keys on `window` to avoid reflow (#31) + * [Fix] In IE 6, `window.external` makes `Object.keys` throw + * [Tests] up to `node` `v6.2`, `v5.10`, `v4.4` + * [Tests] use pretest/posttest for linting/security + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` + * [Dev Deps] remove unused eccheck script + dep + +1.0.9 / 2015-10-19 +================= + * [Fix] Blacklist 'frame' property on window (#16, #17) + * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` + +1.0.8 / 2015-10-14 +================= + * [Fix] wrap automation equality bug checking in try/catch, per [es5-shim#327](https://github.com/es-shims/es5-shim/issues/327) + * [Fix] Blacklist 'window.frameElement' per [es5-shim#322](https://github.com/es-shims/es5-shim/issues/322) + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + * [Dev Deps] update `eslint`, `tape`, `@ljharb/eslint-config`, `jscs` + +1.0.7 / 2015-07-18 +================= + * [Fix] A proper fix for 176f03335e90d5c8d0d8125a99f27819c9b9cdad / https://github.com/es-shims/es5-shim/issues/275 that doesn't break dontEnum/constructor fixes in IE 8. + * [Fix] Remove deprecation message in Chrome by touching deprecated window properties (#15) + * [Tests] Improve test output for automation equality bugfix + * [Tests] Test on `io.js` `v2.4` + +1.0.6 / 2015-07-09 +================= + * [Fix] Use an object lookup rather than ES5's `indexOf` (#14) + * [Tests] ES3 browsers don't have `Array.isArray` + * [Tests] Fix `no-shadow` rule, as well as an IE 8 bug caused by engine NFE shadowing bugs. + +1.0.5 / 2015-07-03 +================= + * [Fix] Fix a flabbergasting IE 8 bug where `localStorage.constructor.prototype === localStorage` throws + * [Tests] Test up to `io.js` `v2.3` + * [Dev Deps] Update `nsp`, `eslint` + +1.0.4 / 2015-05-23 +================= + * Fix a Safari 5.0 bug with `Object.keys` not working with `arguments` + * Test on latest `node` and `io.js` + * Update `jscs`, `tape`, `eslint`, `nsp`, `is`, `editorconfig-tools`, `covert` + +1.0.3 / 2015-01-06 +================= + * Revert "Make `object-keys` more robust against later environment tampering" to maintain ES3 compliance + +1.0.2 / 2014-12-28 +================= + * Update lots of dev dependencies + * Tweaks to README + * Make `object-keys` more robust against later environment tampering + +1.0.1 / 2014-09-03 +================= + * Update URLs and badges in README + +1.0.0 / 2014-08-26 +================= + * v1.0.0 + +0.6.1 / 2014-08-25 +================= + * v0.6.1 + * Updating dependencies (tape, covert, is) + * Update badges in readme + * Use separate var statements + +0.6.0 / 2014-04-23 +================= + * v0.6.0 + * Updating dependencies (tape, covert) + * Make sure boxed primitives, and arguments objects, work properly in ES3 browsers + * Improve test matrix: test all node versions, but only latest two stables are a failure + * Remove internal foreach shim. + +0.5.1 / 2014-03-09 +================= + * 0.5.1 + * Updating dependencies (tape, covert, is) + * Removing forEach from the module (but keeping it in tests) + +0.5.0 / 2014-01-30 +================= + * 0.5.0 + * Explicitly returning the shim, instead of returning native Object.keys when present + * Adding a changelog. + * Cleaning up IIFE wrapping + * Testing on node 0.4 through 0.11 + +0.4.0 / 2013-08-14 +================== + + * v0.4.0 + * In Chrome 4-10 and Safari 4, typeof (new RegExp) === 'function' + * If it's a string, make sure to use charAt instead of brackets. + * Only use Function#call if necessary. + * Making sure the context tests actually run. + * Better function detection + * Adding the android browser + * Fixing testling files + * Updating tape + * Removing the "is" dependency. + * Making an isArguments shim. + * Adding a local forEach shim and tests. + * Updating paths. + * Moving the shim test. + * v0.3.0 + +0.3.0 / 2013-05-18 +================== + + * README tweak. + * Fixing constructor enum issue. Fixes [#5](https://github.com/ljharb/object-keys/issues/5). + * Adding a test for [#5](https://github.com/ljharb/object-keys/issues/5) + * Updating readme. + * Updating dependencies. + * Giving credit to lodash. + * Make sure that a prototype's constructor property is not enumerable. Fixes [#3](https://github.com/ljharb/object-keys/issues/3). + * Adding additional tests to handle arguments objects, and to skip "prototype" in functions. Fixes [#2](https://github.com/ljharb/object-keys/issues/2). + * Fixing a typo on this test for [#3](https://github.com/ljharb/object-keys/issues/3). + * Adding node 0.10 to travis. + * Adding an IE < 9 test per [#3](https://github.com/ljharb/object-keys/issues/3) + * Adding an iOS 5 mobile Safari test per [#2](https://github.com/ljharb/object-keys/issues/2) + * Moving "indexof" and "is" to be dev dependencies. + * Making sure the shim works with functions. + * Flattening the tests. + +0.2.0 / 2013-05-10 +================== + + * v0.2.0 + * Object.keys should work with arrays. + +0.1.8 / 2013-05-10 +================== + + * v0.1.8 + * Upgrading dependencies. + * Using a simpler check. + * Fixing a bug in hasDontEnumBug browsers. + * Using the newest tape! + * Fixing this error test. + * "undefined" is probably a reserved word in ES3. + * Better test message. + +0.1.7 / 2013-04-17 +================== + + * Upgrading "is" once more. + * The key "null" is breaking some browsers. + +0.1.6 / 2013-04-17 +================== + + * v0.1.6 + * Upgrading "is" + +0.1.5 / 2013-04-14 +================== + + * Bumping version. + * Adding more testling browsers. + * Updating "is" + +0.1.4 / 2013-04-08 +================== + + * Using "is" instead of "is-extended". + +0.1.3 / 2013-04-07 +================== + + * Using "foreach" instead of my own shim. + * Removing "tap"; I'll just wait for "tape" to fix its node 0.10 bug. + +0.1.2 / 2013-04-03 +================== + + * Adding dependency status; moving links to an index at the bottom. + * Upgrading is-extended; version 0.1.2 + * Adding an npm version badge. + +0.1.1 / 2013-04-01 +================== + + * Adding Travis CI. + * Bumping the version. + * Adding indexOf since IE sucks. + * Adding a forEach shim since older browsers don't have Array#forEach. + * Upgrading tape - 0.3.2 uses Array#map + * Using explicit end instead of plan. + * Can't test with Array.isArray in older browsers. + * Using is-extended. + * Fixing testling files. + * JSHint/JSLint-ing. + * Removing an unused object. + * Using strict mode. + +0.1.0 / 2013-03-30 +================== + + * Changing the exports should have meant a higher version bump. + * Oops, fixing the repo URL. + * Adding more tests. + * 0.0.2 + * Merge branch 'export_one_thing'; closes [#1](https://github.com/ljharb/object-keys/issues/1) + * Move shim export to a separate file. diff --git a/node_modules/object-keys/LICENSE b/node_modules/object-keys/LICENSE new file mode 100644 index 000000000..28553fdd0 --- /dev/null +++ b/node_modules/object-keys/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2013 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION 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-keys/README.md b/node_modules/object-keys/README.md new file mode 100644 index 000000000..ed4c27702 --- /dev/null +++ b/node_modules/object-keys/README.md @@ -0,0 +1,76 @@ +#object-keys [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable. + +Most common usage: +```js +var keys = Object.keys || require('object-keys'); +``` + +## Example + +```js +var keys = require('object-keys'); +var assert = require('assert'); +var obj = { + a: true, + b: true, + c: true +}; + +assert.deepEqual(keys(obj), ['a', 'b', 'c']); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is not present */ +delete Object.keys; +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is present */ +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, Object.keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +## Source +Implementation taken directly from [es5-shim][es5-shim-url], with modifications, including from [lodash][lodash-url]. + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/object-keys +[npm-version-svg]: http://versionbadg.es/ljharb/object-keys.svg +[travis-svg]: https://travis-ci.org/ljharb/object-keys.svg +[travis-url]: https://travis-ci.org/ljharb/object-keys +[deps-svg]: https://david-dm.org/ljharb/object-keys.svg +[deps-url]: https://david-dm.org/ljharb/object-keys +[dev-deps-svg]: https://david-dm.org/ljharb/object-keys/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/object-keys#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/object-keys.png +[testling-url]: https://ci.testling.com/ljharb/object-keys +[es5-shim-url]: https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L542-589 +[lodash-url]: https://github.com/lodash/lodash +[npm-badge-png]: https://nodei.co/npm/object-keys.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object-keys.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object-keys.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object-keys + diff --git a/node_modules/object-keys/implementation.js b/node_modules/object-keys/implementation.js new file mode 100644 index 000000000..5b3298619 --- /dev/null +++ b/node_modules/object-keys/implementation.js @@ -0,0 +1,122 @@ +'use strict'; + +var keysShim; +if (!Object.keys) { + // modified from https://github.com/es-shims/es5-shim + var has = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var isArgs = require('./isArguments'); // eslint-disable-line global-require + var isEnumerable = Object.prototype.propertyIsEnumerable; + var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); + var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); + var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; + }; + var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true + }; + var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; + }()); + var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } + }; + + keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; + }; +} +module.exports = keysShim; diff --git a/node_modules/object-keys/index.js b/node_modules/object-keys/index.js new file mode 100644 index 000000000..a43807d2f --- /dev/null +++ b/node_modules/object-keys/index.js @@ -0,0 +1,32 @@ +'use strict'; + +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); + +var origKeys = Object.keys; +var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); + +var originalKeys = Object.keys; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + var args = Object.keys(arguments); + return args && args.length === arguments.length; + }(1, 2)); + if (!keysWorksWithArguments) { + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } + return originalKeys(object); + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; diff --git a/node_modules/object-keys/isArguments.js b/node_modules/object-keys/isArguments.js new file mode 100644 index 000000000..f2a2a9014 --- /dev/null +++ b/node_modules/object-keys/isArguments.js @@ -0,0 +1,17 @@ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; diff --git a/node_modules/object-keys/package.json b/node_modules/object-keys/package.json new file mode 100644 index 000000000..99ea92387 --- /dev/null +++ b/node_modules/object-keys/package.json @@ -0,0 +1,88 @@ +{ + "name": "object-keys", + "version": "1.1.1", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net" + }, + { + "name": "Ivan Starkov", + "email": "istarkov@gmail.com" + }, + { + "name": "Gary Katsevman", + "email": "git@gkatsev.com" + } + ], + "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent audit", + "tests-only": "node test/index.js", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "eslint .", + "preaudit": "npm install --package-lock --package-lock-only", + "audit": "npm audit", + "postaudit": "rm package-lock.json" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/object-keys.git" + }, + "keywords": [ + "Object.keys", + "keys", + "ES5", + "shim" + ], + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^13.1.1", + "covert": "^1.1.1", + "eslint": "^5.13.0", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.3.0", + "tape": "^4.9.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/object-keys/test/index.js b/node_modules/object-keys/test/index.js new file mode 100644 index 000000000..5402465a1 --- /dev/null +++ b/node_modules/object-keys/test/index.js @@ -0,0 +1,5 @@ +'use strict'; + +require('./isArguments'); + +require('./shim'); diff --git a/node_modules/object.assign/.editorconfig b/node_modules/object.assign/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/object.assign/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/object.assign/.eslintrc b/node_modules/object.assign/.eslintrc new file mode 100644 index 000000000..131851698 --- /dev/null +++ b/node_modules/object.assign/.eslintrc @@ -0,0 +1,28 @@ +{ + "root": true, + + "extends": "@ljharb", + + "ignorePatterns": ["dist/"], + + "rules": { + "eqeqeq": [2, "allow-null"], + "id-length": [2, { "min": 1, "max": 30 }], + "max-statements": [2, 33], + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": [1, { "ignore": [0] }], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "no-invalid-this": 1, + "max-lines-per-function": 0, + "max-statements-per-line": [2, { "max": 3 }], + "no-magic-numbers": 0, + }, + }, + ], +} diff --git a/node_modules/object.assign/.github/FUNDING.yml b/node_modules/object.assign/.github/FUNDING.yml new file mode 100644 index 000000000..ef7fdbfa0 --- /dev/null +++ b/node_modules/object.assign/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/object.assign +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/object.assign/.nycrc b/node_modules/object.assign/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/object.assign/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/object.assign/CHANGELOG.md b/node_modules/object.assign/CHANGELOG.md new file mode 100644 index 000000000..509f766dc --- /dev/null +++ b/node_modules/object.assign/CHANGELOG.md @@ -0,0 +1,246 @@ +4.1.7 / 2024-12-18 +================== + * [Deps] add missing `es-object-atoms` (#86) + +4.1.6 / 2024-12-18 +================== + * [Refactor] use `call-bound` directly; use `es-object-atoms` + * [Deps] update `call-bind`, `has-symbols` + * [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `hasown`, `mock-property`, `ses`, `tape` + * [actions] split out node 10-20, and 20+ + * [actions] remove redundant finisher + * [Tests] replace `aud` with `npm audit` + +4.1.5 / 2023-11-30 +================== + * [meta] republish without testing HTML file (#85) + * [Deps] update `call-bind`, `define-properties` + * [Dev Deps] use `hasown` instead of `has` + * [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `npmignore`, `mock-property`, `tape` + * [actions] update rebase action + +4.1.4 / 2022-08-16 +================== + * [meta] fix `npmignore` integration (#83) + +4.1.3 / 2022-08-05 +================== + * [Refactor] make steps closer to actual spec + * [Refactor] simplify object coercible check + * [readme] remove defunct badges, add coverage and actions badges + * [eslint] ignore coverage output + * [meta] use `npmignore` to autogenerate an npmignore file + * [meta] remove audit-level + * [Deps] update `call-bind`, `define-properties`, `has-symbols` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `functions-have-names`, `safe-publish-latest`, `ses`, `tape` + * [actions] use `node/install` instead of `node/run`; use `codecov` action + * [actions] reuse common workflows + * [actions] update codecov uploader + * [Tests] add implementation tests + * [Tests] use `mock-property` + * [Tests] disable posttest pending `aud` handling `file:` deps + * [Tests] migrate remaining tests to Github Actions (#81) + * [Tests] gitignore coverage output + * [Tests] test node v1-v9 on Github Actions instead of travis; resume testing all minors (#80) + +4.1.2 / 2020-10-30 +================== + * [Refactor] use extracted `call-bind` instead of full `es-abstract` + * [Dev Deps] update `eslint`, `ses`, `browserify` + * [Tests] run tests in SES + * [Tests] ses-compat: show error stacks + +4.1.1 / 2020-09-11 +================== + * [Fix] avoid mutating `Object.assign` in modern engines + * [Refactor] use `callBind` from `es-abstract` instead of `function-bind` + * [Deps] update `has-symbols`, `object-keys`, `define-properties` + * [meta] add `funding` field, FUNDING.yml + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `browserify`, `covert`, `for-each`, `is`, `tape`, `functions-have-names`; add `aud`, `safe-publish-latest`; remove `jscs` + * [actions] add Require Allow Edits workflow + * [actions] add automatic rebasing / merge commit blocking + * [Tests] ses-compat - add test to ensure package initializes correctly after ses lockdown (#77) + * [Tests] Add passing test for a source of `window.location` (#68) + * [Tests] use shared travis-ci config + * [Tests] use `npx aud` instead of `npm audit` with hoops or `nsp` + * [Tests] use `functions-have-names` + +4.1.0 / 2017-12-21 +================== + * [New] add `auto` entry point (#52) + * [Refactor] Use `has-symbols` module + * [Deps] update `function-bind`, `object-keys` + * [Dev Deps] update `@es-shims/api`, `browserify`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is` + * [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS + +4.0.4 / 2016-07-04 +================== + * [Fix] Cache original `getOwnPropertySymbols`, and use that when `Object.getOwnPropertySymbols` is unavailable + * [Deps] update `object-keys` + * [Dev Deps] update `eslint`, `get-own-property-symbols`, `core-js`, `jscs`, `nsp`, `browserify`, `@ljharb/eslint-config`, `tape`, `@es-shims/api` + * [Tests] up to `node` `v6.2`, `v5.10`, `v4.4` + * [Tests] run sham tests on node 0.10 + * [Tests] use pretest/posttest for linting/security + +4.0.3 / 2015-10-21 +================== + * [Fix] Support core-js's Symbol sham (#17) + * [Fix] Ensure that properties removed or made non-enumerable during enumeration are not assigned (#16) + * [Fix] Avoid looking up keys and values more than once + * [Tests] Avoid using `reduce` so `npm run test:shams:corejs` passes in `node` `v0.8` ([core-js#122](https://github.com/zloirock/core-js/issues/122)) + * [Tests] Refactor to use my conventional structure that separates shimmed, implementation, and common tests + * [Tests] Create `npm run test:shams` and better organize tests for symbol shams + * [Tests] Remove `nsp` in favor of `requiresafe` + +4.0.2 / 2015-10-20 +================== + * [Fix] Ensure correct property enumeration order, particularly in v8 (#15) + * [Deps] update `object-keys`, `define-properties` + * [Dev Deps] update `browserify`, `is`, `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + +4.0.1 / 2015-08-16 +================== + * [Docs] Add `Symbol` note to readme + +4.0.0 / 2015-08-15 +================== + * [Breaking] Implement the [es-shim API](es-shims/api). + * [Robustness] Make implementation robust against later modification of environment methods. + * [Refactor] Move implementation to `implementation.js` + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Deps] update `object-keys`, `define-properties` + * [Dev Deps] update `browserify`, `tape`, `eslint`, `jscs`, `browserify` + * [Tests] Add `npm run tests-only` + * [Tests] use my personal shared `eslint` config. + * [Tests] up to `io.js` `v3.0` + +3.0.1 / 2015-06-28 +================== + * Cache `Object` and `Array#push` to make the shim more robust. + * [Fix] Remove use of `Array#filter`, which isn't in ES3. + * [Deps] Update `object-keys`, `define-properties` + * [Dev Deps] Update `get-own-property-symbols`, `browserify`, `eslint`, `nsp` + * [Tests] Test up to `io.js` `v2.3` + * [Tests] Adding `Object.assign` tests for non-object targets, per https://github.com/paulmillr/es6-shim/issues/348 + +3.0.0 / 2015-05-20 +================== + * Attempt to feature-detect Symbols, even if `typeof Symbol() !== 'symbol'` (#12) + * Make a separate `hasSymbols` internal module + * Update `browserify`, `eslint` + +2.0.3 / 2015-06-28 +================== + * Cache `Object` and `Array#push` to make the shim more robust. + * [Fix] Remove use of `Array#filter`, which isn't in ES3 + * [Deps] Update `object-keys`, `define-properties` + * [Dev Deps] Update `browserify`, `nsp`, `eslint` + * [Tests] Test up to `io.js` `v2.3` + +2.0.2 / 2015-05-20 +================== + * Make sure `.shim` is non-enumerable. + * Refactor `.shim` implementation to use `define-properties` predicates, rather than `delete`ing the original. + * Update docs to match spec/implementation. (#11) + * Add `npm run eslint` + * Test up to `io.js` `v2.0` + * Update `jscs`, `browserify`, `covert` + +2.0.1 / 2015-04-12 +================== + * Make sure non-enumerable Symbols are excluded. + +2.0.0 / 2015-04-12 +================== + * Make sure the shim function overwrites a broken implementation with pending exceptions. + * Ensure shim is not enumerable using `define-properties` + * Ensure `Object.assign` includes symbols. + * All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. + * Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. + * Add `npm run security` via `nsp` + * Update `browserify`, `jscs`, `tape`, `object-keys`, `is` + +1.1.1 / 2014-12-14 +================== + * Actually include the browser build in `npm` + +1.1.0 / 2014-12-14 +================== + * Add `npm run build`, and build an automatic-shimming browser distribution as part of the npm publish process. + * Update `is`, `jscs` + +1.0.3 / 2014-11-29 +================== + * Revert "optimize --production installs" + +1.0.2 / 2014-11-27 +================== + * Update `jscs`, `is`, `object-keys`, `tape` + * Add badges to README + * Name URLs in README + * Lock `covert` to `v1.0.0` + * Optimize --production installs + +1.0.1 / 2014-08-26 +================== + * Update `is`, `covert` + +1.0.0 / 2014-08-07 +================== + * Update `object-keys`, `tape` + +0.5.0 / 2014-07-31 +================== + * Object.assign no longer throws on null or undefined sources, per https://bugs.ecmascript.org/show_bug.cgi?id=3096 + +0.4.3 / 2014-07-30 +================== + * Don’t modify vars in the function signature, since it deoptimizes v8 + +0.4.2 / 2014-07-30 +================== + * Fixing the version number: v0.4.2 + +0.4.1 / 2014-07-19 +================== + * Revert "Use the native Object.keys if it’s available." + +0.4.0 / 2014-07-19 +================== + * Use the native Object.keys if it’s available. + * Fixes [#2](https://github.com/ljharb/object.assign/issues/2). + * Adding failing tests for [#2](https://github.com/ljharb/object.assign/issues/2). + * Fix indentation. + * Adding `npm run lint` + * Update `tape`, `covert` + * README: Use SVG badge for Travis [#1](https://github.com/ljharb/object.assign/issues/1) from mathiasbynens/patch-1 + +0.3.1 / 2014-04-10 +================== + * Object.assign does partially modify objects if it throws, per https://twitter.com/awbjs/status/454320863093862400 + +0.3.0 / 2014-04-10 +================== + * Update with newest ES6 behavior - Object.assign now takes a variable number of source objects. + * Update `tape` + * Make sure old and unstable nodes don’t fail Travis + +0.2.1 / 2014-03-16 +================== + * Let object-keys handle the fallback + * Update dependency badges + * Adding bower.json + +0.2.0 / 2014-03-16 +================== + * Use a for loop, because ES3 browsers don’t have "reduce" + +0.1.1 / 2014-03-14 +================== + * Updating readme + +0.1.0 / 2014-03-14 +================== + * Initial release. + diff --git a/node_modules/object.assign/LICENSE b/node_modules/object.assign/LICENSE new file mode 100644 index 000000000..ab29cbd63 --- /dev/null +++ b/node_modules/object.assign/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION 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.assign/README.md b/node_modules/object.assign/README.md new file mode 100644 index 000000000..8e933fee6 --- /dev/null +++ b/node_modules/object.assign/README.md @@ -0,0 +1,136 @@ +# object.assign [![Version Badge][npm-version-svg]][npm-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][npm-url] + +An Object.assign shim. Invoke its "shim" method to shim Object.assign if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. + +Takes a minimum of 2 arguments: `target` and `source`. +Takes a variable sized list of source arguments - at least 1, as many as you want. +Throws a TypeError if the `target` argument is `null` or `undefined`. + +Most common usage: +```js +var assign = require('object.assign').getPolyfill(); // returns native method if compliant + /* or */ +var assign = require('object.assign/polyfill')(); // returns native method if compliant +``` + +## Example + +```js +var assert = require('assert'); + +// Multiple sources! +var target = { a: true }; +var source1 = { b: true }; +var source2 = { c: true }; +var sourceN = { n: true }; + +var expected = { + a: true, + b: true, + c: true, + n: true +}; + +assign(target, source1, source2, sourceN); +assert.deepEqual(target, expected); // AWESOME! +``` + +```js +var target = { + a: true, + b: true, + c: true +}; +var source1 = { + c: false, + d: false +}; +var sourceN = { + e: false +}; + +var assigned = assign(target, source1, sourceN); +assert.equal(target, assigned); // returns the target object +assert.deepEqual(assigned, { + a: true, + b: true, + c: false, + d: false, + e: false +}); +``` + +```js +/* when Object.assign is not present */ +delete Object.assign; +var shimmedAssign = require('object.assign').shim(); + /* or */ +var shimmedAssign = require('object.assign/shim')(); + +assert.equal(shimmedAssign, assign); + +var target = { + a: true, + b: true, + c: true +}; +var source = { + c: false, + d: false, + e: false +}; + +var assigned = assign(target, source); +assert.deepEqual(Object.assign(target, source), assign(target, source)); +``` + +```js +/* when Object.assign is present */ +var shimmedAssign = require('object.assign').shim(); +assert.equal(shimmedAssign, Object.assign); + +var target = { + a: true, + b: true, + c: true +}; +var source = { + c: false, + d: false, + e: false +}; + +assert.deepEqual(Object.assign(target, source), assign(target, source)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[npm-url]: https://npmjs.org/package/object.assign +[npm-version-svg]: http://versionbadg.es/ljharb/object.assign.svg +[travis-svg]: https://travis-ci.org/ljharb/object.assign.svg +[travis-url]: https://travis-ci.org/ljharb/object.assign +[deps-svg]: https://david-dm.org/ljharb/object.assign.svg?theme=shields.io +[deps-url]: https://david-dm.org/ljharb/object.assign +[dev-deps-svg]: https://david-dm.org/ljharb/object.assign/dev-status.svg?theme=shields.io +[dev-deps-url]: https://david-dm.org/ljharb/object.assign#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/object.assign.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object.assign.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object.assign.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object.assign +[codecov-image]: https://codecov.io/gh/ljharb/object.assign/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/object.assign/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/object.assign +[actions-url]: https://github.com/ljharb/object.assign/actions diff --git a/node_modules/object.assign/auto.js b/node_modules/object.assign/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/object.assign/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/object.assign/dist/browser.js b/node_modules/object.assign/dist/browser.js new file mode 100644 index 000000000..a644f9bc9 --- /dev/null +++ b/node_modules/object.assign/dist/browser.js @@ -0,0 +1,1304 @@ +(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 0 ? adjustedLength : 0), + true + ); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + +},{"call-bind-apply-helpers":8,"call-bind-apply-helpers/applyBind":5,"es-define-property":15,"set-function-length":41}],11:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBindBasic = require('call-bind-apply-helpers'); + +/** @type {(thisArg: string, searchString: string, position?: number) => number} */ +var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); + +/** @type {import('.')} */ +module.exports = function callBoundIntrinsic(name, allowMissing) { + // eslint-disable-next-line no-extra-parens + var intrinsic = /** @type {Parameters[0][0]} */ (GetIntrinsic(name, !!allowMissing)); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBindBasic([intrinsic]); + } + return intrinsic; +}; + +},{"call-bind-apply-helpers":8,"get-intrinsic":26}],12:[function(require,module,exports){ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); + +var gopd = require('gopd'); + +/** @type {import('.')} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; + +},{"es-define-property":15,"es-errors/syntax":20,"es-errors/type":21,"gopd":28}],13:[function(require,module,exports){ +'use strict'; + +var keys = require('object-keys'); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +var toStr = Object.prototype.toString; +var concat = Array.prototype.concat; +var defineDataProperty = require('define-data-property'); + +var isFunction = function (fn) { + return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; +}; + +var supportsDescriptors = require('has-property-descriptors')(); + +var defineProperty = function (object, name, value, predicate) { + if (name in object) { + if (predicate === true) { + if (object[name] === value) { + return; + } + } else if (!isFunction(predicate) || !predicate()) { + return; + } + } + + if (supportsDescriptors) { + defineDataProperty(object, name, value, true); + } else { + defineDataProperty(object, name, value); + } +}; + +var defineProperties = function (object, map) { + var predicates = arguments.length > 2 ? arguments[2] : {}; + var props = keys(map); + if (hasSymbols) { + props = concat.call(props, Object.getOwnPropertySymbols(map)); + } + for (var i = 0; i < props.length; i += 1) { + defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + } +}; + +defineProperties.supportsDescriptors = !!supportsDescriptors; + +module.exports = defineProperties; + +},{"define-data-property":12,"has-property-descriptors":29,"object-keys":39}],14:[function(require,module,exports){ +'use strict'; + +var callBind = require('call-bind-apply-helpers'); +var gOPD = require('gopd'); + +var hasProtoAccessor; +try { + // eslint-disable-next-line no-extra-parens, no-proto + hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype; +} catch (e) { + if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') { + throw e; + } +} + +// eslint-disable-next-line no-extra-parens +var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__')); + +var $Object = Object; +var $getPrototypeOf = $Object.getPrototypeOf; + +/** @type {import('./get')} */ +module.exports = desc && typeof desc.get === 'function' + ? callBind([desc.get]) + : typeof $getPrototypeOf === 'function' + ? /** @type {import('./get')} */ function getDunder(value) { + // eslint-disable-next-line eqeqeq + return $getPrototypeOf(value == null ? value : $Object(value)); + } + : false; + +},{"call-bind-apply-helpers":8,"gopd":28}],15:[function(require,module,exports){ +'use strict'; + +/** @type {import('.')} */ +var $defineProperty = Object.defineProperty || false; +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = false; + } +} + +module.exports = $defineProperty; + +},{}],16:[function(require,module,exports){ +'use strict'; + +/** @type {import('./eval')} */ +module.exports = EvalError; + +},{}],17:[function(require,module,exports){ +'use strict'; + +/** @type {import('.')} */ +module.exports = Error; + +},{}],18:[function(require,module,exports){ +'use strict'; + +/** @type {import('./range')} */ +module.exports = RangeError; + +},{}],19:[function(require,module,exports){ +'use strict'; + +/** @type {import('./ref')} */ +module.exports = ReferenceError; + +},{}],20:[function(require,module,exports){ +'use strict'; + +/** @type {import('./syntax')} */ +module.exports = SyntaxError; + +},{}],21:[function(require,module,exports){ +'use strict'; + +/** @type {import('./type')} */ +module.exports = TypeError; + +},{}],22:[function(require,module,exports){ +'use strict'; + +/** @type {import('./uri')} */ +module.exports = URIError; + +},{}],23:[function(require,module,exports){ +'use strict'; + +/** @type {import('.')} */ +module.exports = Object; + +},{}],24:[function(require,module,exports){ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var toStr = Object.prototype.toString; +var max = Math.max; +var funcType = '[object Function]'; + +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slicy(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + concatty(args, arguments) + ); + if (Object(result) === result) { + return result; + } + return this; + } + return target.apply( + that, + concatty(args, arguments) + ); + + }; + + var boundLength = max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs[i] = '$' + i; + } + + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; + +},{}],25:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; + +},{"./implementation":24}],26:[function(require,module,exports){ +'use strict'; + +var undefined; + +var $Object = require('es-object-atoms'); + +var $Error = require('es-errors'); +var $EvalError = require('es-errors/eval'); +var $RangeError = require('es-errors/range'); +var $ReferenceError = require('es-errors/ref'); +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); +var $URIError = require('es-errors/uri'); + +var abs = require('math-intrinsics/abs'); +var floor = require('math-intrinsics/floor'); +var max = require('math-intrinsics/max'); +var min = require('math-intrinsics/min'); +var pow = require('math-intrinsics/pow'); + +var $Function = Function; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = require('gopd'); +var $defineProperty = require('es-define-property'); + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); +var getDunderProto = require('dunder-proto/get'); + +var getProto = (typeof Reflect === 'function' && Reflect.getPrototypeOf) + || $Object.getPrototypeOf + || getDunderProto; + +var $apply = require('call-bind-apply-helpers/functionApply'); +var $call = require('call-bind-apply-helpers/functionCall'); + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + __proto__: null, + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': $Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': $EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': $Object, + '%Object.getOwnPropertyDescriptor%': $gOPD, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': $RangeError, + '%ReferenceError%': $ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': $URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, + + '%Function.prototype.call%': $call, + '%Function.prototype.apply%': $apply, + '%Object.defineProperty%': $defineProperty, + '%Math.abs%': abs, + '%Math.floor%': floor, + '%Math.max%': max, + '%Math.min%': min, + '%Math.pow%': pow +}; + +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen && getProto) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + __proto__: null, + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = require('function-bind'); +var hasOwn = require('hasown'); +var $concat = bind.call($call, Array.prototype.concat); +var $spliceApply = bind.call($apply, Array.prototype.splice); +var $replace = bind.call($call, String.prototype.replace); +var $strSlice = bind.call($call, String.prototype.slice); +var $exec = bind.call($call, RegExp.prototype.exec); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; + +},{"call-bind-apply-helpers/functionApply":6,"call-bind-apply-helpers/functionCall":7,"dunder-proto/get":14,"es-define-property":15,"es-errors":17,"es-errors/eval":16,"es-errors/range":18,"es-errors/ref":19,"es-errors/syntax":20,"es-errors/type":21,"es-errors/uri":22,"es-object-atoms":23,"function-bind":25,"gopd":28,"has-symbols":30,"hasown":32,"math-intrinsics/abs":33,"math-intrinsics/floor":34,"math-intrinsics/max":35,"math-intrinsics/min":36,"math-intrinsics/pow":37}],27:[function(require,module,exports){ +'use strict'; + +/** @type {import('./gOPD')} */ +module.exports = Object.getOwnPropertyDescriptor; + +},{}],28:[function(require,module,exports){ +'use strict'; + +/** @type {import('.')} */ +var $gOPD = require('./gOPD'); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; + +},{"./gOPD":27}],29:[function(require,module,exports){ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + return !!$defineProperty; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!$defineProperty) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; + +},{"es-define-property":15}],30:[function(require,module,exports){ +'use strict'; + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = require('./shams'); + +/** @type {import('.')} */ +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + +},{"./shams":31}],31:[function(require,module,exports){ +'use strict'; + +/** @type {import('./shams')} */ +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + /** @type {{ [k in symbol]?: unknown }} */ + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + // eslint-disable-next-line no-extra-parens + var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym)); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + +},{}],32:[function(require,module,exports){ +'use strict'; + +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; +var bind = require('function-bind'); + +/** @type {import('.')} */ +module.exports = bind.call(call, $hasOwn); + +},{"function-bind":25}],33:[function(require,module,exports){ +'use strict'; + +/** @type {import('./abs')} */ +module.exports = Math.abs; + +},{}],34:[function(require,module,exports){ +'use strict'; + +/** @type {import('./abs')} */ +module.exports = Math.floor; + +},{}],35:[function(require,module,exports){ +'use strict'; + +/** @type {import('./max')} */ +module.exports = Math.max; + +},{}],36:[function(require,module,exports){ +'use strict'; + +/** @type {import('./min')} */ +module.exports = Math.min; + +},{}],37:[function(require,module,exports){ +'use strict'; + +/** @type {import('./pow')} */ +module.exports = Math.pow; + +},{}],38:[function(require,module,exports){ +'use strict'; + +var keysShim; +if (!Object.keys) { + // modified from https://github.com/es-shims/es5-shim + var has = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var isArgs = require('./isArguments'); // eslint-disable-line global-require + var isEnumerable = Object.prototype.propertyIsEnumerable; + var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); + var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); + var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; + }; + var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true + }; + var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; + }()); + var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } + }; + + keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; + }; +} +module.exports = keysShim; + +},{"./isArguments":40}],39:[function(require,module,exports){ +'use strict'; + +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); + +var origKeys = Object.keys; +var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); + +var originalKeys = Object.keys; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + var args = Object.keys(arguments); + return args && args.length === arguments.length; + }(1, 2)); + if (!keysWorksWithArguments) { + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } + return originalKeys(object); + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; + +},{"./implementation":38,"./isArguments":40}],40:[function(require,module,exports){ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; + +},{}],41:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); + +var $TypeError = require('es-errors/type'); +var $floor = GetIntrinsic('%Math.floor%'); + +/** @type {import('.')} */ +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } + + var loose = arguments.length > 2 && !!arguments[2]; + + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'length', length); + } + } + return fn; +}; + +},{"define-data-property":12,"es-errors/type":21,"get-intrinsic":26,"gopd":28,"has-property-descriptors":29}],42:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +var lacksProperEnumerationOrder = function () { + if (!Object.assign) { + return false; + } + /* + * v8, specifically in node 4.x, has a bug with incorrect property enumeration order + * note: this does not detect the bug unless there's 20 characters + */ + var str = 'abcdefghijklmnopqrst'; + var letters = str.split(''); + var map = {}; + for (var i = 0; i < letters.length; ++i) { + map[letters[i]] = letters[i]; + } + var obj = Object.assign({}, map); + var actual = ''; + for (var k in obj) { + actual += k; + } + return str !== actual; +}; + +var assignHasPendingExceptions = function () { + if (!Object.assign || !Object.preventExtensions) { + return false; + } + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: 2 }); + try { + Object.assign(thrower, 'xy'); + } catch (e) { + return thrower[1] === 'y'; + } + return false; +}; + +module.exports = function getPolyfill() { + if (!Object.assign) { + return implementation; + } + if (lacksProperEnumerationOrder()) { + return implementation; + } + if (assignHasPendingExceptions()) { + return implementation; + } + return Object.assign; +}; + +},{"./implementation":2}],43:[function(require,module,exports){ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimAssign() { + var polyfill = getPolyfill(); + define( + Object, + { assign: polyfill }, + { assign: function () { return Object.assign !== polyfill; } } + ); + return polyfill; +}; + +},{"./polyfill":42,"define-properties":13}]},{},[1]); diff --git a/node_modules/object.assign/hasSymbols.js b/node_modules/object.assign/hasSymbols.js new file mode 100644 index 000000000..34841e011 --- /dev/null +++ b/node_modules/object.assign/hasSymbols.js @@ -0,0 +1,43 @@ +'use strict'; + +var keys = require('object-keys'); + +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + /* + * temp disabled per https://github.com/ljharb/object.assign/issues/17 + * if (sym instanceof Symbol) { return false; } + * temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + * if (!(symObj instanceof Symbol)) { return false; } + */ + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-unreachable-loop + if (keys(obj).length !== 0) { return false; } + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; diff --git a/node_modules/object.assign/implementation.js b/node_modules/object.assign/implementation.js new file mode 100644 index 000000000..4f4b4256f --- /dev/null +++ b/node_modules/object.assign/implementation.js @@ -0,0 +1,46 @@ +'use strict'; + +// modified from https://github.com/es-shims/es6-shim +var objectKeys = require('object-keys'); +var hasSymbols = require('has-symbols/shams')(); +var callBound = require('call-bound'); +var $Object = require('es-object-atoms'); +var $push = callBound('Array.prototype.push'); +var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable'); +var originalGetSymbols = hasSymbols ? $Object.getOwnPropertySymbols : null; + +// eslint-disable-next-line no-unused-vars +module.exports = function assign(target, source1) { + if (target == null) { throw new TypeError('target must be an object'); } + var to = $Object(target); // step 1 + if (arguments.length === 1) { + return to; // step 2 + } + for (var s = 1; s < arguments.length; ++s) { + var from = $Object(arguments[s]); // step 3.a.i + + // step 3.a.ii: + var keys = objectKeys(from); + var getSymbols = hasSymbols && ($Object.getOwnPropertySymbols || originalGetSymbols); + if (getSymbols) { + var syms = getSymbols(from); + for (var j = 0; j < syms.length; ++j) { + var key = syms[j]; + if ($propIsEnumerable(from, key)) { + $push(keys, key); + } + } + } + + // step 3.a.iii: + for (var i = 0; i < keys.length; ++i) { + var nextKey = keys[i]; + if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2 + var propValue = from[nextKey]; // step 3.a.iii.2.a + to[nextKey] = propValue; // step 3.a.iii.2.b + } + } + } + + return to; // step 4 +}; diff --git a/node_modules/object.assign/index.js b/node_modules/object.assign/index.js new file mode 100644 index 000000000..9b5060376 --- /dev/null +++ b/node_modules/object.assign/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var polyfill = callBind.apply(getPolyfill()); +// eslint-disable-next-line no-unused-vars +var bound = function assign(target, source1) { + return polyfill(Object, arguments); +}; + +defineProperties(bound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = bound; diff --git a/node_modules/object.assign/package.json b/node_modules/object.assign/package.json new file mode 100644 index 000000000..996fee0cd --- /dev/null +++ b/node_modules/object.assign/package.json @@ -0,0 +1,96 @@ +{ + "name": "object.assign", + "version": "4.1.7", + "author": "Jordan Harband", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES6 spec-compliant Object.assign shim. From https://github.com/es-shims/es6-shim", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "pretest": "npm run lint && es-shim-api --bound", + "test": "npm run tests-only && npm run test:ses", + "posttest": "npx npm@'>=10.2' audit --production", + "tests-only": "npm run test:implementation && npm run test:shim", + "test:native": "nyc node test/native", + "test:shim": "nyc node test/shimmed", + "test:implementation": "nyc node test", + "test:ses": "node test/ses-compat", + "lint": "eslint .", + "build": "mkdir -p dist && browserify browserShim.js > dist/browser.js", + "prepublishOnly": "safe-publish-latest && npm run build", + "prepublish": "not-in-publish || npm run prepublishOnly" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/object.assign.git" + }, + "keywords": [ + "Object.assign", + "assign", + "ES6", + "extend", + "$.extend", + "jQuery", + "_.extend", + "Underscore", + "es-shim API", + "polyfill", + "shim" + ], + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "browserify": "^16.5.2", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "hasown": "^2.0.2", + "mock-property": "^1.1.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "ses": "^1.10.0", + "tape": "^5.9.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "bower.json", + "browserShim.js", + "!dist/" + ] + } +} diff --git a/node_modules/object.assign/polyfill.js b/node_modules/object.assign/polyfill.js new file mode 100644 index 000000000..ca94aea9b --- /dev/null +++ b/node_modules/object.assign/polyfill.js @@ -0,0 +1,55 @@ +'use strict'; + +var implementation = require('./implementation'); + +var lacksProperEnumerationOrder = function () { + if (!Object.assign) { + return false; + } + /* + * v8, specifically in node 4.x, has a bug with incorrect property enumeration order + * note: this does not detect the bug unless there's 20 characters + */ + var str = 'abcdefghijklmnopqrst'; + var letters = str.split(''); + var map = {}; + for (var i = 0; i < letters.length; ++i) { + map[letters[i]] = letters[i]; + } + var obj = Object.assign({}, map); + var actual = ''; + for (var k in obj) { + actual += k; + } + return str !== actual; +}; + +var assignHasPendingExceptions = function () { + if (!Object.assign || !Object.preventExtensions) { + return false; + } + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: 2 }); + try { + Object.assign(thrower, 'xy'); + } catch (e) { + return thrower[1] === 'y'; + } + return false; +}; + +module.exports = function getPolyfill() { + if (!Object.assign) { + return implementation; + } + if (lacksProperEnumerationOrder()) { + return implementation; + } + if (assignHasPendingExceptions()) { + return implementation; + } + return Object.assign; +}; diff --git a/node_modules/object.assign/shim.js b/node_modules/object.assign/shim.js new file mode 100644 index 000000000..9f896ae3c --- /dev/null +++ b/node_modules/object.assign/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimAssign() { + var polyfill = getPolyfill(); + define( + Object, + { assign: polyfill }, + { assign: function () { return Object.assign !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/object.assign/test/implementation.js b/node_modules/object.assign/test/implementation.js new file mode 100644 index 000000000..05d7d7ada --- /dev/null +++ b/node_modules/object.assign/test/implementation.js @@ -0,0 +1,19 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad first arg/receiver', { skip: !hasStrictMode }, function (st) { + st['throws'](function () { implementation(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation, Object), t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/index.js b/node_modules/object.assign/test/index.js new file mode 100644 index 000000000..776b2b334 --- /dev/null +++ b/node_modules/object.assign/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var assign = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { assign(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { assign(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(assign, t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/native.js b/node_modules/object.assign/test/native.js new file mode 100644 index 000000000..49a70f798 --- /dev/null +++ b/node_modules/object.assign/test/native.js @@ -0,0 +1,49 @@ +'use strict'; + +var test = require('tape'); +var defineProperties = require('define-properties'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('native', function (t) { + t.equal(Object.assign.length, 2, 'Object.assign has a length of 2'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad object value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + // v8 in node 0.8 and 0.10 have non-enumerable string properties + var stringCharsAreEnumerable = isEnumerable.call('xy', 0); + t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) { + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: '2' }); + var error; + try { Object.assign(thrower, 'xy'); } catch (e) { error = e; } + st.equal(error instanceof TypeError, true, 'error is TypeError'); + st.equal(thrower[1], '2', 'thrower[1] === "2"'); + + st.end(); + }); + + runTests(Object.assign, t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/ses-compat.js b/node_modules/object.assign/test/ses-compat.js new file mode 100644 index 000000000..9669eb9a9 --- /dev/null +++ b/node_modules/object.assign/test/ses-compat.js @@ -0,0 +1,12 @@ +'use strict'; + +/* globals lockdown */ + +// requiring ses exposes "lockdown" on the global +require('ses'); + +// lockdown freezes the primordials +lockdown({ errorTaming: 'unsafe' }); + +// initialize the module +require('./'); diff --git a/node_modules/object.assign/test/shimmed.js b/node_modules/object.assign/test/shimmed.js new file mode 100644 index 000000000..ee577587a --- /dev/null +++ b/node_modules/object.assign/test/shimmed.js @@ -0,0 +1,52 @@ +'use strict'; + +var assign = require('../'); +assign.shim(); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.equal(Object.assign.length, 2, 'Object.assign has a length of 2'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad object value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + // v8 in node 0.8 and 0.10 have non-enumerable string properties + var stringCharsAreEnumerable = isEnumerable.call('xy', 0); + t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) { + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: '2' }); + var error; + try { Object.assign(thrower, 'xy'); } catch (e) { error = e; } + st.equal(error instanceof TypeError, true, 'error is TypeError'); + st.equal(thrower[1], '2', 'thrower[1] === "2"'); + + st.end(); + }); + + runTests(Object.assign, t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/tests.js b/node_modules/object.assign/test/tests.js new file mode 100644 index 000000000..eff2793d3 --- /dev/null +++ b/node_modules/object.assign/test/tests.js @@ -0,0 +1,232 @@ +'use strict'; + +var hasSymbols = require('has-symbols/shams')(); +var forEach = require('for-each'); +var hasOwn = require('hasown'); +var mockProperty = require('mock-property'); + +module.exports = function (assign, t) { + t.test('error cases', function (st) { + st['throws'](function () { assign(null); }, TypeError, 'target must be an object'); + st['throws'](function () { assign(undefined); }, TypeError, 'target must be an object'); + st['throws'](function () { assign(null, {}); }, TypeError, 'target must be an object'); + st['throws'](function () { assign(undefined, {}); }, TypeError, 'target must be an object'); + st.end(); + }); + + t.test('non-object target, no sources', function (st) { + var bool = assign(true); + st.equal(typeof bool, 'object', 'bool is object'); + st.equal(Boolean.prototype.valueOf.call(bool), true, 'bool coerces to `true`'); + + var number = assign(1); + st.equal(typeof number, 'object', 'number is object'); + st.equal(Number.prototype.valueOf.call(number), 1, 'number coerces to `1`'); + + var string = assign('1'); + st.equal(typeof string, 'object', 'number is object'); + st.equal(String.prototype.valueOf.call(string), '1', 'number coerces to `"1"`'); + + st.end(); + }); + + t.test('non-object target, with sources', function (st) { + var signal = {}; + + st.test('boolean', function (st2) { + var bool = assign(true, { a: signal }); + st2.equal(typeof bool, 'object', 'bool is object'); + st2.equal(Boolean.prototype.valueOf.call(bool), true, 'bool coerces to `true`'); + st2.equal(bool.a, signal, 'source properties copied'); + st2.end(); + }); + + st.test('number', function (st2) { + var number = assign(1, { a: signal }); + st2.equal(typeof number, 'object', 'number is object'); + st2.equal(Number.prototype.valueOf.call(number), 1, 'number coerces to `1`'); + st2.equal(number.a, signal, 'source properties copied'); + st2.end(); + }); + + st.test('string', function (st2) { + var string = assign('1', { a: signal }); + st2.equal(typeof string, 'object', 'number is object'); + st2.equal(String.prototype.valueOf.call(string), '1', 'number coerces to `"1"`'); + st2.equal(string.a, signal, 'source properties copied'); + st2.end(); + }); + + st.end(); + }); + + t.test('non-object sources', function (st) { + st.deepEqual(assign({ a: 1 }, null, { b: 2 }), { a: 1, b: 2 }, 'ignores null source'); + st.deepEqual(assign({ a: 1 }, { b: 2 }, undefined), { a: 1, b: 2 }, 'ignores undefined source'); + st.end(); + }); + + t.test('returns the modified target object', function (st) { + var target = {}; + var returned = assign(target, { a: 1 }); + st.equal(returned, target, 'returned object is the same reference as the target object'); + st.end(); + }); + + t.test('has the right length', function (st) { + st.equal(assign.length, 2, 'length is 2 => 2 required arguments'); + st.end(); + }); + + t.test('merge two objects', function (st) { + var target = { a: 1 }; + var returned = assign(target, { b: 2 }); + st.deepEqual(returned, { a: 1, b: 2 }, 'returned object has properties from both'); + st.end(); + }); + + t.test('works with functions', function (st) { + var target = function () {}; + target.a = 1; + var returned = assign(target, { b: 2 }); + st.equal(target, returned, 'returned object is target'); + st.equal(returned.a, 1); + st.equal(returned.b, 2); + st.end(); + }); + + t.test('works with primitives', function (st) { + var target = 2; + var source = { b: 42 }; + var returned = assign(target, source); + st.equal(Object.prototype.toString.call(returned), '[object Number]', 'returned is object form of number primitive'); + st.equal(Number(returned), target, 'returned and target have same valueOf'); + st.equal(returned.b, source.b); + st.end(); + }); + + /* globals window */ + t.test('works with window.location', { skip: typeof window === 'undefined' }, function (st) { + var target = {}; + assign(target, window.location); + for (var prop in window.location) { + if (hasOwn(window.location, prop)) { + st.deepEqual(target[prop], window.location[prop], prop + ' is copied'); + } + } + st.end(); + }); + + t.test('merge N objects', function (st) { + var target = { a: 1 }; + var source1 = { b: 2 }; + var source2 = { c: 3 }; + var returned = assign(target, source1, source2); + st.deepEqual(returned, { a: 1, b: 2, c: 3 }, 'returned object has properties from all sources'); + st.end(); + }); + + t.test('only iterates over own keys', function (st) { + var Foo = function () {}; + Foo.prototype.bar = true; + var foo = new Foo(); + foo.baz = true; + var target = { a: 1 }; + var returned = assign(target, foo); + st.equal(returned, target, 'returned object is the same reference as the target object'); + st.deepEqual(target, { a: 1, baz: true }, 'returned object has only own properties from both'); + st.end(); + }); + + t.test('includes enumerable symbols, after keys', { skip: !hasSymbols }, function (st) { + var visited = []; + var obj = {}; + Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } }); + var symbol = Symbol('enumerable'); + Object.defineProperty(obj, symbol, { + enumerable: true, + get: function () { visited.push(symbol); return Infinity; } + }); + var nonEnumSymbol = Symbol('non-enumerable'); + Object.defineProperty(obj, nonEnumSymbol, { + enumerable: false, + get: function () { visited.push(nonEnumSymbol); return -Infinity; } + }); + var target = assign({}, obj); + st.deepEqual(visited, ['a', symbol], 'key is visited first, then symbol'); + st.equal(target.a, 42, 'target.a is 42'); + st.equal(target[symbol], Infinity, 'target[symbol] is Infinity'); + st.notEqual(target[nonEnumSymbol], -Infinity, 'target[nonEnumSymbol] is not -Infinity'); + st.end(); + }); + + t.test('does not fail when symbols are not present', { skip: !Object.isFrozen || Object.isFrozen(Object) }, function (st) { + st.teardown(mockProperty(Object, 'getOwnPropertySymbols', { 'delete': true })); + + var visited = []; + var obj = {}; + Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } }); + var keys = ['a']; + if (hasSymbols) { + var symbol = Symbol('sym'); + Object.defineProperty(obj, symbol, { + enumerable: true, + get: function () { visited.push(symbol); return Infinity; } + }); + keys.push(symbol); + } + var target = assign({}, obj); + st.deepEqual(visited, keys, 'assign visits expected keys'); + st.equal(target.a, 42, 'target.a is 42'); + + if (hasSymbols) { + st.equal(target[symbol], Infinity); + } + st.end(); + }); + + t.test('preserves correct property enumeration order', function (st) { + var str = 'abcdefghijklmnopqrst'; + var letters = {}; + forEach(str.split(''), function (letter) { + letters[letter] = letter; + }); + + var n = 5; + st.comment('run the next test ' + n + ' times'); + var object = assign({}, letters); + var actual = ''; + for (var k in object) { + actual += k; + } + for (var i = 0; i < n; ++i) { + st.equal(actual, str, 'property enumeration order should be followed'); + } + st.end(); + }); + + t.test('checks enumerability and existence, in case of modification during [[Get]]', { skip: !Object.defineProperty }, function (st) { + var targetBvalue = {}; + var targetCvalue = {}; + var target = { b: targetBvalue, c: targetCvalue }; + var source = {}; + Object.defineProperty(source, 'a', { + enumerable: true, + get: function () { + delete this.b; + Object.defineProperty(this, 'c', { enumerable: false }); + return 'a'; + } + }); + var sourceBvalue = {}; + var sourceCvalue = {}; + source.b = sourceBvalue; + source.c = sourceCvalue; + var result = assign(target, source); + st.equal(result, target, 'sanity check: result is === target'); + st.equal(result.b, targetBvalue, 'target key not overwritten by deleted source key'); + st.equal(result.c, targetCvalue, 'target key not overwritten by non-enumerable source key'); + + st.end(); + }); +}; diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE new file mode 100644 index 000000000..19129e315 --- /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 000000000..1f1ffca93 --- /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 000000000..235406736 --- /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 000000000..16815b2fa --- /dev/null +++ b/node_modules/once/package.json @@ -0,0 +1,33 @@ +{ + "name": "once", + "version": "1.4.0", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.0.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "files": [ + "once.js" + ], + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC" +} diff --git a/node_modules/optionator/CHANGELOG.md b/node_modules/optionator/CHANGELOG.md new file mode 100644 index 000000000..2928cc2ce --- /dev/null +++ b/node_modules/optionator/CHANGELOG.md @@ -0,0 +1,59 @@ +# 0.9.0 +- update dependencies, in particular `levn` and `type-check` - this could affect behaviour of argument parsing + +# 0.8.3 +- changes dependency from `wordwrap` to `word-wrap` due to license issue +- update dependencies + +# 0.8.2 +- fix bug #18 - detect missing value when flag is last item +- update dependencies + +# 0.8.1 +- update `fast-levenshtein` dependency + +# 0.8.0 +- update `levn` dependency - supplying a float value to an option with type `Int` now throws an error, instead of silently converting to an `Int` + +# 0.7.1 +- fix bug with use of `defaults` and `concatRepeatedArrays` or `mergeRepeatedObjects` + +# 0.7.0 +- added `concatrepeatedarrays` option: `oneValuePerFlag`, only allows one array value per flag +- added `typeAliases` option +- added `parseArgv` which takes an array and parses with the first two items sliced off +- changed enum help style +- bug fixes (#12) +- use of `concatRepeatedArrays` and `mergeRepeatedObjects` at the top level is deprecated, use it as either a per-option option, or set them in the `defaults` object to set them for all objects + +# 0.6.0 +- added `defaults` lib-option flag, allowing one to set default properties for all options +- added `concatRepeatedArrays` and `mergeRepeatedObjects` as option level properties, allowing you to turn this feature on for specific options only + +# 0.5.0 +- `Boolean` flags with `default: 'true'`, and no short aliases, will by default show the `--no` version in help + +# 0.4.0 +- add `mergeRepeatedObjects` setting + +# 0.3.0 +- add `concatRepeatedArrays` setting +- add `overrideRequired` option setting +- use just Levenshtein string compare algo rather than Levenshtein Damerau to due dependency license issue + +# 0.2.2 +- bug fixes + +# 0.2.1 +- improved interpolation +- added changelog + +# 0.2.0 +- add dependency checks to options - added `dependsOn` as an option property +- add interpolation for `prepend` and `append` text with new `generateHelp` option, `interpolate` + +# 0.1.1 +- update dependencies + +# 0.1.0 +- initial release diff --git a/node_modules/optionator/LICENSE b/node_modules/optionator/LICENSE new file mode 100644 index 000000000..525b11850 --- /dev/null +++ b/node_modules/optionator/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/optionator/README.md b/node_modules/optionator/README.md new file mode 100644 index 000000000..9cd0bb43e --- /dev/null +++ b/node_modules/optionator/README.md @@ -0,0 +1,238 @@ +# Optionator +
+ +Optionator is a JavaScript/Node.js option parsing and help generation library used by [eslint](http://eslint.org), [Grasp](http://graspjs.com), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and [many more](https://www.npmjs.com/browse/depended/optionator). + +For an online demo, check out the [Grasp online demo](http://www.graspjs.com/#demo). + +[About](#about) · [Usage](#usage) · [Settings Format](#settings-format) · [Argument Format](#argument-format) + +## Why? +The problem with other option parsers, such as `yargs` or `minimist`, is they just accept all input, valid or not. +With Optionator, if you mistype an option, it will give you an error (with a suggestion for what you meant). +If you give the wrong type of argument for an option, it will give you an error rather than supplying the wrong input to your application. + + $ cmd --halp + Invalid option '--halp' - perhaps you meant '--help'? + + $ cmd --count str + Invalid value for option 'count' - expected type Int, received value: str. + +Other helpful features include reformatting the help text based on the size of the console, so that it fits even if the console is narrow, and accepting not just an array (eg. process.argv), but a string or object as well, making things like testing much easier. + +## About +Optionator uses [type-check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) behind the scenes to cast and verify input according the specified types. + +MIT license. Version 0.9.4 + + npm install optionator + +For updates on Optionator, [follow me on twitter](https://twitter.com/gkzahariev). + +Optionator is a Node.js module, but can be used in the browser as well if packed with webpack/browserify. + +## Usage +`require('optionator');` returns a function. It has one property, `VERSION`, the current version of the library as a string. This function is called with an object specifying your options and other information, see the [settings format section](#settings-format). This in turn returns an object with three properties, `parse`, `parseArgv`, `generateHelp`, and `generateHelpForOption`, which are all functions. + +```js +var optionator = require('optionator')({ + prepend: 'Usage: cmd [options]', + append: 'Version 1.0.0', + options: [{ + option: 'help', + alias: 'h', + type: 'Boolean', + description: 'displays help' + }, { + option: 'count', + alias: 'c', + type: 'Int', + description: 'number of things', + example: 'cmd --count 2' + }] +}); + +var options = optionator.parseArgv(process.argv); +if (options.help) { + console.log(optionator.generateHelp()); +} +... +``` + +### parse(input, parseOptions) +`parse` processes the `input` according to your settings, and returns an object with the results. + +##### arguments +* input - `[String] | Object | String` - the input you wish to parse +* parseOptions - `{slice: Int}` - all options optional + - `slice` specifies how much to slice away from the beginning if the input is an array or string - by default `0` for string, `2` for array (works with `process.argv`) + +##### returns +`Object` - the parsed options, each key is a camelCase version of the option name (specified in dash-case), and each value is the processed value for that option. Positional values are in an array under the `_` key. + +##### example +```js +parse(['node', 't.js', '--count', '2', 'positional']); // {count: 2, _: ['positional']} +parse('--count 2 positional'); // {count: 2, _: ['positional']} +parse({count: 2, _:['positional']}); // {count: 2, _: ['positional']} +``` + +### parseArgv(input) +`parseArgv` works exactly like `parse`, but only for array input and it slices off the first two elements. + +##### arguments +* input - `[String]` - the input you wish to parse + +##### returns +See "returns" section in "parse" + +##### example +```js +parseArgv(process.argv); +``` + +### generateHelp(helpOptions) +`generateHelp` produces help text based on your settings. + +##### arguments +* helpOptions - `{showHidden: Boolean, interpolate: Object}` - all options optional + - `showHidden` specifies whether to show options with `hidden: true` specified, by default it is `false` + - `interpolate` specify data to be interpolated in `prepend` and `append` text, `{{key}}` is the format - eg. `generateHelp({interpolate:{version: '0.4.2'}})`, will change this `append` text: `Version {{version}}` to `Version 0.4.2` + +##### returns +`String` - the generated help text + +##### example +```js +generateHelp(); /* +"Usage: cmd [options] positional + + -h, --help displays help + -c, --count Int number of things + +Version 1.0.0 +"*/ +``` + +### generateHelpForOption(optionName) +`generateHelpForOption` produces expanded help text for the specified with `optionName` option. If an `example` was specified for the option, it will be displayed, and if a `longDescription` was specified, it will display that instead of the `description`. + +##### arguments +* optionName - `String` - the name of the option to display + +##### returns +`String` - the generated help text for the option + +##### example +```js +generateHelpForOption('count'); /* +"-c, --count Int +description: number of things +example: cmd --count 2 +"*/ +``` + +## Settings Format +When your `require('optionator')`, you get a function that takes in a settings object. This object has the type: + + { + prepend: String, + append: String, + options: [{heading: String} | { + option: String, + alias: [String] | String, + type: String, + enum: [String], + default: String, + restPositional: Boolean, + required: Boolean, + overrideRequired: Boolean, + dependsOn: [String] | String, + concatRepeatedArrays: Boolean | (Boolean, Object), + mergeRepeatedObjects: Boolean, + description: String, + longDescription: String, + example: [String] | String + }], + helpStyle: { + aliasSeparator: String, + typeSeparator: String, + descriptionSeparator: String, + initialIndent: Int, + secondaryIndent: Int, + maxPadFactor: Number + }, + mutuallyExclusive: [[String | [String]]], + concatRepeatedArrays: Boolean | (Boolean, Object), // deprecated, set in defaults object + mergeRepeatedObjects: Boolean, // deprecated, set in defaults object + positionalAnywhere: Boolean, + typeAliases: Object, + defaults: Object + } + +All of the properties are optional (the `Maybe` has been excluded for brevities sake), except for having either `heading: String` or `option: String` in each object in the `options` array. + +### Top Level Properties +* `prepend` is an optional string to be placed before the options in the help text +* `append` is an optional string to be placed after the options in the help text +* `options` is a required array specifying your options and headings, the options and headings will be displayed in the order specified +* `helpStyle` is an optional object which enables you to change the default appearance of some aspects of the help text +* `mutuallyExclusive` is an optional array of arrays of either strings or arrays of strings. The top level array is a list of rules, each rule is a list of elements - each element can be either a string (the name of an option), or a list of strings (a group of option names) - there will be an error if more than one element is present +* `concatRepeatedArrays` see description under the "Option Properties" heading - use at the top level is deprecated, if you want to set this for all options, use the `defaults` property +* `mergeRepeatedObjects` see description under the "Option Properties" heading - use at the top level is deprecated, if you want to set this for all options, use the `defaults` property +* `positionalAnywhere` is an optional boolean (defaults to `true`) - when `true` it allows positional arguments anywhere, when `false`, all arguments after the first positional one are taken to be positional as well, even if they look like a flag. For example, with `positionalAnywhere: false`, the arguments `--flag --boom 12 --crack` would have two positional arguments: `12` and `--crack` +* `typeAliases` is an optional object, it allows you to set aliases for types, eg. `{Path: 'String'}` would allow you to use the type `Path` as an alias for the type `String` +* `defaults` is an optional object following the option properties format, which specifies default values for all options. A default will be overridden if manually set. For example, you can do `default: { type: "String" }` to set the default type of all options to `String`, and then override that default in an individual option by setting the `type` property + +#### Heading Properties +* `heading` a required string, the name of the heading + +#### Option Properties +* `option` the required name of the option - use dash-case, without the leading dashes +* `alias` is an optional string or array of strings which specify any aliases for the option +* `type` is a required string in the [type check](https://github.com/gkz/type-check) [format](https://github.com/gkz/type-check#type-format), this will be used to cast the inputted value and validate it +* `enum` is an optional array of strings, each string will be parsed by [levn](https://github.com/gkz/levn) - the argument value must be one of the resulting values - each potential value must validate against the specified `type` +* `default` is a optional string, which will be parsed by [levn](https://github.com/gkz/levn) and used as the default value if none is set - the value must validate against the specified `type` +* `restPositional` is an optional boolean - if set to `true`, everything after the option will be taken to be a positional argument, even if it looks like a named argument +* `required` is an optional boolean - if set to `true`, the option parsing will fail if the option is not defined +* `overrideRequired` is a optional boolean - if set to `true` and the option is used, and there is another option which is required but not set, it will override the need for the required option and there will be no error - this is useful if you have required options and want to use `--help` or `--version` flags +* `concatRepeatedArrays` is an optional boolean or tuple with boolean and options object (defaults to `false`) - when set to `true` and an option contains an array value and is repeated, the subsequent values for the flag will be appended rather than overwriting the original value - eg. option `g` of type `[String]`: `-g a -g b -g c,d` will result in `['a','b','c','d']` + + You can supply an options object by giving the following value: `[true, options]`. The one currently supported option is `oneValuePerFlag`, this only allows one array value per flag. This is useful if your potential values contain a comma. +* `mergeRepeatedObjects` is an optional boolean (defaults to `false`) - when set to `true` and an option contains an object value and is repeated, the subsequent values for the flag will be merged rather than overwriting the original value - eg. option `g` of type `Object`: `-g a:1 -g b:2 -g c:3,d:4` will result in `{a: 1, b: 2, c: 3, d: 4}` +* `dependsOn` is an optional string or array of strings - if simply a string (the name of another option), it will make sure that that other option is set, if an array of strings, depending on whether `'and'` or `'or'` is first, it will either check whether all (`['and', 'option-a', 'option-b']`), or at least one (`['or', 'option-a', 'option-b']`) other options are set +* `description` is an optional string, which will be displayed next to the option in the help text +* `longDescription` is an optional string, it will be displayed instead of the `description` when `generateHelpForOption` is used +* `example` is an optional string or array of strings with example(s) for the option - these will be displayed when `generateHelpForOption` is used + +#### Help Style Properties +* `aliasSeparator` is an optional string, separates multiple names from each other - default: ' ,' +* `typeSeparator` is an optional string, separates the type from the names - default: ' ' +* `descriptionSeparator` is an optional string , separates the description from the padded name and type - default: ' ' +* `initialIndent` is an optional int - the amount of indent for options - default: 2 +* `secondaryIndent` is an optional int - the amount of indent if wrapped fully (in addition to the initial indent) - default: 4 +* `maxPadFactor` is an optional number - affects the default level of padding for the names/type, it is multiplied by the average of the length of the names/type - default: 1.5 + +## Argument Format +At the highest level there are two types of arguments: named, and positional. + +Name arguments of any length are prefixed with `--` (eg. `--go`), and those of one character may be prefixed with either `--` or `-` (eg. `-g`). + +There are two types of named arguments: boolean flags (eg. `--problemo`, `-p`) which take no value and result in a `true` if they are present, the falsey `undefined` if they are not present, or `false` if present and explicitly prefixed with `no` (eg. `--no-problemo`). Named arguments with values (eg. `--tseries 800`, `-t 800`) are the other type. If the option has a type `Boolean` it will automatically be made into a boolean flag. Any other type results in a named argument that takes a value. + +For more information about how to properly set types to get the value you want, take a look at the [type check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) pages. + +You can group single character arguments that use a single `-`, however all except the last must be boolean flags (which take no value). The last may be a boolean flag, or an argument which takes a value - eg. `-ba 2` is equivalent to `-b -a 2`. + +Positional arguments are all those values which do not fall under the above - they can be anywhere, not just at the end. For example, in `cmd -b one -a 2 two` where `b` is a boolean flag, and `a` has the type `Number`, there are two positional arguments, `one` and `two`. + +Everything after an `--` is positional, even if it looks like a named argument. + +You may optionally use `=` to separate option names from values, for example: `--count=2`. + +If you specify the option `NUM`, then any argument using a single `-` followed by a number will be valid and will set the value of `NUM`. Eg. `-2` will be parsed into `NUM: 2`. + +If duplicate named arguments are present, the last one will be taken. + +## Technical About +`optionator` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [levn](https://github.com/gkz/levn) to cast arguments to their specified type, and uses [type-check](https://github.com/gkz/type-check) to validate values. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/optionator/package.json b/node_modules/optionator/package.json new file mode 100644 index 000000000..72b21bab6 --- /dev/null +++ b/node_modules/optionator/package.json @@ -0,0 +1,43 @@ +{ + "name": "optionator", + "version": "0.9.4", + "author": "George Zahariev ", + "description": "option parsing and help generation", + "homepage": "https://github.com/gkz/optionator", + "keywords": [ + "options", + "flags", + "option parsing", + "cli" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": "https://github.com/gkz/optionator/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/optionator.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "^1.2.1", + "deep-is": "^0.1.3", + "word-wrap": "^1.2.5", + "type-check": "^0.4.0", + "levn": "^0.4.1", + "fast-levenshtein": "^2.0.6" + }, + "devDependencies": { + "livescript": "^1.6.0", + "mocha": "^10.4.0" + } +} diff --git a/node_modules/own-keys/.eslintrc b/node_modules/own-keys/.eslintrc new file mode 100644 index 000000000..a5b9db5cd --- /dev/null +++ b/node_modules/own-keys/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-style": "off", + "id-length": "off", + "max-lines-per-function": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/own-keys/.github/FUNDING.yml b/node_modules/own-keys/.github/FUNDING.yml new file mode 100644 index 000000000..174d3e1ec --- /dev/null +++ b/node_modules/own-keys/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/own-keys +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/own-keys/.nycrc b/node_modules/own-keys/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/own-keys/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/own-keys/CHANGELOG.md b/node_modules/own-keys/CHANGELOG.md new file mode 100644 index 000000000..e27b88880 --- /dev/null +++ b/node_modules/own-keys/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/ljharb/own-keys/compare/v1.0.0...v1.0.1) - 2024-12-29 + +### Commits + +- [Tests] sort with a proper comparator [`4a65b56`](https://github.com/ljharb/own-keys/commit/4a65b569d10985032a0773806dcdec8866132baa) +- [Fix] fix function name when `Reflect.ownKeys` is absent [`5cf17cb`](https://github.com/ljharb/own-keys/commit/5cf17cb1c9adfa836a1ddc467da4da20973db2ae) + +## v1.0.0 - 2024-12-28 + +### Commits + +- Initial implementation, tests, readme, types [`870a06f`](https://github.com/ljharb/own-keys/commit/870a06f9d7a2a6ecee283319d9a7388f8fc1c811) +- Initial commit [`70323dc`](https://github.com/ljharb/own-keys/commit/70323dc09541b4ee80426acfc89762605d7fc7bf) +- npm init [`4a3ad06`](https://github.com/ljharb/own-keys/commit/4a3ad0659defe9a67541c198743bd7733d437725) +- [Tests] node 0.8 sorts object keys differently [`b449364`](https://github.com/ljharb/own-keys/commit/b4493649ead7441fd8e65ab4718acbd088ceac70) +- Only apps should have lockfiles [`a54acbf`](https://github.com/ljharb/own-keys/commit/a54acbf2c6b8ef320abf7493b7c88002c690f9c0) diff --git a/node_modules/own-keys/LICENSE b/node_modules/own-keys/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/own-keys/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/own-keys/README.md b/node_modules/own-keys/README.md new file mode 100644 index 000000000..b54eb91b3 --- /dev/null +++ b/node_modules/own-keys/README.md @@ -0,0 +1,45 @@ +# own-keys [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible. + +## Getting started + +```sh +npm install --save own-keys +``` + +## Usage/Examples + +```js +var ownKeys = require('own-keys'); +var assert = require('assert'); + +assert.deepEqual(ownKeys({ a: 1, b: 2 }), ['a', 'b']); +assert.deepEqual(ownKeys([1, 2, 3]), [0, 1, 2, 'length']); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/own-keys +[npm-version-svg]: https://versionbadg.es/ljharb/own-keys.svg +[deps-svg]: https://david-dm.org/ljharb/own-keys.svg +[deps-url]: https://david-dm.org/ljharb/own-keys +[dev-deps-svg]: https://david-dm.org/ljharb/own-keys/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/own-keys#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/own-keys.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/own-keys.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/own-keys.svg +[downloads-url]: https://npm-stat.com/charts.html?package=own-keys +[codecov-image]: https://codecov.io/gh/ljharb/own-keys/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/own-keys/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/own-keys +[actions-url]: https://github.com/ljharb/own-keys/actions diff --git a/node_modules/own-keys/index.d.ts b/node_modules/own-keys/index.d.ts new file mode 100644 index 000000000..67b3fd269 --- /dev/null +++ b/node_modules/own-keys/index.d.ts @@ -0,0 +1,3 @@ +declare function ownKeys, V>(object: T): (keyof T)[]; + +export = ownKeys; diff --git a/node_modules/own-keys/index.js b/node_modules/own-keys/index.js new file mode 100644 index 000000000..e43ce7348 --- /dev/null +++ b/node_modules/own-keys/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var safePushApply = require('safe-push-apply'); + +var $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true); +var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true); +var $gOPS = GetIntrinsic('%Object.getOwnPropertySymbols%', true); + +var keys = require('object-keys'); + +/** @type {import('.')} */ +module.exports = $ownKeys || function ownKeys(source) { + /** @type {(keyof typeof source)[]} */ + var sourceKeys = ($gOPN || keys)(source); + if ($gOPS) { + safePushApply(sourceKeys, $gOPS(source)); + } + return sourceKeys; +}; diff --git a/node_modules/own-keys/package.json b/node_modules/own-keys/package.json new file mode 100644 index 000000000..915f1adc5 --- /dev/null +++ b/node_modules/own-keys/package.json @@ -0,0 +1,91 @@ +{ + "name": "own-keys", + "version": "1.0.1", + "description": "Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "tests-only": "nyc tape test", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production" + }, + "keywords": [ + "own", + "key", + "keys", + "propertykey", + "string", + "symbol", + "enumerable", + "non-enumerable", + "robust" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/own-keys.git" + }, + "bugs": { + "url": "https://github.com/ljharb/own-keys/issues" + }, + "homepage": "https://github.com/ljharb/own-keys#readme", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.2", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.3", + "@types/get-intrinsic": "^1.2.3", + "@types/isarray": "^2.0.3", + "@types/object-keys": "^1.0.3", + "@types/tape": "^5.8.0", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "has-property-descriptors": "^1.0.2", + "has-symbols": "^1.1.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/own-keys/test/index.js b/node_modules/own-keys/test/index.js new file mode 100644 index 000000000..2e78c6e99 --- /dev/null +++ b/node_modules/own-keys/test/index.js @@ -0,0 +1,72 @@ +'use strict'; + +var test = require('tape'); +var hasSymbols = require('has-symbols/shams')(); +var hasPropertyDescriptors = require('has-property-descriptors')(); + +var ownKeys = require('../'); + +/** @type {(a: PropertyKey, b: PropertyKey) => number} */ +function comparator(a, b) { + if (typeof a === 'string' && typeof b === 'string') { + return a.localeCompare(b); + } + if (typeof a === 'number' && typeof b === 'number') { + return a - b; + } + return typeof a === 'symbol' ? 1 : -1; +} + +test('ownKeys', function (t) { + t.equal(typeof ownKeys, 'function', 'is a function'); + t.equal( + ownKeys.length, + 1, + 'has a length of 1' + ); + + t.test('basics', function (st) { + var obj = { a: 1, b: 2 }; + if (hasPropertyDescriptors) { + Object.defineProperty(obj, 'c', { + configurable: true, + enumerable: false, + writable: true, + value: 3 + }); + } + + st.deepEqual( + ownKeys(obj).sort(comparator), + (hasPropertyDescriptors ? ['a', 'b', 'c'] : ['a', 'b']).sort(comparator), + 'includes non-enumerable properties' + ); + + st.end(); + }); + + t.test('symbols', { skip: !hasSymbols }, function (st) { + /** @type {Record} */ + var obj = { a: 1 }; + var sym = Symbol('b'); + obj[sym] = 2; + + var nonEnumSym = Symbol('c'); + Object.defineProperty(obj, nonEnumSym, { + configurable: true, + enumerable: false, + writable: true, + value: 3 + }); + + st.deepEqual( + ownKeys(obj).sort(comparator), + ['a', sym, nonEnumSym].sort(comparator), + 'works with symbols, both enum and non-enum' + ); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/own-keys/tsconfig.json b/node_modules/own-keys/tsconfig.json new file mode 100644 index 000000000..0ce1896d1 --- /dev/null +++ b/node_modules/own-keys/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/p-limit/index.js b/node_modules/p-limit/index.js new file mode 100644 index 000000000..873f0e70d --- /dev/null +++ b/node_modules/p-limit/index.js @@ -0,0 +1,42 @@ +'use strict'; +const pTry = require('p-try'); + +module.exports = concurrency => { + if (concurrency < 1) { + throw new TypeError('Expected `concurrency` to be a number from 1 and up'); + } + + const queue = []; + let activeCount = 0; + + const next = () => { + activeCount--; + + if (queue.length > 0) { + queue.shift()(); + } + }; + + return fn => new Promise((resolve, reject) => { + const run = () => { + activeCount++; + + pTry(fn).then( + val => { + resolve(val); + next(); + }, + err => { + reject(err); + next(); + } + ); + }; + + if (activeCount < concurrency) { + run(); + } else { + queue.push(run); + } + }); +}; diff --git a/node_modules/p-limit/license b/node_modules/p-limit/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/p-limit/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/p-limit/package.json b/node_modules/p-limit/package.json new file mode 100644 index 000000000..4079517f1 --- /dev/null +++ b/node_modules/p-limit/package.json @@ -0,0 +1,49 @@ +{ + "name": "p-limit", + "version": "1.3.0", + "description": "Run multiple promise-returning & async functions with limited concurrency", + "license": "MIT", + "repository": "sindresorhus/p-limit", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "limit", + "limited", + "concurrency", + "throttle", + "throat", + "rate", + "batch", + "ratelimit", + "task", + "queue", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-try": "^1.0.0" + }, + "devDependencies": { + "ava": "*", + "delay": "^2.0.0", + "in-range": "^1.0.0", + "random-int": "^1.0.0", + "time-span": "^2.0.0", + "xo": "*" + } +} diff --git a/node_modules/p-limit/readme.md b/node_modules/p-limit/readme.md new file mode 100644 index 000000000..90129925c --- /dev/null +++ b/node_modules/p-limit/readme.md @@ -0,0 +1,69 @@ +# p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) + +> Run multiple promise-returning & async functions with limited concurrency + + +## Install + +``` +$ npm install p-limit +``` + + +## Usage + +```js +const pLimit = require('p-limit'); + +const limit = pLimit(1); + +const input = [ + limit(() => fetchSomething('foo')), + limit(() => fetchSomething('bar')), + limit(() => doSomething()) +]; + +(async () => { + // Only one promise is run at once + const result = await Promise.all(input); + console.log(result); +})(); +``` + + +## API + +### pLimit(concurrency) + +Returns a `limit` function. + +#### concurrency + +Type: `number`
+Minimum: `1` + +Concurrency limit. + +### limit(fn) + +Returns the promise returned by calling `fn`. + +#### fn + +Type: `Function` + +Promise-returning/async function. + + +## Related + +- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control +- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions +- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions +- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-locate/index.js b/node_modules/p-locate/index.js new file mode 100644 index 000000000..7461d665b --- /dev/null +++ b/node_modules/p-locate/index.js @@ -0,0 +1,31 @@ +'use strict'; +const pLimit = require('p-limit'); + +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } +} + +// the input can also be a promise, so we `Promise.all()` them both +const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0]))); + +module.exports = (iterable, tester, opts) => { + opts = Object.assign({ + concurrency: Infinity, + preserveOrder: true + }, opts); + + const limit = pLimit(opts.concurrency); + + // start all the promises concurrently with optional limit + const items = Array.from(iterable).map(el => [el, limit(() => Promise.resolve(el).then(tester))]); + + // check the promises either serially or concurrently + const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity); + + return Promise.all(items.map(el => checkLimit(() => finder(el)))) + .then(() => {}) + .catch(err => err instanceof EndError ? err.value : Promise.reject(err)); +}; diff --git a/node_modules/p-locate/license b/node_modules/p-locate/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/p-locate/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/p-locate/package.json b/node_modules/p-locate/package.json new file mode 100644 index 000000000..767002b38 --- /dev/null +++ b/node_modules/p-locate/package.json @@ -0,0 +1,54 @@ +{ + "name": "p-locate", + "version": "2.0.0", + "description": "Get the first fulfilled promise that satisfies the provided testing function", + "license": "MIT", + "repository": "sindresorhus/p-locate", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "locate", + "find", + "finder", + "search", + "searcher", + "test", + "array", + "collection", + "iterable", + "iterator", + "race", + "fulfilled", + "fastest", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-limit": "^1.1.0" + }, + "devDependencies": { + "ava": "*", + "delay": "^1.3.1", + "in-range": "^1.0.0", + "time-span": "^1.0.0", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-locate/readme.md b/node_modules/p-locate/readme.md new file mode 100644 index 000000000..68b96a47e --- /dev/null +++ b/node_modules/p-locate/readme.md @@ -0,0 +1,86 @@ +# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate) + +> Get the first fulfilled promise that satisfies the provided testing function + +Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). + + +## Install + +``` +$ npm install --save p-locate +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const pathExists = require('path-exists'); +const pLocate = require('p-locate'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // only this one actually exists on disk + 'pony.png' +]; + +pLocate(files, file => pathExists(file)).then(foundPath => { + console.log(foundPath); + //=> 'rainbow' +}); +``` + +*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* + + +## API + +### pLocate(input, tester, [options]) + +Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + +#### input + +Type: `Iterable` + +#### tester(element) + +Type: `Function` + +Expected to return a `Promise` or boolean. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises returned by `tester`. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `input` order when searching. + +Disable this to improve performance if you don't care about the order. + + +## Related + +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently +- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-try/index.js b/node_modules/p-try/index.js new file mode 100644 index 000000000..efa2f7433 --- /dev/null +++ b/node_modules/p-try/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = cb => new Promise(resolve => { + resolve(cb()); +}); diff --git a/node_modules/p-try/license b/node_modules/p-try/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/p-try/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/p-try/package.json b/node_modules/p-try/package.json new file mode 100644 index 000000000..ba2513ade --- /dev/null +++ b/node_modules/p-try/package.json @@ -0,0 +1,43 @@ +{ + "name": "p-try", + "version": "1.0.0", + "description": "`Promise#try()` ponyfill - Starts a promise chain", + "license": "MIT", + "repository": "sindresorhus/p-try", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "try", + "resolve", + "function", + "catch", + "async", + "await", + "promises", + "settled", + "ponyfill", + "polyfill", + "shim", + "bluebird" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-try/readme.md b/node_modules/p-try/readme.md new file mode 100644 index 000000000..8e5fdddbe --- /dev/null +++ b/node_modules/p-try/readme.md @@ -0,0 +1,38 @@ +# p-try [![Build Status](https://travis-ci.org/sindresorhus/p-try.svg?branch=master)](https://travis-ci.org/sindresorhus/p-try) + +> [`Promise#try()`](https://github.com/ljharb/proposal-promise-try) [ponyfill](https://ponyfill.com) - Starts a promise chain + +[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/) + + +## Install + +``` +$ npm install --save p-try +``` + + +## Usage + +```js +const pTry = require('p-try'); + +pTry(() => { + return synchronousFunctionThatMightThrow(); +}).then(value => { + console.log(value); +}).catch(error => { + console.error(error); +}); +``` + + +## Related + +- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome +- [More…](https://github.com/sindresorhus/promise-fun) + + +## 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 000000000..feb326642 --- /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 000000000..87c3b1e0b --- /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 000000000..1606d02f6 --- /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 000000000..611b67581 --- /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 000000000..a5e1bc46f --- /dev/null +++ b/node_modules/parse-entities/package.json @@ -0,0 +1,91 @@ +{ + "name": "parse-entities", + "version": "1.2.2", + "description": "Parse HTML character references: fast, spec-compliant, positional information", + "license": "MIT", + "keywords": [ + "parse", + "html", + "character", + "reference", + "entity", + "entities" + ], + "repository": "wooorm/parse-entities", + "bugs": "https://github.com/wooorm/parse-entities/issues", + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "browser": { + "./decode-entity.js": "./decode-entity.browser.js" + }, + "react-native": { + "./decode-entity.js": "./decode-entity.js" + }, + "files": [ + "index.js", + "decode-entity.js", + "decode-entity.browser.js" + ], + "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" + }, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s parseEntities > parse-entities.js", + "build-mangle": "browserify . -s parseEntities -p tinyify > parse-entities.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-browser": "browserify test.js | tape-run", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-browser" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "no-self-compare": "off", + "guard-for-in": "off", + "max-depth": "off" + }, + "ignores": [ + "parse-entities.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/parse-entities/readme.md b/node_modules/parse-entities/readme.md new file mode 100644 index 000000000..e9cc0f037 --- /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-json/index.js b/node_modules/parse-json/index.js new file mode 100644 index 000000000..04add8ae2 --- /dev/null +++ b/node_modules/parse-json/index.js @@ -0,0 +1,35 @@ +'use strict'; +var errorEx = require('error-ex'); +var fallback = require('./vendor/parse'); + +var JSONError = errorEx('JSONError', { + fileName: errorEx.append('in %s') +}); + +module.exports = function (x, reviver, filename) { + if (typeof reviver === 'string') { + filename = reviver; + reviver = null; + } + + try { + try { + return JSON.parse(x, reviver); + } catch (err) { + fallback.parse(x, { + mode: 'json', + reviver: reviver + }); + + throw err; + } + } catch (err) { + var 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 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/parse-json/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/parse-json/package.json b/node_modules/parse-json/package.json new file mode 100644 index 000000000..93e3c41ba --- /dev/null +++ b/node_modules/parse-json/package.json @@ -0,0 +1,46 @@ +{ + "name": "parse-json", + "version": "2.2.0", + "description": "Parse JSON with more helpful errors", + "license": "MIT", + "repository": "sindresorhus/parse-json", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && node test.js" + }, + "files": [ + "index.js", + "vendor" + ], + "keywords": [ + "parse", + "json", + "graceful", + "error", + "message", + "humanize", + "friendly", + "helpful", + "string", + "str" + ], + "dependencies": { + "error-ex": "^1.2.0" + }, + "devDependencies": { + "ava": "0.0.4", + "xo": "*" + }, + "xo": { + "ignores": [ + "vendor/**" + ] + } +} diff --git a/node_modules/parse-json/readme.md b/node_modules/parse-json/readme.md new file mode 100644 index 000000000..ca96e60a6 --- /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 --save parse-json +``` + + +## Usage + +```js +var parseJson = require('parse-json'); +var 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 at 3:1 in foo.json +} +^ +*/ + + +// 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 at 3:1 in foo.json +} +^ +*/ +``` + +## 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](http://sindresorhus.com) diff --git a/node_modules/parse-json/vendor/parse.js b/node_modules/parse-json/vendor/parse.js new file mode 100644 index 000000000..5f9fe9986 --- /dev/null +++ b/node_modules/parse-json/vendor/parse.js @@ -0,0 +1,752 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +// RTFM: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + +var Uni = require('./unicode') + +function isHexDigit(x) { + return (x >= '0' && x <= '9') + || (x >= 'A' && x <= 'F') + || (x >= 'a' && x <= 'f') +} + +function isOctDigit(x) { + return x >= '0' && x <= '7' +} + +function isDecDigit(x) { + return x >= '0' && x <= '9' +} + +var unescapeMap = { + '\'': '\'', + '"' : '"', + '\\': '\\', + 'b' : '\b', + 'f' : '\f', + 'n' : '\n', + 'r' : '\r', + 't' : '\t', + 'v' : '\v', + '/' : '/', +} + +function formatError(input, msg, position, lineno, column, json5) { + var result = msg + ' at ' + (lineno + 1) + ':' + (column + 1) + , tmppos = position - column - 1 + , srcline = '' + , underline = '' + + var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON + + // output no more than 70 characters before the wrong ones + if (tmppos < position - 70) { + tmppos = position - 70 + } + + while (1) { + var chr = input[++tmppos] + + if (isLineTerminator(chr) || tmppos === input.length) { + if (position >= tmppos) { + // ending line error, so show it after the last char + underline += '^' + } + break + } + srcline += chr + + if (position === tmppos) { + underline += '^' + } else if (position > tmppos) { + underline += input[tmppos] === '\t' ? '\t' : ' ' + } + + // output no more than 78 characters on the string + if (srcline.length > 78) break + } + + return result + '\n' + srcline + '\n' + underline +} + +function parse(input, options) { + // parse as a standard JSON mode + var json5 = !(options.mode === 'json' || options.legacy) + var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON + var isWhiteSpace = json5 ? Uni.isWhiteSpace : Uni.isWhiteSpaceJSON + + var length = input.length + , lineno = 0 + , linestart = 0 + , position = 0 + , stack = [] + + var tokenStart = function() {} + var tokenEnd = function(v) {return v} + + /* tokenize({ + raw: '...', + type: 'whitespace'|'comment'|'key'|'literal'|'separator'|'newline', + value: 'number'|'string'|'whatever', + path: [...], + }) + */ + if (options._tokenize) { + ;(function() { + var start = null + tokenStart = function() { + if (start !== null) throw Error('internal error, token overlap') + start = position + } + + tokenEnd = function(v, type) { + if (start != position) { + var hash = { + raw: input.substr(start, position-start), + type: type, + stack: stack.slice(0), + } + if (v !== undefined) hash.value = v + options._tokenize.call(null, hash) + } + start = null + return v + } + })() + } + + function fail(msg) { + var column = position - linestart + + if (!msg) { + if (position < length) { + var token = '\'' + + JSON + .stringify(input[position]) + .replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + + '\'' + + if (!msg) msg = 'Unexpected token ' + token + } else { + if (!msg) msg = 'Unexpected end of input' + } + } + + var error = SyntaxError(formatError(input, msg, position, lineno, column, json5)) + error.row = lineno + 1 + error.column = column + 1 + throw error + } + + function newline(chr) { + // account for + if (chr === '\r' && input[position] === '\n') position++ + linestart = position + lineno++ + } + + function parseGeneric() { + var result + + while (position < length) { + tokenStart() + var chr = input[position++] + + if (chr === '"' || (chr === '\'' && json5)) { + return tokenEnd(parseString(chr), 'literal') + + } else if (chr === '{') { + tokenEnd(undefined, 'separator') + return parseObject() + + } else if (chr === '[') { + tokenEnd(undefined, 'separator') + return parseArray() + + } else if (chr === '-' + || chr === '.' + || isDecDigit(chr) + // + number Infinity NaN + || (json5 && (chr === '+' || chr === 'I' || chr === 'N')) + ) { + return tokenEnd(parseNumber(), 'literal') + + } else if (chr === 'n') { + parseKeyword('null') + return tokenEnd(null, 'literal') + + } else if (chr === 't') { + parseKeyword('true') + return tokenEnd(true, 'literal') + + } else if (chr === 'f') { + parseKeyword('false') + return tokenEnd(false, 'literal') + + } else { + position-- + return tokenEnd(undefined) + } + } + } + + function parseKey() { + var result + + while (position < length) { + tokenStart() + var chr = input[position++] + + if (chr === '"' || (chr === '\'' && json5)) { + return tokenEnd(parseString(chr), 'key') + + } else if (chr === '{') { + tokenEnd(undefined, 'separator') + return parseObject() + + } else if (chr === '[') { + tokenEnd(undefined, 'separator') + return parseArray() + + } else if (chr === '.' + || isDecDigit(chr) + ) { + return tokenEnd(parseNumber(true), 'key') + + } else if (json5 + && Uni.isIdentifierStart(chr) || (chr === '\\' && input[position] === 'u')) { + // unicode char or a unicode sequence + var rollback = position - 1 + var result = parseIdentifier() + + if (result === undefined) { + position = rollback + return tokenEnd(undefined) + } else { + return tokenEnd(result, 'key') + } + + } else { + position-- + return tokenEnd(undefined) + } + } + } + + function skipWhiteSpace() { + tokenStart() + while (position < length) { + var chr = input[position++] + + if (isLineTerminator(chr)) { + position-- + tokenEnd(undefined, 'whitespace') + tokenStart() + position++ + newline(chr) + tokenEnd(undefined, 'newline') + tokenStart() + + } else if (isWhiteSpace(chr)) { + // nothing + + } else if (chr === '/' + && json5 + && (input[position] === '/' || input[position] === '*') + ) { + position-- + tokenEnd(undefined, 'whitespace') + tokenStart() + position++ + skipComment(input[position++] === '*') + tokenEnd(undefined, 'comment') + tokenStart() + + } else { + position-- + break + } + } + return tokenEnd(undefined, 'whitespace') + } + + function skipComment(multi) { + while (position < length) { + var chr = input[position++] + + if (isLineTerminator(chr)) { + // LineTerminator is an end of singleline comment + if (!multi) { + // let parent function deal with newline + position-- + return + } + + newline(chr) + + } else if (chr === '*' && multi) { + // end of multiline comment + if (input[position] === '/') { + position++ + return + } + + } else { + // nothing + } + } + + if (multi) { + fail('Unclosed multiline comment') + } + } + + function parseKeyword(keyword) { + // keyword[0] is not checked because it should've checked earlier + var _pos = position + var len = keyword.length + for (var i=1; i= length || keyword[i] != input[position]) { + position = _pos-1 + fail() + } + position++ + } + } + + function parseObject() { + var result = options.null_prototype ? Object.create(null) : {} + , empty_object = {} + , is_non_empty = false + + while (position < length) { + skipWhiteSpace() + var item1 = parseKey() + skipWhiteSpace() + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (chr === '}' && item1 === undefined) { + if (!json5 && is_non_empty) { + position-- + fail('Trailing comma in object') + } + return result + + } else if (chr === ':' && item1 !== undefined) { + skipWhiteSpace() + stack.push(item1) + var item2 = parseGeneric() + stack.pop() + + if (item2 === undefined) fail('No value found for key ' + item1) + if (typeof(item1) !== 'string') { + if (!json5 || typeof(item1) !== 'number') { + fail('Wrong key type: ' + item1) + } + } + + if ((item1 in empty_object || empty_object[item1] != null) && options.reserved_keys !== 'replace') { + if (options.reserved_keys === 'throw') { + fail('Reserved key: ' + item1) + } else { + // silently ignore it + } + } else { + if (typeof(options.reviver) === 'function') { + item2 = options.reviver.call(null, item1, item2) + } + + if (item2 !== undefined) { + is_non_empty = true + Object.defineProperty(result, item1, { + value: item2, + enumerable: true, + configurable: true, + writable: true, + }) + } + } + + skipWhiteSpace() + + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (chr === ',') { + continue + + } else if (chr === '}') { + return result + + } else { + fail() + } + + } else { + position-- + fail() + } + } + + fail() + } + + function parseArray() { + var result = [] + + while (position < length) { + skipWhiteSpace() + stack.push(result.length) + var item = parseGeneric() + stack.pop() + skipWhiteSpace() + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (item !== undefined) { + if (typeof(options.reviver) === 'function') { + item = options.reviver.call(null, String(result.length), item) + } + if (item === undefined) { + result.length++ + item = true // hack for check below, not included into result + } else { + result.push(item) + } + } + + if (chr === ',') { + if (item === undefined) { + fail('Elisions are not supported') + } + + } else if (chr === ']') { + if (!json5 && item === undefined && result.length) { + position-- + fail('Trailing comma in array') + } + return result + + } else { + position-- + fail() + } + } + } + + function parseNumber() { + // rewind because we don't know first char + position-- + + var start = position + , chr = input[position++] + , t + + var to_num = function(is_octal) { + var str = input.substr(start, position - start) + + if (is_octal) { + var result = parseInt(str.replace(/^0o?/, ''), 8) + } else { + var result = Number(str) + } + + if (Number.isNaN(result)) { + position-- + fail('Bad numeric literal - "' + input.substr(start, position - start + 1) + '"') + } else if (!json5 && !str.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i)) { + // additional restrictions imposed by json + position-- + fail('Non-json numeric literal - "' + input.substr(start, position - start + 1) + '"') + } else { + return result + } + } + + // ex: -5982475.249875e+29384 + // ^ skipping this + if (chr === '-' || (chr === '+' && json5)) chr = input[position++] + + if (chr === 'N' && json5) { + parseKeyword('NaN') + return NaN + } + + if (chr === 'I' && json5) { + parseKeyword('Infinity') + + // returning +inf or -inf + return to_num() + } + + if (chr >= '1' && chr <= '9') { + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + // special case for leading zero: 0.123456 + if (chr === '0') { + chr = input[position++] + + // new syntax, "0o777" old syntax, "0777" + var is_octal = chr === 'o' || chr === 'O' || isOctDigit(chr) + var is_hex = chr === 'x' || chr === 'X' + + if (json5 && (is_octal || is_hex)) { + while (position < length + && (is_hex ? isHexDigit : isOctDigit)( input[position] ) + ) position++ + + var sign = 1 + if (input[start] === '-') { + sign = -1 + start++ + } else if (input[start] === '+') { + start++ + } + + return sign * to_num(is_octal) + } + } + + if (chr === '.') { + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + if (chr === 'e' || chr === 'E') { + chr = input[position++] + if (chr === '-' || chr === '+') position++ + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + // we have char in the buffer, so count for it + position-- + return to_num() + } + + function parseIdentifier() { + // rewind because we don't know first char + position-- + + var result = '' + + while (position < length) { + var chr = input[position++] + + if (chr === '\\' + && input[position] === 'u' + && isHexDigit(input[position+1]) + && isHexDigit(input[position+2]) + && isHexDigit(input[position+3]) + && isHexDigit(input[position+4]) + ) { + // UnicodeEscapeSequence + chr = String.fromCharCode(parseInt(input.substr(position+1, 4), 16)) + position += 5 + } + + if (result.length) { + // identifier started + if (Uni.isIdentifierPart(chr)) { + result += chr + } else { + position-- + return result + } + + } else { + if (Uni.isIdentifierStart(chr)) { + result += chr + } else { + return undefined + } + } + } + + fail() + } + + function parseString(endChar) { + // 7.8.4 of ES262 spec + var result = '' + + while (position < length) { + var chr = input[position++] + + if (chr === endChar) { + return result + + } else if (chr === '\\') { + if (position >= length) fail() + chr = input[position++] + + if (unescapeMap[chr] && (json5 || (chr != 'v' && chr != "'"))) { + result += unescapeMap[chr] + + } else if (json5 && isLineTerminator(chr)) { + // line continuation + newline(chr) + + } else if (chr === 'u' || (chr === 'x' && json5)) { + // unicode/character escape sequence + var off = chr === 'u' ? 4 : 2 + + // validation for \uXXXX + for (var i=0; i= length) fail() + if (!isHexDigit(input[position])) fail('Bad escape sequence') + position++ + } + + result += String.fromCharCode(parseInt(input.substr(position-off, off), 16)) + } else if (json5 && isOctDigit(chr)) { + if (chr < '4' && isOctDigit(input[position]) && isOctDigit(input[position+1])) { + // three-digit octal + var digits = 3 + } else if (isOctDigit(input[position])) { + // two-digit octal + var digits = 2 + } else { + var digits = 1 + } + position += digits - 1 + result += String.fromCharCode(parseInt(input.substr(position-digits, digits), 8)) + /*if (!isOctDigit(input[position])) { + // \0 is allowed still + result += '\0' + } else { + fail('Octal literals are not supported') + }*/ + + } else if (json5) { + // \X -> x + result += chr + + } else { + position-- + fail() + } + + } else if (isLineTerminator(chr)) { + fail() + + } else { + if (!json5 && chr.charCodeAt(0) < 32) { + position-- + fail('Unexpected control character') + } + + // SourceCharacter but not one of " or \ or LineTerminator + result += chr + } + } + + fail() + } + + skipWhiteSpace() + var return_value = parseGeneric() + if (return_value !== undefined || position < length) { + skipWhiteSpace() + + if (position >= length) { + if (typeof(options.reviver) === 'function') { + return_value = options.reviver.call(null, '', return_value) + } + return return_value + } else { + fail() + } + + } else { + if (position) { + fail('No data, only a whitespace') + } else { + fail('No data, empty input') + } + } +} + +/* + * parse(text, options) + * or + * parse(text, reviver) + * + * where: + * text - string + * options - object + * reviver - function + */ +module.exports.parse = function parseJSON(input, options) { + // support legacy functions + if (typeof(options) === 'function') { + options = { + reviver: options + } + } + + if (input === undefined) { + // parse(stringify(x)) should be equal x + // with JSON functions it is not 'cause of undefined + // so we're fixing it + return undefined + } + + // JSON.parse compat + if (typeof(input) !== 'string') input = String(input) + if (options == null) options = {} + if (options.reserved_keys == null) options.reserved_keys = 'ignore' + + if (options.reserved_keys === 'throw' || options.reserved_keys === 'ignore') { + if (options.null_prototype == null) { + options.null_prototype = true + } + } + + try { + return parse(input, options) + } catch(err) { + // jju is a recursive parser, so JSON.parse("{{{{{{{") could blow up the stack + // + // this catch is used to skip all those internal calls + if (err instanceof SyntaxError && err.row != null && err.column != null) { + var old_err = err + err = SyntaxError(old_err.message) + err.column = old_err.column + err.row = old_err.row + } + throw err + } +} + +module.exports.tokenize = function tokenizeJSON(input, options) { + if (options == null) options = {} + + options._tokenize = function(smth) { + if (options._addstack) smth.stack.unshift.apply(smth.stack, options._addstack) + tokens.push(smth) + } + + var tokens = [] + tokens.data = module.exports.parse(input, options) + return tokens +} + diff --git a/node_modules/parse-json/vendor/unicode.js b/node_modules/parse-json/vendor/unicode.js new file mode 100644 index 000000000..1a29143c2 --- /dev/null +++ b/node_modules/parse-json/vendor/unicode.js @@ -0,0 +1,71 @@ + +// This is autogenerated with esprima tools, see: +// https://github.com/ariya/esprima/blob/master/esprima.js +// +// PS: oh God, I hate Unicode + +// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierStart: + +var Uni = module.exports + +module.exports.isWhiteSpace = function isWhiteSpace(x) { + // section 7.2, table 2 + return x === '\u0020' + || x === '\u00A0' + || x === '\uFEFF' // <-- this is not a Unicode WS, only a JS one + || (x >= '\u0009' && x <= '\u000D') // 9 A B C D + + // + whitespace characters from unicode, category Zs + || x === '\u1680' + || x === '\u180E' + || (x >= '\u2000' && x <= '\u200A') // 0 1 2 3 4 5 6 7 8 9 A + || x === '\u2028' + || x === '\u2029' + || x === '\u202F' + || x === '\u205F' + || x === '\u3000' +} + +module.exports.isWhiteSpaceJSON = function isWhiteSpaceJSON(x) { + return x === '\u0020' + || x === '\u0009' + || x === '\u000A' + || x === '\u000D' +} + +module.exports.isLineTerminator = function isLineTerminator(x) { + // ok, here is the part when JSON is wrong + // section 7.3, table 3 + return x === '\u000A' + || x === '\u000D' + || x === '\u2028' + || x === '\u2029' +} + +module.exports.isLineTerminatorJSON = function isLineTerminatorJSON(x) { + return x === '\u000A' + || x === '\u000D' +} + +module.exports.isIdentifierStart = function isIdentifierStart(x) { + return x === '$' + || x === '_' + || (x >= 'A' && x <= 'Z') + || (x >= 'a' && x <= 'z') + || (x >= '\u0080' && Uni.NonAsciiIdentifierStart.test(x)) +} + +module.exports.isIdentifierPart = function isIdentifierPart(x) { + return x === '$' + || x === '_' + || (x >= 'A' && x <= 'Z') + || (x >= 'a' && x <= 'z') + || (x >= '0' && x <= '9') // <-- addition to Start + || (x >= '\u0080' && Uni.NonAsciiIdentifierPart.test(x)) +} + +module.exports.NonAsciiIdentifierStart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ + +// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierPart: + +module.exports.NonAsciiIdentifierPart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ diff --git a/node_modules/path-exists/index.js b/node_modules/path-exists/index.js new file mode 100644 index 000000000..16ae60acb --- /dev/null +++ b/node_modules/path-exists/index.js @@ -0,0 +1,17 @@ +'use strict'; +const fs = require('fs'); + +module.exports = fp => new Promise(resolve => { + fs.access(fp, err => { + resolve(!err); + }); +}); + +module.exports.sync = fp => { + try { + fs.accessSync(fp); + return true; + } catch (err) { + return false; + } +}; diff --git a/node_modules/path-exists/license b/node_modules/path-exists/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/path-exists/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-exists/package.json b/node_modules/path-exists/package.json new file mode 100644 index 000000000..efd56267e --- /dev/null +++ b/node_modules/path-exists/package.json @@ -0,0 +1,40 @@ +{ + "name": "path-exists", + "version": "3.0.0", + "description": "Check if a path exists", + "license": "MIT", + "repository": "sindresorhus/path-exists", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "exists", + "exist", + "file", + "filepath", + "fs", + "filesystem", + "file-system", + "access", + "stat" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/path-exists/readme.md b/node_modules/path-exists/readme.md new file mode 100644 index 000000000..1b65fa705 --- /dev/null +++ b/node_modules/path-exists/readme.md @@ -0,0 +1,50 @@ +# path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/path-exists) + +> Check if a path exists + +Because [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), but there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it. + +Never use this before handling a file though: + +> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there. + + +## Install + +``` +$ npm install --save path-exists +``` + + +## Usage + +```js +// foo.js +const pathExists = require('path-exists'); + +pathExists('foo.js').then(exists => { + console.log(exists); + //=> true +}); +``` + + +## API + +### pathExists(path) + +Returns a promise for a boolean of whether the path exists. + +### pathExists.sync(path) + +Returns a boolean of whether the path exists. + + +## Related + +- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js new file mode 100644 index 000000000..22aa6c356 --- /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 000000000..654d0bfe9 --- /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 000000000..91196d5e9 --- /dev/null +++ b/node_modules/path-is-absolute/package.json @@ -0,0 +1,43 @@ +{ + "name": "path-is-absolute", + "version": "1.0.1", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": "sindresorhus/path-is-absolute", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "devDependencies": { + "xo": "^0.16.0" + } +} diff --git a/node_modules/path-is-absolute/readme.md b/node_modules/path-is-absolute/readme.md new file mode 100644 index 000000000..8dbdf5fcb --- /dev/null +++ b/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-parse/LICENSE b/node_modules/path-parse/LICENSE new file mode 100644 index 000000000..810f3dbea --- /dev/null +++ b/node_modules/path-parse/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Javier Blanco + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-parse/README.md b/node_modules/path-parse/README.md new file mode 100644 index 000000000..05097f86a --- /dev/null +++ b/node_modules/path-parse/README.md @@ -0,0 +1,42 @@ +# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) + +> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). + +## Install + +``` +$ npm install --save path-parse +``` + +## Usage + +```js +var pathParse = require('path-parse'); + +pathParse('/home/user/dir/file.txt'); +//=> { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } +``` + +## API + +See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. + +### pathParse(path) + +### pathParse.posix(path) + +The Posix specific version. + +### pathParse.win32(path) + +The Windows specific version. + +## License + +MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/node_modules/path-parse/index.js b/node_modules/path-parse/index.js new file mode 100644 index 000000000..f062d0a23 --- /dev/null +++ b/node_modules/path-parse/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var isWindows = process.platform === 'win32'; + +// Regex to split a windows path into into [dir, root, basename, name, ext] +var splitWindowsRe = + /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/; + +var win32 = {}; + +function win32SplitPath(filename) { + return splitWindowsRe.exec(filename).slice(1); +} + +win32.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[1], + dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3] + }; +}; + + + +// Split a filename into [dir, root, basename, name, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +posix.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + + return { + root: allParts[1], + dir: allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3], + }; +}; + + +if (isWindows) + module.exports = win32.parse; +else /* posix */ + module.exports = posix.parse; + +module.exports.posix = posix.parse; +module.exports.win32 = win32.parse; diff --git a/node_modules/path-parse/package.json b/node_modules/path-parse/package.json new file mode 100644 index 000000000..36c23f84e --- /dev/null +++ b/node_modules/path-parse/package.json @@ -0,0 +1,33 @@ +{ + "name": "path-parse", + "version": "1.0.7", + "description": "Node.js path.parse() ponyfill", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/jbgutierrez/path-parse.git" + }, + "keywords": [ + "path", + "paths", + "file", + "dir", + "parse", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim" + ], + "author": "Javier Blanco ", + "license": "MIT", + "bugs": { + "url": "https://github.com/jbgutierrez/path-parse/issues" + }, + "homepage": "https://github.com/jbgutierrez/path-parse#readme" +} diff --git a/node_modules/path-to-glob-pattern/LICENSE b/node_modules/path-to-glob-pattern/LICENSE new file mode 100644 index 000000000..2d12116a4 --- /dev/null +++ b/node_modules/path-to-glob-pattern/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +and + +ESLint +Copyright JS Foundation and other contributors, https://js.foundation +https://github.com/eslint/eslint/blob/master/tests/lib/util/glob-util.js diff --git a/node_modules/path-to-glob-pattern/README.md b/node_modules/path-to-glob-pattern/README.md new file mode 100644 index 000000000..f78fea77c --- /dev/null +++ b/node_modules/path-to-glob-pattern/README.md @@ -0,0 +1,83 @@ +# path-to-glob-pattern [![Build Status](https://travis-ci.org/azu/path-to-glob-pattern.svg?branch=master)](https://travis-ci.org/azu/path-to-glob-pattern) + +Convert file/directory path to glob pattern. + +For example, + +``` +src/ => src/**/* +``` + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install path-to-glob-pattern + +## Usage + +`pathToGlobPattern` return process function. + +```js +const pathToGlobPattern = require("path-to-glob-pattern"); +const processPatternJs = pathToGlobPattern({ + extensions: ["js"], + cwd: __dirname +}); +/* ## Pass directory */ +console.log(processPatternJs("src")); +// => src/**/*.js + +/* ## Pass file path */ +console.log(processPatternJs("src/path-to-glob-pattern.js")); +// => src/path-to-glob-pattern.js + +/* ## Pass not match file path */ +console.log(processPatternJs("src/unknown.ext")); +// => src/unknown.ext + +/* ## Multiple extensions */ +const processPatternMultiple = pathToGlobPattern({ + extensions: ["js", "md"], + cwd: __dirname +}); +console.log(processPatternMultiple(".")); +// => **/*.{js,md} +```` + +## Changelog + +See [Releases page](https://github.com/azu/path-to-glob-pattern/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/azu/path-to-glob-pattern/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu + +and + +ESLint +Copyright JS Foundation and other contributors, https://js.foundation +https://github.com/eslint/eslint/blob/master/tests/lib/util/glob-util.js diff --git a/node_modules/path-to-glob-pattern/package.json b/node_modules/path-to-glob-pattern/package.json new file mode 100644 index 000000000..5fbeb583c --- /dev/null +++ b/node_modules/path-to-glob-pattern/package.json @@ -0,0 +1,48 @@ +{ + "directories": { + "test": "test" + }, + "author": "azu", + "license": "MIT", + "files": [ + "bin/", + "lib/", + "src/" + ], + "name": "path-to-glob-pattern", + "version": "1.0.2", + "description": "Convert file/directory path to glob pattern.", + "main": "lib/path-to-glob-pattern.js", + "scripts": { + "test": "mocha test/", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", + "watch": "babel src --out-dir lib --watch --source-maps", + "prepublish": "npm run --if-present build" + }, + "keywords": [ + "glob", + "file", + "path", + "fs" + ], + "repository": { + "type": "git", + "url": "https://github.com/azu/path-to-glob-pattern.git" + }, + "bugs": { + "url": "https://github.com/azu/path-to-glob-pattern/issues" + }, + "homepage": "https://github.com/azu/path-to-glob-pattern", + "devDependencies": { + "babel-cli": "^6.23.0", + "babel-preset-jsdoc-to-assert": "^4.0.0", + "babel-preset-latest": "^6.22.0", + "babel-preset-power-assert": "^1.0.0", + "babel-register": "^6.23.0", + "cross-env": "^3.1.4", + "mocha": "^3.2.0", + "power-assert": "^1.4.2", + "shelljs": "^0.7.6" + }, + "dependencies": {} +} diff --git a/node_modules/path-to-glob-pattern/src/path-to-glob-pattern.js b/node_modules/path-to-glob-pattern/src/path-to-glob-pattern.js new file mode 100644 index 000000000..f220f52eb --- /dev/null +++ b/node_modules/path-to-glob-pattern/src/path-to-glob-pattern.js @@ -0,0 +1,79 @@ +// MIT © 2017 azu +// and +// https://github.com/eslint/eslint/blob/master/tests/lib/util/glob-util.js +// ESLint +// Copyright JS Foundation and other contributors, https://js.foundation +"use strict"; +const path = require("path"); +const fs = require("fs"); +/** + * Replace Windows with posix style paths + * + * @param {string} filePath Path to convert + * @returns {string} Converted filepath + */ +function convertPathToPosix(filePath) { + const normalizedFilePath = path.normalize(filePath); + return normalizedFilePath.replace(/\\/g, "/"); +} + + +const isDirectory = (filepath) => { + try { + return fs.statSync(filepath).isDirectory() + } catch (error) { + return false; + } +}; +/** + * Checks if a provided path is a directory and returns a glob string matching + * all files under that directory if so, the path itself otherwise. + * + * Reason for this is that `glob` needs `/**` to collect all the files under a + * directory where as our previous implementation without `glob` simply walked + * a directory that is passed. So this is to maintain backwards compatibility. + * + * Also makes sure all path separators are POSIX style for `glob` compatibility. + * + * @param {Object} [options] An options object + * @param {string[]} [options.extensions=[]] An array of accepted extensions + * @param {string} [options.cwd=process.cwd()] The cwd to use to resolve relative pathnames + * @returns {Function} A function that takes a pathname and returns a glob that + * matches all files with the provided extensions if + * pathname is a directory. + */ +function processPath(options) { + const cwd = options.cwd; + let extensions = options.extensions; + + extensions = extensions.map(ext => ext.replace(/^\./, "")); + + let suffix = "/**"; + if (extensions.length === 0) { + // no extension option + suffix += "/*"; + } else if (extensions.length === 1) { + suffix += `/*.${extensions[0]}`; + } else { + suffix += `/*.{${extensions.join(",")}}`; + } + + /** + * A function that converts a directory name to a glob pattern + * + * @param {string} filePath The directory path to be modified + * @returns {string} The glob path or the file path itself + * @private + */ + return function(filePath) { + let newPath = filePath; + const resolvedPath = path.resolve(cwd, filePath); + + if (isDirectory(resolvedPath)) { + newPath = filePath.replace(/[/\\]$/, "") + suffix; + } + + return convertPathToPosix(newPath); + }; +} +module.exports = processPath; \ No newline at end of file diff --git a/node_modules/path-type/index.js b/node_modules/path-type/index.js new file mode 100644 index 000000000..207a1d19c --- /dev/null +++ b/node_modules/path-type/index.js @@ -0,0 +1,29 @@ +'use strict'; +var fs = require('graceful-fs'); +var Promise = require('pinkie-promise'); +var pify = require('pify'); + +function type(fn, fn2, fp) { + if (typeof fp !== 'string') { + return Promise.reject(new TypeError('Expected a string')); + } + + return pify(fs[fn], Promise)(fp).then(function (stats) { + return stats[fn2](); + }); +} + +function typeSync(fn, fn2, fp) { + if (typeof fp !== 'string') { + throw new TypeError('Expected a string'); + } + + return fs[fn](fp)[fn2](); +} + +exports.file = type.bind(null, 'stat', 'isFile'); +exports.dir = type.bind(null, 'stat', 'isDirectory'); +exports.symlink = type.bind(null, 'lstat', 'isSymbolicLink'); +exports.fileSync = typeSync.bind(null, 'statSync', 'isFile'); +exports.dirSync = typeSync.bind(null, 'statSync', 'isDirectory'); +exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink'); diff --git a/node_modules/path-type/license b/node_modules/path-type/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/path-type/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-type/package.json b/node_modules/path-type/package.json new file mode 100644 index 000000000..6e54f69bb --- /dev/null +++ b/node_modules/path-type/package.json @@ -0,0 +1,52 @@ +{ + "name": "path-type", + "version": "1.1.0", + "description": "Check if a path is a file, directory, or symlink", + "license": "MIT", + "repository": "sindresorhus/path-type", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "fs", + "type", + "is", + "check", + "directory", + "dir", + "file", + "filepath", + "symlink", + "symbolic", + "link", + "stat", + "stats", + "filesystem" + ], + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "ignores": [ + "test.js" + ] + } +} diff --git a/node_modules/path-type/readme.md b/node_modules/path-type/readme.md new file mode 100644 index 000000000..eac12d609 --- /dev/null +++ b/node_modules/path-type/readme.md @@ -0,0 +1,42 @@ +# path-type [![Build Status](https://travis-ci.org/sindresorhus/path-type.svg?branch=master)](https://travis-ci.org/sindresorhus/path-type) + +> Check if a path is a file, directory, or symlink + + +## Install + +``` +$ npm install --save path-type +``` + + +## Usage + +```js +var pathType = require('path-type'); + +pathType.file('package.json').then(function (isFile) { + console.log(isFile); + //=> true +}) +``` + + +## API + +### .file(path) +### .dir(path) +### .symlink(path) + +Returns a promise that resolves to a boolean of whether the path is the checked type. + +### .fileSync(path) +### .dirSync(path) +### .symlinkSync(path) + +Returns a boolean of whether the path is the checked type. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/pify/index.js b/node_modules/pify/index.js new file mode 100644 index 000000000..7c720ebee --- /dev/null +++ b/node_modules/pify/index.js @@ -0,0 +1,68 @@ +'use strict'; + +var processFn = function (fn, P, opts) { + return function () { + var that = this; + var args = new Array(arguments.length); + + for (var i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P(function (resolve, reject) { + args.push(function (err, result) { + if (err) { + reject(err); + } else if (opts.multiArgs) { + var results = new Array(arguments.length - 1); + + for (var i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + + fn.apply(that, args); + }); + }; +}; + +var pify = module.exports = function (obj, P, opts) { + if (typeof P !== 'function') { + opts = P; + P = Promise; + } + + opts = opts || {}; + opts.exclude = opts.exclude || [/.+Sync$/]; + + var filter = function (key) { + var match = function (pattern) { + return typeof pattern === 'string' ? key === pattern : pattern.test(key); + }; + + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + var ret = typeof obj === 'function' ? function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, P, opts).apply(this, arguments); + } : {}; + + return Object.keys(obj).reduce(function (ret, key) { + var x = obj[key]; + + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x; + + return ret; + }, ret); +}; + +pify.all = pify; diff --git a/node_modules/pify/license b/node_modules/pify/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/pify/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/pify/package.json b/node_modules/pify/package.json new file mode 100644 index 000000000..311d1982e --- /dev/null +++ b/node_modules/pify/package.json @@ -0,0 +1,48 @@ +{ + "name": "pify", + "version": "2.3.0", + "description": "Promisify a callback-style function", + "license": "MIT", + "repository": "sindresorhus/pify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava && npm run optimization-test", + "optimization-test": "node --allow-natives-syntax optimization-test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "promises", + "promisify", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "es2015" + ], + "devDependencies": { + "ava": "*", + "pinkie-promise": "^1.0.0", + "v8-natives": "0.0.2", + "xo": "*" + } +} diff --git a/node_modules/pify/readme.md b/node_modules/pify/readme.md new file mode 100644 index 000000000..c79ca8bf6 --- /dev/null +++ b/node_modules/pify/readme.md @@ -0,0 +1,119 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// promisify a single function + +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// or promisify all methods in a module + +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [promiseModule], [options]) + +Returns a promise wrapped version of the supplied function or module. + +#### input + +Type: `function`, `object` + +Callback-style function or module whose methods you want to promisify. + +#### promiseModule + +Type: `function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + +#### options + +##### multiArgs + +Type: `boolean` +Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `array` of (`string`|`regex`) + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `array` of (`string`|`regex`) +Default: `[/.+Sync$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean` +Default: `false` + +By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(data, null); + }); +}; + +// promisify methods but not fn() +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/pinkie-promise/index.js b/node_modules/pinkie-promise/index.js new file mode 100644 index 000000000..777377a1f --- /dev/null +++ b/node_modules/pinkie-promise/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = typeof Promise === 'function' ? Promise : require('pinkie'); diff --git a/node_modules/pinkie-promise/license b/node_modules/pinkie-promise/license new file mode 100644 index 000000000..1aeb74fd2 --- /dev/null +++ b/node_modules/pinkie-promise/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/pinkie-promise/package.json b/node_modules/pinkie-promise/package.json new file mode 100644 index 000000000..3515f8ff3 --- /dev/null +++ b/node_modules/pinkie-promise/package.json @@ -0,0 +1,35 @@ +{ + "name": "pinkie-promise", + "version": "2.0.1", + "description": "ES2015 Promise ponyfill", + "license": "MIT", + "repository": "floatdrop/pinkie-promise", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "promises", + "es2015", + "es6", + "polyfill", + "ponyfill" + ], + "dependencies": { + "pinkie": "^2.0.0" + }, + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/pinkie-promise/readme.md b/node_modules/pinkie-promise/readme.md new file mode 100644 index 000000000..78477f429 --- /dev/null +++ b/node_modules/pinkie-promise/readme.md @@ -0,0 +1,28 @@ +# pinkie-promise [![Build Status](https://travis-ci.org/floatdrop/pinkie-promise.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie-promise) + +> [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) ponyfill + +Module exports global Promise object (if available) or [`pinkie`](http://github.com/floatdrop/pinkie) Promise polyfill. + +## Install + +``` +$ npm install --save pinkie-promise +``` + +## Usage + +```js +var Promise = require('pinkie-promise'); + +new Promise(function (resolve) { resolve('unicorns'); }); +//=> Promise { 'unicorns' } +``` + +## Related + +- [pify](https://github.com/sindresorhus/pify) - Promisify a callback-style function + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/node_modules/pinkie/index.js b/node_modules/pinkie/index.js new file mode 100644 index 000000000..14ce1bfe3 --- /dev/null +++ b/node_modules/pinkie/index.js @@ -0,0 +1,292 @@ +'use strict'; + +var PENDING = 'pending'; +var SETTLED = 'settled'; +var FULFILLED = 'fulfilled'; +var REJECTED = 'rejected'; +var NOOP = function () {}; +var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function'; + +var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate; +var asyncQueue = []; +var asyncTimer; + +function asyncFlush() { + // run promise callbacks + for (var i = 0; i < asyncQueue.length; i++) { + asyncQueue[i][0](asyncQueue[i][1]); + } + + // reset async asyncQueue + asyncQueue = []; + asyncTimer = false; +} + +function asyncCall(callback, arg) { + asyncQueue.push([callback, arg]); + + if (!asyncTimer) { + asyncTimer = true; + asyncSetTimer(asyncFlush, 0); + } +} + +function invokeResolver(resolver, promise) { + function resolvePromise(value) { + resolve(promise, value); + } + + function rejectPromise(reason) { + reject(promise, reason); + } + + try { + resolver(resolvePromise, rejectPromise); + } catch (e) { + rejectPromise(e); + } +} + +function invokeCallback(subscriber) { + var owner = subscriber.owner; + var settled = owner._state; + var value = owner._data; + var callback = subscriber[settled]; + var promise = subscriber.then; + + if (typeof callback === 'function') { + settled = FULFILLED; + try { + value = callback(value); + } catch (e) { + reject(promise, e); + } + } + + if (!handleThenable(promise, value)) { + if (settled === FULFILLED) { + resolve(promise, value); + } + + if (settled === REJECTED) { + reject(promise, value); + } + } +} + +function handleThenable(promise, value) { + var resolved; + + try { + if (promise === value) { + throw new TypeError('A promises callback cannot return that same promise.'); + } + + if (value && (typeof value === 'function' || typeof value === 'object')) { + // then should be retrieved only once + var then = value.then; + + if (typeof then === 'function') { + then.call(value, function (val) { + if (!resolved) { + resolved = true; + + if (value === val) { + fulfill(promise, val); + } else { + resolve(promise, val); + } + } + }, function (reason) { + if (!resolved) { + resolved = true; + + reject(promise, reason); + } + }); + + return true; + } + } + } catch (e) { + if (!resolved) { + reject(promise, e); + } + + return true; + } + + return false; +} + +function resolve(promise, value) { + if (promise === value || !handleThenable(promise, value)) { + fulfill(promise, value); + } +} + +function fulfill(promise, value) { + if (promise._state === PENDING) { + promise._state = SETTLED; + promise._data = value; + + asyncCall(publishFulfillment, promise); + } +} + +function reject(promise, reason) { + if (promise._state === PENDING) { + promise._state = SETTLED; + promise._data = reason; + + asyncCall(publishRejection, promise); + } +} + +function publish(promise) { + promise._then = promise._then.forEach(invokeCallback); +} + +function publishFulfillment(promise) { + promise._state = FULFILLED; + publish(promise); +} + +function publishRejection(promise) { + promise._state = REJECTED; + publish(promise); + if (!promise._handled && isNode) { + global.process.emit('unhandledRejection', promise._data, promise); + } +} + +function notifyRejectionHandled(promise) { + global.process.emit('rejectionHandled', promise); +} + +/** + * @class + */ +function Promise(resolver) { + if (typeof resolver !== 'function') { + throw new TypeError('Promise resolver ' + resolver + ' is not a function'); + } + + if (this instanceof Promise === false) { + throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.'); + } + + this._then = []; + + invokeResolver(resolver, this); +} + +Promise.prototype = { + constructor: Promise, + + _state: PENDING, + _then: null, + _data: undefined, + _handled: false, + + then: function (onFulfillment, onRejection) { + var subscriber = { + owner: this, + then: new this.constructor(NOOP), + fulfilled: onFulfillment, + rejected: onRejection + }; + + if ((onRejection || onFulfillment) && !this._handled) { + this._handled = true; + if (this._state === REJECTED && isNode) { + asyncCall(notifyRejectionHandled, this); + } + } + + if (this._state === FULFILLED || this._state === REJECTED) { + // already resolved, call callback async + asyncCall(invokeCallback, subscriber); + } else { + // subscribe + this._then.push(subscriber); + } + + return subscriber.then; + }, + + catch: function (onRejection) { + return this.then(null, onRejection); + } +}; + +Promise.all = function (promises) { + if (!Array.isArray(promises)) { + throw new TypeError('You must pass an array to Promise.all().'); + } + + return new Promise(function (resolve, reject) { + var results = []; + var remaining = 0; + + function resolver(index) { + remaining++; + return function (value) { + results[index] = value; + if (!--remaining) { + resolve(results); + } + }; + } + + for (var i = 0, promise; i < promises.length; i++) { + promise = promises[i]; + + if (promise && typeof promise.then === 'function') { + promise.then(resolver(i), reject); + } else { + results[i] = promise; + } + } + + if (!remaining) { + resolve(results); + } + }); +}; + +Promise.race = function (promises) { + if (!Array.isArray(promises)) { + throw new TypeError('You must pass an array to Promise.race().'); + } + + return new Promise(function (resolve, reject) { + for (var i = 0, promise; i < promises.length; i++) { + promise = promises[i]; + + if (promise && typeof promise.then === 'function') { + promise.then(resolve, reject); + } else { + resolve(promise); + } + } + }); +}; + +Promise.resolve = function (value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + + return new Promise(function (resolve) { + resolve(value); + }); +}; + +Promise.reject = function (reason) { + return new Promise(function (resolve, reject) { + reject(reason); + }); +}; + +module.exports = Promise; diff --git a/node_modules/pinkie/license b/node_modules/pinkie/license new file mode 100644 index 000000000..1aeb74fd2 --- /dev/null +++ b/node_modules/pinkie/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/pinkie/package.json b/node_modules/pinkie/package.json new file mode 100644 index 000000000..cb9057b81 --- /dev/null +++ b/node_modules/pinkie/package.json @@ -0,0 +1,36 @@ +{ + "name": "pinkie", + "version": "2.0.4", + "description": "Itty bitty little widdle twinkie pinkie ES2015 Promise implementation", + "license": "MIT", + "repository": "floatdrop/pinkie", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && nyc mocha", + "coverage": "nyc report --reporter=text-lcov | coveralls" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "promises", + "es2015", + "es6" + ], + "devDependencies": { + "core-assert": "^0.1.1", + "coveralls": "^2.11.4", + "mocha": "*", + "nyc": "^3.2.2", + "promises-aplus-tests": "*", + "xo": "^0.10.1" + } +} diff --git a/node_modules/pinkie/readme.md b/node_modules/pinkie/readme.md new file mode 100644 index 000000000..1565f9588 --- /dev/null +++ b/node_modules/pinkie/readme.md @@ -0,0 +1,83 @@ +

+
+ pinkie +
+
+

+ +> Itty bitty little widdle twinkie pinkie [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation + +[![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie) [![Coverage Status](https://coveralls.io/repos/floatdrop/pinkie/badge.svg?branch=master&service=github)](https://coveralls.io/github/floatdrop/pinkie?branch=master) + +There are [tons of Promise implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md#standalone) out there, but all of them focus on browser compatibility and are often bloated with functionality. + +This module is an exact Promise specification polyfill (like [native-promise-only](https://github.com/getify/native-promise-only)), but in Node.js land (it should be browserify-able though). + + +## Install + +``` +$ npm install --save pinkie +``` + + +## Usage + +```js +var fs = require('fs'); +var Promise = require('pinkie'); + +new Promise(function (resolve, reject) { + fs.readFile('foo.json', 'utf8', function (err, data) { + if (err) { + reject(err); + return; + } + + resolve(data); + }); +}); +//=> Promise +``` + + +### API + +`pinkie` exports bare [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation and polyfills [Node.js rejection events](https://nodejs.org/api/process.html#process_event_unhandledrejection). In case you forgot: + +#### new Promise(executor) + +Returns new instance of `Promise`. + +##### executor + +*Required* +Type: `function` + +Function with two arguments `resolve` and `reject`. The first argument fulfills the promise, the second argument rejects it. + +#### pinkie.all(promises) + +Returns a promise that resolves when all of the promises in the `promises` Array argument have resolved. + +#### pinkie.race(promises) + +Returns a promise that resolves or rejects as soon as one of the promises in the `promises` Array resolves or rejects, with the value or reason from that promise. + +#### pinkie.reject(reason) + +Returns a Promise object that is rejected with the given `reason`. + +#### pinkie.resolve(value) + +Returns a Promise object that is resolved with the given `value`. If the `value` is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the `value`. + + +## Related + +- [pinkie-promise](https://github.com/floatdrop/pinkie-promise) - Returns the native Promise or this module + + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/node_modules/pluralize/LICENSE b/node_modules/pluralize/LICENSE new file mode 100644 index 000000000..309c2e3b8 --- /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 000000000..82401813d --- /dev/null +++ b/node_modules/pluralize/Readme.md @@ -0,0 +1,78 @@ +# 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] + +> Pluralize and singularize any word. + +## Installation + +``` +npm install pluralize --save +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 + +```javascript +pluralize('test') //=> "tests" +pluralize('test', 1) //=> "test" +pluralize('test', 5) //=> "tests" +pluralize('test', 1, true) //=> "1 test" +pluralize('test', 5, true) //=> "5 tests" + +pluralize.plural('regex') //=> "regexes" +pluralize.addPluralRule(/gex$/i, 'gexii') +pluralize.plural('regex') //=> "regexii" + +pluralize.plural('singles', 1) //=> "single" +pluralize.addSingularRule(/singles$/i, 'singular') +pluralize.plural('singles', 1) //=> "singular" + +pluralize.plural('irregular') //=> "irregulars" +pluralize.addIrregularRule('irregular', 'regular') +pluralize.plural('irregular') //=> "regular" + +pluralize.plural('paper') //=> "papers" +pluralize.addUncountableRule('paper') +pluralize.plural('paper') //=> "paper" +``` + +## 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 diff --git a/node_modules/pluralize/package.json b/node_modules/pluralize/package.json new file mode 100644 index 000000000..d762b7e5d --- /dev/null +++ b/node_modules/pluralize/package.json @@ -0,0 +1,38 @@ +{ + "name": "pluralize", + "version": "2.0.0", + "description": "Pluralize and singularize any word", + "main": "pluralize.js", + "files": [ + "pluralize.js" + ], + "scripts": { + "lint": "semistandard", + "test-spec": "mocha -R spec --bail", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail", + "test": "npm run lint && npm run test-cov" + }, + "repository": "https://github.com/blakeembrey/pluralize.git", + "keywords": [ + "plural", + "plurals", + "pluralize", + "singular", + "singularize", + "inflection" + ], + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + }, + "license": "MIT", + "readmeFilename": "Readme.md", + "devDependencies": { + "chai": "^3.2.0", + "istanbul": "^0.3.0", + "mocha": "^2.3.2", + "pre-commit": "^1.0.10", + "semistandard": "^7.0.2" + } +} diff --git a/node_modules/pluralize/pluralize.js b/node_modules/pluralize/pluralize.js new file mode 100644 index 000000000..5d8327746 --- /dev/null +++ b/node_modules/pluralize/pluralize.js @@ -0,0 +1,455 @@ +/* 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 = {}; + + /** + * Title case a string. + * + * @param {string} str + * @return {string} + */ + function toTitleCase (str) { + return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase(); + } + + /** + * 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) { + // Upper cased words. E.g. "HELLO". + if (word === word.toUpperCase()) { + return token.toUpperCase(); + } + + // Title cased words. E.g. "Title". + if (word[0] === word[0].toUpperCase()) { + return toTitleCase(token); + } + + // 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] || ''; + }); + } + + /** + * Sanitize a word by passing in the word and sanitization rules. + * + * @param {String} token + * @param {String} word + * @param {Array} collection + * @return {String} + */ + function sanitizeWord (token, word, collection) { + // Empty string or doesn't need fixing. + if (!token.length || uncountables.hasOwnProperty(token)) { + return word; + } + + var len = collection.length; + + // Iterate over the sanitization rules and use the first one to match. + while (len--) { + var rule = collection[len]; + + // If the rule passes, return the replacement. + if (rule[0].test(word)) { + return word.replace(rule[0], function (match, index, word) { + var result = interpolate(rule[1], arguments); + + if (match === '') { + return restoreCase(word[index - 1], result); + } + + return restoreCase(match, result); + }); + } + } + + 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); + }; + } + + /** + * Pluralize or singularize a word based on the passed in count. + * + * @param {String} word + * @param {Number} count + * @param {Boolean} inclusive + * @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 + ); + + /** + * Singularize a word. + * + * @type {Function} + */ + pluralize.singular = replaceWord( + 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'], + ['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'], + ['thief', 'thieves'], + ['genie', 'genies'], + ['groove', 'grooves'], + ['pickaxe', 'pickaxes'], + ['whiskey', 'whiskies'] + ].forEach(function (rule) { + return pluralize.addIrregularRule(rule[0], rule[1]); + }); + + /** + * Pluralization rules. + */ + [ + [/s?$/i, 's'], + [/([^aeiou]ese)$/i, '$1'], + [/(ax|test)is$/i, '$1es'], + [/(alias|[^aou]us|tlas|gas|ris)$/i, '$1es'], + [/(e[mn]u)s?$/i, '$1s'], + [/([^l]ias|[aeiou]las|[emjzr]as|[iu]am)$/i, '$1'], + [/(alumn|syllab|octop|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'], + [/(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'], + [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(?:sis|ses)$/i, '$1sis'], + [/(^analy)(?:sis|ses)$/i, '$1sis'], + [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'], + [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'], + [/([^aeiouy]|qu)ies$/i, '$1y'], + [/(^[pl]|zomb|^(?:neck)?t|[aeo][lt]|cut)ies$/i, '$1ie'], + [/(\b(?:mon|smil))ies$/i, '$1ey'], + [/(m|l)ice$/i, '$1ouse'], + [/(seraph|cherub)im$/i, '$1'], + [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|tlas|gas|(?:her|at|gr)o|ris)(?:es)?$/i, '$1'], + [/(e[mn]u)s?$/i, '$1'], + [/(movie|twelve)s$/i, '$1'], + [/(cris|test|diagnos)(?:is|es)$/i, '$1is'], + [/(alumn|syllab|octop|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. + 'advice', + 'adulthood', + 'agenda', + 'aid', + 'alcohol', + 'ammo', + 'athletics', + 'bison', + 'blood', + 'bream', + 'buffalo', + 'butter', + 'carp', + 'cash', + 'chassis', + 'chess', + 'clothing', + 'commerce', + 'cod', + 'cooperation', + 'corps', + 'digestion', + 'debris', + 'diabetes', + 'energy', + 'equipment', + 'elk', + 'excretion', + 'expertise', + 'flounder', + 'fun', + 'gallows', + 'garbage', + 'graffiti', + 'headquarters', + 'health', + 'herpes', + 'highjinks', + 'homework', + 'housework', + 'information', + 'jeans', + 'justice', + 'kudos', + 'labour', + 'literature', + 'machinery', + 'mackerel', + 'mail', + 'media', + 'mews', + 'moose', + 'music', + 'news', + 'pike', + 'plankton', + 'pliers', + 'pollution', + 'premises', + 'rain', + 'research', + 'rice', + 'salmon', + 'scissors', + 'series', + 'sewage', + 'shambles', + 'shrimp', + 'species', + 'staff', + 'swine', + 'trout', + 'traffic', + 'transporation', + 'tuna', + 'wealth', + 'welfare', + 'whiting', + 'wildebeest', + 'wildlife', + 'you', + // Regexes. + /pox$/i, // "chickpox", "smallpox" + /ois$/i, + /deer$/i, // "deer", "reindeer" + /fish$/i, // "fish", "blowfish", "angelfish" + /sheep$/i, + /measles$/i, + /[^aeiou]ese$/i // "chinese", "japanese" + ].forEach(pluralize.addUncountableRule); + + return pluralize; +}); diff --git a/node_modules/possible-typed-array-names/.eslintrc b/node_modules/possible-typed-array-names/.eslintrc new file mode 100644 index 000000000..3b5d9e90e --- /dev/null +++ b/node_modules/possible-typed-array-names/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/possible-typed-array-names/.github/FUNDING.yml b/node_modules/possible-typed-array-names/.github/FUNDING.yml new file mode 100644 index 000000000..7afce20a6 --- /dev/null +++ b/node_modules/possible-typed-array-names/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/possible-typed-array-names +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/node_modules/possible-typed-array-names/CHANGELOG.md b/node_modules/possible-typed-array-names/CHANGELOG.md new file mode 100644 index 000000000..e3bf2a10c --- /dev/null +++ b/node_modules/possible-typed-array-names/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.0](https://github.com/ljharb/possible-typed-array-names/compare/v1.0.0...v1.1.0) - 2025-02-06 + +### Commits + +- [types] use shared tsconfig [`7d3057f`](https://github.com/ljharb/possible-typed-array-names/commit/7d3057f723d221c032951e618f45ad9044cae80d) +- [actions] split out node 10-20, and 20+ [`3cc8138`](https://github.com/ljharb/possible-typed-array-names/commit/3cc81385d6af59c096475080d76a4c78e6fef664) +- [actions] remove redundant finisher; use reusable workflows [`b46fe5d`](https://github.com/ljharb/possible-typed-array-names/commit/b46fe5d2d47054922f7be81acc0f3c2b7882ddab) +- [New] add `Float16Array` [`77df613`](https://github.com/ljharb/possible-typed-array-names/commit/77df61313d3491acfd23da0d4452673cca476644) +- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/tape`, `auto-changelog`, `tape` [`85bba2e`](https://github.com/ljharb/possible-typed-array-names/commit/85bba2e359add86b19ef058d4a0560d369bf55a2) +- [Tests] tiny refactor [`b2ddd5a`](https://github.com/ljharb/possible-typed-array-names/commit/b2ddd5a9bc86b63631d9f2c17f21f0503492dbb3) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`ed4447f`](https://github.com/ljharb/possible-typed-array-names/commit/ed4447f9ef1ad8657186282140a74ab474240d4e) +- [Tests] add attw; `postlint` [`b5b808c`](https://github.com/ljharb/possible-typed-array-names/commit/b5b808cebf0bc0bdb8636f4981cc8ffabb58bbbb) +- [Tests] replace `aud` with `npm audit` [`ce71c4e`](https://github.com/ljharb/possible-typed-array-names/commit/ce71c4e993e03b41034a4ca96fb8531dd8b8cc14) + +## v1.0.0 - 2024-02-19 + +### Commits + +- Initial implementation, tests, readme, types [`c279f55`](https://github.com/ljharb/possible-typed-array-names/commit/c279f550021896afa50c1169b3111618a96cf898) +- Initial commit [`0f22bf2`](https://github.com/ljharb/possible-typed-array-names/commit/0f22bf24d16fc8ea29483ed7ed378afb3758a4df) +- npm init [`25d6cff`](https://github.com/ljharb/possible-typed-array-names/commit/25d6cffe4091921e4e210704dabed37ae3d7b261) +- Only apps should have lockfiles [`a1bd592`](https://github.com/ljharb/possible-typed-array-names/commit/a1bd592fa037430d401b1d6d26cfea2c2d6789db) diff --git a/node_modules/possible-typed-array-names/LICENSE b/node_modules/possible-typed-array-names/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/possible-typed-array-names/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/possible-typed-array-names/README.md b/node_modules/possible-typed-array-names/README.md new file mode 100644 index 000000000..0580d2f71 --- /dev/null +++ b/node_modules/possible-typed-array-names/README.md @@ -0,0 +1,50 @@ +# possible-typed-array-names [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A simple list of possible Typed Array names. + +## Example + +```js +const assert = require('assert'); + +const names = require('possible-typed-array-names'); + +assert(Array.isArray(names)); +assert(names.every(name => ( + typeof name === 'string' + && (( + typeof globalThis[name] === 'function' + && globalThis[name].name === name + ) || typeof globalThis[name] === 'undefined') +))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/possible-typed-array-names +[npm-version-svg]: https://versionbadg.es/ljharb/possible-typed-array-names.svg +[deps-svg]: https://david-dm.org/ljharb/possible-typed-array-names.svg +[deps-url]: https://david-dm.org/ljharb/possible-typed-array-names +[dev-deps-svg]: https://david-dm.org/ljharb/possible-typed-array-names/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/possible-typed-array-names#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/possible-typed-array-names.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/possible-typed-array-names.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/possible-typed-array-names.svg +[downloads-url]: https://npm-stat.com/charts.html?package=possible-typed-array-names +[codecov-image]: https://codecov.io/gh/ljharb/possible-typed-array-names/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/possible-typed-array-names/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/possible-typed-array-names +[actions-url]: https://github.com/ljharb/possible-typed-array-names/actions diff --git a/node_modules/possible-typed-array-names/index.d.ts b/node_modules/possible-typed-array-names/index.d.ts new file mode 100644 index 000000000..921315965 --- /dev/null +++ b/node_modules/possible-typed-array-names/index.d.ts @@ -0,0 +1,16 @@ +declare const names: [ + 'Float16Array', + 'Float32Array', + 'Float64Array', + 'Int8Array', + 'Int16Array', + 'Int32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Uint16Array', + 'Uint32Array', + 'BigInt64Array', + 'BigUint64Array' +]; + +export = names; \ No newline at end of file diff --git a/node_modules/possible-typed-array-names/index.js b/node_modules/possible-typed-array-names/index.js new file mode 100644 index 000000000..5551ab602 --- /dev/null +++ b/node_modules/possible-typed-array-names/index.js @@ -0,0 +1,17 @@ +'use strict'; + +/** @type {import('.')} */ +module.exports = [ + 'Float16Array', + 'Float32Array', + 'Float64Array', + 'Int8Array', + 'Int16Array', + 'Int32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Uint16Array', + 'Uint32Array', + 'BigInt64Array', + 'BigUint64Array' +]; diff --git a/node_modules/possible-typed-array-names/package.json b/node_modules/possible-typed-array-names/package.json new file mode 100644 index 000000000..5285efa40 --- /dev/null +++ b/node_modules/possible-typed-array-names/package.json @@ -0,0 +1,84 @@ +{ + "name": "possible-typed-array-names", + "version": "1.1.0", + "description": "A simple list of possible Typed Array names.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "npx npm@'>= 10.2' audit --production", + "prelint": "evalmd README.md && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/possible-typed-array-names.git" + }, + "keywords": [ + "typed", + "array", + "typedarray", + "Float32Array", + "Float64Array", + "Int8Array", + "Int16Array", + "Int32Array", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "BigInt64Array", + "BigUint64Array" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/possible-typed-array-names/issues" + }, + "homepage": "https://github.com/ljharb/possible-typed-array-names#readme", + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.3", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.3", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/possible-typed-array-names/test/index.js b/node_modules/possible-typed-array-names/test/index.js new file mode 100644 index 000000000..e115695a4 --- /dev/null +++ b/node_modules/possible-typed-array-names/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); + +var names = require('../'); + +test('typed array names', function (t) { + for (var i = 0; i < names.length; i++) { + var name = names[i]; + + t.equal(typeof name, 'string', 'is string'); + t.equal(names.indexOf(name), i, 'is unique (from start)'); + t.equal(names.lastIndexOf(name), i, 'is unique (from end)'); + + t.match(typeof global[name], /^(?:function|undefined)$/, 'is a global function, or `undefined`'); + } + + t.end(); +}); diff --git a/node_modules/possible-typed-array-names/tsconfig.json b/node_modules/possible-typed-array-names/tsconfig.json new file mode 100644 index 000000000..4e940905a --- /dev/null +++ b/node_modules/possible-typed-array-names/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ESNext", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/prelude-ls/CHANGELOG.md b/node_modules/prelude-ls/CHANGELOG.md new file mode 100644 index 000000000..71b8a0f2c --- /dev/null +++ b/node_modules/prelude-ls/CHANGELOG.md @@ -0,0 +1,108 @@ +# 1.2.1 +- fix version + +# 1.2.0 +- add `List.remove` +- build with LiveScript 1.6.0 +- update dependencies +- remove coverage calculation + +# 1.1.2 +- add `Func.memoize` +- fix `zip-all` and `zip-with-all` corner case (no input) +- build with LiveScript 1.4.0 + +# 1.1.1 +- curry `unique-by`, `minimum-by` + +# 1.1.0 +- added `List` functions: `maximum-by`, `minimum-by`, `unique-by` +- added `List` functions: `at`, `elem-index`, `elem-indices`, `find-index`, `find-indices` +- added `Str` functions: `capitalize`, `camelize`, `dasherize` +- added `Func` function: `over` - eg. ``same-length = (==) `over` (.length)`` +- exported `Str.repeat` through main `prelude` object +- fixed definition of `foldr` and `foldr1`, the new correct definition is backwards incompatible with the old, incorrect one +- fixed issue with `fix` +- improved code coverage + +# 1.0.3 +- build browser versions + +# 1.0.2 +- bug fix for `flatten` - slight change with bug fix, flattens arrays only, not array-like objects + +# 1.0.1 +- bug fixes for `drop-while` and `take-while` + +# 1.0.0 +* massive update - separated functions into separate modules +* functions do not accept multiple types anymore - use different versions in their respective modules in some cases (eg. `Obj.map`), or use `chars` or `values` in other cases to transform into a list +* objects are no longer transformed into functions, simply use `(obj.)` in LiveScript to do that +* browser version now using browserify - use `prelude = require('prelude-ls')` +* added `compact`, `split`, `flatten`, `difference`, `intersection`, `union`, `count-by`, `group-by`, `chars`, `unchars`, `apply` +* added `lists-to-obj` which takes a list of keys and list of values and zips them up into an object, and the converse `obj-to-lists` +* added `pairs-to-obj` which takes a list of pairs (2 element lists) and creates an object, and the converse `obj-to-pairs` +* removed `cons`, `append` - use the concat operator +* removed `compose` - use the compose operator +* removed `obj-to-func` - use partially applied access (eg. `(obj.)`) +* removed `length` - use `(.length)` +* `sort-by` renamed to `sort-with` +* added new `sort-by` +* removed `compare` - just use the new `sort-by` +* `break-it` renamed `break-list`, (`Str.break-str` for the string version) +* added `Str.repeat` which creates a new string by repeating the input n times +* `unfold` as alias to `unfoldr` is no longer used +* fixed up style and compiled with LiveScript 1.1.1 +* use Make instead of Slake +* greatly improved tests + +# 0.6.0 +* fixed various bugs +* added `fix`, a fixpoint (Y combinator) for anonymous recursive functions +* added `unfoldr` (alias `unfold`) +* calling `replicate` with a string now returns a list of strings +* removed `partial`, just use native partial application in LiveScript using the `_` placeholder, or currying +* added `sort`, `sortBy`, and `compare` + +# 0.5.0 +* removed `lookup` - use (.prop) +* removed `call` - use (.func arg1, arg2) +* removed `pluck` - use map (.prop), xs +* fixed buys wtih `head` and `last` +* added non-minifed browser version, as `prelude-browser.js` +* renamed `prelude-min.js` to `prelude-browser-min.js` +* renamed `zip` to `zipAll` +* renamed `zipWith` to `zipAllWith` +* added `zip`, a curried zip that takes only two arguments +* added `zipWith`, a curried zipWith that takes only two arguments + +# 0.4.0 +* added `parition` function +* added `curry` function +* removed `elem` function (use `in`) +* removed `notElem` function (use `not in`) + +# 0.3.0 +* added `listToObject` +* added `unique` +* added `objToFunc` +* added support for using strings in map and the like +* added support for using objects in map and the like +* added ability to use objects instead of functions in certain cases +* removed `error` (just use throw) +* added `tau` constant +* added `join` +* added `values` +* added `keys` +* added `partial` +* renamed `log` to `ln` +* added alias to `head`: `first` +* added `installPrelude` helper + +# 0.2.0 +* removed functions that simply warp operators as you can now use operators as functions in LiveScript +* `min/max` are now curried and take only 2 arguments +* added `call` + +# 0.1.0 +* initial public release diff --git a/node_modules/prelude-ls/LICENSE b/node_modules/prelude-ls/LICENSE new file mode 100644 index 000000000..525b11850 --- /dev/null +++ b/node_modules/prelude-ls/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/prelude-ls/README.md b/node_modules/prelude-ls/README.md new file mode 100644 index 000000000..fabc212e7 --- /dev/null +++ b/node_modules/prelude-ls/README.md @@ -0,0 +1,15 @@ +# prelude.ls [![Build Status](https://travis-ci.org/gkz/prelude-ls.png?branch=master)](https://travis-ci.org/gkz/prelude-ls) + +is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for,
LiveScript. + +See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more. + +You can install via npm `npm install prelude-ls` + +### Development + +`make test` to test + +`make build` to build `lib` from `src` + +`make build-browser` to build browser versions diff --git a/node_modules/prelude-ls/package.json b/node_modules/prelude-ls/package.json new file mode 100644 index 000000000..c313c3da3 --- /dev/null +++ b/node_modules/prelude-ls/package.json @@ -0,0 +1,46 @@ +{ + "name": "prelude-ls", + "version": "1.2.1", + "author": "George Zahariev ", + "description": "prelude.ls is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript.", + "keywords": [ + "prelude", + "livescript", + "utility", + "ls", + "coffeescript", + "javascript", + "library", + "functional", + "array", + "list", + "object", + "string" + ], + "main": "lib/", + "files": [ + "lib/", + "README.md", + "LICENSE" + ], + "homepage": "http://preludels.com", + "bugs": "https://github.com/gkz/prelude-ls/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/prelude-ls.git" + }, + "scripts": { + "test": "make test" + }, + "devDependencies": { + "livescript": "^1.6.0", + "uglify-js": "^3.8.1", + "mocha": "^7.1.1", + "browserify": "^16.5.1", + "sinon": "~8.0.1" + } +} diff --git a/node_modules/process-nextick-args/index.js b/node_modules/process-nextick-args/index.js new file mode 100644 index 000000000..3eecf1148 --- /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 000000000..c67e3532b --- /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 000000000..6070b723f --- /dev/null +++ b/node_modules/process-nextick-args/package.json @@ -0,0 +1,25 @@ +{ + "name": "process-nextick-args", + "version": "2.0.1", + "description": "process.nextTick but always with args", + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/calvinmetcalf/process-nextick-args.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" + }, + "homepage": "https://github.com/calvinmetcalf/process-nextick-args", + "devDependencies": { + "tap": "~0.2.6" + } +} diff --git a/node_modules/process-nextick-args/readme.md b/node_modules/process-nextick-args/readme.md new file mode 100644 index 000000000..ecb432c9b --- /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/rc-config-loader/LICENSE b/node_modules/rc-config-loader/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/rc-config-loader/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-config-loader/README.md b/node_modules/rc-config-loader/README.md new file mode 100644 index 000000000..f03cbbd25 --- /dev/null +++ b/node_modules/rc-config-loader/README.md @@ -0,0 +1,214 @@ +# rc-config-loader [![Build Status](https://travis-ci.org/azu/rc-config-loader.svg?branch=master)](https://travis-ci.org/azu/rc-config-loader) + +Load config from `.{product}rc.{json,yml,js}` file. + +It is a Node.js library for loading `.textlintrc`, `.eslintrc`, `.stylelintrc` etc... + +## Features + +Find and load a configuration object from: + +- a `package.json` property if it is needed +- a JSON or YAML, JS "rc file" + - `.rc` or `.rc.json` or `.rc.js` or`.rc.yml`, `.rc.yaml` +- TypeScript support + - Includes `.d.ts` + +## Difference + +### with [MoOx/rc-loader](https://github.com/MoOx/rc-loader "MoOx/rc-loader") + +- Safe API + - `rc` contains shabang in `.js` file +- Enhance Error message + +### with [cosmiconfig](https://github.com/davidtheclark/cosmiconfig "cosmiconfig") + +- Sync loading + - [cosmiconfig@3+](https://github.com/davidtheclark/cosmiconfig/blob/master/CHANGELOG.md#300) support `sync` option +- Built-in TypeScript support + +If you want to async support and customize loader, recommenced to use [cosmiconfig](https://github.com/davidtheclark/cosmiconfig). + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install rc-config-loader + +## Usage + +### API + +```ts +export interface rcConfigLoaderOption { + // does look for `package.json` + packageJSON?: + | boolean + | { + fieldName: string; + }; + // if config file name is not same with packageName, set the name + configFileName?: string; + // treat default(no ext file) as some extension + defaultExtension?: string | string[]; + // where start to load + cwd?: string; +} +/** + * Find and load rcfile, return { config, filePath } + * If not found any rcfile, throw an Error. + * @param {string} pkgName + * @param {rcConfigLoaderOption} [opts] + * @returns {{ config: Object, filePath:string } | undefined} + */ +export declare function rcFile(pkgName: string, opts?: rcConfigLoaderOption): { + config: R; + filePath: string; +} | undefined; + +``` + +`rcFile` return `{ config, filePath }` object. + +- `config`: it is config object +- `filePath`: absolute path to config file + +**Note:** + +- `rcFile` function return `undefined` if the config file is not found +- `rcFile` throw an Error if the config file content is malformed (causing a parsing error) + +Recommenced usage: + +```js +import { rcFile } from "rc-config-loader" + +function loadRcFile(rcFileName){ + try { + const results = rcFile(rcFileName); + // Not Found + if (!results) { + return {}; + } + return config; + } catch (error) { + // Found it, but it is parsing error + return {} ; // default value + } +} +// load config +const config = loadRcFile("your-application"); +console.log(config); // => rcfile content +``` + +### Example + +```js +"use strict"; +import { rcFile } from "rc-config-loader" +// load .eslintrc from current dir +console.log(rcFile("eslint")); + +// load .eslintrc from specific path +console.log(rcFile("eslint", { + configFileName: `${__dirname}/test/fixtures/.eslintrc` +})); +/* +config: { extends: 'standard', + rules: + { 'comma-dangle': [ 2, 'always-multiline' ], + 'arrow-parens': [ 2, 'as-needed' ] } } +filePath: ${__dirname}/test/fixtures/.eslintrc + */ + +// load property from pacakge.json +console.log(rcFile("rc-config-loader", { + packageJSON: { + fieldName: "directories" + } +})); +/* +config: { test: 'test' } +filePath: /path/to/package.json + */ + +// load .eslintrc from specific dir +console.log(rcFile("eslint", { + cwd: `${__dirname}/test/fixtures` +})); + +// load specific filename from current dir +console.log(rcFile("travis", {configFileName: ".travis"})); +/* +config: { sudo: false, language: 'node_js', node_js: 'stable' } +filePath: /path/to/.travis + */ + +// try to load as .json, .yml, js +console.log(rcFile("bar", { + configFileName: `${__dirname}/test/fixtures/.barrc`, + defaultExtension: [".json", ".yml", ".js"] +})); + +// try to load as foobar, but .foobarrc is not found +console.log(rcFile("foorbar")); // => undefined + +// try to load as .json, but it is not json +// throw SyntaxError +try { + rcFile("unknown", { + // This is not json + configFileName: `${__dirname}/test/fixtures/.unknownrc`, + defaultExtension: ".json" + }) +} catch (error) { + console.log(error); + /* + SyntaxError: Cannot read config file: /test/fixtures/.unknownrc + */ +} +``` + +## Users + +- [textlint](https://github.com/textlint/textlint "textlint") + +## Changelog + +See [Releases page](https://github.com/azu/rc-config-loader/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/azu/rc-config-loader/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu + +## Acknowledgement + +- [zkochan/rcfile: Loads library configuration in all possible ways](https://github.com/zkochan/rcfile "zkochan/rcfile: Loads library configuration in all possible ways") + +**Difference** + +- support multiple `defaultExtension` diff --git a/node_modules/rc-config-loader/package.json b/node_modules/rc-config-loader/package.json new file mode 100644 index 000000000..1085d679b --- /dev/null +++ b/node_modules/rc-config-loader/package.json @@ -0,0 +1,76 @@ +{ + "name": "rc-config-loader", + "version": "3.0.0", + "description": "load config file from .{product}rc.{json,yml,js}", + "keywords": [ + "config", + "configuration", + "json", + "loader", + "rc", + "yaml", + "yml" + ], + "homepage": "https://github.com/azu/rc-config-loader", + "bugs": { + "url": "https://github.com/azu/rc-config-loader/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/azu/rc-config-loader.git" + }, + "license": "MIT", + "author": "azu", + "files": [ + "bin/", + "lib/", + "src/" + ], + "main": "lib/rc-config-loader.js", + "types": "lib/rc-config-loader.d.ts", + "directories": { + "test": "test" + }, + "scripts": { + "build": "cross-env NODE_ENV=production tsc -p .", + "prettier": "prettier --write '**/*.{js,jsx,ts,tsx,css}'", + "prepublish": "npm run --if-present build", + "test": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -p . --watch" + }, + "husky": { + "hooks": { + "post-commit": "git reset", + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{js,jsx,ts,tsx,css}": [ + "prettier --write", + "git add" + ] + }, + "prettier": { + "printWidth": 120, + "tabWidth": 4 + }, + "dependencies": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.1", + "require-from-string": "^2.0.2" + }, + "devDependencies": { + "@types/mocha": "^5.2.7", + "@types/node": "^12.12.5", + "chai": "^4.2.0", + "cross-env": "^6.0.3", + "husky": "^3.0.9", + "lint-staged": "^9.4.2", + "mocha": "^6.2.2", + "prettier": "^1.8.2", + "ts-node": "^8.4.1", + "ts-node-test-register": "^8.0.1", + "typescript": "^3.6.4" + } +} diff --git a/node_modules/rc-config-loader/src/rc-config-loader.ts b/node_modules/rc-config-loader/src/rc-config-loader.ts new file mode 100644 index 000000000..8c49a5d8a --- /dev/null +++ b/node_modules/rc-config-loader/src/rc-config-loader.ts @@ -0,0 +1,228 @@ +// MIT © 2017 azu +// MIT © Zoltan Kochan +// Original https://github.com/zkochan/rcfile +import path from "path"; +import fs from "fs"; + +const debug = require("debug")("rc-config-loader"); +const requireFromString = require("require-from-string"); +const JSON5 = require("json5"); + +const defaultLoaderByExt = { + ".js": loadJSConfigFile, + ".json": loadJSONConfigFile, + ".yaml": loadYAMLConfigFile, + ".yml": loadYAMLConfigFile +}; + +const defaultOptions = { + // does look for `package.json` + packageJSON: false, + // treat default(no ext file) as some extension + defaultExtension: [".json", ".yaml", ".yml", ".js"], + cwd: process.cwd() +}; + +export interface rcConfigLoaderOption { + // does look for `package.json` + packageJSON?: + | boolean + | { + fieldName: string; + }; + // if config file name is not same with packageName, set the name + configFileName?: string; + // treat default(no ext file) as some extension + defaultExtension?: string | string[]; + // where start to load + cwd?: string; +} + +type Loader = (fileName: string, suppress: boolean) => R; + +const selectLoader = (defaultLoaderByExt: { [index: string]: Loader }, extension: string) => { + if (![".json", ".yaml", ".yml", ".js"].includes(extension)) { + throw new Error(`${extension} is not supported.`); + } + return defaultLoaderByExt[extension]; +}; + +/** + * Find and load rcfile, return { config, filePath } + * If not found any rcfile, throw an Error. + * @param {string} pkgName + * @param {rcConfigLoaderOption} [opts] + * @returns {{ config: Object, filePath:string } | undefined} + */ +export function rcFile( + pkgName: string, + opts: rcConfigLoaderOption = {} +): + | { + config: R; + filePath: string; + } + | undefined { + // path/to/config or basename of config file. + const configFileName = opts.configFileName || `.${pkgName}rc`; + const defaultExtension = opts.defaultExtension || defaultOptions.defaultExtension; + const cwd = opts.cwd || defaultOptions.cwd; + const packageJSON = opts.packageJSON || defaultOptions.packageJSON; + const packageJSONFieldName = typeof packageJSON === "object" ? packageJSON.fieldName : pkgName; + + const parts = splitPath(cwd); + const loadersByOrder = Array.isArray(defaultExtension) + ? defaultExtension.map(extension => selectLoader(defaultLoaderByExt, extension)) + : selectLoader(defaultLoaderByExt, defaultExtension); + + const loaderByExt = Object.assign({}, defaultLoaderByExt, { + "": loadersByOrder + }); + return findConfig({ + parts, + loaderByExt, + loadersByOrder, + configFileName, + packageJSON, + packageJSONFieldName + }); +} + +/** + * + * @returns {{ + * config: string, + * filePath: string + * }} + */ +function findConfig({ + parts, + loaderByExt, + loadersByOrder, + configFileName, + packageJSON, + packageJSONFieldName +}: { + parts: string[]; + loaderByExt: { + [index: string]: Loader; + }; + loadersByOrder: Loader | Loader[]; + configFileName: string; + packageJSON: boolean | { fieldName: string }; + packageJSONFieldName: string; +}): + | { + config: R; + filePath: string; + } + | undefined { + const extensions = Object.keys(loaderByExt); + while (extensions.length) { + const ext = extensions.shift(); + // may be ext is "". if it .rc + const configLocation = join(parts, configFileName + ext); + if (!fs.existsSync(configLocation)) { + continue; + } + // if ext === ""(empty string):, use ordered loaders + const loaders = ext ? loaderByExt[ext] : loadersByOrder; + if (!Array.isArray(loaders)) { + const loader = loaders; + const result = loader(configLocation, false); + if (!result) { + continue; + } + return { + config: result, + filePath: configLocation + }; + } + for (let i = 0; i < loaders.length; i++) { + const loader = loaders[i]; + const result = loader(configLocation, true); + if (!result) { + continue; + } + return { + config: result, + filePath: configLocation + }; + } + } + + if (packageJSON) { + const pkgJSONLoc = join(parts, "package.json"); + if (fs.existsSync(pkgJSONLoc)) { + const pkgJSON = require(pkgJSONLoc); + if (pkgJSON[packageJSONFieldName]) { + return { + config: pkgJSON[packageJSONFieldName], + filePath: pkgJSONLoc + }; + } + } + } + if (parts.pop()) { + return findConfig({ parts, loaderByExt, loadersByOrder, configFileName, packageJSON, packageJSONFieldName }); + } + return; +} + +function splitPath(x: string): string[] { + return path.resolve(x || "").split(path.sep); +} + +function join(parts: string[], filename: string) { + return path.resolve(parts.join(path.sep) + path.sep, filename); +} + +function loadJSConfigFile(filePath: string, suppress: boolean) { + debug(`Loading JavaScript config file: ${filePath}`); + try { + const content = fs.readFileSync(filePath, "utf-8"); + return requireFromString(content, filePath); + } catch (error) { + debug(`Error reading JavaScript file: ${filePath}`); + if (!suppress) { + error.message = `Cannot read config file: ${filePath}\nError: ${error.message}`; + throw error; + } + } +} + +function loadJSONConfigFile(filePath: string, suppress: boolean) { + debug(`Loading JSON config file: ${filePath}`); + + try { + return JSON5.parse(readFile(filePath)); + } catch (error) { + debug(`Error reading JSON file: ${filePath}`); + if (!suppress) { + error.message = `Cannot read config file: ${filePath}\nError: ${error.message}`; + throw error; + } + } +} + +function readFile(filePath: string) { + return fs.readFileSync(filePath, "utf8"); +} + +function loadYAMLConfigFile(filePath: string, suppress: boolean) { + debug(`Loading YAML config file: ${filePath}`); + + // lazy load YAML to improve performance when not used + const yaml = require("js-yaml"); + + try { + // empty YAML file can be null, so always use + return yaml.safeLoad(readFile(filePath)) || {}; + } catch (error) { + debug(`Error reading YAML file: ${filePath}`); + if (!suppress) { + error.message = `Cannot read config file: ${filePath}\nError: ${error.message}`; + throw error; + } + } +} diff --git a/node_modules/rc/LICENSE.APACHE2 b/node_modules/rc/LICENSE.APACHE2 new file mode 100644 index 000000000..6366c0471 --- /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 000000000..96bb796aa --- /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 000000000..6eafbd734 --- /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 000000000..e6522e267 --- /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 000000000..8c230c5cd --- /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 000000000..ab05b6072 --- /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 000000000..65eb47afe --- /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/package.json b/node_modules/rc/package.json new file mode 100644 index 000000000..887238fa4 --- /dev/null +++ b/node_modules/rc/package.json @@ -0,0 +1,29 @@ +{ + "name": "rc", + "version": "1.2.8", + "description": "hardwired configuration loader", + "main": "index.js", + "browser": "browser.js", + "scripts": { + "test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/dominictarr/rc.git" + }, + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "keywords": [ + "config", + "rc", + "unix", + "defaults" + ], + "bin": "./cli.js", + "author": "Dominic Tarr (dominictarr.com)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } +} diff --git a/node_modules/rc/test/ini.js b/node_modules/rc/test/ini.js new file mode 100644 index 000000000..e6857f8b3 --- /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 000000000..0ecd17634 --- /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 000000000..4f6335189 --- /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/read-pkg-up/index.js b/node_modules/read-pkg-up/index.js new file mode 100644 index 000000000..26079760f --- /dev/null +++ b/node_modules/read-pkg-up/index.js @@ -0,0 +1,26 @@ +'use strict'; +const findUp = require('find-up'); +const readPkg = require('read-pkg'); + +module.exports = opts => { + return findUp('package.json', opts).then(fp => { + if (!fp) { + return {}; + } + + return readPkg(fp, opts).then(pkg => ({pkg, path: fp})); + }); +}; + +module.exports.sync = opts => { + const fp = findUp.sync('package.json', opts); + + if (!fp) { + return {}; + } + + return { + pkg: readPkg.sync(fp, opts), + path: fp + }; +}; diff --git a/node_modules/read-pkg-up/license b/node_modules/read-pkg-up/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/read-pkg-up/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/read-pkg-up/node_modules/load-json-file/index.js b/node_modules/read-pkg-up/node_modules/load-json-file/index.js new file mode 100644 index 000000000..b2767e302 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/load-json-file/index.js @@ -0,0 +1,11 @@ +'use strict'; +const path = require('path'); +const fs = require('graceful-fs'); +const stripBom = require('strip-bom'); +const parseJson = require('parse-json'); +const pify = require('pify'); + +const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp)); + +module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp)); +module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp); diff --git a/node_modules/read-pkg-up/node_modules/load-json-file/license b/node_modules/read-pkg-up/node_modules/load-json-file/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/load-json-file/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/read-pkg-up/node_modules/load-json-file/package.json b/node_modules/read-pkg-up/node_modules/load-json-file/package.json new file mode 100644 index 000000000..8bfb1c600 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/load-json-file/package.json @@ -0,0 +1,43 @@ +{ + "name": "load-json-file", + "version": "4.0.0", + "description": "Read and parse a JSON file", + "license": "MIT", + "repository": "sindresorhus/load-json-file", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "read", + "json", + "parse", + "file", + "fs", + "graceful", + "load" + ], + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/read-pkg-up/node_modules/load-json-file/readme.md b/node_modules/read-pkg-up/node_modules/load-json-file/readme.md new file mode 100644 index 000000000..3319c266c --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/load-json-file/readme.md @@ -0,0 +1,45 @@ +# load-json-file [![Build Status](https://travis-ci.org/sindresorhus/load-json-file.svg?branch=master)](https://travis-ci.org/sindresorhus/load-json-file) + +> Read and parse a JSON file + +[Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom), uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs), and throws more [helpful JSON errors](https://github.com/sindresorhus/parse-json). + + +## Install + +``` +$ npm install --save load-json-file +``` + + +## Usage + +```js +const loadJsonFile = require('load-json-file'); + +loadJsonFile('foo.json').then(json => { + console.log(json); + //=> {foo: true} +}); +``` + + +## API + +### loadJsonFile(filepath) + +Returns a promise for the parsed JSON. + +### loadJsonFile.sync(filepath) + +Returns the parsed JSON. + + +## Related + +- [write-json-file](https://github.com/sindresorhus/write-json-file) - Stringify and write JSON to a file atomically + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/read-pkg-up/node_modules/parse-json/index.js b/node_modules/read-pkg-up/node_modules/parse-json/index.js new file mode 100644 index 000000000..16f42b4a3 --- /dev/null +++ b/node_modules/read-pkg-up/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/read-pkg-up/node_modules/parse-json/license b/node_modules/read-pkg-up/node_modules/parse-json/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/read-pkg-up/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/read-pkg-up/node_modules/parse-json/package.json b/node_modules/read-pkg-up/node_modules/parse-json/package.json new file mode 100644 index 000000000..7aca6eded --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/parse-json/package.json @@ -0,0 +1,43 @@ +{ + "name": "parse-json", + "version": "4.0.0", + "description": "Parse JSON with more helpful errors", + "license": "MIT", + "repository": "sindresorhus/parse-json", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "files": [ + "index.js", + "vendor" + ], + "keywords": [ + "parse", + "json", + "graceful", + "error", + "message", + "humanize", + "friendly", + "helpful", + "string", + "str" + ], + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "devDependencies": { + "ava": "*", + "nyc": "^11.2.1", + "xo": "*" + } +} diff --git a/node_modules/read-pkg-up/node_modules/parse-json/readme.md b/node_modules/read-pkg-up/node_modules/parse-json/readme.md new file mode 100644 index 000000000..2976e3471 --- /dev/null +++ b/node_modules/read-pkg-up/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/read-pkg-up/node_modules/path-type/index.js b/node_modules/read-pkg-up/node_modules/path-type/index.js new file mode 100644 index 000000000..6e0a1b7b7 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/path-type/index.js @@ -0,0 +1,42 @@ +'use strict'; +const fs = require('fs'); +const pify = require('pify'); + +function type(fn, fn2, fp) { + if (typeof fp !== 'string') { + return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`)); + } + + return pify(fs[fn])(fp) + .then(stats => stats[fn2]()) + .catch(err => { + if (err.code === 'ENOENT') { + return false; + } + + throw err; + }); +} + +function typeSync(fn, fn2, fp) { + if (typeof fp !== 'string') { + throw new TypeError(`Expected a string, got ${typeof fp}`); + } + + try { + return fs[fn](fp)[fn2](); + } catch (err) { + if (err.code === 'ENOENT') { + return false; + } + + throw err; + } +} + +exports.file = type.bind(null, 'stat', 'isFile'); +exports.dir = type.bind(null, 'stat', 'isDirectory'); +exports.symlink = type.bind(null, 'lstat', 'isSymbolicLink'); +exports.fileSync = typeSync.bind(null, 'statSync', 'isFile'); +exports.dirSync = typeSync.bind(null, 'statSync', 'isDirectory'); +exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink'); diff --git a/node_modules/read-pkg-up/node_modules/path-type/license b/node_modules/read-pkg-up/node_modules/path-type/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/path-type/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/read-pkg-up/node_modules/path-type/package.json b/node_modules/read-pkg-up/node_modules/path-type/package.json new file mode 100644 index 000000000..bdcb46e6f --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/path-type/package.json @@ -0,0 +1,45 @@ +{ + "name": "path-type", + "version": "3.0.0", + "description": "Check if a path is a file, directory, or symlink", + "license": "MIT", + "repository": "sindresorhus/path-type", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "fs", + "type", + "is", + "check", + "directory", + "dir", + "file", + "filepath", + "symlink", + "symbolic", + "link", + "stat", + "stats", + "filesystem" + ], + "dependencies": { + "pify": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/read-pkg-up/node_modules/path-type/readme.md b/node_modules/read-pkg-up/node_modules/path-type/readme.md new file mode 100644 index 000000000..ed2af8b98 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/path-type/readme.md @@ -0,0 +1,42 @@ +# path-type [![Build Status](https://travis-ci.org/sindresorhus/path-type.svg?branch=master)](https://travis-ci.org/sindresorhus/path-type) + +> Check if a path is a file, directory, or symlink + + +## Install + +``` +$ npm install path-type +``` + + +## Usage + +```js +const pathType = require('path-type'); + +pathType.file('package.json').then(isFile => { + console.log(isFile); + //=> true +}) +``` + + +## API + +### .file(path) +### .dir(path) +### .symlink(path) + +Returns a `Promise` for a `boolean` of whether the path is the checked type. + +### .fileSync(path) +### .dirSync(path) +### .symlinkSync(path) + +Returns a `boolean` of whether the path is the checked type. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/read-pkg-up/node_modules/pify/index.js b/node_modules/read-pkg-up/node_modules/pify/index.js new file mode 100644 index 000000000..1dee43ad0 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/pify/index.js @@ -0,0 +1,84 @@ +'use strict'; + +const processFn = (fn, opts) => function () { + const P = opts.promiseModule; + const args = new Array(arguments.length); + + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P((resolve, reject) => { + if (opts.errorFirst) { + args.push(function (err, result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + if (err) { + results.unshift(err); + reject(results); + } else { + resolve(results); + } + } else if (err) { + reject(err); + } else { + resolve(result); + } + }); + } else { + args.push(function (result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 0; i < arguments.length; i++) { + results[i] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + } + + fn.apply(this, args); + }); +}; + +module.exports = (obj, opts) => { + opts = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, opts); + + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + let ret; + if (typeof obj === 'function') { + ret = function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, opts).apply(this, arguments); + }; + } else { + ret = Object.create(Object.getPrototypeOf(obj)); + } + + for (const key in obj) { // eslint-disable-line guard-for-in + const x = obj[key]; + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, opts) : x; + } + + return ret; +}; diff --git a/node_modules/read-pkg-up/node_modules/pify/license b/node_modules/read-pkg-up/node_modules/pify/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/pify/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/read-pkg-up/node_modules/pify/package.json b/node_modules/read-pkg-up/node_modules/pify/package.json new file mode 100644 index 000000000..468d85760 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/pify/package.json @@ -0,0 +1,51 @@ +{ + "name": "pify", + "version": "3.0.0", + "description": "Promisify a callback-style function", + "license": "MIT", + "repository": "sindresorhus/pify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava && npm run optimization-test", + "optimization-test": "node --allow-natives-syntax optimization-test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "promises", + "promisify", + "all", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "await", + "es2015", + "bluebird" + ], + "devDependencies": { + "ava": "*", + "pinkie-promise": "^2.0.0", + "v8-natives": "^1.0.0", + "xo": "*" + } +} diff --git a/node_modules/read-pkg-up/node_modules/pify/readme.md b/node_modules/read-pkg-up/node_modules/pify/readme.md new file mode 100644 index 000000000..376ca4e59 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/pify/readme.md @@ -0,0 +1,131 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// Promisify a single function +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// Promisify all methods in a module +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [options]) + +Returns a `Promise` wrapped version of the supplied function or module. + +#### input + +Type: `Function` `Object` + +Callback-style function or module whose methods you want to promisify. + +#### options + +##### multiArgs + +Type: `boolean`
+Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `string[]` `RegExp[]` + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `string[]` `RegExp[]`
+Default: `[/.+(Sync|Stream)$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean`
+Default: `false` + +If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(null, data); + }); +}; + +// Promisify methods but not `fn()` +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + +##### errorFirst + +Type: `boolean`
+Default: `true` + +Whether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc. + +##### promiseModule + +Type: `Function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + + +## Related + +- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/read-pkg-up/node_modules/read-pkg/index.js b/node_modules/read-pkg-up/node_modules/read-pkg/index.js new file mode 100644 index 000000000..dff948b69 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/read-pkg/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const loadJsonFile = require('load-json-file'); +const pathType = require('path-type'); + +module.exports = (fp, opts) => { + if (typeof fp !== 'string') { + opts = fp; + fp = '.'; + } + + opts = opts || {}; + + return pathType.dir(fp) + .then(isDir => { + if (isDir) { + fp = path.join(fp, 'package.json'); + } + + return loadJsonFile(fp); + }) + .then(x => { + if (opts.normalize !== false) { + require('normalize-package-data')(x); + } + + return x; + }); +}; + +module.exports.sync = (fp, opts) => { + if (typeof fp !== 'string') { + opts = fp; + fp = '.'; + } + + opts = opts || {}; + fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp; + + const x = loadJsonFile.sync(fp); + + if (opts.normalize !== false) { + require('normalize-package-data')(x); + } + + return x; +}; diff --git a/node_modules/read-pkg-up/node_modules/read-pkg/license b/node_modules/read-pkg-up/node_modules/read-pkg/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/read-pkg/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/read-pkg-up/node_modules/read-pkg/package.json b/node_modules/read-pkg-up/node_modules/read-pkg/package.json new file mode 100644 index 000000000..1a40fe0ed --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/read-pkg/package.json @@ -0,0 +1,42 @@ +{ + "name": "read-pkg", + "version": "3.0.0", + "description": "Read a package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "pkg", + "package", + "normalize" + ], + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/read-pkg-up/node_modules/read-pkg/readme.md b/node_modules/read-pkg-up/node_modules/read-pkg/readme.md new file mode 100644 index 000000000..687506740 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/read-pkg/readme.md @@ -0,0 +1,79 @@ +# read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg) + +> Read a package.json file + + +## Why + +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + + +## Install + +``` +$ npm install read-pkg +``` + + +## Usage + +```js +const readPkg = require('read-pkg'); + +readPkg().then(pkg => { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); + +readPkg(__dirname).then(pkg => { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); + +readPkg(path.join('unicorn', 'package.json')).then(pkg => { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); +``` + + +## API + +### readPkg([path], [options]) + +Returns a `Promise` for the parsed JSON. + +### readPkg.sync([path], [options]) + +Returns the parsed JSON. + +#### path + +Type: `string`
+Default: `process.cwd()` + +Path to a `package.json` file or its directory. + +#### options + +##### normalize + +Type: `boolean`
+Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + +## Related + +- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file +- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file +- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/read-pkg-up/node_modules/strip-bom/index.js b/node_modules/read-pkg-up/node_modules/strip-bom/index.js new file mode 100644 index 000000000..b00feb9a4 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/strip-bom/index.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = x => { + if (typeof x !== 'string') { + throw new TypeError('Expected a string, got ' + typeof x); + } + + // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string + // conversion translates it to FEFF (UTF-16 BOM) + if (x.charCodeAt(0) === 0xFEFF) { + return x.slice(1); + } + + return x; +}; diff --git a/node_modules/read-pkg-up/node_modules/strip-bom/license b/node_modules/read-pkg-up/node_modules/strip-bom/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/strip-bom/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/read-pkg-up/node_modules/strip-bom/package.json b/node_modules/read-pkg-up/node_modules/strip-bom/package.json new file mode 100644 index 000000000..10f8fdd7e --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/strip-bom/package.json @@ -0,0 +1,40 @@ +{ + "name": "strip-bom", + "version": "3.0.0", + "description": "Strip UTF-8 byte order mark (BOM) from a string", + "license": "MIT", + "repository": "sindresorhus/strip-bom", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "bom", + "byte", + "order", + "mark", + "unicode", + "utf8", + "utf-8", + "remove", + "delete", + "trim", + "text", + "string" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/read-pkg-up/node_modules/strip-bom/readme.md b/node_modules/read-pkg-up/node_modules/strip-bom/readme.md new file mode 100644 index 000000000..812a98071 --- /dev/null +++ b/node_modules/read-pkg-up/node_modules/strip-bom/readme.md @@ -0,0 +1,36 @@ +# strip-bom [![Build Status](https://travis-ci.org/sindresorhus/strip-bom.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-bom) + +> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string + +From Wikipedia: + +> The Unicode Standard permits the BOM in UTF-8, but does not require nor recommend its use. Byte order has no meaning in UTF-8. + + +## Install + +``` +$ npm install --save strip-bom +``` + + +## Usage + +```js +const stripBom = require('strip-bom'); + +stripBom('\uFEFFunicorn'); +//=> 'unicorn' +``` + + +## Related + +- [strip-bom-cli](https://github.com/sindresorhus/strip-bom-cli) - CLI for this module +- [strip-bom-buf](https://github.com/sindresorhus/strip-bom-buf) - Buffer version of this module +- [strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream) - Stream version of this module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/read-pkg-up/package.json b/node_modules/read-pkg-up/package.json new file mode 100644 index 000000000..5126ad07f --- /dev/null +++ b/node_modules/read-pkg-up/package.json @@ -0,0 +1,57 @@ +{ + "name": "read-pkg-up", + "version": "3.0.0", + "description": "Read the closest package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "pkg", + "package", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "search", + "match", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/read-pkg-up/readme.md b/node_modules/read-pkg-up/readme.md new file mode 100644 index 000000000..ecf739311 --- /dev/null +++ b/node_modules/read-pkg-up/readme.md @@ -0,0 +1,80 @@ +# read-pkg-up [![Build Status](https://travis-ci.org/sindresorhus/read-pkg-up.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg-up) + +> Read the closest package.json file + + +## Why + +- [Finds the closest package.json](https://github.com/sindresorhus/find-up) +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + + +## Install + +``` +$ npm install read-pkg-up +``` + + +## Usage + +```js +const readPkgUp = require('read-pkg-up'); + +readPkgUp().then(result => { + console.log(result); + /* + { + pkg: { + name: 'awesome-package', + version: '1.0.0', + … + }, + path: '/Users/sindresorhus/dev/awesome-package/package.json' + } + */ +}); +``` + + +## API + +### readPkgUp([options]) + +Returns a `Promise` for the result object. + +### readPkgUp.sync([options]) + +Returns the result object. + +#### options + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start looking for a package.json file. + +##### normalize + +Type: `boolean`
+Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + +## Related + +- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories +- [pkg-conf](https://github.com/sindresorhus/pkg-conf) - Get namespaced config from the closest package.json + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/read-pkg/index.js b/node_modules/read-pkg/index.js new file mode 100644 index 000000000..c5c3afa8e --- /dev/null +++ b/node_modules/read-pkg/index.js @@ -0,0 +1,48 @@ +'use strict'; +var path = require('path'); +var loadJsonFile = require('load-json-file'); +var normalizePackageData = require('normalize-package-data'); +var pathType = require('path-type'); + +module.exports = function (fp, opts) { + if (typeof fp !== 'string') { + opts = fp; + fp = '.'; + } + + opts = opts || {}; + + return pathType.dir(fp) + .then(function (isDir) { + if (isDir) { + fp = path.join(fp, 'package.json'); + } + + return loadJsonFile(fp); + }) + .then(function (x) { + if (opts.normalize !== false) { + normalizePackageData(x); + } + + return x; + }); +}; + +module.exports.sync = function (fp, opts) { + if (typeof fp !== 'string') { + opts = fp; + fp = '.'; + } + + opts = opts || {}; + fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp; + + var x = loadJsonFile.sync(fp); + + if (opts.normalize !== false) { + normalizePackageData(x); + } + + return x; +}; diff --git a/node_modules/read-pkg/license b/node_modules/read-pkg/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/read-pkg/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/read-pkg/package.json b/node_modules/read-pkg/package.json new file mode 100644 index 000000000..594b0c28b --- /dev/null +++ b/node_modules/read-pkg/package.json @@ -0,0 +1,42 @@ +{ + "name": "read-pkg", + "version": "1.1.0", + "description": "Read a package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "pkg", + "package", + "normalize" + ], + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/read-pkg/readme.md b/node_modules/read-pkg/readme.md new file mode 100644 index 000000000..9a0d4cc45 --- /dev/null +++ b/node_modules/read-pkg/readme.md @@ -0,0 +1,79 @@ +# read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg) + +> Read a package.json file + + +## Why + +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + + +## Install + +``` +$ npm install --save read-pkg +``` + + +## Usage + +```js +var readPkg = require('read-pkg'); + +readPkg().then(function (pkg) { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); + +readPkg(__dirname).then(function (pkg) { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); + +readPkg(path.join('unicorn', 'package.json')).then(function (pkg) { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); +``` + + +## API + +### readPkg([path], [options]) + +Returns a promise that resolves to the parsed JSON. + +### readPkg.sync([path], [options]) + +Returns the parsed JSON. + +#### path + +Type: `string` +Default: `.` + +Path to a `package.json` file or its directory. + +#### options + +##### normalize + +Type: `boolean` +Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + +## Related + +- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file +- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file +- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/readable-stream/.travis.yml b/node_modules/readable-stream/.travis.yml new file mode 100644 index 000000000..f62cdac06 --- /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 000000000..f478d58dc --- /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 000000000..16ffb93f2 --- /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 000000000..2873b3b2e --- /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 000000000..f1c5a9314 --- /dev/null +++ b/node_modules/readable-stream/README.md @@ -0,0 +1,58 @@ +# readable-stream + +***Node-core v8.17.0 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) + + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![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.17.0/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 000000000..83275f192 --- /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 000000000..f8b2db83d --- /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 000000000..46924cbfd --- /dev/null +++ b/node_modules/readable-stream/duplex.js @@ -0,0 +1 @@ +module.exports = require('./readable').Duplex diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json new file mode 100644 index 000000000..514c178e9 --- /dev/null +++ b/node_modules/readable-stream/package.json @@ -0,0 +1,52 @@ +{ + "name": "readable-stream", + "version": "2.3.8", + "description": "Streams3, a user-land copy of the stream library from Node.js", + "main": "readable.js", + "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" + }, + "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" + }, + "scripts": { + "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js", + "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" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "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" + }, + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "license": "MIT" +} diff --git a/node_modules/readable-stream/passthrough.js b/node_modules/readable-stream/passthrough.js new file mode 100644 index 000000000..ffd791d7f --- /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 000000000..e50372592 --- /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 000000000..ec89ec533 --- /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 000000000..b1baba26d --- /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 000000000..ebdde6a85 --- /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 000000000..3211a6f80 --- /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/reflect.getprototypeof/.eslintrc b/node_modules/reflect.getprototypeof/.eslintrc new file mode 100644 index 000000000..48be5f33a --- /dev/null +++ b/node_modules/reflect.getprototypeof/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "max-statements": [2, 25], + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + "IsCallable", + "Type", + ], + }], + }, +} diff --git a/node_modules/reflect.getprototypeof/.nycrc b/node_modules/reflect.getprototypeof/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/reflect.getprototypeof/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/reflect.getprototypeof/CHANGELOG.md b/node_modules/reflect.getprototypeof/CHANGELOG.md new file mode 100644 index 000000000..02a4353bc --- /dev/null +++ b/node_modules/reflect.getprototypeof/CHANGELOG.md @@ -0,0 +1,115 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.10](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.9...v1.0.10) - 2025-01-02 + +### Commits + +- [Refactor] use `es-object-atoms` and `get-proto` directly [`2c55da0`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/2c55da02fb56d9ce7a19e505f487dfb088256d24) +- [Refactor] use `isObject` helper instead of `Type` [`e4c24a4`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/e4c24a4cc1b9928da3eb1f0a032703235d32855e) +- [Deps] update `es-abstract`, `get-intrinsic` [`54005fb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/54005fb9df56fb399e0c526600cb7799d23ef64f) +- [Deps] update `es-abstract` [`e71b3b7`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/e71b3b75847d4af71e42ff049bd2b4d55f0324fc) + +## [v1.0.9](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.8...v1.0.9) - 2024-12-18 + +### Commits + +- [Fix] avoid a crash with node `--disable-proto=throw` flag [`73f449d`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/73f449dff08fe574a4cd937d7265aceb1774de05) +- [Deps] update `dunder-proto`, `es-abstract`, `get-intrinsic`, `which-builtin-type` [`80c8227`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/80c8227aac6cef446ac8460f8bbdd9a83bd1d131) + +## [v1.0.8](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.7...v1.0.8) - 2024-12-06 + +### Commits + +- [Refactor] share the getDunderProto helper [`f4be71b`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/f4be71b2941f217311210a00d84d8338b4880e2a) +- [Refactor] extract helper to `dunder-proto` [`51dcd35`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/51dcd3547ef9808c9fee7aa4a638d3d5d93db70c) +- [Deps] update `call-bind` [`c06e8d3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/c06e8d3c1c9b567ca5bd6bb8542ae2e342f276ff) +- [Deps] update `gopd` [`c951a70`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/c951a709d5483fecc4041287a676d881295d1940) +- [Deps] update `gopd` [`8bd7b85`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/8bd7b8524aacc0574c979e3fe4f82adc51b03f3f) +- [Deps] update `which-builtin-type` [`f46f624`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/f46f62423c1c452063f73d34a363c127410742b2) + +## [v1.0.7](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.6...v1.0.7) - 2024-11-23 + +### Commits + +- [Fix] cache `Object.prototype[__proto__]` getter [`68acea1`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/68acea171951197f83bb107af9e186ce68a5a78f) +- [Tests] remove unused test file [`055596a`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/055596aa2e050e08d35f8f19aa642e9b61a54f7f) +- [actions] split out node 10-20, and 20+ [`99a57c2`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/99a57c2551d11de70ea90b934e02b04ff3cec6c0) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`fe4bb92`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/fe4bb92a4d629e629f42f76567d837f8f17643a4) +- [Deps] update `es-abstract`, `globalthis`, `which-builtin-type` [`867aeb3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/867aeb3c434ee03fd819da09d23a32a2c71290dc) +- [Tests] replace `aud` with `npm audit` [`5129c11`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/5129c112e18e3475afe42a836ac5d4d7ddfcfc18) +- [Deps] remove unused dep; add missing dev dep [`23cf537`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/23cf537aeac98bf27a8d39e24048e1c9fa4df7a7) +- [Dev Deps] add missing peer dep [`18862fa`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/18862fa57d2aa86825998db935ac6ffe23dec113) + +## [v1.0.6](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.5...v1.0.6) - 2024-03-16 + +### Commits + +- [meta] remove useless ESM [`cc16ab1`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/cc16ab1f3b050c9465b41fbbf79e284e8e9084ff) +- [Deps] update `call-bind`, `es-abstract`, `es-errors`, `get-intrinsic` [`ece7445`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/ece7445f03d148c67f5fc91ea455a05731b54cea) +- [Dev Deps] update `tape` [`a894b62`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/a894b624c16247cbb76a00e76a39e3d44ac5bccf) + +## [v1.0.5](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.4...v1.0.5) - 2024-02-04 + +### Commits + +- [Refactor] use `es-errors` where possible, so things that only need those do not need `get-intrinsic` [`08735cb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/08735cba1dfeabae4e362b61e6de36843a472d22) +- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `get-intrinsic` [`b5700ec`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/b5700eca8af88bbc693b304567d6124d13c03827) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`f80fcbb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/f80fcbb140661c07aa2a94547ffae0a5a8f937ac) + +## [v1.0.4](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.3...v1.0.4) - 2023-08-30 + +### Commits + +- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`325044f`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/325044f152c87f18344ba558b5967e69298a5dd2) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`56b9555`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/56b9555a536207493c4e2c17f1fee2390535a659) + +## [v1.0.3](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.2...v1.0.3) - 2022-11-07 + +### Commits + +- [actions] reuse common workflows [`0a76d97`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/0a76d972c13cd319504d3eecf8e7e00e39327c88) +- [meta] use `npmignore` to autogenerate an npmignore file [`c4861b4`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/c4861b45aeebddd1d998bdd44438b29e4bf974e8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`e5352ab`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/e5352ab099f7104c085ffd2ee8fbfec69546fa2c) +- [actions] update codecov uploader [`dbcedf8`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/dbcedf83e967e17316fc98fb18011c603bb54823) +- [Deps] update `define-properties`, `es-abstract`, `globalthis`, `which-builtin-type` [`84fbfab`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/84fbfabe53774587be4748df303cec8acded7c0f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`75dc8a3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/75dc8a337f11f11a947241c968bb7f5b843a1d17) +- [actions] update rebase action to use reusable workflow [`49463a7`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/49463a7a6d9aaa08c201ff4206efcade7a997175) +- [Dev Deps] update `@es-shims/api` [`adf75cb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/adf75cb9dbda9052437a8e48e33da28dc52aa63c) + +## [v1.0.2](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.1...v1.0.2) - 2021-10-03 + +### Commits + +- [Deps] update `es-abstract` [`947bbb1`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/947bbb1bff0cc08ab80bb809a19771c6087e9fda) +- [actions] update workflows` [`af4708d`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/af4708d75212ee5781b549b1ff86f903fc659e3f) + +## [v1.0.1](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.0...v1.0.1) - 2021-09-08 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`86f4aa3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/86f4aa392c73220ecb561d644def5c3efab4f9f5) +- [Refactor] remove unnecessary ESM files [`162e4bf`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/162e4bfb58fb4eba6f2f26f11b0f46a8ea6587a7) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`5515a8d`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/5515a8d17fc1978792db7e57a79f7f2fa60dc55e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`db05b43`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/db05b43dff616acab04544ab04bd385d462b8572) +- [readme] add github actions/codecov badges [`d9ea295`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/d9ea295264f1d415b5083b3d4116b14a5a8ee7ff) +- [Deps] update `es-abstract`, `which-builtin-type` [`1753dee`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/1753deeaadbd66bb65e140e4bc81cee6652f07cd) +- [Dev Deps] update `eslint`, `tape` [`4bce2db`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/4bce2db34c4182edd0bf3610eaeb1ea42844ee15) +- [Deps] update `es-abstract`, `get-intrinsic` [`1dca685`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/1dca685d1e5305b6720882ac8f4d5038a8309431) +- [meta] use `prepublishOnly` script for npm 7+ [`1108273`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/1108273eba643ac8b135d177c21dd371ccb32901) +- [actions] update workflows [`8674d66`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/8674d662705675531d216bdba2b7e1e26be1b12b) +- [Deps] update `es-abstract` [`4e4fdcf`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/4e4fdcf854f3cd71d71aa80723664f5d2b814dad) + +## v1.0.0 - 2021-01-12 + +### Commits + +- es-shims initial commit [`ffd0b98`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/ffd0b980b47f0b2db6bc3373364e950f6fce33cb) +- Initial commit [`64c868f`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/64c868fa1bb3630f4ab823aaba98d0f28b3f8078) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`6a006b4`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/6a006b4ddebfe68fd23b2870c83aadefecf80b04) +- [meta] Only apps should have lockfiles [`d1a29b5`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/d1a29b5b37d31129ecc1fecac1922d4c4935f9fa) +- [Deps] update `call-bind` [`bfcc1a0`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/bfcc1a0bd04fffe5fe53e791dd40f7988bbd5d03) diff --git a/node_modules/reflect.getprototypeof/LICENSE b/node_modules/reflect.getprototypeof/LICENSE new file mode 100644 index 000000000..40680dc46 --- /dev/null +++ b/node_modules/reflect.getprototypeof/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 ECMAScript Shims + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/reflect.getprototypeof/README.md b/node_modules/reflect.getprototypeof/README.md new file mode 100644 index 000000000..f19646810 --- /dev/null +++ b/node_modules/reflect.getprototypeof/README.md @@ -0,0 +1,77 @@ +# reflect.getprototypeof [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES2015 mostly-spec-compliant `Reflect.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible - specifically, anything with `__proto__` support, or ES6. Built-in types will also work correctly in older engines. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/5.1/). + +## Example + +```js +var getPrototypeOf = require('reflect.getprototypeof'); +var assert = require('assert'); + +assert.throws(() => getPrototypeOf(true)); +assert.throws(() => getPrototypeOf(42)); +assert.throws(() => getPrototypeOf('')); +assert.equal(getPrototypeOf(/a/g), RegExp.prototype); +assert.equal(getPrototypeOf(new Date()), Date.prototype); +assert.equal(getPrototypeOf(function () {}), Function.prototype); +assert.equal(getPrototypeOf([]), Array.prototype); +assert.equal(getPrototypeOf({}), Object.prototype); +``` + +```js +var getPrototypeOf = require('reflect.getprototypeof'); +var assert = require('assert'); +/* when Reflect or Reflect.getPrototypeOf is not present */ +if (typeof Reflect === 'object') { delete Reflect.getPrototypeOf; } +delete globalThis.Reflect; +var shimmed = getPrototypeOf.shim(); +assert.equal(shimmed, getPrototypeOf.getPolyfill()); + +assert.throws(() => Reflect.getPrototypeOf(true)); +assert.throws(() => Reflect.getPrototypeOf(42)); +assert.throws(() => Reflect.getPrototypeOf('')); +assert.equal(Reflect.getPrototypeOf(/a/g), RegExp.prototype); +assert.equal(Reflect.getPrototypeOf(new Date()), Date.prototype); +assert.equal(Reflect.getPrototypeOf(function () {}), Function.prototype); +assert.equal(Reflect.getPrototypeOf([]), Array.prototype); +assert.equal(Reflect.getPrototypeOf({}), Object.prototype); +``` + +```js +var getPrototypeOf = require('reflect.getprototypeof'); +var assert = require('assert'); +/* when Reflect.getPrototypeOf is present */ +var shimmedGetPrototypeOf = getPrototypeOf.shim(); +assert.equal(shimmedGetPrototypeOf, Reflect.getPrototypeOf); +assert.equal(Reflect.getPrototypeOf([]), Array.prototype); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/reflect.getprototypeof +[npm-version-svg]: https://versionbadg.es/es-shims/Reflect.getPrototypeOf.svg +[deps-svg]: https://david-dm.org/es-shims/Reflect.getPrototypeOf.svg +[deps-url]: https://david-dm.org/es-shims/Reflect.getPrototypeOf +[dev-deps-svg]: https://david-dm.org/es-shims/Reflect.getPrototypeOf/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/Reflect.getPrototypeOf#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/reflect.getprototypeof.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/reflect.getprototypeof.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/reflect.getprototypeof.svg +[downloads-url]: https://npm-stat.com/charts.html?package=reflect.getprototypeof +[codecov-image]: https://codecov.io/gh/es-shims/Reflect.getPrototypeOf/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/Reflect.getPrototypeOf/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Reflect.getPrototypeOf +[actions-url]: https://github.com/es-shims/Reflect.getPrototypeOf/actions diff --git a/node_modules/reflect.getprototypeof/auto.js b/node_modules/reflect.getprototypeof/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/reflect.getprototypeof/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/reflect.getprototypeof/implementation.js b/node_modules/reflect.getprototypeof/implementation.js new file mode 100644 index 000000000..a971fc0ed --- /dev/null +++ b/node_modules/reflect.getprototypeof/implementation.js @@ -0,0 +1,40 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var IsCallable = require('es-abstract/2024/IsCallable'); +var isObject = require('es-abstract/helpers/isObject'); +var whichBuiltinType = require('which-builtin-type'); +var $TypeError = require('es-errors/type'); + +var gPO = require('get-proto'); +var $Object = require('es-object-atoms'); + +module.exports = function getPrototypeOf(O) { + if (!isObject(O)) { + throw new $TypeError('Reflect.getPrototypeOf called on non-object'); + } + + if (gPO) { + return gPO(O); + } + + var type = whichBuiltinType(O); + if (type) { + var intrinsic = GetIntrinsic('%' + type + '.prototype%', true); + if (intrinsic) { + return intrinsic; + } + } + if (IsCallable(O.constructor)) { + return O.constructor.prototype; + } + if (O instanceof Object) { + return $Object.prototype; + } + + /* + * Correctly return null for Objects created with `Object.create(null)` (shammed or native) or `{ __proto__: null}`. Also returns null for + * cross-realm objects on browsers that lack `__proto__` support (like IE <11), but that's the best we can do. + */ + return null; +}; diff --git a/node_modules/reflect.getprototypeof/index.js b/node_modules/reflect.getprototypeof/index.js new file mode 100644 index 000000000..21d0a7b87 --- /dev/null +++ b/node_modules/reflect.getprototypeof/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var callBind = require('call-bind'); +var define = require('define-properties'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill(), typeof Reflect === 'object' ? Reflect : Object); + +define(bound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = bound; diff --git a/node_modules/reflect.getprototypeof/package.json b/node_modules/reflect.getprototypeof/package.json new file mode 100644 index 000000000..0e186a006 --- /dev/null +++ b/node_modules/reflect.getprototypeof/package.json @@ -0,0 +1,98 @@ +{ + "name": "reflect.getprototypeof", + "version": "1.0.10", + "description": "An ES2015 mostly-spec-compliant `Reflect.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible", + "main": "index.js", + "type": "commonjs", + "exports": { + ".": "./index.js", + "./auto": "./auto.js", + "./polyfill": "./polyfill.js", + "./implementation": "./implementation.js", + "./shim": "./shim.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/es-shims/Reflect.getPrototypeOf.git" + }, + "keywords": [ + "Reflect.getPrototypeOf", + "Object.getPrototypeOf", + "proto", + "__proto__", + "[[Prototype]]", + "getPrototypeOf", + "ES5", + "shim", + "polyfill", + "es-shim API", + "browser" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/es-shims/Reflect.getPrototypeOf/issues" + }, + "homepage": "https://github.com/es-shims/Reflect.getPrototypeOf", + "engines": { + "node": ">= 0.4" + }, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "functions-have-names": "^1.2.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "testling": { + "files": "test/implementation.js" + } +} diff --git a/node_modules/reflect.getprototypeof/polyfill.js b/node_modules/reflect.getprototypeof/polyfill.js new file mode 100644 index 000000000..0c317e148 --- /dev/null +++ b/node_modules/reflect.getprototypeof/polyfill.js @@ -0,0 +1,14 @@ +'use strict'; + +var implementation = require('./implementation'); + +var getProto = require('get-proto'); + +module.exports = function getPolyfill() { + if (typeof Reflect === 'object' && Reflect && Reflect.getPrototypeOf) { + return Reflect.getPrototypeOf; + } + return getProto + ? function getPrototypeOf(O) { return getProto(O); } + : implementation; +}; diff --git a/node_modules/reflect.getprototypeof/shim.js b/node_modules/reflect.getprototypeof/shim.js new file mode 100644 index 000000000..1724eb2c0 --- /dev/null +++ b/node_modules/reflect.getprototypeof/shim.js @@ -0,0 +1,21 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimGetPrototypeOf() { + define( + global, + { Reflect: {} }, + { Reflect: function () { return typeof Reflect !== 'object' || !Reflect; } } + ); + + var polyfill = getPolyfill(); + define( + Reflect, + { getPrototypeOf: polyfill }, + { getPrototypeOf: function () { return Reflect.getPrototypeOf !== polyfill; } } + ); + + return polyfill; +}; diff --git a/node_modules/reflect.getprototypeof/test/implementation.js b/node_modules/reflect.getprototypeof/test/implementation.js new file mode 100644 index 000000000..8992d3d3b --- /dev/null +++ b/node_modules/reflect.getprototypeof/test/implementation.js @@ -0,0 +1,11 @@ +'use strict'; + +var getPrototypeOf = require('../implementation'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + runTests(getPrototypeOf, t); + + t.end(); +}); diff --git a/node_modules/reflect.getprototypeof/test/index.js b/node_modules/reflect.getprototypeof/test/index.js new file mode 100644 index 000000000..0492e7d63 --- /dev/null +++ b/node_modules/reflect.getprototypeof/test/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var getPrototypeOf = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + runTests(getPrototypeOf, t); + + t.end(); +}); diff --git a/node_modules/reflect.getprototypeof/test/shimmed.js b/node_modules/reflect.getprototypeof/test/shimmed.js new file mode 100644 index 000000000..c3de97e29 --- /dev/null +++ b/node_modules/reflect.getprototypeof/test/shimmed.js @@ -0,0 +1,28 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); + +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.equal(Reflect.getPrototypeOf.length, 1, 'Reflect.getPrototypeOf has length of 1'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Reflect.getPrototypeOf.name, 'getPrototypeOf', 'Reflect.getPrototypeOf has name "getPrototypeOf"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Reflect, 'getPrototypeOf'), 'Reflect.getPrototypeOf is not enumerable'); + et.end(); + }); + + runTests(Reflect.getPrototypeOf, t); + + t.end(); +}); diff --git a/node_modules/reflect.getprototypeof/test/tests.js b/node_modules/reflect.getprototypeof/test/tests.js new file mode 100644 index 000000000..508d923ed --- /dev/null +++ b/node_modules/reflect.getprototypeof/test/tests.js @@ -0,0 +1,33 @@ +'use strict'; + +module.exports = function (getPrototypeOf, t) { + t.test('nullish value', function (st) { + st['throws'](function () { return getPrototypeOf(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return getPrototypeOf(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + t['throws'](function () { getPrototypeOf(true); }, 'throws for true'); + t['throws'](function () { getPrototypeOf(false); }, 'throws for false'); + t['throws'](function () { getPrototypeOf(42); }, 'throws for 42'); + t['throws'](function () { getPrototypeOf(NaN); }, 'throws for NaN'); + t['throws'](function () { getPrototypeOf(0); }, 'throws for +0'); + t['throws'](function () { getPrototypeOf(-0); }, 'throws for -0'); + t['throws'](function () { getPrototypeOf(Infinity); }, 'throws for ∞'); + t['throws'](function () { getPrototypeOf(-Infinity); }, 'throws for -∞'); + t['throws'](function () { getPrototypeOf(''); }, 'throws for empty string'); + t['throws'](function () { getPrototypeOf('foo'); }, 'throws for non-empty string'); + t.equal(getPrototypeOf(/a/g), RegExp.prototype); + t.equal(getPrototypeOf(new Date()), Date.prototype); + t.equal(getPrototypeOf(function () {}), Function.prototype); + t.equal(getPrototypeOf([]), Array.prototype); + t.equal(getPrototypeOf({}), Object.prototype); + + var obj = { __proto__: null }; + if ('toString' in obj) { + t.comment('no null objects in this engine'); + t.equal(getPrototypeOf(obj), Object.prototype, '"null" object has Object.prototype as [[Prototype]]'); + } else { + t.equal(getPrototypeOf(obj), null, 'null object has null [[Prototype]]'); + } +}; diff --git a/node_modules/regex-not/LICENSE b/node_modules/regex-not/LICENSE new file mode 100644 index 000000000..8ee09d911 --- /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 000000000..24d00e7de --- /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 000000000..02bfed4a8 --- /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 000000000..0320d5324 --- /dev/null +++ b/node_modules/regex-not/package.json @@ -0,0 +1,63 @@ +{ + "name": "regex-not", + "description": "Create a javascript regular expression for matching everything except for the given string.", + "version": "1.0.2", + "homepage": "https://github.com/jonschlinkert/regex-not", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/regex-not", + "bugs": { + "url": "https://github.com/jonschlinkert/regex-not/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "keywords": [ + "exec", + "match", + "negate", + "negation", + "not", + "regex", + "regular expression", + "test" + ], + "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 + } + } +} diff --git a/node_modules/regexp.prototype.flags/.editorconfig b/node_modules/regexp.prototype.flags/.editorconfig new file mode 100644 index 000000000..eaa214161 --- /dev/null +++ b/node_modules/regexp.prototype.flags/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/regexp.prototype.flags/.eslintrc b/node_modules/regexp.prototype.flags/.eslintrc new file mode 100644 index 000000000..fb009abae --- /dev/null +++ b/node_modules/regexp.prototype.flags/.eslintrc @@ -0,0 +1,20 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "eqeqeq": [2, "allow-null"], + "id-length": 0, + "no-invalid-this": "off", + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + }, + }, + ], +} diff --git a/node_modules/regexp.prototype.flags/.nycrc b/node_modules/regexp.prototype.flags/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/regexp.prototype.flags/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/regexp.prototype.flags/CHANGELOG.md b/node_modules/regexp.prototype.flags/CHANGELOG.md new file mode 100644 index 000000000..bf84c26b7 --- /dev/null +++ b/node_modules/regexp.prototype.flags/CHANGELOG.md @@ -0,0 +1,249 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.5.4](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.5.3...v1.5.4) - 2025-01-02 + +### Commits + +- [Refactor] use `get-proto` and `es-errors` [`6355772`](https://github.com/es-shims/RegExp.prototype.flags/commit/6355772344db0465e11c58e387f968de0cf4e4fa) +- [Deps] update `call-bind` [`c630183`](https://github.com/es-shims/RegExp.prototype.flags/commit/c6301838b07f3e71b3dc1d5b2cfa88f88b9f6a6d) +- [Dev Deps] update `object-inspect` [`c0201af`](https://github.com/es-shims/RegExp.prototype.flags/commit/c0201af97cb849947d5246fa7d9f9a8ea5bc5b36) + +## [v1.5.3](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.5.2...v1.5.3) - 2024-10-03 + +### Fixed + +- [Fix] avoid unnecessary polyfill [`#31`](https://github.com/es-shims/RegExp.prototype.flags/issues/31) + +### Commits + +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`9e8bc20`](https://github.com/es-shims/RegExp.prototype.flags/commit/9e8bc20868a6366c08cfa9f37648573b8bcab449) +- [Dev Deps] update `@es-shims/api`, `auto-changelog`, `es-value-fixtures`, `tape` [`c32be8e`](https://github.com/es-shims/RegExp.prototype.flags/commit/c32be8e8bb8b6726376ba82d27a31087b4847444) +- [readme] fix typos [`195c32e`](https://github.com/es-shims/RegExp.prototype.flags/commit/195c32e7f48d09b12428442aaaa5a28a72d56287) +- [Deps] update `call-bind`, `set-function-name` [`207517f`](https://github.com/es-shims/RegExp.prototype.flags/commit/207517f62aa8f6a9c721c6d484c2c7f5a386864a) +- [Dev Deps] update `available-regexp-flags`, `tape` [`b3854f7`](https://github.com/es-shims/RegExp.prototype.flags/commit/b3854f70afa7a5da8c0f4cac40bb8ad8df71d297) +- [Tests] replace `aud` with `npm audit` [`d3ee951`](https://github.com/es-shims/RegExp.prototype.flags/commit/d3ee951c0760b3f9f01e5a953dfef92c8d6fcfb4) +- [Dev Deps] update `hasown` [`9e407c4`](https://github.com/es-shims/RegExp.prototype.flags/commit/9e407c41cd8db52b1fd602ae3117b3cd3e1beecc) +- [Dev Deps] add missing peer dep [`0199bfd`](https://github.com/es-shims/RegExp.prototype.flags/commit/0199bfd69dd140bdee743d6a874d758349aaaaaa) + +## [v1.5.2](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.5.1...v1.5.2) - 2024-02-11 + +### Commits + +- [Tests] increase coverage [`c692c88`](https://github.com/es-shims/RegExp.prototype.flags/commit/c692c88e073f6d17fc5b6b1c740ef1ecb433eb4b) +- [Dev Deps] use `hasown` instead of `has` [`fb5b350`](https://github.com/es-shims/RegExp.prototype.flags/commit/fb5b350122507e4bec68fb417a46f07d062caf77) +- [Dev Deps] update `aud`, `hasown`, `npmignore`, `tape` [`fd0ddd9`](https://github.com/es-shims/RegExp.prototype.flags/commit/fd0ddd9c837c0a8066de37a41eb4f83310f15a57) +- [Deps] update `call-bind`, `define-properties`, `set-function-name` [`ca53f66`](https://github.com/es-shims/RegExp.prototype.flags/commit/ca53f662549b2fbff61323a6d2aa9af15a6c836b) +- [Dev Deps] update `object-inspect`, `tape` [`4491680`](https://github.com/es-shims/RegExp.prototype.flags/commit/449168010d4d63a2cd854dcec9f37efacda19082) +- [Refactor] use `es-errors` [`1d03d22`](https://github.com/es-shims/RegExp.prototype.flags/commit/1d03d225327008aeb6b4b501a4720318d717621e) +- [Fix] properly check for a non-object receiver [`024d442`](https://github.com/es-shims/RegExp.prototype.flags/commit/024d4421edd8922f9acbac35afcfe69a8a3db6a9) +- [Deps] update `call-bind` [`f222ce0`](https://github.com/es-shims/RegExp.prototype.flags/commit/f222ce0925a7431d1d3dd113d803746f07e1175d) + +## [v1.5.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.5.0...v1.5.1) - 2023-09-12 + +### Commits + +- [Refactor] use `set-function-name` [`1384147`](https://github.com/es-shims/RegExp.prototype.flags/commit/13841474baf5700de8e3f65fae3670ad1b233483) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `available-regexp-flags`, `tape` [`07bf9a2`](https://github.com/es-shims/RegExp.prototype.flags/commit/07bf9a2c354cc41379b01fe5c383233adaaccf0e) +- [Dev Deps] add missing `npmignore` dep [`8ca9dfe`](https://github.com/es-shims/RegExp.prototype.flags/commit/8ca9dfe4da31ef74ee48a4dcf62692eebb8f8fdd) + +## [v1.5.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.3...v1.5.0) - 2023-04-18 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`f7438ad`](https://github.com/es-shims/RegExp.prototype.flags/commit/f7438ad3728128b99daaeb1d3133a40d906d3621) +- [New] add `unicodeSets`/`v` flag [`f922170`](https://github.com/es-shims/RegExp.prototype.flags/commit/f92217039c9c86a61421ce69594e93a546721397) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `available-regexp-flags`, `object-inspect`, `tape` [`1203078`](https://github.com/es-shims/RegExp.prototype.flags/commit/12030785e6beb1f06c406a4731714012d93867e2) +- [actions] update rebase action to use reusable workflow [`c562ea2`](https://github.com/es-shims/RegExp.prototype.flags/commit/c562ea20c27442ff30ce65091a313b5e49ae8515) +- [Dev Deps] update `aud`, `object-inspect`, `tape` [`f3ae811`](https://github.com/es-shims/RegExp.prototype.flags/commit/f3ae81109dd08b200dce8bd52c183bc44662c3b4) +- [Deps] update `define-properties`, `functions-have-names` [`2d0476e`](https://github.com/es-shims/RegExp.prototype.flags/commit/2d0476e5eba1e4a9b786f169f3be96c2f5a192b2) +- [Tests] use `for-each` instead of `foreach` [`d9f30da`](https://github.com/es-shims/RegExp.prototype.flags/commit/d9f30dab65ff0185a8688c6e62dc1fe650879cc0) +- [Deps] update `define-properties` [`81c1c20`](https://github.com/es-shims/RegExp.prototype.flags/commit/81c1c2012070c1f4480a9ab55bc0cff206152603) + +## [v1.4.3](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.2...v1.4.3) - 2022-04-14 + +### Commits + +- [Fix] when shimmed, name must be `get flags` [`fcefd00`](https://github.com/es-shims/RegExp.prototype.flags/commit/fcefd0039177e9cbcb2ed842d353131ace7a3377) + +## [v1.4.2](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.1...v1.4.2) - 2022-04-12 + +### Commits + +- [Fix] ensure `hasIndices` is patched properly, and getter order is correct [`a1af45a`](https://github.com/es-shims/RegExp.prototype.flags/commit/a1af45a8a6f7305b097b83f96ee9fc45abb3e733) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`24f5a0c`](https://github.com/es-shims/RegExp.prototype.flags/commit/24f5a0c84f2e7d263ae0e2008def870afd6d5a4f) + +## [v1.4.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.0...v1.4.1) - 2022-01-13 + +### Commits + +- [Fix] `polyfill`: do not throw in a descriptorless environment [`e2d24e7`](https://github.com/es-shims/RegExp.prototype.flags/commit/e2d24e707a44d958a0b6d3a114effb2f2b475337) + +## [v1.4.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.3.2...v1.4.0) - 2022-01-13 + +### Commits + +- [Tests] use `available-regexp-flags` [`95af246`](https://github.com/es-shims/RegExp.prototype.flags/commit/95af2463f1373282087528f8566e20ffae26c3db) +- [New] add `hasIndices`/`d` flag [`89959ca`](https://github.com/es-shims/RegExp.prototype.flags/commit/89959ca1128ea48dcd0ec1416355264425fa3bc5) + +## [v1.3.2](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.3.1...v1.3.2) - 2022-01-13 + +### Commits + +- [actions] reuse common workflows [`6665b5d`](https://github.com/es-shims/RegExp.prototype.flags/commit/6665b5db7c45ce6b987d08ebaf6d2767eec95b94) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`babce94`](https://github.com/es-shims/RegExp.prototype.flags/commit/babce94b5ca96e93e74e384c0a01295943677a3f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `object-inspect`, `safe-publish-latest`, `tape` [`52132d9`](https://github.com/es-shims/RegExp.prototype.flags/commit/52132d9f3df904864d4cf3fd44892ee563aee524) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c16687c`](https://github.com/es-shims/RegExp.prototype.flags/commit/c16687c118d374d8997a8d885467507bf943b4bc) +- [actions] update codecov uploader [`0a3c904`](https://github.com/es-shims/RegExp.prototype.flags/commit/0a3c904a9fd1247b3b8e0fb6b451b3fbe97735bd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`3fce7f2`](https://github.com/es-shims/RegExp.prototype.flags/commit/3fce7f27c753440003675d03ae9a7ecfa6a74d30) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`75ca498`](https://github.com/es-shims/RegExp.prototype.flags/commit/75ca49889349fc42e51ea79b2ec7a1996fb3eb18) +- [actions] update workflows [`300f321`](https://github.com/es-shims/RegExp.prototype.flags/commit/300f321984526066656bec791f0bb3861b33cfbc) +- [meta] better `eccheck` command [`5f735ab`](https://github.com/es-shims/RegExp.prototype.flags/commit/5f735ab1b1c87dbd05c0096249160587f166cd51) +- [Dev Deps] update `eslint`, `tape` [`3059637`](https://github.com/es-shims/RegExp.prototype.flags/commit/3059637210eb5c9fa97160ec2f0aea1d1d724eb7) +- [actions] update workflows` [`dbd8ab4`](https://github.com/es-shims/RegExp.prototype.flags/commit/dbd8ab49fa2196dd74791107825c43e4481cdfd2) +- [meta] use `prepublishOnly` script for npm 7+ [`5cc8652`](https://github.com/es-shims/RegExp.prototype.flags/commit/5cc86524a41bf358b6701bcf46e480f0e3e470b4) +- [Fix] use polyfill, not implementation, in main export [`15ab4b8`](https://github.com/es-shims/RegExp.prototype.flags/commit/15ab4b85f3904e48664e26394dc12765ed666da4) +- [meta] remove `audit-level` config, which breaks npm 7 installs [`1cb98ae`](https://github.com/es-shims/RegExp.prototype.flags/commit/1cb98aed731e73d11df5ed3b853b371d35a69f5a) + +## [v1.3.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.3.0...v1.3.1) - 2021-01-15 + +### Commits + +- [Tests] run `nyc` on all tests; use `tape` runner; add full es-shims test suite [`047a1e8`](https://github.com/es-shims/RegExp.prototype.flags/commit/047a1e8ff250220254b0e9598d962a56c8ec3ffc) +- [Tests] migrate tests to Github Actions [`e4e391f`](https://github.com/es-shims/RegExp.prototype.flags/commit/e4e391fd3e6f057172994ad0c33ca128568c0b06) +- [meta] use `auto-changelog` for changelog [`afbcd06`](https://github.com/es-shims/RegExp.prototype.flags/commit/afbcd06402e97e975af797e2c1375e35e22e90f2) +- [actions] add Require Allow Edits workflow [`0db5d50`](https://github.com/es-shims/RegExp.prototype.flags/commit/0db5d50cdf59e3e5529024af4f8ce05829edc06d) +- [meta] do not publish github action workflow files [`53f2902`](https://github.com/es-shims/RegExp.prototype.flags/commit/53f29020e5a1f517e91b8cf226ed6bc97eadc090) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `aud` [`05f2a85`](https://github.com/es-shims/RegExp.prototype.flags/commit/05f2a851869069c7911176809028be8491465f86) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2a197b8`](https://github.com/es-shims/RegExp.prototype.flags/commit/2a197b84916f094946c5cad56ef8e7bb7e8f12ac) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`e40bd37`](https://github.com/es-shims/RegExp.prototype.flags/commit/e40bd37de9bb756672832a6c994652965d09b9ae) +- [Refactor] use `call-bind` instead of `es-abstract` [`e6eac90`](https://github.com/es-shims/RegExp.prototype.flags/commit/e6eac9052ebdb4bc28cb83b5d3017a4ed74fe3f1) +- [Deps] update `es-abstract` [`f198075`](https://github.com/es-shims/RegExp.prototype.flags/commit/f198075d6fc075e0d98967af98a512742e6e7e4f) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`2d21727`](https://github.com/es-shims/RegExp.prototype.flags/commit/2d217275d78214b82c7f5cacca85ca2308df83f1) +- [Deps] update `es-abstract` [`7e7ddc6`](https://github.com/es-shims/RegExp.prototype.flags/commit/7e7ddc66174256f6688a857b09c9a02bafcf4866) + +## [v1.3.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.2.0...v1.3.0) - 2019-12-14 + +### Commits + +- [Tests] remove `jscs` [`4a09ab4`](https://github.com/es-shims/RegExp.prototype.flags/commit/4a09ab467f62065a1718b0dcc50f7818b5400ab6) +- [Tests] use shared travis-ci configs [`8afa6a9`](https://github.com/es-shims/RegExp.prototype.flags/commit/8afa6a99fd35c19fb49ba630fd17159a5da2a34e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `has`, `tape` [`13a9fc9`](https://github.com/es-shims/RegExp.prototype.flags/commit/13a9fc9d6bc2600681eb3f638668beccf80b843c) +- [Refactor] use `callBind` helper from `es-abstract` [`c3a3727`](https://github.com/es-shims/RegExp.prototype.flags/commit/c3a37276764d99c1e4f7e9467ad636fce8c92c58) +- [actions] add automatic rebasing / merge commit blocking [`51e3f93`](https://github.com/es-shims/RegExp.prototype.flags/commit/51e3f9366d15a07edaf532884948ce74b6827125) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`7e1ee50`](https://github.com/es-shims/RegExp.prototype.flags/commit/7e1ee505df374867c2c04d500aa1c36265161b6f) +- [meta] add `funding` field [`c99cbec`](https://github.com/es-shims/RegExp.prototype.flags/commit/c99cbec1af9b0e0be42e82f164adacf2e1bdee16) +- [New] add `auto` entry point [`1e53e85`](https://github.com/es-shims/RegExp.prototype.flags/commit/1e53e854f663472e74dd0350e0c095df9c2b9c7b) +- [Tests] use `eclint` instead of `editorconfig-tools` [`8600bfe`](https://github.com/es-shims/RegExp.prototype.flags/commit/8600bfed42ab8d294463df482874c344fc079f82) +- [Deps] update `define-properties` [`ad221fa`](https://github.com/es-shims/RegExp.prototype.flags/commit/ad221fa2a26a9c2bc8d274b689cf7a626b58f4e9) + +## [v1.2.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.1.1...v1.2.0) - 2017-10-24 + +### Commits + +- [Tests] up to `node` `v8.8`, `v7.10`, `v6.11`, `v4.8`; improve matrix; use `nvm install-latest-npm` so new npm doesn’t break old node [`5a9653d`](https://github.com/es-shims/RegExp.prototype.flags/commit/5a9653d1904eb8ad8baffe43cd065b6f36013e5a) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`; add `has` [`556de86`](https://github.com/es-shims/RegExp.prototype.flags/commit/556de8632bbe7a23279717f7d0b6ee841514fbe1) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`726772c`](https://github.com/es-shims/RegExp.prototype.flags/commit/726772c054a499ab7680823c4bd8fa9b048d9420) +- [New] add support for `dotAll` regex flag. [`fcbd64f`](https://github.com/es-shims/RegExp.prototype.flags/commit/fcbd64f84fd974d98384bdb093bf25656eb72e8f) +- [Dev Deps] update `eslint`, `jscs`, `nsp`, `tape`, `@ljharb/eslint-config`, `@es-shims/api` [`0272934`](https://github.com/es-shims/RegExp.prototype.flags/commit/02729344addadc105b9c5e12d90cca85a75d16d6) +- [Dev Deps] update `jscs`, `nsp`, `eslint` [`e4cd264`](https://github.com/es-shims/RegExp.prototype.flags/commit/e4cd264f4afa33ff865325b04791de95696e3ae4) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@es-shims/api` [`baf5169`](https://github.com/es-shims/RegExp.prototype.flags/commit/baf51698ac00b31b6a4a6d5646a183a409ad1118) +- [Dev Deps] update `tape`, `nsp`, `eslint`, `@ljharb/eslint-config` [`97cea15`](https://github.com/es-shims/RegExp.prototype.flags/commit/97cea152c20bb0e63e9c5111780f7b4af5d1a0e8) +- [Dev Deps] update `tape`, `discs`, `eslint`, `@ljharb/eslint-config` [`b6872f4`](https://github.com/es-shims/RegExp.prototype.flags/commit/b6872f44c833f6f7faf63881657208b6cd43ef49) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`14702cc`](https://github.com/es-shims/RegExp.prototype.flags/commit/14702ccd050029d4e6ea2e59d0912e6bfc16ffc0) +- [Dev Deps] update `jscs`, `@es-shims/api` [`cd060a6`](https://github.com/es-shims/RegExp.prototype.flags/commit/cd060a650db019be5244e1c1b77a29f6d79c89db) +- [Tests] up to `node` `v6.2`, `v5.11` [`14638bd`](https://github.com/es-shims/RegExp.prototype.flags/commit/14638bdbd62d6b6a7c89efb8ec57a7815032b4bb) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`b0a5ffb`](https://github.com/es-shims/RegExp.prototype.flags/commit/b0a5ffb25a76783053652e0d7f835e354f9b29b6) +- [Tests] npm run silently [`35804d4`](https://github.com/es-shims/RegExp.prototype.flags/commit/35804d45dd7f57faab923aaab914e6390813e700) +- [Tests] up to `node` `v5.9`, `v4.4` [`e0fe80d`](https://github.com/es-shims/RegExp.prototype.flags/commit/e0fe80d96783820444d6dea1e6b5739032a50c1b) +- [Tests] up to `node` `v5.7`, `v4.3` [`9739c42`](https://github.com/es-shims/RegExp.prototype.flags/commit/9739c422523571cc439d73a9ecaf5dc2e2643bec) +- [Dev Deps] update `jscs` [`4aa1699`](https://github.com/es-shims/RegExp.prototype.flags/commit/4aa1699a0582b7739f14c6cd8d5ae1a4515bd604) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `@ljharb/eslint-config` [`8bc5e6b`](https://github.com/es-shims/RegExp.prototype.flags/commit/8bc5e6ba5befc8f399e00f3c2d064519457fb57c) +- [Tests] fix npm upgrades on older nodes [`ae00bb9`](https://github.com/es-shims/RegExp.prototype.flags/commit/ae00bb9d979605f41fc598156b5c590923ac8184) +- Only apps should have lockfiles. [`6d14965`](https://github.com/es-shims/RegExp.prototype.flags/commit/6d1496550a962ea8525fb7b62dc4ac99d9513a6d) +- [Tests] use pretest/posttest for better organization [`0520cfd`](https://github.com/es-shims/RegExp.prototype.flags/commit/0520cfda23835fb5bff038a6e5cc530b0ce66985) +- [Tests] up to `node` `v5.5` [`810f62b`](https://github.com/es-shims/RegExp.prototype.flags/commit/810f62b6d2418e843b7c2c225841e9305dbc01ee) +- [Tests] on `node` `v5.3` [`f839662`](https://github.com/es-shims/RegExp.prototype.flags/commit/f839662887cbb1a5e472a9302185355b431c85c1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`78ecaa5`](https://github.com/es-shims/RegExp.prototype.flags/commit/78ecaa5b203a07f76505824f77ce1e5d60d8b0ca) +- [Tests] up to `node` `v5.2` [`c04d762`](https://github.com/es-shims/RegExp.prototype.flags/commit/c04d762a8c09ab544df14c14521f32dac3f67823) +- [Tests] up to `node` `v5.0` [`7c0d5b9`](https://github.com/es-shims/RegExp.prototype.flags/commit/7c0d5b944d9ba30f38227d0750109d582be254e2) +- [Tests] on `node` `v5.10` [`40ddafd`](https://github.com/es-shims/RegExp.prototype.flags/commit/40ddafd83e2e1c959ee8ba24cb296559f2545a0c) +- [Deps] update `define-properties` [`98ea89d`](https://github.com/es-shims/RegExp.prototype.flags/commit/98ea89dc9c41b81b84d4071105048687dab0660e) + +## [v1.1.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.1.0...v1.1.1) - 2015-08-16 + +### Commits + +- [Fix] cover the case where there is no descriptor on the prototype [`67014c3`](https://github.com/es-shims/RegExp.prototype.flags/commit/67014c35a93c76e28c4ab5cd3e5a54f7f40c2ddf) + +## [v1.1.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.0.1...v1.1.0) - 2015-08-16 + +### Commits + +- Update `jscs`, `eslint`; use my personal shared `eslint` config. [`37ca379`](https://github.com/es-shims/RegExp.prototype.flags/commit/37ca379bc72620fa6785b0a9ca791b160328c236) +- Update `eslint`, `tape`, `editorconfig-tools`, `nsp` [`cb92d6e`](https://github.com/es-shims/RegExp.prototype.flags/commit/cb92d6e8a8c1df5f00a226e11a78f38c6f7c3055) +- Implement the [es-shim API](es-shims/api). [`15eb821`](https://github.com/es-shims/RegExp.prototype.flags/commit/15eb821be2771e03a1341a08483513702118b45c) +- Refactoring to reduce complexity. [`aeb4785`](https://github.com/es-shims/RegExp.prototype.flags/commit/aeb47854f6b00355702104066c63f6eed38b5e81) +- Move implementation to `implementation.js` [`a698925`](https://github.com/es-shims/RegExp.prototype.flags/commit/a698925b4c1c78cd1ed4315b9deb5bb1707d5203) +- Update `eslint`, `jscs` [`277a4a1`](https://github.com/es-shims/RegExp.prototype.flags/commit/277a4a15e663eb823b63743b84645158b9bb9a43) +- Update `nsp`, `eslint` [`c9f3866`](https://github.com/es-shims/RegExp.prototype.flags/commit/c9f3866e25b52050f6bfe3fd0de8849de0271ea4) +- Update `tape`, `eslint` [`a08795b`](https://github.com/es-shims/RegExp.prototype.flags/commit/a08795b688b186fa5a2ec207358d81c16a07d30d) +- Make some things a bit more robust. [`450abb4`](https://github.com/es-shims/RegExp.prototype.flags/commit/450abb48974f10bfd2d9478e7ea1b9d87f004fb9) +- Update `eslint` [`25d898f`](https://github.com/es-shims/RegExp.prototype.flags/commit/25d898f62719b26fea5f9245be141103d4ec58cd) +- Test on latest two `io.js` versions. [`2e17ca3`](https://github.com/es-shims/RegExp.prototype.flags/commit/2e17ca304e12fb5071a091706a4d559b3eac968a) +- All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`4a2a548`](https://github.com/es-shims/RegExp.prototype.flags/commit/4a2a5480c50f30814000684462a8a3b44c87ae2e) +- Update `eslint` [`64df4e0`](https://github.com/es-shims/RegExp.prototype.flags/commit/64df4e0a2d0e2901b57652e30913db797dc0829b) +- Update `eslint` [`ac05ae5`](https://github.com/es-shims/RegExp.prototype.flags/commit/ac05ae509a4a70d107820a749ea6f02784fc41eb) +- Clean up `supportsDescriptors` check. [`e44d0de`](https://github.com/es-shims/RegExp.prototype.flags/commit/e44d0dec9c8415ff9a911b8806e1d245d6919a11) +- [Dev Deps] Update `jscs` [`8741758`](https://github.com/es-shims/RegExp.prototype.flags/commit/87417588f52f1176fc37d7c32221aa85f749aa34) +- Update `tape`, `jscs`, `nsp`, `eslint` [`db1f658`](https://github.com/es-shims/RegExp.prototype.flags/commit/db1f6584b18cc035ef3b5aec556f54e0ee8c639d) +- Test on `io.js` `v2.3` [`18c948f`](https://github.com/es-shims/RegExp.prototype.flags/commit/18c948f033c87ab2657a0395052cbec531c40900) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`c37e79f`](https://github.com/es-shims/RegExp.prototype.flags/commit/c37e79f380d87a226a6cdaa5f09f832f5dc21b7d) +- Update `tape`, `jscs`, `eslint` [`4b652bf`](https://github.com/es-shims/RegExp.prototype.flags/commit/4b652bf5f2f0e36a15227d0b4048de91ee6c4433) +- [Dev Deps] Update `tape`, `eslint` [`29d4ac0`](https://github.com/es-shims/RegExp.prototype.flags/commit/29d4ac0bea16c6a9f611cb15baccd30449f30a91) +- Test up to `io.js` `v2.1` [`9f9e342`](https://github.com/es-shims/RegExp.prototype.flags/commit/9f9e34295ced1b288dea08e0a66dffd2bc03ff8b) +- Update `covert`, `jscs` [`c98f3b4`](https://github.com/es-shims/RegExp.prototype.flags/commit/c98f3b47f01f317e8a589486dfaee482c66b8b64) +- Update `jscs` [`9e5e220`](https://github.com/es-shims/RegExp.prototype.flags/commit/9e5e220be6ec5d5b9b658235287e35bded580b06) +- [Dev Deps] update `tape` [`cdd3af2`](https://github.com/es-shims/RegExp.prototype.flags/commit/cdd3af21507b01aa524f8b87f158dfc8a8153c85) +- [Dev Deps] update `tape` [`d42d0bf`](https://github.com/es-shims/RegExp.prototype.flags/commit/d42d0bf28f8da2cb47fff49283a07a693f8cb626) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`a5e7453`](https://github.com/es-shims/RegExp.prototype.flags/commit/a5e745375c01e9f90ff632c55a5b44b6ada38217) +- Update `tape` [`2a675ec`](https://github.com/es-shims/RegExp.prototype.flags/commit/2a675ec707a9d89aea403d0b9a723ea531e50c2d) +- Test on `io.js` `v2.5` [`448cbdb`](https://github.com/es-shims/RegExp.prototype.flags/commit/448cbdb7df47e52677daea4e0c41e892ad8770e4) +- Test on `io.js` `v2.4` [`948e511`](https://github.com/es-shims/RegExp.prototype.flags/commit/948e51129c01147ffe4dedc3a7d4980128d0cf73) +- Test on `io.js` `v2.2` [`4793278`](https://github.com/es-shims/RegExp.prototype.flags/commit/4793278f5aca187e36b42b08fc1388d8021400e2) +- Update `eslint` [`0f463da`](https://github.com/es-shims/RegExp.prototype.flags/commit/0f463daa14a193ed94b16c46832074d63e861c91) +- Update `eslint` [`5a16967`](https://github.com/es-shims/RegExp.prototype.flags/commit/5a16967db71bb8a24c81a27ee366f0b02b663e34) +- Test on `io.js` `v3.0` [`7ba8706`](https://github.com/es-shims/RegExp.prototype.flags/commit/7ba87064bc8520d34a9560bea8e366d70c93dbbb) +- Test on `iojs-v1.2` [`b521e09`](https://github.com/es-shims/RegExp.prototype.flags/commit/b521e099b7de48cfbdd6860265eb5e972d2859a5) + +## [v1.0.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.0.0...v1.0.1) - 2014-12-13 + +### Merged + +- Match the spec properly: throw when not an object; make getter generic. [`#3`](https://github.com/es-shims/RegExp.prototype.flags/pull/3) + +### Fixed + +- Match the spec properly [`#1`](https://github.com/es-shims/RegExp.prototype.flags/issues/1) + +### Commits + +- Speed up the “is object” check in case of `null` or `undefined` [`77137f9`](https://github.com/es-shims/RegExp.prototype.flags/commit/77137f99449c9b6583cdfda295a00b832dfd45f3) + +## v1.0.0 - 2014-12-10 + +### Commits + +- Adding dotfiles [`313812e`](https://github.com/es-shims/RegExp.prototype.flags/commit/313812e1d8ff42a13dbc8689f2e719324c46c9ca) +- Tests [`625a042`](https://github.com/es-shims/RegExp.prototype.flags/commit/625a042220a3152b49608fb6f187f67bff02b6fb) +- Add package.json [`8b98257`](https://github.com/es-shims/RegExp.prototype.flags/commit/8b98257f900d0a73c8eb3805b9b01999e05e880a) +- Adding the README [`884798b`](https://github.com/es-shims/RegExp.prototype.flags/commit/884798b710d5a85bc6d9a6879f509766e2e57c0e) +- Implementation. [`4186cc9`](https://github.com/es-shims/RegExp.prototype.flags/commit/4186cc9d9a7533f78d88be976f0a8a2757604fc5) +- Adding LICENSE and CHANGELOG [`f87fa81`](https://github.com/es-shims/RegExp.prototype.flags/commit/f87fa8126cc6c39747fbe0dc6cb40ca0ff77fbbc) +- Fixing README URLs [`b821703`](https://github.com/es-shims/RegExp.prototype.flags/commit/b821703d5e5b01ee4f526f15c8e525645cf95ef7) +- Clean up dependencies; update `tape`, `jscs`, `nsp` [`0e13fc1`](https://github.com/es-shims/RegExp.prototype.flags/commit/0e13fc12df09f3a7ac30116ef13bba820c220730) +- Initial commit. [`8a9e35e`](https://github.com/es-shims/RegExp.prototype.flags/commit/8a9e35e15f65c9640e64ee14fab190a60993efaa) diff --git a/node_modules/regexp.prototype.flags/LICENSE b/node_modules/regexp.prototype.flags/LICENSE new file mode 100644 index 000000000..e5956a86b --- /dev/null +++ b/node_modules/regexp.prototype.flags/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (C) 2014 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/node_modules/regexp.prototype.flags/README.md b/node_modules/regexp.prototype.flags/README.md new file mode 100644 index 000000000..ca5f28252 --- /dev/null +++ b/node_modules/regexp.prototype.flags/README.md @@ -0,0 +1,55 @@ +RegExp.prototype.flags [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +An ES6 spec-compliant `RegExp.prototype.flags` shim. Invoke its "shim" method to shim RegExp.prototype.flags if it is unavailable. +*Note*: `RegExp#flags` requires a true ES5 environment - specifically, one with ES5 getters. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-get-regexp.prototype.flags). + +Most common usage: +```js +var flags = require('regexp.prototype.flags'); +var assert = require('assert'); + +assert(flags(/a/) === ''); +assert(flags(new RegExp('a')) === ''); +assert(flags(/a/mig) === 'gim'); +assert(flags(new RegExp('a', 'mig')) === 'gim'); + +if (!RegExp.prototype.flags) { + flags.shim(); +} + +assert(flags(/a/) === /a/.flags); +assert(flags(new RegExp('a')) === new RegExp('a').flags); +assert(flags(/a/mig) === /a/mig.flags); +assert(flags(new RegExp('a', 'mig')) === new RegExp('a', 'mig').flags); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/regexp.prototype.flags +[npm-version-svg]: http://versionbadg.es/es-shims/RegExp.prototype.flags.svg +[travis-svg]: https://travis-ci.org/es-shims/RegExp.prototype.flags.svg +[travis-url]: https://travis-ci.org/es-shims/RegExp.prototype.flags +[deps-svg]: https://david-dm.org/es-shims/RegExp.prototype.flags.svg +[deps-url]: https://david-dm.org/es-shims/RegExp.prototype.flags +[dev-deps-svg]: https://david-dm.org/es-shims/RegExp.prototype.flags/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/RegExp.prototype.flags#info=devDependencies +[testling-svg]: https://ci.testling.com/es-shims/RegExp.prototype.flags.png +[testling-url]: https://ci.testling.com/es-shims/RegExp.prototype.flags +[npm-badge-png]: https://nodei.co/npm/regexp.prototype.flags.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/regexp.prototype.flags.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/regexp.prototype.flags.svg +[downloads-url]: http://npm-stat.com/charts.html?package=regexp.prototype.flags diff --git a/node_modules/regexp.prototype.flags/auto.js b/node_modules/regexp.prototype.flags/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/regexp.prototype.flags/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/regexp.prototype.flags/implementation.js b/node_modules/regexp.prototype.flags/implementation.js new file mode 100644 index 000000000..4005503b2 --- /dev/null +++ b/node_modules/regexp.prototype.flags/implementation.js @@ -0,0 +1,39 @@ +'use strict'; + +var setFunctionName = require('set-function-name'); +var $TypeError = require('es-errors/type'); + +var $Object = Object; + +module.exports = setFunctionName(function flags() { + if (this == null || this !== $Object(this)) { + throw new $TypeError('RegExp.prototype.flags getter called on non-object'); + } + var result = ''; + if (this.hasIndices) { + result += 'd'; + } + if (this.global) { + result += 'g'; + } + if (this.ignoreCase) { + result += 'i'; + } + if (this.multiline) { + result += 'm'; + } + if (this.dotAll) { + result += 's'; + } + if (this.unicode) { + result += 'u'; + } + if (this.unicodeSets) { + result += 'v'; + } + if (this.sticky) { + result += 'y'; + } + return result; +}, 'get flags', true); + diff --git a/node_modules/regexp.prototype.flags/index.js b/node_modules/regexp.prototype.flags/index.js new file mode 100644 index 000000000..d6054c766 --- /dev/null +++ b/node_modules/regexp.prototype.flags/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var flagsBound = callBind(getPolyfill()); + +define(flagsBound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = flagsBound; diff --git a/node_modules/regexp.prototype.flags/package.json b/node_modules/regexp.prototype.flags/package.json new file mode 100644 index 000000000..51b5df7f1 --- /dev/null +++ b/node_modules/regexp.prototype.flags/package.json @@ -0,0 +1,105 @@ +{ + "name": "regexp.prototype.flags", + "version": "1.5.4", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES6 spec-compliant RegExp.prototype.flags shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "evalmd README.md && es-shim-api --bound", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/es-shims/RegExp.prototype.flags.git" + }, + "keywords": [ + "RegExp.prototype.flags", + "regex", + "regular expression", + "ES6", + "shim", + "flag", + "flags", + "regexp", + "RegExp#flags", + "polyfill", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "available-regexp-flags": "^1.0.4", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "hasown": "^2.0.2", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/9.0..latest", + "firefox/4.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/11.6..latest", + "opera/next", + "safari/5.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/regexp.prototype.flags/polyfill.js b/node_modules/regexp.prototype.flags/polyfill.js new file mode 100644 index 000000000..8c78882fa --- /dev/null +++ b/node_modules/regexp.prototype.flags/polyfill.js @@ -0,0 +1,39 @@ +'use strict'; + +var implementation = require('./implementation'); + +var supportsDescriptors = require('define-properties').supportsDescriptors; +var $gOPD = Object.getOwnPropertyDescriptor; + +module.exports = function getPolyfill() { + if (supportsDescriptors && (/a/mig).flags === 'gim') { + var descriptor = $gOPD(RegExp.prototype, 'flags'); + if ( + descriptor + && typeof descriptor.get === 'function' + && 'dotAll' in RegExp.prototype + && 'hasIndices' in RegExp.prototype + ) { + /* eslint getter-return: 0 */ + var calls = ''; + var o = {}; + Object.defineProperty(o, 'hasIndices', { + get: function () { + calls += 'd'; + } + }); + Object.defineProperty(o, 'sticky', { + get: function () { + calls += 'y'; + } + }); + + descriptor.get.call(o); + + if (calls === 'dy') { + return descriptor.get; + } + } + } + return implementation; +}; diff --git a/node_modules/regexp.prototype.flags/shim.js b/node_modules/regexp.prototype.flags/shim.js new file mode 100644 index 000000000..9d22c8bb8 --- /dev/null +++ b/node_modules/regexp.prototype.flags/shim.js @@ -0,0 +1,26 @@ +'use strict'; + +var supportsDescriptors = require('define-properties').supportsDescriptors; +var getPolyfill = require('./polyfill'); +var gOPD = require('gopd'); +var defineProperty = Object.defineProperty; +var $TypeError = require('es-errors'); +var getProto = require('get-proto'); +var regex = /a/; + +module.exports = function shimFlags() { + if (!supportsDescriptors || !getProto) { + throw new $TypeError('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors'); + } + var polyfill = getPolyfill(); + var proto = getProto(regex); + var descriptor = gOPD(proto, 'flags'); + if (!descriptor || descriptor.get !== polyfill) { + defineProperty(proto, 'flags', { + configurable: true, + enumerable: false, + get: polyfill + }); + } + return polyfill; +}; diff --git a/node_modules/regexp.prototype.flags/test/builtin.js b/node_modules/regexp.prototype.flags/test/builtin.js new file mode 100644 index 000000000..ef3dac700 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/builtin.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); +var hasStrictMode = require('has-strict-mode')(); + +var runTests = require('./tests'); + +test('builtin', function (t) { + var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags'); + + t.equal(descriptor.get.length, 0, 'RegExp#flags getter has a length of 0'); + + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(descriptor.get.name, functionsHaveConfigurableNames ? 'get flags' : 'flags', 'RegExp#flags getter has name "get flags" (or "flags" if function names are not configurable)'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(RegExp.prototype, 'flags'), 'RegExp#flags is not enumerable'); + et.end(); + }); + + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + st['throws'](function () { return descriptor.get.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return descriptor.get.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + t.test('has the correct descriptor', function (st) { + st.equal(descriptor.configurable, true); + st.equal(descriptor.enumerable, false); + st.equal(typeof descriptor.get, 'function'); + st.equal(descriptor.set, undefined); + st.end(); + }); + + runTests(callBind(descriptor.get), t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/implementation.js b/node_modules/regexp.prototype.flags/test/implementation.js new file mode 100644 index 000000000..1e3a71416 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var flags = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { flags.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { flags.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(flags), t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/index.js b/node_modules/regexp.prototype.flags/test/index.js new file mode 100644 index 000000000..10d107133 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var flags = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { flags(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { flags(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(flags, t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/shimmed.js b/node_modules/regexp.prototype.flags/test/shimmed.js new file mode 100644 index 000000000..059e0e17d --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/shimmed.js @@ -0,0 +1,48 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); +var hasStrictMode = require('has-strict-mode')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags'); + + t.equal(descriptor.get.length, 0, 'RegExp#flags getter has a length of 0'); + + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(descriptor.get.name, functionsHaveConfigurableNames ? 'get flags' : 'flags', 'RegExp#flags getter has name "get flags" (or "flags" if function names are not configurable)'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(RegExp.prototype, 'flags'), 'RegExp#flags is not enumerable'); + et.end(); + }); + + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + st['throws'](function () { return descriptor.get.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return descriptor.get.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + t.test('has the correct descriptor', function (st) { + st.equal(descriptor.configurable, true); + st.equal(descriptor.enumerable, false); + st.equal(typeof descriptor.get, 'function'); + st.equal(descriptor.set, undefined); + st.end(); + }); + + runTests(callBind(descriptor.get), t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/tests.js b/node_modules/regexp.prototype.flags/test/tests.js new file mode 100644 index 000000000..fbe41941c --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/tests.js @@ -0,0 +1,143 @@ +'use strict'; + +var hasOwn = require('hasown'); +var inspect = require('object-inspect'); +var supportsDescriptors = require('define-properties').supportsDescriptors; +var v = require('es-value-fixtures'); + +var forEach = require('for-each'); +var availableFlags = require('available-regexp-flags'); +var regexProperties = require('available-regexp-flags/properties'); + +var sortedFlags = availableFlags.slice().sort(function (a, b) { return a.localeCompare(b); }).join(''); + +var getRegexLiteral = function (stringRegex) { + try { + // eslint-disable-next-line no-new-func + return Function('return ' + stringRegex + ';')(); + } catch (e) { /**/ } + return null; +}; + +module.exports = function runTests(flags, t) { + forEach(v.primitives, function (nonObject) { + t['throws']( + function () { flags(nonObject); }, + TypeError, + 'throws when called with a non-object receiver: ' + inspect(nonObject) + ); + }); + + t.equal(flags(/a/g), 'g', 'flags(/a/g) !== "g"'); + t.equal(flags(/a/gmi), 'gim', 'flags(/a/gmi) !== "gim"'); + t.equal(flags(new RegExp('a', 'gmi')), 'gim', 'flags(new RegExp("a", "gmi")) !== "gim"'); + t.equal(flags(/a/), '', 'flags(/a/) !== ""'); + t.equal(flags(new RegExp('a')), '', 'flags(new RegExp("a")) !== ""'); + + forEach(availableFlags, function (flag) { + var property = regexProperties[flag]; + t.test(property + ' flag', function (st) { + st.equal(flags(getRegexLiteral('/a/' + flag)), flag, 'flags(/a/' + flag + ') !== ' + inspect(flag)); + st.equal(flags(new RegExp('a', flag)), flag, 'flags(new RegExp("a", ' + inspect(flag) + ')) !== ' + inspect(flag)); + st.end(); + }); + }); + + t.test('sorting', function (st) { + st.equal(flags(/a/gim), 'gim', 'flags(/a/gim) !== "gim"'); + st.equal(flags(/a/mig), 'gim', 'flags(/a/mig) !== "gim"'); + st.equal(flags(/a/mgi), 'gim', 'flags(/a/mgi) !== "gim"'); + if (hasOwn(RegExp.prototype, 'sticky')) { + st.equal(flags(getRegexLiteral('/a/gyim')), 'gimy', 'flags(/a/gyim) !== "gimy"'); + } + if (hasOwn(RegExp.prototype, 'unicode')) { + st.equal(flags(getRegexLiteral('/a/ugmi')), 'gimu', 'flags(/a/ugmi) !== "gimu"'); + } + if (hasOwn(RegExp.prototype, 'dotAll')) { + st.equal(flags(getRegexLiteral('/a/sgmi')), 'gims', 'flags(/a/sgmi) !== "gims"'); + } + + var randomFlags = availableFlags.slice().sort(function () { return Math.random() > 0.5 ? 1 : -1; }).join('').replace('v', ''); + st.equal( + flags(getRegexLiteral('/a/' + randomFlags)), + sortedFlags.replace('v', ''), + 'random: flags(/a/' + randomFlags + ') === ' + inspect(sortedFlags) + ); + + st.end(); + }); + + t.test('basic examples', function (st) { + st.equal(flags(/a/g), 'g', '(/a/g).flags !== "g"'); + st.equal(flags(/a/gmi), 'gim', '(/a/gmi).flags !== "gim"'); + st.equal(flags(new RegExp('a', 'gmi')), 'gim', 'new RegExp("a", "gmi").flags !== "gim"'); + st.equal(flags(/a/), '', '(/a/).flags !== ""'); + st.equal(flags(new RegExp('a')), '', 'new RegExp("a").flags !== ""'); + + st.end(); + }); + + t.test('generic flags', function (st) { + st.equal(flags({}), ''); + st.equal(flags({ ignoreCase: true }), 'i'); + st.equal(flags({ dotAll: 1, global: 0, sticky: 1, unicode: 1 }), 'suy'); + st.equal(flags({ __proto__: { multiline: true } }), 'm'); + + var obj = {}; + forEach(availableFlags, function (flag) { + if (flag !== 'v') { + obj[regexProperties[flag]] = true; + } + }); + st.equal(flags(obj), sortedFlags.replace('v', ''), 'an object with every available flag: ' + sortedFlags); + + st.end(); + }); + + t.test('getters', { skip: !supportsDescriptors }, function (st) { + /* eslint getter-return: 0 */ + var calls = ''; + var re = {}; + Object.defineProperty(re, 'hasIndices', { + get: function () { + calls += 'd'; + } + }); + Object.defineProperty(re, 'global', { + get: function () { + calls += 'g'; + } + }); + Object.defineProperty(re, 'ignoreCase', { + get: function () { + calls += 'i'; + } + }); + Object.defineProperty(re, 'multiline', { + get: function () { + calls += 'm'; + } + }); + Object.defineProperty(re, 'dotAll', { + get: function () { + calls += 's'; + } + }); + Object.defineProperty(re, 'unicode', { + get: function () { + calls += 'u'; + } + }); + Object.defineProperty(re, 'sticky', { + get: function () { + calls += 'y'; + } + }); + + flags(re); + + st.equal(calls, 'dgimsuy', 'getters are called in expected order'); + + st.end(); + }); +}; diff --git a/node_modules/remark-frontmatter/index.js b/node_modules/remark-frontmatter/index.js new file mode 100644 index 000000000..3fa9ecbb6 --- /dev/null +++ b/node_modules/remark-frontmatter/index.js @@ -0,0 +1,63 @@ +'use strict' + +var xtend = require('xtend') +var matters = require('./lib/matters') +var parse = require('./lib/parse') +var compile = require('./lib/compile') + +module.exports = frontmatter + +function frontmatter(options) { + var parser = this.Parser + var compiler = this.Compiler + var config = matters(options || ['yaml']) + + if (isRemarkParser(parser)) { + attachParser(parser, config) + } + + if (isRemarkCompiler(compiler)) { + attachCompiler(compiler, config) + } +} + +function attachParser(parser, matters) { + var proto = parser.prototype + var tokenizers = wrap(parse, matters) + var names = [] + var key + + for (key in tokenizers) { + names.push(key) + } + + proto.blockMethods = names.concat(proto.blockMethods) + proto.blockTokenizers = xtend(tokenizers, proto.blockTokenizers) +} + +function attachCompiler(compiler, matters) { + var proto = compiler.prototype + proto.visitors = xtend(wrap(compile, matters), proto.visitors) +} + +function wrap(func, matters) { + var result = {} + var length = matters.length + var index = -1 + var tuple + + while (++index < length) { + tuple = func(matters[index]) + result[tuple[0]] = tuple[1] + } + + return result +} + +function isRemarkParser(parser) { + return Boolean(parser && parser.prototype && parser.prototype.blockTokenizers) +} + +function isRemarkCompiler(compiler) { + return Boolean(compiler && compiler.prototype && compiler.prototype.visitors) +} diff --git a/node_modules/remark-frontmatter/license b/node_modules/remark-frontmatter/license new file mode 100644 index 000000000..045ffe0e0 --- /dev/null +++ b/node_modules/remark-frontmatter/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2017 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-frontmatter/package.json b/node_modules/remark-frontmatter/package.json new file mode 100644 index 000000000..3de12d175 --- /dev/null +++ b/node_modules/remark-frontmatter/package.json @@ -0,0 +1,97 @@ +{ + "name": "remark-frontmatter", + "version": "1.3.3", + "description": "remark plugin to support frontmatter (yaml, toml, and more)", + "license": "MIT", + "keywords": [ + "unified", + "remark", + "remark-plugin", + "plugin", + "mdast", + "markdown", + "frontmatter", + "yaml", + "toml" + ], + "repository": "remarkjs/remark-frontmatter", + "bugs": "https://github.com/remarkjs/remark-frontmatter/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)", + "Lars Trieloff ", + "Max Kueng " + ], + "files": [ + "index.js", + "lib" + ], + "dependencies": { + "fault": "^1.0.1", + "xtend": "^4.0.1" + }, + "devDependencies": { + "browserify": "^16.0.0", + "is-hidden": "^1.0.0", + "not": "^0.1.0", + "nyc": "^15.0.0", + "prettier": "^2.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", + "to-vfile": "^6.0.0", + "unified": "^8.0.0", + "xo": "^0.28.0" + }, + "scripts": { + "format": "remark *.md -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s remarkFrontmatter > remark-frontmatter.js", + "build-mangle": "browserify . -s remarkFrontmatter -p tinyify > remark-frontmatter.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test/index.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "guard-for-in": "off" + }, + "ignores": [ + "remark-frontmatter.js" + ] + }, + "remarkConfig": { + "plugins": [ + [ + "./", + [ + "yaml", + "toml" + ] + ], + "preset-wooorm" + ] + } +} diff --git a/node_modules/remark-frontmatter/readme.md b/node_modules/remark-frontmatter/readme.md new file mode 100644 index 000000000..16aac62b3 --- /dev/null +++ b/node_modules/remark-frontmatter/readme.md @@ -0,0 +1,293 @@ +# remark-frontmatter + +[![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 support frontmatter (YAML, TOML, and more). + +## Install + +[npm][]: + +```sh +npm install remark-frontmatter +``` + +## Use + +Say we have the following file, `example.md`: + +```markdown ++++ +title = "New Website" ++++ + +# Other markdown +``` + +And our script, `example.js`, looks as follows: + +```js +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var unified = require('unified') +var parse = require('remark-parse') +var stringify = require('remark-stringify') +var frontmatter = require('remark-frontmatter') + +unified() + .use(parse) + .use(stringify) + .use(frontmatter, ['yaml', 'toml']) + .use(logger) + .process(vfile.readSync('example.md'), function(err, file) { + console.log(String(file)) + console.error(report(err || file)) + }) + +function logger() { + return console.dir +} +``` + +Now, running `node example` yields: + +```js +{ type: 'root', + children: + [ { type: 'toml', + value: 'title = "New Website"', + position: [Object] }, + { type: 'heading', + depth: 1, + children: [Array], + position: [Object] } ], + position: [Object] } +``` + +```markdown +example.md: no issues found ++++ +title = "New Website" ++++ + +# Other markdown +``` + +## API + +### `remark().use(frontmatter[, options])` + +Support frontmatter (YAML, TOML, and more). +Adds [tokenizers][] if the [processor][] is configured with +[`remark-parse`][parse], and [visitors][] if configured with +[`remark-stringify`][stringify]. + +If you are parsing from a different syntax, or compiling to a different syntax +(such as, [`remark-man`][man]) your custom nodes may not be supported. + +##### `options` + +One [`preset`][preset] or [`Matter`][matter], or an array of them, defining all +the supported frontmatters (default: `'yaml'`). + +##### `preset` + +Either `'yaml'` or `'toml'`: + +* `'yaml'` — [`matter`][matter] defined as `{type: 'yaml', marker: '-'}` +* `'toml'` — [`matter`][matter] defined as `{type: 'toml', marker: '+'}` + +##### `Matter` + +An object with a `type` and either a `marker` or a `fence`: + +* `type` (`string`) + — Node type to parse to in [mdast][] and compile from +* `marker` (`string` or `{open: string, close: string}`) + — Character used to construct fences. + By providing an object with `open` and `close`. + different characters can be used for opening and closing fences. + For example the character `'-'` will result in `'---'` being used as the + fence +* `fence` (`string` or `{open: string, close: string}`) + — String used as the complete fence. + By providing an object with `open` and `close` different values can be used + for opening and closing fences. + This can be used too if fences contain different characters or lengths other + than 3 +* `anywhere` (`boolean`, default: `false`) + – if `true`, matter can be found anywhere in the document. + If `false` (default), only matter at the start of the document is recognized + +###### Example + +For `{type: 'yaml', marker: '-'}`: + +```yaml +--- +key: value +--- +``` + +Yields: + +```json +{ + "type": "yaml", + "value": "key: value" +} +``` + +For `{type: 'custom', marker: {open: '<', close: '>'}}`: + +```text +<<< +data +>>> +``` + +Yields: + +```json +{ + "type": "custom", + "value": "data" +} +``` + +For `{type: 'custom', fence: '+=+=+=+'}`: + +```text ++=+=+=+ +data ++=+=+=+ +``` + +Yields: + +```json +{ + "type": "custom", + "value": "data" +} +``` + +For `{type: 'json', fence: {open: '{', close: '}'}}`: + +```json +{ + "key": "value" +} +``` + +Yields: + +```json +{ + "type": "json", + "value": "\"key\": \"value\"" +} +``` + +## Security + +Use of `remark-frontmatter` does not involve [**rehype**][rehype] +([**hast**][hast]) or user content so there are no openings for +[cross-site scripting (XSS)][xss] attacks. + +## Related + +* [`remark-github`](https://github.com/remarkjs/remark-github) + — Auto-link references like in GitHub issues, PRs, and comments +* [`remark-math`](https://github.com/rokt33r/remark-math) + — Math support +* [`remark-yaml-config`](https://github.com/remarkjs/remark-yaml-config) + — Configure remark from YAML configuration + +## 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-frontmatter/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-frontmatter + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-frontmatter.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-frontmatter + +[downloads-badge]: https://img.shields.io/npm/dm/remark-frontmatter.svg + +[downloads]: https://www.npmjs.com/package/remark-frontmatter + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-frontmatter.svg + +[size]: https://bundlephobia.com/result?p=remark-frontmatter + +[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 + +[parse]: https://github.com/remarkjs/remark/tree/master/packages/remark-parse + +[tokenizers]: https://github.com/remarkjs/remark/tree/master/packages/remark-parse#parserblocktokenizers + +[stringify]: https://github.com/remarkjs/remark/tree/master/packages/remark-stringify + +[visitors]: https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#compilervisitors + +[processor]: https://github.com/unifiedjs/unified#processor + +[mdast]: https://github.com/syntax-tree/mdast + +[man]: https://github.com/remarkjs/remark-man + +[preset]: #preset + +[matter]: #matter + +[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-parse/index.js b/node_modules/remark-parse/index.js new file mode 100644 index 000000000..1579e3551 --- /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/package.json b/node_modules/remark-parse/package.json new file mode 100644 index 000000000..822420cb2 --- /dev/null +++ b/node_modules/remark-parse/package.json @@ -0,0 +1,44 @@ +{ + "name": "remark-parse", + "version": "5.0.0", + "description": "Markdown parser for remark", + "license": "MIT", + "keywords": [ + "markdown", + "abstract", + "syntax", + "tree", + "ast", + "parse" + ], + "homepage": "http://remark.js.org", + "repository": "https://github.com/remarkjs/remark/tree/master/packages/remark-parse", + "bugs": "https://github.com/remarkjs/remark/issues", + "author": "Titus Wormer (http://wooorm.com)", + "contributors": [ + "Titus Wormer (http://wooorm.com)", + "Eugene Sharygin " + ], + "files": [ + "index.js", + "lib" + ], + "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" + }, + "xo": false +} diff --git a/node_modules/remark-parse/readme.md b/node_modules/remark-parse/readme.md new file mode 100644 index 000000000..ecaa6c093 --- /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/repeat-string/LICENSE b/node_modules/repeat-string/LICENSE new file mode 100644 index 000000000..39245ac1c --- /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 000000000..aaa5e91c7 --- /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 000000000..4459afd80 --- /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 000000000..09f889299 --- /dev/null +++ b/node_modules/repeat-string/package.json @@ -0,0 +1,77 @@ +{ + "name": "repeat-string", + "description": "Repeat the given string n times. Fastest implementation for repeating a string.", + "version": "1.6.1", + "homepage": "https://github.com/jonschlinkert/repeat-string", + "author": "Jon Schlinkert (http://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://github.com/doowb)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Linus Unnebäck (http://linus.unnebäck.se)", + "Thijs Busser (http://tbusser.net)", + "Titus (wooorm.com)" + ], + "repository": "jonschlinkert/repeat-string", + "bugs": { + "url": "https://github.com/jonschlinkert/repeat-string/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10" + }, + "scripts": { + "test": "mocha" + }, + "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" + }, + "keywords": [ + "fast", + "fastest", + "fill", + "left", + "left-pad", + "multiple", + "pad", + "padding", + "repeat", + "repeating", + "repetition", + "right", + "right-pad", + "string", + "times" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "repeat-element" + ] + }, + "helpers": [ + "./benchmark/helper.js" + ], + "reflinks": [ + "verb" + ] + } +} diff --git a/node_modules/replace-ext/LICENSE b/node_modules/replace-ext/LICENSE new file mode 100755 index 000000000..fd38d6935 --- /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 000000000..8775983b7 --- /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 000000000..7cb7789e2 --- /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 000000000..27dbe3104 --- /dev/null +++ b/node_modules/replace-ext/package.json @@ -0,0 +1,44 @@ +{ + "name": "replace-ext", + "version": "1.0.0", + "description": "Replaces a file extension with another one", + "author": "Gulp Team (http://gulpjs.com/)", + "contributors": [ + "Eric Schoffstall ", + "Blaine Bublitz " + ], + "repository": "gulpjs/replace-ext", + "license": "MIT", + "engines": { + "node": ">= 0.10" + }, + "main": "index.js", + "files": [ + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint . && jscs index.js test/", + "pretest": "npm run lint", + "test": "mocha --async-only", + "cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly", + "coveralls": "npm run cover && istanbul-coveralls" + }, + "dependencies": {}, + "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" + }, + "keywords": [ + "gulp", + "extensions", + "filepath", + "basename" + ] +} diff --git a/node_modules/require-from-string/index.js b/node_modules/require-from-string/index.js new file mode 100644 index 000000000..cb5595fde --- /dev/null +++ b/node_modules/require-from-string/index.js @@ -0,0 +1,34 @@ +'use strict'; + +var Module = require('module'); +var path = require('path'); + +module.exports = function requireFromString(code, filename, opts) { + if (typeof filename === 'object') { + opts = filename; + filename = undefined; + } + + opts = opts || {}; + filename = filename || ''; + + opts.appendPaths = opts.appendPaths || []; + opts.prependPaths = opts.prependPaths || []; + + if (typeof code !== 'string') { + throw new Error('code must be a string, not ' + typeof code); + } + + var paths = Module._nodeModulePaths(path.dirname(filename)); + + var parent = module.parent; + var m = new Module(filename, parent); + m.filename = filename; + m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); + m._compile(code, filename); + + var exports = m.exports; + parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1); + + return exports; +}; diff --git a/node_modules/require-from-string/license b/node_modules/require-from-string/license new file mode 100644 index 000000000..1aeb74fd2 --- /dev/null +++ b/node_modules/require-from-string/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/require-from-string/package.json b/node_modules/require-from-string/package.json new file mode 100644 index 000000000..800d46efc --- /dev/null +++ b/node_modules/require-from-string/package.json @@ -0,0 +1,28 @@ +{ + "name": "require-from-string", + "version": "2.0.2", + "description": "Require module from string", + "license": "MIT", + "repository": "floatdrop/require-from-string", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "" + ], + "dependencies": {}, + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/require-from-string/readme.md b/node_modules/require-from-string/readme.md new file mode 100644 index 000000000..88b3236f8 --- /dev/null +++ b/node_modules/require-from-string/readme.md @@ -0,0 +1,56 @@ +# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string) + +Load module from string in Node. + +## Install + +``` +$ npm install --save require-from-string +``` + + +## Usage + +```js +var requireFromString = require('require-from-string'); + +requireFromString('module.exports = 1'); +//=> 1 +``` + + +## API + +### requireFromString(code, [filename], [options]) + +#### code + +*Required* +Type: `string` + +Module code. + +#### filename +Type: `string` +Default: `''` + +Optional filename. + + +#### options +Type: `object` + +##### appendPaths +Type: `Array` + +List of `paths`, that will be appended to module `paths`. Useful, when you want +to be able require modules from these paths. + +##### prependPaths +Type: `Array` + +Same as `appendPaths`, but paths will be prepended. + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/node_modules/resolve/.editorconfig b/node_modules/resolve/.editorconfig new file mode 100644 index 000000000..d63f0bb6c --- /dev/null +++ b/node_modules/resolve/.editorconfig @@ -0,0 +1,37 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab + +[lib/core.json] +indent_style = tab + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[{*.json,Makefile}] +max_line_length = off + +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off +max_line_length = off +insert_final_newline = off diff --git a/node_modules/resolve/.eslintrc b/node_modules/resolve/.eslintrc new file mode 100644 index 000000000..60c73a586 --- /dev/null +++ b/node_modules/resolve/.eslintrc @@ -0,0 +1,65 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 1, + "id-length": [2, { "min": 1, "max": 40 }], + "max-lines": [2, 360], + "max-lines-per-function": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-shadow": 0, + "no-use-before-define": 0, + "sort-keys": 0, + }, + "overrides": [ + { + "files": "bin/**", + "rules": { + "no-process-exit": "off", + }, + }, + { + "files": "example/**", + "rules": { + "no-console": 0, + }, + }, + { + "files": "test/resolver/nested_symlinks/mylib/*.js", + "rules": { + "no-throw-literal": 0, + }, + }, + { + "files": "test/**", + "parserOptions": { + "ecmaVersion": 5, + "allowReserved": false, + }, + "rules": { + "dot-notation": [2, { "allowPattern": "throws" }], + "max-lines": 0, + "max-lines-per-function": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + }, + }, + ], + + "ignorePatterns": [ + "./test/resolver/malformed_package_json/package.json", + ], +} diff --git a/node_modules/resolve/.github/FUNDING.yml b/node_modules/resolve/.github/FUNDING.yml new file mode 100644 index 000000000..d9c059554 --- /dev/null +++ b/node_modules/resolve/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/resolve +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/resolve/.github/INCIDENT_RESPONSE_PROCESS.md b/node_modules/resolve/.github/INCIDENT_RESPONSE_PROCESS.md new file mode 100644 index 000000000..2777753e7 --- /dev/null +++ b/node_modules/resolve/.github/INCIDENT_RESPONSE_PROCESS.md @@ -0,0 +1,119 @@ +# Incident Response Process for **resolve** + +## Reporting a Vulnerability + +We take the security of **resolve** very seriously. If you believe you’ve found a security vulnerability, please inform us responsibly through coordinated disclosure. + +### How to Report + +> **Do not** report security vulnerabilities through public GitHub issues, discussions, or social media. + +Instead, please use one of these secure channels: + +1. **GitHub Security Advisories** + Use the **Report a vulnerability** button in the Security tab of the [browserify/resolve repository](https://github.com/browserify/resolve). + +2. **Email** + Follow the posted [Security Policy](https://github.com/browserify/resolve/security/policy). + +### What to Include + +**Required Information:** +- Brief description of the vulnerability type +- Affected version(s) and components +- Steps to reproduce the issue +- Impact assessment (what an attacker could achieve) +- Confirm the issue is not present in test files (in other words, only via the official entry points in `exports`) + +**Helpful Additional Details:** +- Full paths of affected source files +- Specific commit or branch where the issue exists +- Required configuration to reproduce +- Proof-of-concept code (if available) +- Suggested mitigation or fix + +## Our Response Process + +**Timeline Commitments:** +- **Initial acknowledgment**: Within 24 hours +- **Detailed response**: Within 3 business days +- **Status updates**: Every 7 days until resolved +- **Resolution target**: 90 days for most issues + +**What We’ll Do:** +1. Acknowledge your report and assign a tracking ID +2. Assess the vulnerability and determine severity +3. Develop and test a fix +4. Coordinate disclosure timeline with you +5. Release a security update and publish an advisory and CVE +6. Credit you in our security advisory (if desired) + +## Disclosure Policy + +- **Coordinated disclosure**: We’ll work with you on timing +- **Typical timeline**: 90 days from report to public disclosure +- **Early disclosure**: If actively exploited +- **Delayed disclosure**: For complex issues + +## Scope + +**In Scope:** +- **resolve** package (all supported versions) +- Official examples and documentation +- Core resolution APIs +- Dependencies with direct security implications + +**Out of Scope:** +- Third-party wrappers or extensions +- Bundler-specific integrations +- Social engineering or physical attacks +- Theoretical vulnerabilities without practical exploitation +- Issues in non-production files + +## Security Measures + +**Our Commitments:** +- Regular vulnerability scanning via `npm audit` +- Automated security checks in CI/CD (GitHub Actions) +- Secure coding practices and mandatory code review +- Prompt patch releases for critical issues + +**User Responsibilities:** +- Keep **resolve** updated +- Monitor dependency vulnerabilities +- Follow secure configuration guidelines for module resolution + +## Legal Safe Harbor + +**We will NOT:** +- Initiate legal action +- Contact law enforcement +- Suspend or terminate your access + +**You must:** +- Only test against your own installations +- Not access, modify, or delete user data +- Not degrade service availability +- Not publicly disclose before coordinated disclosure +- Act in good faith + +## Recognition + +- **Advisory Credits**: Credit in GitHub Security Advisories (unless anonymous) + +## Security Updates + +**Stay Informed:** +- Subscribe to npm updates for **resolve** +- Enable GitHub Security Advisory notifications + +**Update Process:** +- Patch releases (e.g., 1.22.10 → 1.22.11) +- Out-of-band releases for critical issues +- Advisories via GitHub Security Advisories + +## Contact Information + +- **Security reports**: Security tab of [browserify/resolve](https://github.com/browserify/resolve/security) +- **General inquiries**: GitHub Discussions or Issues + diff --git a/node_modules/resolve/.github/THREAT_MODEL.md b/node_modules/resolve/.github/THREAT_MODEL.md new file mode 100644 index 000000000..2952f698c --- /dev/null +++ b/node_modules/resolve/.github/THREAT_MODEL.md @@ -0,0 +1,74 @@ +## Threat Model for resolve (module path resolution library) + +### 1. Library Overview + +- **Library Name:** resolve +- **Brief Description:** Implements Node.js `require.resolve()` algorithm for synchronous and asynchronous file path resolution. Used to locate modules and files in Node.js projects. +- **Key Public APIs/Functions:** `resolve.sync()` / `resolve/sync`, `resolve()` / `resolve/async` + +### 2. Define Scope + +This threat model focuses on the core path resolution algorithm, including filesystem interaction, option handling, and cache management. + +### 3. Conceptual System Diagram + +``` +Caller Application → resolve(id, options) → Resolution Algorithm → File System + │ + └→ Options Handling + └→ Cache System +``` + +**Trust Boundaries:** +- **Input module IDs:** May come from untrusted sources (user input, configuration) +- **Filesystem access:** The library interacts with the filesystem to resolve paths +- **Options:** Provided by the caller +- **Cache:** Used to improve performance, but could be a vector for tampering or information disclosure if not handled securely + +### 4. Identify Assets + +- **Integrity of resolution output:** Ensure correct and safe file path matching. +- **Confidentiality of configuration:** Prevent sensitive path information from being leaked. +- **Availability/performance for host application:** Prevent crashes or resource exhaustion. +- **Security of host application:** Prevent path traversal or unintended filesystem access. +- **Reputation of library:** Maintain trust by avoiding supply chain attacks and vulnerabilities[1][3][4]. + +### 5. Identify Threats + +| Component / API / Interaction | S | T | R | I | D | E | +|-----------------------------------------------------|----|----|----|----|----|----| +| Public API Call (`resolve/async`, `resolve/sync`) | ✓ | ✓ | – | ✓ | – | – | +| Filesystem Access | – | ✓ | – | ✓ | ✓ | – | +| Options Handling | ✓ | ✓ | – | ✓ | – | – | +| Cache System | – | ✓ | – | ✓ | – | – | + +**Key Threats:** +- **Spoofing:** Malicious module IDs mimicking legitimate packages, or spoofing configuration options[1]. +- **Tampering:** Caller-provided paths altering resolution order, or cache tampering leading to incorrect results[1][4]. +- **Information Disclosure:** Error messages revealing filesystem structure or sensitive paths[1]. +- **Denial of Service:** Recursive or excessive resolution exhausting filesystem handles or causing application crashes[1]. +- **Path Traversal:** Malicious input allowing access to files outside the intended directory[4]. + +### 6. Mitigation/Countermeasures + +| Threat Identified | Proposed Mitigation | +|--------------------------------------------|---------------------| +| Spoofing (malicious module IDs/config) | Sanitize input IDs; validate against known patterns; restrict `basedir` to app-controlled paths[1][4]. | +| Tampering (path traversal, cache) | Validate input IDs for directory escapes; secure cache reads/writes; restrict cache to trusted sources[1][4]. | +| Information Disclosure (error messages) | Generic "not found" errors without internal paths; avoid exposing sensitive configuration in errors[1]. | +| Denial of Service (resource exhaustion) | Limit recursive resolution depth; implement timeout; monitor for excessive filesystem operations[1]. | + +### 7. Risk Ranking + +- **High:** Path traversal via malicious IDs (if not properly mitigated) +- **Medium:** Cache tampering or spoofing (if cache is not secured) +- **Low:** Information disclosure in errors (if error handling is generic) + +### 8. Next Steps & Review + +1. **Implement input sanitization for module IDs and configuration.** +2. **Add resolution depth limiting and timeout.** +3. **Audit cache handling for race conditions and tampering.** +4. **Regularly review dependencies for vulnerabilities.** +5. **Keep documentation and threat model up to date.** +6. **Monitor for new threats as the ecosystem and library evolve[1][3].** diff --git a/node_modules/resolve/LICENSE b/node_modules/resolve/LICENSE new file mode 100644 index 000000000..ff4fce28a --- /dev/null +++ b/node_modules/resolve/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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/SECURITY.md b/node_modules/resolve/SECURITY.md new file mode 100644 index 000000000..ad2dc5b51 --- /dev/null +++ b/node_modules/resolve/SECURITY.md @@ -0,0 +1,11 @@ +# Security + +Please file a private vulnerability via GitHub, email [@ljharb](https://github.com/ljharb), or see https://tidelift.com/security if you have a potential security vulnerability to report. + +## Incident Response + +See our [Incident Response Process](.github/INCIDENT_RESPONSE_PROCESS.md). + +## Threat Model + +See [THREAT_MODEL.md](./THREAT_MODEL.md). diff --git a/node_modules/resolve/async.js b/node_modules/resolve/async.js new file mode 100644 index 000000000..f38c5813e --- /dev/null +++ b/node_modules/resolve/async.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/async'); diff --git a/node_modules/resolve/example/async.js b/node_modules/resolve/example/async.js new file mode 100644 index 000000000..20e65dc28 --- /dev/null +++ b/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/node_modules/resolve/example/sync.js b/node_modules/resolve/example/sync.js new file mode 100644 index 000000000..54b2cc100 --- /dev/null +++ b/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/node_modules/resolve/index.js b/node_modules/resolve/index.js new file mode 100644 index 000000000..125d81464 --- /dev/null +++ b/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/node_modules/resolve/package.json b/node_modules/resolve/package.json new file mode 100644 index 000000000..87563b388 --- /dev/null +++ b/node_modules/resolve/package.json @@ -0,0 +1,75 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.22.11", + "repository": { + "type": "git", + "url": "ssh://github.com/browserify/resolve.git" + }, + "bin": { + "resolve": "./bin/resolve" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated && cp node_modules/is-core-module/core.json ./lib/ ||:", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'", + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", + "tests-only": "tape test/*.js", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "npm run test:multirepo && npx npm@'>= 10.2' audit --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.2.0", + "array.prototype.map": "^1.0.8", + "copy-dir": "^1.3.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "mv": "^2.1.1", + "npmignore": "^0.3.1", + "object-keys": "^1.1.1", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.1", + "tap": "0.4.13", + "tape": "^5.9.0", + "tmp": "^0.0.31" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "appveyor.yml", + "test/resolver/malformed_package_json", + "test/list-exports" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/resolve/readme.markdown b/node_modules/resolve/readme.markdown new file mode 100644 index 000000000..ad34d60dd --- /dev/null +++ b/node_modules/resolve/readme.markdown @@ -0,0 +1,301 @@ +# resolve [![Version Badge][2]][1] + +implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +asynchronously resolve: + +```js +var resolve = require('resolve/async'); // or, require('resolve') +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +```js +var resolve = require('resolve/sync'); // or, `require('resolve').sync +var res = resolve('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +```js +var resolve = require('resolve'); +var async = require('resolve/async'); +var sync = require('resolve/sync'); +``` + +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.isDirectory - function to asynchronously test whether a file exists and is a directory + +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified + * pkgfile - path to package.json + * cb - callback + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * pkgfile - path to package.json + * dir - directory that contains package.json + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFile: fs.readFile, + isFile: function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + isDirectory: function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + realpath: function realpath(file, cb) { + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFileSync - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* opts.isDirectory - function to synchronously test whether a file exists and is a directory + +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified + * pkgfile - path to package.json + +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2) + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFileSync: fs.readFileSync, + isFile: function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }, + isDirectory: function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); + }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +# install + +With [npm](https://npmjs.org) do: + +```sh +npm install resolve +``` + +# license + +MIT + +[1]: https://npmjs.org/package/resolve +[2]: https://versionbadg.es/browserify/resolve.svg +[5]: https://david-dm.org/browserify/resolve.svg +[6]: https://david-dm.org/browserify/resolve +[7]: https://david-dm.org/browserify/resolve/dev-status.svg +[8]: https://david-dm.org/browserify/resolve#info=devDependencies +[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/resolve.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/resolve.svg +[downloads-url]: https://npm-stat.com/charts.html?package=resolve +[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/browserify/resolve/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve +[actions-url]: https://github.com/browserify/resolve/actions diff --git a/node_modules/resolve/sync.js b/node_modules/resolve/sync.js new file mode 100644 index 000000000..cd0ee0401 --- /dev/null +++ b/node_modules/resolve/sync.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/sync'); diff --git a/node_modules/resolve/test/core.js b/node_modules/resolve/test/core.js new file mode 100644 index 000000000..a477adc5c --- /dev/null +++ b/node_modules/resolve/test/core.js @@ -0,0 +1,88 @@ +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); + +var resolve = require('../'); + +var brokenNode = semver.satisfies(process.version, '11.11 - 11.13'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + + st.ok(!resolve.isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + // note: this must be require, not require.resolve, due to https://github.com/nodejs/node/issues/43274 + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + t.comment(mod + ': ' + resolve.core[mod]); + if (resolve.core[mod]) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else if (brokenNode) { + st.ok(true, 'this version of node is broken: attempting to require things that fail to resolve breaks "home_paths" tests'); + } else { + st.throws(requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + var blacklist = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (blacklist.indexOf(mod) === -1) { + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/resolve/test/dotdot.js b/node_modules/resolve/test/dotdot.js new file mode 100644 index 000000000..30806659b --- /dev/null +++ b/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 000000000..67f2534eb --- /dev/null +++ b/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/node_modules/resolve/test/dotdot/index.js b/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 000000000..643f9fcc6 --- /dev/null +++ b/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/node_modules/resolve/test/faulty_basedir.js b/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 000000000..5f2141a67 --- /dev/null +++ b/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var path = require('path'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(!!err, true); + }); +}); + +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { + t.plan(2); + + var opts = { + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), + preserveSymlinks: false + }; + + var module = './dotdot/abc'; + + resolve(module, opts, function (err, res) { + t.equal(err.code, 'MODULE_NOT_FOUND'); + t.equal(res, undefined); + }); +}); diff --git a/node_modules/resolve/test/filter.js b/node_modules/resolve/test/filter.js new file mode 100644 index 000000000..8f8cccdb2 --- /dev/null +++ b/node_modules/resolve/test/filter.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg, pkgfile) { + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = [pkg, pkgfile]; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + var packageFile = packageFilterArgs[1]; + t.equal( + packageFile, + path.join(dir, 'baz/package.json'), + 'second packageFilter argument is "pkgfile"' + ); + + t.end(); + }); +}); diff --git a/node_modules/resolve/test/filter_sync.js b/node_modules/resolve/test/filter_sync.js new file mode 100644 index 000000000..8a43b9818 --- /dev/null +++ b/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,33 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + var res = resolve.sync('./baz', { + basedir: dir, + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef + return pkg; + } + }); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + if (!'is 1.x') { // eslint-disable-line no-constant-condition + var packageFile = packageFilterArgs[1]; + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); + } + + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition + // eslint-disable-next-line no-constant-condition + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); + + t.end(); +}); diff --git a/node_modules/resolve/test/home_paths.js b/node_modules/resolve/test/home_paths.js new file mode 100644 index 000000000..3b8c9b32c --- /dev/null +++ b/node_modules/resolve/test/home_paths.js @@ -0,0 +1,127 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../async'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazPkg = { name: 'baz', main: 'quux.js' }; + var dotMainPkg = { main: 'index' }; + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + var dotSlashMainPkg = { main: 'index' }; + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('dot_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_main`'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + s2t.deepEqual(pkg, dotMainPkg); + }); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(3); + + resolve('dot_slash_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_slash_main`'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + s2t.deepEqual(pkg, dotSlashMainPkg); + }); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('baz', function (err, res, pkg) { + s2t.error(err, 'no error resolving `baz`'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + s2t.deepEqual(pkg, bazPkg); + }); + }); + }); + }); + }); +}); diff --git a/node_modules/resolve/test/home_paths_sync.js b/node_modules/resolve/test/home_paths_sync.js new file mode 100644 index 000000000..5d2c56fd3 --- /dev/null +++ b/node_modules/resolve/test/home_paths_sync.js @@ -0,0 +1,114 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../sync'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_main'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_slash_main'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('baz'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + }); + }); + }); + }); +}); diff --git a/node_modules/resolve/test/mock.js b/node_modules/resolve/test/mock.js new file mode 100644 index 000000000..611627549 --- /dev/null +++ b/node_modules/resolve/test/mock.js @@ -0,0 +1,315 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('symlinked', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + cb(null, resolved); + return; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + cb(null, path.join(dir, 'symlinked', base)); + } else { + cb(null, path.join(resolved, 'symlinked')); + } + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); +}); + +test('readPackage', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + t.test('with readFile', function (st) { + st.plan(3); + + resolve('bar', opts('/foo'), function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + st.equal(pkg && pkg.main, './baz.js'); + }); + }); + + var readPackage = function (readFile, file, cb) { + var barPackage = path.join('bar', 'package.json'); + if (file.slice(-barPackage.length) === barPackage) { + cb(null, { main: './something-else.js' }); + } else { + cb(null, JSON.parse(files[path.resolve(file)])); + } + }; + + t.test('with readPackage', function (st) { + st.plan(3); + + var options = opts('/foo'); + delete options.readFile; + options.readPackage = readPackage; + resolve('bar', options, function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); + st.equal(pkg && pkg.main, './something-else.js'); + }); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackage = readPackage; + resolve('bar', options, function (err) { + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); + }); + }); +}); diff --git a/node_modules/resolve/test/mock_sync.js b/node_modules/resolve/test/mock_sync.js new file mode 100644 index 000000000..c5a7e2a98 --- /dev/null +++ b/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,214 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); + +test('symlinked', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + return resolved; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + return path.join(dir, 'symlinked', base); + } + return path.join(resolved, 'symlinked'); + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); +}); + +test('readPackageSync', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir, useReadPackage) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: useReadPackage ? null : function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + t.test('with readFile', function (st) { + st.plan(1); + + st.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); + }); + + var readPackageSync = function (readFileSync, file) { + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { + return { main: './something-else.js' }; + } + return JSON.parse(files[path.resolve(file)]); + }; + + t.test('with readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + delete options.readFileSync; + options.readPackageSync = readPackageSync; + + st.equal( + resolve.sync('bar', options), + path.resolve('/foo/node_modules/bar/something-else.js') + ); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackageSync = readPackageSync; + st.throws( + function () { resolve.sync('bar', options); }, + TypeError, + 'errors when both readFile and readPackage are provided' + ); + }); +}); + diff --git a/node_modules/resolve/test/module_dir.js b/node_modules/resolve/test/module_dir.js new file mode 100644 index 000000000..b50e5bb17 --- /dev/null +++ b/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 000000000..dd7cf7b2d --- /dev/null +++ b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 000000000..ef2d4d4bf --- /dev/null +++ b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 000000000..e8ba62993 --- /dev/null +++ b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 000000000..c13b8cf6a --- /dev/null +++ b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/node_modules/resolve/test/node-modules-paths.js b/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 000000000..675441db2 --- /dev/null +++ b/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,143 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + if (paths) { + for (var k = 0; k < paths.length; ++k) { + moduleDirs.push(path.basename(paths[k])); + } + } + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths=array option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with paths=function option', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); + }; + + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); + + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); + + t.end(); + }); + + t.test('with paths=function skipping node modules resolution', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return []; + }; + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }); + t.deepEqual(dirs, [], 'no node_modules was computed'); + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); + + t.test('combine paths correctly on Windows', function (t) { + var start = 'C:\\Users\\username\\myProject\\src'; + var paths = []; + var moduleDirectories = ['node_modules', start]; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); + + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { + var start = '/Users/username/git/myProject/src'; + var paths = []; + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); +}); diff --git a/node_modules/resolve/test/node_path.js b/node_modules/resolve/test/node_path.js new file mode 100644 index 000000000..e463d6c8c --- /dev/null +++ b/node_modules/resolve/test/node_path.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(8); + + var isDir = function (dir, cb) { + if (dir === '/node_path' || dir === 'node_path/x') { + return cb(null, true); + } + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); + }); + + // ensure that relative paths still resolve against the regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: path.join(__dirname, 'node_path/x'), + isDirectory: isDir + }, function (err, res) { + var root = require('tap/package.json').main; // eslint-disable-line global-require + t.error(err); + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); + }); +}); diff --git a/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 000000000..ad70d0bb0 --- /dev/null +++ b/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 000000000..a64132e4c --- /dev/null +++ b/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 000000000..4d0f32e24 --- /dev/null +++ b/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 000000000..793315e84 --- /dev/null +++ b/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/node_modules/resolve/test/nonstring.js b/node_modules/resolve/test/nonstring.js new file mode 100644 index 000000000..ef63c40f9 --- /dev/null +++ b/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/resolve/test/pathfilter.js b/node_modules/resolve/test/pathfilter.js new file mode 100644 index 000000000..16519aeae --- /dev/null +++ b/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,75 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + +var pathFilterFactory = function (t) { + return function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; +}; + +test('#62: deep module references and the pathFilter', function (t) { + t.test('deep/ref.js', function (st) { + st.plan(3); + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) st.fail(err); + + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + var res = resolve.sync('deep/ref', { basedir: resolverDir }); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + t.test('deep/deeper/ref', function (st) { + st.plan(4); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + st.notEqual(pkg, undefined); + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + var res = resolve.sync( + 'deep/deeper/ref', + { basedir: resolverDir } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + }); + + t.test('deep/ref alt', function (st) { + st.plan(8); + + var pathFilter = pathFilterFactory(st); + + var res = resolve.sync( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) st.fail(err); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + st.end(); + } + ); + }); + + t.end(); +}); diff --git a/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/precedence.js b/node_modules/resolve/test/precedence.js new file mode 100644 index 000000000..2febb598f --- /dev/null +++ b/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/resolve/test/precedence/aaa.js b/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 000000000..b83a3e7ad --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 000000000..e0f8f6abf --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 000000000..93542a965 --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/node_modules/resolve/test/precedence/bbb.js b/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 000000000..2298f47fd --- /dev/null +++ b/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 000000000..716b81d4b --- /dev/null +++ b/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/node_modules/resolve/test/resolver.js b/node_modules/resolve/test/resolver.js new file mode 100644 index 000000000..df8211af3 --- /dev/null +++ b/node_modules/resolve/test/resolver.js @@ -0,0 +1,597 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var resolve = require('../'); +var async = require('../async'); + +test('`./async` entry point', function (t) { + t.equal(resolve, async, '`./async` entry point is the same as `main`'); + t.end(); +}); + +test('async foo', function (t) { + t.plan(12); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg.main, 'bar'); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, 'grux'); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'tiv'); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(5); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('path iterator', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'baz/quux.js')); + t.equal(pkg && pkg.name, 'baz'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('missing index', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + resolve('./missing_index', { basedir: resolverDir }, function (err, res, pkg) { + t.ok(err instanceof Error); + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('missing main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./missing_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('null main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./null_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('main: false', function (t) { + t.plan(2); + + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + resolve('./false_main', { basedir: basedir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal( + res, + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + t.deepEqual(pkg, { + name: 'false_main', + main: false + }); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); + + resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('not a directory', function (t) { + t.plan(6); + var path = './foo'; + resolve(path, { basedir: __filename }, function (err, res, pkg) { + t.ok(err, 'a non-directory errors'); + t.equal(arguments.length, 1); + t.equal(res, undefined); + t.equal(pkg, undefined); + + t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('browser field in package.json', function (t) { + t.plan(3); + + var dir = path.join(__dirname, 'resolver'); + resolve( + './browser_field', + { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.equal(pkg && pkg.main, 'b'); + t.equal(pkg && pkg.browser, undefined); + } + ); +}); + +test('absolute paths', function (t) { + t.plan(4); + + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + resolve(__filename, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file resolves' + ); + }); + resolve(extensionless, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file resolves' + ); + }); + resolve(__filename, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file with a basedir resolves' + ); + }); + resolve(extensionless, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + }); +}); + +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { + /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ + t.plan( + (3 * 3) // 3 sets of 3 assertions in the final callback + + 2 // 1 readPackage call with malformed package.json + ); + + var basedir = malformedDir; + var expected = path.join(basedir, 'index.js'); + + resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { + t.error(err, 'no error'); + t.equal(res, expected, 'malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument'); + }); + + resolve( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + }, + function (err, res, pkg) { + t.error(err, 'with packageFilter: no error'); + t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument'); + } + ); + + resolve( + './index.js', + { + basedir: basedir, + readPackage: function (readFile, pkgfile, cb) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + readFile(pkgfile, function (err, result) { + try { + cb(null, JSON.parse(result)); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error'); + cb(null); + } + }); + } + }, + function (err, res, pkg) { + t.error(err, 'with readPackage: no error'); + t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument'); + } + ); +}); diff --git a/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/baz/package.json b/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 000000000..2f77720b8 --- /dev/null +++ b/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,4 @@ +{ + "name": "baz", + "main": "quux.js" +} diff --git a/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 000000000..bd816eaba --- /dev/null +++ b/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/browser_field/a.js b/node_modules/resolve/test/resolver/browser_field/a.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/browser_field/b.js b/node_modules/resolve/test/resolver/browser_field/b.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/browser_field/package.json b/node_modules/resolve/test/resolver/browser_field/package.json new file mode 100644 index 000000000..bf406f083 --- /dev/null +++ b/node_modules/resolve/test/resolver/browser_field/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser_field", + "main": "a", + "browser": "b" +} diff --git a/node_modules/resolve/test/resolver/cup.coffee b/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/node_modules/resolve/test/resolver/dot_main/index.js b/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 000000000..bd816eaba --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_main/package.json b/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 000000000..d7f4fc807 --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/node_modules/resolve/test/resolver/dot_slash_main/index.js b/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 000000000..bd816eaba --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_slash_main/package.json b/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 000000000..f51287b9d --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/node_modules/resolve/test/resolver/false_main/index.js b/node_modules/resolve/test/resolver/false_main/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/false_main/package.json b/node_modules/resolve/test/resolver/false_main/package.json new file mode 100644 index 000000000..a7416c0c7 --- /dev/null +++ b/node_modules/resolve/test/resolver/false_main/package.json @@ -0,0 +1,4 @@ +{ + "name": "false_main", + "main": false +} diff --git a/node_modules/resolve/test/resolver/foo.js b/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 000000000..bd816eaba --- /dev/null +++ b/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 000000000..bc1fb0a6f --- /dev/null +++ b/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 000000000..b71880417 --- /dev/null +++ b/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/node_modules/resolve/test/resolver/invalid_main/package.json b/node_modules/resolve/test/resolver/invalid_main/package.json new file mode 100644 index 000000000..059074864 --- /dev/null +++ b/node_modules/resolve/test/resolver/invalid_main/package.json @@ -0,0 +1,7 @@ +{ + "name": "invalid_main", + "main": [ + "why is this a thing", + "srsly omg wtf" + ] +} diff --git a/node_modules/resolve/test/resolver/mug.coffee b/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/mug.js b/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/multirepo/lerna.json b/node_modules/resolve/test/resolver/multirepo/lerna.json new file mode 100644 index 000000000..d6707ca0c --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/lerna.json @@ -0,0 +1,6 @@ +{ + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/node_modules/resolve/test/resolver/multirepo/package.json b/node_modules/resolve/test/resolver/multirepo/package.json new file mode 100644 index 000000000..4391d392e --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/package.json @@ -0,0 +1,20 @@ +{ + "name": "ljharb-monorepo-symlink-test", + "private": true, + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "postinstall": "lerna bootstrap", + "test": "node packages/package-a" + }, + "author": "", + "license": "MIT", + "dependencies": { + "jquery": "^3.3.1", + "resolve": "../../../" + }, + "devDependencies": { + "lerna": "^3.4.3" + } +} diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js new file mode 100644 index 000000000..8875a32df --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var assert = require('assert'); +var path = require('path'); +var resolve = require('resolve'); + +var basedir = __dirname + '/node_modules/@my-scope/package-b'; + +var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); + +/* + * preserveSymlinks === false + * will search NPM package from + * - packages/package-b/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); +assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); + +/* + * preserveSymlinks === true + * will search NPM package from + * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules + * - packages/package-a/node_modules/@my-scope/packages/node_modules + * - packages/package-a/node_modules/@my-scope/node_modules + * - packages/package-a/node_modules/node_modules + * - packages/package-a/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); +assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); + +console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json new file mode 100644 index 000000000..204de51e0 --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-a", + "version": "0.0.0", + "private": true, + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-b": "^0.0.0" + } +} diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json new file mode 100644 index 000000000..f57c3b5f5 --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-b", + "private": true, + "version": "0.0.0", + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-a": "^0.0.0" + } +} diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js new file mode 100644 index 000000000..9b4846a82 --- /dev/null +++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js @@ -0,0 +1,26 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b; +var c; + +var test = function test() { + console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); + console.log(b, ': preserveSymlinks true'); + console.log(c, ': preserveSymlinks false'); + + if (a !== b && a !== c) { + throw 'async: no match'; + } + console.log('async: success! a matched either b or c\n'); +}; + +require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { + if (err) { throw err; } + b = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); +require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { + if (err) { throw err; } + c = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); + diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json new file mode 100644 index 000000000..acfe9e951 --- /dev/null +++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json @@ -0,0 +1,15 @@ +{ + "name": "mylib", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "buffer": "*" + } +} diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js new file mode 100644 index 000000000..3283efc2e --- /dev/null +++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js @@ -0,0 +1,12 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); +var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); + +console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); +console.log(b, ': preserveSymlinks true'); +console.log(c, ': preserveSymlinks false'); + +if (a !== b && a !== c) { + throw 'sync: no match'; +} +console.log('sync: success! a matched either b or c\n'); diff --git a/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 000000000..bd816eaba --- /dev/null +++ b/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/same_names/foo.js b/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 000000000..888cae37a --- /dev/null +++ b/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/node_modules/resolve/test/resolver/same_names/foo/index.js b/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 000000000..bd816eaba --- /dev/null +++ b/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/resolver/symlinked/package/bar.js b/node_modules/resolve/test/resolver/symlinked/package/bar.js new file mode 100644 index 000000000..cb1c2c01e --- /dev/null +++ b/node_modules/resolve/test/resolver/symlinked/package/bar.js @@ -0,0 +1 @@ +module.exports = 'bar'; diff --git a/node_modules/resolve/test/resolver/symlinked/package/package.json b/node_modules/resolve/test/resolver/symlinked/package/package.json new file mode 100644 index 000000000..8e1b58591 --- /dev/null +++ b/node_modules/resolve/test/resolver/symlinked/package/package.json @@ -0,0 +1,3 @@ +{ + "main": "bar.js" +} \ No newline at end of file diff --git a/node_modules/resolve/test/resolver/without_basedir/main.js b/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 000000000..5b31975be --- /dev/null +++ b/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/node_modules/resolve/test/resolver_sync.js b/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 000000000..a6df8ced4 --- /dev/null +++ b/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,730 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); + +var resolve = require('../'); +var sync = require('../sync'); + +var requireResolveSupportsPaths = require.resolve.length > 1 + && !(/^v12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794 + +var requireResolveDefaultPathsBroken = (/^v8\.9\.|^v9\.[01]\.0|^v9\.2\./).test(process.version); +// broken in node v8.9.x, v9.0, v9.1, v9.2.x. see https://github.com/nodejs/node/pull/17113 + +test('`./sync` entry point', function (t) { + t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`'); + t.end(); +}); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: dir }), + require.resolve('./foo', { paths: [dir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + require.resolve('./foo.js', { paths: [dir] }), + './foo.js: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + // Test that filename is reported as the "from" value when passed. + t.throws( + function () { + resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); + }, + { + name: 'Error', + message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" + } + ); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + var basedir = path.join(dir, 'bar'); + + t.equal( + resolve.sync('foo', { basedir: basedir }), + path.join(dir, 'bar/node_modules/foo/index.js'), + 'foo in bar' + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('foo', { basedir: basedir }), + require.resolve('foo', { paths: [basedir] }), + 'foo in bar: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js'), + './baz' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./baz', { basedir: dir }), + require.resolve('./baz', { paths: [dir] }), + './baz: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./grux', { basedir: dir }), + require.resolve('./grux', { paths: [dir] }), + './grux: resolve.sync === require.resolve' + ); + } + + var tivDir = path.join(dir, 'grux'); + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + path.join(dir, 'tiv/index.js') + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + require.resolve('tiv', { paths: [tivDir] }), + 'tiv: resolve.sync === require.resolve' + ); + } + + var gruxDir = path.join(dir, 'tiv'); + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + path.join(dir, 'grux/index.js') + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + require.resolve('grux', { paths: [gruxDir] }), + 'grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('../grux', { basedir: dir }), + require.resolve('../grux', { paths: [dir] }), + '../grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee'), + './cup -> ./cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee'), + './cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }), + require.resolve('./cup.coffee', { paths: [dir] }), + './cup.coffee: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./mug', { basedir: dir }), + require.resolve('./mug', { paths: [dir] }), + './mug: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee'), + './mug -> ./mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('path iterator', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + t.equal( + resolve.sync('baz', { packageIterator: exactIterator }), + path.join(resolverDir, 'baz/quux.js') + ); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + require.resolve('./incorrect_main', { paths: [resolverDir] }), + './incorrect_main: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('missing index', function (t) { + t.plan(requireResolveSupportsPaths ? 2 : 1); + + var resolverDir = path.join(__dirname, 'resolver'); + try { + resolve.sync('./missing_index', { basedir: resolverDir }); + t.fail('did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + require.resolve('./missing_index', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } +}); + +test('missing main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('null main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('main: false', function (t) { + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + require.resolve('./false_main', { paths: [basedir] }), + '`"main": false`: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names'); + + t.equal( + resolve.sync('./foo', { basedir: basedir }), + path.join(dir, 'same_names/foo.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: basedir }), + require.resolve('./foo', { paths: [basedir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + require.resolve('./foo/', { paths: [basedir] }), + './foo/: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names/foo'); + + t.equal( + resolve.sync('./', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + './' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./', { basedir: basedir }), + require.resolve('./', { paths: [basedir] }), + './: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('.', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + '.' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('.', { basedir: basedir }), + require.resolve('.', { paths: [basedir] }), + '.: resolve.sync === require.resolve', + { todo: true } + ); + } + + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.equal( + resolve.sync('./' + testFile), + require.resolve('./' + testFile), + 'sanity check: resolve.sync === require.resolve' + ); + + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_main'), + path.join(__dirname, 'resolver/dot_main/index.js'), + './resolver/dot_main' + ); + t.equal( + resolve.sync('./resolver/dot_main'), + require.resolve('./resolver/dot_main'), + './resolver/dot_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_slash_main'), + path.join(__dirname, 'resolver/dot_slash_main/index.js') + ); + t.equal( + resolve.sync('./resolver/dot_slash_main'), + require.resolve('./resolver/dot_slash_main'), + './resolver/dot_slash_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('not a directory', function (t) { + var path = './foo'; + try { + resolve.sync(path, { basedir: __filename }); + t.fail(); + } catch (err) { + t.ok(err, 'a non-directory errors'); + t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('browser field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./browser_field', { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.end(); +}); + +test('absolute paths', function (t) { + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + t.equal( + resolve.sync(__filename), + __filename, + 'absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(extensionless), + __filename, + 'extensionless absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + __filename, + 'absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + require.resolve(__filename, { paths: [process.cwd()] }), + 'absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + require.resolve(extensionless, { paths: [process.cwd()] }), + 'extensionless absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { + t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); + + var basedir = malformedDir; + var expected = path.join(basedir, 'index.js'); + + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + expected, + 'malformed package.json is silently ignored' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + require.resolve('./index.js', { paths: [basedir] }), + 'malformed package.json: resolve.sync === require.resolve' + ); + } + + var res1 = resolve.sync( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + } + ); + + t.equal( + res1, + expected, + 'with packageFilter: malformed package.json is silently ignored' + ); + + var res2 = resolve.sync( + './index.js', + { + basedir: basedir, + readPackageSync: function (readFileSync, pkgfile) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + var result = String(readFileSync(pkgfile)); + try { + return JSON.parse(result); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error'); + } + } + } + ); + + t.equal( + res2, + expected, + 'with readPackageSync: malformed package.json is silently ignored' + ); +}); diff --git a/node_modules/resolve/test/shadowed_core.js b/node_modules/resolve/test/shadowed_core.js new file mode 100644 index 000000000..3a5f4fcff --- /dev/null +++ b/node_modules/resolve/test/shadowed_core.js @@ -0,0 +1,54 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('shadowed core modules still return core module', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, 'util'); + }); +}); + +test('shadowed core modules still return core module [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, 'util'); +}); + +test('shadowed core modules return shadow when appending `/`', function (t) { + t.plan(2); + + resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow when appending `/` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/node_modules/resolve/test/shadowed_core/node_modules/util/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/node_modules/resolve/test/subdirs.js b/node_modules/resolve/test/subdirs.js new file mode 100644 index 000000000..b7b8450a9 --- /dev/null +++ b/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/node_modules/resolve/test/symlinks.js b/node_modules/resolve/test/symlinks.js new file mode 100644 index 000000000..35f881afb --- /dev/null +++ b/node_modules/resolve/test/symlinks.js @@ -0,0 +1,176 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var map = require('array.prototype.map'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); +var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); +var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.unlinkSync(packageDir); +} catch (err) {} +try { + fs.unlinkSync(modADir); +} catch (err) {} +try { + fs.unlinkSync(symlinkModADir); +} catch (err) {} + +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} +try { + fs.symlinkSync('../../package', packageDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); +} +try { + fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); +} + +test('symlink', function (t) { + t.plan(2); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + t.error(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +test('sync symlink', function (t) { + var start = new Date(); + t.doesNotThrow(function () { + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); + }); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); + +test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); + + t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + t.end(); +}); + +test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + t.plan(2); + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { + t.notOk(err, 'no error'); + t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + }); +}); + +test('packageFilter', function (t) { + function relative(x) { + return path.relative(__dirname, x); + } + + function testPackageFilter(preserveSymlinks) { + return function (st) { + st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition + + var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; + var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; + var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; + var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; + var destDir = path.join(__dirname, 'symlinks', 'dest'); + + /* eslint multiline-comment-style: 0 */ + /* v2.x will restore these tests + var packageFilterPath = []; + var actualPath = resolve.sync('mod-a', { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile, dir) { + packageFilterPath.push(pkgfile); + } + }); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'sync: actual path is correct' + ); + st.deepEqual( + map(packageFilterPath, relative), + map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), + 'sync: packageFilter pkgfile arg is correct' + ); + */ + + var asyncPackageFilterPath = []; + resolve( + 'mod-a', + { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile) { + asyncPackageFilterPath.push(pkgfile); + } + }, + function (err, actualPath) { + st.error(err, 'no error'); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'async: actual path is correct' + ); + st.deepEqual( + map(asyncPackageFilterPath, relative), + map( + preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], + path.normalize + ), + 'async: packageFilter pkgfile arg is correct' + ); + } + ); + }; + } + + t.test('preserveSymlinks: false', testPackageFilter(false)); + + t.test('preserveSymlinks: true', testPackageFilter(true)); + + t.end(); +}); diff --git a/node_modules/ret/LICENSE b/node_modules/ret/LICENSE new file mode 100644 index 000000000..b351ee8e9 --- /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 000000000..28563e16d --- /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/package.json b/node_modules/ret/package.json new file mode 100644 index 000000000..2fde9a44e --- /dev/null +++ b/node_modules/ret/package.json @@ -0,0 +1,35 @@ +{ + "name": "ret", + "description": "Tokenizes a string that represents a regular expression.", + "keywords": [ + "regex", + "regexp", + "regular expression", + "parser", + "tokenizer" + ], + "version": "0.1.15", + "repository": { + "type": "git", + "url": "git://github.com/fent/ret.js.git" + }, + "author": "Roly Fentanes (https://github.com/fent)", + "main": "./lib/index.js", + "files": [ + "lib" + ], + "scripts": { + "test": "istanbul cover vows -- --spec test/*-test.js" + }, + "directories": { + "lib": "./lib" + }, + "devDependencies": { + "istanbul": "*", + "vows": "*" + }, + "engines": { + "node": ">=0.12" + }, + "license": "MIT" +} diff --git a/node_modules/rimraf/LICENSE b/node_modules/rimraf/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/rimraf/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/rimraf/README.md b/node_modules/rimraf/README.md new file mode 100644 index 000000000..423b8cf85 --- /dev/null +++ b/node_modules/rimraf/README.md @@ -0,0 +1,101 @@ +[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) + +The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. + +Install with `npm install rimraf`, or just drop rimraf.js somewhere. + +## API + +`rimraf(f, [opts], callback)` + +The first parameter will be interpreted as a globbing pattern for files. If you +want to disable globbing you can do so with `opts.disableGlob` (defaults to +`false`). This might be handy, for instance, if you have filenames that contain +globbing wildcard characters. + +The callback will be called with an error if there is one. Certain +errors are handled for you: + +* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of + `opts.maxBusyTries` times before giving up, adding 100ms of wait + between each attempt. The default `maxBusyTries` is 3. +* `ENOENT` - If the file doesn't exist, rimraf will return + successfully, since your desired outcome is already the case. +* `EMFILE` - Since `readdir` requires opening a file descriptor, it's + possible to hit `EMFILE` if too many file descriptors are in use. + In the sync case, there's nothing to be done for this. But in the + async case, rimraf will gradually back off with timeouts up to + `opts.emfileWait` ms, which defaults to 1000. + +## options + +* unlink, chmod, stat, lstat, rmdir, readdir, + unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync + + In order to use a custom file system library, you can override + specific fs functions on the options object. + + If any of these functions are present on the options object, then + the supplied function will be used instead of the default fs + method. + + Sync methods are only relevant for `rimraf.sync()`, of course. + + For example: + + ```javascript + var myCustomFS = require('some-custom-fs') + + rimraf('some-thing', myCustomFS, callback) + ``` + +* maxBusyTries + + If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered + on Windows systems, then rimraf will retry with a linear backoff + wait of 100ms longer on each try. The default maxBusyTries is 3. + + Only relevant for async usage. + +* emfileWait + + If an `EMFILE` error is encountered, then rimraf will retry + repeatedly with a linear backoff of 1ms longer on each try, until + the timeout counter hits this max. The default limit is 1000. + + If you repeatedly encounter `EMFILE` errors, then consider using + [graceful-fs](http://npm.im/graceful-fs) in your program. + + Only relevant for async usage. + +* glob + + Set to `false` to disable [glob](http://npm.im/glob) pattern + matching. + + Set to an object to pass options to the glob module. The default + glob options are `{ nosort: true, silent: true }`. + + Glob version 6 is used in this module. + + Relevant for both sync and async usage. + +* disableGlob + + Set to any non-falsey value to disable globbing entirely. + (Equivalent to setting `glob: false`.) + +## rimraf.sync + +It can remove stuff synchronously, too. But that's not so good. Use +the async API. It's better. + +## CLI + +If installed with `npm install rimraf -g` it can be used as a global +command `rimraf [ ...]` which is useful for cross platform support. + +## mkdirp + +If you need to create a directory recursively, check out +[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/node_modules/rimraf/bin.js b/node_modules/rimraf/bin.js new file mode 100755 index 000000000..0d1e17be7 --- /dev/null +++ b/node_modules/rimraf/bin.js @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +var rimraf = require('./') + +var help = false +var dashdash = false +var noglob = false +var args = process.argv.slice(2).filter(function(arg) { + if (dashdash) + return !!arg + else if (arg === '--') + dashdash = true + else if (arg === '--no-glob' || arg === '-G') + noglob = true + else if (arg === '--glob' || arg === '-g') + noglob = false + else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) + help = true + else + return !!arg +}) + +if (help || args.length === 0) { + // If they didn't ask for help, then this is not a "success" + var log = help ? console.log : console.error + log('Usage: rimraf [ ...]') + log('') + log(' Deletes all files and folders at "path" recursively.') + log('') + log('Options:') + log('') + log(' -h, --help Display this usage info') + log(' -G, --no-glob Do not expand glob patterns in arguments') + log(' -g, --glob Expand glob patterns in arguments (default)') + process.exit(help ? 0 : 1) +} else + go(0) + +function go (n) { + if (n >= args.length) + return + var options = {} + if (noglob) + options = { glob: false } + rimraf(args[n], options, function (er) { + if (er) + throw er + go(n+1) + }) +} diff --git a/node_modules/rimraf/package.json b/node_modules/rimraf/package.json new file mode 100644 index 000000000..783fae92f --- /dev/null +++ b/node_modules/rimraf/package.json @@ -0,0 +1,29 @@ +{ + "name": "rimraf", + "version": "2.6.3", + "main": "rimraf.js", + "description": "A deep deletion module for node (like `rm -rf`)", + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": "git://github.com/isaacs/rimraf.git", + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags", + "test": "tap test/*.js" + }, + "bin": "./bin.js", + "dependencies": { + "glob": "^7.1.3" + }, + "files": [ + "LICENSE", + "README.md", + "bin.js", + "rimraf.js" + ], + "devDependencies": { + "mkdirp": "^0.5.1", + "tap": "^12.1.1" + } +} diff --git a/node_modules/rimraf/rimraf.js b/node_modules/rimraf/rimraf.js new file mode 100644 index 000000000..e80dd1069 --- /dev/null +++ b/node_modules/rimraf/rimraf.js @@ -0,0 +1,364 @@ +module.exports = rimraf +rimraf.sync = rimrafSync + +var assert = require("assert") +var path = require("path") +var fs = require("fs") +var glob = require("glob") +var _0666 = parseInt('666', 8) + +var defaultGlobOpts = { + nosort: true, + silent: true +} + +// for EMFILE handling +var timeout = 0 + +var isWindows = (process.platform === "win32") + +function defaults (options) { + var methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(function(m) { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 + if (options.glob === false) { + options.disableGlob = true + } + options.disableGlob = options.disableGlob || false + options.glob = options.glob || defaultGlobOpts +} + +function rimraf (p, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert.equal(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + var busyTries = 0 + var errState = null + var n = 0 + + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]) + + options.lstat(p, function (er, stat) { + if (!er) + return afterGlob(null, [p]) + + glob(p, options.glob, afterGlob) + }) + + function next (er) { + errState = errState || er + if (--n === 0) + cb(errState) + } + + function afterGlob (er, results) { + if (er) + return cb(er) + + n = results.length + if (n === 0) + return cb() + + results.forEach(function (p) { + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && + busyTries < options.maxBusyTries) { + busyTries ++ + var time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(function () { + rimraf_(p, options, CB) + }, time) + } + + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(function () { + rimraf_(p, options, CB) + }, timeout ++) + } + + // already gone + if (er.code === "ENOENT") er = null + } + + timeout = 0 + next(er) + }) + }) + } +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, function (er, st) { + if (er && er.code === "ENOENT") + return cb(null) + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb) + + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) + + options.unlink(p, function (er) { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) + assert(er instanceof Error) + + options.chmod(p, _0666, function (er2) { + if (er2) + cb(er2.code === "ENOENT" ? null : er) + else + options.stat(p, function(er3, stats) { + if (er3) + cb(er3.code === "ENOENT" ? null : er) + else if (stats.isDirectory()) + rmdir(p, options, er, cb) + else + options.unlink(p, cb) + }) + }) +} + +function fixWinEPERMSync (p, options, er) { + assert(p) + assert(options) + if (er) + assert(er instanceof Error) + + try { + options.chmodSync(p, _0666) + } catch (er2) { + if (er2.code === "ENOENT") + return + else + throw er + } + + try { + var stats = options.statSync(p) + } catch (er3) { + if (er3.code === "ENOENT") + return + else + throw er + } + + if (stats.isDirectory()) + rmdirSync(p, options, er) + else + options.unlinkSync(p) +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, function (er) { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) + else + cb(er) + }) +} + +function rmkids(p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, function (er, files) { + if (er) + return cb(er) + var n = files.length + if (n === 0) + return options.rmdir(p, cb) + var errState + files.forEach(function (f) { + rimraf(path.join(p, f), options, function (er) { + if (errState) + return + if (er) + return cb(errState = er) + if (--n === 0) + options.rmdir(p, cb) + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + var results + + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p] + } else { + try { + options.lstatSync(p) + results = [p] + } catch (er) { + results = glob.sync(p, options.glob) + } + } + + if (!results.length) + return + + for (var i = 0; i < results.length; i++) { + var p = results[i] + + try { + var st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + + // Windows can EPERM on stat. Life is suffering. + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er) + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er + + rmdirSync(p, options, er) + } + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "ENOTDIR") + throw originalEr + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options) + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(function (f) { + rimrafSync(path.join(p, f), options) + }) + + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + var retries = isWindows ? 100 : 1 + var i = 0 + do { + var threw = true + try { + var ret = options.rmdirSync(p, options) + threw = false + return ret + } finally { + if (++i < retries && threw) + continue + } + } while (true) +} diff --git a/node_modules/safe-array-concat/.eslintrc b/node_modules/safe-array-concat/.eslintrc new file mode 100644 index 000000000..fc909f1ef --- /dev/null +++ b/node_modules/safe-array-concat/.eslintrc @@ -0,0 +1,15 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "max-lines-per-function": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/safe-array-concat/.github/FUNDING.yml b/node_modules/safe-array-concat/.github/FUNDING.yml new file mode 100644 index 000000000..bbd94cdb9 --- /dev/null +++ b/node_modules/safe-array-concat/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/safe-array-concat +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/safe-array-concat/.nycrc b/node_modules/safe-array-concat/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/safe-array-concat/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/safe-array-concat/CHANGELOG.md b/node_modules/safe-array-concat/CHANGELOG.md new file mode 100644 index 000000000..07171dd43 --- /dev/null +++ b/node_modules/safe-array-concat/CHANGELOG.md @@ -0,0 +1,69 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.3](https://github.com/ljharb/safe-array-concat/compare/v1.1.2...v1.1.3) - 2024-12-11 + +### Commits + +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/tape`, `auto-changelog`, `mock-property`, `tape` [`9452ca7`](https://github.com/ljharb/safe-array-concat/commit/9452ca7dc6e22d89fb1bbf4f604d3e058a6813c0) +- [actions] split out node 10-20, and 20+ [`8166059`](https://github.com/ljharb/safe-array-concat/commit/8166059134d555337faf7574f40c746deaecfa99) +- [Deps] update `call-bind`, `get-intrinsic`, `has-symbols` [`d35014a`](https://github.com/ljharb/safe-array-concat/commit/d35014a2f8240ca70c336ef694744726b03a042b) +- [Refactor] use `call-bound` directly [`0bdddbd`](https://github.com/ljharb/safe-array-concat/commit/0bdddbdbdd887f12ecc58ee9fd1f358ec13560d3) +- [Tests] replace `aud` with `npm audit` [`c62dae0`](https://github.com/ljharb/safe-array-concat/commit/c62dae04b6eb56c460132fdd6e10de432228757e) +- [Dev Deps] add missing peer dep [`4860aae`](https://github.com/ljharb/safe-array-concat/commit/4860aae938375ae69ecf1c8d6caf58632ca57715) + +## [v1.1.2](https://github.com/ljharb/safe-array-concat/compare/v1.1.1...v1.1.2) - 2024-03-09 + +### Commits + +- [types] use a generic [`a1d744d`](https://github.com/ljharb/safe-array-concat/commit/a1d744d749033c91f0c108b28ac6dbc6016ecce4) +- [Dev Deps] update `@ljharb/tsconfig`, `set-function-length` [`3d3da0a`](https://github.com/ljharb/safe-array-concat/commit/3d3da0ab110bce21f466381c5d09f93200a20f85) + +## [v1.1.1](https://github.com/ljharb/safe-array-concat/compare/v1.1.0...v1.1.1) - 2024-03-09 + +### Commits + +- [types] use shared config [`f509f80`](https://github.com/ljharb/safe-array-concat/commit/f509f80fb2dd9734c309ccb59ca9451c5a5de885) +- [actions] remove redundant finisher; use reusable workflows [`b5f5ff4`](https://github.com/ljharb/safe-array-concat/commit/b5f5ff497976a48e291788b26b741cd4f3d388eb) +- [types] use handwritten d.ts instead of emit [`e717048`](https://github.com/ljharb/safe-array-concat/commit/e717048433b52d3a3240b7c697b5736756ed296e) +- [Dev Deps] update `set-function-length`, `tape` [`dde26a7`](https://github.com/ljharb/safe-array-concat/commit/dde26a7600ebe8ebc8f45d1bf8f1a970175604d8) +- [Deps] update `call-bind`, `get-intrinsic` [`d5d2cde`](https://github.com/ljharb/safe-array-concat/commit/d5d2cde9e5b7179d00d85e007b80b138969c5968) +- [Dev Deps] update `tape` [`9454c5a`](https://github.com/ljharb/safe-array-concat/commit/9454c5a3beacb08200b4b00b7ffa54a572cb76ab) +- [Tests] add `@arethetypeswrong/cli [`00a5243`](https://github.com/ljharb/safe-array-concat/commit/00a5243a5b923ff2b694b3b5ef4ce39027e30f6e) +- [Deps] update `get-intrinsic` [`c935764`](https://github.com/ljharb/safe-array-concat/commit/c9357646c3923a1351dca21f175b2b421dd15da5) + +## [v1.1.0](https://github.com/ljharb/safe-array-concat/compare/v1.0.1...v1.1.0) - 2024-01-15 + +### Commits + +- [New] add types [`bd92413`](https://github.com/ljharb/safe-array-concat/commit/bd92413643b2bd0ad62e854172fad129d3899dc1) +- [Dev Deps] update `aud`, `mock-property`, `npmignore`, `set-function-length`, `tape` [`497ffcb`](https://github.com/ljharb/safe-array-concat/commit/497ffcbb271ad61752756ec363ad5b9400e4d367) +- [Deps] update `call-bind`, `get-intrinsic` [`770f870`](https://github.com/ljharb/safe-array-concat/commit/770f8704d3751b947c7f4772d9ee38d8bcdecf44) +- [Dev Deps] update `mock-property`, `tape` [`be76bd9`](https://github.com/ljharb/safe-array-concat/commit/be76bd958fa73607a105122a8770677ecbdf78f0) +- [Tests] use `set-function-length/env` [`89b1167`](https://github.com/ljharb/safe-array-concat/commit/89b116758d91ad521f963cccf056f9a3f0b18c20) +- [meta] add missing npmrc values [`3185cc7`](https://github.com/ljharb/safe-array-concat/commit/3185cc7a6773baf625c65bb58ffb9b7ee5f3306e) +- [meta] add `sideEffects` flag [`df6c7eb`](https://github.com/ljharb/safe-array-concat/commit/df6c7ebca7f2fd2f152fe2c2a2260d21728e70a3) + +## [v1.0.1](https://github.com/ljharb/safe-array-concat/compare/v1.0.0...v1.0.1) - 2023-09-05 + +### Fixed + +- [Perf] set `Symbol.isConcatSpreadable` only when required [`#2`](https://github.com/ljharb/safe-array-concat/issues/2) + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`c0791b0`](https://github.com/ljharb/safe-array-concat/commit/c0791b00b74e70113921c32d4d1fd494b7e8f555) +- [Deps] update `get-intrinsic` [`7d07ae6`](https://github.com/ljharb/safe-array-concat/commit/7d07ae69d512bb3b6fb2131f1c824b5ffd85af9f) + +## v1.0.0 - 2023-04-20 + +### Commits + +- Initial implementation, tests, readme [`31b8e70`](https://github.com/ljharb/safe-array-concat/commit/31b8e709bbba4b01ebc51cc15cdcc7012fe58341) +- Initial commit [`83d38c6`](https://github.com/ljharb/safe-array-concat/commit/83d38c6f4cde453063393482d9129b134d403d0a) +- npm init [`516fdc2`](https://github.com/ljharb/safe-array-concat/commit/516fdc2bef306ec13f98b1f1b49c929b5308907f) +- Only apps should have lockfiles [`9cfa07b`](https://github.com/ljharb/safe-array-concat/commit/9cfa07b9112107b5ba22c74baca8cb80934a09f2) diff --git a/node_modules/safe-array-concat/LICENSE b/node_modules/safe-array-concat/LICENSE new file mode 100644 index 000000000..b4213ac64 --- /dev/null +++ b/node_modules/safe-array-concat/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-array-concat/README.md b/node_modules/safe-array-concat/README.md new file mode 100644 index 000000000..c7e1d4514 --- /dev/null +++ b/node_modules/safe-array-concat/README.md @@ -0,0 +1,53 @@ +# safe-array-concat [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Array.prototype.concat`, but made safe by ignoring Symbol.isConcatSpreadable + +## Getting started + +```sh +npm install --save safe-array-concat +``` + +## Usage/Examples + +```js +var safeConcat = require('safe-array-concat'); +var assert = require('assert'); + +assert.deepEqual([].concat([1, 2], 3, [[4]]), [1, 2, 3, [4]], 'arrays spread as expected with normal concat'); +assert.deepEqual(safeConcat([1, 2], 3, [[4]]), [1, 2, 3, [4]], 'arrays spread as expected with safe concat'); + +String.prototype[Symbol.isConcatSpreadable] = true; +assert.deepEqual([].concat('foo', Object('bar')), ['foo', 'b', 'a', 'r'], 'spreadable String objects are spread with normal concat!!!'); +assert.deepEqual(safeConcat('foo', Object('bar')), ['foo', Object('bar')], 'spreadable String objects are not spread with safe concat'); + +Array.prototype[Symbol.isConcatSpreadable] = false; +assert.deepEqual([].concat([1, 2], 3, [[4]]), [[], [1, 2], 3, [[4]]], 'non-concat-spreadable arrays do not spread with normal concat!!!'); +assert.deepEqual(safeConcat([1, 2], 3, [[4]]), [1, 2, 3, [4]], 'non-concat-spreadable arrays still spread with safe concat'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/safe-array-concat +[npm-version-svg]: https://versionbadg.es/ljharb/safe-array-concat.svg +[deps-svg]: https://david-dm.org/ljharb/safe-array-concat.svg +[deps-url]: https://david-dm.org/ljharb/safe-array-concat +[dev-deps-svg]: https://david-dm.org/ljharb/safe-array-concat/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/safe-array-concat#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/safe-array-concat.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/safe-array-concat.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/safe-array-concat.svg +[downloads-url]: https://npm-stat.com/charts.html?package=safe-array-concat +[codecov-image]: https://codecov.io/gh/ljharb/safe-array-concat/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/safe-array-concat/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/safe-array-concat +[actions-url]: https://github.com/ljharb/safe-array-concat/actions diff --git a/node_modules/safe-array-concat/index.d.ts b/node_modules/safe-array-concat/index.d.ts new file mode 100644 index 000000000..4b204c078 --- /dev/null +++ b/node_modules/safe-array-concat/index.d.ts @@ -0,0 +1,3 @@ +declare function safeArrayConcat(item: T | T[], ...items: (T | T[])[]): T[]; + +export = safeArrayConcat; diff --git a/node_modules/safe-array-concat/index.js b/node_modules/safe-array-concat/index.js new file mode 100644 index 000000000..f2630ceaa --- /dev/null +++ b/node_modules/safe-array-concat/index.js @@ -0,0 +1,43 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var $concat = GetIntrinsic('%Array.prototype.concat%'); + +var callBind = require('call-bind'); + +var callBound = require('call-bound'); +var $slice = callBound('Array.prototype.slice'); + +var hasSymbols = require('has-symbols/shams')(); +var isConcatSpreadable = hasSymbols && Symbol.isConcatSpreadable; + +/** @type {never[]} */ var empty = []; +var $concatApply = isConcatSpreadable ? callBind.apply($concat, empty) : null; + +// eslint-disable-next-line no-extra-parens +var isArray = isConcatSpreadable ? /** @type {(value: unknown) => value is unknown[]} */ (require('isarray')) : null; + +/** @type {import('.')} */ +module.exports = isConcatSpreadable + // eslint-disable-next-line no-unused-vars + ? function safeArrayConcat(item) { + for (var i = 0; i < arguments.length; i += 1) { + /** @type {typeof item} */ var arg = arguments[i]; + // @ts-expect-error ts(2538) see https://github.com/microsoft/TypeScript/issues/9998#issuecomment-1890787975; works if `const` + if (arg && typeof arg === 'object' && typeof arg[isConcatSpreadable] === 'boolean') { + // @ts-expect-error ts(7015) TS doesn't yet support Symbol indexing + if (!empty[isConcatSpreadable]) { + // @ts-expect-error ts(7015) TS doesn't yet support Symbol indexing + empty[isConcatSpreadable] = true; + } + // @ts-expect-error ts(2721) ts(18047) not sure why TS can't figure out this can't be null + var arr = isArray(arg) ? $slice(arg) : [arg]; + // @ts-expect-error ts(7015) TS can't handle expandos on an array + arr[isConcatSpreadable] = true; // shadow the property. TODO: use [[Define]] + arguments[i] = arr; + } + } + // @ts-expect-error ts(2345) https://github.com/microsoft/TypeScript/issues/57164 TS doesn't understand that apply can take an arguments object + return $concatApply(arguments); + } + : callBind($concat, empty); diff --git a/node_modules/safe-array-concat/node_modules/isarray/LICENSE b/node_modules/safe-array-concat/node_modules/isarray/LICENSE new file mode 100644 index 000000000..de3226673 --- /dev/null +++ b/node_modules/safe-array-concat/node_modules/isarray/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/safe-array-concat/node_modules/isarray/README.md b/node_modules/safe-array-concat/node_modules/isarray/README.md new file mode 100644 index 000000000..3e160b2b7 --- /dev/null +++ b/node_modules/safe-array-concat/node_modules/isarray/README.md @@ -0,0 +1,38 @@ + +# isarray + +`Array#isArray` for older browsers and deprecated Node.js versions. + +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + +__Just use Array.isArray directly__, unless you need to support those older versions. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](https://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/node-browserify). + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! diff --git a/node_modules/safe-array-concat/node_modules/isarray/index.js b/node_modules/safe-array-concat/node_modules/isarray/index.js new file mode 100644 index 000000000..a57f63495 --- /dev/null +++ b/node_modules/safe-array-concat/node_modules/isarray/index.js @@ -0,0 +1,5 @@ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/safe-array-concat/node_modules/isarray/package.json b/node_modules/safe-array-concat/node_modules/isarray/package.json new file mode 100644 index 000000000..fb0e89be3 --- /dev/null +++ b/node_modules/safe-array-concat/node_modules/isarray/package.json @@ -0,0 +1,48 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "2.0.5", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "files": [ + "index.js" + ], + "dependencies": {}, + "devDependencies": { + "tape": "~2.13.4" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test.js", + "browsers": [ + "ie/8..latest", + "firefox/17..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" + ] + }, + "scripts": { + "test": "tape test.js" + } +} diff --git a/node_modules/safe-array-concat/package.json b/node_modules/safe-array-concat/package.json new file mode 100644 index 000000000..6f1c23571 --- /dev/null +++ b/node_modules/safe-array-concat/package.json @@ -0,0 +1,90 @@ +{ + "name": "safe-array-concat", + "version": "1.1.3", + "description": "`Array.prototype.concat`, but made safe by ignoring Symbol.isConcatSpreadable", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "tests-only": "nyc tape test", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production" + }, + "keywords": [ + "safe", + "Array", + "concat", + "push", + "isConcatSpreadable" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/safe-array-concat.git" + }, + "bugs": { + "url": "https://github.com/ljharb/safe-array-concat/issues" + }, + "homepage": "https://github.com/ljharb/safe-array-concat#readme", + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.3", + "@types/has-symbols": "^1.0.2", + "@types/isarray": "^2.0.2", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "mock-property": "^1.1.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "set-function-length": "^1.2.2", + "tape": "^5.9.0", + "typescript": "next" + }, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">=0.4" + } +} diff --git a/node_modules/safe-array-concat/test/index.js b/node_modules/safe-array-concat/test/index.js new file mode 100644 index 000000000..1e0341ac2 --- /dev/null +++ b/node_modules/safe-array-concat/test/index.js @@ -0,0 +1,100 @@ +'use strict'; + +var test = require('tape'); +var mockProperty = require('mock-property'); +var hasSymbols = require('has-symbols/shams')(); +var isConcatSpreadable = hasSymbols && Symbol.isConcatSpreadable; +var species = hasSymbols && Symbol.species; + +var boundFnsHaveConfigurableLengths = require('set-function-length/env').boundFnsHaveConfigurableLengths; + +var safeConcat = require('../'); + +test('safe-array-concat', function (t) { + t.equal(typeof safeConcat, 'function', 'is a function'); + t.equal( + safeConcat.length, + boundFnsHaveConfigurableLengths ? 1 : 0, + 'has a length of ' + (boundFnsHaveConfigurableLengths ? 1 : '0 (function lengths are not configurable)') + ); + + t.deepEqual( + // eslint-disable-next-line no-extra-parens + safeConcat(/** @type {(string | number | number[])[]} */ ([1, 2]), [3, 4], 'foo', 5, 6, [[7]]), + [1, 2, 3, 4, 'foo', 5, 6, [7]], + 'works with flat and nested arrays' + ); + + t.deepEqual( + safeConcat(undefined, 1, 2), + [undefined, 1, 2], + 'first item as undefined is not the concat receiver, which would throw via ToObject' + ); + t.deepEqual( + safeConcat(null, 1, 2), + [null, 1, 2], + 'first item as null is not the concat receiver, which would throw via ToObject' + ); + + var arr = [1, 2]; + arr.constructor = function C() { + return { args: arguments }; + }; + t.deepEqual( + safeConcat(arr, 3, 4), + [1, 2, 3, 4], + 'first item as an array with a nonArray .constructor; ignores constructor' + ); + + t.test('has Symbol.species', { skip: !species }, function (st) { + var speciesArr = [1, 2]; + // @ts-expect-error ts(2740) TS's `constructor` type requires a function + speciesArr.constructor = {}; + // @ts-expect-error ts(2538) TS can't type narrow from tape's `skip` + speciesArr.constructor[species] = function Species() { + return { args: arguments }; + }; + + st.deepEqual( + safeConcat(speciesArr, 3, 4), + [1, 2, 3, 4], + 'first item as an array with a .constructor object with a Symbol.species; ignores constructor and species' + ); + + st.end(); + }); + + t.test('has isConcatSpreadable', { skip: !isConcatSpreadable }, function (st) { + // TS can't type narrow from tape's `skip` + if (isConcatSpreadable) { + st.teardown(mockProperty( + // eslint-disable-next-line no-extra-parens + /** @type {Record} */ (/** @type {unknown} */ (String.prototype)), + isConcatSpreadable, + { value: true } + )); + + var nonSpreadable = [1, 2]; + // @ts-expect-error ts(7015) TS can't handle expandos on an array + nonSpreadable[isConcatSpreadable] = false; + + st.deepEqual( + safeConcat(nonSpreadable, 3, 4, 'foo', Object('bar')), + [1, 2, 3, 4, 'foo', Object('bar')], + 'a non-concat-spreadable array is spreaded, and a concat-spreadable String is not spreaded' + ); + + st.teardown(mockProperty(Array.prototype, isConcatSpreadable, { value: false })); + + st.deepEqual( + safeConcat([1, 2], 3, 4, 'foo', Object('bar')), + [1, 2, 3, 4, 'foo', Object('bar')], + 'all arrays marked non-concat-spreadable are still spreaded, and a concat-spreadable String is not spreaded' + ); + } + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/safe-array-concat/tsconfig.json b/node_modules/safe-array-concat/tsconfig.json new file mode 100644 index 000000000..0ce1896d1 --- /dev/null +++ b/node_modules/safe-array-concat/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE new file mode 100644 index 000000000..0c068ceec --- /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 000000000..e9a81afd0 --- /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 000000000..e9fed809a --- /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 000000000..22438dabb --- /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 000000000..623fbc3f6 --- /dev/null +++ b/node_modules/safe-buffer/package.json @@ -0,0 +1,37 @@ +{ + "name": "safe-buffer", + "description": "Safer Node.js Buffer API", + "version": "5.1.2", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "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", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + } +} diff --git a/node_modules/safe-push-apply/.eslintrc b/node_modules/safe-push-apply/.eslintrc new file mode 100644 index 000000000..fc909f1ef --- /dev/null +++ b/node_modules/safe-push-apply/.eslintrc @@ -0,0 +1,15 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "max-lines-per-function": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/safe-push-apply/.github/FUNDING.yml b/node_modules/safe-push-apply/.github/FUNDING.yml new file mode 100644 index 000000000..048935621 --- /dev/null +++ b/node_modules/safe-push-apply/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/safe-push-apply +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/safe-push-apply/.nycrc b/node_modules/safe-push-apply/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/safe-push-apply/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/safe-push-apply/CHANGELOG.md b/node_modules/safe-push-apply/CHANGELOG.md new file mode 100644 index 000000000..24570a1ed --- /dev/null +++ b/node_modules/safe-push-apply/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2024-12-28 + +### Commits + +- Initial implementation, tests, readme, types [`6e85f82`](https://github.com/ljharb/safe-push-apply/commit/6e85f82b116286503ff377e15708cd1584531c5f) +- Initial commit [`93928d9`](https://github.com/ljharb/safe-push-apply/commit/93928d9a1304ccc25b799528a4bbca8615f7614e) +- npm init [`5da39da`](https://github.com/ljharb/safe-push-apply/commit/5da39da33bb096e633d1e631a9374cfa0d7dc06b) +- Only apps should have lockfiles [`83fc8b4`](https://github.com/ljharb/safe-push-apply/commit/83fc8b4be29d680a27225329cc1ef5505626effa) diff --git a/node_modules/safe-push-apply/LICENSE b/node_modules/safe-push-apply/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/safe-push-apply/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-push-apply/README.md b/node_modules/safe-push-apply/README.md new file mode 100644 index 000000000..e2c56bd00 --- /dev/null +++ b/node_modules/safe-push-apply/README.md @@ -0,0 +1,59 @@ +# safe-push-apply [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Push an array of items into an array, while being robust against prototype modification. + +## Getting started + +```sh +npm install --save safe-push-apply +``` + +## Usage/Examples + +```js +var safePushApply = require('safe-push-apply'); +var assert = require('assert'); + +var arr = [1, 2, 3]; + +var orig = Array.prototype[Symbol.iterator]; +delete Array.prototype[Symbol.iterator]; +assert.throws(() => { + try { + arr.push(...[3, 4, 5]); + } finally { + Array.prototype[Symbol.iterator] = orig; + } +}, 'array is not iterable anymore'); + +delete Array.prototype.push; +safePushApply(arr, [3, 4, 5]); + +assert.deepEqual(arr, [1, 2, 3, 3, 4, 5]); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/safe-push-apply +[npm-version-svg]: https://versionbadg.es/ljharb/safe-push-apply.svg +[deps-svg]: https://david-dm.org/ljharb/safe-push-apply.svg +[deps-url]: https://david-dm.org/ljharb/safe-push-apply +[dev-deps-svg]: https://david-dm.org/ljharb/safe-push-apply/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/safe-push-apply#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/safe-push-apply.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/safe-push-apply.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/safe-push-apply.svg +[downloads-url]: https://npm-stat.com/charts.html?package=safe-push-apply +[codecov-image]: https://codecov.io/gh/ljharb/safe-push-apply/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/safe-push-apply/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/safe-push-apply +[actions-url]: https://github.com/ljharb/safe-push-apply/actions diff --git a/node_modules/safe-push-apply/index.d.ts b/node_modules/safe-push-apply/index.d.ts new file mode 100644 index 000000000..28d78ddba --- /dev/null +++ b/node_modules/safe-push-apply/index.d.ts @@ -0,0 +1,6 @@ +declare function safePushApply( + target: T[], + source: ArrayLike, +): void; + +export = safePushApply; diff --git a/node_modules/safe-push-apply/index.js b/node_modules/safe-push-apply/index.js new file mode 100644 index 000000000..080a1b85c --- /dev/null +++ b/node_modules/safe-push-apply/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var $TypeError = require('es-errors/type'); + +var isArray = require('isarray'); + +/** @type {import('.')} */ +module.exports = function safePushApply(target, source) { + if (!isArray(target)) { + throw new $TypeError('target must be an array'); + } + for (var i = 0; i < source.length; i++) { + target[target.length] = source[i]; // eslint-disable-line no-param-reassign + } +}; diff --git a/node_modules/safe-push-apply/node_modules/isarray/LICENSE b/node_modules/safe-push-apply/node_modules/isarray/LICENSE new file mode 100644 index 000000000..de3226673 --- /dev/null +++ b/node_modules/safe-push-apply/node_modules/isarray/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/safe-push-apply/node_modules/isarray/README.md b/node_modules/safe-push-apply/node_modules/isarray/README.md new file mode 100644 index 000000000..3e160b2b7 --- /dev/null +++ b/node_modules/safe-push-apply/node_modules/isarray/README.md @@ -0,0 +1,38 @@ + +# isarray + +`Array#isArray` for older browsers and deprecated Node.js versions. + +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + +__Just use Array.isArray directly__, unless you need to support those older versions. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](https://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/node-browserify). + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! diff --git a/node_modules/safe-push-apply/node_modules/isarray/index.js b/node_modules/safe-push-apply/node_modules/isarray/index.js new file mode 100644 index 000000000..a57f63495 --- /dev/null +++ b/node_modules/safe-push-apply/node_modules/isarray/index.js @@ -0,0 +1,5 @@ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/safe-push-apply/node_modules/isarray/package.json b/node_modules/safe-push-apply/node_modules/isarray/package.json new file mode 100644 index 000000000..fb0e89be3 --- /dev/null +++ b/node_modules/safe-push-apply/node_modules/isarray/package.json @@ -0,0 +1,48 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "2.0.5", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "files": [ + "index.js" + ], + "dependencies": {}, + "devDependencies": { + "tape": "~2.13.4" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test.js", + "browsers": [ + "ie/8..latest", + "firefox/17..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" + ] + }, + "scripts": { + "test": "tape test.js" + } +} diff --git a/node_modules/safe-push-apply/package.json b/node_modules/safe-push-apply/package.json new file mode 100644 index 000000000..cc7bc6ba0 --- /dev/null +++ b/node_modules/safe-push-apply/package.json @@ -0,0 +1,82 @@ +{ + "name": "safe-push-apply", + "version": "1.0.0", + "description": "Push an array of items into an array, while being robust against prototype modification", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "tests-only": "nyc tape test", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production" + }, + "keywords": [ + "array", + "push", + "apply", + "pushApply", + "safe" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/safe-push-apply.git" + }, + "bugs": { + "url": "https://github.com/ljharb/safe-push-apply/issues" + }, + "homepage": "https://github.com/ljharb/safe-push-apply#readme", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/isarray": "^2.0.3", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/safe-push-apply/test/index.js b/node_modules/safe-push-apply/test/index.js new file mode 100644 index 000000000..46fd1afcd --- /dev/null +++ b/node_modules/safe-push-apply/test/index.js @@ -0,0 +1,30 @@ +'use strict'; + +var test = require('tape'); + +var safePushApply = require('../'); + +test('safe-push-apply', function (t) { + t.equal(typeof safePushApply, 'function', 'is a function'); + t.equal(safePushApply.length, 2, 'has a length of 2'); + + t['throws']( + // @ts-expect-error + function () { safePushApply({}, []); }, + TypeError, + 'throws if target is not an array' + ); + + var a = [1, 2]; + var b = [3, 4]; + safePushApply(a, b); + t.deepEqual(a, [1, 2, 3, 4], 'b is pushed into a'); + t.deepEqual(b, [3, 4], 'b is not modified'); + + var c = '567'; + // @ts-expect-error TS ArrayLike doesn't accept strings for some reason + safePushApply(a, c); + t.deepEqual(a, [1, 2, 3, 4, '5', '6', '7'], 'works with arraylike source'); + + t.end(); +}); diff --git a/node_modules/safe-push-apply/tsconfig.json b/node_modules/safe-push-apply/tsconfig.json new file mode 100644 index 000000000..0ce1896d1 --- /dev/null +++ b/node_modules/safe-push-apply/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/safe-regex-test/.eslintrc b/node_modules/safe-regex-test/.eslintrc new file mode 100644 index 000000000..ff89be3cc --- /dev/null +++ b/node_modules/safe-regex-test/.eslintrc @@ -0,0 +1,9 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/node_modules/safe-regex-test/.github/FUNDING.yml b/node_modules/safe-regex-test/.github/FUNDING.yml new file mode 100644 index 000000000..ef4a26798 --- /dev/null +++ b/node_modules/safe-regex-test/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/safe-regex-test +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/safe-regex-test/.nycrc b/node_modules/safe-regex-test/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/safe-regex-test/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/safe-regex-test/CHANGELOG.md b/node_modules/safe-regex-test/CHANGELOG.md new file mode 100644 index 000000000..8ed1eb473 --- /dev/null +++ b/node_modules/safe-regex-test/CHANGELOG.md @@ -0,0 +1,55 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.0](https://github.com/ljharb/safe-regex-test/compare/v1.0.3...v1.1.0) - 2024-12-12 + +### Commits + +- [actions] split out node 10-20, and 20+ [`b4a46bb`](https://github.com/ljharb/safe-regex-test/commit/b4a46bb30542251df8051aec52561ce2bb162f85) +- [New] add types [`5cb24eb`](https://github.com/ljharb/safe-regex-test/commit/5cb24eb6d074fdae200446e172f1ab485460c34e) +- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`e225ca0`](https://github.com/ljharb/safe-regex-test/commit/e225ca081b77ea105b5e913a00473066efeb471d) +- [Refactor] use `call-bound` directly [`9be3cd2`](https://github.com/ljharb/safe-regex-test/commit/9be3cd2f390f23c0075ec93e5abdace0ee5d9d9d) +- [Deps] update `call-bind`, `is-regex` [`524b736`](https://github.com/ljharb/safe-regex-test/commit/524b73677e16de9dde27dfb8f30ac4760071bbda) +- [Tests] replace `aud` with `npm audit` [`f3cd537`](https://github.com/ljharb/safe-regex-test/commit/f3cd5379e48152daeb51fdd09e15d3ec74797761) +- [Dev Deps] add missing peer dep [`14da559`](https://github.com/ljharb/safe-regex-test/commit/14da559a0620b99a262ab9610dba13720915360f) + +## [v1.0.3](https://github.com/ljharb/safe-regex-test/compare/v1.0.2...v1.0.3) - 2024-02-06 + +### Commits + +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d6ba2f9`](https://github.com/ljharb/safe-regex-test/commit/d6ba2f948c679c3104ce6d6c897bedff0f1c5b74) +- [Deps] update `call-bind`, `get-intrinsic` [`5a3b1d7`](https://github.com/ljharb/safe-regex-test/commit/5a3b1d755e46f010e6930f15ec30eae023feffd3) +- [Dev Deps] update `tape` [`75fb719`](https://github.com/ljharb/safe-regex-test/commit/75fb71937c5daf1326052c59d6f251f439cd9332) + +## [v1.0.2](https://github.com/ljharb/safe-regex-test/compare/v1.0.1...v1.0.2) - 2024-01-11 + +### Commits + +- [meta] package.json `sideEffects` should be boolean [`094bb88`](https://github.com/ljharb/safe-regex-test/commit/094bb88d93ce25e26d20f5badee4e45acf0e3ac5) + +## [v1.0.1](https://github.com/ljharb/safe-regex-test/compare/v1.0.0...v1.0.1) - 2024-01-09 + +### Commits + +- [Tests] add nyc for coverage [`7e3f525`](https://github.com/ljharb/safe-regex-test/commit/7e3f5254efdf0979f72492f0e7f52a3a9814591f) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `object-inspect`, `tape` [`e7e0169`](https://github.com/ljharb/safe-regex-test/commit/e7e016949b78602f24debc1185c26f33cc4e9d1b) +- [actions] update rebase action [`2962694`](https://github.com/ljharb/safe-regex-test/commit/2962694bce7ffa278e873911072c11119bb3a608) +- [readme] add testing badges; remove david-dm badges [`e9dfd83`](https://github.com/ljharb/safe-regex-test/commit/e9dfd830655ac702ac7b7947f7076bb524994968) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`496fe99`](https://github.com/ljharb/safe-regex-test/commit/496fe99aa66f20cadb1cf79f6d479b87ae95b620) +- [Deps] update `call-bind`, `get-intrinsic` [`d94c5ba`](https://github.com/ljharb/safe-regex-test/commit/d94c5badd0362df8ff7ced38b50d20550fd629c1) +- [meta] add missing `engines.node` [`f3d4711`](https://github.com/ljharb/safe-regex-test/commit/f3d4711a51b21330e34f5f27e45452fbdb924715) +- [Deps] update `get-intrinsic` [`0eeedd7`](https://github.com/ljharb/safe-regex-test/commit/0eeedd74d0313fab9b0718895c02905f702ecb4d) +- [meta] add `sideEffects` flag [`fe1655f`](https://github.com/ljharb/safe-regex-test/commit/fe1655f16449208d987d9f4b7dafb15564ca80f7) + +## v1.0.0 - 2022-09-22 + +### Commits + +- Initial implementation, tests, readme [`0273e9f`](https://github.com/ljharb/safe-regex-test/commit/0273e9f96f4b09df413523f4faacc8ae9ac5e6cb) +- Initial commit [`b6c1edf`](https://github.com/ljharb/safe-regex-test/commit/b6c1edf740e6105fb71c34c1c69fadd837e8f7ab) +- npm init [`c7f5765`](https://github.com/ljharb/safe-regex-test/commit/c7f576580607b16458b5a16e6bfa3b639e49c6bd) +- Only apps should have lockfiles [`1162bf0`](https://github.com/ljharb/safe-regex-test/commit/1162bf011835040f7e2c9936734294b2d98536bf) diff --git a/node_modules/safe-regex-test/LICENSE b/node_modules/safe-regex-test/LICENSE new file mode 100644 index 000000000..6abfe1434 --- /dev/null +++ b/node_modules/safe-regex-test/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-test/README.md b/node_modules/safe-regex-test/README.md new file mode 100644 index 000000000..fca66d436 --- /dev/null +++ b/node_modules/safe-regex-test/README.md @@ -0,0 +1,46 @@ +# safe-regex-test [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Give a regex, get a robust predicate function that tests it against a string. This will work even if `RegExp.prototype` is altered later. + +## Getting started + +```sh +npm install --save safe-regex-test +``` + +## Usage/Examples + +```js +var regexTester = require('safe-regex-test'); +var assert = require('assert'); + +var tester = regexTester('a'); +assert.ok(tester('a')); +assert.notOk(tester('b')); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/safe-regex-test +[npm-version-svg]: https://versionbadg.es/ljharb/safe-regex-test.svg +[deps-svg]: https://david-dm.org/ljharb/safe-regex-test.svg +[deps-url]: https://david-dm.org/ljharb/safe-regex-test +[dev-deps-svg]: https://david-dm.org/ljharb/safe-regex-test/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/safe-regex-test#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/safe-regex-test.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/safe-regex-test.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/safe-regex-test.svg +[downloads-url]: https://npm-stat.com/charts.html?package=safe-regex-test +[codecov-image]: https://codecov.io/gh/ljharb/safe-regex-test/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/safe-regex-test/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/safe-regex-test +[actions-url]: https://github.com/ljharb/safe-regex-test/actions diff --git a/node_modules/safe-regex-test/index.d.ts b/node_modules/safe-regex-test/index.d.ts new file mode 100644 index 000000000..a1267e44f --- /dev/null +++ b/node_modules/safe-regex-test/index.d.ts @@ -0,0 +1,3 @@ +declare function regexTester(regex: RegExp): (string: string) => boolean; + +export = regexTester; \ No newline at end of file diff --git a/node_modules/safe-regex-test/index.js b/node_modules/safe-regex-test/index.js new file mode 100644 index 000000000..bf751bc3d --- /dev/null +++ b/node_modules/safe-regex-test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var callBound = require('call-bound'); +var isRegex = require('is-regex'); + +var $exec = callBound('RegExp.prototype.exec'); +var $TypeError = require('es-errors/type'); + +/** @type {import('.')} */ +module.exports = function regexTester(regex) { + if (!isRegex(regex)) { + throw new $TypeError('`regex` must be a RegExp'); + } + return function test(s) { + return $exec(regex, s) !== null; + }; +}; diff --git a/node_modules/safe-regex-test/package.json b/node_modules/safe-regex-test/package.json new file mode 100644 index 000000000..f8f982ebb --- /dev/null +++ b/node_modules/safe-regex-test/package.json @@ -0,0 +1,87 @@ +{ + "name": "safe-regex-test", + "version": "1.1.0", + "description": "Give a regex, get a robust predicate function that tests it against a string.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "tests-only": "nyc tape test", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/safe-regex-test.git" + }, + "keywords": [ + "regex", + "regexp", + "test", + "tester", + "safe", + "robust", + "exec" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/safe-regex-test/issues" + }, + "homepage": "https://github.com/ljharb/safe-regex-test#readme", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/for-each": "^0.3.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/safe-regex-test/test/index.js b/node_modules/safe-regex-test/test/index.js new file mode 100644 index 000000000..6420e0771 --- /dev/null +++ b/node_modules/safe-regex-test/test/index.js @@ -0,0 +1,41 @@ +'use strict'; + +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); + +var regexTester = require('../'); + +test('regex tester', function (t) { + t.equal(typeof regexTester, 'function', 'is a function'); + + t.test('non-regexes', function (st) { + forEach([].concat( + // @ts-expect-error TS sucks with concat + v.primitives, + v.objects + ), function (val) { + st['throws']( + function () { regexTester(val); }, + TypeError, + inspect(val) + ' is not a regex' + ); + }); + + st.end(); + }); + + t.test('regexes', function (st) { + var tester = regexTester(/a/); + + st.equal(typeof tester, 'function', 'returns a function'); + st.equal(tester('a'), true, 'returns true for a match'); + st.equal(tester('b'), false, 'returns false for a non-match'); + st.equal(tester('a'), true, 'returns true for a match again'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/safe-regex-test/tsconfig.json b/node_modules/safe-regex-test/tsconfig.json new file mode 100644 index 000000000..6c2a8a0b9 --- /dev/null +++ b/node_modules/safe-regex-test/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + // "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} \ No newline at end of file diff --git a/node_modules/safe-regex/.travis.yml b/node_modules/safe-regex/.travis.yml new file mode 100644 index 000000000..cc4dba29d --- /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 000000000..ee27ba4b4 --- /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 000000000..f486f592c --- /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 000000000..488f5014d --- /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 000000000..0dd631b54 --- /dev/null +++ b/node_modules/safe-regex/package.json @@ -0,0 +1,43 @@ +{ + "name": "safe-regex", + "version": "1.1.0", + "description": "detect possibly catastrophic, exponential-time regular expressions", + "main": "index.js", + "dependencies": { + "ret": "~0.1.10" + }, + "devDependencies": { + "tape": "^3.5.0" + }, + "scripts": { + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8", "ie/9", "ie/10", + "firefox/latest", + "chrome/latest", + "opera/latest", + "safari/latest" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/safe-regex.git" + }, + "homepage": "https://github.com/substack/safe-regex", + "keywords": [ + "catastrophic", + "exponential", + "regex", + "safe", + "sandbox" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/node_modules/safe-regex/readme.markdown b/node_modules/safe-regex/readme.markdown new file mode 100644 index 000000000..83673ac3d --- /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 000000000..0bda85045 --- /dev/null +++ b/node_modules/safe-regex/test/regex.js @@ -0,0 +1,50 @@ +var safe = require('../'); +var test = require('tape'); + +var good = [ + /\bOakland\b/, + /\b(Oakland|San Francisco)\b/i, + /^\d+1337\d+$/i, + /^\d+(1337|404)\d+$/i, + /^\d+(1337|404)*\d+$/i, + RegExp(Array(26).join('a?') + Array(26).join('a')), +]; + +test('safe regex', function (t) { + t.plan(good.length); + good.forEach(function (re) { + t.equal(safe(re), true); + }); +}); + + +var bad = [ + /^(a?){25}(a){25}$/, + RegExp(Array(27).join('a?') + Array(27).join('a')), + /(x+x+)+y/, + /foo|(x+x+)+y/, + /(a+){10}y/, + /(a+){2}y/, + /(.*){1,32000}[bc]/ +]; + +test('unsafe regex', function (t) { + t.plan(bad.length); + bad.forEach(function (re) { + t.equal(safe(re), false); + }); +}); + +var invalid = [ + '*Oakland*', + 'hey(yoo))', + 'abcde(?>hellow)', + '[abc' +]; + +test('invalid regex', function (t) { + t.plan(invalid.length); + invalid.forEach(function (re) { + t.equal(safe(re), false); + }); +}); diff --git a/node_modules/semver/LICENSE b/node_modules/semver/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md new file mode 100644 index 000000000..f8dfa5a0d --- /dev/null +++ b/node_modules/semver/README.md @@ -0,0 +1,412 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install --save semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json new file mode 100644 index 000000000..db035e97d --- /dev/null +++ b/node_modules/semver/package.json @@ -0,0 +1,38 @@ +{ + "name": "semver", + "version": "5.7.2", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" + }, + "devDependencies": { + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" + } +} diff --git a/node_modules/semver/range.bnf b/node_modules/semver/range.bnf new file mode 100644 index 000000000..d4c6ae0d7 --- /dev/null +++ b/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js new file mode 100644 index 000000000..dcb683341 --- /dev/null +++ b/node_modules/semver/semver.js @@ -0,0 +1,1525 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +// The actual regexps go on exports.re +var re = exports.re = [] +var safeRe = exports.safeRe = [] +var src = exports.src = [] +var R = 0 + +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++ +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' +var NUMERICIDENTIFIERLOOSE = R++ +src[NUMERICIDENTIFIERLOOSE] = '\\d+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++ +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++ +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')' + +var MAINVERSIONLOOSE = R++ +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++ +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +var PRERELEASEIDENTIFIERLOOSE = R++ +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++ +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' + +var PRERELEASELOOSE = R++ +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++ +src[BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++ +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++ +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?' + +src[FULL] = '^' + FULLPLAIN + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?' + +var LOOSE = R++ +src[LOOSE] = '^' + LOOSEPLAIN + '$' + +var GTLT = R++ +src[GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++ +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +var XRANGEIDENTIFIER = R++ +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' + +var XRANGEPLAIN = R++ +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGEPLAINLOOSE = R++ +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGE = R++ +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' +var XRANGELOOSE = R++ +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++ +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++ +src[LONETILDE] = '(?:~>?)' + +var TILDETRIM = R++ +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), 'g') +var tildeTrimReplace = '$1~' + +var TILDE = R++ +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' +var TILDELOOSE = R++ +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++ +src[LONECARET] = '(?:\\^)' + +var CARETTRIM = R++ +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), 'g') +var caretTrimReplace = '$1^' + +var CARET = R++ +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' +var CARETLOOSE = R++ +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++ +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' +var COMPARATOR = R++ +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++ +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++ +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$' + +var HYPHENRANGELOOSE = R++ +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +var STAR = R++ +src[STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? safeRe[LOOSE] : safeRe[FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY) { + return true + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + this.raw) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(safeRe[TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(safeRe[CARETTRIM], caretTrimReplace) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + }) + }) +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(safeRe[STAR], '') +} + +// This function is passed to string.replace(safeRe[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version) { + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + var match = version.match(safeRe[COERCE]) + + if (match == null) { + return null + } + + return parse(match[1] + + '.' + (match[2] || '0') + + '.' + (match[3] || '0')) +} diff --git a/node_modules/set-function-length/.eslintrc b/node_modules/set-function-length/.eslintrc new file mode 100644 index 000000000..7cff50717 --- /dev/null +++ b/node_modules/set-function-length/.eslintrc @@ -0,0 +1,27 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic" + ], + }], + "no-extra-parens": "off", + }, + + "overrides": [ + { + "files": ["test/**/*.js"], + "rules": { + "id-length": "off", + "max-lines-per-function": "off", + "multiline-comment-style": "off", + "no-empty-function": "off", + }, + }, + ], +} diff --git a/node_modules/set-function-length/.github/FUNDING.yml b/node_modules/set-function-length/.github/FUNDING.yml new file mode 100644 index 000000000..92feb6f9b --- /dev/null +++ b/node_modules/set-function-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/set-function-name +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/node_modules/set-function-length/.nycrc b/node_modules/set-function-length/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/set-function-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/set-function-length/CHANGELOG.md b/node_modules/set-function-length/CHANGELOG.md new file mode 100644 index 000000000..bac439d87 --- /dev/null +++ b/node_modules/set-function-length/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.2](https://github.com/ljharb/set-function-length/compare/v1.2.1...v1.2.2) - 2024-03-09 + +### Commits + +- [types] use shared config [`027032f`](https://github.com/ljharb/set-function-length/commit/027032fe9cc439644a07248ea6a8d813fcc767cb) +- [actions] remove redundant finisher; use reusable workflow [`1fd4fb1`](https://github.com/ljharb/set-function-length/commit/1fd4fb1c58bd5170f0dcff7e320077c0aa2ffdeb) +- [types] use a handwritten d.ts file instead of emit [`01b9761`](https://github.com/ljharb/set-function-length/commit/01b9761742c95e1118e8c2d153ce2ae43d9731aa) +- [Deps] update `define-data-property`, `get-intrinsic`, `has-property-descriptors` [`bee8eaf`](https://github.com/ljharb/set-function-length/commit/bee8eaf7749f325357ade85cffeaeef679e513d4) +- [Dev Deps] update `call-bind`, `tape` [`5dae579`](https://github.com/ljharb/set-function-length/commit/5dae579fdc3aab91b14ebb58f9c19ee3f509d434) +- [Tests] use `@arethetypeswrong/cli` [`7e22425`](https://github.com/ljharb/set-function-length/commit/7e22425d15957fd3d6da0b6bca4afc0c8d255d2d) + +## [v1.2.1](https://github.com/ljharb/set-function-length/compare/v1.2.0...v1.2.1) - 2024-02-06 + +### Commits + +- [Dev Deps] update `call-bind`, `tape`, `typescript` [`d9a4601`](https://github.com/ljharb/set-function-length/commit/d9a460199c4c1fa37da9ebe055e2c884128f0738) +- [Deps] update `define-data-property`, `get-intrinsic` [`38d39ae`](https://github.com/ljharb/set-function-length/commit/38d39aed13a757ed36211d5b0437b88485090c6b) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b4bfe5a`](https://github.com/ljharb/set-function-length/commit/b4bfe5ae0953b906d55b85f867eca5e7f673ebf4) + +## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14 + +### Commits + +- [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a) +- [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a) +- [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1) +- [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a) +- [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0) + +## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19 + +### Fixed + +- [Fix] move `define-data-property` to runtime deps [`#2`](https://github.com/ljharb/set-function-length/issues/2) + +### Commits + +- [Dev Deps] update `object-inspect`; add missing `call-bind` [`5aecf79`](https://github.com/ljharb/set-function-length/commit/5aecf79e7d6400957a5d9bd9ac20d4528908ca18) + +## [v1.1.0](https://github.com/ljharb/set-function-length/compare/v1.0.1...v1.1.0) - 2023-10-13 + +### Commits + +- [New] add `env` entry point [`475c87a`](https://github.com/ljharb/set-function-length/commit/475c87aa2f59b700aaed589d980624ec596acdcb) +- [Tests] add coverage with `nyc` [`14f0bf8`](https://github.com/ljharb/set-function-length/commit/14f0bf8c145ae60bf14a026420a06bb7be132c36) +- [eslint] fix linting failure [`fb516f9`](https://github.com/ljharb/set-function-length/commit/fb516f93c664057138c53559ef63c8622a093335) +- [Deps] update `define-data-property` [`d727e7c`](https://github.com/ljharb/set-function-length/commit/d727e7c6c9a40d7bf26797694e500ea68741feea) + +## [v1.0.1](https://github.com/ljharb/set-function-length/compare/v1.0.0...v1.0.1) - 2023-10-12 + +### Commits + +- [Refactor] use `get-intrinsic`, since it‘s in the dep graph anyways [`278a954`](https://github.com/ljharb/set-function-length/commit/278a954a06cd849051c569ff7aee56df6798933e) +- [meta] add `exports` [`72acfe5`](https://github.com/ljharb/set-function-length/commit/72acfe5a0310071fb205a72caba5ecbab24336a0) + +## v1.0.0 - 2023-10-12 + +### Commits + +- Initial implementation, tests, readme [`fce14e1`](https://github.com/ljharb/set-function-length/commit/fce14e17586460e4f294405173be72b6ffdf7e5f) +- Initial commit [`ca7ba85`](https://github.com/ljharb/set-function-length/commit/ca7ba857c7c283f9d26e21f14e71cd388f2cb722) +- npm init [`6a7e493`](https://github.com/ljharb/set-function-length/commit/6a7e493927736cebcaf5c1a84e69b8e6b7b744d8) +- Only apps should have lockfiles [`d2bf6c4`](https://github.com/ljharb/set-function-length/commit/d2bf6c43de8a51b02a0aa53e8d62cb50c4a2b0da) diff --git a/node_modules/set-function-length/LICENSE b/node_modules/set-function-length/LICENSE new file mode 100644 index 000000000..031492907 --- /dev/null +++ b/node_modules/set-function-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and 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/set-function-length/README.md b/node_modules/set-function-length/README.md new file mode 100644 index 000000000..15e3ac4b1 --- /dev/null +++ b/node_modules/set-function-length/README.md @@ -0,0 +1,56 @@ +# set-function-length [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Set a function’s length. + +Arguments: + - `fn`: the function + - `length`: the new length. Must be an integer between 0 and 2**32. + - `loose`: Optional. If true, and the length fails to be set, do not throw. Default false. + +Returns `fn`. + +## Usage + +```javascript +var setFunctionLength = require('set-function-length'); +var assert = require('assert'); + +function zero() {} +function one(_) {} +function two(_, __) {} + +assert.equal(zero.length, 0); +assert.equal(one.length, 1); +assert.equal(two.length, 2); + +assert.equal(setFunctionLength(zero, 10), zero); +assert.equal(setFunctionLength(one, 11), one); +assert.equal(setFunctionLength(two, 12), two); + +assert.equal(zero.length, 10); +assert.equal(one.length, 11); +assert.equal(two.length, 12); +``` + +[package-url]: https://npmjs.org/package/set-function-length +[npm-version-svg]: https://versionbadg.es/ljharb/set-function-length.svg +[deps-svg]: https://david-dm.org/ljharb/set-function-length.svg +[deps-url]: https://david-dm.org/ljharb/set-function-length +[dev-deps-svg]: https://david-dm.org/ljharb/set-function-length/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/set-function-length#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/set-function-length.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/set-function-length.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/set-function-length.svg +[downloads-url]: https://npm-stat.com/charts.html?package=set-function-length +[codecov-image]: https://codecov.io/gh/ljharb/set-function-length/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/set-function-length/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-length +[actions-url]: https://github.com/ljharb/set-function-length/actions diff --git a/node_modules/set-function-length/env.d.ts b/node_modules/set-function-length/env.d.ts new file mode 100644 index 000000000..970ea535b --- /dev/null +++ b/node_modules/set-function-length/env.d.ts @@ -0,0 +1,9 @@ +declare const env: { + __proto__: null, + boundFnsHaveConfigurableLengths: boolean; + boundFnsHaveWritableLengths: boolean; + functionsHaveConfigurableLengths: boolean; + functionsHaveWritableLengths: boolean; +}; + +export = env; \ No newline at end of file diff --git a/node_modules/set-function-length/env.js b/node_modules/set-function-length/env.js new file mode 100644 index 000000000..d9b0a2997 --- /dev/null +++ b/node_modules/set-function-length/env.js @@ -0,0 +1,25 @@ +'use strict'; + +var gOPD = require('gopd'); +var bind = require('function-bind'); + +var unbound = gOPD && gOPD(function () {}, 'length'); +// @ts-expect-error ts(2555) TS is overly strict with .call +var bound = gOPD && gOPD(bind.call(function () {}), 'length'); + +var functionsHaveConfigurableLengths = !!(unbound && unbound.configurable); + +var functionsHaveWritableLengths = !!(unbound && unbound.writable); + +var boundFnsHaveConfigurableLengths = !!(bound && bound.configurable); + +var boundFnsHaveWritableLengths = !!(bound && bound.writable); + +/** @type {import('./env')} */ +module.exports = { + __proto__: null, + boundFnsHaveConfigurableLengths: boundFnsHaveConfigurableLengths, + boundFnsHaveWritableLengths: boundFnsHaveWritableLengths, + functionsHaveConfigurableLengths: functionsHaveConfigurableLengths, + functionsHaveWritableLengths: functionsHaveWritableLengths +}; diff --git a/node_modules/set-function-length/index.d.ts b/node_modules/set-function-length/index.d.ts new file mode 100644 index 000000000..0451ecd39 --- /dev/null +++ b/node_modules/set-function-length/index.d.ts @@ -0,0 +1,7 @@ +declare namespace setFunctionLength { + type Func = (...args: unknown[]) => unknown; +} + +declare function setFunctionLength(fn: T, length: number, loose?: boolean): T; + +export = setFunctionLength; \ No newline at end of file diff --git a/node_modules/set-function-length/index.js b/node_modules/set-function-length/index.js new file mode 100644 index 000000000..14ce74dae --- /dev/null +++ b/node_modules/set-function-length/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); + +var $TypeError = require('es-errors/type'); +var $floor = GetIntrinsic('%Math.floor%'); + +/** @type {import('.')} */ +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } + + var loose = arguments.length > 2 && !!arguments[2]; + + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'length', length); + } + } + return fn; +}; diff --git a/node_modules/set-function-length/package.json b/node_modules/set-function-length/package.json new file mode 100644 index 000000000..f6b88819a --- /dev/null +++ b/node_modules/set-function-length/package.json @@ -0,0 +1,102 @@ +{ + "name": "set-function-length", + "version": "1.2.2", + "description": "Set a function's length property", + "main": "index.js", + "exports": { + ".": "./index.js", + "./env": "./env.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "directories": { + "test": "test" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/set-function-length.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "set", + "function", + "length", + "function.length" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/set-function-length/issues" + }, + "homepage": "https://github.com/ljharb/set-function-length#readme", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.1.1", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/function-bind": "^1.1.10", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "call-bind": "^1.0.7", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/node_modules/set-function-length/tsconfig.json b/node_modules/set-function-length/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/set-function-length/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/set-function-name/.eslintrc b/node_modules/set-function-name/.eslintrc new file mode 100644 index 000000000..ceed91844 --- /dev/null +++ b/node_modules/set-function-name/.eslintrc @@ -0,0 +1,21 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "no-extra-parens": "off", + }, + + "overrides": [ + { + "files": ["test/**/*.js"], + "rules": { + "id-length": "off", + "multiline-comment-style": "off", + "no-empty-function": "off", + }, + }, + ], +} diff --git a/node_modules/set-function-name/.github/FUNDING.yml b/node_modules/set-function-name/.github/FUNDING.yml new file mode 100644 index 000000000..92feb6f9b --- /dev/null +++ b/node_modules/set-function-name/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/set-function-name +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/node_modules/set-function-name/CHANGELOG.md b/node_modules/set-function-name/CHANGELOG.md new file mode 100644 index 000000000..d3719c3b0 --- /dev/null +++ b/node_modules/set-function-name/CHANGELOG.md @@ -0,0 +1,48 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.2](https://github.com/jfsiii/set-function-name/compare/v2.0.1...v2.0.2) - 2024-02-19 + +### Commits + +- [meta] add types [`ae747cd`](https://github.com/jfsiii/set-function-name/commit/ae747cdcf4a986e6974a375be8ec04dd7565f0bd) +- [Dev Deps] update `aud`, `npmignore`, `object-inspect`, `tape` [`01aafcb`](https://github.com/jfsiii/set-function-name/commit/01aafcb82e4df653fcbd666ce4f256c06f70d94e) +- [Deps] update `define-data-property`, `has-property-descriptors` [`0ef6338`](https://github.com/jfsiii/set-function-name/commit/0ef6338fac84f63c2445855778bfd9271ae048cb) +- [Refactor] use `es-errors` [`0b23e87`](https://github.com/jfsiii/set-function-name/commit/0b23e878a16c959bd8b1aa7152d65818dd90578c) + +## [v2.0.1](https://github.com/jfsiii/set-function-name/compare/v2.0.0...v2.0.1) - 2023-09-13 + +### Commits + +- [Fix] move `functions-have-names` to runtime deps [`db2eda8`](https://github.com/jfsiii/set-function-name/commit/db2eda8da4c8aecfad01739000bbd63d04a8e8cf) + +## [v2.0.0](https://github.com/jfsiii/set-function-name/compare/v1.0.0...v2.0.0) - 2023-09-12 + +### Commits + +- [eslint] add `npm run lint` [`23e1fcd`](https://github.com/jfsiii/set-function-name/commit/23e1fcd85b64b864cb8f7e894da78d540e72923a) +- [actions] add reused GHA [`525127e`](https://github.com/jfsiii/set-function-name/commit/525127e08bdb35b0d44f565492456c7d1d5923fc) +- [meta] add `.gitignore` [`aa3abdf`](https://github.com/jfsiii/set-function-name/commit/aa3abdfa6af18adf70281352905dd69ef8b2c66f) +- [Tests] switch tests to use tape; add posttest [`8ad6d30`](https://github.com/jfsiii/set-function-name/commit/8ad6d30c61f78d2f9beec156ba7f1c4c3741c593) +- [readme] add readme [`732c46c`](https://github.com/jfsiii/set-function-name/commit/732c46c05e0fa6843dbc85b3af1e9c9bf22e7bf9) +- [New] add optional `loose` argument [`f5e4771`](https://github.com/jfsiii/set-function-name/commit/f5e4771266c95567d87f6dc2cff94c986bc7e074) +- [meta] relicense package to MIT; fix repo URLs [`13948f8`](https://github.com/jfsiii/set-function-name/commit/13948f8bb4ec8a25b67332d8de232ad0c0dc4e6d) +- [meta] add `auto-changelog` [`7ab201c`](https://github.com/jfsiii/set-function-name/commit/7ab201c0d83d464664cc4588acad0d0f75926679) +- [Breaking] throw if a non-function is provided [`cf6fc8f`](https://github.com/jfsiii/set-function-name/commit/cf6fc8f3396d58aa8c32a83375cbf57d933d7e79) +- [Breaking] drop UMD, just use CJS [`47abfe8`](https://github.com/jfsiii/set-function-name/commit/47abfe89abfaa72f71e0a77a52a5ff2b7377e11a) +- [Refactor] use `define-data-property` and `has-property-descriptors` [`9921c2b`](https://github.com/jfsiii/set-function-name/commit/9921c2b64c571255084aefaa02660314609e8ea0) +- [meta] use `npmignore` to autogenerate an npmignore file [`c5dbe4f`](https://github.com/jfsiii/set-function-name/commit/c5dbe4f4c44298596338432e2ac9946a10c98edd) +- Only apps should have lockfiles [`98bbfa1`](https://github.com/jfsiii/set-function-name/commit/98bbfa145387f318152a6b792bd69aca3c544813) +- [meta] add `safe-publish-latest` [`8916cd8`](https://github.com/jfsiii/set-function-name/commit/8916cd8f5549dceee31f06d35a76e2f9d4933a8b) +- [meta] add `engines` [`2427c8e`](https://github.com/jfsiii/set-function-name/commit/2427c8e2499f378c9ff3d92c7d544c771ca810df) + +## v1.0.0 - 2017-09-14 + +### Commits + +- Initial commit. Including tests. [`f26a1f2`](https://github.com/jfsiii/set-function-name/commit/f26a1f2c69a70dad5049b1daa08eae5f6acd9a1e) +- add .npmignore to ignore test directory [`9cac96f`](https://github.com/jfsiii/set-function-name/commit/9cac96fd9e98f25883be6e727ac32356522a5d69) diff --git a/node_modules/set-function-name/LICENSE b/node_modules/set-function-name/LICENSE new file mode 100644 index 000000000..031492907 --- /dev/null +++ b/node_modules/set-function-name/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and 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/set-function-name/README.md b/node_modules/set-function-name/README.md new file mode 100644 index 000000000..b1612dd35 --- /dev/null +++ b/node_modules/set-function-name/README.md @@ -0,0 +1,61 @@ +# set-function-name [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Set a function’s name. + +Arguments: + - `fn`: the function + - `name`: the new name + - `loose`: Optional. If true, and the name fails to be set, do not throw. Default false. + +Returns `fn`. + +## Usage + +```javascript +var setFunctionName = require('set-function-name'); +var assert = require('assert'); + +const obj = { + concise() {}, + arrow: () => {}, + named: function named() {}, + anon: function () {}, +}; +assert.equal(obj.concise.name, 'concise'); +assert.equal(obj.arrow.name, 'arrow'); +assert.equal(obj.named.name, 'named'); +assert.equal(obj.anon.name, 'anon'); + +assert.equal(setFunctionName(obj.concise, 'brief'), obj.concise); +assert.equal(setFunctionName(obj.arrow, 'pointy'), obj.arrow); +assert.equal(setFunctionName(obj.named, ''), obj.named); +assert.equal(setFunctionName(obj.anon, 'anonymous'), obj.anon); + +assert.equal(obj.concise.name, 'brief'); +assert.equal(obj.arrow.name, 'pointy'); +assert.equal(obj.named.name, ''); +assert.equal(obj.anon.name, 'anonymous'); +``` + +[package-url]: https://npmjs.org/package/set-function-name +[npm-version-svg]: https://versionbadg.es/ljharb/set-function-name.svg +[deps-svg]: https://david-dm.org/ljharb/set-function-name.svg +[deps-url]: https://david-dm.org/ljharb/set-function-name +[dev-deps-svg]: https://david-dm.org/ljharb/set-function-name/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/set-function-name#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/set-function-name.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/set-function-name.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/set-function-name.svg +[downloads-url]: https://npm-stat.com/charts.html?package=set-function-name +[codecov-image]: https://codecov.io/gh/ljharb/set-function-name/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/set-function-name/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-name +[actions-url]: https://github.com/ljharb/set-function-name/actions diff --git a/node_modules/set-function-name/index.d.ts b/node_modules/set-function-name/index.d.ts new file mode 100644 index 000000000..a3f6114a2 --- /dev/null +++ b/node_modules/set-function-name/index.d.ts @@ -0,0 +1,5 @@ +type Func = (...args: unknown[]) => unknown; + +declare function setFunctionName(fn: T, name: string, loose?: boolean): T; + +export = setFunctionName; \ No newline at end of file diff --git a/node_modules/set-function-name/index.js b/node_modules/set-function-name/index.js new file mode 100644 index 000000000..8c1823875 --- /dev/null +++ b/node_modules/set-function-name/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); + +var $TypeError = require('es-errors/type'); + +/** @type {import('.')} */ +module.exports = function setFunctionName(fn, name) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + var loose = arguments.length > 2 && !!arguments[2]; + if (!loose || functionsHaveConfigurableNames) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'name', name, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'name', name); + } + } + return fn; +}; diff --git a/node_modules/set-function-name/package.json b/node_modules/set-function-name/package.json new file mode 100644 index 000000000..df47de0af --- /dev/null +++ b/node_modules/set-function-name/package.json @@ -0,0 +1,99 @@ +{ + "name": "set-function-name", + "version": "2.0.2", + "description": "Set a function's name property", + "main": "index.js", + "types": "./index.d.ts", + "directories": { + "test": "test" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/set-function-name.git" + }, + "keywords": [ + "set", + "assign", + "function", + "name", + "function.name" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/set-function-name/issues" + }, + "homepage": "https://github.com/ljharb/set-function-name#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/function.prototype.name": "^1.1.3", + "@types/functions-have-names": "^1.2.2", + "@types/has-property-descriptors": "^1.0.3", + "@types/make-arrow-function": "^1.2.2", + "@types/make-async-function": "^1.0.2", + "@types/make-async-generator-function": "^1.0.3", + "@types/make-generator-function": "^2.0.3", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "function.prototype.name": "^1.1.6", + "in-publish": "^2.0.1", + "make-arrow-function": "^1.2.0", + "make-async-function": "^1.0.0", + "make-async-generator-function": "^1.0.0", + "make-generator-function": "^2.0.0", + "npmignore": "^0.3.1", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test", + "!*.d.ts", + "!*.d.ts.map" + ] + } +} diff --git a/node_modules/set-function-name/tsconfig.json b/node_modules/set-function-name/tsconfig.json new file mode 100644 index 000000000..6d5dc00f2 --- /dev/null +++ b/node_modules/set-function-name/tsconfig.json @@ -0,0 +1,59 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/set-proto/.eslintrc b/node_modules/set-proto/.eslintrc new file mode 100644 index 000000000..1d21a8aef --- /dev/null +++ b/node_modules/set-proto/.eslintrc @@ -0,0 +1,10 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "sort-keys": "off", + }, +} diff --git a/node_modules/set-proto/.github/FUNDING.yml b/node_modules/set-proto/.github/FUNDING.yml new file mode 100644 index 000000000..71e5d8b13 --- /dev/null +++ b/node_modules/set-proto/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/set-proto +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/set-proto/.nycrc b/node_modules/set-proto/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/set-proto/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/set-proto/CHANGELOG.md b/node_modules/set-proto/CHANGELOG.md new file mode 100644 index 000000000..7ffdd4192 --- /dev/null +++ b/node_modules/set-proto/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2024-12-30 + +### Commits + +- Initial implementation, tests, readme, types [`7036fc9`](https://github.com/ljharb/set-proto/commit/7036fc9128568b1ff0b75d1955f7f364a4394079) +- Initial commit [`dd9bedd`](https://github.com/ljharb/set-proto/commit/dd9bedd41db6ff3efa00c84fcac8ae34558bf6ee) +- npm init [`63915de`](https://github.com/ljharb/set-proto/commit/63915dee39422698275fabe9876eb141e04390dd) +- Only apps should have lockfiles [`deffdae`](https://github.com/ljharb/set-proto/commit/deffdae5b989a9305247a4db314222ecc0a99280) diff --git a/node_modules/set-proto/LICENSE b/node_modules/set-proto/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/set-proto/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-proto/Object.setPrototypeOf.d.ts b/node_modules/set-proto/Object.setPrototypeOf.d.ts new file mode 100644 index 000000000..cbef07051 --- /dev/null +++ b/node_modules/set-proto/Object.setPrototypeOf.d.ts @@ -0,0 +1,8 @@ +declare function setProto( + object: O, + proto: P, +): O; + +declare const x: typeof setProto | null; + +export = x; \ No newline at end of file diff --git a/node_modules/set-proto/Object.setPrototypeOf.js b/node_modules/set-proto/Object.setPrototypeOf.js new file mode 100644 index 000000000..dc213eb09 --- /dev/null +++ b/node_modules/set-proto/Object.setPrototypeOf.js @@ -0,0 +1,6 @@ +'use strict'; + +var $Object = require('es-object-atoms'); + +/** @type {import('./Object.setPrototypeOf')} */ +module.exports = $Object.setPrototypeOf || null; diff --git a/node_modules/set-proto/README.md b/node_modules/set-proto/README.md new file mode 100644 index 000000000..7e304179a --- /dev/null +++ b/node_modules/set-proto/README.md @@ -0,0 +1,52 @@ +# set-proto [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly set the [[Prototype]] of an object. Uses the best available method. + +## Getting started + +```sh +npm install --save set-proto +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const setProto = require('set-proto'); + +const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' }; +const b = { c: 3 }; + +assert.ok(!('c' in a)); + +setProto(a, b); + +assert.ok('c' in a); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/set-proto +[npm-version-svg]: https://versionbadg.es/ljharb/set-proto.svg +[deps-svg]: https://david-dm.org/ljharb/set-proto.svg +[deps-url]: https://david-dm.org/ljharb/set-proto +[dev-deps-svg]: https://david-dm.org/ljharb/set-proto/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/set-proto#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/set-proto.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/set-proto.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/set-proto.svg +[downloads-url]: https://npm-stat.com/charts.html?package=set-proto +[codecov-image]: https://codecov.io/gh/ljharb/set-proto/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/set-proto/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-proto +[actions-url]: https://github.com/ljharb/set-proto/actions diff --git a/node_modules/set-proto/Reflect.setPrototypeOf.d.ts b/node_modules/set-proto/Reflect.setPrototypeOf.d.ts new file mode 100644 index 000000000..cb156a4df --- /dev/null +++ b/node_modules/set-proto/Reflect.setPrototypeOf.d.ts @@ -0,0 +1,3 @@ +declare const x: typeof Reflect.setPrototypeOf | null; + +export = x; \ No newline at end of file diff --git a/node_modules/set-proto/Reflect.setPrototypeOf.js b/node_modules/set-proto/Reflect.setPrototypeOf.js new file mode 100644 index 000000000..ccb7fd059 --- /dev/null +++ b/node_modules/set-proto/Reflect.setPrototypeOf.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./Reflect.setPrototypeOf')} */ +module.exports = (typeof Reflect !== 'undefined' && Reflect.setPrototypeOf) || null; diff --git a/node_modules/set-proto/index.d.ts b/node_modules/set-proto/index.d.ts new file mode 100644 index 000000000..0cadad923 --- /dev/null +++ b/node_modules/set-proto/index.d.ts @@ -0,0 +1,8 @@ +declare function setProto( + object: O, + proto: P, +): O; + +declare const x: typeof setProto | null; + +export = x; diff --git a/node_modules/set-proto/index.js b/node_modules/set-proto/index.js new file mode 100644 index 000000000..d5df1bf2d --- /dev/null +++ b/node_modules/set-proto/index.js @@ -0,0 +1,25 @@ +'use strict'; + +var reflectSetProto = require('./Reflect.setPrototypeOf'); +var originalSetProto = require('./Object.setPrototypeOf'); + +var setDunderProto = require('dunder-proto/set'); + +var $TypeError = require('es-errors/type'); + +/** @type {import('.')} */ +module.exports = reflectSetProto + ? function setProto(O, proto) { + // @ts-expect-error TS can't narrow inside a closure, for some reason + if (reflectSetProto(O, proto)) { + return O; + } + throw new $TypeError('Reflect.setPrototypeOf: failed to set [[Prototype]]'); + } + : originalSetProto || ( + setDunderProto ? function setProto(O, proto) { + // @ts-expect-error TS can't narrow inside a closure, for some reason + setDunderProto(O, proto); + return O; + } : null + ); diff --git a/node_modules/set-proto/package.json b/node_modules/set-proto/package.json new file mode 100644 index 000000000..47ec70616 --- /dev/null +++ b/node_modules/set-proto/package.json @@ -0,0 +1,82 @@ +{ + "name": "set-proto", + "version": "1.0.0", + "description": "Robustly set the [[Prototype]] of an object", + "main": "index.js", + "exports": { + ".": "./index.js", + "./Reflect.setPrototypeOf": "./Reflect.setPrototypeOf.js", + "./Object.setPrototypeOf": "./Object.setPrototypeOf.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "posttest": "npx npm@\">=10.2\" audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/set-proto.git" + }, + "keywords": [ + "set", + "proto", + "prototype", + "setPrototypeOf", + "[[Prototype]]" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/set-proto/issues" + }, + "homepage": "https://github.com/ljharb/set-proto#readme", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.2", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.3", + "@types/tape": "^5.8.0", + "auto-changelog": "^2.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "testling": { + "files": "test/index.js" + } +} diff --git a/node_modules/set-proto/test/index.js b/node_modules/set-proto/test/index.js new file mode 100644 index 000000000..ee1f10942 --- /dev/null +++ b/node_modules/set-proto/test/index.js @@ -0,0 +1,40 @@ +'use strict'; + +var test = require('tape'); + +var setProto = require('../'); + +var isPrototypeOf = Object.prototype.isPrototypeOf; + +test('setProto', function (t) { + t.equal(typeof setProto, 'function', 'is a function'); + + t.test('can set', { skip: !setProto }, function (st) { + var obj = { a: 1 }; + var proto = { b: 2 }; + + st.ok(isPrototypeOf.call(Object.prototype, obj), 'Object.prototype is isPrototypeOf obj'); + st.notOk(isPrototypeOf.call(proto, obj), 'proto is not isPrototypeOf obj'); + st.ok('a' in obj, 'a is in obj'); + st.notOk('b' in obj, 'b is not in obj'); + + // eslint-disable-next-line no-extra-parens + st.equal(/** @type {NonNullable} */ (setProto)(obj, proto), obj, 'returns the object'); + + st.ok(isPrototypeOf.call(Object.prototype, obj), 'Object.prototype is isPrototypeOf obj'); + st.ok(isPrototypeOf.call(proto, obj), 'proto is isPrototypeOf obj'); + st.ok('a' in obj, 'a is in obj'); + st.ok('b' in obj, 'b is in obj'); + + st.equal(Object.getPrototypeOf(obj), proto, 'sets the prototype'); + st.end(); + }); + + t.test('can not set', { skip: !!setProto }, function (st) { + st.equal(setProto, null); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/set-proto/tsconfig.json b/node_modules/set-proto/tsconfig.json new file mode 100644 index 000000000..60fb90e45 --- /dev/null +++ b/node_modules/set-proto/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + //"target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/side-channel-list/.editorconfig b/node_modules/side-channel-list/.editorconfig new file mode 100644 index 000000000..72e0ebaa7 --- /dev/null +++ b/node_modules/side-channel-list/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/node_modules/side-channel-list/.eslintrc b/node_modules/side-channel-list/.eslintrc new file mode 100644 index 000000000..93978e7d5 --- /dev/null +++ b/node_modules/side-channel-list/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-lines-per-function": 0, + "multiline-comment-style": 1, + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/node_modules/side-channel-list/.github/FUNDING.yml b/node_modules/side-channel-list/.github/FUNDING.yml new file mode 100644 index 000000000..eaff73503 --- /dev/null +++ b/node_modules/side-channel-list/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/side-channel-list +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/side-channel-list/.nycrc b/node_modules/side-channel-list/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/side-channel-list/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/side-channel-list/CHANGELOG.md b/node_modules/side-channel-list/CHANGELOG.md new file mode 100644 index 000000000..2ec51b769 --- /dev/null +++ b/node_modules/side-channel-list/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2024-12-10 + +### Commits + +- Initial implementation, tests, readme, types [`5d6baee`](https://github.com/ljharb/side-channel-list/commit/5d6baee5c9054a1238007f5a1dfc109a7a816251) +- Initial commit [`3ae784c`](https://github.com/ljharb/side-channel-list/commit/3ae784c63a47895fbaeed2a91ab54a8029a7a100) +- npm init [`07055a4`](https://github.com/ljharb/side-channel-list/commit/07055a4d139895565b199dba5fe2479c1a1b9e28) +- Only apps should have lockfiles [`9573058`](https://github.com/ljharb/side-channel-list/commit/9573058a47494e2d68f8c6c77b5d7fbe441949c1) diff --git a/node_modules/side-channel-list/LICENSE b/node_modules/side-channel-list/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/side-channel-list/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/side-channel-list/README.md b/node_modules/side-channel-list/README.md new file mode 100644 index 000000000..d9c7a1373 --- /dev/null +++ b/node_modules/side-channel-list/README.md @@ -0,0 +1,62 @@ +# side-channel-list [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Store information about any JS value in a side channel, using a linked list. + +Warning: this implementation will leak memory until you `delete` the `key`. +Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy. + +## Getting started + +```sh +npm install --save side-channel-list +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const getSideChannelList = require('side-channel-list'); + +const channel = getSideChannelList(); + +const key = {}; +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); + +channel.set(key, 42); + +channel.assert(key); // does not throw +assert.equal(channel.has(key), true); +assert.equal(channel.get(key), 42); + +channel.delete(key); +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/side-channel-list +[npm-version-svg]: https://versionbadg.es/ljharb/side-channel-list.svg +[deps-svg]: https://david-dm.org/ljharb/side-channel-list.svg +[deps-url]: https://david-dm.org/ljharb/side-channel-list +[dev-deps-svg]: https://david-dm.org/ljharb/side-channel-list/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/side-channel-list#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/side-channel-list.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/side-channel-list.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/side-channel-list.svg +[downloads-url]: https://npm-stat.com/charts.html?package=side-channel-list +[codecov-image]: https://codecov.io/gh/ljharb/side-channel-list/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-list/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-list +[actions-url]: https://github.com/ljharb/side-channel-list/actions diff --git a/node_modules/side-channel-list/index.d.ts b/node_modules/side-channel-list/index.d.ts new file mode 100644 index 000000000..c9cabc843 --- /dev/null +++ b/node_modules/side-channel-list/index.d.ts @@ -0,0 +1,13 @@ +declare namespace getSideChannelList { + type Channel = { + assert: (key: K) => void; + has: (key: K) => boolean; + get: (key: K) => V | undefined; + set: (key: K, value: V) => void; + delete: (key: K) => boolean; + }; +} + +declare function getSideChannelList(): getSideChannelList.Channel; + +export = getSideChannelList; diff --git a/node_modules/side-channel-list/index.js b/node_modules/side-channel-list/index.js new file mode 100644 index 000000000..8d6f98ca1 --- /dev/null +++ b/node_modules/side-channel-list/index.js @@ -0,0 +1,113 @@ +'use strict'; + +var inspect = require('object-inspect'); + +var $TypeError = require('es-errors/type'); + +/* +* This function traverses the list returning the node corresponding to the given key. +* +* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. +* By doing so, all the recently used nodes can be accessed relatively quickly. +*/ +/** @type {import('./list.d.ts').listGetNode} */ +// eslint-disable-next-line consistent-return +var listGetNode = function (list, key, isDelete) { + /** @type {typeof list | NonNullable<(typeof list)['next']>} */ + var prev = list; + /** @type {(typeof list)['next']} */ + var curr; + // eslint-disable-next-line eqeqeq + for (; (curr = prev.next) != null; prev = curr) { + if (curr.key === key) { + prev.next = curr.next; + if (!isDelete) { + // eslint-disable-next-line no-extra-parens + curr.next = /** @type {NonNullable} */ (list.next); + list.next = curr; // eslint-disable-line no-param-reassign + } + return curr; + } + } +}; + +/** @type {import('./list.d.ts').listGet} */ +var listGet = function (objects, key) { + if (!objects) { + return void undefined; + } + var node = listGetNode(objects, key); + return node && node.value; +}; +/** @type {import('./list.d.ts').listSet} */ +var listSet = function (objects, key, value) { + var node = listGetNode(objects, key); + if (node) { + node.value = value; + } else { + // Prepend the new node to the beginning of the list + objects.next = /** @type {import('./list.d.ts').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens + key: key, + next: objects.next, + value: value + }); + } +}; +/** @type {import('./list.d.ts').listHas} */ +var listHas = function (objects, key) { + if (!objects) { + return false; + } + return !!listGetNode(objects, key); +}; +/** @type {import('./list.d.ts').listDelete} */ +// eslint-disable-next-line consistent-return +var listDelete = function (objects, key) { + if (objects) { + return listGetNode(objects, key, true); + } +}; + +/** @type {import('.')} */ +module.exports = function getSideChannelList() { + /** @typedef {ReturnType} Channel */ + /** @typedef {Parameters[0]} K */ + /** @typedef {Parameters[1]} V */ + + /** @type {import('./list.d.ts').RootNode | undefined} */ var $o; + + /** @type {Channel} */ + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + 'delete': function (key) { + var root = $o && $o.next; + var deletedNode = listDelete($o, key); + if (deletedNode && root && root === deletedNode) { + $o = void undefined; + } + return !!deletedNode; + }, + get: function (key) { + return listGet($o, key); + }, + has: function (key) { + return listHas($o, key); + }, + set: function (key, value) { + if (!$o) { + // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head + $o = { + next: void undefined + }; + } + // eslint-disable-next-line no-extra-parens + listSet(/** @type {NonNullable} */ ($o), key, value); + } + }; + // @ts-expect-error TODO: figure out why this is erroring + return channel; +}; diff --git a/node_modules/side-channel-list/list.d.ts b/node_modules/side-channel-list/list.d.ts new file mode 100644 index 000000000..2c759e253 --- /dev/null +++ b/node_modules/side-channel-list/list.d.ts @@ -0,0 +1,14 @@ +type ListNode = { + key: K; + next: undefined | ListNode; + value: T; +}; +type RootNode = { + next: undefined | ListNode; +}; + +export function listGetNode(list: RootNode, key: ListNode['key'], isDelete?: boolean): ListNode | undefined; +export function listGet(objects: undefined | RootNode, key: ListNode['key']): T | undefined; +export function listSet(objects: RootNode, key: ListNode['key'], value: T): void; +export function listHas(objects: undefined | RootNode, key: ListNode['key']): boolean; +export function listDelete(objects: undefined | RootNode, key: ListNode['key']): ListNode | undefined; diff --git a/node_modules/side-channel-list/package.json b/node_modules/side-channel-list/package.json new file mode 100644 index 000000000..ba0f5c581 --- /dev/null +++ b/node_modules/side-channel-list/package.json @@ -0,0 +1,77 @@ +{ + "name": "side-channel-list", + "version": "1.0.0", + "description": "Store information about any JS value in a side channel, using a linked list", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "evalmd README.md && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/side-channel-list.git" + }, + "keywords": [], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/side-channel-list/issues" + }, + "homepage": "https://github.com/ljharb/side-channel-list#readme", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/side-channel-list/test/index.js b/node_modules/side-channel-list/test/index.js new file mode 100644 index 000000000..3ad436879 --- /dev/null +++ b/node_modules/side-channel-list/test/index.js @@ -0,0 +1,104 @@ +'use strict'; + +var test = require('tape'); + +var getSideChannelList = require('../'); + +test('getSideChannelList', function (t) { + t.test('export', function (st) { + st.equal(typeof getSideChannelList, 'function', 'is a function'); + + st.equal(getSideChannelList.length, 0, 'takes no arguments'); + + var channel = getSideChannelList(); + st.ok(channel, 'is truthy'); + st.equal(typeof channel, 'object', 'is an object'); + st.end(); + }); + + t.test('assert', function (st) { + var channel = getSideChannelList(); + st['throws']( + function () { channel.assert({}); }, + TypeError, + 'nonexistent value throws' + ); + + var o = {}; + channel.set(o, 'data'); + st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops'); + + st.end(); + }); + + t.test('has', function (st) { + var channel = getSideChannelList(); + /** @type {unknown[]} */ var o = []; + + st.equal(channel.has(o), false, 'nonexistent value yields false'); + + channel.set(o, 'foo'); + st.equal(channel.has(o), true, 'existent value yields true'); + + st.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + st.equal(channel.has('abc'), true, 'non object value that exists yields true'); + + st.end(); + }); + + t.test('get', function (st) { + var channel = getSideChannelList(); + var o = {}; + st.equal(channel.get(o), undefined, 'nonexistent value yields undefined'); + + var data = {}; + channel.set(o, data); + st.equal(channel.get(o), data, '"get" yields data set by "set"'); + + st.end(); + }); + + t.test('set', function (st) { + var channel = getSideChannelList(); + var o = function () {}; + st.equal(channel.get(o), undefined, 'value not set'); + + channel.set(o, 42); + st.equal(channel.get(o), 42, 'value was set'); + + channel.set(o, Infinity); + st.equal(channel.get(o), Infinity, 'value was set again'); + + var o2 = {}; + channel.set(o2, 17); + st.equal(channel.get(o), Infinity, 'o is not modified'); + st.equal(channel.get(o2), 17, 'o2 is set'); + + channel.set(o, 14); + st.equal(channel.get(o), 14, 'o is modified'); + st.equal(channel.get(o2), 17, 'o2 is not modified'); + + st.end(); + }); + + t.test('delete', function (st) { + var channel = getSideChannelList(); + var o = {}; + st.equal(channel['delete']({}), false, 'nonexistent value yields false'); + + channel.set(o, 42); + st.equal(channel.has(o), true, 'value is set'); + + st.equal(channel['delete']({}), false, 'nonexistent value still yields false'); + + st.equal(channel['delete'](o), true, 'deleted value yields true'); + + st.equal(channel.has(o), false, 'value is no longer set'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/side-channel-list/tsconfig.json b/node_modules/side-channel-list/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/side-channel-list/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/side-channel-map/.editorconfig b/node_modules/side-channel-map/.editorconfig new file mode 100644 index 000000000..72e0ebaa7 --- /dev/null +++ b/node_modules/side-channel-map/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/node_modules/side-channel-map/.eslintrc b/node_modules/side-channel-map/.eslintrc new file mode 100644 index 000000000..93978e7d5 --- /dev/null +++ b/node_modules/side-channel-map/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-lines-per-function": 0, + "multiline-comment-style": 1, + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/node_modules/side-channel-map/.github/FUNDING.yml b/node_modules/side-channel-map/.github/FUNDING.yml new file mode 100644 index 000000000..f2891bd62 --- /dev/null +++ b/node_modules/side-channel-map/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/side-channel-map +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/side-channel-map/.nycrc b/node_modules/side-channel-map/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/side-channel-map/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/side-channel-map/CHANGELOG.md b/node_modules/side-channel-map/CHANGELOG.md new file mode 100644 index 000000000..b6ccea906 --- /dev/null +++ b/node_modules/side-channel-map/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/ljharb/side-channel-map/compare/v1.0.0...v1.0.1) - 2024-12-10 + +### Commits + +- [Deps] update `call-bound` [`6d05aaa`](https://github.com/ljharb/side-channel-map/commit/6d05aaa4ce5f2be4e7825df433d650696f0ba40f) +- [types] fix generics ordering [`11c0184`](https://github.com/ljharb/side-channel-map/commit/11c0184132ac11fdc16857e12682e148e5e9ee74) + +## v1.0.0 - 2024-12-10 + +### Commits + +- Initial implementation, tests, readme, types [`ad877b4`](https://github.com/ljharb/side-channel-map/commit/ad877b42926d46d63fff76a2bd01d2b4a01959a9) +- Initial commit [`28f8879`](https://github.com/ljharb/side-channel-map/commit/28f8879c512abe8fcf9b6a4dc7754a0287e5eba4) +- npm init [`2c9604e`](https://github.com/ljharb/side-channel-map/commit/2c9604e5aa40223e425ea7cea78f8a07697504bd) +- Only apps should have lockfiles [`5e7ba9c`](https://github.com/ljharb/side-channel-map/commit/5e7ba9cffe3ef42095815adc8ac1255b49bbadf5) diff --git a/node_modules/side-channel-map/LICENSE b/node_modules/side-channel-map/LICENSE new file mode 100644 index 000000000..f82f38963 --- /dev/null +++ b/node_modules/side-channel-map/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/side-channel-map/README.md b/node_modules/side-channel-map/README.md new file mode 100644 index 000000000..8fa6f77f0 --- /dev/null +++ b/node_modules/side-channel-map/README.md @@ -0,0 +1,62 @@ +# side-channel-map [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Store information about any JS value in a side channel, using a Map. + +Warning: if the `key` is an object, this implementation will leak memory until you `delete` it. +Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy. + +## Getting started + +```sh +npm install --save side-channel-map +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const getSideChannelMap = require('side-channel-map'); + +const channel = getSideChannelMap(); + +const key = {}; +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); + +channel.set(key, 42); + +channel.assert(key); // does not throw +assert.equal(channel.has(key), true); +assert.equal(channel.get(key), 42); + +channel.delete(key); +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/side-channel-map +[npm-version-svg]: https://versionbadg.es/ljharb/side-channel-map.svg +[deps-svg]: https://david-dm.org/ljharb/side-channel-map.svg +[deps-url]: https://david-dm.org/ljharb/side-channel-map +[dev-deps-svg]: https://david-dm.org/ljharb/side-channel-map/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/side-channel-map#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/side-channel-map.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/side-channel-map.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/side-channel-map.svg +[downloads-url]: https://npm-stat.com/charts.html?package=side-channel-map +[codecov-image]: https://codecov.io/gh/ljharb/side-channel-map/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-map/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-map +[actions-url]: https://github.com/ljharb/side-channel-map/actions diff --git a/node_modules/side-channel-map/index.d.ts b/node_modules/side-channel-map/index.d.ts new file mode 100644 index 000000000..de33e899e --- /dev/null +++ b/node_modules/side-channel-map/index.d.ts @@ -0,0 +1,15 @@ +declare namespace getSideChannelMap { + type Channel = { + assert: (key: K) => void; + has: (key: K) => boolean; + get: (key: K) => V | undefined; + set: (key: K, value: V) => void; + delete: (key: K) => boolean; + }; +} + +declare function getSideChannelMap(): getSideChannelMap.Channel; + +declare const x: false | typeof getSideChannelMap; + +export = x; diff --git a/node_modules/side-channel-map/index.js b/node_modules/side-channel-map/index.js new file mode 100644 index 000000000..e111100bf --- /dev/null +++ b/node_modules/side-channel-map/index.js @@ -0,0 +1,68 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bound'); +var inspect = require('object-inspect'); + +var $TypeError = require('es-errors/type'); +var $Map = GetIntrinsic('%Map%', true); + +/** @type {(thisArg: Map, key: K) => V} */ +var $mapGet = callBound('Map.prototype.get', true); +/** @type {(thisArg: Map, key: K, value: V) => void} */ +var $mapSet = callBound('Map.prototype.set', true); +/** @type {(thisArg: Map, key: K) => boolean} */ +var $mapHas = callBound('Map.prototype.has', true); +/** @type {(thisArg: Map, key: K) => boolean} */ +var $mapDelete = callBound('Map.prototype.delete', true); +/** @type {(thisArg: Map) => number} */ +var $mapSize = callBound('Map.prototype.size', true); + +/** @type {import('.')} */ +module.exports = !!$Map && /** @type {Exclude} */ function getSideChannelMap() { + /** @typedef {ReturnType} Channel */ + /** @typedef {Parameters[0]} K */ + /** @typedef {Parameters[1]} V */ + + /** @type {Map | undefined} */ var $m; + + /** @type {Channel} */ + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + 'delete': function (key) { + if ($m) { + var result = $mapDelete($m, key); + if ($mapSize($m) === 0) { + $m = void undefined; + } + return result; + } + return false; + }, + get: function (key) { // eslint-disable-line consistent-return + if ($m) { + return $mapGet($m, key); + } + }, + has: function (key) { + if ($m) { + return $mapHas($m, key); + } + return false; + }, + set: function (key, value) { + if (!$m) { + // @ts-expect-error TS can't handle narrowing a variable inside a closure + $m = new $Map(); + } + $mapSet($m, key, value); + } + }; + + // @ts-expect-error TODO: figure out why TS is erroring here + return channel; +}; diff --git a/node_modules/side-channel-map/package.json b/node_modules/side-channel-map/package.json new file mode 100644 index 000000000..18e808059 --- /dev/null +++ b/node_modules/side-channel-map/package.json @@ -0,0 +1,80 @@ +{ + "name": "side-channel-map", + "version": "1.0.1", + "description": "Store information about any JS value in a side channel, using a Map", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "evalmd README.md && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/side-channel-map.git" + }, + "keywords": [], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/side-channel-map/issues" + }, + "homepage": "https://github.com/ljharb/side-channel-map#readme", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/get-intrinsic": "^1.2.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/side-channel-map/test/index.js b/node_modules/side-channel-map/test/index.js new file mode 100644 index 000000000..17433239e --- /dev/null +++ b/node_modules/side-channel-map/test/index.js @@ -0,0 +1,114 @@ +'use strict'; + +var test = require('tape'); + +var getSideChannelMap = require('../'); + +test('getSideChannelMap', { skip: typeof Map !== 'function' }, function (t) { + var getSideChannel = getSideChannelMap || function () { + throw new EvalError('should never happen'); + }; + + t.test('export', function (st) { + st.equal(typeof getSideChannel, 'function', 'is a function'); + + st.equal(getSideChannel.length, 0, 'takes no arguments'); + + var channel = getSideChannel(); + st.ok(channel, 'is truthy'); + st.equal(typeof channel, 'object', 'is an object'); + st.end(); + }); + + t.test('assert', function (st) { + var channel = getSideChannel(); + st['throws']( + function () { channel.assert({}); }, + TypeError, + 'nonexistent value throws' + ); + + var o = {}; + channel.set(o, 'data'); + st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops'); + + st.end(); + }); + + t.test('has', function (st) { + var channel = getSideChannel(); + /** @type {unknown[]} */ var o = []; + + st.equal(channel.has(o), false, 'nonexistent value yields false'); + + channel.set(o, 'foo'); + st.equal(channel.has(o), true, 'existent value yields true'); + + st.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + st.equal(channel.has('abc'), true, 'non object value that exists yields true'); + + st.end(); + }); + + t.test('get', function (st) { + var channel = getSideChannel(); + var o = {}; + st.equal(channel.get(o), undefined, 'nonexistent value yields undefined'); + + var data = {}; + channel.set(o, data); + st.equal(channel.get(o), data, '"get" yields data set by "set"'); + + st.end(); + }); + + t.test('set', function (st) { + var channel = getSideChannel(); + var o = function () {}; + st.equal(channel.get(o), undefined, 'value not set'); + + channel.set(o, 42); + st.equal(channel.get(o), 42, 'value was set'); + + channel.set(o, Infinity); + st.equal(channel.get(o), Infinity, 'value was set again'); + + var o2 = {}; + channel.set(o2, 17); + st.equal(channel.get(o), Infinity, 'o is not modified'); + st.equal(channel.get(o2), 17, 'o2 is set'); + + channel.set(o, 14); + st.equal(channel.get(o), 14, 'o is modified'); + st.equal(channel.get(o2), 17, 'o2 is not modified'); + + st.end(); + }); + + t.test('delete', function (st) { + var channel = getSideChannel(); + var o = {}; + st.equal(channel['delete']({}), false, 'nonexistent value yields false'); + + channel.set(o, 42); + st.equal(channel.has(o), true, 'value is set'); + + st.equal(channel['delete']({}), false, 'nonexistent value still yields false'); + + st.equal(channel['delete'](o), true, 'deleted value yields true'); + + st.equal(channel.has(o), false, 'value is no longer set'); + + st.end(); + }); + + t.end(); +}); + +test('getSideChannelMap, no Maps', { skip: typeof Map === 'function' }, function (t) { + t.equal(getSideChannelMap, false, 'is false'); + + t.end(); +}); diff --git a/node_modules/side-channel-map/tsconfig.json b/node_modules/side-channel-map/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/side-channel-map/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/side-channel-weakmap/.editorconfig b/node_modules/side-channel-weakmap/.editorconfig new file mode 100644 index 000000000..72e0ebaa7 --- /dev/null +++ b/node_modules/side-channel-weakmap/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/node_modules/side-channel-weakmap/.eslintrc b/node_modules/side-channel-weakmap/.eslintrc new file mode 100644 index 000000000..9b13ad8ba --- /dev/null +++ b/node_modules/side-channel-weakmap/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "max-lines-per-function": 0, + "multiline-comment-style": 1, + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/node_modules/side-channel-weakmap/.github/FUNDING.yml b/node_modules/side-channel-weakmap/.github/FUNDING.yml new file mode 100644 index 000000000..2ae71cdb9 --- /dev/null +++ b/node_modules/side-channel-weakmap/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/side-channel-weakmap +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/side-channel-weakmap/.nycrc b/node_modules/side-channel-weakmap/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/side-channel-weakmap/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/side-channel-weakmap/CHANGELOG.md b/node_modules/side-channel-weakmap/CHANGELOG.md new file mode 100644 index 000000000..aba7ab041 --- /dev/null +++ b/node_modules/side-channel-weakmap/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/ljharb/side-channel-weakmap/compare/v1.0.1...v1.0.2) - 2024-12-10 + +### Commits + +- [types] fix generics ordering [`1b62e94`](https://github.com/ljharb/side-channel-weakmap/commit/1b62e94a2ad6ed30b640ba73c4a2535836c67289) + +## [v1.0.1](https://github.com/ljharb/side-channel-weakmap/compare/v1.0.0...v1.0.1) - 2024-12-10 + +### Commits + +- [types] fix generics ordering [`08a4a5d`](https://github.com/ljharb/side-channel-weakmap/commit/08a4a5dbffedc3ebc79f1aaaf5a3dd6d2196dc1b) +- [Deps] update `side-channel-map` [`b53fe44`](https://github.com/ljharb/side-channel-weakmap/commit/b53fe447dfdd3a9aebedfd015b384eac17fce916) + +## v1.0.0 - 2024-12-10 + +### Commits + +- Initial implementation, tests, readme, types [`53c0fa4`](https://github.com/ljharb/side-channel-weakmap/commit/53c0fa4788435a006f58b9d7b43cb65989ecee49) +- Initial commit [`a157947`](https://github.com/ljharb/side-channel-weakmap/commit/a157947f26fcaf2c4a941d3a044e76bf67343532) +- npm init [`54dfc55`](https://github.com/ljharb/side-channel-weakmap/commit/54dfc55bafb16265910d5aad4e743c43aee5bbbb) +- Only apps should have lockfiles [`0ddd6c7`](https://github.com/ljharb/side-channel-weakmap/commit/0ddd6c7b07fe8ee04d67b2e9f7255af7ce62c07d) diff --git a/node_modules/side-channel-weakmap/LICENSE b/node_modules/side-channel-weakmap/LICENSE new file mode 100644 index 000000000..3900dd7e2 --- /dev/null +++ b/node_modules/side-channel-weakmap/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/side-channel-weakmap/README.md b/node_modules/side-channel-weakmap/README.md new file mode 100644 index 000000000..856ee3643 --- /dev/null +++ b/node_modules/side-channel-weakmap/README.md @@ -0,0 +1,62 @@ +# side-channel-weakmap [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Store information about any JS value in a side channel. Uses WeakMap if available. + +Warning: this implementation will leak memory until you `delete` the `key`. +Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy. + +## Getting started + +```sh +npm install --save side-channel-weakmap +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const getSideChannelList = require('side-channel-weakmap'); + +const channel = getSideChannelList(); + +const key = {}; +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); + +channel.set(key, 42); + +channel.assert(key); // does not throw +assert.equal(channel.has(key), true); +assert.equal(channel.get(key), 42); + +channel.delete(key); +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/side-channel-weakmap +[npm-version-svg]: https://versionbadg.es/ljharb/side-channel-weakmap.svg +[deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap.svg +[deps-url]: https://david-dm.org/ljharb/side-channel-weakmap +[dev-deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/side-channel-weakmap#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/side-channel-weakmap.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/side-channel-weakmap.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/side-channel-weakmap.svg +[downloads-url]: https://npm-stat.com/charts.html?package=side-channel-weakmap +[codecov-image]: https://codecov.io/gh/ljharb/side-channel-weakmap/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-weakmap/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-weakmap +[actions-url]: https://github.com/ljharb/side-channel-weakmap/actions diff --git a/node_modules/side-channel-weakmap/index.d.ts b/node_modules/side-channel-weakmap/index.d.ts new file mode 100644 index 000000000..ce1bc2a4a --- /dev/null +++ b/node_modules/side-channel-weakmap/index.d.ts @@ -0,0 +1,15 @@ +declare namespace getSideChannelWeakMap { + type Channel = { + assert: (key: K) => void; + has: (key: K) => boolean; + get: (key: K) => V | undefined; + set: (key: K, value: V) => void; + delete: (key: K) => boolean; + } +} + +declare function getSideChannelWeakMap(): getSideChannelWeakMap.Channel; + +declare const x: false | typeof getSideChannelWeakMap; + +export = x; diff --git a/node_modules/side-channel-weakmap/index.js b/node_modules/side-channel-weakmap/index.js new file mode 100644 index 000000000..e5b8183d9 --- /dev/null +++ b/node_modules/side-channel-weakmap/index.js @@ -0,0 +1,84 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bound'); +var inspect = require('object-inspect'); +var getSideChannelMap = require('side-channel-map'); + +var $TypeError = require('es-errors/type'); +var $WeakMap = GetIntrinsic('%WeakMap%', true); + +/** @type {(thisArg: WeakMap, key: K) => V} */ +var $weakMapGet = callBound('WeakMap.prototype.get', true); +/** @type {(thisArg: WeakMap, key: K, value: V) => void} */ +var $weakMapSet = callBound('WeakMap.prototype.set', true); +/** @type {(thisArg: WeakMap, key: K) => boolean} */ +var $weakMapHas = callBound('WeakMap.prototype.has', true); +/** @type {(thisArg: WeakMap, key: K) => boolean} */ +var $weakMapDelete = callBound('WeakMap.prototype.delete', true); + +/** @type {import('.')} */ +module.exports = $WeakMap + ? /** @type {Exclude} */ function getSideChannelWeakMap() { + /** @typedef {ReturnType} Channel */ + /** @typedef {Parameters[0]} K */ + /** @typedef {Parameters[1]} V */ + + /** @type {WeakMap | undefined} */ var $wm; + /** @type {Channel | undefined} */ var $m; + + /** @type {Channel} */ + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + 'delete': function (key) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapDelete($wm, key); + } + } else if (getSideChannelMap) { + if ($m) { + return $m['delete'](key); + } + } + return false; + }, + get: function (key) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapGet($wm, key); + } + } + return $m && $m.get(key); + }, + has: function (key) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapHas($wm, key); + } + } + return !!$m && $m.has(key); + }, + set: function (key, value) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if (!$wm) { + $wm = new $WeakMap(); + } + $weakMapSet($wm, key, value); + } else if (getSideChannelMap) { + if (!$m) { + $m = getSideChannelMap(); + } + // eslint-disable-next-line no-extra-parens + /** @type {NonNullable} */ ($m).set(key, value); + } + } + }; + + // @ts-expect-error TODO: figure out why this is erroring + return channel; + } + : getSideChannelMap; diff --git a/node_modules/side-channel-weakmap/package.json b/node_modules/side-channel-weakmap/package.json new file mode 100644 index 000000000..9ef658333 --- /dev/null +++ b/node_modules/side-channel-weakmap/package.json @@ -0,0 +1,87 @@ +{ + "name": "side-channel-weakmap", + "version": "1.0.2", + "description": "Store information about any JS value in a side channel. Uses WeakMap if available.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/side-channel-weakmap.git" + }, + "keywords": [ + "weakmap", + "map", + "side", + "channel", + "metadata" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/side-channel-weakmap/issues" + }, + "homepage": "https://github.com/ljharb/side-channel-weakmap#readme", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/side-channel-weakmap/test/index.js b/node_modules/side-channel-weakmap/test/index.js new file mode 100644 index 000000000..a01248b57 --- /dev/null +++ b/node_modules/side-channel-weakmap/test/index.js @@ -0,0 +1,114 @@ +'use strict'; + +var test = require('tape'); + +var getSideChannelWeakMap = require('../'); + +test('getSideChannelMap', { skip: typeof WeakMap !== 'function' && typeof Map !== 'function' }, function (t) { + var getSideChannel = getSideChannelWeakMap || function () { + throw new EvalError('should never happen'); + }; + + t.test('export', function (st) { + st.equal(typeof getSideChannel, 'function', 'is a function'); + + st.equal(getSideChannel.length, 0, 'takes no arguments'); + + var channel = getSideChannel(); + st.ok(channel, 'is truthy'); + st.equal(typeof channel, 'object', 'is an object'); + st.end(); + }); + + t.test('assert', function (st) { + var channel = getSideChannel(); + st['throws']( + function () { channel.assert({}); }, + TypeError, + 'nonexistent value throws' + ); + + var o = {}; + channel.set(o, 'data'); + st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops'); + + st.end(); + }); + + t.test('has', function (st) { + var channel = getSideChannel(); + /** @type {unknown[]} */ var o = []; + + st.equal(channel.has(o), false, 'nonexistent value yields false'); + + channel.set(o, 'foo'); + st.equal(channel.has(o), true, 'existent value yields true'); + + st.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + st.equal(channel.has('abc'), true, 'non object value that exists yields true'); + + st.end(); + }); + + t.test('get', function (st) { + var channel = getSideChannel(); + var o = {}; + st.equal(channel.get(o), undefined, 'nonexistent value yields undefined'); + + var data = {}; + channel.set(o, data); + st.equal(channel.get(o), data, '"get" yields data set by "set"'); + + st.end(); + }); + + t.test('set', function (st) { + var channel = getSideChannel(); + var o = function () {}; + st.equal(channel.get(o), undefined, 'value not set'); + + channel.set(o, 42); + st.equal(channel.get(o), 42, 'value was set'); + + channel.set(o, Infinity); + st.equal(channel.get(o), Infinity, 'value was set again'); + + var o2 = {}; + channel.set(o2, 17); + st.equal(channel.get(o), Infinity, 'o is not modified'); + st.equal(channel.get(o2), 17, 'o2 is set'); + + channel.set(o, 14); + st.equal(channel.get(o), 14, 'o is modified'); + st.equal(channel.get(o2), 17, 'o2 is not modified'); + + st.end(); + }); + + t.test('delete', function (st) { + var channel = getSideChannel(); + var o = {}; + st.equal(channel['delete']({}), false, 'nonexistent value yields false'); + + channel.set(o, 42); + st.equal(channel.has(o), true, 'value is set'); + + st.equal(channel['delete']({}), false, 'nonexistent value still yields false'); + + st.equal(channel['delete'](o), true, 'deleted value yields true'); + + st.equal(channel.has(o), false, 'value is no longer set'); + + st.end(); + }); + + t.end(); +}); + +test('getSideChannelMap, no WeakMaps and/or Maps', { skip: typeof WeakMap === 'function' || typeof Map === 'function' }, function (t) { + t.equal(getSideChannelWeakMap, false, 'is false'); + + t.end(); +}); diff --git a/node_modules/side-channel-weakmap/tsconfig.json b/node_modules/side-channel-weakmap/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/side-channel-weakmap/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/side-channel/.editorconfig b/node_modules/side-channel/.editorconfig new file mode 100644 index 000000000..72e0ebaa7 --- /dev/null +++ b/node_modules/side-channel/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/node_modules/side-channel/.eslintrc b/node_modules/side-channel/.eslintrc new file mode 100644 index 000000000..9b13ad8ba --- /dev/null +++ b/node_modules/side-channel/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "max-lines-per-function": 0, + "multiline-comment-style": 1, + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/node_modules/side-channel/.github/FUNDING.yml b/node_modules/side-channel/.github/FUNDING.yml new file mode 100644 index 000000000..2a94840c6 --- /dev/null +++ b/node_modules/side-channel/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/side-channel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/side-channel/.nycrc b/node_modules/side-channel/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/side-channel/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/side-channel/CHANGELOG.md b/node_modules/side-channel/CHANGELOG.md new file mode 100644 index 000000000..58e378c72 --- /dev/null +++ b/node_modules/side-channel/CHANGELOG.md @@ -0,0 +1,110 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.0](https://github.com/ljharb/side-channel/compare/v1.0.6...v1.1.0) - 2024-12-11 + +### Commits + +- [Refactor] extract implementations to `side-channel-weakmap`, `side-channel-map`, `side-channel-list` [`ada5955`](https://github.com/ljharb/side-channel/commit/ada595549a5c4c6c853756d598846b180941c6da) +- [New] add `channel.delete` [`c01d2d3`](https://github.com/ljharb/side-channel/commit/c01d2d3fd51dbb1ce6da72ad7916e61bd6172aad) +- [types] improve types [`0c54356`](https://github.com/ljharb/side-channel/commit/0c5435651417df41b8cc1a5f7cdce8bffae68cde) +- [readme] add content [`be24868`](https://github.com/ljharb/side-channel/commit/be248682ac294b0e22c883092c45985aa91c490a) +- [actions] split out node 10-20, and 20+ [`c4488e2`](https://github.com/ljharb/side-channel/commit/c4488e241ef3d49a19fe266ac830a2e644305911) +- [types] use shared tsconfig [`0e0d57c`](https://github.com/ljharb/side-channel/commit/0e0d57c2ff17c7b45c6cbd43ebcf553edc9e3adc) +- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `tape` [`fb4f622`](https://github.com/ljharb/side-channel/commit/fb4f622e64a99a1e40b6e5cd7691674a9dc429e4) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`b78336b`](https://github.com/ljharb/side-channel/commit/b78336b886172d1b457d414ac9e28de8c5fecc78) +- [Tests] replace `aud` with `npm audit` [`ee3ab46`](https://github.com/ljharb/side-channel/commit/ee3ab4690d954311c35115651bcfd45edd205aa1) +- [Dev Deps] add missing peer dep [`c03e21a`](https://github.com/ljharb/side-channel/commit/c03e21a7def3b67cdc15ae22316884fefcb2f6a8) + +## [v1.0.6](https://github.com/ljharb/side-channel/compare/v1.0.5...v1.0.6) - 2024-02-29 + +### Commits + +- add types [`9beef66`](https://github.com/ljharb/side-channel/commit/9beef6643e6d717ea57bedabf86448123a7dd9e9) +- [meta] simplify `exports` [`4334cf9`](https://github.com/ljharb/side-channel/commit/4334cf9df654151504c383b62a2f9ebdc8d9d5ac) +- [Deps] update `call-bind` [`d6043c4`](https://github.com/ljharb/side-channel/commit/d6043c4d8f4d7be9037dd0f0419c7a2e0e39ec6a) +- [Dev Deps] update `tape` [`6aca376`](https://github.com/ljharb/side-channel/commit/6aca3761868dc8cd5ff7fd9799bf6b95e09a6eb0) + +## [v1.0.5](https://github.com/ljharb/side-channel/compare/v1.0.4...v1.0.5) - 2024-02-06 + +### Commits + +- [actions] reuse common workflows [`3d2e1ff`](https://github.com/ljharb/side-channel/commit/3d2e1ffd16dd6eaaf3e40ff57951f840d2d63c04) +- [meta] use `npmignore` to autogenerate an npmignore file [`04296ea`](https://github.com/ljharb/side-channel/commit/04296ea17d1544b0a5d20fd5bfb31aa4f6513eb9) +- [meta] add `.editorconfig`; add `eclint` [`130f0a6`](https://github.com/ljharb/side-channel/commit/130f0a6adbc04d385c7456a601d38344dce3d6a9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`d480c2f`](https://github.com/ljharb/side-channel/commit/d480c2fbe757489ae9b4275491ffbcc3ac4725e9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ecbe70e`](https://github.com/ljharb/side-channel/commit/ecbe70e53a418234081a77971fec1fdfae20c841) +- [actions] update rebase action [`75240b9`](https://github.com/ljharb/side-channel/commit/75240b9963b816e8846400d2287cb68f88c7fba7) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`ae8d281`](https://github.com/ljharb/side-channel/commit/ae8d281572430099109870fd9430d2ca3f320b8d) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`7125b88`](https://github.com/ljharb/side-channel/commit/7125b885fd0eacad4fee9b073b72d14065ece278) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`82577c9`](https://github.com/ljharb/side-channel/commit/82577c9796304519139a570f82a317211b5f3b86) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`550aadf`](https://github.com/ljharb/side-channel/commit/550aadf20475a6081fd70304cc54f77259a5c8a8) +- [Tests] increase coverage [`5130877`](https://github.com/ljharb/side-channel/commit/5130877a7b27c862e64e6d1c12a178b28808859d) +- [Deps] update `get-intrinsic`, `object-inspect` [`ba0194c`](https://github.com/ljharb/side-channel/commit/ba0194c505b1a8a0427be14cadd5b8a46d4d01b8) +- [meta] add missing `engines.node` [`985fd24`](https://github.com/ljharb/side-channel/commit/985fd249663cb06617a693a94fe08cad12f5cb70) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`40227a8`](https://github.com/ljharb/side-channel/commit/40227a87b01709ad2c0eebf87eb4223a800099b9) +- [Deps] update `get-intrinsic` [`a989b40`](https://github.com/ljharb/side-channel/commit/a989b4024958737ae7be9fbffdeff2078f33a0fd) +- [Deps] update `object-inspect` [`aec42d2`](https://github.com/ljharb/side-channel/commit/aec42d2ec541a31aaa02475692c87d489237d9a3) + +## [v1.0.4](https://github.com/ljharb/side-channel/compare/v1.0.3...v1.0.4) - 2020-12-29 + +### Commits + +- [Tests] migrate tests to Github Actions [`10909cb`](https://github.com/ljharb/side-channel/commit/10909cbf8ce9c0bf96f604cf13d7ffd5a22c2d40) +- [Refactor] Use a linked list rather than an array, and move accessed nodes to the beginning [`195613f`](https://github.com/ljharb/side-channel/commit/195613f28b5c1e6072ef0b61b5beebaf2b6a304e) +- [meta] do not publish github action workflow files [`290ec29`](https://github.com/ljharb/side-channel/commit/290ec29cd21a60585145b4a7237ec55228c52c27) +- [Tests] run `nyc` on all tests; use `tape` runner [`ea6d030`](https://github.com/ljharb/side-channel/commit/ea6d030ff3fe6be2eca39e859d644c51ecd88869) +- [actions] add "Allow Edits" workflow [`d464d8f`](https://github.com/ljharb/side-channel/commit/d464d8fe52b5eddf1504a0ed97f0941a90f32c15) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`02daca8`](https://github.com/ljharb/side-channel/commit/02daca87c6809821c97be468d1afa2f5ef447383) +- [Refactor] use `call-bind` and `get-intrinsic` instead of `es-abstract` [`e09d481`](https://github.com/ljharb/side-channel/commit/e09d481528452ebafa5cdeae1af665c35aa2deee) +- [Deps] update `object.assign` [`ee83aa8`](https://github.com/ljharb/side-channel/commit/ee83aa81df313b5e46319a63adb05cf0c179079a) +- [actions] update rebase action to use checkout v2 [`7726b0b`](https://github.com/ljharb/side-channel/commit/7726b0b058b632fccea709f58960871defaaa9d7) + +## [v1.0.3](https://github.com/ljharb/side-channel/compare/v1.0.2...v1.0.3) - 2020-08-23 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`1f10561`](https://github.com/ljharb/side-channel/commit/1f105611ef3acf32dec8032ae5c0baa5e56bb868) +- [Deps] update `es-abstract`, `object-inspect` [`bc20159`](https://github.com/ljharb/side-channel/commit/bc201597949a505e37cef9eaf24c7010831e6f03) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`b9b2b22`](https://github.com/ljharb/side-channel/commit/b9b2b225f9e0ea72a6ec2b89348f0bd690bc9ed1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7055ab4`](https://github.com/ljharb/side-channel/commit/7055ab4de0860606efd2003674a74f1fe6ebc07e) +- [Dev Deps] update `auto-changelog`; add `aud` [`d278c37`](https://github.com/ljharb/side-channel/commit/d278c37d08227be4f84aa769fcd919e73feeba40) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`3bcf982`](https://github.com/ljharb/side-channel/commit/3bcf982faa122745b39c33ce83d32fdf003741c6) +- [Tests] only audit prod deps [`18d01c4`](https://github.com/ljharb/side-channel/commit/18d01c4015b82a3d75044c4d5ba7917b2eac01ec) +- [Deps] update `es-abstract` [`6ab096d`](https://github.com/ljharb/side-channel/commit/6ab096d9de2b482cf5e0717e34e212f5b2b9bc9a) +- [Dev Deps] update `tape` [`9dc174c`](https://github.com/ljharb/side-channel/commit/9dc174cc651dfd300b4b72da936a0a7eda5f9452) +- [Deps] update `es-abstract` [`431d0f0`](https://github.com/ljharb/side-channel/commit/431d0f0ff11fbd2ae6f3115582a356d3a1cfce82) +- [Deps] update `es-abstract` [`49869fd`](https://github.com/ljharb/side-channel/commit/49869fd323bf4453f0ba515c0fb265cf5ab7b932) +- [meta] Add package.json to package's exports [`77d9cdc`](https://github.com/ljharb/side-channel/commit/77d9cdceb2a9e47700074f2ae0c0a202e7dac0d4) + +## [v1.0.2](https://github.com/ljharb/side-channel/compare/v1.0.1...v1.0.2) - 2019-12-20 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`4a526df`](https://github.com/ljharb/side-channel/commit/4a526df44e4701566ed001ec78546193f818b082) +- [Deps] update `es-abstract` [`d4f6e62`](https://github.com/ljharb/side-channel/commit/d4f6e629b6fb93a07415db7f30d3c90fd7f264fe) + +## [v1.0.1](https://github.com/ljharb/side-channel/compare/v1.0.0...v1.0.1) - 2019-12-01 + +### Commits + +- [Fix] add missing "exports" [`d212907`](https://github.com/ljharb/side-channel/commit/d2129073abf0701a5343bf28aa2145617604dc2e) + +## v1.0.0 - 2019-12-01 + +### Commits + +- Initial implementation [`dbebd3a`](https://github.com/ljharb/side-channel/commit/dbebd3a4b5ed64242f9a6810efe7c4214cd8cde4) +- Initial tests [`73bdefe`](https://github.com/ljharb/side-channel/commit/73bdefe568c9076cf8c0b8719bc2141aec0e19b8) +- Initial commit [`43c03e1`](https://github.com/ljharb/side-channel/commit/43c03e1c2849ec50a87b7a5cd76238a62b0b8770) +- npm init [`5c090a7`](https://github.com/ljharb/side-channel/commit/5c090a765d66a5527d9889b89aeff78dee91348c) +- [meta] add `auto-changelog` [`a5c4e56`](https://github.com/ljharb/side-channel/commit/a5c4e5675ec02d5eb4d84b4243aeea2a1d38fbec) +- [actions] add automatic rebasing / merge commit blocking [`bab1683`](https://github.com/ljharb/side-channel/commit/bab1683d8f9754b086e94397699fdc645e0d7077) +- [meta] add `funding` field; create FUNDING.yml [`63d7aea`](https://github.com/ljharb/side-channel/commit/63d7aeaf34f5650650ae97ca4b9fae685bd0937c) +- [Tests] add `npm run lint` [`46a5a81`](https://github.com/ljharb/side-channel/commit/46a5a81705cd2664f83df232c01dbbf2ee952885) +- Only apps should have lockfiles [`8b16b03`](https://github.com/ljharb/side-channel/commit/8b16b0305f00895d90c4e2e5773c854cfea0e448) +- [meta] add `safe-publish-latest` [`2f098ef`](https://github.com/ljharb/side-channel/commit/2f098ef092a39399cfe548b19a1fc03c2fd2f490) diff --git a/node_modules/side-channel/LICENSE b/node_modules/side-channel/LICENSE new file mode 100644 index 000000000..3900dd7e2 --- /dev/null +++ b/node_modules/side-channel/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/side-channel/README.md b/node_modules/side-channel/README.md new file mode 100644 index 000000000..cc7e10358 --- /dev/null +++ b/node_modules/side-channel/README.md @@ -0,0 +1,61 @@ +# side-channel [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Store information about any JS value in a side channel. Uses WeakMap if available. + +Warning: in an environment that lacks `WeakMap`, this implementation will leak memory until you `delete` the `key`. + +## Getting started + +```sh +npm install --save side-channel +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const getSideChannel = require('side-channel'); + +const channel = getSideChannel(); + +const key = {}; +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); + +channel.set(key, 42); + +channel.assert(key); // does not throw +assert.equal(channel.has(key), true); +assert.equal(channel.get(key), 42); + +channel.delete(key); +assert.equal(channel.has(key), false); +assert.throws(() => channel.assert(key), TypeError); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/side-channel +[npm-version-svg]: https://versionbadg.es/ljharb/side-channel.svg +[deps-svg]: https://david-dm.org/ljharb/side-channel.svg +[deps-url]: https://david-dm.org/ljharb/side-channel +[dev-deps-svg]: https://david-dm.org/ljharb/side-channel/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/side-channel#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/side-channel.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/side-channel.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/side-channel.svg +[downloads-url]: https://npm-stat.com/charts.html?package=side-channel +[codecov-image]: https://codecov.io/gh/ljharb/side-channel/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel +[actions-url]: https://github.com/ljharb/side-channel/actions diff --git a/node_modules/side-channel/index.d.ts b/node_modules/side-channel/index.d.ts new file mode 100644 index 000000000..18c63171c --- /dev/null +++ b/node_modules/side-channel/index.d.ts @@ -0,0 +1,14 @@ +import getSideChannelList from 'side-channel-list'; +import getSideChannelMap from 'side-channel-map'; +import getSideChannelWeakMap from 'side-channel-weakmap'; + +declare namespace getSideChannel { + type Channel = + | getSideChannelList.Channel + | ReturnType, false>> + | ReturnType, false>>; +} + +declare function getSideChannel(): getSideChannel.Channel; + +export = getSideChannel; diff --git a/node_modules/side-channel/index.js b/node_modules/side-channel/index.js new file mode 100644 index 000000000..a8a9b0559 --- /dev/null +++ b/node_modules/side-channel/index.js @@ -0,0 +1,43 @@ +'use strict'; + +var $TypeError = require('es-errors/type'); +var inspect = require('object-inspect'); +var getSideChannelList = require('side-channel-list'); +var getSideChannelMap = require('side-channel-map'); +var getSideChannelWeakMap = require('side-channel-weakmap'); + +var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList; + +/** @type {import('.')} */ +module.exports = function getSideChannel() { + /** @typedef {ReturnType} Channel */ + + /** @type {Channel | undefined} */ var $channelData; + + /** @type {Channel} */ + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + 'delete': function (key) { + return !!$channelData && $channelData['delete'](key); + }, + get: function (key) { + return $channelData && $channelData.get(key); + }, + has: function (key) { + return !!$channelData && $channelData.has(key); + }, + set: function (key, value) { + if (!$channelData) { + $channelData = makeChannel(); + } + + $channelData.set(key, value); + } + }; + // @ts-expect-error TODO: figure out why this is erroring + return channel; +}; diff --git a/node_modules/side-channel/package.json b/node_modules/side-channel/package.json new file mode 100644 index 000000000..30fa42cd8 --- /dev/null +++ b/node_modules/side-channel/package.json @@ -0,0 +1,85 @@ +{ + "name": "side-channel", + "version": "1.1.0", + "description": "Store information about any JS value in a side channel. Uses WeakMap if available.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/side-channel.git" + }, + "keywords": [ + "weakmap", + "map", + "side", + "channel", + "metadata" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/side-channel/issues" + }, + "homepage": "https://github.com/ljharb/side-channel#readme", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/side-channel/test/index.js b/node_modules/side-channel/test/index.js new file mode 100644 index 000000000..bd1e7c2a2 --- /dev/null +++ b/node_modules/side-channel/test/index.js @@ -0,0 +1,104 @@ +'use strict'; + +var test = require('tape'); + +var getSideChannel = require('../'); + +test('getSideChannel', function (t) { + t.test('export', function (st) { + st.equal(typeof getSideChannel, 'function', 'is a function'); + + st.equal(getSideChannel.length, 0, 'takes no arguments'); + + var channel = getSideChannel(); + st.ok(channel, 'is truthy'); + st.equal(typeof channel, 'object', 'is an object'); + st.end(); + }); + + t.test('assert', function (st) { + var channel = getSideChannel(); + st['throws']( + function () { channel.assert({}); }, + TypeError, + 'nonexistent value throws' + ); + + var o = {}; + channel.set(o, 'data'); + st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops'); + + st.end(); + }); + + t.test('has', function (st) { + var channel = getSideChannel(); + /** @type {unknown[]} */ var o = []; + + st.equal(channel.has(o), false, 'nonexistent value yields false'); + + channel.set(o, 'foo'); + st.equal(channel.has(o), true, 'existent value yields true'); + + st.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + st.equal(channel.has('abc'), true, 'non object value that exists yields true'); + + st.end(); + }); + + t.test('get', function (st) { + var channel = getSideChannel(); + var o = {}; + st.equal(channel.get(o), undefined, 'nonexistent value yields undefined'); + + var data = {}; + channel.set(o, data); + st.equal(channel.get(o), data, '"get" yields data set by "set"'); + + st.end(); + }); + + t.test('set', function (st) { + var channel = getSideChannel(); + var o = function () {}; + st.equal(channel.get(o), undefined, 'value not set'); + + channel.set(o, 42); + st.equal(channel.get(o), 42, 'value was set'); + + channel.set(o, Infinity); + st.equal(channel.get(o), Infinity, 'value was set again'); + + var o2 = {}; + channel.set(o2, 17); + st.equal(channel.get(o), Infinity, 'o is not modified'); + st.equal(channel.get(o2), 17, 'o2 is set'); + + channel.set(o, 14); + st.equal(channel.get(o), 14, 'o is modified'); + st.equal(channel.get(o2), 17, 'o2 is not modified'); + + st.end(); + }); + + t.test('delete', function (st) { + var channel = getSideChannel(); + var o = {}; + st.equal(channel['delete']({}), false, 'nonexistent value yields false'); + + channel.set(o, 42); + st.equal(channel.has(o), true, 'value is set'); + + st.equal(channel['delete']({}), false, 'nonexistent value still yields false'); + + st.equal(channel['delete'](o), true, 'deleted value yields true'); + + st.equal(channel.has(o), false, 'value is no longer set'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/side-channel/tsconfig.json b/node_modules/side-channel/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/side-channel/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/slice-ansi/index.js b/node_modules/slice-ansi/index.js new file mode 100755 index 000000000..c65de4d4a --- /dev/null +++ b/node_modules/slice-ansi/index.js @@ -0,0 +1,80 @@ +'use strict'; + +var ESCAPES = [ + '\u001b', + '\u009b' +]; + +var END_CODE = 39; + +var ESCAPE_CODES = { + 0: 0, + 1: 22, + 2: 22, + 3: 23, + 4: 24, + 7: 27, + 8: 28, + 9: 29, + 30: 39, + 31: 39, + 32: 39, + 33: 39, + 34: 39, + 35: 39, + 36: 39, + 37: 39, + 90: 39, + 40: 49, + 41: 49, + 42: 49, + 43: 49, + 44: 49, + 45: 49, + 46: 49, + 47: 49 +}; + +function wrapAnsi(code) { + return ESCAPES[0] + '[' + code + 'm'; +} + +module.exports = function (str, begin, end) { + end = end || str.length; + var insideEscape = false; + var escapeCode; + var visible = 0; + var output = ''; + + for (var i = 0; i < str.length; i++) { + var leftEscape = false; + var x = str[i]; + + if (ESCAPES.indexOf(x) !== -1) { + insideEscape = true; + var code = /[0-9][^m]*/.exec(str.slice(i, i + 4)); + escapeCode = code === END_CODE ? null : code; + } else if (insideEscape && x === 'm') { + insideEscape = false; + leftEscape = true; + } + + if (!insideEscape && !leftEscape) { + ++visible; + } + + if (visible > begin && visible <= end) { + output += x; + } else if (visible === begin && escapeCode !== undefined && escapeCode !== END_CODE) { + output += wrapAnsi(escapeCode); + } else if (visible >= end) { + if (escapeCode !== undefined) { + output += wrapAnsi(ESCAPE_CODES[escapeCode] || END_CODE); + } + break; + } + } + + return output; +}; + diff --git a/node_modules/slice-ansi/license b/node_modules/slice-ansi/license new file mode 100755 index 000000000..3ecaf413e --- /dev/null +++ b/node_modules/slice-ansi/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 DC + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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/slice-ansi/package.json b/node_modules/slice-ansi/package.json new file mode 100644 index 000000000..70bc93162 --- /dev/null +++ b/node_modules/slice-ansi/package.json @@ -0,0 +1,56 @@ +{ + "name": "slice-ansi", + "version": "0.0.4", + "description": "Slice a string with ANSI escape codes", + "license": "MIT", + "repository": "chalk/slice-ansi", + "author": { + "name": "David Caccavella", + "email": "threedeecee@gmail.com" + }, + "maintainers": [ + "David Caccavella (github.com/dthree)", + "Sindre Sorhus (sindresorhus.com)", + "Joshua Appelman (jbnicolai.com)", + "JD Ballard (github.com/qix-)" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js && xo" + }, + "files": [ + "index.js" + ], + "keywords": [ + "slice", + "string", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": {}, + "devDependencies": { + "ava": "^0.2.0", + "chalk": "^1.1.1", + "strip-ansi": "^3.0.0", + "xo": "*" + } +} diff --git a/node_modules/slice-ansi/readme.md b/node_modules/slice-ansi/readme.md new file mode 100755 index 000000000..31be6124d --- /dev/null +++ b/node_modules/slice-ansi/readme.md @@ -0,0 +1,56 @@ +# slice-ansi + +[![Build Status](https://travis-ci.org/vorpaljs/slice-ansi.svg?branch=master)](https://travis-ci.org/vorpaljs/slice-ansi) +[![XO: Linted](https://img.shields.io/badge/xo-linted-blue.svg)](https://github.com/sindresorhus/xo) + +> Slice a string with [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) + +## Install + +``` +$ npm install --save slice-ansi +``` + +## Usage + +```js +var chalk = require('chalk'); +var sliceAnsi = require('slice-ansi'); + +var input = 'The quick brown ' + chalk.red('fox jumped over ') + + 'the lazy ' + chalk.green('dog and then ran away with the unicorn.'); + +console.log(sliceAnsi(input, 20, 30)); +``` + +## API + +### sliceAnsi(input, beginSlice[, endSlice]) + +#### input + +Type: `string` + +String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). + +#### beginSlice + +Type: `number` + +The zero-based index at which to begin the slice. + +#### endSlice + +Type: `number` + +Optional. The zero-based index at which to end the slice. + + +## Related + +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## License + +MIT © [David Caccavella](https://githbu.com/dthree) diff --git a/node_modules/spdx-correct/LICENSE b/node_modules/spdx-correct/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/node_modules/spdx-correct/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/spdx-correct/README.md b/node_modules/spdx-correct/README.md new file mode 100644 index 000000000..af563d865 --- /dev/null +++ b/node_modules/spdx-correct/README.md @@ -0,0 +1,22 @@ +## Usage + +```javascript +var correct = require('spdx-correct') +var assert = require('assert') + +assert.strictEqual(correct('mit'), 'MIT') + +assert.strictEqual(correct('Apache 2'), 'Apache-2.0') + +assert(correct('No idea what license') === null) + +// disable upgrade option +assert(correct('GPL-3.0'), 'GPL-3.0-or-later') +assert(correct('GPL-3.0', { upgrade: false }), 'GPL-3.0') +``` + +## Contributors + +spdx-correct has benefited from the work of several contributors. +See [the GitHub repository](https://github.com/jslicense/spdx-correct.js/graphs/contributors) +for more information. diff --git a/node_modules/spdx-correct/index.js b/node_modules/spdx-correct/index.js new file mode 100644 index 000000000..4d9037e0c --- /dev/null +++ b/node_modules/spdx-correct/index.js @@ -0,0 +1,386 @@ +/* +Copyright spdx-correct.js contributors + +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. +*/ +var parse = require('spdx-expression-parse') +var spdxLicenseIds = require('spdx-license-ids') + +function valid (string) { + try { + parse(string) + return true + } catch (error) { + return false + } +} + +// Sorting function that orders the given array of transpositions such +// that a transposition with the longer pattern comes before a transposition +// with a shorter pattern. This is to prevent e.g. the transposition +// ["General Public License", "GPL"] from matching to "Lesser General Public License" +// before a longer and more accurate transposition ["Lesser General Public License", "LGPL"] +// has a chance to be recognized. +function sortTranspositions(a, b) { + var length = b[0].length - a[0].length + if (length !== 0) return length + return a[0].toUpperCase().localeCompare(b[0].toUpperCase()) +} + +// Common transpositions of license identifier acronyms +var transpositions = [ + ['APGL', 'AGPL'], + ['Gpl', 'GPL'], + ['GLP', 'GPL'], + ['APL', 'Apache'], + ['ISD', 'ISC'], + ['GLP', 'GPL'], + ['IST', 'ISC'], + ['Claude', 'Clause'], + [' or later', '+'], + [' International', ''], + ['GNU', 'GPL'], + ['GUN', 'GPL'], + ['+', ''], + ['GNU GPL', 'GPL'], + ['GNU LGPL', 'LGPL'], + ['GNU/GPL', 'GPL'], + ['GNU GLP', 'GPL'], + ['GNU LESSER GENERAL PUBLIC LICENSE', 'LGPL'], + ['GNU Lesser General Public License', 'LGPL'], + ['GNU LESSER GENERAL PUBLIC LICENSE', 'LGPL-2.1'], + ['GNU Lesser General Public License', 'LGPL-2.1'], + ['LESSER GENERAL PUBLIC LICENSE', 'LGPL'], + ['Lesser General Public License', 'LGPL'], + ['LESSER GENERAL PUBLIC LICENSE', 'LGPL-2.1'], + ['Lesser General Public License', 'LGPL-2.1'], + ['GNU General Public License', 'GPL'], + ['Gnu public license', 'GPL'], + ['GNU Public License', 'GPL'], + ['GNU GENERAL PUBLIC LICENSE', 'GPL'], + ['MTI', 'MIT'], + ['Mozilla Public License', 'MPL'], + ['Universal Permissive License', 'UPL'], + ['WTH', 'WTF'], + ['WTFGPL', 'WTFPL'], + ['-License', ''] +].sort(sortTranspositions) + +var TRANSPOSED = 0 +var CORRECT = 1 + +// Simple corrections to nearly valid identifiers. +var transforms = [ + // e.g. 'mit' + function (argument) { + return argument.toUpperCase() + }, + // e.g. 'MIT ' + function (argument) { + return argument.trim() + }, + // e.g. 'M.I.T.' + function (argument) { + return argument.replace(/\./g, '') + }, + // e.g. 'Apache- 2.0' + function (argument) { + return argument.replace(/\s+/g, '') + }, + // e.g. 'CC BY 4.0'' + function (argument) { + return argument.replace(/\s+/g, '-') + }, + // e.g. 'LGPLv2.1' + function (argument) { + return argument.replace('v', '-') + }, + // e.g. 'Apache 2.0' + function (argument) { + return argument.replace(/,?\s*(\d)/, '-$1') + }, + // e.g. 'GPL 2' + function (argument) { + return argument.replace(/,?\s*(\d)/, '-$1.0') + }, + // e.g. 'Apache Version 2.0' + function (argument) { + return argument + .replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2') + }, + // e.g. 'Apache Version 2' + function (argument) { + return argument + .replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0') + }, + // e.g. 'ZLIB' + function (argument) { + return argument[0].toUpperCase() + argument.slice(1) + }, + // e.g. 'MPL/2.0' + function (argument) { + return argument.replace('/', '-') + }, + // e.g. 'Apache 2' + function (argument) { + return argument + .replace(/\s*V\s*(\d)/, '-$1') + .replace(/(\d)$/, '$1.0') + }, + // e.g. 'GPL-2.0', 'GPL-3.0' + function (argument) { + if (argument.indexOf('3.0') !== -1) { + return argument + '-or-later' + } else { + return argument + '-only' + } + }, + // e.g. 'GPL-2.0-' + function (argument) { + return argument + 'only' + }, + // e.g. 'GPL2' + function (argument) { + return argument.replace(/(\d)$/, '-$1.0') + }, + // e.g. 'BSD 3' + function (argument) { + return argument.replace(/(-| )?(\d)$/, '-$2-Clause') + }, + // e.g. 'BSD clause 3' + function (argument) { + return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause') + }, + // e.g. 'New BSD license' + function (argument) { + return argument.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i, 'BSD-3-Clause') + }, + // e.g. 'Simplified BSD license' + function (argument) { + return argument.replace(/\bSimplified(-| )?BSD((-| )License)?/i, 'BSD-2-Clause') + }, + // e.g. 'Free BSD license' + function (argument) { + return argument.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i, 'BSD-2-Clause-$1BSD') + }, + // e.g. 'Clear BSD license' + function (argument) { + return argument.replace(/\bClear(-| )?BSD((-| )License)?/i, 'BSD-3-Clause-Clear') + }, + // e.g. 'Old BSD License' + function (argument) { + return argument.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i, 'BSD-4-Clause') + }, + // e.g. 'BY-NC-4.0' + function (argument) { + return 'CC-' + argument + }, + // e.g. 'BY-NC' + function (argument) { + return 'CC-' + argument + '-4.0' + }, + // e.g. 'Attribution-NonCommercial' + function (argument) { + return argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, '') + }, + // e.g. 'Attribution-NonCommercial' + function (argument) { + return 'CC-' + + argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, '') + + '-4.0' + } +] + +var licensesWithVersions = spdxLicenseIds + .map(function (id) { + var match = /^(.*)-\d+\.\d+$/.exec(id) + return match + ? [match[0], match[1]] + : [id, null] + }) + .reduce(function (objectMap, item) { + var key = item[1] + objectMap[key] = objectMap[key] || [] + objectMap[key].push(item[0]) + return objectMap + }, {}) + +var licensesWithOneVersion = Object.keys(licensesWithVersions) + .map(function makeEntries (key) { + return [key, licensesWithVersions[key]] + }) + .filter(function identifySoleVersions (item) { + return ( + // Licenses has just one valid version suffix. + item[1].length === 1 && + item[0] !== null && + // APL will be considered Apache, rather than APL-1.0 + item[0] !== 'APL' + ) + }) + .map(function createLastResorts (item) { + return [item[0], item[1][0]] + }) + +licensesWithVersions = undefined + +// If all else fails, guess that strings containing certain substrings +// meant to identify certain licenses. +var lastResorts = [ + ['UNLI', 'Unlicense'], + ['WTF', 'WTFPL'], + ['2 CLAUSE', 'BSD-2-Clause'], + ['2-CLAUSE', 'BSD-2-Clause'], + ['3 CLAUSE', 'BSD-3-Clause'], + ['3-CLAUSE', 'BSD-3-Clause'], + ['AFFERO', 'AGPL-3.0-or-later'], + ['AGPL', 'AGPL-3.0-or-later'], + ['APACHE', 'Apache-2.0'], + ['ARTISTIC', 'Artistic-2.0'], + ['Affero', 'AGPL-3.0-or-later'], + ['BEER', 'Beerware'], + ['BOOST', 'BSL-1.0'], + ['BSD', 'BSD-2-Clause'], + ['CDDL', 'CDDL-1.1'], + ['ECLIPSE', 'EPL-1.0'], + ['FUCK', 'WTFPL'], + ['GNU', 'GPL-3.0-or-later'], + ['LGPL', 'LGPL-3.0-or-later'], + ['GPLV1', 'GPL-1.0-only'], + ['GPL-1', 'GPL-1.0-only'], + ['GPLV2', 'GPL-2.0-only'], + ['GPL-2', 'GPL-2.0-only'], + ['GPL', 'GPL-3.0-or-later'], + ['MIT +NO-FALSE-ATTRIBS', 'MITNFA'], + ['MIT', 'MIT'], + ['MPL', 'MPL-2.0'], + ['X11', 'X11'], + ['ZLIB', 'Zlib'] +].concat(licensesWithOneVersion).sort(sortTranspositions) + +var SUBSTRING = 0 +var IDENTIFIER = 1 + +var validTransformation = function (identifier) { + for (var i = 0; i < transforms.length; i++) { + var transformed = transforms[i](identifier).trim() + if (transformed !== identifier && valid(transformed)) { + return transformed + } + } + return null +} + +var validLastResort = function (identifier) { + var upperCased = identifier.toUpperCase() + for (var i = 0; i < lastResorts.length; i++) { + var lastResort = lastResorts[i] + if (upperCased.indexOf(lastResort[SUBSTRING]) > -1) { + return lastResort[IDENTIFIER] + } + } + return null +} + +var anyCorrection = function (identifier, check) { + for (var i = 0; i < transpositions.length; i++) { + var transposition = transpositions[i] + var transposed = transposition[TRANSPOSED] + if (identifier.indexOf(transposed) > -1) { + var corrected = identifier.replace( + transposed, + transposition[CORRECT] + ) + var checked = check(corrected) + if (checked !== null) { + return checked + } + } + } + return null +} + +module.exports = function (identifier, options) { + options = options || {} + var upgrade = options.upgrade === undefined ? true : !!options.upgrade + function postprocess (value) { + return upgrade ? upgradeGPLs(value) : value + } + var validArugment = ( + typeof identifier === 'string' && + identifier.trim().length !== 0 + ) + if (!validArugment) { + throw Error('Invalid argument. Expected non-empty string.') + } + identifier = identifier.trim() + if (valid(identifier)) { + return postprocess(identifier) + } + var noPlus = identifier.replace(/\+$/, '').trim() + if (valid(noPlus)) { + return postprocess(noPlus) + } + var transformed = validTransformation(identifier) + if (transformed !== null) { + return postprocess(transformed) + } + transformed = anyCorrection(identifier, function (argument) { + if (valid(argument)) { + return argument + } + return validTransformation(argument) + }) + if (transformed !== null) { + return postprocess(transformed) + } + transformed = validLastResort(identifier) + if (transformed !== null) { + return postprocess(transformed) + } + transformed = anyCorrection(identifier, validLastResort) + if (transformed !== null) { + return postprocess(transformed) + } + return null +} + +function upgradeGPLs (value) { + if ([ + 'GPL-1.0', 'LGPL-1.0', 'AGPL-1.0', + 'GPL-2.0', 'LGPL-2.0', 'AGPL-2.0', + 'LGPL-2.1' + ].indexOf(value) !== -1) { + return value + '-only' + } else if ([ + 'GPL-1.0+', 'GPL-2.0+', 'GPL-3.0+', + 'LGPL-2.0+', 'LGPL-2.1+', 'LGPL-3.0+', + 'AGPL-1.0+', 'AGPL-3.0+' + ].indexOf(value) !== -1) { + return value.replace(/\+$/, '-or-later') + } else if (['GPL-3.0', 'LGPL-3.0', 'AGPL-3.0'].indexOf(value) !== -1) { + return value + '-or-later' + } else { + return value + } +} diff --git a/node_modules/spdx-correct/package.json b/node_modules/spdx-correct/package.json new file mode 100644 index 000000000..d77615638 --- /dev/null +++ b/node_modules/spdx-correct/package.json @@ -0,0 +1,32 @@ +{ + "name": "spdx-correct", + "description": "correct invalid SPDX expressions", + "version": "3.2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.0.0", + "standard": "^14.3.4", + "standard-markdown": "^6.0.0", + "tape": "^5.0.1" + }, + "files": [ + "index.js" + ], + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata" + ], + "license": "Apache-2.0", + "repository": "jslicense/spdx-correct.js", + "scripts": { + "lint": "standard && standard-markdown README.md", + "test": "defence README.md | replace-require-self | node && node test.js" + } +} diff --git a/node_modules/spdx-exceptions/README.md b/node_modules/spdx-exceptions/README.md new file mode 100644 index 000000000..6c927ecc6 --- /dev/null +++ b/node_modules/spdx-exceptions/README.md @@ -0,0 +1,36 @@ +The package exports an array of strings. Each string is an identifier +for a license exception under the [Software Package Data Exchange +(SPDX)][SPDX] software license metadata standard. + +[SPDX]: https://spdx.org + +## Copyright and Licensing + +### SPDX + +"SPDX" is a federally registered United States trademark of The Linux +Foundation Corporation. + +From version 2.0 of the [SPDX] specification: + +> Copyright © 2010-2015 Linux Foundation and its Contributors. Licensed +> under the Creative Commons Attribution License 3.0 Unported. All other +> rights are expressly reserved. + +The Linux Foundation and the SPDX working groups are good people. Only +they decide what "SPDX" means, as a standard and otherwise. I respect +their work and their rights. You should, too. + +### This Package + +> I created this package by copying exception identifiers out of the +> SPDX specification. That work was mechanical, routine, and required no +> creativity whatsoever. - Kyle Mitchell, package author + +United States users concerned about intellectual property may wish to +discuss the following Supreme Court decisions with their attorneys: + +- _Baker v. Selden_, 101 U.S. 99 (1879) + +- _Feist Publications, Inc., v. Rural Telephone Service Co._, + 499 U.S. 340 (1991) diff --git a/node_modules/spdx-exceptions/deprecated.json b/node_modules/spdx-exceptions/deprecated.json new file mode 100644 index 000000000..cba7e2bad --- /dev/null +++ b/node_modules/spdx-exceptions/deprecated.json @@ -0,0 +1,3 @@ +[ + "Nokia-Qt-exception-1.1" +] diff --git a/node_modules/spdx-exceptions/index.json b/node_modules/spdx-exceptions/index.json new file mode 100644 index 000000000..d9549d3e4 --- /dev/null +++ b/node_modules/spdx-exceptions/index.json @@ -0,0 +1,68 @@ +[ + "389-exception", + "Asterisk-exception", + "Autoconf-exception-2.0", + "Autoconf-exception-3.0", + "Autoconf-exception-generic", + "Autoconf-exception-generic-3.0", + "Autoconf-exception-macro", + "Bison-exception-1.24", + "Bison-exception-2.2", + "Bootloader-exception", + "Classpath-exception-2.0", + "CLISP-exception-2.0", + "cryptsetup-OpenSSL-exception", + "DigiRule-FOSS-exception", + "eCos-exception-2.0", + "Fawkes-Runtime-exception", + "FLTK-exception", + "fmt-exception", + "Font-exception-2.0", + "freertos-exception-2.0", + "GCC-exception-2.0", + "GCC-exception-2.0-note", + "GCC-exception-3.1", + "Gmsh-exception", + "GNAT-exception", + "GNOME-examples-exception", + "GNU-compiler-exception", + "gnu-javamail-exception", + "GPL-3.0-interface-exception", + "GPL-3.0-linking-exception", + "GPL-3.0-linking-source-exception", + "GPL-CC-1.0", + "GStreamer-exception-2005", + "GStreamer-exception-2008", + "i2p-gpl-java-exception", + "KiCad-libraries-exception", + "LGPL-3.0-linking-exception", + "libpri-OpenH323-exception", + "Libtool-exception", + "Linux-syscall-note", + "LLGPL", + "LLVM-exception", + "LZMA-exception", + "mif-exception", + "OCaml-LGPL-linking-exception", + "OCCT-exception-1.0", + "OpenJDK-assembly-exception-1.0", + "openvpn-openssl-exception", + "PS-or-PDF-font-exception-20170817", + "QPL-1.0-INRIA-2004-exception", + "Qt-GPL-exception-1.0", + "Qt-LGPL-exception-1.1", + "Qwt-exception-1.0", + "SANE-exception", + "SHL-2.0", + "SHL-2.1", + "stunnel-exception", + "SWI-exception", + "Swift-exception", + "Texinfo-exception", + "u-boot-exception-2.0", + "UBDL-exception", + "Universal-FOSS-exception-1.0", + "vsftpd-openssl-exception", + "WxWindows-exception-3.1", + "x11vnc-openssl-exception" +] diff --git a/node_modules/spdx-exceptions/package.json b/node_modules/spdx-exceptions/package.json new file mode 100644 index 000000000..2f9a9504b --- /dev/null +++ b/node_modules/spdx-exceptions/package.json @@ -0,0 +1,19 @@ +{ + "name": "spdx-exceptions", + "description": "list of SPDX standard license exceptions", + "version": "2.5.0", + "author": "The Linux Foundation", + "contributors": [ + "Kyle E. Mitchell (https://kemitchell.com/)" + ], + "license": "CC-BY-3.0", + "repository": "kemitchell/spdx-exceptions.json", + "files": [ + "index.json", + "deprecated.json" + ], + "scripts": { + "build": "node build.js", + "latest": "node latest.js" + } +} diff --git a/node_modules/spdx-expression-parse/AUTHORS b/node_modules/spdx-expression-parse/AUTHORS new file mode 100644 index 000000000..257a76b94 --- /dev/null +++ b/node_modules/spdx-expression-parse/AUTHORS @@ -0,0 +1,4 @@ +C. Scott Ananian (http://cscott.net) +Kyle E. Mitchell (https://kemitchell.com) +Shinnosuke Watanabe +Antoine Motet diff --git a/node_modules/spdx-expression-parse/LICENSE b/node_modules/spdx-expression-parse/LICENSE new file mode 100644 index 000000000..831618eab --- /dev/null +++ b/node_modules/spdx-expression-parse/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2015 Kyle E. Mitchell & other authors listed in AUTHORS + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/spdx-expression-parse/README.md b/node_modules/spdx-expression-parse/README.md new file mode 100644 index 000000000..9406462e3 --- /dev/null +++ b/node_modules/spdx-expression-parse/README.md @@ -0,0 +1,91 @@ +This package parses [SPDX license expression](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) strings describing license terms, like [package.json license strings](https://docs.npmjs.com/files/package.json#license), into consistently structured ECMAScript objects. The npm command-line interface depends on this package, as do many automatic license-audit tools. + +In a nutshell: + +```javascript +var parse = require('spdx-expression-parse') +var assert = require('assert') + +assert.deepEqual( + // Licensed under the terms of the Two-Clause BSD License. + parse('BSD-2-Clause'), + {license: 'BSD-2-Clause'} +) + +assert.throws(function () { + // An invalid SPDX license expression. + // Should be `Apache-2.0`. + parse('Apache 2') +}) + +assert.deepEqual( + // Dual licensed under either: + // - LGPL 2.1 + // - a combination of Three-Clause BSD and MIT + parse('(LGPL-2.1 OR BSD-3-Clause AND MIT)'), + { + left: {license: 'LGPL-2.1'}, + conjunction: 'or', + right: { + left: {license: 'BSD-3-Clause'}, + conjunction: 'and', + right: {license: 'MIT'} + } + } +) +``` + +The syntax comes from the [Software Package Data eXchange (SPDX)](https://spdx.org/), a standard from the [Linux Foundation](https://www.linuxfoundation.org) for shareable data about software package license terms. SPDX aims to make sharing and auditing license data easy, especially for users of open-source software. + +The bulk of the SPDX standard describes syntax and semantics of XML metadata files. This package implements two lightweight, plain-text components of that larger standard: + +1. The [license list](https://spdx.org/licenses), a mapping from specific string identifiers, like `Apache-2.0`, to standard form license texts and bolt-on license exceptions. The [spdx-license-ids](https://www.npmjs.com/package/spdx-license-ids) and [spdx-exceptions](https://www.npmjs.com/package/spdx-exceptions) packages implement the license list. `spdx-expression-parse` depends on and `require()`s them. + + Any license identifier from the license list is a valid license expression: + + ```javascript + var identifiers = [] + .concat(require('spdx-license-ids')) + .concat(require('spdx-license-ids/deprecated')) + + identifiers.forEach(function (id) { + assert.deepEqual(parse(id), {license: id}) + }) + ``` + + So is any license identifier `WITH` a standardized license exception: + + ```javascript + identifiers.forEach(function (id) { + require('spdx-exceptions').forEach(function (e) { + assert.deepEqual( + parse(id + ' WITH ' + e), + {license: id, exception: e} + ) + }) + }) + ``` + +2. The license expression language, for describing simple and complex license terms, like `MIT` for MIT-licensed and `(GPL-2.0 OR Apache-2.0)` for dual-licensing under GPL 2.0 and Apache 2.0. `spdx-expression-parse` itself implements license expression language, exporting a parser. + + ```javascript + assert.deepEqual( + // Licensed under a combination of: + // - the MIT License AND + // - a combination of: + // - LGPL 2.1 (or a later version) AND + // - Three-Clause BSD + parse('(MIT AND (LGPL-2.1+ AND BSD-3-Clause))'), + { + left: {license: 'MIT'}, + conjunction: 'and', + right: { + left: {license: 'LGPL-2.1', plus: true}, + conjunction: 'and', + right: {license: 'BSD-3-Clause'} + } + } + ) + ``` + +The Linux Foundation and its contributors license the SPDX standard under the terms of [the Creative Commons Attribution License 3.0 Unported (SPDX: "CC-BY-3.0")](http://spdx.org/licenses/CC-BY-3.0). "SPDX" is a United States federally registered trademark of the Linux Foundation. The authors of this package license their work under the terms of the MIT License. diff --git a/node_modules/spdx-expression-parse/index.js b/node_modules/spdx-expression-parse/index.js new file mode 100644 index 000000000..52fab560a --- /dev/null +++ b/node_modules/spdx-expression-parse/index.js @@ -0,0 +1,8 @@ +'use strict' + +var scan = require('./scan') +var parse = require('./parse') + +module.exports = function (source) { + return parse(scan(source)) +} diff --git a/node_modules/spdx-expression-parse/package.json b/node_modules/spdx-expression-parse/package.json new file mode 100644 index 000000000..c9edc9f93 --- /dev/null +++ b/node_modules/spdx-expression-parse/package.json @@ -0,0 +1,39 @@ +{ + "name": "spdx-expression-parse", + "description": "parse SPDX license expressions", + "version": "3.0.1", + "author": "Kyle E. Mitchell (https://kemitchell.com)", + "files": [ + "AUTHORS", + "index.js", + "parse.js", + "scan.js" + ], + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.0.0", + "standard": "^14.1.0" + }, + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata", + "package", + "package.json", + "standards" + ], + "license": "MIT", + "repository": "jslicense/spdx-expression-parse.js", + "scripts": { + "lint": "standard", + "test:readme": "defence -i javascript README.md | replace-require-self | node", + "test:suite": "node test.js", + "test": "npm run test:suite && npm run test:readme" + } +} diff --git a/node_modules/spdx-expression-parse/parse.js b/node_modules/spdx-expression-parse/parse.js new file mode 100644 index 000000000..5a00b45c5 --- /dev/null +++ b/node_modules/spdx-expression-parse/parse.js @@ -0,0 +1,138 @@ +'use strict' + +// The ABNF grammar in the spec is totally ambiguous. +// +// This parser follows the operator precedence defined in the +// `Order of Precedence and Parentheses` section. + +module.exports = function (tokens) { + var index = 0 + + function hasMore () { + return index < tokens.length + } + + function token () { + return hasMore() ? tokens[index] : null + } + + function next () { + if (!hasMore()) { + throw new Error() + } + index++ + } + + function parseOperator (operator) { + var t = token() + if (t && t.type === 'OPERATOR' && operator === t.string) { + next() + return t.string + } + } + + function parseWith () { + if (parseOperator('WITH')) { + var t = token() + if (t && t.type === 'EXCEPTION') { + next() + return t.string + } + throw new Error('Expected exception after `WITH`') + } + } + + function parseLicenseRef () { + // TODO: Actually, everything is concatenated into one string + // for backward-compatibility but it could be better to return + // a nice structure. + var begin = index + var string = '' + var t = token() + if (t.type === 'DOCUMENTREF') { + next() + string += 'DocumentRef-' + t.string + ':' + if (!parseOperator(':')) { + throw new Error('Expected `:` after `DocumentRef-...`') + } + } + t = token() + if (t.type === 'LICENSEREF') { + next() + string += 'LicenseRef-' + t.string + return { license: string } + } + index = begin + } + + function parseLicense () { + var t = token() + if (t && t.type === 'LICENSE') { + next() + var node = { license: t.string } + if (parseOperator('+')) { + node.plus = true + } + var exception = parseWith() + if (exception) { + node.exception = exception + } + return node + } + } + + function parseParenthesizedExpression () { + var left = parseOperator('(') + if (!left) { + return + } + + var expr = parseExpression() + + if (!parseOperator(')')) { + throw new Error('Expected `)`') + } + + return expr + } + + function parseAtom () { + return ( + parseParenthesizedExpression() || + parseLicenseRef() || + parseLicense() + ) + } + + function makeBinaryOpParser (operator, nextParser) { + return function parseBinaryOp () { + var left = nextParser() + if (!left) { + return + } + + if (!parseOperator(operator)) { + return left + } + + var right = parseBinaryOp() + if (!right) { + throw new Error('Expected expression') + } + return { + left: left, + conjunction: operator.toLowerCase(), + right: right + } + } + } + + var parseAnd = makeBinaryOpParser('AND', parseAtom) + var parseExpression = makeBinaryOpParser('OR', parseAnd) + + var node = parseExpression() + if (!node || hasMore()) { + throw new Error('Syntax error') + } + return node +} diff --git a/node_modules/spdx-expression-parse/scan.js b/node_modules/spdx-expression-parse/scan.js new file mode 100644 index 000000000..b74fce2e2 --- /dev/null +++ b/node_modules/spdx-expression-parse/scan.js @@ -0,0 +1,131 @@ +'use strict' + +var licenses = [] + .concat(require('spdx-license-ids')) + .concat(require('spdx-license-ids/deprecated')) +var exceptions = require('spdx-exceptions') + +module.exports = function (source) { + var index = 0 + + function hasMore () { + return index < source.length + } + + // `value` can be a regexp or a string. + // If it is recognized, the matching source string is returned and + // the index is incremented. Otherwise `undefined` is returned. + function read (value) { + if (value instanceof RegExp) { + var chars = source.slice(index) + var match = chars.match(value) + if (match) { + index += match[0].length + return match[0] + } + } else { + if (source.indexOf(value, index) === index) { + index += value.length + return value + } + } + } + + function skipWhitespace () { + read(/[ ]*/) + } + + function operator () { + var string + var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+'] + for (var i = 0; i < possibilities.length; i++) { + string = read(possibilities[i]) + if (string) { + break + } + } + + if (string === '+' && index > 1 && source[index - 2] === ' ') { + throw new Error('Space before `+`') + } + + return string && { + type: 'OPERATOR', + string: string + } + } + + function idstring () { + return read(/[A-Za-z0-9-.]+/) + } + + function expectIdstring () { + var string = idstring() + if (!string) { + throw new Error('Expected idstring at offset ' + index) + } + return string + } + + function documentRef () { + if (read('DocumentRef-')) { + var string = expectIdstring() + return { type: 'DOCUMENTREF', string: string } + } + } + + function licenseRef () { + if (read('LicenseRef-')) { + var string = expectIdstring() + return { type: 'LICENSEREF', string: string } + } + } + + function identifier () { + var begin = index + var string = idstring() + + if (licenses.indexOf(string) !== -1) { + return { + type: 'LICENSE', + string: string + } + } else if (exceptions.indexOf(string) !== -1) { + return { + type: 'EXCEPTION', + string: string + } + } + + index = begin + } + + // Tries to read the next token. Returns `undefined` if no token is + // recognized. + function parseToken () { + // Ordering matters + return ( + operator() || + documentRef() || + licenseRef() || + identifier() + ) + } + + var tokens = [] + while (hasMore()) { + skipWhitespace() + if (!hasMore()) { + break + } + + var token = parseToken() + if (!token) { + throw new Error('Unexpected `' + source[index] + + '` at offset ' + index) + } + + tokens.push(token) + } + return tokens +} diff --git a/node_modules/spdx-license-ids/README.md b/node_modules/spdx-license-ids/README.md new file mode 100644 index 000000000..ba650628a --- /dev/null +++ b/node_modules/spdx-license-ids/README.md @@ -0,0 +1,51 @@ +# spdx-license-ids + +[![npm version](https://img.shields.io/npm/v/spdx-license-ids.svg)](https://www.npmjs.com/package/spdx-license-ids) + +A list of [SPDX license](https://spdx.org/licenses/) identifiers + +## Installation + +[Download JSON directly](https://raw.githubusercontent.com/jslicense/spdx-license-ids/main/index.json), or [use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/): + +``` +npm install spdx-license-ids +``` + +## [Node.js](https://nodejs.org/) API + +### require('spdx-license-ids') + +Type: `string[]` + +All license IDs except for the currently deprecated ones. + +```javascript +const ids = require('spdx-license-ids'); +//=> ['0BSD', 'AAL', 'ADSL', 'AFL-1.1', 'AFL-1.2', 'AFL-2.0', 'AFL-2.1', 'AFL-3.0', 'AGPL-1.0-only', ...] + +ids.includes('BSD-3-Clause'); //=> true +ids.includes('CC-BY-1.0'); //=> true + +ids.includes('GPL-3.0'); //=> false +``` + +### require('spdx-license-ids/deprecated') + +Type: `string[]` + +Deprecated license IDs. + +```javascript +const deprecatedIds = require('spdx-license-ids/deprecated'); +//=> ['AGPL-1.0', 'AGPL-3.0', 'GFDL-1.1', 'GFDL-1.2', 'GFDL-1.3', 'GPL-1.0', 'GPL-2.0', ...] + +deprecatedIds.includes('BSD-3-Clause'); //=> false +deprecatedIds.includes('CC-BY-1.0'); //=> false + +deprecatedIds.includes('GPL-3.0'); //=> true +``` + +## License + +[Creative Commons Zero v1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/deed) diff --git a/node_modules/spdx-license-ids/deprecated.json b/node_modules/spdx-license-ids/deprecated.json new file mode 100644 index 000000000..4f70a14c7 --- /dev/null +++ b/node_modules/spdx-license-ids/deprecated.json @@ -0,0 +1,28 @@ +[ + "AGPL-1.0", + "AGPL-3.0", + "BSD-2-Clause-FreeBSD", + "BSD-2-Clause-NetBSD", + "GFDL-1.1", + "GFDL-1.2", + "GFDL-1.3", + "GPL-1.0", + "GPL-2.0", + "GPL-2.0-with-GCC-exception", + "GPL-2.0-with-autoconf-exception", + "GPL-2.0-with-bison-exception", + "GPL-2.0-with-classpath-exception", + "GPL-2.0-with-font-exception", + "GPL-3.0", + "GPL-3.0-with-GCC-exception", + "GPL-3.0-with-autoconf-exception", + "LGPL-2.0", + "LGPL-2.1", + "LGPL-3.0", + "Net-SNMP", + "Nunit", + "StandardML-NJ", + "bzip2-1.0.5", + "eCos-2.0", + "wxWindows" +] diff --git a/node_modules/spdx-license-ids/index.json b/node_modules/spdx-license-ids/index.json new file mode 100644 index 000000000..f51552687 --- /dev/null +++ b/node_modules/spdx-license-ids/index.json @@ -0,0 +1,697 @@ +[ + "0BSD", + "3D-Slicer-1.0", + "AAL", + "ADSL", + "AFL-1.1", + "AFL-1.2", + "AFL-2.0", + "AFL-2.1", + "AFL-3.0", + "AGPL-1.0-only", + "AGPL-1.0-or-later", + "AGPL-3.0-only", + "AGPL-3.0-or-later", + "ALGLIB-Documentation", + "AMD-newlib", + "AMDPLPA", + "AML", + "AML-glslang", + "AMPAS", + "ANTLR-PD", + "ANTLR-PD-fallback", + "APAFML", + "APL-1.0", + "APSL-1.0", + "APSL-1.1", + "APSL-1.2", + "APSL-2.0", + "ASWF-Digital-Assets-1.0", + "ASWF-Digital-Assets-1.1", + "Abstyles", + "AdaCore-doc", + "Adobe-2006", + "Adobe-Display-PostScript", + "Adobe-Glyph", + "Adobe-Utopia", + "Advanced-Cryptics-Dictionary", + "Afmparse", + "Aladdin", + "Apache-1.0", + "Apache-1.1", + "Apache-2.0", + "App-s2p", + "Arphic-1999", + "Artistic-1.0", + "Artistic-1.0-Perl", + "Artistic-1.0-cl8", + "Artistic-2.0", + "Artistic-dist", + "Aspell-RU", + "BOLA-1.1", + "BSD-1-Clause", + "BSD-2-Clause", + "BSD-2-Clause-Darwin", + "BSD-2-Clause-Patent", + "BSD-2-Clause-Views", + "BSD-2-Clause-first-lines", + "BSD-2-Clause-pkgconf-disclaimer", + "BSD-3-Clause", + "BSD-3-Clause-Attribution", + "BSD-3-Clause-Clear", + "BSD-3-Clause-HP", + "BSD-3-Clause-LBNL", + "BSD-3-Clause-Modification", + "BSD-3-Clause-No-Military-License", + "BSD-3-Clause-No-Nuclear-License", + "BSD-3-Clause-No-Nuclear-License-2014", + "BSD-3-Clause-No-Nuclear-Warranty", + "BSD-3-Clause-Open-MPI", + "BSD-3-Clause-Sun", + "BSD-3-Clause-Tso", + "BSD-3-Clause-acpica", + "BSD-3-Clause-flex", + "BSD-4-Clause", + "BSD-4-Clause-Shortened", + "BSD-4-Clause-UC", + "BSD-4.3RENO", + "BSD-4.3TAHOE", + "BSD-Advertising-Acknowledgement", + "BSD-Attribution-HPND-disclaimer", + "BSD-Inferno-Nettverk", + "BSD-Mark-Modifications", + "BSD-Protection", + "BSD-Source-Code", + "BSD-Source-beginning-file", + "BSD-Systemics", + "BSD-Systemics-W3Works", + "BSL-1.0", + "BUSL-1.1", + "Baekmuk", + "Bahyph", + "Barr", + "Beerware", + "BitTorrent-1.0", + "BitTorrent-1.1", + "Bitstream-Charter", + "Bitstream-Vera", + "BlueOak-1.0.0", + "Boehm-GC", + "Boehm-GC-without-fee", + "Borceux", + "Brian-Gladman-2-Clause", + "Brian-Gladman-3-Clause", + "Buddy", + "C-UDA-1.0", + "CAL-1.0", + "CAL-1.0-Combined-Work-Exception", + "CAPEC-tou", + "CATOSL-1.1", + "CC-BY-1.0", + "CC-BY-2.0", + "CC-BY-2.5", + "CC-BY-2.5-AU", + "CC-BY-3.0", + "CC-BY-3.0-AT", + "CC-BY-3.0-AU", + "CC-BY-3.0-DE", + "CC-BY-3.0-IGO", + "CC-BY-3.0-NL", + "CC-BY-3.0-US", + "CC-BY-4.0", + "CC-BY-NC-1.0", + "CC-BY-NC-2.0", + "CC-BY-NC-2.5", + "CC-BY-NC-3.0", + "CC-BY-NC-3.0-DE", + "CC-BY-NC-4.0", + "CC-BY-NC-ND-1.0", + "CC-BY-NC-ND-2.0", + "CC-BY-NC-ND-2.5", + "CC-BY-NC-ND-3.0", + "CC-BY-NC-ND-3.0-DE", + "CC-BY-NC-ND-3.0-IGO", + "CC-BY-NC-ND-4.0", + "CC-BY-NC-SA-1.0", + "CC-BY-NC-SA-2.0", + "CC-BY-NC-SA-2.0-DE", + "CC-BY-NC-SA-2.0-FR", + "CC-BY-NC-SA-2.0-UK", + "CC-BY-NC-SA-2.5", + "CC-BY-NC-SA-3.0", + "CC-BY-NC-SA-3.0-DE", + "CC-BY-NC-SA-3.0-IGO", + "CC-BY-NC-SA-4.0", + "CC-BY-ND-1.0", + "CC-BY-ND-2.0", + "CC-BY-ND-2.5", + "CC-BY-ND-3.0", + "CC-BY-ND-3.0-DE", + "CC-BY-ND-4.0", + "CC-BY-SA-1.0", + "CC-BY-SA-2.0", + "CC-BY-SA-2.0-UK", + "CC-BY-SA-2.1-JP", + "CC-BY-SA-2.5", + "CC-BY-SA-3.0", + "CC-BY-SA-3.0-AT", + "CC-BY-SA-3.0-DE", + "CC-BY-SA-3.0-IGO", + "CC-BY-SA-4.0", + "CC-PDDC", + "CC-PDM-1.0", + "CC-SA-1.0", + "CC0-1.0", + "CDDL-1.0", + "CDDL-1.1", + "CDL-1.0", + "CDLA-Permissive-1.0", + "CDLA-Permissive-2.0", + "CDLA-Sharing-1.0", + "CECILL-1.0", + "CECILL-1.1", + "CECILL-2.0", + "CECILL-2.1", + "CECILL-B", + "CECILL-C", + "CERN-OHL-1.1", + "CERN-OHL-1.2", + "CERN-OHL-P-2.0", + "CERN-OHL-S-2.0", + "CERN-OHL-W-2.0", + "CFITSIO", + "CMU-Mach", + "CMU-Mach-nodoc", + "CNRI-Jython", + "CNRI-Python", + "CNRI-Python-GPL-Compatible", + "COIL-1.0", + "CPAL-1.0", + "CPL-1.0", + "CPOL-1.02", + "CUA-OPL-1.0", + "Caldera", + "Caldera-no-preamble", + "Catharon", + "ClArtistic", + "Clips", + "Community-Spec-1.0", + "Condor-1.1", + "Cornell-Lossless-JPEG", + "Cronyx", + "Crossword", + "CryptoSwift", + "CrystalStacker", + "Cube", + "D-FSL-1.0", + "DEC-3-Clause", + "DL-DE-BY-2.0", + "DL-DE-ZERO-2.0", + "DOC", + "DRL-1.0", + "DRL-1.1", + "DSDP", + "DocBook-DTD", + "DocBook-Schema", + "DocBook-Stylesheet", + "DocBook-XML", + "Dotseqn", + "ECL-1.0", + "ECL-2.0", + "EFL-1.0", + "EFL-2.0", + "EPICS", + "EPL-1.0", + "EPL-2.0", + "ESA-PL-permissive-2.4", + "ESA-PL-strong-copyleft-2.4", + "ESA-PL-weak-copyleft-2.4", + "EUDatagrid", + "EUPL-1.0", + "EUPL-1.1", + "EUPL-1.2", + "Elastic-2.0", + "Entessa", + "ErlPL-1.1", + "Eurosym", + "FBM", + "FDK-AAC", + "FSFAP", + "FSFAP-no-warranty-disclaimer", + "FSFUL", + "FSFULLR", + "FSFULLRSD", + "FSFULLRWD", + "FSL-1.1-ALv2", + "FSL-1.1-MIT", + "FTL", + "Fair", + "Ferguson-Twofish", + "Frameworx-1.0", + "FreeBSD-DOC", + "FreeImage", + "Furuseth", + "GCR-docs", + "GD", + "GFDL-1.1-invariants-only", + "GFDL-1.1-invariants-or-later", + "GFDL-1.1-no-invariants-only", + "GFDL-1.1-no-invariants-or-later", + "GFDL-1.1-only", + "GFDL-1.1-or-later", + "GFDL-1.2-invariants-only", + "GFDL-1.2-invariants-or-later", + "GFDL-1.2-no-invariants-only", + "GFDL-1.2-no-invariants-or-later", + "GFDL-1.2-only", + "GFDL-1.2-or-later", + "GFDL-1.3-invariants-only", + "GFDL-1.3-invariants-or-later", + "GFDL-1.3-no-invariants-only", + "GFDL-1.3-no-invariants-or-later", + "GFDL-1.3-only", + "GFDL-1.3-or-later", + "GL2PS", + "GLWTPL", + "GPL-1.0-only", + "GPL-1.0-or-later", + "GPL-2.0-only", + "GPL-2.0-or-later", + "GPL-3.0-only", + "GPL-3.0-or-later", + "Game-Programming-Gems", + "Giftware", + "Glide", + "Glulxe", + "Graphics-Gems", + "Gutmann", + "HDF5", + "HIDAPI", + "HP-1986", + "HP-1989", + "HPND", + "HPND-DEC", + "HPND-Fenneberg-Livingston", + "HPND-INRIA-IMAG", + "HPND-Intel", + "HPND-Kevlin-Henney", + "HPND-MIT-disclaimer", + "HPND-Markus-Kuhn", + "HPND-Netrek", + "HPND-Pbmplus", + "HPND-SMC", + "HPND-UC", + "HPND-UC-export-US", + "HPND-doc", + "HPND-doc-sell", + "HPND-export-US", + "HPND-export-US-acknowledgement", + "HPND-export-US-modify", + "HPND-export2-US", + "HPND-merchantability-variant", + "HPND-sell-MIT-disclaimer-xserver", + "HPND-sell-regexpr", + "HPND-sell-variant", + "HPND-sell-variant-MIT-disclaimer", + "HPND-sell-variant-MIT-disclaimer-rev", + "HPND-sell-variant-critical-systems", + "HTMLTIDY", + "HaskellReport", + "Hippocratic-2.1", + "IBM-pibs", + "ICU", + "IEC-Code-Components-EULA", + "IJG", + "IJG-short", + "IPA", + "IPL-1.0", + "ISC", + "ISC-Veillard", + "ISO-permission", + "ImageMagick", + "Imlib2", + "Info-ZIP", + "Inner-Net-2.0", + "InnoSetup", + "Intel", + "Intel-ACPI", + "Interbase-1.0", + "JPL-image", + "JPNIC", + "JSON", + "Jam", + "JasPer-2.0", + "Kastrup", + "Kazlib", + "Knuth-CTAN", + "LAL-1.2", + "LAL-1.3", + "LGPL-2.0-only", + "LGPL-2.0-or-later", + "LGPL-2.1-only", + "LGPL-2.1-or-later", + "LGPL-3.0-only", + "LGPL-3.0-or-later", + "LGPLLR", + "LOOP", + "LPD-document", + "LPL-1.0", + "LPL-1.02", + "LPPL-1.0", + "LPPL-1.1", + "LPPL-1.2", + "LPPL-1.3a", + "LPPL-1.3c", + "LZMA-SDK-9.11-to-9.20", + "LZMA-SDK-9.22", + "Latex2e", + "Latex2e-translated-notice", + "Leptonica", + "LiLiQ-P-1.1", + "LiLiQ-R-1.1", + "LiLiQ-Rplus-1.1", + "Libpng", + "Linux-OpenIB", + "Linux-man-pages-1-para", + "Linux-man-pages-copyleft", + "Linux-man-pages-copyleft-2-para", + "Linux-man-pages-copyleft-var", + "Lucida-Bitmap-Fonts", + "MIPS", + "MIT", + "MIT-0", + "MIT-CMU", + "MIT-Click", + "MIT-Festival", + "MIT-Khronos-old", + "MIT-Modern-Variant", + "MIT-STK", + "MIT-Wu", + "MIT-advertising", + "MIT-enna", + "MIT-feh", + "MIT-open-group", + "MIT-testregex", + "MITNFA", + "MMIXware", + "MMPL-1.0.1", + "MPEG-SSG", + "MPL-1.0", + "MPL-1.1", + "MPL-2.0", + "MPL-2.0-no-copyleft-exception", + "MS-LPL", + "MS-PL", + "MS-RL", + "MTLL", + "Mackerras-3-Clause", + "Mackerras-3-Clause-acknowledgment", + "MakeIndex", + "Martin-Birgmeier", + "McPhee-slideshow", + "Minpack", + "MirOS", + "Motosoto", + "MulanPSL-1.0", + "MulanPSL-2.0", + "Multics", + "Mup", + "NAIST-2003", + "NASA-1.3", + "NBPL-1.0", + "NCBI-PD", + "NCGL-UK-2.0", + "NCL", + "NCSA", + "NGPL", + "NICTA-1.0", + "NIST-PD", + "NIST-PD-TNT", + "NIST-PD-fallback", + "NIST-Software", + "NLOD-1.0", + "NLOD-2.0", + "NLPL", + "NOSL", + "NPL-1.0", + "NPL-1.1", + "NPOSL-3.0", + "NRL", + "NTIA-PD", + "NTP", + "NTP-0", + "Naumen", + "NetCDF", + "Newsletr", + "Nokia", + "Noweb", + "O-UDA-1.0", + "OAR", + "OCCT-PL", + "OCLC-2.0", + "ODC-By-1.0", + "ODbL-1.0", + "OFFIS", + "OFL-1.0", + "OFL-1.0-RFN", + "OFL-1.0-no-RFN", + "OFL-1.1", + "OFL-1.1-RFN", + "OFL-1.1-no-RFN", + "OGC-1.0", + "OGDL-Taiwan-1.0", + "OGL-Canada-2.0", + "OGL-UK-1.0", + "OGL-UK-2.0", + "OGL-UK-3.0", + "OGTSL", + "OLDAP-1.1", + "OLDAP-1.2", + "OLDAP-1.3", + "OLDAP-1.4", + "OLDAP-2.0", + "OLDAP-2.0.1", + "OLDAP-2.1", + "OLDAP-2.2", + "OLDAP-2.2.1", + "OLDAP-2.2.2", + "OLDAP-2.3", + "OLDAP-2.4", + "OLDAP-2.5", + "OLDAP-2.6", + "OLDAP-2.7", + "OLDAP-2.8", + "OLFL-1.3", + "OML", + "OPL-1.0", + "OPL-UK-3.0", + "OPUBL-1.0", + "OSC-1.0", + "OSET-PL-2.1", + "OSL-1.0", + "OSL-1.1", + "OSL-2.0", + "OSL-2.1", + "OSL-3.0", + "OSSP", + "OpenMDW-1.0", + "OpenPBS-2.3", + "OpenSSL", + "OpenSSL-standalone", + "OpenVision", + "PADL", + "PDDL-1.0", + "PHP-3.0", + "PHP-3.01", + "PPL", + "PSF-2.0", + "ParaType-Free-Font-1.3", + "Parity-6.0.0", + "Parity-7.0.0", + "Pixar", + "Plexus", + "PolyForm-Noncommercial-1.0.0", + "PolyForm-Small-Business-1.0.0", + "PostgreSQL", + "Python-2.0", + "Python-2.0.1", + "QPL-1.0", + "QPL-1.0-INRIA-2004", + "Qhull", + "RHeCos-1.1", + "RPL-1.1", + "RPL-1.5", + "RPSL-1.0", + "RSA-MD", + "RSCPL", + "Rdisc", + "Ruby", + "Ruby-pty", + "SAX-PD", + "SAX-PD-2.0", + "SCEA", + "SGI-B-1.0", + "SGI-B-1.1", + "SGI-B-2.0", + "SGI-OpenGL", + "SGMLUG-PM", + "SGP4", + "SHL-0.5", + "SHL-0.51", + "SISSL", + "SISSL-1.2", + "SL", + "SMAIL-GPL", + "SMLNJ", + "SMPPL", + "SNIA", + "SOFA", + "SPL-1.0", + "SSH-OpenSSH", + "SSH-short", + "SSLeay-standalone", + "SSPL-1.0", + "SUL-1.0", + "SWL", + "Saxpath", + "SchemeReport", + "Sendmail", + "Sendmail-8.23", + "Sendmail-Open-Source-1.1", + "SimPL-2.0", + "Sleepycat", + "Soundex", + "Spencer-86", + "Spencer-94", + "Spencer-99", + "SugarCRM-1.1.3", + "Sun-PPP", + "Sun-PPP-2000", + "SunPro", + "Symlinks", + "TAPR-OHL-1.0", + "TCL", + "TCP-wrappers", + "TGPPL-1.0", + "TMate", + "TORQUE-1.1", + "TOSL", + "TPDL", + "TPL-1.0", + "TTWL", + "TTYP0", + "TU-Berlin-1.0", + "TU-Berlin-2.0", + "TekHVC", + "TermReadKey", + "ThirdEye", + "TrustedQSL", + "UCAR", + "UCL-1.0", + "UMich-Merit", + "UPL-1.0", + "URT-RLE", + "Ubuntu-font-1.0", + "UnRAR", + "Unicode-3.0", + "Unicode-DFS-2015", + "Unicode-DFS-2016", + "Unicode-TOU", + "UnixCrypt", + "Unlicense", + "Unlicense-libtelnet", + "Unlicense-libwhirlpool", + "VOSTROM", + "VSL-1.0", + "Vim", + "Vixie-Cron", + "W3C", + "W3C-19980720", + "W3C-20150513", + "WTFNMFPL", + "WTFPL", + "Watcom-1.0", + "Widget-Workshop", + "WordNet", + "Wsuipa", + "X11", + "X11-distribute-modifications-variant", + "X11-no-permit-persons", + "X11-swapped", + "XFree86-1.1", + "XSkat", + "Xdebug-1.03", + "Xerox", + "Xfig", + "Xnet", + "YPL-1.0", + "YPL-1.1", + "ZPL-1.1", + "ZPL-2.0", + "ZPL-2.1", + "Zed", + "Zeeff", + "Zend-2.0", + "Zimbra-1.3", + "Zimbra-1.4", + "Zlib", + "any-OSI", + "any-OSI-perl-modules", + "bcrypt-Solar-Designer", + "blessing", + "bzip2-1.0.6", + "check-cvs", + "checkmk", + "copyleft-next-0.3.0", + "copyleft-next-0.3.1", + "curl", + "cve-tou", + "diffmark", + "dtoa", + "dvipdfm", + "eGenix", + "etalab-2.0", + "fwlw", + "gSOAP-1.3b", + "generic-xts", + "gnuplot", + "gtkbook", + "hdparm", + "hyphen-bulgarian", + "iMatix", + "jove", + "libpng-1.6.35", + "libpng-2.0", + "libselinux-1.0", + "libtiff", + "libutil-David-Nugent", + "lsof", + "magaz", + "mailprio", + "man2html", + "metamail", + "mpi-permissive", + "mpich2", + "mplus", + "ngrep", + "pkgconf", + "pnmstitch", + "psfrag", + "psutils", + "python-ldap", + "radvd", + "snprintf", + "softSurfer", + "ssh-keyscan", + "swrule", + "threeparttable", + "ulem", + "w3m", + "wwl", + "xinetd", + "xkeyboard-config-Zinoviev", + "xlock", + "xpp", + "xzoom", + "zlib-acknowledgement" +] diff --git a/node_modules/spdx-license-ids/package.json b/node_modules/spdx-license-ids/package.json new file mode 100644 index 000000000..9c9ba0838 --- /dev/null +++ b/node_modules/spdx-license-ids/package.json @@ -0,0 +1,29 @@ +{ + "name": "spdx-license-ids", + "version": "3.0.23", + "description": "A list of SPDX license identifiers", + "repository": "jslicense/spdx-license-ids", + "author": "Shinnosuke Watanabe (https://github.com/shinnn)", + "license": "CC0-1.0", + "scripts": { + "build": "node build.js", + "latest": "node latest.js", + "pretest": "npm run build", + "test": "node test.js" + }, + "files": [ + "deprecated.json", + "index.json" + ], + "keywords": [ + "spdx", + "license", + "licenses", + "id", + "identifier", + "identifiers", + "json", + "array", + "oss" + ] +} diff --git a/node_modules/sprintf-js/.npmignore b/node_modules/sprintf-js/.npmignore new file mode 100644 index 000000000..096746c14 --- /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 000000000..663ac52e4 --- /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 000000000..83863561b --- /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 000000000..d90a75989 --- /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 000000000..3559efd76 --- /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 000000000..dbaf744d8 --- /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 000000000..055964c62 --- /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 000000000..055964c62 --- /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 000000000..dc61e51ad --- /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 000000000..369dbafab --- /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 000000000..ee011aaa5 --- /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 000000000..246e1c3b9 --- /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 000000000..75f7eca71 --- /dev/null +++ b/node_modules/sprintf-js/package.json @@ -0,0 +1,22 @@ +{ + "name": "sprintf-js", + "version": "1.0.3", + "description": "JavaScript sprintf implementation", + "author": "Alexandru Marasteanu (http://alexei.ro/)", + "main": "src/sprintf.js", + "scripts": { + "test": "mocha test/test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/alexei/sprintf.js.git" + }, + "license": "BSD-3-Clause", + "readmeFilename": "README.md", + "devDependencies": { + "mocha": "*", + "grunt": "*", + "grunt-contrib-watch": "*", + "grunt-contrib-uglify": "*" + } +} 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 000000000..9c69123be --- /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 000000000..c0fc7c08b --- /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 000000000..6f57b2538 --- /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 000000000..aceee00d1 --- /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 000000000..8d8660d36 --- /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 000000000..1111db063 --- /dev/null +++ b/node_modules/state-toggle/package.json @@ -0,0 +1,70 @@ +{ + "name": "state-toggle", + "version": "1.0.3", + "description": "Enter/exit a state", + "license": "MIT", + "keywords": [ + "enter", + "exit", + "state" + ], + "repository": "wooorm/state-toggle", + "bugs": "https://github.com/wooorm/state-toggle/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": {}, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s stateToggle -o state-toggle.js", + "build-mangle": "browserify . -s stateToggle -p tinyify -o state-toggle.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "state-toggle.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + } +} diff --git a/node_modules/state-toggle/readme.md b/node_modules/state-toggle/readme.md new file mode 100644 index 000000000..9fcca1e5e --- /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/stop-iteration-iterator/.eslintrc b/node_modules/stop-iteration-iterator/.eslintrc new file mode 100644 index 000000000..20f1fabc4 --- /dev/null +++ b/node_modules/stop-iteration-iterator/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "globals": { + "StopIteration": false, + }, + + "rules": { + "func-name-matching": [2, "always"], + "id-length": 0, + }, +} diff --git a/node_modules/stop-iteration-iterator/.github/FUNDING.yml b/node_modules/stop-iteration-iterator/.github/FUNDING.yml new file mode 100644 index 000000000..4f99ddc08 --- /dev/null +++ b/node_modules/stop-iteration-iterator/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/stop-iteration-iterator +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/stop-iteration-iterator/.nycrc b/node_modules/stop-iteration-iterator/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/stop-iteration-iterator/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/stop-iteration-iterator/CHANGELOG.md b/node_modules/stop-iteration-iterator/CHANGELOG.md new file mode 100644 index 000000000..6ff21b632 --- /dev/null +++ b/node_modules/stop-iteration-iterator/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.0](https://github.com/ljharb/stop-iteration-iterator/compare/v1.0.0...v1.1.0) - 2024-12-13 + +### Commits + +- [New] add types [`f0ee985`](https://github.com/ljharb/stop-iteration-iterator/commit/f0ee985afeccf2950e693757266c77baeaab50f5) +- [actions] split out node 10-20, and 20+ [`b49d910`](https://github.com/ljharb/stop-iteration-iterator/commit/b49d9101ff21b27e30ce6b2c52e121b36efaa7e8) +- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `npmignore`, `tape` [`2bdaff7`](https://github.com/ljharb/stop-iteration-iterator/commit/2bdaff787a45d4034c079bd308c4a9ba2b09950e) +- [types] clean up tsconfig [`c275b15`](https://github.com/ljharb/stop-iteration-iterator/commit/c275b15940ed12955e77bf2fd764ff507788637d) +- [meta] clean up changelog [`a3eeb9a`](https://github.com/ljharb/stop-iteration-iterator/commit/a3eeb9a763063e27a560f09d25b865f40e373154) +- [Robustness] use `es-errors` [`ca51cb8`](https://github.com/ljharb/stop-iteration-iterator/commit/ca51cb8d7ef259e4aa8e4a9289f0c187fc08d560) +- [Tests] replace `aud` with `npm audit` [`d4b8df0`](https://github.com/ljharb/stop-iteration-iterator/commit/d4b8df04328f133b65bec028c5f78715cd061357) +- [Deps] update `internal-slot` [`61ca626`](https://github.com/ljharb/stop-iteration-iterator/commit/61ca626be1bd5e9bb6051f70b32e3d49b8abcd6a) +- [Deps] update `internal-slot` [`cdabf84`](https://github.com/ljharb/stop-iteration-iterator/commit/cdabf8419d448faaacd1b5d87c839acb7a6eb899) +- [meta] add `sideEffects` flag [`a5f6cb6`](https://github.com/ljharb/stop-iteration-iterator/commit/a5f6cb6e9fa8859115e452c22d4ef90366dc4d0f) +- [Dev Deps] add missing peer dep [`6f6496e`](https://github.com/ljharb/stop-iteration-iterator/commit/6f6496ec5c47499f5e30b80268e2ce545a5469ba) + +## v1.0.0 - 2023-01-12 + +### Commits + +- Initial implementation, tests, readme [`43e8109`](https://github.com/ljharb/stop-iteration-iterator/commit/43e81099d2f2b63ff3a8a253ad13dd8279c9e2dc) +- Initial commit [`23929ce`](https://github.com/ljharb/stop-iteration-iterator/commit/23929ce525165bfe54f053284fd066dce8598486) +- npm init [`a9847ab`](https://github.com/ljharb/stop-iteration-iterator/commit/a9847ab637a7c223fb7478d47caf04e89ba283ff) +- Only apps should have lockfiles [`4e41f3f`](https://github.com/ljharb/stop-iteration-iterator/commit/4e41f3fbbaf8a1d32b12514d7296961e5df73e4b) diff --git a/node_modules/stop-iteration-iterator/LICENSE b/node_modules/stop-iteration-iterator/LICENSE new file mode 100644 index 000000000..b4213ac64 --- /dev/null +++ b/node_modules/stop-iteration-iterator/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/stop-iteration-iterator/README.md b/node_modules/stop-iteration-iterator/README.md new file mode 100644 index 000000000..851860db9 --- /dev/null +++ b/node_modules/stop-iteration-iterator/README.md @@ -0,0 +1,42 @@ +# stop-iteration-iterator [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Firefox 17-26 iterators throw a StopIteration object to indicate "done". This normalizes it. + +# Usage + +```js +var stopIterationIterator = require('stop-iteration-iterator'); + +var s = new Set([1, 2]); + +var iterator = stopIterationIterator(s.keys()); + +iterator.next(); // { done: false, value: 1 } +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + + +[package-url]: https://npmjs.org/package/stop-iteration-iterator +[npm-version-svg]: https://versionbadg.es/ljharb/stop-iteration-iterator.svg +[deps-svg]: https://david-dm.org/ljharb/stop-iteration-iterator.svg +[deps-url]: https://david-dm.org/ljharb/stop-iteration-iterator +[dev-deps-svg]: https://david-dm.org/ljharb/stop-iteration-iterator/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/stop-iteration-iterator#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/stop-iteration-iterator.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/stop-iteration-iterator.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/stop-iteration-iterator.svg +[downloads-url]: https://npm-stat.com/charts.html?package=stop-iteration-iterator +[codecov-image]: https://codecov.io/gh/ljharb/stop-iteration-iterator/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/stop-iteration-iterator/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/stop-iteration-iterator +[actions-url]: https://github.com/ljharb/stop-iteration-iterator/actions diff --git a/node_modules/stop-iteration-iterator/index.d.ts b/node_modules/stop-iteration-iterator/index.d.ts new file mode 100644 index 000000000..e0b92ff4f --- /dev/null +++ b/node_modules/stop-iteration-iterator/index.d.ts @@ -0,0 +1,7 @@ +declare global { + const StopIteration: (object & { readonly __brand__?: unique symbol }) | undefined; +} + +declare function getStopIterationIterator(origIterator: { next(): IteratorResult }): Iterator; + +export = getStopIterationIterator; \ No newline at end of file diff --git a/node_modules/stop-iteration-iterator/index.js b/node_modules/stop-iteration-iterator/index.js new file mode 100644 index 000000000..d1d751da5 --- /dev/null +++ b/node_modules/stop-iteration-iterator/index.js @@ -0,0 +1,46 @@ +'use strict'; + +var SLOT = require('internal-slot'); +var $SyntaxError = require('es-errors/syntax'); + +var $StopIteration = typeof StopIteration === 'object' ? StopIteration : null; + +/** @type {import('.')} */ +module.exports = function getStopIterationIterator(origIterator) { + if (!$StopIteration) { + throw new $SyntaxError('this environment lacks StopIteration'); + } + + SLOT.set(origIterator, '[[Done]]', false); + + /** @template T @typedef {T extends Iterator ? U : never} IteratorType */ + /** @typedef {IteratorType>} T */ + var siIterator = { + next: /** @type {() => IteratorResult} */ function next() { + // eslint-disable-next-line no-extra-parens + var iterator = /** @type {typeof origIterator} */ (SLOT.get(this, '[[Iterator]]')); + var done = !!SLOT.get(iterator, '[[Done]]'); + try { + return { + done: done, + // eslint-disable-next-line no-extra-parens + value: done ? void undefined : /** @type {T} */ (iterator.next()) + }; + } catch (e) { + SLOT.set(iterator, '[[Done]]', true); + if (e !== $StopIteration) { + throw e; + } + return { + done: true, + value: void undefined + }; + } + } + }; + + SLOT.set(siIterator, '[[Iterator]]', origIterator); + + // @ts-expect-error TODO FIXME + return siIterator; +}; diff --git a/node_modules/stop-iteration-iterator/package.json b/node_modules/stop-iteration-iterator/package.json new file mode 100644 index 000000000..6046d2fb4 --- /dev/null +++ b/node_modules/stop-iteration-iterator/package.json @@ -0,0 +1,77 @@ +{ + "name": "stop-iteration-iterator", + "version": "1.1.0", + "description": "Firefox 17-26 iterators throw a StopIteration object to indicate \"done\". This normalizes it.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/stop-iteration-iterator.git" + }, + "keywords": [ + "stopiteration", + "iterator", + "firefox" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/stop-iteration-iterator/issues" + }, + "homepage": "https://github.com/ljharb/stop-iteration-iterator#readme", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/tape": "^5.6.5", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/stop-iteration-iterator/test/index.js b/node_modules/stop-iteration-iterator/test/index.js new file mode 100644 index 000000000..7ba13daab --- /dev/null +++ b/node_modules/stop-iteration-iterator/test/index.js @@ -0,0 +1,51 @@ +'use strict'; + +var test = require('tape'); + +var stopIterationIterator = require('../'); + +test('stopIterationIterator', function (t) { + t.equal(typeof stopIterationIterator, 'function', 'stopIterationIterator is a function'); + + t.test('no StopIteration support', { skip: typeof StopIteration === 'object' }, function (st) { + st['throws']( + // @ts-expect-error + function () { stopIterationIterator(); }, + SyntaxError, + 'throws a SyntaxError when StopIteration is not supported' + ); + + st.end(); + }); + + t.test('StopIteration support', { skip: typeof StopIteration !== 'object' }, function (st) { + // eslint-disable-next-line no-extra-parens + var s = /** @type {Set & { iterator(): SetIterator}} */ (new Set([1, 2])); + + var i = s.iterator(); + st.equal(i.next(), 1, 'first item is 1'); + st.equal(i.next(), 2, 'second item is 2'); + try { + i.next(); + st.fail(); + } catch (e) { + st.equal(e, StopIteration, 'StopIteration thrown'); + } + + // eslint-disable-next-line no-extra-parens + var m = /** @type {Map & { iterator(): MapIterator<[string, number]>}} */ (new Map([[1, 'a'], [2, 'b']])); + var mi = m.iterator(); + st.deepEqual(mi.next(), [1, 'a'], 'first item is 1 and a'); + st.deepEqual(mi.next(), [2, 'b'], 'second item is 2 and b'); + try { + mi.next(); + st.fail(); + } catch (e) { + st.equal(e, StopIteration, 'StopIteration thrown'); + } + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/stop-iteration-iterator/tsconfig.json b/node_modules/stop-iteration-iterator/tsconfig.json new file mode 100644 index 000000000..17df18fee --- /dev/null +++ b/node_modules/stop-iteration-iterator/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@ljharb/tsconfig", + "exclude": [ + "coverage", + ], +} \ No newline at end of file diff --git a/node_modules/string-width/index.js b/node_modules/string-width/index.js new file mode 100644 index 000000000..b9bec6244 --- /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 000000000..654d0bfe9 --- /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/node_modules/strip-ansi/index.js b/node_modules/string-width/node_modules/strip-ansi/index.js new file mode 100644 index 000000000..099480fbf --- /dev/null +++ b/node_modules/string-width/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/string-width/node_modules/strip-ansi/license b/node_modules/string-width/node_modules/strip-ansi/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/string-width/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/string-width/node_modules/strip-ansi/package.json b/node_modules/string-width/node_modules/strip-ansi/package.json new file mode 100644 index 000000000..301685ba3 --- /dev/null +++ b/node_modules/string-width/node_modules/strip-ansi/package.json @@ -0,0 +1,57 @@ +{ + "name": "strip-ansi", + "version": "3.0.1", + "description": "Strip ANSI escape codes", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Boy Nicolai Appelman (jbna.nl)", + "JD Ballard (github.com/qix-)" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/string-width/node_modules/strip-ansi/readme.md b/node_modules/string-width/node_modules/strip-ansi/readme.md new file mode 100644 index 000000000..cb7d9ff7e --- /dev/null +++ b/node_modules/string-width/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/string-width/package.json b/node_modules/string-width/package.json new file mode 100644 index 000000000..5ba436166 --- /dev/null +++ b/node_modules/string-width/package.json @@ -0,0 +1,56 @@ +{ + "name": "string-width", + "version": "1.0.2", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "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" + ], + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/string-width/readme.md b/node_modules/string-width/readme.md new file mode 100644 index 000000000..1ab42c935 --- /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.prototype.trim/.editorconfig b/node_modules/string.prototype.trim/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/string.prototype.trim/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/string.prototype.trim/.eslintrc b/node_modules/string.prototype.trim/.eslintrc new file mode 100644 index 000000000..2bbc53b11 --- /dev/null +++ b/node_modules/string.prototype.trim/.eslintrc @@ -0,0 +1,25 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "RequireObjectCoercible", + "ToString", + ], + }], + "no-invalid-this": 1, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "id-length": 0, + }, + }, + ], +} diff --git a/node_modules/string.prototype.trim/.nycrc b/node_modules/string.prototype.trim/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/string.prototype.trim/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/string.prototype.trim/CHANGELOG.md b/node_modules/string.prototype.trim/CHANGELOG.md new file mode 100644 index 000000000..78144f325 --- /dev/null +++ b/node_modules/string.prototype.trim/CHANGELOG.md @@ -0,0 +1,202 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.10](https://github.com/es-shims/String.prototype.trim/compare/v1.2.9...v1.2.10) - 2024-12-11 + +### Commits + +- [actions] split out node 10-20, and 20+ [`335d99a`](https://github.com/es-shims/String.prototype.trim/commit/335d99a408ee623eb60ca53af13da1813d3ee1b8) +- [Refactor] use `define-data-property` and `has-property-descriptors` directly [`2e0c2e9`](https://github.com/es-shims/String.prototype.trim/commit/2e0c2e9979c9368b13a90a31ae79ca8b1f2fa01a) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`138d3db`](https://github.com/es-shims/String.prototype.trim/commit/138d3db824e6fed5a0f9c81ae06534ef4e20b969) +- [Deps] update `call-bind`, `es-abstract` [`3a06731`](https://github.com/es-shims/String.prototype.trim/commit/3a0673152cc347f42feed04a6936d824ffb2bb57) +- [Refactor] use `call-bound` directly [`9499206`](https://github.com/es-shims/String.prototype.trim/commit/9499206837e054fac9b48db0f63c09dd1e955e11) +- [Tests] replace `aud` with `npm audit` [`c88a935`](https://github.com/es-shims/String.prototype.trim/commit/c88a935c098d8a9809812af68c1fc51ab65854cb) +- [Dev Deps] add missing dev dep [`9667c7d`](https://github.com/es-shims/String.prototype.trim/commit/9667c7d04de2dff034cde13f41aca9e203947d43) +- [Dev Deps] add missing peer dep [`6417c72`](https://github.com/es-shims/String.prototype.trim/commit/6417c727c94acb568ad4f5b4674996401f5ee531) + +## [v1.2.9](https://github.com/es-shims/String.prototype.trim/compare/v1.2.8...v1.2.9) - 2024-03-16 + +### Commits + +- [Refactor] use `es-object-atoms`; update `call-bind`, `define-properties`, `es-abstract` [`f6fe1af`](https://github.com/es-shims/String.prototype.trim/commit/f6fe1af4cb9381757971b294afc845e3b2e7c1e9) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`d4e2b81`](https://github.com/es-shims/String.prototype.trim/commit/d4e2b81878478d7090826b73d52bc42f117a2189) + +## [v1.2.8](https://github.com/es-shims/String.prototype.trim/compare/v1.2.7...v1.2.8) - 2023-09-07 + +### Commits + +- [Tests] add passing test cases [`2ab172c`](https://github.com/es-shims/String.prototype.trim/commit/2ab172c3ddeec62fb4f6ead3c7e10d24e340ecad) +- [Deps] update `es-abstract` [`8c16598`](https://github.com/es-shims/String.prototype.trim/commit/8c16598aba57e30c5e8446f91fb998a5790c1f81) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`2b99fad`](https://github.com/es-shims/String.prototype.trim/commit/2b99fad6f32386b5bf1b304acb0fdd2a73c77a95) +- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/eslint-config`, `aud`, `tape` [`97be2b5`](https://github.com/es-shims/String.prototype.trim/commit/97be2b55a3902753f50fadc2e9df6b7ff0f0f669) +- [Deps] update `define-properties`, `es-abstract` [`1fdc65f`](https://github.com/es-shims/String.prototype.trim/commit/1fdc65ff4b9c73cc9d132832943a89a57f1f93a5) + +## [v1.2.7](https://github.com/es-shims/String.prototype.trim/compare/v1.2.6...v1.2.7) - 2022-11-07 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`3e6de84`](https://github.com/es-shims/String.prototype.trim/commit/3e6de84f959c1ecc44e894aa1a64a8eb5007f3f5) +- [actions] update rebase action to use reusable workflow [`b725a04`](https://github.com/es-shims/String.prototype.trim/commit/b725a0499b832e69dfe5121bb643464a659ba8ff) +- [Deps] update `es-abstract` [`b707a17`](https://github.com/es-shims/String.prototype.trim/commit/b707a1747363f361665c50eda5eb952a86755e8c) +- [Dev Deps] update `aud`, `tape` [`5295419`](https://github.com/es-shims/String.prototype.trim/commit/5295419b0bbaf8035696ef3a24a8625ee743ec7f) + +## [v1.2.6](https://github.com/es-shims/String.prototype.trim/compare/v1.2.5...v1.2.6) - 2022-04-24 + +### Commits + +- [actions] reuse common workflows [`dbfc093`](https://github.com/es-shims/String.prototype.trim/commit/dbfc0932e7b2fad166245599310a1d84a1be0882) +- [Fix] as of unicode v6, the mongolian vowel separator is no longer whitespace [`56bbb86`](https://github.com/es-shims/String.prototype.trim/commit/56bbb86b8e514a16fc47e095b8c1014e12a2e92a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`7fa437e`](https://github.com/es-shims/String.prototype.trim/commit/7fa437e4c3d25798d979294a121f93cb4346ba04) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `tape` [`716a060`](https://github.com/es-shims/String.prototype.trim/commit/716a06080dbca68ec8e3b2e0e18c0a333ed28594) +- [actions] update codecov uploader [`9a39958`](https://github.com/es-shims/String.prototype.trim/commit/9a39958a13e20d6b9f01f9fce71dd37cc03da52e) +- [Fix] ensure main entry point properly checks the receiver in ES3 engines [`24220c4`](https://github.com/es-shims/String.prototype.trim/commit/24220c49dcb7055b5b94eb52c4d610428e19d3e4) +- [Deps] update `define-properties`, `es-abstract` [`c6008ea`](https://github.com/es-shims/String.prototype.trim/commit/c6008ea9007741755710b70ae05003cb71a7d1bd) + +## [v1.2.5](https://github.com/es-shims/String.prototype.trim/compare/v1.2.4...v1.2.5) - 2021-10-03 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`37d5a61`](https://github.com/es-shims/String.prototype.trim/commit/37d5a61c95a26c079b30e2d9d2ffdb70f36ca9cf) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`4c4a85e`](https://github.com/es-shims/String.prototype.trim/commit/4c4a85e5f521ae9811ac1205af933e3845b5a24e) +- [readme] add github actions/codecov badges [`9980eee`](https://github.com/es-shims/String.prototype.trim/commit/9980eee58866b08218ff3257a3af2aa9e29774fc) +- [Deps] update `es-abstract` [`6c1da80`](https://github.com/es-shims/String.prototype.trim/commit/6c1da806270fd909a76fc43e3dfe91be46058382) +- [readme] remove defunct testling badge [`8d282d1`](https://github.com/es-shims/String.prototype.trim/commit/8d282d1becd5f8d3ffe0e6e1dbfa2ddf29071670) +- [Dev Deps] update `eslint`, `tape` [`8856c26`](https://github.com/es-shims/String.prototype.trim/commit/8856c2663b5495cafb930e009f68e2d22958cac0) +- [actions] update workflows [`62cd341`](https://github.com/es-shims/String.prototype.trim/commit/62cd3412aaeee13c0d2cfe7f9bd33297e7279989) +- [meta] use `prepublishOnly` script for npm 7+ [`abd99c4`](https://github.com/es-shims/String.prototype.trim/commit/abd99c4a9838847efb3db7ddf579fb4bda8f6030) +- [Deps] update `es-abstract` [`802cb7b`](https://github.com/es-shims/String.prototype.trim/commit/802cb7b69b3a0c9a9b9642d641f0af490bd9dde7) + +## [v1.2.4](https://github.com/es-shims/String.prototype.trim/compare/v1.2.3...v1.2.4) - 2021-02-21 + +### Commits + +- [meta] do not publish github action workflow files [`936161b`](https://github.com/es-shims/String.prototype.trim/commit/936161bf43c83e09bc39c4d472d313c8f64e3fe3) +- [readme] remove travis badge [`9a28c39`](https://github.com/es-shims/String.prototype.trim/commit/9a28c3943b51a2cc87694c954205249122256d92) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `functions-have-names`, `has-strict-mode`, `tape` [`7b4be8d`](https://github.com/es-shims/String.prototype.trim/commit/7b4be8d12365feb5b42658902cf18316508a0c62) +- [Tests] increase coverage [`31b8735`](https://github.com/es-shims/String.prototype.trim/commit/31b87354f55f24501ca8b2f02477cb692a70457c) +- [actions] update workflows [`eda6ab7`](https://github.com/es-shims/String.prototype.trim/commit/eda6ab73fea52b49b74653e96ac81d5372599dc8) +- [Deps] update `call-bind`, `es-abstract` [`083f88f`](https://github.com/es-shims/String.prototype.trim/commit/083f88f5342144f337f1f82874cb8cd6f27f2262) + +## [v1.2.3](https://github.com/es-shims/String.prototype.trim/compare/v1.2.2...v1.2.3) - 2020-11-21 + +### Commits + +- [Tests] migrate tests to Github Actions [`6768c8d`](https://github.com/es-shims/String.prototype.trim/commit/6768c8d5569a6fcc841436b98a19ddf6b63c7de4) +- [Tests] run `nyc` on all tests [`2fd5baa`](https://github.com/es-shims/String.prototype.trim/commit/2fd5baa7239a4d449338e0333e2dc4573597962e) +- [Deps] update `es-abstract`; use `call-bind` where applicable [`e4e8c6e`](https://github.com/es-shims/String.prototype.trim/commit/e4e8c6ede423ee8c384564092f624f980097bb28) +- [Dev Deps] update `eslint`, `aud`, `auto-changelog` [`a21c1d5`](https://github.com/es-shims/String.prototype.trim/commit/a21c1d5c87ec9b1b5107b0a1faf138993951081c) + +## [v1.2.2](https://github.com/es-shims/String.prototype.trim/compare/v1.2.1...v1.2.2) - 2020-09-15 + +### Commits + +- [Tests] use `nyc` for coverage` [`0884270`](https://github.com/es-shims/String.prototype.trim/commit/0884270b26f7e6f7602d9f355dc3b4d5cd12d97e) +- [Tests] add implementation tests [`475c480`](https://github.com/es-shims/String.prototype.trim/commit/475c4804224a11bb6fba6d1407b59f7aab2c5d4e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`d70d913`](https://github.com/es-shims/String.prototype.trim/commit/d70d9136bc76499ecee1997068b7f3d1ba0f94e8) +- [actions] add "Allow Edits" workflow [`6e6be23`](https://github.com/es-shims/String.prototype.trim/commit/6e6be23aa679e02836e1f3e65bd09dd30c3fd2ae) +- [Refactor] use `RequireObjectCoercible` instead of `CheckObjectCoercible` [`5bfaf17`](https://github.com/es-shims/String.prototype.trim/commit/5bfaf1731edd5fcd01ec07f75717eebdf4992e4c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `functions-have-names`; add `safe-publish-latest` [`65be600`](https://github.com/es-shims/String.prototype.trim/commit/65be600028222127c1faaeacea810bc042f35f70) +- [Deps] update `es-abstract`, remove `function-bind` [`5f4d1ec`](https://github.com/es-shims/String.prototype.trim/commit/5f4d1ec8f2c13a4b4fde171ca2029e1ec4057b2b) +- [Refactor] switch from 2019 to 2020 AOs [`4c2d5d2`](https://github.com/es-shims/String.prototype.trim/commit/4c2d5d23f63731958007d856767f5a2f9c779c15) +- [Dev Deps] update `auto-changelog`, `tape` [`c7fc9e2`](https://github.com/es-shims/String.prototype.trim/commit/c7fc9e22b09d24a9aa9e68358d4a5ba10e25ff04) +- [Dev Deps] update `auto-changelog`; add `aud` [`e1dec36`](https://github.com/es-shims/String.prototype.trim/commit/e1dec364391ea5d7dc8339d2da279fdc511cdbe9) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`35826c2`](https://github.com/es-shims/String.prototype.trim/commit/35826c21b140a3c1431bd20c3443da23888b92bc) +- [Deps] update `es-abstract` [`54095ef`](https://github.com/es-shims/String.prototype.trim/commit/54095ef76d193c8595516977e98343f8db754e2d) +- [Deps] update `es-abstract` [`486dd9c`](https://github.com/es-shims/String.prototype.trim/commit/486dd9c68c5843a9f50cde55749d34edb9702616) + +## [v1.2.1](https://github.com/es-shims/String.prototype.trim/compare/v1.2.0...v1.2.1) - 2019-12-16 + +### Commits + +- [Tests] use shared travis-ci configs [`52f7e64`](https://github.com/es-shims/String.prototype.trim/commit/52f7e643f128e04ed0139c1cb3da7b7907ea639f) +- [meta] add `auto-changelog` [`6284c06`](https://github.com/es-shims/String.prototype.trim/commit/6284c061c8f4de4314a43e8600ff879164ab162c) +- [meta] remove unused Makefile and associated utilities [`8c781cd`](https://github.com/es-shims/String.prototype.trim/commit/8c781cd4bad87f7bf31dae256ef0f1c19cec2113) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names` [`c54b481`](https://github.com/es-shims/String.prototype.trim/commit/c54b481743611e736315c10885cfc861d306e64a) +- [Refactor] use split-up `es-abstract` (57% bundle size decrease) [`b0378c9`](https://github.com/es-shims/String.prototype.trim/commit/b0378c99988846b0a8edf3fcfd08f30dd632f5a9) +- [actions] add automatic rebasing / merge commit blocking [`bffe893`](https://github.com/es-shims/String.prototype.trim/commit/bffe893990837250f8a3c4714bd52675251af5c7) +- [meta] add `funding` field [`0559449`](https://github.com/es-shims/String.prototype.trim/commit/05594490366fad2d8e4bd435937fbd81169d965a) +- [Deps] update `es-abstract` [`c44d307`](https://github.com/es-shims/String.prototype.trim/commit/c44d307a50bb1fc53811b49d9203cd794ed1bae4) + +## [v1.2.0](https://github.com/es-shims/String.prototype.trim/compare/v1.1.2...v1.2.0) - 2019-07-24 + +### Commits + +- [Tests] up to `node` `v12.6`, `v11.15`, `v10.16`, `v9.11`, `v8.16`, `v7.10`, `v6.17`, `4.9`; use `nvm install-latest-npm` [`b857148`](https://github.com/es-shims/String.prototype.trim/commit/b857148644d305f720b2dd9bf691b7dc2930f91d) +- [Tests] remove `jscs` [`ad1dea7`](https://github.com/es-shims/String.prototype.trim/commit/ad1dea7f6114de79d637e82cdfaf1aa5499bd358) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `replace`, `semver`, `tape` [`fcbc11d`](https://github.com/es-shims/String.prototype.trim/commit/fcbc11d4af9be65f4f7eb4aec20498c7a33a004f) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`06a4ffa`](https://github.com/es-shims/String.prototype.trim/commit/06a4ffa3078d4ab65418e878d3ef7b03277e8a1f) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@es-shims/api` [`3554fb1`](https://github.com/es-shims/String.prototype.trim/commit/3554fb1fe722004080000b0767f7f89676a3d73a) +- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`804b2f2`](https://github.com/es-shims/String.prototype.trim/commit/804b2f244c257b32cb2473eb1a829ce97dc6a0a5) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `semver`, `@ljharb/eslint-config` [`6a69408`](https://github.com/es-shims/String.prototype.trim/commit/6a694081cdd9aa9296ea181e4d2b4c6fe656bb16) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`e89adee`](https://github.com/es-shims/String.prototype.trim/commit/e89adeefcbd6fb59563e62d230b8036d65a8bf69) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`1280e56`](https://github.com/es-shims/String.prototype.trim/commit/1280e5629deb4554c7077d0e452399c03c06f7b1) +- [New] add `auto` entry point [`bb00b15`](https://github.com/es-shims/String.prototype.trim/commit/bb00b1551d2774e216b5d316b552d08a7f0619d4) +- [Tests] fix tests for the mongolian vowel separator [`a35f627`](https://github.com/es-shims/String.prototype.trim/commit/a35f6275ec7b4d6b47136a007fd07566e037cac8) +- [Tests] up to `node` `v5.9`, `v4.4` [`b541b9b`](https://github.com/es-shims/String.prototype.trim/commit/b541b9b46873be859aea6c5b1e7f6f54323ea139) +- [Dev Deps] update `jscs`, `nsp`, `eslint` [`b52022d`](https://github.com/es-shims/String.prototype.trim/commit/b52022d809922914827c34bcf2c1f81b68bde092) +- [Tests] use pretest/posttest for linting/security [`39f5684`](https://github.com/es-shims/String.prototype.trim/commit/39f56844f30f630ab5497f38153b8f0646ed1d96) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`8c358c2`](https://github.com/es-shims/String.prototype.trim/commit/8c358c22ee57bd5e7b437fb707230399ea7c42aa) +- [Tests] up to `node` `v6.2` [`2ac7e1f`](https://github.com/es-shims/String.prototype.trim/commit/2ac7e1f90088bb0c96986006539ffebb6b2a6eda) +- Only apps should have lockfiles [`cb15ed5`](https://github.com/es-shims/String.prototype.trim/commit/cb15ed57fbf3ba3f2d7f24af957e8ff41421dd81) +- [Deps] update `define-properties`, `es-abstract`, `function-bind` [`5e0371a`](https://github.com/es-shims/String.prototype.trim/commit/5e0371af5c7b8fee49a0e7d1bcc26fcf41743779) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api` [`37bae7f`](https://github.com/es-shims/String.prototype.trim/commit/37bae7f8f4952b376036d924673b9e885da022f8) +- [Tests] on `node` `v5.6`, `v4.3` [`33017cf`](https://github.com/es-shims/String.prototype.trim/commit/33017cf0d3aade480c357ee8aedaca7bc5a75092) +- [Tests] allow coverage to fail [`0d7b1e3`](https://github.com/es-shims/String.prototype.trim/commit/0d7b1e365484f8c33247b60e2a07748dc2183d40) +- [Tests] use `functions-have-names` [`3e68777`](https://github.com/es-shims/String.prototype.trim/commit/3e687776f6a45e3a6d129705aad3bb4863758114) +- [Tests] on `node` `v5.12` [`32ea49d`](https://github.com/es-shims/String.prototype.trim/commit/32ea49d7572b3f981d036ea060e3ed3559ad78ef) +- [Deps] update `es-abstract` [`15f7f24`](https://github.com/es-shims/String.prototype.trim/commit/15f7f249619b7aab941c6c8156cb81ed57c39b7e) +- [Tests] on `node` `v5.10` [`080c50f`](https://github.com/es-shims/String.prototype.trim/commit/080c50fc617de7ac024d443d4a9b76ba295bd744) +- [Deps] update `function-bind` [`532480e`](https://github.com/es-shims/String.prototype.trim/commit/532480e07ad7bf22da64d401ede35928d21ff558) + +## [v1.1.2](https://github.com/es-shims/String.prototype.trim/compare/v1.1.1...v1.1.2) - 2016-02-06 + +### Commits + +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `semver`, `@ljharb/eslint-config` [`df94d07`](https://github.com/es-shims/String.prototype.trim/commit/df94d07e12ca1e52739353f534a3d89e0a860a70) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`ef78d89`](https://github.com/es-shims/String.prototype.trim/commit/ef78d89148efe8d371fb828923dd149163e2c5c6) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`b746516`](https://github.com/es-shims/String.prototype.trim/commit/b7465166a48828367bedaa2d42a30a5e148dcaae) +- package.json: use object form of "authors", add "contributors" [`a799df1`](https://github.com/es-shims/String.prototype.trim/commit/a799df17322ae526d5c8732c75bd5bcc3d1f649f) +- [Tests] up to `node` `v5.5`, don’t allow `0.8` to fail [`7fea308`](https://github.com/es-shims/String.prototype.trim/commit/7fea3082424fbeb25f2cb88884a999326ca428f2) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `semver`, `@ljharb/eslint-config` [`d14c7c1`](https://github.com/es-shims/String.prototype.trim/commit/d14c7c1850fb8e3a9f1d153bd818ed3beacdbadc) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`2903359`](https://github.com/es-shims/String.prototype.trim/commit/29033591ca3e65977e2746537c94b7e2e8b65ecc) +- [Tests] fix npm upgrades for older nodes [`0a6cbfa`](https://github.com/es-shims/String.prototype.trim/commit/0a6cbfa0ac506703ed554f6dc8bbde7ac1977cd4) +- [Deps] update `define-properties`, `es-abstract` [`39ccb08`](https://github.com/es-shims/String.prototype.trim/commit/39ccb0881762d762934ef2cb3c0459c65b3abf72) +- [Deps] update `es-abstract` [`c40e4fb`](https://github.com/es-shims/String.prototype.trim/commit/c40e4fb229e1a6a3e3c6818fc680ca380f2d866c) +- Use the polyfill, not the implementation, as the default export. [`0fe847e`](https://github.com/es-shims/String.prototype.trim/commit/0fe847e901871f1a8f33a66be2cd518bf8dcd0e1) +- [Tests] on `node` `v4.2` [`589743c`](https://github.com/es-shims/String.prototype.trim/commit/589743c0f8b1432a79cfed4b29187e6a9760a87b) +- [Deps] update `es-abstract` [`85bad8e`](https://github.com/es-shims/String.prototype.trim/commit/85bad8e217969a6e1eb7679a1bb06d6f075bd557) +- added assert [`aa81ac5`](https://github.com/es-shims/String.prototype.trim/commit/aa81ac55540a9e53a58ce0d1f5266ff36d403b3a) + +## [v1.1.1](https://github.com/es-shims/String.prototype.trim/compare/v1.1.0...v1.1.1) - 2015-08-16 + +### Commits + +- [Docs] remove "if" around `.shim` call in example [`b9ce088`](https://github.com/es-shims/String.prototype.trim/commit/b9ce08875f7252a85928e426db9b533cc5ee007a) + +## [v1.1.0](https://github.com/es-shims/String.prototype.trim/compare/v1.0.0...v1.1.0) - 2015-08-16 + +### Commits + +- Implement the [es-shim API](es-shims/api). [`5812703`](https://github.com/es-shims/String.prototype.trim/commit/581270337926462f9babf83772bcab71bc48bf8f) +- Move implementation to `implementation.js` [`e455b2a`](https://github.com/es-shims/String.prototype.trim/commit/e455b2af0e360358f02e54b556e698a971fc31f4) +- Fix `make release` [`efd2071`](https://github.com/es-shims/String.prototype.trim/commit/efd20711e9a226ad25e2b1e5ad7bbe85ef832d69) +- [Dev Deps] update `jscs` [`6c2fa95`](https://github.com/es-shims/String.prototype.trim/commit/6c2fa957538f139767de540693910cf1f49c8d3a) +- [Deps] update `es-abstract` [`de4cd87`](https://github.com/es-shims/String.prototype.trim/commit/de4cd876239d550f3c35e1db55a973cbb03c9b77) +- [Dev Deps] update `tape` [`2d07fe1`](https://github.com/es-shims/String.prototype.trim/commit/2d07fe19ff136467e1edbca91cfea6caac1b06d8) +- [Dev Deps] update `tape` [`e697efe`](https://github.com/es-shims/String.prototype.trim/commit/e697efe943cab07639d62649424c72e4f44f2469) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`6065103`](https://github.com/es-shims/String.prototype.trim/commit/6065103baa10f56b904f44693d5ba6b23ee6ba57) + +## v1.0.0 - 2015-08-08 + +### Commits + +- Dotfiles / Makefile [`b7f0e52`](https://github.com/es-shims/String.prototype.trim/commit/b7f0e526ea73136e00595d768faaba83a41da7ee) +- Tests [`4d61441`](https://github.com/es-shims/String.prototype.trim/commit/4d61441de9dcf2278dcd118077d4541843a47534) +- package.json [`2a2e0f2`](https://github.com/es-shims/String.prototype.trim/commit/2a2e0f2949dd30095eda20e1796483ea21dd7b38) +- Initial commit [`51aa18f`](https://github.com/es-shims/String.prototype.trim/commit/51aa18f299f8d340034670af0311c5981c89f713) +- Read me [`5681192`](https://github.com/es-shims/String.prototype.trim/commit/56811925aed1dd06a2cfa654b3f246b6a897a33c) +- Implementation [`87f08c5`](https://github.com/es-shims/String.prototype.trim/commit/87f08c565f7be56c2826386aa4a4e683a00d8871) diff --git a/node_modules/string.prototype.trim/LICENSE b/node_modules/string.prototype.trim/LICENSE new file mode 100644 index 000000000..fcf5754ef --- /dev/null +++ b/node_modules/string.prototype.trim/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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.prototype.trim/README.md b/node_modules/string.prototype.trim/README.md new file mode 100644 index 000000000..60b333f5c --- /dev/null +++ b/node_modules/string.prototype.trim/README.md @@ -0,0 +1,48 @@ +# String.prototype.trim [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES5 spec-compliant `String.prototype.trim` shim. Invoke its "shim" method to shim `String.prototype.trim` if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the spec (both [ES5](https://262.ecma-international.org/5.1/#sec-15.5.4.20) and [current](https://tc39.es/ecma262/#sec-string.prototype.trim)). + +Most common usage: + +```js +var assert = require('assert'); +var trim = require('string.prototype.trim'); + +assert(trim(' \t\na \t\n') === 'a'); + +trim.shim(); // will be a no-op if not needed + +assert(trim(' \t\na \t\n') === ' \t\na \t\n'.trim()); +``` + +## Engine Bugs +Some implementations of `String#trim` incorrectly trim zero-width spaces. This shim detects and corrects this behavior. + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/string.prototype.trim +[npm-version-svg]: https://versionbadg.es/es-shims/String.prototype.trim.svg +[deps-svg]: https://david-dm.org/es-shims/String.prototype.trim.svg +[deps-url]: https://david-dm.org/es-shims/String.prototype.trim +[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trim/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trim#info=devDependencies +[license-image]: https://img.shields.io/npm/l/string.prototype.trim.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trim.svg +[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trim +[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trim/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trim/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trim +[actions-url]: https://github.com/es-shims/String.prototype.trim/actions diff --git a/node_modules/string.prototype.trim/auto.js b/node_modules/string.prototype.trim/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/string.prototype.trim/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/string.prototype.trim/implementation.js b/node_modules/string.prototype.trim/implementation.js new file mode 100644 index 000000000..bf457b5b3 --- /dev/null +++ b/node_modules/string.prototype.trim/implementation.js @@ -0,0 +1,21 @@ +'use strict'; + +var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible'); +var ToString = require('es-abstract/2024/ToString'); +var callBound = require('call-bound'); +var $replace = callBound('String.prototype.replace'); + +var mvsIsWS = (/^\s$/).test('\u180E'); +/* eslint-disable no-control-regex */ +var leftWhitespace = mvsIsWS + ? /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/ + : /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/; +var rightWhitespace = mvsIsWS + ? /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/ + : /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/; +/* eslint-enable no-control-regex */ + +module.exports = function trim() { + var S = ToString(RequireObjectCoercible(this)); + return $replace($replace(S, leftWhitespace, ''), rightWhitespace, ''); +}; diff --git a/node_modules/string.prototype.trim/index.js b/node_modules/string.prototype.trim/index.js new file mode 100644 index 000000000..ce41c888c --- /dev/null +++ b/node_modules/string.prototype.trim/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var callBind = require('call-bind'); +var define = require('define-properties'); +var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); +var boundMethod = function trim(receiver) { + RequireObjectCoercible(receiver); + return bound(receiver); +}; + +define(boundMethod, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = boundMethod; diff --git a/node_modules/string.prototype.trim/package.json b/node_modules/string.prototype.trim/package.json new file mode 100644 index 000000000..e76066e1f --- /dev/null +++ b/node_modules/string.prototype.trim/package.json @@ -0,0 +1,106 @@ +{ + "name": "string.prototype.trim", + "version": "1.2.10", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "ES5 spec-compliant shim for String.prototype.trim", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/es-shims/String.prototype.trim.git" + }, + "keywords": [ + "String.prototype.trim", + "string", + "ES5", + "shim", + "trim", + "polyfill", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/9.0..latest", + "firefox/4.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/11.6..latest", + "opera/next", + "safari/5.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/string.prototype.trim/polyfill.js b/node_modules/string.prototype.trim/polyfill.js new file mode 100644 index 000000000..534db4ca9 --- /dev/null +++ b/node_modules/string.prototype.trim/polyfill.js @@ -0,0 +1,19 @@ +'use strict'; + +var implementation = require('./implementation'); + +var zeroWidthSpace = '\u200b'; +var mongolianVowelSeparator = '\u180E'; + +module.exports = function getPolyfill() { + if ( + String.prototype.trim + && zeroWidthSpace.trim() === zeroWidthSpace + && mongolianVowelSeparator.trim() === mongolianVowelSeparator + && ('_' + mongolianVowelSeparator).trim() === ('_' + mongolianVowelSeparator) + && (mongolianVowelSeparator + '_').trim() === (mongolianVowelSeparator + '_') + ) { + return String.prototype.trim; + } + return implementation; +}; diff --git a/node_modules/string.prototype.trim/shim.js b/node_modules/string.prototype.trim/shim.js new file mode 100644 index 000000000..58a073cdc --- /dev/null +++ b/node_modules/string.prototype.trim/shim.js @@ -0,0 +1,20 @@ +'use strict'; + +var supportsDescriptors = require('has-property-descriptors')(); +var defineDataProperty = require('define-data-property'); + +var getPolyfill = require('./polyfill'); + +module.exports = function shimStringTrim() { + var polyfill = getPolyfill(); + + if (String.prototype.trim !== polyfill) { + if (supportsDescriptors) { + defineDataProperty(String.prototype, 'trim', polyfill, true); + } else { + defineDataProperty(String.prototype, 'trim', polyfill); + } + } + + return polyfill; +}; diff --git a/node_modules/string.prototype.trim/test/implementation.js b/node_modules/string.prototype.trim/test/implementation.js new file mode 100644 index 000000000..ba3ae596e --- /dev/null +++ b/node_modules/string.prototype.trim/test/implementation.js @@ -0,0 +1,21 @@ +'use strict'; + +var trim = require('../implementation'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var callBind = require('call-bind'); + +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { trim.call(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { trim.call(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(trim), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trim/test/index.js b/node_modules/string.prototype.trim/test/index.js new file mode 100644 index 000000000..cc9085175 --- /dev/null +++ b/node_modules/string.prototype.trim/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var trim = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { trim(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { trim(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(trim, t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trim/test/shimmed.js b/node_modules/string.prototype.trim/test/shimmed.js new file mode 100644 index 000000000..57cf69c7c --- /dev/null +++ b/node_modules/string.prototype.trim/test/shimmed.js @@ -0,0 +1,36 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.equal(String.prototype.trim.length, 0, 'String#trim has a length of 0'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(String.prototype.trim.name, 'trim', 'String#trim has name "trim"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(String.prototype, 'trim'), 'String#trim is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return String.prototype.trim.call(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return String.prototype.trim.call(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(String.prototype.trim), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trim/test/tests.js b/node_modules/string.prototype.trim/test/tests.js new file mode 100644 index 000000000..fcc065146 --- /dev/null +++ b/node_modules/string.prototype.trim/test/tests.js @@ -0,0 +1,62 @@ +'use strict'; + +var forEach = require('for-each'); + +module.exports = function (trim, t) { + t.test('normal cases', function (st) { + st.equal(trim(' \t\na \t\n'), 'a', 'strips whitespace off left and right sides'); + st.equal(trim('a'), 'a', 'noop when no whitespace'); + + var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + st.equal(trim(allWhitespaceChars + 'a' + allWhitespaceChars), 'a', 'all expected whitespace chars are trimmed'); + + st.end(); + }); + + // see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/ + var mongolianVowelSeparator = '\u180E'; + var mvsIsWS = (/^\s$/).test('\u180E'); + t.test('unicode >= 4 && < 6.3', function (st) { + st.equal( + trim(mongolianVowelSeparator + 'a' + mongolianVowelSeparator), + mvsIsWS ? 'a' : mongolianVowelSeparator + 'a' + mongolianVowelSeparator, + 'mongolian vowel separator is' + (mvsIsWS ? '' : ' not') + ' whitespace' + ); + + st.equal( + trim(mongolianVowelSeparator), + mvsIsWS ? '' : mongolianVowelSeparator + ); + st.equal( + trim('_' + mongolianVowelSeparator), + '_' + (mvsIsWS ? '' : mongolianVowelSeparator) + ); + st.equal( + trim(mongolianVowelSeparator + '_'), + (mvsIsWS ? '' : mongolianVowelSeparator) + '_' + ); + + st.end(); + }); + + t.test('zero-width spaces', function (st) { + var zeroWidth = '\u200b'; + st.equal(trim(zeroWidth), zeroWidth, 'zero width space does not trim'); + st.end(); + }); + + t.test('non-whitespace characters', function (st) { + // Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace. + var nonWhitespaces = { + '\\u0085': '\u0085', + '\\u200b': '\u200b', + '\\ufffe': '\ufffe' + }; + + forEach(nonWhitespaces, function (nonWhitespace, name) { + st.equal(trim(nonWhitespace), nonWhitespace, name + ' does not trim'); + }); + + st.end(); + }); +}; diff --git a/node_modules/string.prototype.trimend/.editorconfig b/node_modules/string.prototype.trimend/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/string.prototype.trimend/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/string.prototype.trimend/.eslintrc b/node_modules/string.prototype.trimend/.eslintrc new file mode 100644 index 000000000..8056b20c9 --- /dev/null +++ b/node_modules/string.prototype.trimend/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "RequireObjectCoercible", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "id-length": 0, + "no-invalid-this": 1, + }, + }, + ], +} diff --git a/node_modules/string.prototype.trimend/.nycrc b/node_modules/string.prototype.trimend/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/string.prototype.trimend/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/string.prototype.trimend/CHANGELOG.md b/node_modules/string.prototype.trimend/CHANGELOG.md new file mode 100644 index 000000000..4981fd958 --- /dev/null +++ b/node_modules/string.prototype.trimend/CHANGELOG.md @@ -0,0 +1,128 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.9](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.8...v1.0.9) - 2024-12-11 + +### Commits + +- [actions] split out node 10-20, and 20+ [`7e5ffdc`](https://github.com/es-shims/String.prototype.trimEnd/commit/7e5ffdc2ab30b09e19773f35df5dceffddc660d4) +- [meta] sort package.json mildly [`2f99c8b`](https://github.com/es-shims/String.prototype.trimEnd/commit/2f99c8bc69d50dc0c56af3900cc31129ef42bc1b) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`2774fe6`](https://github.com/es-shims/String.prototype.trimEnd/commit/2774fe6660c9de92eacf2a8173f494aa151b1fc1) +- [Refactor] use `call-bound` directly [`9e3bbec`](https://github.com/es-shims/String.prototype.trimEnd/commit/9e3bbec66695b715ec38f832aa472e1a82ffe095) +- [Tests] replace `aud` with `npm audit` [`cb9a462`](https://github.com/es-shims/String.prototype.trimEnd/commit/cb9a4623b86d2a91cb0a5b704739b6fe43078abd) +- [meta] add missing `engines.node` [`f46c829`](https://github.com/es-shims/String.prototype.trimEnd/commit/f46c829985a3c78e92482247fe30800781b4a9e3) +- [Deps] update `call-bind` [`e892c32`](https://github.com/es-shims/String.prototype.trimEnd/commit/e892c32d30aaaee372c8159b7ac94d564cf7f0e9) +- [Dev Deps] add missing peer dep [`e1a59da`](https://github.com/es-shims/String.prototype.trimEnd/commit/e1a59da39cc18bbe546371b12d39f86b4c947896) + +## [v1.0.8](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.7...v1.0.8) - 2024-03-16 + +### Commits + +- [Refactor] replace `es-abstract` with `es-object-atoms` [`0df2b01`](https://github.com/es-shims/String.prototype.trimEnd/commit/0df2b018d3ba214e2435b9841a7a03fc06c24fd0) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`190e9c5`](https://github.com/es-shims/String.prototype.trimEnd/commit/190e9c5d74f84d8f90f61c9e9ad4b05f657df830) + +## [v1.0.7](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.6...v1.0.7) - 2023-09-07 + +### Commits + +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`1a10293`](https://github.com/es-shims/String.prototype.trimEnd/commit/1a102935636b564cd346d83666f62a9398864081) +- [Deps] update `define-properties`, `es-abstract` [`6ba2e19`](https://github.com/es-shims/String.prototype.trimEnd/commit/6ba2e19a78f9c63bad2daf0627ce7f2e33f1aeb9) + +## [v1.0.6](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.5...v1.0.6) - 2022-11-07 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`1d1e717`](https://github.com/es-shims/String.prototype.trimEnd/commit/1d1e71720ada81e484c9bffb386f65d7a6a1335e) +- [actions] update rebase action to use reusable workflow [`83f2683`](https://github.com/es-shims/String.prototype.trimEnd/commit/83f268325cc37ca72bea995281167a9d2821810b) +- [Dev Deps] update `aud`, `tape` [`a3a9129`](https://github.com/es-shims/String.prototype.trimEnd/commit/a3a9129dd995a949bdb93d278f403aa400e088ed) +- [Deps] update `es-abstract` [`a6e476d`](https://github.com/es-shims/String.prototype.trimEnd/commit/a6e476dc0120a41a22e66b5079bf3b407da387fa) + +## [v1.0.5](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.4...v1.0.5) - 2022-05-02 + +### Commits + +- [actions] reuse common workflows [`69a56ce`](https://github.com/es-shims/String.prototype.trimEnd/commit/69a56ce95343848d5e498f8e939a0697db8ac9f2) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5d7db31`](https://github.com/es-shims/String.prototype.trimEnd/commit/5d7db314948faac975705db56305b6cc3dae7ba9) +- [Fix] ensure main entry point properly checks the receiver in ES3 engines [`bb1983d`](https://github.com/es-shims/String.prototype.trimEnd/commit/bb1983dc27504733ab883a42f55b134f679a642d) +- [Fix] as of unicode v6, the mongolian vowel separator is no longer whitespace [`10a1091`](https://github.com/es-shims/String.prototype.trimEnd/commit/10a10916e1ffc8cdab78515b2cc521cc74c08277) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`a08e14b`](https://github.com/es-shims/String.prototype.trimEnd/commit/a08e14bfea5e27d419ef742e83f467a169a69971) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `tape` [`1c4c8da`](https://github.com/es-shims/String.prototype.trimEnd/commit/1c4c8dab4aefc1c5823a61b5a0286bb6fe1e036c) +- [actions] update codecov uploader [`70c4a7c`](https://github.com/es-shims/String.prototype.trimEnd/commit/70c4a7c566fd5bf72475df9318ec2cd218ceca26) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`4b08ed7`](https://github.com/es-shims/String.prototype.trimEnd/commit/4b08ed78a579585b593b3ca4ac7919d13906e840) +- [readme] add github actions/codecov badges [`9805501`](https://github.com/es-shims/String.prototype.trimEnd/commit/980550105b304385bcccb8ec05a247e02c24d04a) +- [Dev Deps] update `eslint`, `tape` [`50ec335`](https://github.com/es-shims/String.prototype.trimEnd/commit/50ec335ed42b59d1ab626dbe412f4ae23ab99b4b) +- [actions] update workflows [`bf9c32e`](https://github.com/es-shims/String.prototype.trimEnd/commit/bf9c32efe08e98b53302df67581dc971b7a758cd) +- [meta] use `prepublishOnly` script for npm 7+ [`9d921bd`](https://github.com/es-shims/String.prototype.trimEnd/commit/9d921bdbcaf8cebebbc302e6df518cbc3e4907bd) +- [Deps] update `define-properties` [`15617ce`](https://github.com/es-shims/String.prototype.trimEnd/commit/15617ced8ac2ea3ab8324a04d16fd294b12059b5) + +## [v1.0.4](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.3...v1.0.4) - 2021-02-23 + +### Commits + +- [meta] do not publish github action workflow files [`08e735c`](https://github.com/es-shims/String.prototype.trimEnd/commit/08e735cd55b00ae78a9dc16c6b4e786f7931085b) +- [readme] remove travis badge [`10e0e47`](https://github.com/es-shims/String.prototype.trimEnd/commit/10e0e47cb2ecfd171e68b40f8486c5d007dcf3ef) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `has-strict-mode`, `tape` [`0871432`](https://github.com/es-shims/String.prototype.trimEnd/commit/0871432c70c2f6a3929acd740a5d1f57c939f345) +- [Tests] increase coverage [`711e6a6`](https://github.com/es-shims/String.prototype.trimEnd/commit/711e6a66660f30f7a30fef536be435af1a13d05c) +- [actions] update workflows [`deb0d06`](https://github.com/es-shims/String.prototype.trimEnd/commit/deb0d06f41ac1c3e1e640ecd1cf0e69303ab5799) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`e250b4a`](https://github.com/es-shims/String.prototype.trimEnd/commit/e250b4a38401e7c02a067dab26cc68316da47ef7) +- [meta] gitignore coverage output [`55231df`](https://github.com/es-shims/String.prototype.trimEnd/commit/55231dfd9829277ba5c3f07be5434dc385703ca9) +- [Deps] update `call-bind` [`0580f5f`](https://github.com/es-shims/String.prototype.trimEnd/commit/0580f5f915ecb87677764d03fe3cf023e3bee7d8) + +## [v1.0.3](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.2...v1.0.3) - 2020-11-21 + +### Commits + +- [Tests] migrate tests to Github Actions [`23e7a09`](https://github.com/es-shims/String.prototype.trimEnd/commit/23e7a09a4ad37c21c3db3d7761212c7d84a371a2) +- [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner [`26e8623`](https://github.com/es-shims/String.prototype.trimEnd/commit/26e8623cf35c1859d0b482d4bb5b3450d101a810) +- [Tests] run `nyc` on all tests [`a72a546`](https://github.com/es-shims/String.prototype.trimEnd/commit/a72a546f671c5d3ac65dff68b4db1a1cc7089bfd) +- [Deps] replace `es-abstract` with `call-bind` [`f07b87d`](https://github.com/es-shims/String.prototype.trimEnd/commit/f07b87dd452090a2601d666edceb1daa90d45f24) +- [Dev Deps] update `eslint`, `aud`; add `safe-publish-latest` [`122ecb7`](https://github.com/es-shims/String.prototype.trimEnd/commit/122ecb726b1dc043b9ef27fa5a7b4172a4d5df37) + +## [v1.0.2](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.1...v1.0.2) - 2020-10-20 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`a003e71`](https://github.com/es-shims/String.prototype.trimEnd/commit/a003e7166d8de16c551a14b0ec855187357cce43) +- [actions] add "Allow Edits" workflow [`0b4b43c`](https://github.com/es-shims/String.prototype.trimEnd/commit/0b4b43cb605f7b3532e61c43dfc7f1795296c5a4) +- [Deps] update `es-abstract` [`75ca6b0`](https://github.com/es-shims/String.prototype.trimEnd/commit/75ca6b0e9757d64013ae863cfaac49ebcb36f1cf) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`552016c`](https://github.com/es-shims/String.prototype.trimEnd/commit/552016cb631ac13c12bbbc0d6dd65012e5e79583) + +## [v1.0.1](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.0...v1.0.1) - 2020-04-09 + +### Commits + +- [meta] add some missing repo metadata [`6abe248`](https://github.com/es-shims/String.prototype.trimEnd/commit/6abe248ba0b57a8b0e16bbe01de07a4d37c421bc) +- [Dev Deps] update `auto-changelog` [`e2eaab2`](https://github.com/es-shims/String.prototype.trimEnd/commit/e2eaab2fd1bc27a3d224b3d76db16190c1dd6d08) + +## [v1.0.0](https://github.com/es-shims/String.prototype.trimEnd/compare/v0.1.0...v1.0.0) - 2020-03-30 + +### Commits + +- [Breaking] convert to es-shim API [`2c6ef13`](https://github.com/es-shims/String.prototype.trimEnd/commit/2c6ef13d3f0b07a9bc55e367b311dbb731780405) +- [meta] add `auto-changelog` [`6f1fcc1`](https://github.com/es-shims/String.prototype.trimEnd/commit/6f1fcc1739de1e9541bd603b659807646a13dd7f) +- [meta] update readme [`ed4ce0d`](https://github.com/es-shims/String.prototype.trimEnd/commit/ed4ce0d84d53e626b48375c5959be20332464eaf) +- [Tests] add `npm run lint` [`eadaf2c`](https://github.com/es-shims/String.prototype.trimEnd/commit/eadaf2c83f2d791b54d80d7b30a9961ebc0f246f) +- Only apps should have lockfiles [`44d355f`](https://github.com/es-shims/String.prototype.trimEnd/commit/44d355f7dafcb0b51c5001824b07f7a2b9f1d06e) +- [actions] add automatic rebasing / merge commit blocking [`e78bf8e`](https://github.com/es-shims/String.prototype.trimEnd/commit/e78bf8e5fc04fcb3379dd1c98360d7df4f9ea7d6) +- [Tests] use shared travis-ci configs [`983c563`](https://github.com/es-shims/String.prototype.trimEnd/commit/983c5639efca2c9bb8b93ebbb917fbcb2561b94c) +- [meta] add `funding` field [`35139d6`](https://github.com/es-shims/String.prototype.trimEnd/commit/35139d6236ceacfc1501d08fb196d18a936ee583) +- [meta] fix non-updated version number [`a2d308b`](https://github.com/es-shims/String.prototype.trimEnd/commit/a2d308b99967ca427936c54747175794ca7336e1) + +## [v0.1.0](https://github.com/es-shims/String.prototype.trimEnd/compare/v0.0.1...v0.1.0) - 2017-12-19 + +### Commits + +- updated README [`f1c71a0`](https://github.com/es-shims/String.prototype.trimEnd/commit/f1c71a0a882e89e1c207ed2b316d91670be2b075) + +## v0.0.1 - 2017-12-19 + +### Commits + +- finished polyfill [`e58d550`](https://github.com/es-shims/String.prototype.trimEnd/commit/e58d550ab8695924ff4221ebe91f00f29801aa4b) +- created README file [`f78628a`](https://github.com/es-shims/String.prototype.trimEnd/commit/f78628ab123171f8b7759bba331d6a589702584f) +- Initial commit [`9199478`](https://github.com/es-shims/String.prototype.trimEnd/commit/9199478256da953e2f5bddfc4d82a161f4537e85) +- typo [`d1f4558`](https://github.com/es-shims/String.prototype.trimEnd/commit/d1f4558a51157833f14d8a424426d038d06576ce) diff --git a/node_modules/string.prototype.trimend/LICENSE b/node_modules/string.prototype.trimend/LICENSE new file mode 100644 index 000000000..e48a1b576 --- /dev/null +++ b/node_modules/string.prototype.trimend/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Khaled Al-Ansari + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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.prototype.trimend/README.md b/node_modules/string.prototype.trimend/README.md new file mode 100644 index 000000000..292bda959 --- /dev/null +++ b/node_modules/string.prototype.trimend/README.md @@ -0,0 +1,46 @@ +# String.prototype.trimEnd [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES2019-spec-compliant `String.prototype.trimEnd` shim. Invoke its "shim" method to shim `String.prototype.trimEnd` if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. + +Most common usage: +```js +var trimEnd = require('string.prototype.trimend'); + +assert(trimEnd(' \t\na \t\n') === 'a \t\n'); + +if (!String.prototype.trimEnd) { + trimEnd.shim(); +} + +assert(trimEnd(' \t\na \t\n ') === ' \t\na \t\n '.trimEnd()); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/string.prototype.trimend +[npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimEnd.svg +[deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd.svg +[deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd +[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/string.prototype.trimend.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/string.prototype.trimend.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimend.svg +[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimend +[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimEnd/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimEnd/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trimEnd +[actions-url]: https://github.com/es-shims/String.prototype.trimEnd/actions diff --git a/node_modules/string.prototype.trimend/auto.js b/node_modules/string.prototype.trimend/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/string.prototype.trimend/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/string.prototype.trimend/implementation.js b/node_modules/string.prototype.trimend/implementation.js new file mode 100644 index 000000000..486495743 --- /dev/null +++ b/node_modules/string.prototype.trimend/implementation.js @@ -0,0 +1,15 @@ +'use strict'; + +var callBound = require('call-bound'); +var $replace = callBound('String.prototype.replace'); + +var mvsIsWS = (/^\s$/).test('\u180E'); +/* eslint-disable no-control-regex */ +var endWhitespace = mvsIsWS + ? /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/ + : /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/; +/* eslint-enable no-control-regex */ + +module.exports = function trimEnd() { + return $replace(this, endWhitespace, ''); +}; diff --git a/node_modules/string.prototype.trimend/index.js b/node_modules/string.prototype.trimend/index.js new file mode 100644 index 000000000..ce41c888c --- /dev/null +++ b/node_modules/string.prototype.trimend/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var callBind = require('call-bind'); +var define = require('define-properties'); +var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); +var boundMethod = function trim(receiver) { + RequireObjectCoercible(receiver); + return bound(receiver); +}; + +define(boundMethod, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = boundMethod; diff --git a/node_modules/string.prototype.trimend/package.json b/node_modules/string.prototype.trimend/package.json new file mode 100644 index 000000000..930f82b80 --- /dev/null +++ b/node_modules/string.prototype.trimend/package.json @@ -0,0 +1,83 @@ +{ + "name": "string.prototype.trimend", + "version": "1.0.9", + "author": "Jordan Harband ", + "contributors": [ + "Jordan Harband ", + "Khaled Al-Ansari " + ], + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES2019 spec-compliant String.prototype.trimEnd shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/es-shims/String.prototype.trimEnd.git" + }, + "keywords": [ + "es6", + "es7", + "es8", + "javascript", + "prototype", + "polyfill", + "utility", + "trim", + "trimLeft", + "trimRight", + "trimStart", + "trimEnd", + "tc39" + ], + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/string.prototype.trimend/polyfill.js b/node_modules/string.prototype.trimend/polyfill.js new file mode 100644 index 000000000..0fa4f7083 --- /dev/null +++ b/node_modules/string.prototype.trimend/polyfill.js @@ -0,0 +1,15 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + if (!String.prototype.trimEnd && !String.prototype.trimRight) { + return implementation; + } + var zeroWidthSpace = '\u200b'; + var trimmed = zeroWidthSpace.trimEnd ? zeroWidthSpace.trimEnd() : zeroWidthSpace.trimRight(); + if (trimmed !== zeroWidthSpace) { + return implementation; + } + return String.prototype.trimEnd || String.prototype.trimRight; +}; diff --git a/node_modules/string.prototype.trimend/shim.js b/node_modules/string.prototype.trimend/shim.js new file mode 100644 index 000000000..5a8f4773b --- /dev/null +++ b/node_modules/string.prototype.trimend/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimTrimEnd() { + var polyfill = getPolyfill(); + define( + String.prototype, + { trimEnd: polyfill }, + { trimEnd: function () { return String.prototype.trimEnd !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/string.prototype.trimend/test/implementation.js b/node_modules/string.prototype.trimend/test/implementation.js new file mode 100644 index 000000000..7fdf95b7d --- /dev/null +++ b/node_modules/string.prototype.trimend/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimend/test/index.js b/node_modules/string.prototype.trimend/test/index.js new file mode 100644 index 000000000..2ee8f6703 --- /dev/null +++ b/node_modules/string.prototype.trimend/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var trimEnd = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { trimEnd(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { trimEnd(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(trimEnd, t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimend/test/shimmed.js b/node_modules/string.prototype.trimend/test/shimmed.js new file mode 100644 index 000000000..1a01ceb1b --- /dev/null +++ b/node_modules/string.prototype.trimend/test/shimmed.js @@ -0,0 +1,36 @@ +'use strict'; + +require('../auto'); + +var runTests = require('./tests'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +test('shimmed', function (t) { + t.equal(String.prototype.trimEnd.length, 0, 'String#trimEnd has a length of 0'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal((/^(?:trimRight|trimEnd)$/).test(String.prototype.trimEnd.name), true, 'String#trimEnd has name "trimRight" or "trimEnd"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(String.prototype, 'trimEnd'), 'String#trimEnd is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return String.prototype.trimEnd.call(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return String.prototype.trimEnd.call(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(String.prototype.trimEnd), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimend/test/tests.js b/node_modules/string.prototype.trimend/test/tests.js new file mode 100644 index 000000000..03a8c5c51 --- /dev/null +++ b/node_modules/string.prototype.trimend/test/tests.js @@ -0,0 +1,31 @@ +'use strict'; + +module.exports = function (trimEnd, t) { + t.test('normal cases', function (st) { + st.equal(trimEnd(' \t\na \t\n'), ' \t\na', 'strips whitespace off the left side'); + st.equal(trimEnd('a'), 'a', 'noop when no whitespace'); + + var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + st.equal(trimEnd(allWhitespaceChars + 'a' + allWhitespaceChars), allWhitespaceChars + 'a', 'all expected whitespace chars are trimmed'); + + st.end(); + }); + + // see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/ + var mongolianVowelSeparator = '\u180E'; + var mvsIsWS = (/^\s$/).test(mongolianVowelSeparator); + t.test('mongolian vowel separator: unicode >= 4 && < 6.3', function (st) { + st.equal( + trimEnd(mongolianVowelSeparator + 'a' + mongolianVowelSeparator), + mongolianVowelSeparator + 'a' + (mvsIsWS ? '' : mongolianVowelSeparator), + 'mongolian vowel separator is ' + (mvsIsWS ? '' : 'not ') + 'whitespace' + ); + st.end(); + }); + + t.test('zero-width spaces', function (st) { + var zeroWidth = '\u200b'; + st.equal(trimEnd(zeroWidth), zeroWidth, 'zero width space does not trim'); + st.end(); + }); +}; diff --git a/node_modules/string.prototype.trimstart/.editorconfig b/node_modules/string.prototype.trimstart/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/string.prototype.trimstart/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/string.prototype.trimstart/.eslintrc b/node_modules/string.prototype.trimstart/.eslintrc new file mode 100644 index 000000000..8056b20c9 --- /dev/null +++ b/node_modules/string.prototype.trimstart/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "RequireObjectCoercible", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "id-length": 0, + "no-invalid-this": 1, + }, + }, + ], +} diff --git a/node_modules/string.prototype.trimstart/.nycrc b/node_modules/string.prototype.trimstart/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/string.prototype.trimstart/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/string.prototype.trimstart/CHANGELOG.md b/node_modules/string.prototype.trimstart/CHANGELOG.md new file mode 100644 index 000000000..e7701e1be --- /dev/null +++ b/node_modules/string.prototype.trimstart/CHANGELOG.md @@ -0,0 +1,118 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.8](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.7...v1.0.8) - 2024-03-21 + +### Commits + +- [actions] use reusable workflows [`d139c11`](https://github.com/es-shims/String.prototype.trimStart/commit/d139c119ba5003936649741fae52b28080794dd3) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`16ff815`](https://github.com/es-shims/String.prototype.trimStart/commit/16ff81546c62ac3159fdf223cd1b035729fd55f0) +- [Deps] update `call-bind`, `define-properties` [`8dd308d`](https://github.com/es-shims/String.prototype.trimStart/commit/8dd308dd225ea3cb6a4d2c9662e435101367a5ef) +- [Refactor] use `es-object-atoms` instead of `es-abstract` [`4868f56`](https://github.com/es-shims/String.prototype.trimStart/commit/4868f566f8052ab7e28ce733ecc62b56f743f7fc) +- [meta] add missing `engines.node` [`8c1cce6`](https://github.com/es-shims/String.prototype.trimStart/commit/8c1cce612e4e1fdd1e5172c9e508a88abd3e6a5c) + +## [v1.0.7](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.6...v1.0.7) - 2023-09-04 + +### Commits + +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`58e7aa6`](https://github.com/es-shims/String.prototype.trimStart/commit/58e7aa63b702f4494b89b8723b585bab5899a304) +- [Deps] update `define-properties`, `es-abstract` [`8d9a7bf`](https://github.com/es-shims/String.prototype.trimStart/commit/8d9a7bf123f320799211dd57aa0c832aaafb8a19) + +## [v1.0.6](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.5...v1.0.6) - 2022-11-07 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`0838ae4`](https://github.com/es-shims/String.prototype.trimStart/commit/0838ae4ed948df470185afbeea4296f5c5ecd759) +- [actions] update rebase action to use reusable workflow [`d6bb784`](https://github.com/es-shims/String.prototype.trimStart/commit/d6bb78400a00459e9ab0b28f433c45804a65184d) +- [Dev Deps] update `aud`, `tape` [`8734d9a`](https://github.com/es-shims/String.prototype.trimStart/commit/8734d9a616c6aca9ec7f0c8819e66c2496deb32e) +- [Deps] update `es-abstract` [`30f593f`](https://github.com/es-shims/String.prototype.trimStart/commit/30f593f3febf6d8d9b3d5605174b437fed9cbb3a) + +## [v1.0.5](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.4...v1.0.5) - 2022-05-02 + +### Commits + +- [actions] reuse common workflows [`61d4009`](https://github.com/es-shims/String.prototype.trimStart/commit/61d40098a96b3dcc6cf963c9d03dd1b23b6eb13d) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`bfe39c4`](https://github.com/es-shims/String.prototype.trimStart/commit/bfe39c498e26a4ad75c64cce27ff3df9bfef2cc1) +- [Fix] ensure main entry point properly checks the receiver in ES3 engines [`36e3730`](https://github.com/es-shims/String.prototype.trimStart/commit/36e37307bb06fb5dc34d861a4bf6f7db931340d9) +- [Fix] as of unicode v6, the mongolian vowel separator is no longer whitespace [`4f77eed`](https://github.com/es-shims/String.prototype.trimStart/commit/4f77eed5aa64e6f781310847d7831563fce90f5c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`59fcb99`](https://github.com/es-shims/String.prototype.trimStart/commit/59fcb995ef8d4723a83e28d46dbe41a14253b681) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `tape` [`486ffcf`](https://github.com/es-shims/String.prototype.trimStart/commit/486ffcfa93c75516601169a3973b81fdfeb7de8b) +- [actions] update codecov uploader [`b33ac48`](https://github.com/es-shims/String.prototype.trimStart/commit/b33ac48ccc86f6b894d8fde5162bd1c806904972) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`3c89fa5`](https://github.com/es-shims/String.prototype.trimStart/commit/3c89fa571d1c4b8894230d93caaf3b3d9885534d) +- [readme] add github actions/codecov badges [`00be6b3`](https://github.com/es-shims/String.prototype.trimStart/commit/00be6b34fdd989950b934b4471087362b78d4b0c) +- [Dev Deps] update `eslint`, `tape` [`13a08f5`](https://github.com/es-shims/String.prototype.trimStart/commit/13a08f578c53cf5f129fb6ebe486e8bbcc40c14e) +- [actions] update workflows [`6ac576d`](https://github.com/es-shims/String.prototype.trimStart/commit/6ac576dde99f73d19492777efed29ec069e89bf1) +- [meta] use `prepublishOnly` script for npm 7+ [`fa382ca`](https://github.com/es-shims/String.prototype.trimStart/commit/fa382caa5c8e9a868572605ce215a3db1dc9ef21) +- [Deps] update `define-properties` [`d57bffe`](https://github.com/es-shims/String.prototype.trimStart/commit/d57bffef7d89384c8888627c5ee33b80e24d54e0) + +## [v1.0.4](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.3...v1.0.4) - 2021-02-23 + +### Commits + +- [meta] do not publish github action workflow files [`9c434ec`](https://github.com/es-shims/String.prototype.trimStart/commit/9c434eceb50141cf36e8e65f514226b0b547b568) +- [readme] remove travis badge [`7843160`](https://github.com/es-shims/String.prototype.trimStart/commit/7843160a3e8feaa2213feb0da9c5ad7d9bf21b59) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `has-strict-mode`, `tape` [`8b52646`](https://github.com/es-shims/String.prototype.trimStart/commit/8b52646510aea20473da5491fe0876117a2251b1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`badeda2`](https://github.com/es-shims/String.prototype.trimStart/commit/badeda2b01d2e266e4d1c2e7dc0e4fca0f066f3e) +- [Tests] increase coverage [`bf8777d`](https://github.com/es-shims/String.prototype.trimStart/commit/bf8777d54c4b05c093559021cfaf0670306120f8) +- [actions] update workflows [`61be1c6`](https://github.com/es-shims/String.prototype.trimStart/commit/61be1c649ae859faa40286e57fa22cef65ae1229) +- [meta] gitignore coverage output [`c9c98d7`](https://github.com/es-shims/String.prototype.trimStart/commit/c9c98d75d7708e8906a39b55a0ad7a0ed6a9e4b0) +- [Deps] update `call-bind` [`c8645e8`](https://github.com/es-shims/String.prototype.trimStart/commit/c8645e89f9ace7681660ba66c724cf00c798f3d4) + +## [v1.0.3](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.2...v1.0.3) - 2020-11-21 + +### Commits + +- [Tests] migrate tests to Github Actions [`fbc7519`](https://github.com/es-shims/String.prototype.trimStart/commit/fbc7519cce2b5bfff9fe28dea96fb5f6f82e19fd) +- [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner [`3c9330b`](https://github.com/es-shims/String.prototype.trimStart/commit/3c9330be9ad02497f78ff0fd94b7c918c3a4bc21) +- [Tests] run `nyc` on all tests [`52229ca`](https://github.com/es-shims/String.prototype.trimStart/commit/52229ca28426be516c3826743e417be85144673e) +- [Deps] replace `es-abstract` with `call-bind` [`5e5068d`](https://github.com/es-shims/String.prototype.trimStart/commit/5e5068d2cc85d0a6f2a441ea984521ee70470537) +- [Dev Deps] update `eslint`, `aud`; add `safe-publish-latest` [`42a853e`](https://github.com/es-shims/String.prototype.trimStart/commit/42a853e2cb419378085098cb66e421ee94eed3ab) + +## [v1.0.2](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.1...v1.0.2) - 2020-10-20 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`d032b38`](https://github.com/es-shims/String.prototype.trimStart/commit/d032b38aac7e9ebae7bf5c4195492c508af2815a) +- [actions] add "Allow Edits" workflow [`83e30ba`](https://github.com/es-shims/String.prototype.trimStart/commit/83e30bac01572b6dba6358fec6e339c55dc431c9) +- [Deps] update `es-abstract` [`707d85d`](https://github.com/es-shims/String.prototype.trimStart/commit/707d85d827d9c537a144f199fdecc47edaade1cd) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`096c6d9`](https://github.com/es-shims/String.prototype.trimStart/commit/096c6d9dc142286c750da7024e7a88ed698a4953) + +## [v1.0.1](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.0...v1.0.1) - 2020-04-09 + +### Commits + +- [meta] add some missing repo metadata [`3385da3`](https://github.com/es-shims/String.prototype.trimStart/commit/3385da3bbb87819de11a869981ca954887a6a092) +- [Dev Deps] update `auto-changelog` [`879377d`](https://github.com/es-shims/String.prototype.trimStart/commit/879377df9c1ff97d8f0b3eac800683f1d68a304c) + +## [v1.0.0](https://github.com/es-shims/String.prototype.trimStart/compare/v0.1.0...v1.0.0) - 2020-03-30 + +### Commits + +- [Breaking] convert to es-shim API [`970922c`](https://github.com/es-shims/String.prototype.trimStart/commit/970922c494c78b033c351c77f61a8aefd49c30d9) +- [meta] add `auto-changelog` [`ff30c09`](https://github.com/es-shims/String.prototype.trimStart/commit/ff30c0996289113d2c3dbbfca7e280ff151bf36d) +- [meta] update readme [`816291d`](https://github.com/es-shims/String.prototype.trimStart/commit/816291d01e0eaf85da9b732c179cfb2454bd282e) +- [Tests] add `npm run lint` [`3341104`](https://github.com/es-shims/String.prototype.trimStart/commit/3341104450bc6ac84f3b70a6d6c0fbeb4df5131e) +- Only apps should have lockfiles [`f008df7`](https://github.com/es-shims/String.prototype.trimStart/commit/f008df73fbf3dcf8dfad6d5cad86de7050d0ae09) +- [actions] add automatic rebasing / merge commit blocking [`e5ba35c`](https://github.com/es-shims/String.prototype.trimStart/commit/e5ba35c1a14fcf652336cc9c4be49d232981161e) +- [Tests] use shared travis-ci configs [`46516b1`](https://github.com/es-shims/String.prototype.trimStart/commit/46516b137a8c07ed5807d751bd61199688ef9baa) +- [meta] add `funding` field [`34ae856`](https://github.com/es-shims/String.prototype.trimStart/commit/34ae8563f115bd4a5e5f5d2d786c0fa0a420fa2a) +- [meta] fix non-updated version number [`3b0e262`](https://github.com/es-shims/String.prototype.trimStart/commit/3b0e262e2f4eeee2e1b99fe890f8ca17bed8f2fd) + +## [v0.1.0](https://github.com/es-shims/String.prototype.trimStart/compare/v0.0.1...v0.1.0) - 2017-12-19 + +### Commits + +- updated README [`ab2f6ac`](https://github.com/es-shims/String.prototype.trimStart/commit/ab2f6ac8813ed336a0f2dc3aa8cdb52f4d52814b) + +## v0.0.1 - 2017-12-19 + +### Commits + +- finished polyfill [`1c7ca20`](https://github.com/es-shims/String.prototype.trimStart/commit/1c7ca2043e3383b6e743870bc622ad4a38477147) +- created README file: [`192ecad`](https://github.com/es-shims/String.prototype.trimStart/commit/192ecaded4e0d5baaa65cd41e590b8d837520d44) +- Initial commit [`14044f8`](https://github.com/es-shims/String.prototype.trimStart/commit/14044f8a0fe1d155fe7403a8327bdbaf135da2d6) +- updated README [`d4fb6be`](https://github.com/es-shims/String.prototype.trimStart/commit/d4fb6be15455dd68fc4b306bee1d30dd4afc96e7) diff --git a/node_modules/string.prototype.trimstart/LICENSE b/node_modules/string.prototype.trimstart/LICENSE new file mode 100644 index 000000000..e48a1b576 --- /dev/null +++ b/node_modules/string.prototype.trimstart/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Khaled Al-Ansari + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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.prototype.trimstart/README.md b/node_modules/string.prototype.trimstart/README.md new file mode 100644 index 000000000..5ec76138e --- /dev/null +++ b/node_modules/string.prototype.trimstart/README.md @@ -0,0 +1,46 @@ +# String.prototype.trimStart [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES2019-spec-compliant `String.prototype.trimStart` shim. Invoke its "shim" method to shim `String.prototype.trimStart` if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. + +Most common usage: +```js +var trimStart = require('string.prototype.trimstart'); + +assert(trimStart(' \t\na \t\n') === 'a \t\n'); + +if (!String.prototype.trimStart) { + trimStart.shim(); +} + +assert(trimStart(' \t\na \t\n') === ' \t\na \t\n'.trimStart()); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/string.prototype.trimstart +[npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimStart.svg +[deps-svg]: https://david-dm.org/es-shims/String.prototype.trimStart.svg +[deps-url]: https://david-dm.org/es-shims/String.prototype.trimStart +[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimStart/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimStart#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/string.prototype.trimstart.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/string.prototype.trimstart.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimstart.svg +[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimstart +[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimStart/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimStart/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trimStart +[actions-url]: https://github.com/es-shims/String.prototype.trimStart/actions diff --git a/node_modules/string.prototype.trimstart/auto.js b/node_modules/string.prototype.trimstart/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/string.prototype.trimstart/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/string.prototype.trimstart/implementation.js b/node_modules/string.prototype.trimstart/implementation.js new file mode 100644 index 000000000..882e7111e --- /dev/null +++ b/node_modules/string.prototype.trimstart/implementation.js @@ -0,0 +1,15 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); +var $replace = callBound('String.prototype.replace'); + +var mvsIsWS = (/^\s$/).test('\u180E'); +/* eslint-disable no-control-regex */ +var startWhitespace = mvsIsWS + ? /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/ + : /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/; +/* eslint-enable no-control-regex */ + +module.exports = function trimStart() { + return $replace(this, startWhitespace, ''); +}; diff --git a/node_modules/string.prototype.trimstart/index.js b/node_modules/string.prototype.trimstart/index.js new file mode 100644 index 000000000..ce41c888c --- /dev/null +++ b/node_modules/string.prototype.trimstart/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var callBind = require('call-bind'); +var define = require('define-properties'); +var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); +var boundMethod = function trim(receiver) { + RequireObjectCoercible(receiver); + return bound(receiver); +}; + +define(boundMethod, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = boundMethod; diff --git a/node_modules/string.prototype.trimstart/package.json b/node_modules/string.prototype.trimstart/package.json new file mode 100644 index 000000000..ceefb8b3f --- /dev/null +++ b/node_modules/string.prototype.trimstart/package.json @@ -0,0 +1,82 @@ +{ + "name": "string.prototype.trimstart", + "version": "1.0.8", + "author": "Jordan Harband ", + "contributors": [ + "Jordan Harband ", + "Khaled Al-Ansari " + ], + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES2019 spec-compliant String.prototype.trimStart shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/es-shims/String.prototype.trimStart.git" + }, + "keywords": [ + "es6", + "es7", + "es8", + "javascript", + "prototype", + "polyfill", + "utility", + "trim", + "trimLeft", + "trimRight", + "trimStart", + "trimEnd", + "tc39" + ], + "devDependencies": { + "@es-shims/api": "^2.4.2", + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/string.prototype.trimstart/polyfill.js b/node_modules/string.prototype.trimstart/polyfill.js new file mode 100644 index 000000000..9adaccd52 --- /dev/null +++ b/node_modules/string.prototype.trimstart/polyfill.js @@ -0,0 +1,15 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + if (!String.prototype.trimStart && !String.prototype.trimLeft) { + return implementation; + } + var zeroWidthSpace = '\u200b'; + var trimmed = zeroWidthSpace.trimStart ? zeroWidthSpace.trimStart() : zeroWidthSpace.trimLeft(); + if (trimmed !== zeroWidthSpace) { + return implementation; + } + return String.prototype.trimStart || String.prototype.trimLeft; +}; diff --git a/node_modules/string.prototype.trimstart/shim.js b/node_modules/string.prototype.trimstart/shim.js new file mode 100644 index 000000000..5ea6dfdcf --- /dev/null +++ b/node_modules/string.prototype.trimstart/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimTrimStart() { + var polyfill = getPolyfill(); + define( + String.prototype, + { trimStart: polyfill }, + { trimStart: function () { return String.prototype.trimStart !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/string.prototype.trimstart/test/implementation.js b/node_modules/string.prototype.trimstart/test/implementation.js new file mode 100644 index 000000000..7fdf95b7d --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimstart/test/index.js b/node_modules/string.prototype.trimstart/test/index.js new file mode 100644 index 000000000..baff6b59b --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var trimStart = require('../'); +var test = require('tape'); + +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { trimStart(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { trimStart(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(trimStart, t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimstart/test/shimmed.js b/node_modules/string.prototype.trimstart/test/shimmed.js new file mode 100644 index 000000000..bfdbe486c --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/shimmed.js @@ -0,0 +1,36 @@ +'use strict'; + +require('../auto'); + +var runTests = require('./tests'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +test('shimmed', function (t) { + t.equal(String.prototype.trimStart.length, 0, 'String#trimStart has a length of 0'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal((/^(?:trimLeft|trimStart)$/).test(String.prototype.trimStart.name), true, 'String#trimStart has name "trimLeft" or "trimStart"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(String.prototype, 'trimStart'), 'String#trimStart is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return String.prototype.trimStart.call(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return String.prototype.trimStart.call(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(String.prototype.trimStart), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimstart/test/tests.js b/node_modules/string.prototype.trimstart/test/tests.js new file mode 100644 index 000000000..526aac144 --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/tests.js @@ -0,0 +1,31 @@ +'use strict'; + +module.exports = function (trimStart, t) { + t.test('normal cases', function (st) { + st.equal(trimStart(' \t\na \t\n'), 'a \t\n', 'strips whitespace off the left side'); + st.equal(trimStart('a'), 'a', 'noop when no whitespace'); + + var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + st.equal(trimStart(allWhitespaceChars + 'a' + allWhitespaceChars), 'a' + allWhitespaceChars, 'all expected whitespace chars are trimmed'); + + st.end(); + }); + + // see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/ + var mongolianVowelSeparator = '\u180E'; + var mvsIsWS = (/^\s$/).test(mongolianVowelSeparator); + t.test('mongolian vowel separator: unicode >= 4 && < 6.3', function (st) { + st.equal( + trimStart(mongolianVowelSeparator + 'a' + mongolianVowelSeparator), + (mvsIsWS ? '' : mongolianVowelSeparator) + 'a' + mongolianVowelSeparator, + 'mongolian vowel separator is ' + (mvsIsWS ? '' : 'not ') + 'whitespace' + ); + st.end(); + }); + + t.test('zero-width spaces', function (st) { + var zeroWidth = '\u200b'; + st.equal(trimStart(zeroWidth), zeroWidth, 'zero width space does not trim'); + st.end(); + }); +}; diff --git a/node_modules/string_decoder/.travis.yml b/node_modules/string_decoder/.travis.yml new file mode 100644 index 000000000..3347a7254 --- /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 000000000..778edb207 --- /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 000000000..5fd58315e --- /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/package.json b/node_modules/string_decoder/package.json new file mode 100644 index 000000000..518c3eb9f --- /dev/null +++ b/node_modules/string_decoder/package.json @@ -0,0 +1,31 @@ +{ + "name": "string_decoder", + "version": "1.1.1", + "description": "The string_decoder module from Node core", + "main": "lib/string_decoder.js", + "dependencies": { + "safe-buffer": "~5.1.0" + }, + "devDependencies": { + "babel-polyfill": "^6.23.0", + "core-util-is": "^1.0.2", + "inherits": "^2.0.3", + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/parallel/*.js && node test/verify-dependencies", + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/string_decoder.git" + }, + "homepage": "https://github.com/nodejs/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT" +} diff --git a/node_modules/strip-ansi/index.d.ts b/node_modules/strip-ansi/index.d.ts new file mode 100644 index 000000000..907fccc29 --- /dev/null +++ b/node_modules/strip-ansi/index.d.ts @@ -0,0 +1,17 @@ +/** +Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. + +@example +``` +import stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` +*/ +declare function stripAnsi(string: string): string; + +export = stripAnsi; diff --git a/node_modules/strip-ansi/index.js b/node_modules/strip-ansi/index.js new file mode 100644 index 000000000..9a593dfcd --- /dev/null +++ b/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/strip-ansi/license b/node_modules/strip-ansi/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/strip-ansi/node_modules/ansi-regex/index.d.ts b/node_modules/strip-ansi/node_modules/ansi-regex/index.d.ts new file mode 100644 index 000000000..2dbf6af2b --- /dev/null +++ b/node_modules/strip-ansi/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import 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'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/node_modules/strip-ansi/node_modules/ansi-regex/index.js new file mode 100644 index 000000000..616ff837d --- /dev/null +++ b/node_modules/strip-ansi/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/strip-ansi/node_modules/ansi-regex/license b/node_modules/strip-ansi/node_modules/ansi-regex/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/strip-ansi/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/node_modules/strip-ansi/node_modules/ansi-regex/package.json new file mode 100644 index 000000000..017f53116 --- /dev/null +++ b/node_modules/strip-ansi/node_modules/ansi-regex/package.json @@ -0,0 +1,55 @@ +{ + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "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" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/node_modules/strip-ansi/node_modules/ansi-regex/readme.md new file mode 100644 index 000000000..4d848bc36 --- /dev/null +++ b/node_modules/strip-ansi/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install 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'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
+Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## 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. 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. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/strip-ansi/package.json b/node_modules/strip-ansi/package.json new file mode 100644 index 000000000..1a41108d4 --- /dev/null +++ b/node_modules/strip-ansi/package.json @@ -0,0 +1,54 @@ +{ + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/strip-ansi/readme.md b/node_modules/strip-ansi/readme.md new file mode 100644 index 000000000..7c4b56d46 --- /dev/null +++ b/node_modules/strip-ansi/readme.md @@ -0,0 +1,46 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string + + +## Install + +``` +$ npm install strip-ansi +``` + + +## Usage + +```js +const stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` + + +## strip-ansi for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of strip-ansi 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-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + diff --git a/node_modules/strip-bom/index.js b/node_modules/strip-bom/index.js new file mode 100644 index 000000000..5695c5c79 --- /dev/null +++ b/node_modules/strip-bom/index.js @@ -0,0 +1,17 @@ +'use strict'; +var isUtf8 = require('is-utf8'); + +module.exports = function (x) { + // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string + // conversion translates it to FEFF (UTF-16 BOM) + if (typeof x === 'string' && x.charCodeAt(0) === 0xFEFF) { + return x.slice(1); + } + + if (Buffer.isBuffer(x) && isUtf8(x) && + x[0] === 0xEF && x[1] === 0xBB && x[2] === 0xBF) { + return x.slice(3); + } + + return x; +}; diff --git a/node_modules/strip-bom/license b/node_modules/strip-bom/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/strip-bom/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-bom/package.json b/node_modules/strip-bom/package.json new file mode 100644 index 000000000..8fe93ea53 --- /dev/null +++ b/node_modules/strip-bom/package.json @@ -0,0 +1,42 @@ +{ + "name": "strip-bom", + "version": "2.0.0", + "description": "Strip UTF-8 byte order mark (BOM) from a string/buffer", + "license": "MIT", + "repository": "sindresorhus/strip-bom", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "bom", + "strip", + "byte", + "mark", + "unicode", + "utf8", + "utf-8", + "remove", + "delete", + "trim", + "text", + "buffer", + "string" + ], + "dependencies": { + "is-utf8": "^0.2.0" + }, + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/strip-bom/readme.md b/node_modules/strip-bom/readme.md new file mode 100644 index 000000000..8ecf258b6 --- /dev/null +++ b/node_modules/strip-bom/readme.md @@ -0,0 +1,39 @@ +# strip-bom [![Build Status](https://travis-ci.org/sindresorhus/strip-bom.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-bom) + +> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string/buffer + +From Wikipedia: + +> The Unicode Standard permits the BOM in UTF-8, but does not require nor recommend its use. Byte order has no meaning in UTF-8. + + +## Install + +``` +$ npm install --save strip-bom +``` + + +## Usage + +```js +var fs = require('fs'); +var stripBom = require('strip-bom'); + +stripBom('\uFEFFunicorn'); +//=> 'unicorn' + +stripBom(fs.readFileSync('unicorn.txt')); +//=> 'unicorn' +``` + + +## Related + +- [strip-bom-cli](https://github.com/sindresorhus/strip-bom-cli) - CLI for this module +- [strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream) - Stream version of this module + + +## 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 000000000..4e6576e6d --- /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 000000000..654d0bfe9 --- /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 000000000..288ecc774 --- /dev/null +++ b/node_modules/strip-json-comments/package.json @@ -0,0 +1,42 @@ +{ + "name": "strip-json-comments", + "version": "2.0.1", + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "license": "MIT", + "repository": "sindresorhus/strip-json-comments", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "json", + "strip", + "remove", + "delete", + "trim", + "comments", + "multiline", + "parse", + "config", + "configuration", + "conf", + "settings", + "util", + "env", + "environment" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/strip-json-comments/readme.md b/node_modules/strip-json-comments/readme.md new file mode 100644 index 000000000..0ee58dfe3 --- /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/structured-source/README.md b/node_modules/structured-source/README.md new file mode 100644 index 000000000..0b4f56d76 --- /dev/null +++ b/node_modules/structured-source/README.md @@ -0,0 +1,66 @@ +StructuredSource +============== + + +## About + +Provides StructuredSource and functionality for converting range and loc vice versa. + +## Installation + +```sh +npm install structured-source +``` + + +## Usage + +```js +const StructuredSource = require('structured-source'); + +let src = new StructuredSource('aaa\u2028aaaa\u2029aaaaa\n'); + +// positionToIndex({ line: number, column: number) -> number +assert(src.positionToIndex({ line: 1, column: 2 }) === 2); + +// indexToPosition(number) -> { line: number, column: number } +assert.deepEqual(src.indexToPosition(2), { line: 1, column: 2 }); + +// rangeToLocation([ number, number ]) -> { start: { line: number, column: number}, end: { line: number, column: number } } +assert.deepEqual(src.rangeToLocation([0, 2]), { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } +}); + +// locationToRange({ start: { line: number, column: number}, end: { line: number, column: number } }) -> [ number, number ] +assert.deepEqual(src.locationToRange({ + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } +}), [0, 2]); +``` + +### License + +Copyright (C) 2012-2014 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 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 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/structured-source/package.json b/node_modules/structured-source/package.json new file mode 100644 index 000000000..b5048b042 --- /dev/null +++ b/node_modules/structured-source/package.json @@ -0,0 +1,56 @@ +{ + "name": "structured-source", + "version": "3.0.2", + "description": "Provides StructuredSource and functionality for converting range and loc vice versa.", + "author": "Yusuke SUZUKI", + "homepage": "https://github.com/Constellation/structured-source", + "repository": { + "type": "git", + "url": "https://github.com/Constellation/structured-source.git" + }, + "main": "lib/index.js", + "maintainers": [ + { + "name": "Yusuke SUZUKI", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "files": [ + "lib" + ], + "scripts": { + "test": "gulp test" + }, + "dependencies": { + "boundary": "^1.0.1" + }, + "devDependencies": { + "gulp": "^3.8.10", + "gulp-6to5": "^1.0.2", + "gulp-bump": "^0.1.11", + "gulp-espower": "^0.10.0", + "gulp-filter": "^2.0.0", + "gulp-git": "^0.5.5", + "gulp-mocha": "^2.0.0", + "gulp-sourcemaps": "^1.2.8", + "gulp-tag-version": "^1.2.1", + "power-assert": "^0.10.0" + }, + "keywords": [ + "location", + "range", + "abstract", + "syntax", + "tree" + ], + "bugs": { + "url": "https://github.com/Constellation/structured-source/issues" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/Constellation/structured-source/raw/master/LICENSE.BSD" + } + ] +} diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js new file mode 100644 index 000000000..4346e272e --- /dev/null +++ b/node_modules/supports-color/index.js @@ -0,0 +1,50 @@ +'use strict'; +var argv = process.argv; + +var terminator = argv.indexOf('--'); +var hasFlag = function (flag) { + flag = '--' + flag; + var pos = argv.indexOf(flag); + return pos !== -1 && (terminator !== -1 ? pos < terminator : true); +}; + +module.exports = (function () { + if ('FORCE_COLOR' in process.env) { + return true; + } + + if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + return false; + } + + if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + return true; + } + + if (process.stdout && !process.stdout.isTTY) { + return false; + } + + if (process.platform === 'win32') { + return true; + } + + if ('COLORTERM' in process.env) { + return true; + } + + if (process.env.TERM === 'dumb') { + return false; + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { + return true; + } + + return false; +})(); diff --git a/node_modules/supports-color/license b/node_modules/supports-color/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/supports-color/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/supports-color/package.json b/node_modules/supports-color/package.json new file mode 100644 index 000000000..3bb77ac1b --- /dev/null +++ b/node_modules/supports-color/package.json @@ -0,0 +1,49 @@ +{ + "name": "supports-color", + "version": "2.0.0", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": "chalk/supports-color", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Appelman (jbnicolai.com)" + ], + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect" + ], + "devDependencies": { + "mocha": "*", + "require-uncached": "^1.0.2" + } +} diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md new file mode 100644 index 000000000..b4761f1ec --- /dev/null +++ b/node_modules/supports-color/readme.md @@ -0,0 +1,36 @@ +# 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 --save supports-color +``` + + +## Usage + +```js +var supportsColor = require('supports-color'); + +if (supportsColor) { + console.log('Terminal supports color'); +} +``` + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. + + +## 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 + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/supports-preserve-symlinks-flag/.eslintrc b/node_modules/supports-preserve-symlinks-flag/.eslintrc new file mode 100644 index 000000000..346ffeca8 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "env": { + "browser": true, + "node": true, + }, + + "rules": { + "id-length": "off", + }, +} diff --git a/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml b/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml new file mode 100644 index 000000000..e8d64f37e --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/supports-preserve-symlink-flag +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/supports-preserve-symlinks-flag/.nycrc b/node_modules/supports-preserve-symlinks-flag/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md b/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md new file mode 100644 index 000000000..61f607f48 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2022-01-02 + +### Commits + +- Tests [`e2f59ad`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/e2f59ad74e2ae0f5f4899fcde6a6f693ab7cc074) +- Initial commit [`dc222aa`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/dc222aad3c0b940d8d3af1ca9937d108bd2dc4b9) +- [meta] do not publish workflow files [`5ef77f7`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/5ef77f7cb6946d16ee38672be9ec0f1bbdf63262) +- npm init [`992b068`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/992b068503a461f7e8676f40ca2aab255fd8d6ff) +- read me [`6c9afa9`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c9afa9fabc8eaf0814aaed6dd01e6df0931b76d) +- Initial implementation [`2f98925`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2f9892546396d4ab0ad9f1ff83e76c3f01234ae8) +- [meta] add `auto-changelog` [`6c476ae`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c476ae1ed7ce68b0480344f090ac2844f35509d) +- [Dev Deps] add `eslint`, `@ljharb/eslint-config` [`d0fffc8`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/d0fffc886d25fba119355520750a909d64da0087) +- Only apps should have lockfiles [`ab318ed`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/ab318ed7ae62f6c2c0e80a50398d40912afd8f69) +- [meta] add `safe-publish-latest` [`2bb23b3`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2bb23b3ebab02dc4135c4cdf0217db82835b9fca) +- [meta] add `sideEffects` flag [`600223b`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/600223ba24f30779f209d9097721eff35ed62741) diff --git a/node_modules/supports-preserve-symlinks-flag/LICENSE b/node_modules/supports-preserve-symlinks-flag/LICENSE new file mode 100644 index 000000000..2e7b9a3ea --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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-preserve-symlinks-flag/README.md b/node_modules/supports-preserve-symlinks-flag/README.md new file mode 100644 index 000000000..eb05b124c --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/README.md @@ -0,0 +1,42 @@ +# node-supports-preserve-symlinks-flag [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Determine if the current node version supports the `--preserve-symlinks` flag. + +## Example + +```js +var supportsPreserveSymlinks = require('node-supports-preserve-symlinks-flag'); +var assert = require('assert'); + +assert.equal(supportsPreserveSymlinks, null); // in a browser +assert.equal(supportsPreserveSymlinks, false); // in node < v6.2 +assert.equal(supportsPreserveSymlinks, true); // in node v6.2+ +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/node-supports-preserve-symlinks-flag +[npm-version-svg]: https://versionbadg.es/inspect-js/node-supports-preserve-symlinks-flag.svg +[deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag.svg +[deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag +[dev-deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/node-supports-preserve-symlinks-flag.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/node-supports-preserve-symlinks-flag.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/node-supports-preserve-symlinks-flag.svg +[downloads-url]: https://npm-stat.com/charts.html?package=node-supports-preserve-symlinks-flag +[codecov-image]: https://codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/node-supports-preserve-symlinks-flag +[actions-url]: https://github.com/inspect-js/node-supports-preserve-symlinks-flag/actions diff --git a/node_modules/supports-preserve-symlinks-flag/browser.js b/node_modules/supports-preserve-symlinks-flag/browser.js new file mode 100644 index 000000000..087be1fe9 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/browser.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = null; diff --git a/node_modules/supports-preserve-symlinks-flag/index.js b/node_modules/supports-preserve-symlinks-flag/index.js new file mode 100644 index 000000000..86fd5d331 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/index.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = ( +// node 12+ + process.allowedNodeEnvironmentFlags && process.allowedNodeEnvironmentFlags.has('--preserve-symlinks') +) || ( +// node v6.2 - v11 + String(module.constructor._findPath).indexOf('preserveSymlinks') >= 0 // eslint-disable-line no-underscore-dangle +); diff --git a/node_modules/supports-preserve-symlinks-flag/package.json b/node_modules/supports-preserve-symlinks-flag/package.json new file mode 100644 index 000000000..56edadcaa --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/package.json @@ -0,0 +1,70 @@ +{ + "name": "supports-preserve-symlinks-flag", + "version": "1.0.0", + "description": "Determine if the current node version supports the `--preserve-symlinks` flag.", + "main": "./index.js", + "browser": "./browser.js", + "exports": { + ".": [ + { + "browser": "./browser.js", + "default": "./index.js" + }, + "./index.js" + ], + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/node-supports-preserve-symlinks-flag.git" + }, + "keywords": [ + "node", + "flag", + "symlink", + "symlinks", + "preserve-symlinks" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag/issues" + }, + "homepage": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.1.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^8.6.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tape": "^5.4.0" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/supports-preserve-symlinks-flag/test/index.js b/node_modules/supports-preserve-symlinks-flag/test/index.js new file mode 100644 index 000000000..9938d6716 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/test/index.js @@ -0,0 +1,29 @@ +'use strict'; + +var test = require('tape'); +var semver = require('semver'); + +var supportsPreserveSymlinks = require('../'); +var browser = require('../browser'); + +test('supportsPreserveSymlinks', function (t) { + t.equal(typeof supportsPreserveSymlinks, 'boolean', 'is a boolean'); + + t.equal(browser, null, 'browser file is `null`'); + t.equal( + supportsPreserveSymlinks, + null, + 'in a browser, is null', + { skip: typeof window === 'undefined' } + ); + + var expected = semver.satisfies(process.version, '>= 6.2'); + t.equal( + supportsPreserveSymlinks, + expected, + 'is true in node v6.2+, false otherwise (actual: ' + supportsPreserveSymlinks + ', expected ' + expected + ')', + { skip: typeof window !== 'undefined' } + ); + + t.end(); +}); diff --git a/node_modules/table/LICENSE b/node_modules/table/LICENSE new file mode 100644 index 000000000..7e84ea3af --- /dev/null +++ b/node_modules/table/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2016, Gajus Kuizinas (http://gajus.com/) +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 the Gajus Kuizinas (http://gajus.com/) 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 ANUARY 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/table/README.md b/node_modules/table/README.md new file mode 100644 index 000000000..2b5669755 --- /dev/null +++ b/node_modules/table/README.md @@ -0,0 +1,652 @@ +

Table

+ +[![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat)](https://travis-ci.org/gajus/table) +[![NPM version](http://img.shields.io/npm/v/table.svg?style=flat)](https://www.npmjs.com/package/table) +[![js-canonical-style](https://img.shields.io/badge/code%20style-canonical-brightgreen.svg?style=flat)](https://github.com/gajus/canonical) + +* [Table](#table) + * [Features](#table-features) + * [Usage](#table-usage) + * [Cell Content Alignment](#table-usage-cell-content-alignment) + * [Column Width](#table-usage-column-width) + * [Custom Border](#table-usage-custom-border) + * [Draw Horizontal Line](#table-usage-draw-horizontal-line) + * [Padding Cell Content](#table-usage-padding-cell-content) + * [Predefined Border Templates](#table-usage-predefined-border-templates) + * [Streaming](#table-usage-streaming) + * [Text Truncation](#table-usage-text-truncation) + * [Text Wrapping](#table-usage-text-wrapping) + + +Produces a string that represents array data in a text table. + +![Demo of table displaying a list of missions to the Moon.](./.README/demo.png) + +

Features

+ +* Works with strings containing [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) characters. +* Works with strings containing [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). +* Configurable border characters. +* Configurable content alignment per column. +* Configurable content padding per column. +* Configurable column width. +* Text wrapping. + +

Usage

+ +Table data is described using an array (rows) of array (cells). + +```js +import table from 'table'; + +let data, + output; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] +]; + +/** + * @typedef {string} table~cell + */ + +/** + * @typedef {table~cell[]} table~row + */ + +/** + * @typedef {Object} table~columns + * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left). + * @property {number} width Column width (default: auto). + * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity). + * @property {number} paddingLeft Cell content padding width left (default: 1). + * @property {number} paddingRight Cell content padding width right (default: 1). + */ + +/** + * @typedef {Object} table~border + * @property {string} topBody + * @property {string} topJoin + * @property {string} topLeft + * @property {string} topRight + * @property {string} bottomBody + * @property {string} bottomJoin + * @property {string} bottomLeft + * @property {string} bottomRight + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + * @property {string} joinBody + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinJoin + */ + +/** + * Used to dynamically tell table whether to draw a line separating rows or not. + * The default behavior is to always return true. + * + * @typedef {function} drawJoin + * @param {number} index + * @param {number} size + * @return {boolean} + */ + +/** + * @typedef {Object} table~config + * @property {table~border} border + * @property {table~columns[]} columns Column specific configuration. + * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values. + * @property {table~drawJoin} drawHorizontalLine + */ + +/** + * Generates a text table. + * + * @param {table~row[]} rows + * @param {table~config} config + * @return {String} + */ +output = table(data); + +console.log(output); +``` + +``` +╔════╤════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────┼────╢ +║ 1A │ 1B │ 1C ║ +╟────┼────┼────╢ +║ 2A │ 2B │ 2C ║ +╚════╧════╧════╝ +``` + + +

Cell Content Alignment

+ +`{string} config.columns[{number}].alignment` property controls content horizontal alignment within a cell. + +Valid values are: "left", "right" and "center". + +```js +let config, + data, + output; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] +]; + +config = { + columns: { + 0: { + alignment: 'left', + minWidth: 10 + }, + 1: { + alignment: 'center', + minWidth: 10 + }, + 2: { + alignment: 'right', + minWidth: 10 + } + } +}; + +output = table(data, config); + +console.log(output); +``` + +``` +╔════════════╤════════════╤════════════╗ +║ 0A │ 0B │ 0C ║ +╟────────────┼────────────┼────────────╢ +║ 1A │ 1B │ 1C ║ +╟────────────┼────────────┼────────────╢ +║ 2A │ 2B │ 2C ║ +╚════════════╧════════════╧════════════╝ +``` + +

Column Width

+ +`{number} config.columns[{number}].width` property restricts column width to a fixed width. + +```js +let data, + output, + options; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] +]; + +options = { + columns: { + 1: { + width: 10 + } + } +}; + +output = table(data, options); + +console.log(output); +``` + +``` +╔════╤════════════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────────────┼────╢ +║ 1A │ 1B │ 1C ║ +╟────┼────────────┼────╢ +║ 2A │ 2B │ 2C ║ +╚════╧════════════╧════╝ +``` + +

Custom Border

+ +`{object} config.border` property describes characters used to draw the table border. + +```js +let config, + data, + output; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] +]; + +config = { + border: { + topBody: `─`, + topJoin: `┬`, + topLeft: `┌`, + topRight: `┐`, + + bottomBody: `─`, + bottomJoin: `┴`, + bottomLeft: `└`, + bottomRight: `┘`, + + bodyLeft: `│`, + bodyRight: `│`, + bodyJoin: `│`, + + joinBody: `─`, + joinLeft: `├`, + joinRight: `┤`, + joinJoin: `┼` + } +}; + +output = table(data, config); + +console.log(output); +``` + +``` +┌────┬────┬────┐ +│ 0A │ 0B │ 0C │ +├────┼────┼────┤ +│ 1A │ 1B │ 1C │ +├────┼────┼────┤ +│ 2A │ 2B │ 2C │ +└────┴────┴────┘ +``` + +

Draw Horizontal Line

+ +`{function} config.drawHorizontalLine` property is a function that is called for every non-content row in the table. The result of the function `{boolean}` determines whether a row is drawn. + +```js +let data, + output, + options; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'], + ['3A', '3B', '3C'], + ['4A', '4B', '4C'] +]; + +options = { + /** + * @typedef {function} drawJoin + * @param {number} index + * @param {number} size + * @return {boolean} + */ + drawHorizontalLine: (index, size) => { + return index === 0 || index === 1 || index === size - 1 || index === size; + } +}; + +output = table(data, options); + +console.log(output); +``` + +``` +╔════╤════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────┼────╢ +║ 1A │ 1B │ 1C ║ +║ 2A │ 2B │ 2C ║ +║ 3A │ 3B │ 3C ║ +╟────┼────┼────╢ +║ 4A │ 4B │ 4C ║ +╚════╧════╧════╝ +``` + +

Padding Cell Content

+ +`{number} config.columns[{number}].paddingLeft` and `{number} config.columns[{number}].paddingRight` properties control content padding within a cell. Property value represents a number of whitespaces used to pad the content. + +```js +let config, + data, + output; + +data = [ + ['0A', 'AABBCC', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] +]; + +config = { + columns: { + 0: { + paddingLeft: 3 + }, + 1: { + width: 2, + paddingRight: 3 + } + } +}; + +output = table(data, config); + +console.log(output); +``` + +``` +╔══════╤══════╤════╗ +║ 0A │ AA │ 0C ║ +║ │ BB │ ║ +║ │ CC │ ║ +╟──────┼──────┼────╢ +║ 1A │ 1B │ 1C ║ +╟──────┼──────┼────╢ +║ 2A │ 2B │ 2C ║ +╚══════╧══════╧════╝ +``` + +

Predefined Border Templates

+ +You can load one of the predefined border templates using `getBorderCharacters` function. + +```js +import table, { + getBorderCharacters +} from 'table'; + +let config, + data; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] +]; + +config = { + border: getBorderCharacters(`name of the template`) +}; + +table(data, config); +``` + +``` +# honeywell + +╔════╤════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────┼────╢ +║ 1A │ 1B │ 1C ║ +╟────┼────┼────╢ +║ 2A │ 2B │ 2C ║ +╚════╧════╧════╝ + +# norc + +┌────┬────┬────┐ +│ 0A │ 0B │ 0C │ +├────┼────┼────┤ +│ 1A │ 1B │ 1C │ +├────┼────┼────┤ +│ 2A │ 2B │ 2C │ +└────┴────┴────┘ + +# ramac (ASCII; for use in terminals that do not support Unicode characters) + ++----+----+----+ +| 0A | 0B | 0C | +|----|----|----| +| 1A | 1B | 1C | +|----|----|----| +| 2A | 2B | 2C | ++----+----+----+ + +# void (no borders; see "bordless table" section of the documentation) + + 0A 0B 0C + + 1A 1B 1C + + 2A 2B 2C + +``` + +Raise [an issue](https://github.com/gajus/table/issues) if you'd like to contribute a new border template. + +

Borderless Table

+ +Simply using "void" border character template creates a table with a lot of unnecessary spacing. + +To create a more plesant to the eye table, reset the padding and remove the joining rows, e.g. + +```js +let output; + +output = table(data, { + border: getBorderCharacters(`void`), + columnDefault: { + paddingLeft: 0, + paddingRight: 1 + }, + drawJoin: () => { + return false + } +}); + +console.log(output); +``` + +``` +0A 0B 0C +1A 1B 1C +2A 2B 2C +``` + +

Streaming

+ +`table` package exports `createStream` function used to draw a table and append rows. + +`createStream` requires `{number} columnDefault.width` and `{number} columnCount` configuration properties. + +```js +import { + createStream +} from 'table'; + +let config, + stream; + +config = { + columnDefault: { + width: 50 + }, + columnCount: 1 +}; + +stream = createStream(config); + +setInterval(() => { + stream.write([new Date()]); +}, 500); +``` + +![Streaming current date.](./.README/streaming.gif) + +`table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed. + +The underlying implementation is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691). + +Streaming supports all of the configuration properties and functionality of a static table (such as auto text wrapping, alignment and padding), e.g. + +```js +import { + createStream +} from 'table'; + +import _ from 'lodash'; + +let config, + stream, + i; + +config = { + columnDefault: { + width: 50 + }, + columnCount: 3, + columns: { + 0: { + width: 10, + alignment: 'right' + }, + 1: { + alignment: 'center', + }, + 2: { + width: 10 + } + } +}; + +stream = createStream(config); + +i = 0; + +setInterval(() => { + let random; + + random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join(''); + + stream.write([i++, new Date(), random]); +}, 500); +``` + +![Streaming random data.](./.README/streaming-random.gif) +

Text Truncation

+ +To handle a content that overflows the container width, `table` package implements [text wrapping](#table-usage-text-wrapping). However, sometimes you may want to truncate content that is too long to be displayed in the table. + +`{number} config.columns[{number}].truncate` property (default: `Infinity`) truncates the text at the specified length. + +```js +let config, + data, + output; + +data = [ + ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.'] +]; + +config = { + columns: { + 0: { + width: 20, + truncate: 100 + } + } +}; + +output = table(data, config); + +console.log(output); +``` + +``` +╔══════════════════════╗ +║ Lorem ipsum dolor si ║ +║ t amet, consectetur ║ +║ adipiscing elit. Pha ║ +║ sellus pulvinar nibh ║ +║ sed mauris conva... ║ +╚══════════════════════╝ +``` + +

Text Wrapping

+ +`table` package implements auto text wrapping, i.e. text that has width greater than the container width will be separated into multiple lines, e.g. + +```js +let config, + data, + output; + +data = [ + ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.'] +]; + +config = { + columns: { + 0: { + width: 20 + } + } +}; + +output = table(data, config); + +console.log(output); +``` + +``` +╔══════════════════════╗ +║ Lorem ipsum dolor si ║ +║ t amet, consectetur ║ +║ adipiscing elit. Pha ║ +║ sellus pulvinar nibh ║ +║ sed mauris convallis ║ +║ dapibus. Nunc venena ║ +║ tis tempus nulla sit ║ +║ amet viverra. ║ +╚══════════════════════╝ +``` + +When `wrapWord` is `true` the text is broken at the nearest space or one of the special characters ("-", "_", "\", "/", ".", ",", ";"), e.g. + +```js +let config, + data, + output; + +data = [ + ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.'] +]; + +config = { + columns: { + 0: { + width: 20, + wrapWord: true + } + } +}; + +output = table(data, config); + +console.log(output); +``` + +``` +╔══════════════════════╗ +║ Lorem ipsum dolor ║ +║ sit amet, ║ +║ consectetur ║ +║ adipiscing elit. ║ +║ Phasellus pulvinar ║ +║ nibh sed mauris ║ +║ convallis dapibus. ║ +║ Nunc venenatis ║ +║ tempus nulla sit ║ +║ amet viverra. ║ +╚══════════════════════╝ +``` + diff --git a/node_modules/table/dist/alignString.js b/node_modules/table/dist/alignString.js new file mode 100644 index 000000000..73e613765 --- /dev/null +++ b/node_modules/table/dist/alignString.js @@ -0,0 +1,108 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _stringWidth = require('string-width'); + +var _stringWidth2 = _interopRequireDefault(_stringWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const alignments = ['left', 'right', 'center']; + +/** + * @param {string} subject + * @param {number} width + * @returns {string} + */ +const alignLeft = (subject, width) => { + return subject + _lodash2.default.repeat(' ', width); +}; + +/** + * @param {string} subject + * @param {number} width + * @returns {string} + */ +const alignRight = (subject, width) => { + return _lodash2.default.repeat(' ', width) + subject; +}; + +/** + * @param {string} subject + * @param {number} width + * @returns {string} + */ +const alignCenter = (subject, width) => { + let halfWidth; + + halfWidth = width / 2; + + if (halfWidth % 2 === 0) { + return _lodash2.default.repeat(' ', halfWidth) + subject + _lodash2.default.repeat(' ', halfWidth); + } else { + halfWidth = _lodash2.default.floor(halfWidth); + + return _lodash2.default.repeat(' ', halfWidth) + subject + _lodash2.default.repeat(' ', halfWidth + 1); + } +}; + +/** + * Pads a string to the left and/or right to position the subject + * text in a desired alignment within a container. + * + * @param {string} subject + * @param {number} containerWidth + * @param {string} alignment One of the valid options (left, right, center). + * @returns {string} + */ + +exports.default = (subject, containerWidth, alignment) => { + if (!_lodash2.default.isString(subject)) { + throw new Error('Subject parameter value must be a string.'); + } + + if (!_lodash2.default.isNumber(containerWidth)) { + throw new Error('Container width parameter value must be a number.'); + } + + const subjectWidth = (0, _stringWidth2.default)(subject); + + if (subjectWidth > containerWidth) { + // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject); + + throw new Error('Subject parameter value width cannot be greater than the container width.'); + } + + if (!_lodash2.default.isString(alignment)) { + throw new Error('Alignment parameter value must be a string.'); + } + + if (alignments.indexOf(alignment) === -1) { + throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).'); + } + + if (subjectWidth === 0) { + return _lodash2.default.repeat(' ', containerWidth); + } + + const availableWidth = containerWidth - subjectWidth; + + if (alignment === 'left') { + return alignLeft(subject, availableWidth); + } + + if (alignment === 'right') { + return alignRight(subject, availableWidth); + } + + return alignCenter(subject, availableWidth); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/alignTableData.js b/node_modules/table/dist/alignTableData.js new file mode 100644 index 000000000..5d390b946 --- /dev/null +++ b/node_modules/table/dist/alignTableData.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _stringWidth = require('string-width'); + +var _stringWidth2 = _interopRequireDefault(_stringWidth); + +var _alignString = require('./alignString'); + +var _alignString2 = _interopRequireDefault(_alignString); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {table~row[]} rows + * @param {Object} config + * @returns {table~row[]} + */ +exports.default = (rows, config) => { + return _lodash2.default.map(rows, cells => { + return _lodash2.default.map(cells, (value, index1) => { + const column = config.columns[index1]; + + if ((0, _stringWidth2.default)(value) === column.width) { + return value; + } else { + return (0, _alignString2.default)(value, column.width, column.alignment); + } + }); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/calculateCellHeight.js b/node_modules/table/dist/calculateCellHeight.js new file mode 100644 index 000000000..b5ec6998d --- /dev/null +++ b/node_modules/table/dist/calculateCellHeight.js @@ -0,0 +1,49 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _stringWidth = require('string-width'); + +var _stringWidth2 = _interopRequireDefault(_stringWidth); + +var _wrapWord = require('./wrapWord'); + +var _wrapWord2 = _interopRequireDefault(_wrapWord); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {string} value + * @param {number} columnWidth + * @param {boolean} useWrapWord + * @returns {number} + */ +exports.default = function (value, columnWidth) { + let useWrapWord = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + if (!_lodash2.default.isString(value)) { + throw new Error('Value must be a string.'); + } + + if (!_lodash2.default.isInteger(columnWidth)) { + throw new Error('Column width must be an integer.'); + } + + if (columnWidth < 1) { + throw new Error('Column width must be greater than 0.'); + } + + if (useWrapWord) { + return (0, _wrapWord2.default)(value, columnWidth).length; + } + + return _lodash2.default.ceil((0, _stringWidth2.default)(value) / columnWidth); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/calculateCellWidthIndex.js b/node_modules/table/dist/calculateCellWidthIndex.js new file mode 100644 index 000000000..bc6c0a307 --- /dev/null +++ b/node_modules/table/dist/calculateCellWidthIndex.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _stringWidth = require('string-width'); + +var _stringWidth2 = _interopRequireDefault(_stringWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Calculates width of each cell contents. + * + * @param {string[]} cells + * @returns {number[]} + */ +exports.default = cells => { + return _lodash2.default.map(cells, value => { + return (0, _stringWidth2.default)(value); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/calculateMaximumColumnWidthIndex.js b/node_modules/table/dist/calculateMaximumColumnWidthIndex.js new file mode 100644 index 000000000..062ca45f3 --- /dev/null +++ b/node_modules/table/dist/calculateMaximumColumnWidthIndex.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _calculateCellWidthIndex = require('./calculateCellWidthIndex'); + +var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Produces an array of values that describe the largest value length (width) in every column. + * + * @param {Array[]} rows + * @returns {number[]} + */ +exports.default = rows => { + if (!rows[0]) { + throw new Error('Dataset must have at least one row.'); + } + + const columns = _lodash2.default.fill(Array(rows[0].length), 0); + + _lodash2.default.forEach(rows, row => { + const columnWidthIndex = (0, _calculateCellWidthIndex2.default)(row); + + _lodash2.default.forEach(columnWidthIndex, (valueWidth, index0) => { + if (columns[index0] < valueWidth) { + columns[index0] = valueWidth; + } + }); + }); + + return columns; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/calculateRowHeightIndex.js b/node_modules/table/dist/calculateRowHeightIndex.js new file mode 100644 index 000000000..b9eaf60e0 --- /dev/null +++ b/node_modules/table/dist/calculateRowHeightIndex.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _calculateCellHeight = require('./calculateCellHeight'); + +var _calculateCellHeight2 = _interopRequireDefault(_calculateCellHeight); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Calculates the vertical row span index. + * + * @param {Array[]} rows + * @param {Object} config + * @returns {number[]} + */ +exports.default = (rows, config) => { + const tableWidth = rows[0].length; + + const rowSpanIndex = []; + + _lodash2.default.forEach(rows, cells => { + const cellHeightIndex = _lodash2.default.fill(Array(tableWidth), 1); + + _lodash2.default.forEach(cells, (value, index1) => { + if (!_lodash2.default.isNumber(config.columns[index1].width)) { + throw new Error('column[index].width must be a number.'); + } + + if (!_lodash2.default.isBoolean(config.columns[index1].wrapWord)) { + throw new Error('column[index].wrapWord must be a boolean.'); + } + + cellHeightIndex[index1] = (0, _calculateCellHeight2.default)(value, config.columns[index1].width, config.columns[index1].wrapWord); + }); + + rowSpanIndex.push(_lodash2.default.max(cellHeightIndex)); + }); + + return rowSpanIndex; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/createStream.js b/node_modules/table/dist/createStream.js new file mode 100644 index 000000000..f9c3df503 --- /dev/null +++ b/node_modules/table/dist/createStream.js @@ -0,0 +1,159 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _makeStreamConfig = require('./makeStreamConfig'); + +var _makeStreamConfig2 = _interopRequireDefault(_makeStreamConfig); + +var _drawRow = require('./drawRow'); + +var _drawRow2 = _interopRequireDefault(_drawRow); + +var _drawBorder = require('./drawBorder'); + +var _stringifyTableData = require('./stringifyTableData'); + +var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData); + +var _truncateTableData = require('./truncateTableData'); + +var _truncateTableData2 = _interopRequireDefault(_truncateTableData); + +var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex'); + +var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex); + +var _alignTableData = require('./alignTableData'); + +var _alignTableData2 = _interopRequireDefault(_alignTableData); + +var _padTableData = require('./padTableData'); + +var _padTableData2 = _interopRequireDefault(_padTableData); + +var _calculateRowHeightIndex = require('./calculateRowHeightIndex'); + +var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {Array} data + * @param {Object} config + * @returns {Array} + */ +const prepareData = (data, config) => { + let rows; + + rows = (0, _stringifyTableData2.default)(data); + + rows = (0, _truncateTableData2.default)(data, config); + + const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config); + + rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config); + rows = (0, _alignTableData2.default)(rows, config); + rows = (0, _padTableData2.default)(rows, config); + + return rows; +}; + +/** + * @param {string[]} row + * @param {number[]} columnWidthIndex + * @param {Object} config + * @returns {undefined} + */ +const create = (row, columnWidthIndex, config) => { + const rows = prepareData([row], config); + + const body = _lodash2.default.map(rows, literalRow => { + return (0, _drawRow2.default)(literalRow, config.border); + }).join(''); + + let output; + + output = ''; + + output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config.border); + output += body; + output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border); + + output = _lodash2.default.trimEnd(output); + + process.stdout.write(output); +}; + +/** + * @param {string[]} row + * @param {number[]} columnWidthIndex + * @param {Object} config + * @returns {undefined} + */ +const append = (row, columnWidthIndex, config) => { + const rows = prepareData([row], config); + + const body = _lodash2.default.map(rows, literalRow => { + return (0, _drawRow2.default)(literalRow, config.border); + }).join(''); + + let output; + + output = '\r\x1b[K'; + + output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border); + output += body; + output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border); + + output = _lodash2.default.trimEnd(output); + + process.stdout.write(output); +}; + +/** + * @param {Object} userConfig + * @returns {Object} + */ + +exports.default = function () { + let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + const config = (0, _makeStreamConfig2.default)(userConfig); + + const columnWidthIndex = _lodash2.default.mapValues(config.columns, column => { + return column.width + column.paddingLeft + column.paddingRight; + }); + + let empty; + + empty = true; + + return { + /** + * @param {string[]} row + * @returns {undefined} + */ + write: row => { + if (row.length !== config.columnCount) { + throw new Error('Row cell count does not match the config.columnCount.'); + } + + if (empty) { + empty = false; + + return create(row, columnWidthIndex, config); + } else { + return append(row, columnWidthIndex, config); + } + } + }; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/drawBorder.js b/node_modules/table/dist/drawBorder.js new file mode 100644 index 000000000..aeb2b719f --- /dev/null +++ b/node_modules/table/dist/drawBorder.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = undefined; + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @typedef drawBorder~parts + * @property {string} left + * @property {string} right + * @property {string} body + * @property {string} join + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorder~parts} parts + * @returns {string} + */ +const drawBorder = (columnSizeIndex, parts) => { + const columns = _lodash2.default.map(columnSizeIndex, size => { + return _lodash2.default.repeat(parts.body, size); + }).join(parts.join); + + return parts.left + columns + parts.right + '\n'; +}; + +/** + * @typedef drawBorderTop~parts + * @property {string} topLeft + * @property {string} topRight + * @property {string} topBody + * @property {string} topJoin + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorderTop~parts} parts + * @returns {string} + */ +const drawBorderTop = (columnSizeIndex, parts) => { + return drawBorder(columnSizeIndex, { + body: parts.topBody, + join: parts.topJoin, + left: parts.topLeft, + right: parts.topRight + }); +}; + +/** + * @typedef drawBorderJoin~parts + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinBody + * @property {string} joinJoin + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorderJoin~parts} parts + * @returns {string} + */ +const drawBorderJoin = (columnSizeIndex, parts) => { + return drawBorder(columnSizeIndex, { + body: parts.joinBody, + join: parts.joinJoin, + left: parts.joinLeft, + right: parts.joinRight + }); +}; + +/** + * @typedef drawBorderBottom~parts + * @property {string} topLeft + * @property {string} topRight + * @property {string} topBody + * @property {string} topJoin + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorderBottom~parts} parts + * @returns {string} + */ +const drawBorderBottom = (columnSizeIndex, parts) => { + return drawBorder(columnSizeIndex, { + body: parts.bottomBody, + join: parts.bottomJoin, + left: parts.bottomLeft, + right: parts.bottomRight + }); +}; + +exports.drawBorder = drawBorder; +exports.drawBorderBottom = drawBorderBottom; +exports.drawBorderJoin = drawBorderJoin; +exports.drawBorderTop = drawBorderTop; \ No newline at end of file diff --git a/node_modules/table/dist/drawRow.js b/node_modules/table/dist/drawRow.js new file mode 100644 index 000000000..8e75bc2c3 --- /dev/null +++ b/node_modules/table/dist/drawRow.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +/** + * @typedef {Object} drawRow~border + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + */ + +/** + * @param {number[]} columns + * @param {drawRow~border} border + * @returns {string} + */ +exports.default = (columns, border) => { + return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n'; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/drawTable.js b/node_modules/table/dist/drawTable.js new file mode 100644 index 000000000..12b6a75ab --- /dev/null +++ b/node_modules/table/dist/drawTable.js @@ -0,0 +1,63 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _drawBorder = require('./drawBorder'); + +var _drawRow = require('./drawRow'); + +var _drawRow2 = _interopRequireDefault(_drawRow); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {Array} rows + * @param {Object} border + * @param {Array} columnSizeIndex + * @param {Array} rowSpanIndex + * @param {Function} drawHorizontalLine + * @returns {string} + */ +exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => { + let output, realRowIndex, rowHeight; + + const rowCount = rows.length; + + realRowIndex = 0; + + output = ''; + + if (drawHorizontalLine(realRowIndex, rowCount)) { + output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border); + } + + _lodash2.default.forEach(rows, (row, index0) => { + output += (0, _drawRow2.default)(row, border); + + if (!rowHeight) { + rowHeight = rowSpanIndex[realRowIndex]; + + realRowIndex++; + } + + rowHeight--; + + if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) { + output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border); + } + }); + + if (drawHorizontalLine(realRowIndex, rowCount)) { + output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, border); + } + + return output; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/getBorderCharacters.js b/node_modules/table/dist/getBorderCharacters.js new file mode 100644 index 000000000..21f4eb13a --- /dev/null +++ b/node_modules/table/dist/getBorderCharacters.js @@ -0,0 +1,128 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +/* eslint-disable sort-keys */ + +/** + * @typedef border + * @property {string} topBody + * @property {string} topJoin + * @property {string} topLeft + * @property {string} topRight + * @property {string} bottomBody + * @property {string} bottomJoin + * @property {string} bottomLeft + * @property {string} bottomRight + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + * @property {string} joinBody + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinJoin + */ + +/** + * @param {string} name + * @returns {border} + */ +exports.default = name => { + if (name === 'honeywell') { + return { + topBody: '═', + topJoin: '╤', + topLeft: '╔', + topRight: '╗', + + bottomBody: '═', + bottomJoin: '╧', + bottomLeft: '╚', + bottomRight: '╝', + + bodyLeft: '║', + bodyRight: '║', + bodyJoin: '│', + + joinBody: '─', + joinLeft: '╟', + joinRight: '╢', + joinJoin: '┼' + }; + } + + if (name === 'norc') { + return { + topBody: '─', + topJoin: '┬', + topLeft: '┌', + topRight: '┐', + + bottomBody: '─', + bottomJoin: '┴', + bottomLeft: '└', + bottomRight: '┘', + + bodyLeft: '│', + bodyRight: '│', + bodyJoin: '│', + + joinBody: '─', + joinLeft: '├', + joinRight: '┤', + joinJoin: '┼' + }; + } + + if (name === 'ramac') { + return { + topBody: '-', + topJoin: '+', + topLeft: '+', + topRight: '+', + + bottomBody: '-', + bottomJoin: '+', + bottomLeft: '+', + bottomRight: '+', + + bodyLeft: '|', + bodyRight: '|', + bodyJoin: '|', + + joinBody: '-', + joinLeft: '|', + joinRight: '|', + joinJoin: '|' + }; + } + + if (name === 'void') { + return { + topBody: '', + topJoin: '', + topLeft: '', + topRight: '', + + bottomBody: '', + bottomJoin: '', + bottomLeft: '', + bottomRight: '', + + bodyLeft: '', + bodyRight: '', + bodyJoin: '', + + joinBody: '', + joinLeft: '', + joinRight: '', + joinJoin: '' + }; + } + + throw new Error('Unknown border template "' + name + '".'); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/index.js b/node_modules/table/dist/index.js new file mode 100644 index 000000000..f937e069a --- /dev/null +++ b/node_modules/table/dist/index.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getBorderCharacters = exports.createStream = undefined; + +var _table = require('./table'); + +var _table2 = _interopRequireDefault(_table); + +var _createStream = require('./createStream'); + +var _createStream2 = _interopRequireDefault(_createStream); + +var _getBorderCharacters = require('./getBorderCharacters'); + +var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.createStream = _createStream2.default; +exports.getBorderCharacters = _getBorderCharacters2.default; +exports.default = _table2.default; \ No newline at end of file diff --git a/node_modules/table/dist/makeConfig.js b/node_modules/table/dist/makeConfig.js new file mode 100644 index 000000000..45ad8e899 --- /dev/null +++ b/node_modules/table/dist/makeConfig.js @@ -0,0 +1,101 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _getBorderCharacters = require('./getBorderCharacters'); + +var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters); + +var _validateConfig = require('./validateConfig'); + +var _validateConfig2 = _interopRequireDefault(_validateConfig); + +var _calculateMaximumColumnWidthIndex = require('./calculateMaximumColumnWidthIndex'); + +var _calculateMaximumColumnWidthIndex2 = _interopRequireDefault(_calculateMaximumColumnWidthIndex); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Merges user provided border characters with the default border ("honeywell") characters. + * + * @param {Object} border + * @returns {Object} + */ +const makeBorder = function makeBorder() { + let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border); +}; + +/** + * Creates a configuration for every column using default + * values for the missing configuration properties. + * + * @param {Array[]} rows + * @param {Object} columns + * @param {Object} columnDefault + * @returns {Object} + */ +const makeColumns = function makeColumns(rows) { + let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex2.default)(rows); + + _lodash2.default.times(rows[0].length, index => { + if (_lodash2.default.isUndefined(columns[index])) { + columns[index] = {}; + } + + columns[index] = _lodash2.default.assign({ + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Infinity, + width: maximumColumnWidthIndex[index], + wrapWord: false + }, columnDefault, columns[index]); + }); + + return columns; +}; + +/** + * Makes a new configuration object out of the userConfig object + * using default values for the missing configuration properties. + * + * @param {Array[]} rows + * @param {Object} userConfig + * @returns {Object} + */ + +exports.default = function (rows) { + let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + (0, _validateConfig2.default)('config.json', userConfig); + + const config = _lodash2.default.cloneDeep(userConfig); + + config.border = makeBorder(config.border); + config.columns = makeColumns(rows, config.columns, config.columnDefault); + + if (!config.drawHorizontalLine) { + /** + * @returns {boolean} + */ + config.drawHorizontalLine = () => { + return true; + }; + } + + return config; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/makeStreamConfig.js b/node_modules/table/dist/makeStreamConfig.js new file mode 100644 index 000000000..1482dae07 --- /dev/null +++ b/node_modules/table/dist/makeStreamConfig.js @@ -0,0 +1,109 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _getBorderCharacters = require('./getBorderCharacters'); + +var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters); + +var _validateConfig = require('./validateConfig'); + +var _validateConfig2 = _interopRequireDefault(_validateConfig); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Merges user provided border characters with the default border ("honeywell") characters. + * + * @param {Object} border + * @returns {Object} + */ +const makeBorder = function makeBorder() { + let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border); +}; + +/** + * Creates a configuration for every column using default + * values for the missing configuration properties. + * + * @param {number} columnCount + * @param {Object} columns + * @param {Object} columnDefault + * @returns {Object} + */ +const makeColumns = function makeColumns(columnCount) { + let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + _lodash2.default.times(columnCount, index => { + if (_lodash2.default.isUndefined(columns[index])) { + columns[index] = {}; + } + + columns[index] = _lodash2.default.assign({ + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Infinity, + wrapWord: false + }, columnDefault, columns[index]); + }); + + return columns; +}; + +/** + * @typedef {Object} columnConfig + * @property {string} alignment + * @property {number} width + * @property {number} truncate + * @property {number} paddingLeft + * @property {number} paddingRight + */ + +/** + * @typedef {Object} streamConfig + * @property {columnConfig} columnDefault + * @property {Object} border + * @property {columnConfig[]} + * @property {number} columnCount Number of columns in the table (required). + */ + +/** + * Makes a new configuration object out of the userConfig object + * using default values for the missing configuration properties. + * + * @param {streamConfig} userConfig + * @returns {Object} + */ + +exports.default = function () { + let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + (0, _validateConfig2.default)('streamConfig.json', userConfig); + + const config = _lodash2.default.cloneDeep(userConfig); + + if (!config.columnDefault || !config.columnDefault.width) { + throw new Error('Must provide config.columnDefault.width when creating a stream.'); + } + + if (!config.columnCount) { + throw new Error('Must provide config.columnCount.'); + } + + config.border = makeBorder(config.border); + config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault); + + return config; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/mapDataUsingRowHeightIndex.js b/node_modules/table/dist/mapDataUsingRowHeightIndex.js new file mode 100644 index 000000000..fb1c09199 --- /dev/null +++ b/node_modules/table/dist/mapDataUsingRowHeightIndex.js @@ -0,0 +1,59 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _wrapString = require('./wrapString'); + +var _wrapString2 = _interopRequireDefault(_wrapString); + +var _wrapWord = require('./wrapWord'); + +var _wrapWord2 = _interopRequireDefault(_wrapWord); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {Array} unmappedRows + * @param {number[]} rowHeightIndex + * @param {Object} config + * @returns {Array} + */ +exports.default = (unmappedRows, rowHeightIndex, config) => { + const tableWidth = unmappedRows[0].length; + + const mappedRows = _lodash2.default.map(unmappedRows, (cells, index0) => { + const rowHeight = _lodash2.default.times(rowHeightIndex[index0], () => { + return _lodash2.default.fill(Array(tableWidth), ''); + }); + + // rowHeight + // [{row index within rowSaw; index2}] + // [{cell index within a virtual row; index1}] + + _lodash2.default.forEach(cells, (value, index1) => { + let chunkedValue; + + if (config.columns[index1].wrapWord) { + chunkedValue = (0, _wrapWord2.default)(value, config.columns[index1].width); + } else { + chunkedValue = (0, _wrapString2.default)(value, config.columns[index1].width); + } + + _lodash2.default.forEach(chunkedValue, (part, index2) => { + rowHeight[index2][index1] = part; + }); + }); + + return rowHeight; + }); + + return _lodash2.default.flatten(mappedRows); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/padTableData.js b/node_modules/table/dist/padTableData.js new file mode 100644 index 000000000..5132421eb --- /dev/null +++ b/node_modules/table/dist/padTableData.js @@ -0,0 +1,28 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {table~row[]} rows + * @param {Object} config + * @returns {table~row[]} + */ +exports.default = (rows, config) => { + return _lodash2.default.map(rows, cells => { + return _lodash2.default.map(cells, (value, index1) => { + const column = config.columns[index1]; + + return _lodash2.default.repeat(' ', column.paddingLeft) + value + _lodash2.default.repeat(' ', column.paddingRight); + }); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/schemas/config.json b/node_modules/table/dist/schemas/config.json new file mode 100644 index 000000000..c71fed55a --- /dev/null +++ b/node_modules/table/dist/schemas/config.json @@ -0,0 +1,114 @@ +{ + "id": "config.json", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "#/definitions/borders" + }, + "columns": { + "$ref": "#/definitions/columns" + }, + "columnDefault": { + "$ref": "#/definitions/column" + }, + "drawHorizontalLine": { + "typeof": "function" + } + }, + "additionalProperties": false, + "definitions": { + "columns": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, + "column": { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": [ + "left", + "right", + "center" + ] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }, + "borders": { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }, + "border": { + "type": "string" + } + } +} diff --git a/node_modules/table/dist/schemas/streamConfig.json b/node_modules/table/dist/schemas/streamConfig.json new file mode 100644 index 000000000..878f3fc90 --- /dev/null +++ b/node_modules/table/dist/schemas/streamConfig.json @@ -0,0 +1,114 @@ +{ + "id": "streamConfig.json", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "#/definitions/borders" + }, + "columns": { + "$ref": "#/definitions/columns" + }, + "columnDefault": { + "$ref": "#/definitions/column" + }, + "columnCount": { + "type": "number" + } + }, + "additionalProperties": false, + "definitions": { + "columns": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, + "column": { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": [ + "left", + "right", + "center" + ] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }, + "borders": { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }, + "border": { + "type": "string" + } + } +} diff --git a/node_modules/table/dist/stringifyTableData.js b/node_modules/table/dist/stringifyTableData.js new file mode 100644 index 000000000..2600f9512 --- /dev/null +++ b/node_modules/table/dist/stringifyTableData.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Casts all cell values to a string. + * + * @param {table~row[]} rows + * @returns {table~row[]} + */ +exports.default = rows => { + return _lodash2.default.map(rows, cells => { + return _lodash2.default.map(cells, String); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/table.js b/node_modules/table/dist/table.js new file mode 100644 index 000000000..b62ffd2b7 --- /dev/null +++ b/node_modules/table/dist/table.js @@ -0,0 +1,135 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _drawTable = require('./drawTable'); + +var _drawTable2 = _interopRequireDefault(_drawTable); + +var _calculateCellWidthIndex = require('./calculateCellWidthIndex'); + +var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex); + +var _makeConfig = require('./makeConfig'); + +var _makeConfig2 = _interopRequireDefault(_makeConfig); + +var _calculateRowHeightIndex = require('./calculateRowHeightIndex'); + +var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex); + +var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex'); + +var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex); + +var _alignTableData = require('./alignTableData'); + +var _alignTableData2 = _interopRequireDefault(_alignTableData); + +var _padTableData = require('./padTableData'); + +var _padTableData2 = _interopRequireDefault(_padTableData); + +var _validateTableData = require('./validateTableData'); + +var _validateTableData2 = _interopRequireDefault(_validateTableData); + +var _stringifyTableData = require('./stringifyTableData'); + +var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData); + +var _truncateTableData = require('./truncateTableData'); + +var _truncateTableData2 = _interopRequireDefault(_truncateTableData); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @typedef {string} table~cell + */ + +/** + * @typedef {table~cell[]} table~row + */ + +/** + * @typedef {Object} table~columns + * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left). + * @property {number} width Column width (default: auto). + * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity). + * @property {number} paddingLeft Cell content padding width left (default: 1). + * @property {number} paddingRight Cell content padding width right (default: 1). + */ + +/** + * @typedef {Object} table~border + * @property {string} topBody + * @property {string} topJoin + * @property {string} topLeft + * @property {string} topRight + * @property {string} bottomBody + * @property {string} bottomJoin + * @property {string} bottomLeft + * @property {string} bottomRight + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + * @property {string} joinBody + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinJoin + */ + +/** + * Used to tell whether to draw a horizontal line. + * This callback is called for each non-content line of the table. + * The default behavior is to always return true. + * + * @typedef {Function} drawHorizontalLine + * @param {number} index + * @param {number} size + * @returns {boolean} + */ + +/** + * @typedef {Object} table~config + * @property {table~border} border + * @property {table~columns[]} columns Column specific configuration. + * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values. + * @property {table~drawHorizontalLine} drawHorizontalLine + */ + +/** + * Generates a text table. + * + * @param {table~row[]} data + * @param {table~config} userConfig + * @returns {string} + */ +exports.default = function (data) { + let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let rows; + + (0, _validateTableData2.default)(data); + + rows = (0, _stringifyTableData2.default)(data); + + const config = (0, _makeConfig2.default)(rows, userConfig); + + rows = (0, _truncateTableData2.default)(data, config); + + const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config); + + rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config); + rows = (0, _alignTableData2.default)(rows, config); + rows = (0, _padTableData2.default)(rows, config); + + const cellWidthIndex = (0, _calculateCellWidthIndex2.default)(rows[0]); + + return (0, _drawTable2.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/truncateTableData.js b/node_modules/table/dist/truncateTableData.js new file mode 100644 index 000000000..4bc197dd0 --- /dev/null +++ b/node_modules/table/dist/truncateTableData.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @todo Make it work with ASCII content. + * @param {table~row[]} rows + * @param {Object} config + * @returns {table~row[]} + */ +exports.default = (rows, config) => { + return _lodash2.default.map(rows, cells => { + return _lodash2.default.map(cells, (content, index) => { + return _lodash2.default.truncate(content, { + length: config.columns[index].truncate + }); + }); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/validateConfig.js b/node_modules/table/dist/validateConfig.js new file mode 100644 index 000000000..caba30134 --- /dev/null +++ b/node_modules/table/dist/validateConfig.js @@ -0,0 +1,756 @@ +'use strict'; +var equal = require('ajv/lib/compile/equal'); +var validate = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + var refVal = []; + var refVal1 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || validate.schema.properties[key0]); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + if (data.topBody !== undefined) { + var errs_1 = errors; + if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) { + if (vErrors === null) vErrors = refVal2.errors; + else vErrors = vErrors.concat(refVal2.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.topJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.topLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.topRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomBody !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bodyLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bodyRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bodyJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinBody !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal1.schema = { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }; + refVal1.errors = null; + refVal[1] = refVal1; + var refVal2 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if (typeof data !== "string") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'string' + }, + message: 'should be string' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal2.schema = { + "type": "string" + }; + refVal2.errors = null; + refVal[2] = refVal2; + var refVal3 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || pattern0.test(key0)); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + for (var key0 in data) { + if (pattern0.test(key0)) { + var errs_1 = errors; + if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) { + if (vErrors === null) vErrors = refVal4.errors; + else vErrors = vErrors.concat(refVal4.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal3.schema = { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }; + refVal3.errors = null; + refVal[3] = refVal3; + var refVal4 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || validate.schema.properties[key0]); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + var data1 = data.alignment; + if (data1 !== undefined) { + var errs_1 = errors; + var schema1 = validate.schema.properties.alignment.enum; + var valid1; + valid1 = false; + for (var i1 = 0; i1 < schema1.length; i1++) + if (equal(data1, schema1[i1])) { + valid1 = true; + break; + } + if (!valid1) { + var err = { + keyword: 'enum', + dataPath: (dataPath || '') + '.alignment', + schemaPath: '#/properties/alignment/enum', + params: { + allowedValues: schema1 + }, + message: 'should be equal to one of the allowed values' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + if (typeof data1 !== "string") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.alignment', + schemaPath: '#/properties/alignment/type', + params: { + type: 'string' + }, + message: 'should be string' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.width !== undefined) { + var errs_1 = errors; + if (typeof data.width !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.width', + schemaPath: '#/properties/width/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.wrapWord !== undefined) { + var errs_1 = errors; + if (typeof data.wrapWord !== "boolean") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.wrapWord', + schemaPath: '#/properties/wrapWord/type', + params: { + type: 'boolean' + }, + message: 'should be boolean' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.truncate !== undefined) { + var errs_1 = errors; + if (typeof data.truncate !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.truncate', + schemaPath: '#/properties/truncate/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.paddingLeft !== undefined) { + var errs_1 = errors; + if (typeof data.paddingLeft !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.paddingLeft', + schemaPath: '#/properties/paddingLeft/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.paddingRight !== undefined) { + var errs_1 = errors; + if (typeof data.paddingRight !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.paddingRight', + schemaPath: '#/properties/paddingRight/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal4.schema = { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": ["left", "right", "center"] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }; + refVal4.errors = null; + refVal[4] = refVal4; + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine'); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + if (data.border !== undefined) { + var errs_1 = errors; + if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) { + if (vErrors === null) vErrors = refVal1.errors; + else vErrors = vErrors.concat(refVal1.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.columns !== undefined) { + var errs_1 = errors; + if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) { + if (vErrors === null) vErrors = refVal3.errors; + else vErrors = vErrors.concat(refVal3.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.columnDefault !== undefined) { + var errs_1 = errors; + if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) { + if (vErrors === null) vErrors = refVal[4].errors; + else vErrors = vErrors.concat(refVal[4].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.drawHorizontalLine !== undefined) { + var errs_1 = errors; + var errs__1 = errors; + var valid1; + if (!(typeof data.drawHorizontalLine == "function")) { + if (errs__1 == errors) { + var err = { + keyword: 'typeof', + dataPath: (dataPath || '') + '.drawHorizontalLine', + schemaPath: '#/properties/drawHorizontalLine/typeof', + params: { + keyword: 'typeof' + }, + message: 'should pass "typeof" keyword validation' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } else { + for (var i1 = errs__1; i1 < errors; i1++) { + var ruleErr1 = vErrors[i1]; + if (ruleErr1.dataPath === undefined) { + ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine'; + } + if (ruleErr1.schemaPath === undefined) { + ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof"; + } + } + } + } + var valid1 = errors === errs_1; + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; +})(); +validate.schema = { + "id": "config.json", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "#/definitions/borders" + }, + "columns": { + "$ref": "#/definitions/columns" + }, + "columnDefault": { + "$ref": "#/definitions/column" + }, + "drawHorizontalLine": { + "typeof": "function" + } + }, + "additionalProperties": false, + "definitions": { + "columns": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, + "column": { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": ["left", "right", "center"] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }, + "borders": { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }, + "border": { + "type": "string" + } + } +}; +validate.errors = null; +module.exports = validate; \ No newline at end of file diff --git a/node_modules/table/dist/validateStreamConfig.js b/node_modules/table/dist/validateStreamConfig.js new file mode 100644 index 000000000..09ea2aac9 --- /dev/null +++ b/node_modules/table/dist/validateStreamConfig.js @@ -0,0 +1,742 @@ +'use strict'; +var equal = require('ajv/lib/compile/equal'); +var validate = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + var refVal = []; + var refVal1 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || validate.schema.properties[key0]); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + if (data.topBody !== undefined) { + var errs_1 = errors; + if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) { + if (vErrors === null) vErrors = refVal2.errors; + else vErrors = vErrors.concat(refVal2.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.topJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.topLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.topRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomBody !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bottomRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bodyLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bodyRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.bodyJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinBody !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinLeft !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinRight !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.joinJoin !== undefined) { + var errs_1 = errors; + if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) { + if (vErrors === null) vErrors = refVal[2].errors; + else vErrors = vErrors.concat(refVal[2].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal1.schema = { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }; + refVal1.errors = null; + refVal[1] = refVal1; + var refVal2 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if (typeof data !== "string") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'string' + }, + message: 'should be string' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal2.schema = { + "type": "string" + }; + refVal2.errors = null; + refVal[2] = refVal2; + var refVal3 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || pattern0.test(key0)); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + for (var key0 in data) { + if (pattern0.test(key0)) { + var errs_1 = errors; + if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) { + if (vErrors === null) vErrors = refVal4.errors; + else vErrors = vErrors.concat(refVal4.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal3.schema = { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }; + refVal3.errors = null; + refVal[3] = refVal3; + var refVal4 = (function() { + var pattern0 = new RegExp('^[0-9]+$'); + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || validate.schema.properties[key0]); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + var data1 = data.alignment; + if (data1 !== undefined) { + var errs_1 = errors; + var schema1 = validate.schema.properties.alignment.enum; + var valid1; + valid1 = false; + for (var i1 = 0; i1 < schema1.length; i1++) + if (equal(data1, schema1[i1])) { + valid1 = true; + break; + } + if (!valid1) { + var err = { + keyword: 'enum', + dataPath: (dataPath || '') + '.alignment', + schemaPath: '#/properties/alignment/enum', + params: { + allowedValues: schema1 + }, + message: 'should be equal to one of the allowed values' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + if (typeof data1 !== "string") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.alignment', + schemaPath: '#/properties/alignment/type', + params: { + type: 'string' + }, + message: 'should be string' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.width !== undefined) { + var errs_1 = errors; + if (typeof data.width !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.width', + schemaPath: '#/properties/width/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.wrapWord !== undefined) { + var errs_1 = errors; + if (typeof data.wrapWord !== "boolean") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.wrapWord', + schemaPath: '#/properties/wrapWord/type', + params: { + type: 'boolean' + }, + message: 'should be boolean' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.truncate !== undefined) { + var errs_1 = errors; + if (typeof data.truncate !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.truncate', + schemaPath: '#/properties/truncate/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.paddingLeft !== undefined) { + var errs_1 = errors; + if (typeof data.paddingLeft !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.paddingLeft', + schemaPath: '#/properties/paddingLeft/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + if (data.paddingRight !== undefined) { + var errs_1 = errors; + if (typeof data.paddingRight !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.paddingRight', + schemaPath: '#/properties/paddingRight/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; + })(); + refVal4.schema = { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": ["left", "right", "center"] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }; + refVal4.errors = null; + refVal[4] = refVal4; + return function validate(data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + var vErrors = null; + var errors = 0; + if (rootData === undefined) rootData = data; + if ((data && typeof data === "object" && !Array.isArray(data))) { + var errs__0 = errors; + var valid1 = true; + for (var key0 in data) { + var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'columnCount'); + if (isAdditional0) { + valid1 = false; + var err = { + keyword: 'additionalProperties', + dataPath: (dataPath || '') + "", + schemaPath: '#/additionalProperties', + params: { + additionalProperty: '' + key0 + '' + }, + message: 'should NOT have additional properties' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + } + if (data.border !== undefined) { + var errs_1 = errors; + if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) { + if (vErrors === null) vErrors = refVal1.errors; + else vErrors = vErrors.concat(refVal1.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.columns !== undefined) { + var errs_1 = errors; + if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) { + if (vErrors === null) vErrors = refVal3.errors; + else vErrors = vErrors.concat(refVal3.errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.columnDefault !== undefined) { + var errs_1 = errors; + if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) { + if (vErrors === null) vErrors = refVal[4].errors; + else vErrors = vErrors.concat(refVal[4].errors); + errors = vErrors.length; + } + var valid1 = errors === errs_1; + } + if (data.columnCount !== undefined) { + var errs_1 = errors; + if (typeof data.columnCount !== "number") { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + '.columnCount', + schemaPath: '#/properties/columnCount/type', + params: { + type: 'number' + }, + message: 'should be number' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + var valid1 = errors === errs_1; + } + } else { + var err = { + keyword: 'type', + dataPath: (dataPath || '') + "", + schemaPath: '#/type', + params: { + type: 'object' + }, + message: 'should be object' + }; + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; + } + validate.errors = vErrors; + return errors === 0; + }; +})(); +validate.schema = { + "id": "streamConfig.json", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "#/definitions/borders" + }, + "columns": { + "$ref": "#/definitions/columns" + }, + "columnDefault": { + "$ref": "#/definitions/column" + }, + "columnCount": { + "type": "number" + } + }, + "additionalProperties": false, + "definitions": { + "columns": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, + "column": { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": ["left", "right", "center"] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }, + "borders": { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }, + "border": { + "type": "string" + } + } +}; +validate.errors = null; +module.exports = validate; \ No newline at end of file diff --git a/node_modules/table/dist/validateTableData.js b/node_modules/table/dist/validateTableData.js new file mode 100644 index 000000000..4f71f39a5 --- /dev/null +++ b/node_modules/table/dist/validateTableData.js @@ -0,0 +1,59 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @typedef {string} cell + */ + +/** + * @typedef {cell[]} validateData~column + */ + +/** + * @param {column[]} rows + * @returns {undefined} + */ +exports.default = rows => { + if (!_lodash2.default.isArray(rows)) { + throw new Error('Table data must be an array.'); + } + + if (rows.length === 0) { + throw new Error('Table must define at least one row.'); + } + + if (rows[0].length === 0) { + throw new Error('Table must define at least one column.'); + } + + const columnNumber = rows[0].length; + + _lodash2.default.forEach(rows, cells => { + if (!_lodash2.default.isArray(cells)) { + throw new Error('Table row data must be an array.'); + } + + if (cells.length !== columnNumber) { + throw new Error('Table must have a consistent number of cells.'); + } + + // @todo Make an exception for newline characters. + // @see https://github.com/gajus/table/issues/9 + _lodash2.default.forEach(cells, cell => { + if (/[\x01-\x1A]/.test(cell)) { + throw new Error('Table data must not contain control characters.'); + } + }); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/wrapString.js b/node_modules/table/dist/wrapString.js new file mode 100644 index 000000000..d51184558 --- /dev/null +++ b/node_modules/table/dist/wrapString.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _sliceAnsi = require('slice-ansi'); + +var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi); + +var _stringWidth = require('string-width'); + +var _stringWidth2 = _interopRequireDefault(_stringWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Creates an array of strings split into groups the length of size. + * This function works with strings that contain ASCII characters. + * + * wrapText is different from would-be "chunk" implementation + * in that whitespace characters that occur on a chunk size limit are trimmed. + * + * @param {string} subject + * @param {number} size + * @returns {Array} + */ +exports.default = (subject, size) => { + let subjectSlice; + + subjectSlice = subject; + + const chunks = []; + + do { + chunks.push((0, _sliceAnsi2.default)(subjectSlice, 0, size)); + + subjectSlice = _lodash2.default.trim((0, _sliceAnsi2.default)(subjectSlice, size)); + } while ((0, _stringWidth2.default)(subjectSlice)); + + return chunks; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/dist/wrapWord.js b/node_modules/table/dist/wrapWord.js new file mode 100644 index 000000000..f994f96e7 --- /dev/null +++ b/node_modules/table/dist/wrapWord.js @@ -0,0 +1,58 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _sliceAnsi = require('slice-ansi'); + +var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi); + +var _stringWidth = require('string-width'); + +var _stringWidth2 = _interopRequireDefault(_stringWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @param {string} input + * @param {number} size + * @returns {Array} + */ +exports.default = (input, size) => { + let subject; + + subject = input; + + const chunks = []; + + // https://regex101.com/r/gY5kZ1/1 + const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))'); + + do { + let chunk; + + chunk = subject.match(re); + + if (chunk) { + chunk = chunk[0]; + + subject = (0, _sliceAnsi2.default)(subject, (0, _stringWidth2.default)(chunk)); + + chunk = _lodash2.default.trim(chunk); + } else { + chunk = (0, _sliceAnsi2.default)(subject, 0, size); + subject = (0, _sliceAnsi2.default)(subject, size); + } + + chunks.push(chunk); + } while ((0, _stringWidth2.default)(subject)); + + return chunks; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/table/node_modules/ansi-regex/index.js b/node_modules/table/node_modules/ansi-regex/index.js new file mode 100644 index 000000000..93f162cc4 --- /dev/null +++ b/node_modules/table/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = () => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[a-zA-Z\\d]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, 'g'); +}; diff --git a/node_modules/table/node_modules/ansi-regex/license b/node_modules/table/node_modules/ansi-regex/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/table/node_modules/ansi-regex/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/table/node_modules/ansi-regex/package.json b/node_modules/table/node_modules/ansi-regex/package.json new file mode 100644 index 000000000..05486190a --- /dev/null +++ b/node_modules/table/node_modules/ansi-regex/package.json @@ -0,0 +1,53 @@ +{ + "name": "ansi-regex", + "version": "3.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js" + ], + "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" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/table/node_modules/ansi-regex/readme.md b/node_modules/table/node_modules/ansi-regex/readme.md new file mode 100644 index 000000000..22db1c340 --- /dev/null +++ b/node_modules/table/node_modules/ansi-regex/readme.md @@ -0,0 +1,46 @@ +# 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](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install 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. 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. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +## License + +MIT diff --git a/node_modules/table/node_modules/is-fullwidth-code-point/index.js b/node_modules/table/node_modules/is-fullwidth-code-point/index.js new file mode 100644 index 000000000..d506327c3 --- /dev/null +++ b/node_modules/table/node_modules/is-fullwidth-code-point/index.js @@ -0,0 +1,46 @@ +'use strict'; +/* eslint-disable yoda */ +module.exports = x => { + if (Number.isNaN(x)) { + return false; + } + + // code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + x >= 0x1100 && ( + x <= 0x115f || // Hangul Jamo + x === 0x2329 || // LEFT-POINTING ANGLE BRACKET + x === 0x232a || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= x && x <= 0x4dbf) || + // CJK Unified Ideographs .. Yi Radicals + (0x4e00 <= x && x <= 0xa4c6) || + // Hangul Jamo Extended-A + (0xa960 <= x && x <= 0xa97c) || + // Hangul Syllables + (0xac00 <= x && x <= 0xd7a3) || + // CJK Compatibility Ideographs + (0xf900 <= x && x <= 0xfaff) || + // Vertical Forms + (0xfe10 <= x && x <= 0xfe19) || + // CJK Compatibility Forms .. Small Form Variants + (0xfe30 <= x && x <= 0xfe6b) || + // Halfwidth and Fullwidth Forms + (0xff01 <= x && x <= 0xff60) || + (0xffe0 <= x && x <= 0xffe6) || + // Kana Supplement + (0x1b000 <= x && x <= 0x1b001) || + // Enclosed Ideographic Supplement + (0x1f200 <= x && x <= 0x1f251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= x && x <= 0x3fffd) + ) + ) { + return true; + } + + return false; +}; diff --git a/node_modules/table/node_modules/is-fullwidth-code-point/license b/node_modules/table/node_modules/is-fullwidth-code-point/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/table/node_modules/is-fullwidth-code-point/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/table/node_modules/is-fullwidth-code-point/package.json b/node_modules/table/node_modules/is-fullwidth-code-point/package.json new file mode 100644 index 000000000..3049d9e03 --- /dev/null +++ b/node_modules/table/node_modules/is-fullwidth-code-point/package.json @@ -0,0 +1,45 @@ +{ + "name": "is-fullwidth-code-point", + "version": "2.0.0", + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "license": "MIT", + "repository": "sindresorhus/is-fullwidth-code-point", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "char", + "string", + "str", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/table/node_modules/is-fullwidth-code-point/readme.md b/node_modules/table/node_modules/is-fullwidth-code-point/readme.md new file mode 100644 index 000000000..093b0281b --- /dev/null +++ b/node_modules/table/node_modules/is-fullwidth-code-point/readme.md @@ -0,0 +1,39 @@ +# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) + +> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) + + +## Install + +``` +$ npm install --save is-fullwidth-code-point +``` + + +## Usage + +```js +const isFullwidthCodePoint = require('is-fullwidth-code-point'); + +isFullwidthCodePoint('谢'.codePointAt()); +//=> true + +isFullwidthCodePoint('a'.codePointAt()); +//=> false +``` + + +## API + +### isFullwidthCodePoint(input) + +#### input + +Type: `number` + +[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/table/node_modules/string-width/index.js b/node_modules/table/node_modules/string-width/index.js new file mode 100644 index 000000000..bbc49d29b --- /dev/null +++ b/node_modules/table/node_modules/string-width/index.js @@ -0,0 +1,36 @@ +'use strict'; +const stripAnsi = require('strip-ansi'); +const isFullwidthCodePoint = require('is-fullwidth-code-point'); + +module.exports = str => { + if (typeof str !== 'string' || str.length === 0) { + return 0; + } + + str = stripAnsi(str); + + let width = 0; + + for (let i = 0; i < str.length; i++) { + const code = str.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; diff --git a/node_modules/table/node_modules/string-width/license b/node_modules/table/node_modules/string-width/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/table/node_modules/string-width/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/table/node_modules/string-width/package.json b/node_modules/table/node_modules/string-width/package.json new file mode 100644 index 000000000..89f0b6a6c --- /dev/null +++ b/node_modules/table/node_modules/string-width/package.json @@ -0,0 +1,55 @@ +{ + "name": "string-width", + "version": "2.1.1", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "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" + ], + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/table/node_modules/string-width/readme.md b/node_modules/table/node_modules/string-width/readme.md new file mode 100644 index 000000000..df5b7199f --- /dev/null +++ b/node_modules/table/node_modules/string-width/readme.md @@ -0,0 +1,42 @@ +# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) + +> Get the visual width of a string - the number of columns required to display it + +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + +Useful to be able to measure the actual width of command-line output. + + +## Install + +``` +$ npm install string-width +``` + + +## Usage + +```js +const stringWidth = require('string-width'); + +stringWidth('古'); +//=> 2 + +stringWidth('\u001b[1m古\u001b[22m'); +//=> 2 + +stringWidth('a'); +//=> 1 +``` + + +## Related + +- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module +- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string +- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/table/node_modules/strip-ansi/index.js b/node_modules/table/node_modules/strip-ansi/index.js new file mode 100644 index 000000000..96e0292c8 --- /dev/null +++ b/node_modules/table/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; diff --git a/node_modules/table/node_modules/strip-ansi/license b/node_modules/table/node_modules/strip-ansi/license new file mode 100644 index 000000000..e7af2f771 --- /dev/null +++ b/node_modules/table/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/table/node_modules/strip-ansi/package.json b/node_modules/table/node_modules/strip-ansi/package.json new file mode 100644 index 000000000..555f19461 --- /dev/null +++ b/node_modules/table/node_modules/strip-ansi/package.json @@ -0,0 +1,52 @@ +{ + "name": "strip-ansi", + "version": "4.0.0", + "description": "Strip ANSI escape codes", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/table/node_modules/strip-ansi/readme.md b/node_modules/table/node_modules/strip-ansi/readme.md new file mode 100644 index 000000000..dc76f0cb1 --- /dev/null +++ b/node_modules/table/node_modules/strip-ansi/readme.md @@ -0,0 +1,39 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install strip-ansi +``` + + +## Usage + +```js +const stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' +``` + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +## License + +MIT diff --git a/node_modules/table/package.json b/node_modules/table/package.json new file mode 100644 index 000000000..d53b6e599 --- /dev/null +++ b/node_modules/table/package.json @@ -0,0 +1,69 @@ +{ + "author": { + "email": "gajus@gajus.com", + "name": "Gajus Kuizinas", + "url": "http://gajus.com" + }, + "dependencies": { + "ajv": "^4.7.0", + "ajv-keywords": "^1.0.0", + "chalk": "^1.1.1", + "lodash": "^4.0.0", + "slice-ansi": "0.0.4", + "string-width": "^2.0.0" + }, + "description": "Formats data into a string table.", + "devDependencies": { + "ajv-cli": "^1.1.0", + "babel": "^6.5.2", + "babel-cli": "^6.14.0", + "babel-core": "^6.14.0", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-istanbul": "^2.0.3", + "babel-preset-es2015-node4": "^2.1.0", + "babel-register": "^6.14.0", + "chai": "^3.4.1", + "eslint": "^3.5.0", + "eslint-config-canonical": "^1.8.6", + "gitdown": "^2.4.0", + "husky": "^0.11.7", + "mocha": "^3.0.2", + "nyc": "^8.3.1", + "sinon": "^1.17.2" + }, + "keywords": [ + "ascii", + "text", + "table", + "align", + "ansi" + ], + "license": "BSD-3-Clause", + "main": "./dist/index.js", + "name": "table", + "nyc": { + "include": [ + "src/*.js" + ], + "instrument": false, + "lines": 70, + "require": [ + "babel-register" + ], + "sourceMap": false + }, + "repository": { + "type": "git", + "url": "https://github.com/gajus/table" + }, + "scripts": { + "build": "rm -fr ./dist && babel --copy-files ./src --out-dir ./dist && npm run make-validators", + "lint": "npm run build && eslint ./src ./tests", + "make-readme": "gitdown ./.README/README.md --output-file ./README.md", + "make-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js", + "precommit": "npm run lint && npm run test", + "prepublish": "NODE_ENV=production npm run build", + "test": "npm run build && nyc --check-coverage mocha" + }, + "version": "3.8.3" +} diff --git a/node_modules/table/test/README/usage/basic.js b/node_modules/table/test/README/usage/basic.js new file mode 100644 index 000000000..1ce78ebcb --- /dev/null +++ b/node_modules/table/test/README/usage/basic.js @@ -0,0 +1,25 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('basic', () => { + const data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] + ]; + + const output = table(data); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔════╤════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────┼────╢ +║ 1A │ 1B │ 1C ║ +╟────┼────┼────╢ +║ 2A │ 2B │ 2C ║ +╚════╧════╧════╝ + `); + }); +}); diff --git a/node_modules/table/test/README/usage/cell_content_alignment.js b/node_modules/table/test/README/usage/cell_content_alignment.js new file mode 100644 index 000000000..b687599b3 --- /dev/null +++ b/node_modules/table/test/README/usage/cell_content_alignment.js @@ -0,0 +1,45 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('cell_content_alignment', () => { + const data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] + ]; + + const config = { + columns: { + 0: { + alignment: 'left', + width: 10 + }, + 1: { + alignment: 'center', + width: 10 + }, + 2: { + alignment: 'right', + width: 10 + } + } + }; + + const output = table(data, config); + + // console.log(output); + + /* eslint-disable no-restricted-syntax */ + expectTable(output, ` +╔════════════╤════════════╤════════════╗ +║ 0A │ 0B │ 0C ║ +╟────────────┼────────────┼────────────╢ +║ 1A │ 1B │ 1C ║ +╟────────────┼────────────┼────────────╢ +║ 2A │ 2B │ 2C ║ +╚════════════╧════════════╧════════════╝ + `); + /* eslint-enable no-restricted-syntax */ + }); +}); diff --git a/node_modules/table/test/README/usage/column_width.js b/node_modules/table/test/README/usage/column_width.js new file mode 100644 index 000000000..698b4aa66 --- /dev/null +++ b/node_modules/table/test/README/usage/column_width.js @@ -0,0 +1,33 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('column_width', () => { + const data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] + ]; + + const config = { + columns: { + 1: { + width: 10 + } + } + }; + + const output = table(data, config); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔════╤════════════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────────────┼────╢ +║ 1A │ 1B │ 1C ║ +╟────┼────────────┼────╢ +║ 2A │ 2B │ 2C ║ +╚════╧════════════╧════╝ + `); + }); +}); diff --git a/node_modules/table/test/README/usage/custom_border.js b/node_modules/table/test/README/usage/custom_border.js new file mode 100644 index 000000000..2ce22abc8 --- /dev/null +++ b/node_modules/table/test/README/usage/custom_border.js @@ -0,0 +1,50 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('usage/custom_border', () => { + const data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] + ]; + + /* eslint-disable sort-keys */ + const config = { + border: { + topBody: '─', + topJoin: '┬', + topLeft: '┌', + topRight: '┐', + + bottomBody: '─', + bottomJoin: '┴', + bottomLeft: '└', + bottomRight: '┘', + + bodyLeft: '│', + bodyRight: '│', + bodyJoin: '│', + + joinBody: '─', + joinLeft: '├', + joinRight: '┤', + joinJoin: '┼' + } + }; + /* eslint-enable */ + + const output = table(data, config); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +┌────┬────┬────┐ +│ 0A │ 0B │ 0C │ +├────┼────┼────┤ +│ 1A │ 1B │ 1C │ +├────┼────┼────┤ +│ 2A │ 2B │ 2C │ +└────┴────┴────┘ + `); + }); +}); diff --git a/node_modules/table/test/README/usage/draw_horizontal_line.js b/node_modules/table/test/README/usage/draw_horizontal_line.js new file mode 100644 index 000000000..621081bbf --- /dev/null +++ b/node_modules/table/test/README/usage/draw_horizontal_line.js @@ -0,0 +1,41 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('usage/draw_horizontal_line', () => { + const data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'], + ['3A', '3B', '3C'], + ['4A', '4B', '4C'] + ]; + + const options = { + /** + * @typedef {Function} drawJoin + * @param {number} index + * @param {number} size + * @returns {boolean} + */ + drawHorizontalLine: (index, size) => { + return index === 0 || index === 1 || index === size - 1 || index === size; + } + }; + + const output = table(data, options); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔════╤════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────┼────╢ +║ 1A │ 1B │ 1C ║ +║ 2A │ 2B │ 2C ║ +║ 3A │ 3B │ 3C ║ +╟────┼────┼────╢ +║ 4A │ 4B │ 4C ║ +╚════╧════╧════╝ + `); + }); +}); diff --git a/node_modules/table/test/README/usage/expectTable.js b/node_modules/table/test/README/usage/expectTable.js new file mode 100644 index 000000000..d66c913fb --- /dev/null +++ b/node_modules/table/test/README/usage/expectTable.js @@ -0,0 +1,13 @@ +import { + expect +} from 'chai'; +import _ from 'lodash'; + +/** + * @param {string} result + * @param {string} expectedResult + * @returns {undefined} + */ +export default (result, expectedResult) => { + expect(result).to.equal(_.trim(expectedResult) + '\n'); +}; diff --git a/node_modules/table/test/README/usage/moon_mission.js b/node_modules/table/test/README/usage/moon_mission.js new file mode 100644 index 000000000..c9b9239a8 --- /dev/null +++ b/node_modules/table/test/README/usage/moon_mission.js @@ -0,0 +1,67 @@ +import _ from 'lodash'; +import chalk from 'chalk'; +import table, { + getBorderCharacters +} from './../../../src'; + +describe('README.md usage/', () => { + it('moon_mission', () => { + const data = [ + [ + chalk.bold('Spacecraft'), + chalk.bold('Launch Date'), + chalk.bold('Operator'), + chalk.bold('Outcome'), + chalk.bold('Remarks') + ], + [ + 'Able I', + '17 August 1958', + 'USAF', + chalk.white.bold.bgRed('Launch failure'), + 'First attempted launch beyond Earth orbit; failed to orbit due to turbopump gearbox malfunction resulting in first stage explosion.[3] Reached apogee of 16 kilometres (9.9 mi)' + ], + [ + 'Luna 2', + '12 September 1959', + 'OKB-1', + chalk.black.bgGreen('Successful'), + 'Successful impact at 21:02 on 14 September 1959. First spacecraft to reach lunar surface' + ], + [ + 'Lunar Orbiter 1', + '10 August 1966', + 'NASA', + chalk.black.bgYellow('Partial failure'), + 'Orbital insertion at around 15:36 UTC on 14 August. Deorbited early due to lack of fuel and to avoid communications interference with the next mission, impacted the Moon at 13:30 UTC on 29 October 1966.' + ], + [ + 'Apollo 8', + '21 December 1968', + 'NASA', + chalk.black.bgGreen('Successful'), + 'First manned mission to the Moon; entered orbit around the Moon with four-minute burn beginning at 09:59:52 UTC on 24 December. Completed ten orbits of the Moon before returning to Earth with an engine burn at 06:10:16 UTC on 25 December. Landed in the Pacific Ocean at 15:51 UTC on 27 December.' + ], + [ + 'Apollo 11', + '16 July 1969', + 'NASA', + chalk.black.bgGreen('Successful'), + 'First manned landing on the Moon. LM landed at 20:17 UTC on 20 July 1969' + ] + ]; + + const tableBorder = _.mapValues(getBorderCharacters('honeywell'), (char) => { + return chalk.gray(char); + }); + + table(data, { + border: tableBorder, + columns: { + 4: { + width: 50 + } + } + }); + }); +}); diff --git a/node_modules/table/test/README/usage/padding_cell_content.js b/node_modules/table/test/README/usage/padding_cell_content.js new file mode 100644 index 000000000..fdac2b384 --- /dev/null +++ b/node_modules/table/test/README/usage/padding_cell_content.js @@ -0,0 +1,39 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('usage/padding_cell_content', () => { + const data = [ + ['0A', 'AABBCC', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] + ]; + + const config = { + columns: { + 0: { + paddingLeft: 3 + }, + 1: { + paddingRight: 3, + width: 2 + } + } + }; + + const output = table(data, config); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔══════╤══════╤════╗ +║ 0A │ AA │ 0C ║ +║ │ BB │ ║ +║ │ CC │ ║ +╟──────┼──────┼────╢ +║ 1A │ 1B │ 1C ║ +╟──────┼──────┼────╢ +║ 2A │ 2B │ 2C ║ +╚══════╧══════╧════╝ + `); + }); +}); diff --git a/node_modules/table/test/README/usage/predefined_border_templates.js b/node_modules/table/test/README/usage/predefined_border_templates.js new file mode 100644 index 000000000..f6ad71644 --- /dev/null +++ b/node_modules/table/test/README/usage/predefined_border_templates.js @@ -0,0 +1,91 @@ +import _ from 'lodash'; +import table, { + getBorderCharacters +} from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/predefined_border_templates', () => { + let data; + + before(() => { + data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'] + ]; + }); + + it('honeywell', () => { + const output = table(data, { + border: getBorderCharacters('honeywell') + }); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔════╤════╤════╗ +║ 0A │ 0B │ 0C ║ +╟────┼────┼────╢ +║ 1A │ 1B │ 1C ║ +╟────┼────┼────╢ +║ 2A │ 2B │ 2C ║ +╚════╧════╧════╝ + `); + }); + + it('norc', () => { + const output = table(data, { + border: getBorderCharacters('norc') + }); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +┌────┬────┬────┐ +│ 0A │ 0B │ 0C │ +├────┼────┼────┤ +│ 1A │ 1B │ 1C │ +├────┼────┼────┤ +│ 2A │ 2B │ 2C │ +└────┴────┴────┘ + `); + }); + + it('ramac', () => { + const output = table(data, { + border: getBorderCharacters('ramac') + }); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` ++----+----+----+ +| 0A | 0B | 0C | +|----|----|----| +| 1A | 1B | 1C | +|----|----|----| +| 2A | 2B | 2C | ++----+----+----+ + `); + }); + + it('void', () => { + const output = table(data, { + border: getBorderCharacters('void') + }); + + expectTable(_.trim(output) + '\n', '0A 0B 0C \n\n 1A 1B 1C \n\n 2A 2B 2C'); + }); + + it('borderless', () => { + const output = table(data, { + border: getBorderCharacters('void'), + columnDefault: { + paddingLeft: 0, + paddingRight: 1 + }, + drawHorizontalLine: () => { + return false; + } + }); + + expectTable(_.trim(output) + '\n', '0A 0B 0C \n1A 1B 1C \n2A 2B 2C'); + }); +}); diff --git a/node_modules/table/test/README/usage/streaming.js b/node_modules/table/test/README/usage/streaming.js new file mode 100644 index 000000000..faec63dfb --- /dev/null +++ b/node_modules/table/test/README/usage/streaming.js @@ -0,0 +1,56 @@ +import { + createStream +} from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + describe('process.stdout.write', () => { + let processStdoutWriteBuffer; + + /** + * @var {Function} Reference to the original process.stdout.write function. + */ + const processStdoutWrite = process.stdout.write; + + /** + * @returns {undefined} + */ + const overwriteProcessStdoutWrite = () => { + processStdoutWriteBuffer = ''; + + process.stdout.write = (text) => { + processStdoutWriteBuffer += text; + }; + }; + + /** + * @returns {string} + */ + const resetProcessStdoudWrite = () => { + process.stdout.write = processStdoutWrite; + + return processStdoutWriteBuffer; + }; + + it('streaming', () => { + const config = { + columnCount: 3, + columnDefault: { + width: 2 + } + }; + + const stream = createStream(config); + + overwriteProcessStdoutWrite(); + + stream.write(['0A', '0B', '0C']); + stream.write(['1A', '1B', '1C']); + stream.write(['2A', '2B', '2C']); + + const output = resetProcessStdoudWrite(); + + expectTable(output + '\n', '╔════╤════╤════╗\n║ 0A │ 0B │ 0C ║\n╚════╧════╧════╝\r\u001b[K╟────┼────┼────╢\n║ 1A │ 1B │ 1C ║\n╚════╧════╧════╝\r\u001b[K╟────┼────┼────╢\n║ 2A │ 2B │ 2C ║\n╚════╧════╧════╝'); + }); + }); +}); diff --git a/node_modules/table/test/README/usage/text_truncating.js b/node_modules/table/test/README/usage/text_truncating.js new file mode 100644 index 000000000..07e941216 --- /dev/null +++ b/node_modules/table/test/README/usage/text_truncating.js @@ -0,0 +1,32 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('text_truncating', () => { + const data = [ + ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.'] + ]; + + const config = { + columns: { + 0: { + truncate: 100, + width: 20 + } + } + }; + + const output = table(data, config); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔══════════════════════╗ +║ Lorem ipsum dolor si ║ +║ t amet, consectetur ║ +║ adipiscing elit. Pha ║ +║ sellus pulvinar nibh ║ +║ sed mauris conva... ║ +╚══════════════════════╝ + `); + }); +}); diff --git a/node_modules/table/test/README/usage/text_wrapping.js b/node_modules/table/test/README/usage/text_wrapping.js new file mode 100644 index 000000000..1db25e980 --- /dev/null +++ b/node_modules/table/test/README/usage/text_wrapping.js @@ -0,0 +1,67 @@ +import table from './../../../src'; +import expectTable from './expectTable'; + +describe('README.md usage/', () => { + it('text_wrapping (no wrap word)', () => { + const data = [ + ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.'] + ]; + + const config = { + columns: { + 0: { + width: 20 + } + } + }; + + const output = table(data, config); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔══════════════════════╗ +║ Lorem ipsum dolor si ║ +║ t amet, consectetur ║ +║ adipiscing elit. Pha ║ +║ sellus pulvinar nibh ║ +║ sed mauris convallis ║ +║ dapibus. Nunc venena ║ +║ tis tempus nulla sit ║ +║ amet viverra. ║ +╚══════════════════════╝ + `); + }); + + it('text_wrapping (wrap word)', () => { + const data = [ + ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.'] + ]; + + const config = { + columns: { + 0: { + width: 20, + wrapWord: true + } + } + }; + + const output = table(data, config); + + // eslint-disable-next-line no-restricted-syntax + expectTable(output, ` +╔══════════════════════╗ +║ Lorem ipsum dolor ║ +║ sit amet, ║ +║ consectetur ║ +║ adipiscing elit. ║ +║ Phasellus pulvinar ║ +║ nibh sed mauris ║ +║ convallis dapibus. ║ +║ Nunc venenatis ║ +║ tempus nulla sit ║ +║ amet viverra. ║ +╚══════════════════════╝ + `); + }); +}); diff --git a/node_modules/table/test/alignString.js b/node_modules/table/test/alignString.js new file mode 100644 index 000000000..e995a34f8 --- /dev/null +++ b/node_modules/table/test/alignString.js @@ -0,0 +1,102 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import chalk from 'chalk'; +import alignString from './../src/alignString'; + +describe('alignString', () => { + context('subject parameter value is not a string', () => { + it('throws an error', () => { + expect(() => { + alignString(); + }).to.throw(Error, 'Subject parameter value must be a string.'); + }); + }); + context('container width parameter value is not a string', () => { + it('throws an error', () => { + expect(() => { + alignString(''); + }).to.throw(Error, 'Container width parameter value must be a number.'); + }); + }); + context('subject parameter value width is greater than the container width', () => { + it('throws an error', () => { + expect(() => { + alignString('aa', 1, 'left'); + }).to.throw(Error, 'Subject parameter value width cannot be greater than the container width.'); + }); + }); + context('container alignment parameter value is not a string', () => { + it('throws an error', () => { + expect(() => { + alignString('', 1); + }).to.throw(Error, 'Alignment parameter value must be a string.'); + }); + }); + context('container alignment parameter value is not a known alignment parameter value', () => { + it('throws an error', () => { + expect(() => { + alignString('', 1, 'foo'); + }).to.throw(Error, 'Alignment parameter value must be a known alignment parameter value (left, right, center).'); + }); + }); + context('subject parameter value', () => { + context('0 width', () => { + it('produces a string consisting of container width number of whitespace characters', () => { + expect(alignString('', 5, 'left')).to.equal(' ', 'left'); + expect(alignString('', 5, 'center')).to.equal(' ', 'center'); + expect(alignString('', 5, 'right')).to.equal(' ', 'right'); + }); + }); + context('plain text', () => { + context('alignment', () => { + context('left', () => { + it('pads the string on the right side using a whitespace character', () => { + expect(alignString('aa', 6, 'left')).to.equal('aa '); + }); + }); + context('right', () => { + it('pads the string on the left side using a whitespace character', () => { + expect(alignString('aa', 6, 'right')).to.equal(' aa'); + }); + }); + context('center', () => { + it('pads the string on both sides using a whitespace character', () => { + expect(alignString('aa', 6, 'center')).to.equal(' aa '); + }); + context('uneven number of available with', () => { + it('floors the available width; adds extra space to the end of the string', () => { + expect(alignString('aa', 7, 'center')).to.equal(' aa '); + }); + }); + }); + }); + }); + context('text containing ANSI escape codes', () => { + context('alignment', () => { + context('left', () => { + it('pads the string on the right side using a whitespace character', () => { + expect(alignString(chalk.red('aa'), 6, 'left')).to.equal(chalk.red('aa') + ' '); + }); + }); + context('right', () => { + it('pads the string on the left side using a whitespace character', () => { + expect(alignString(chalk.red('aa'), 6, 'right')).to.equal(' ' + chalk.red('aa')); + }); + }); + context('center', () => { + it('pads the string on both sides using a whitespace character', () => { + expect(alignString(chalk.red('aa'), 6, 'center')).to.equal(' ' + chalk.red('aa') + ' '); + }); + context('uneven number of available with', () => { + it('floors the available width; adds extra space to the end of the string', () => { + expect(alignString(chalk.red('aa'), 7, 'center')).to.equal(' ' + chalk.red('aa') + ' '); + }); + }); + }); + }); + }); + }); +}); diff --git a/node_modules/table/test/calculateCellHeight.js b/node_modules/table/test/calculateCellHeight.js new file mode 100644 index 000000000..c5a4929d8 --- /dev/null +++ b/node_modules/table/test/calculateCellHeight.js @@ -0,0 +1,44 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import calculateCellHeight from './../src/calculateCellHeight'; + +describe('calculateCellHeight', () => { + describe('value', () => { + context('is not a string', () => { + it('throws an error', () => { + expect(() => { + calculateCellHeight(null); + }).to.throw(Error, 'Value must be a string.'); + }); + }); + }); + describe('context width', () => { + context('is not an integer', () => { + it('throws an error', () => { + expect(() => { + calculateCellHeight('foo', null); + }).to.throw(Error, 'Column width must be an integer.'); + }); + }); + context('is 0', () => { + it('throws an error', () => { + expect(() => { + calculateCellHeight('foo', 0); + }).to.throw(Error, 'Column width must be greater than 0.'); + }); + }); + context('is lesser than the column width', () => { + it('has height 1', () => { + expect(calculateCellHeight('foo', 10)).to.equal(1); + }); + }); + context('is 2 and half times greater than the column width', () => { + it('has height 3', () => { + expect(calculateCellHeight('aabbc', 2)).to.equal(3); + }); + }); + }); +}); diff --git a/node_modules/table/test/calculateCellWidthIndex.js b/node_modules/table/test/calculateCellWidthIndex.js new file mode 100644 index 000000000..b999567cb --- /dev/null +++ b/node_modules/table/test/calculateCellWidthIndex.js @@ -0,0 +1,20 @@ +import { + expect +} from 'chai'; +import calculateCellWidthIndex from './../src/calculateCellWidthIndex'; + +describe('calculateCellWidthIndex', () => { + context('all cells have different width', () => { + it('describes each cell contents width', () => { + const cellWidthIndex = calculateCellWidthIndex([ + 'a', + 'aaa', + 'aaaaaa' + ]); + + expect(cellWidthIndex[0]).to.equal(1, 'first column'); + expect(cellWidthIndex[1]).to.equal(3, 'second column'); + expect(cellWidthIndex[2]).to.equal(6, 'third column'); + }); + }); +}); diff --git a/node_modules/table/test/calculateMaximumColumnWidthIndex.js b/node_modules/table/test/calculateMaximumColumnWidthIndex.js new file mode 100644 index 000000000..6508134cf --- /dev/null +++ b/node_modules/table/test/calculateMaximumColumnWidthIndex.js @@ -0,0 +1,59 @@ +import { + expect +} from 'chai'; +import chalk from 'chalk'; +import calculateMaximumColumnWidthIndex from './../src/calculateMaximumColumnWidthIndex'; + +describe('calculateMaximumColumnWidthIndex', () => { + it('throws an error when attempting to calculate maximum column value index for an empty data set', () => { + expect(() => { + calculateMaximumColumnWidthIndex([]); + }).to.throw(Error, 'Dataset must have at least one row.'); + }); + it('calculates the maximum column value index', () => { + const maximumColumnValueIndex = calculateMaximumColumnWidthIndex([ + [ + '', + 'a', + 'b', + 'c' + ], + [ + '', + 'a', + 'bbbbbbbbbb', + 'c' + ], + [ + '', + '', + 'b', + 'ccccc' + ] + ]); + + expect(maximumColumnValueIndex).to.deep.equal([0, 1, 10, 5]); + }); + context('cell values contain ANSI codes', () => { + it('uses visual width of the string', () => { + const maximumColumnValueIndex = calculateMaximumColumnWidthIndex([ + [ + chalk.red('aaaaa') + ] + ]); + + expect(maximumColumnValueIndex[0]).to.equal(5); + }); + }); + context('cell values contain fullwidth characters', () => { + it('uses visual width of the string', () => { + const maximumColumnValueIndex = calculateMaximumColumnWidthIndex([ + [ + chalk.red('古') + ] + ]); + + expect(maximumColumnValueIndex[0]).to.equal(2); + }); + }); +}); diff --git a/node_modules/table/test/calculateRowHeightIndex.js b/node_modules/table/test/calculateRowHeightIndex.js new file mode 100644 index 000000000..d4a43aedf --- /dev/null +++ b/node_modules/table/test/calculateRowHeightIndex.js @@ -0,0 +1,78 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import calculateRowHeightIndex from './../src/calculateRowHeightIndex'; + +describe('calculateRowHeightIndex', () => { + context('single column', () => { + context('cell content width is lesser than column width', () => { + it('is equal to 1', () => { + const data = [ + [ + 'aaa' + ] + ]; + + const config = { + columns: { + 0: { + width: 10, + wrapWord: false + } + } + }; + + const rowSpanIndex = calculateRowHeightIndex(data, config); + + expect(rowSpanIndex[0]).to.equal(1); + }); + }); + context('cell content width is twice the size of the column width', () => { + it('is equal to 2', () => { + const data = [ + [ + 'aaabbb' + ] + ]; + + const config = { + columns: { + 0: { + width: 3, + wrapWord: false + } + } + }; + + const rowSpanIndex = calculateRowHeightIndex(data, config); + + expect(rowSpanIndex[0]).to.equal(2); + }); + }); + }); + context('multiple columns', () => { + context('multiple cell content width is greater than the column width', () => { + it('uses the largest height', () => { + const data = [ + ['aaabbb'], + ['aaabbb'] + ]; + + const config = { + columns: { + 0: { + width: 2, + wrapWord: false + } + } + }; + + const rowSpanIndex = calculateRowHeightIndex(data, config); + + expect(rowSpanIndex[0]).to.equal(3); + }); + }); + }); +}); diff --git a/node_modules/table/test/config.js b/node_modules/table/test/config.js new file mode 100644 index 000000000..55bd5c2b8 --- /dev/null +++ b/node_modules/table/test/config.js @@ -0,0 +1,43 @@ +import { + expect +} from 'chai'; +import configSamples from './configSamples'; +import validateConfig from '../dist/validateConfig'; +import configSchema from '../src/schemas/config.json'; +import Ajv from 'ajv'; +import ajvKeywords from 'ajv-keywords'; + +describe('config.json schema', () => { + var validate; + + before(() => { + var ajv = new Ajv({allErrors: true}); + ajvKeywords(ajv, 'typeof'); + validate = ajv.compile(configSchema); + }); + + it('should pass validation of valid config samples', () => { + configSamples.valid.forEach((sample, i) => { + testValid(sample, validate); + testValid(sample, validateConfig); + }); + + function testValid(sample, validate) { + var valid = validate(sample); + if (!valid) console.log(validate.errors); + expect(valid).to.equal(true); + } + }); + + it('should fail validation of invalid config samples', () => { + configSamples.invalid.forEach((sample, i) => { + testInvalid(sample, validate); + testInvalid(sample, validateConfig); + }); + + function testInvalid(sample, validate) { + var valid = validate(sample); + expect(valid).to.equal(false); + } + }); +}); diff --git a/node_modules/table/test/configSamples.js b/node_modules/table/test/configSamples.js new file mode 100644 index 000000000..20d8bf6ad --- /dev/null +++ b/node_modules/table/test/configSamples.js @@ -0,0 +1,153 @@ +export default { + valid: [ + { + columns: { + 0: { + alignment: 'left', + // minWidth: 10, + width: 10 + }, + 1: { + alignment: 'center', + // minWidth: 10, + width: 10 + }, + 2: { + alignment: 'right', + // minWidth: 10, + width: 10 + } + } + }, + { + border: { + topBody: `─`, + topJoin: `┬`, + topLeft: `┌`, + topRight: `┐`, + + bottomBody: `─`, + bottomJoin: `┴`, + bottomLeft: `└`, + bottomRight: `┘`, + + bodyLeft: `│`, + bodyRight: `│`, + bodyJoin: `│`, + + joinBody: `─`, + joinLeft: `├`, + joinRight: `┤`, + joinJoin: `┼` + } + }, + { + columns: { + 0: { + paddingLeft: 3 + }, + 1: { + width: 2, + paddingRight: 3 + } + } + }, + { + border: {}, + columnDefault: { + paddingLeft: 0, + paddingRight: 1 + }, + // drawJoin: () => { + // return false + // } + }, + { + columnDefault: { + width: 50 + }, + // columnCount: 3, + columns: { + 0: { + width: 10, + alignment: 'right' + }, + 1: { + alignment: 'center', + }, + 2: { + width: 10 + } + } + }, + { border: { topBody: '-' } }, + { border: { topJoin: '-' } }, + { border: { topLeft: '-' } }, + { border: { topRight: '-' } }, + { border: { bottomBody: '-' } }, + { border: { bottomJoin: '-' } }, + { border: { bottomLeft: '-' } }, + { border: { bottomRight: '-' } }, + { border: { bodyLeft: '-' } }, + { border: { bodyRight: '-' } }, + { border: { bodyJoin: '-' } }, + { border: { joinBody: '-' } }, + { border: { joinLeft: '-' } }, + { border: { joinRight: '-' } }, + { border: { joinJoin: '-' } }, + { columns: { '1': { alignment: 'left' } } }, + { columns: { '1': { width: 5 } } }, + { columns: { '1': { wrapWord: true } } }, + { columns: { '1': { truncate: 1 } } }, + { columns: { '1': { paddingLeft: 1 } } }, + { columns: { '1': { paddingRight: 1 } } }, + { columnDefault: { alignment: 'left' } }, + { columnDefault: { width: 5 } }, + { columnDefault: { wrapWord: true } }, + { columnDefault: { truncate: 1 } }, + { columnDefault: { paddingLeft: 1 } }, + { columnDefault: { paddingRight: 1 } }, + { drawHorizontalLine: function(){} } + ], + invalid: [ + { border: 1 }, + { border: { unknown: '-' } }, + { border: { topBody: 1 } }, + { border: { topJoin: 1 } }, + { border: { topLeft: 1 } }, + { border: { topRight: 1 } }, + { border: { bottomBody: 1 } }, + { border: { bottomJoin: 1 } }, + { border: { bottomLeft: 1 } }, + { border: { bottomRight: 1 } }, + { border: { bodyLeft: 1 } }, + { border: { bodyRight: 1 } }, + { border: { bodyJoin: 1 } }, + { border: { joinBody: 1 } }, + { border: { joinLeft: 1 } }, + { border: { joinRight: 1 } }, + { border: { joinJoin: 1 } }, + { columns: 1 }, + { columns: { a: { width: 5 } } }, + { columns: { '1': 1 } }, + { columns: { '1': { unknown: 1 } } }, + { columns: { '1': { alignment: 1 } } }, + { columns: { '1': { alignment: '1' } } }, + { columns: { '1': { width: '5' } } }, + { columns: { '1': { wrapWord: 1 } } }, + { columns: { '1': { truncate: '1' } } }, + { columns: { '1': { paddingLeft: '1' } } }, + { columns: { '1': { paddingRight: '1' } } }, + { columnDefault: 1 }, + { columnDefault: { unknown: 1 } }, + { columnDefault: { alignment: 1 } }, + { columnDefault: { alignment: '1' } }, + { columnDefault: { width: '5' } }, + { columnDefault: { wrapWord: 1 } }, + { columnDefault: { truncate: '1' } }, + { columnDefault: { paddingLeft: '1' } }, + { columnDefault: { paddingRight: '1' } }, + { drawHorizontalLine: 1 }, + { unknown: 1 } + ] +}; diff --git a/node_modules/table/test/createStream.js b/node_modules/table/test/createStream.js new file mode 100644 index 000000000..c9abece56 --- /dev/null +++ b/node_modules/table/test/createStream.js @@ -0,0 +1,41 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import createStream from './../src/createStream'; + +describe('createStream', () => { + context('"config.columnDefault.width" property is not provided', () => { + it('throws an error', () => { + expect(() => { + createStream(); + }).to.throw(Error, 'Must provide config.columnDefault.width when creating a stream.'); + }); + }); + context('"config.columnCount" property is not provided', () => { + it('throws an error', () => { + expect(() => { + createStream({ + columnDefault: { + width: 10 + } + }); + }).to.throw(Error, 'Must provide config.columnCount.'); + }); + }); + context('Table data cell count does not match the columnCount.', () => { + it('throws an error', () => { + expect(() => { + const stream = createStream({ + columnCount: 10, + columnDefault: { + width: 10 + } + }); + + stream.write(['foo']); + }).to.throw(Error, 'Row cell count does not match the config.columnCount.'); + }); + }); +}); diff --git a/node_modules/table/test/drawBorder.js b/node_modules/table/test/drawBorder.js new file mode 100644 index 000000000..a2cbb17e7 --- /dev/null +++ b/node_modules/table/test/drawBorder.js @@ -0,0 +1,71 @@ +/* eslint-disable sort-keys */ + +import { + expect +} from 'chai'; +import { + drawBorder, + drawBorderTop, + drawBorderJoin, + drawBorderBottom +} from './../src/drawBorder'; + +describe('drawBorder', () => { + it('draws a border using parts', () => { + const parts = { + left: '╔', + right: '╗', + body: '═', + join: '╤' + }; + + expect(drawBorder([1], parts)).to.equal('╔═╗\n'); + expect(drawBorder([1, 1], parts)).to.equal('╔═╤═╗\n'); + expect(drawBorder([5, 10], parts)).to.equal('╔═════╤══════════╗\n'); + }); +}); + +describe('drawBorderTop', () => { + it('draws a border using parts', () => { + const parts = { + topLeft: '╔', + topRight: '╗', + topBody: '═', + topJoin: '╤' + }; + + expect(drawBorderTop([1], parts)).to.equal('╔═╗\n'); + expect(drawBorderTop([1, 1], parts)).to.equal('╔═╤═╗\n'); + expect(drawBorderTop([5, 10], parts)).to.equal('╔═════╤══════════╗\n'); + }); +}); + +describe('drawBorderJoin', () => { + it('draws a border using parts', () => { + const parts = { + joinBody: '─', + joinLeft: '╟', + joinRight: '╢', + joinJoin: '┼' + }; + + expect(drawBorderJoin([1], parts)).to.equal('╟─╢\n'); + expect(drawBorderJoin([1, 1], parts)).to.equal('╟─┼─╢\n'); + expect(drawBorderJoin([5, 10], parts)).to.equal('╟─────┼──────────╢\n'); + }); +}); + +describe('drawBorderBottom', () => { + it('draws a border using parts', () => { + const parts = { + bottomBody: '═', + bottomJoin: '╧', + bottomLeft: '╚', + bottomRight: '╝' + }; + + expect(drawBorderBottom([1], parts)).to.equal('╚═╝\n'); + expect(drawBorderBottom([1, 1], parts)).to.equal('╚═╧═╝\n'); + expect(drawBorderBottom([5, 10], parts)).to.equal('╚═════╧══════════╝\n'); + }); +}); diff --git a/node_modules/table/test/makeConfig.js b/node_modules/table/test/makeConfig.js new file mode 100644 index 000000000..706173864 --- /dev/null +++ b/node_modules/table/test/makeConfig.js @@ -0,0 +1,75 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import makeConfig from './../src/makeConfig'; + +describe('makeConfig', () => { + it('does not affect the parameter configuration object', () => { + const config = {}; + + makeConfig([ + [ + 'aaaaa' + ] + ], config); + + expect(config).to.deep.equal({}); + }); + + context('column', () => { + context('"alignment"', () => { + context('is not provided', () => { + it('defaults to "left"', () => { + const config = makeConfig([ + [ + 'aaaaa' + ] + ]); + + expect(config.columns[0].alignment).to.equal('left'); + }); + }); + }); + context('"width"', () => { + context('is not provided', () => { + it('defaults to the maximum column width', () => { + const config = makeConfig([ + [ + 'aaaaa' + ] + ]); + + expect(config.columns[0].width).to.equal(5); + }); + }); + }); + context('"paddingLeft"', () => { + context('is not provided', () => { + it('defaults to 1', () => { + const config = makeConfig([ + [ + 'aaaaa' + ] + ]); + + expect(config.columns[0].paddingLeft).to.equal(1); + }); + }); + }); + context('"paddingRight"', () => { + context('is not provided', () => { + it('defaults to 1', () => { + const config = makeConfig([ + [ + 'aaaaa' + ] + ]); + + expect(config.columns[0].paddingRight).to.equal(1); + }); + }); + }); + }); +}); diff --git a/node_modules/table/test/mapDataUsingRowHeightIndex.js b/node_modules/table/test/mapDataUsingRowHeightIndex.js new file mode 100644 index 000000000..d6ddd6bb3 --- /dev/null +++ b/node_modules/table/test/mapDataUsingRowHeightIndex.js @@ -0,0 +1,119 @@ +import { + expect +} from 'chai'; +import mapDataUsingRowHeightIndex from './../src/mapDataUsingRowHeightIndex'; + +describe('mapDataUsingRowHeightIndex', () => { + context('no data spans multiple rows', () => { + it('maps data to a single cell', () => { + const config = { + columns: { + 0: { + width: 2 + } + } + }; + + const rowSpanIndex = [ + 1 + ]; + + const data = [ + [ + 'aa' + ] + ]; + + const mappedData = mapDataUsingRowHeightIndex(data, rowSpanIndex, config); + + expect(mappedData).to.deep.equal([ + [ + 'aa' + ] + ]); + }); + }); + + context('single cell spans multiple rows', () => { + it('maps data to multiple rows', () => { + const config = { + columns: { + 0: { + width: 2 + } + } + }; + + const rowSpanIndex = [ + 5 + ]; + + const data = [ + [ + 'aabbccddee' + ] + ]; + + const mappedData = mapDataUsingRowHeightIndex(data, rowSpanIndex, config); + + expect(mappedData).to.deep.equal([ + ['aa'], + ['bb'], + ['cc'], + ['dd'], + ['ee'] + ]); + }); + }); + + context('multiple cells spans multiple rows', () => { + it('maps data to multiple rows', () => { + const config = { + columns: { + 0: { + width: 2 + }, + 1: { + width: 4 + } + } + }; + + const rowSpanIndex = [ + 5 + ]; + + const data = [ + [ + 'aabbccddee', + '00001111' + ] + ]; + + const mappedData = mapDataUsingRowHeightIndex(data, rowSpanIndex, config); + + expect(mappedData).to.deep.equal([ + [ + 'aa', + '0000' + ], + [ + 'bb', + '1111' + ], + [ + 'cc', + '' + ], + [ + 'dd', + '' + ], + [ + 'ee', + '' + ] + ]); + }); + }); +}); diff --git a/node_modules/table/test/streamConfig.js b/node_modules/table/test/streamConfig.js new file mode 100644 index 000000000..fe3e7557c --- /dev/null +++ b/node_modules/table/test/streamConfig.js @@ -0,0 +1,43 @@ +import { + expect +} from 'chai'; +import configSamples from './streamConfigSamples'; +import validateConfig from '../dist/validateStreamConfig'; +import configSchema from '../src/schemas/streamConfig.json'; +import Ajv from 'ajv'; +import ajvKeywords from 'ajv-keywords'; + +describe('streamConfig.json schema', () => { + var validate; + + before(() => { + var ajv = new Ajv({allErrors: true}); + ajvKeywords(ajv, 'typeof'); + validate = ajv.compile(configSchema); + }); + + it('should pass validation of valid streamConfig samples', () => { + configSamples.valid.forEach((sample, i) => { + testValid(sample, validate); + testValid(sample, validateConfig); + }); + + function testValid(sample, validate) { + var valid = validate(sample); + if (!valid) console.log(validate.errors); + expect(valid).to.equal(true); + } + }); + + it('should fail validation of invalid streamConfig samples', () => { + configSamples.invalid.forEach((sample, i) => { + testInvalid(sample, validate); + testInvalid(sample, validateConfig); + }); + + function testInvalid(sample, validate) { + var valid = validate(sample); + expect(valid).to.equal(false); + } + }); +}); diff --git a/node_modules/table/test/streamConfigSamples.js b/node_modules/table/test/streamConfigSamples.js new file mode 100644 index 000000000..3c7d1f31b --- /dev/null +++ b/node_modules/table/test/streamConfigSamples.js @@ -0,0 +1,151 @@ +export default { + valid: [ + { + columns: { + 0: { + alignment: 'left', + // minWidth: 10, + width: 10 + }, + 1: { + alignment: 'center', + // minWidth: 10, + width: 10 + }, + 2: { + alignment: 'right', + // minWidth: 10, + width: 10 + } + } + }, + { + border: { + topBody: `─`, + topJoin: `┬`, + topLeft: `┌`, + topRight: `┐`, + + bottomBody: `─`, + bottomJoin: `┴`, + bottomLeft: `└`, + bottomRight: `┘`, + + bodyLeft: `│`, + bodyRight: `│`, + bodyJoin: `│`, + + joinBody: `─`, + joinLeft: `├`, + joinRight: `┤`, + joinJoin: `┼` + } + }, + { + columns: { + 0: { + paddingLeft: 3 + }, + 1: { + width: 2, + paddingRight: 3 + } + } + }, + { + border: {}, + columnDefault: { + paddingLeft: 0, + paddingRight: 1 + }, + // drawJoin: () => { + // return false + // } + }, + { + columnDefault: { + width: 50 + }, + // columnCount: 3, + columns: { + 0: { + width: 10, + alignment: 'right' + }, + 1: { + alignment: 'center', + }, + 2: { + width: 10 + } + } + }, + { border: { topBody: '-' } }, + { border: { topJoin: '-' } }, + { border: { topLeft: '-' } }, + { border: { topRight: '-' } }, + { border: { bottomBody: '-' } }, + { border: { bottomJoin: '-' } }, + { border: { bottomLeft: '-' } }, + { border: { bottomRight: '-' } }, + { border: { bodyLeft: '-' } }, + { border: { bodyRight: '-' } }, + { border: { bodyJoin: '-' } }, + { border: { joinBody: '-' } }, + { border: { joinLeft: '-' } }, + { border: { joinRight: '-' } }, + { border: { joinJoin: '-' } }, + { columns: { '1': { alignment: 'left' } } }, + { columns: { '1': { width: 5 } } }, + { columns: { '1': { wrapWord: true } } }, + { columns: { '1': { truncate: 1 } } }, + { columns: { '1': { paddingLeft: 1 } } }, + { columns: { '1': { paddingRight: 1 } } }, + { columnDefault: { alignment: 'left' } }, + { columnDefault: { width: 5 } }, + { columnDefault: { wrapWord: true } }, + { columnDefault: { truncate: 1 } }, + { columnDefault: { paddingLeft: 1 } }, + { columnDefault: { paddingRight: 1 } } + ], + invalid: [ + { border: 1 }, + { border: { unknown: '-' } }, + { border: { topBody: 1 } }, + { border: { topJoin: 1 } }, + { border: { topLeft: 1 } }, + { border: { topRight: 1 } }, + { border: { bottomBody: 1 } }, + { border: { bottomJoin: 1 } }, + { border: { bottomLeft: 1 } }, + { border: { bottomRight: 1 } }, + { border: { bodyLeft: 1 } }, + { border: { bodyRight: 1 } }, + { border: { bodyJoin: 1 } }, + { border: { joinBody: 1 } }, + { border: { joinLeft: 1 } }, + { border: { joinRight: 1 } }, + { border: { joinJoin: 1 } }, + { columns: 1 }, + { columns: { a: { width: 5 } } }, + { columns: { '1': 1 } }, + { columns: { '1': { unknown: 1 } } }, + { columns: { '1': { alignment: 1 } } }, + { columns: { '1': { alignment: '1' } } }, + { columns: { '1': { width: '5' } } }, + { columns: { '1': { wrapWord: 1 } } }, + { columns: { '1': { truncate: '1' } } }, + { columns: { '1': { paddingLeft: '1' } } }, + { columns: { '1': { paddingRight: '1' } } }, + { columnDefault: 1 }, + { columnDefault: { unknown: 1 } }, + { columnDefault: { alignment: 1 } }, + { columnDefault: { alignment: '1' } }, + { columnDefault: { width: '5' } }, + { columnDefault: { wrapWord: 1 } }, + { columnDefault: { truncate: '1' } }, + { columnDefault: { paddingLeft: '1' } }, + { columnDefault: { paddingRight: '1' } }, + { unknown: 1 } + ] +}; diff --git a/node_modules/table/test/validateTableData.js b/node_modules/table/test/validateTableData.js new file mode 100644 index 000000000..24e8800e3 --- /dev/null +++ b/node_modules/table/test/validateTableData.js @@ -0,0 +1,65 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import validateTableData from './../src/validateTableData'; + +describe('validateTableData', () => { + context('table does not have a row', () => { + it('throws an error', () => { + expect(() => { + validateTableData([]); + }).to.throw(Error, 'Table must define at least one row.'); + }); + }); + + context('table does not have a column', () => { + it('throws an error', () => { + expect(() => { + validateTableData([[]]); + }).to.throw(Error, 'Table must define at least one column.'); + }); + }); + + context('row data is not an array', () => { + it('throws an error', () => { + expect(() => { + validateTableData({}); + }).to.throw(Error, 'Table data must be an array.'); + }); + }); + + context('column data is not an array', () => { + it('throws an error', () => { + expect(() => { + validateTableData([{}]); + }).to.throw(Error, 'Table row data must be an array.'); + }); + }); + + context('cell data contains a control character', () => { + it('throws an error', () => { + expect(() => { + validateTableData([ + [ + [ + String.fromCodePoint(0x01) + ] + ] + ]); + }).to.throw(Error, 'Table data must not contain control characters.'); + }); + }); + + context('rows have inconsistent number of cells', () => { + it('throws an error', () => { + expect(() => { + validateTableData([ + ['a', 'b', 'c'], + ['a', 'b'] + ]); + }).to.throw(Error, 'Table must have a consistent number of cells.'); + }); + }); +}); diff --git a/node_modules/table/test/wrapString.js b/node_modules/table/test/wrapString.js new file mode 100644 index 000000000..d1c4f54cb --- /dev/null +++ b/node_modules/table/test/wrapString.js @@ -0,0 +1,45 @@ +/* eslint-disable max-nested-callbacks */ + +import { + expect +} from 'chai'; +import chalk from 'chalk'; +import wrapString from './../src/wrapString'; + +describe('wrapString', () => { + context('subject is a plain text string', () => { + context('subject is lesser than the chunk size', () => { + it('returns subject in a single chunk', () => { + expect(wrapString('aaa', 3)).to.deep.equal(['aaa']); + }); + }); + context('subject is larger than the chunk size', () => { + it('returns subject sliced into multiple chunks', () => { + expect(wrapString('aaabbbc', 3)).to.deep.equal(['aaa', 'bbb', 'c']); + }); + }); + context('a chunk starts with a space', () => { + it('adjusts chunks to offset the space', () => { + expect(wrapString('aaa bbb ccc', 3)).to.deep.equal(['aaa', 'bbb', 'ccc']); + }); + }); + }); + context('subject string contains ANSI escape codes', () => { + describe('subject is lesser than the chunk size', () => { + it('returns subject in a single chunk', () => { + expect(wrapString(chalk.red('aaa'), 3)).to.deep.equal([ + '\u001b[31m\u001b[31m\u001b[31m\u001b[31m\u001b[31maaa\u001b[39m' + ]); + }); + }); + describe('subject is larger than the chunk size', () => { + it('returns subject sliced into multiple chunks', () => { + expect(wrapString(chalk.red('aaabbbc'), 3)).to.deep.equal([ + '\u001b[31m\u001b[31m\u001b[31m\u001b[31m\u001b[31maaa\u001b[39m', + '\u001b[31m\u001b[31m\u001b[31m\u001b[31m\u001b[31mbbb\u001b[39m', + '\u001b[31m\u001b[31m\u001b[31m\u001b[31m\u001b[31mc\u001b[39m' + ]); + }); + }); + }); +}); diff --git a/node_modules/table/test/wrapWord.js b/node_modules/table/test/wrapWord.js new file mode 100644 index 000000000..309b9d301 --- /dev/null +++ b/node_modules/table/test/wrapWord.js @@ -0,0 +1,32 @@ +import { + expect +} from 'chai'; +import wrapWord from './../src/wrapWord'; + +describe('wrapWord', () => { + it('wraps a string at a nearest whitespace', () => { + expect(wrapWord('aaa bbb', 5)).to.deep.equal(['aaa', 'bbb']); + expect(wrapWord('a a a bbb', 5)).to.deep.equal(['a a a', 'bbb']); + }); + context('a single word is longer than chunk size', () => { + it('cuts the word', () => { + expect(wrapWord('aaaaa', 2)).to.deep.equal(['aa', 'aa', 'a']); + }); + }); + context('a long word with a special character', () => { + it('cuts the word at the special character', () => { + expect(wrapWord('aaa\\bbb', 5)).to.deep.equal(['aaa\\', 'bbb']); + expect(wrapWord('aaa/bbb', 5)).to.deep.equal(['aaa/', 'bbb']); + expect(wrapWord('aaa_bbb', 5)).to.deep.equal(['aaa_', 'bbb']); + expect(wrapWord('aaa-bbb', 5)).to.deep.equal(['aaa-', 'bbb']); + expect(wrapWord('aaa.bbb', 5)).to.deep.equal(['aaa.', 'bbb']); + expect(wrapWord('aaa,bbb', 5)).to.deep.equal(['aaa,', 'bbb']); + expect(wrapWord('aaa;bbb', 5)).to.deep.equal(['aaa;', 'bbb']); + }); + }); + context('a special character after the length of a container', () => { + it('does not include special character', () => { + expect(wrapWord('aa-bbbbb-cccc', 5)).to.deep.equal(['aa-', 'bbbbb', '-cccc']); + }); + }); +}); diff --git a/node_modules/text-table/.travis.yml b/node_modules/text-table/.travis.yml new file mode 100644 index 000000000..cc4dba29d --- /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 000000000..ee27ba4b4 --- /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 000000000..9be43098c --- /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 000000000..52b1c69e0 --- /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 000000000..2cea62993 --- /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 000000000..bab983b66 --- /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 000000000..903ea4c41 --- /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 000000000..5c0ba9876 --- /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 000000000..b4d17a4ff --- /dev/null +++ b/node_modules/text-table/package.json @@ -0,0 +1,44 @@ +{ + "name": "text-table", + "version": "0.2.0", + "description": "borderless text tables with alignment", + "main": "index.js", + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.2", + "cli-color": "~0.2.3" + }, + "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" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/text-table.git" + }, + "homepage": "https://github.com/substack/text-table", + "keywords": [ + "text", + "table", + "align", + "ascii", + "rows", + "tabular" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/node_modules/text-table/readme.markdown b/node_modules/text-table/readme.markdown new file mode 100644 index 000000000..18806acd9 --- /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 000000000..245357f26 --- /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 000000000..fbc5bb10a --- /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 000000000..c2c7a62a8 --- /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 000000000..f804f9281 --- /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 000000000..659b57c93 --- /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 000000000..9c6701464 --- /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/textlint-filter-rule-comments/LICENSE b/node_modules/textlint-filter-rule-comments/LICENSE new file mode 100644 index 000000000..ffd6b4aa2 --- /dev/null +++ b/node_modules/textlint-filter-rule-comments/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/textlint-filter-rule-comments/README.md b/node_modules/textlint-filter-rule-comments/README.md new file mode 100644 index 000000000..0b2a67ff4 --- /dev/null +++ b/node_modules/textlint-filter-rule-comments/README.md @@ -0,0 +1,142 @@ +# textlint-filter-rule-comments [![Actions Status: test](https://github.com/textlint/textlint-filter-rule-comments/workflows/test/badge.svg)](https://github.com/textlint/textlint-filter-rule-comments/actions?query=workflow%3A"test") + +textlint rule that ignore error using comments directive. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install textlint-filter-rule-comments + +Dependencies: + +- [textlint](http://textlint.github.io/ "textlint") >= 6.9 + +## Usage + +### Ignore error messages using comments + +Example case in Markdown. + +```markdown +This is error text. + + + +This is ignored text by rule. +Disables all rules between comments + + + +This is error text. +``` + +Ignore specified rules: + +```markdown + + +Ignore RuleA and RuleB + + + +Still ignore RuleB +``` + +**Limitation(markdown)**: + +Require new-line around of `` in Markdown. +This limitation com from [remark](https://github.com/wooorm/remark "remark"). + +NG: + +```markdown + +this is wrong + +``` + +OK: + +```markdown + + +this is ok + + +``` + +### Settings + +Via `.textlintrc`(Recommended) + + +```json +{ + "filters": { + "comments": true + } +} +``` + +### Options + +- `enablingComment`: + - default: `"textlint-enable"` + - enable comment directive + - e.g.) `` +- `disablingComment`: + - default: `"textlint-disable"` + - disable comment directive + - e.g.) `` + +```js +{ + "filters": { + "comments": { + // enable comment directive + // if comment has the value, then enable textlint rule + "enablingComment": "textlint-enable", + // disable comment directive + // if comment has the value, then disable textlint rule + "disablingComment": "textlint-disable" + } + } +} +``` + + + +## Changelog + +See [Releases page](https://github.com/textlint/textlint-filter-rule-comments/releases). + +## Acknowledgement + +- [Documentation - ESLint - Pluggable JavaScript linter](http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments "Documentation - ESLint - Pluggable JavaScript linter") + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/textlint/textlint-filter-rule-comments/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](http://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/textlint-filter-rule-comments/package.json b/node_modules/textlint-filter-rule-comments/package.json new file mode 100644 index 000000000..63e3c931e --- /dev/null +++ b/node_modules/textlint-filter-rule-comments/package.json @@ -0,0 +1,45 @@ +{ + "name": "textlint-filter-rule-comments", + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint-filter-rule-comments.git" + }, + "author": "azu", + "email": "azuciao@gmail.com", + "homepage": "https://github.com/textlint/textlint-filter-rule-comments", + "license": "MIT", + "bugs": { + "url": "https://github.com/textlint/textlint-filter-rule-comments/issues" + }, + "files": [ + "src/", + "lib/" + ], + "version": "1.3.0", + "description": "textlint rule that ignore texts using comments directive.", + "main": "lib/textlint-filter-rule-comments.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "mocha test/", + "build": "NODE_ENV=production babel src --out-dir lib --source-maps", + "watch": "babel src --out-dir lib --watch --source-maps", + "prepublish": "npm run --if-present build" + }, + "keywords": [ + "textlint", + "ignore" + ], + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/register": "^7.0.0", + "@textlint/ast-node-types": "^14.0.3", + "@textlint/legacy-textlint-core": "^14.0.3", + "mocha": "^10.3.0", + "textlint": "^14.0.3", + "textlint-rule-report-node-types": "^1.1.0" + } +} diff --git a/node_modules/textlint-filter-rule-comments/src/StatusManager.js b/node_modules/textlint-filter-rule-comments/src/StatusManager.js new file mode 100644 index 000000000..09e4021fc --- /dev/null +++ b/node_modules/textlint-filter-rule-comments/src/StatusManager.js @@ -0,0 +1,97 @@ +// LICENSE : MIT +"use strict"; +export default class StatusManager { + constructor(endIndex) { + /** + * @typedef {Object} IgnoringCommentObject + * @property {number|null} startIndex + * @property {number|null} endIndex + * @property {string|null} ruleId + */ + /** + * @type {IgnoringCommentObject[]} + */ + this.reportingConfig = []; + + /** + * @type {TxtNode} + */ + this.endIndex = endIndex; + } + + getIgnoringMessages() { + return this.reportingConfig.map(reporting => { + if (reporting.endIndex === null) { + // [start, ?= document-end] + // filled with document's end + reporting.endIndex = this.endIndex; + } + return reporting; + }); + } + + /** + * Add data to reporting configuration to disable reporting for list of rules + * starting from start location + * @param {Object} startNode Node to start + * @param {string[]} rulesToDisable List of rules + * @returns {void} + */ + disableReporting(startNode, rulesToDisable) { + const reportingConfig = this.reportingConfig; + if (rulesToDisable.length) { + rulesToDisable.forEach(function (ruleId) { + reportingConfig.push({ + startIndex: startNode.range[0], + endIndex: null, + ruleId: ruleId + }); + }); + } else { + reportingConfig.push({ + startIndex: startNode.range[0], + endIndex: null, + ruleId: null + }); + } + } + + /** + * Add data to reporting configuration to enable reporting for list of rules + * starting from start location + * @param {Object} startNode Node to start + * @param {string[]} rulesToEnable List of rules + * @returns {void} + */ + enableReporting(startNode, rulesToEnable) { + var i; + const endIndex = startNode.range[0]; + const reportingConfig = this.reportingConfig; + if (rulesToEnable.length) { + rulesToEnable.forEach(function (ruleId) { + for (i = reportingConfig.length - 1; i >= 0; i--) { + if (!reportingConfig[i].endIndex && reportingConfig[i].ruleId === ruleId) { + reportingConfig[i].endIndex = endIndex; + break; + } + } + }); + } else { + + // find all previous disabled locations if they was started as list of rules + var prevStart; + + for (i = reportingConfig.length - 1; i >= 0; i--) { + if (prevStart && prevStart !== reportingConfig[i].start) { + break; + } + + if (!reportingConfig[i].endIndex) { + reportingConfig[i].endIndex = endIndex; + prevStart = reportingConfig[i].start; + } + } + } + } + +} \ No newline at end of file diff --git a/node_modules/textlint-filter-rule-comments/src/parse-comment.js b/node_modules/textlint-filter-rule-comments/src/parse-comment.js new file mode 100644 index 000000000..e6fd39a5e --- /dev/null +++ b/node_modules/textlint-filter-rule-comments/src/parse-comment.js @@ -0,0 +1,65 @@ +// LICENSE : MIT +"use strict"; +const HTML_COMMENT_REGEXP = //g; +export function isHTMLComment(htmlString) { + return HTML_COMMENT_REGEXP.test(htmlString); +} + +/** + * get comment value from html comment tag + * @param {string} commentValue + * @returns {string[]} + */ +export function getValuesFromHTMLComment(commentValue) { + const results = []; + commentValue.replace(HTML_COMMENT_REGEXP, function(all, comment){ + results.push(comment); + }); + return results; +} +/** + * Parses a config of values separated by comma. + * @param {string} string The string to parse. + * @returns {Object} Result map of values and true values + */ +export function parseListConfig(string) { + const items = {}; + + // Collapse whitespace around , + string = string.replace(/\s*,\s*/g, ","); + string.split(/,+/).forEach(function (name) { + name = name.trim(); + if (!name) { + return; + } + items[name] = true; + }); + return items; +} + +/** + * parse "textlint-enable aRule, bRule" and return ["aRule", "bRule"] + * @param {string} string + * @returns {string[]} + */ +export function parseRuleIds(string) { + return Object.keys(parseListConfig(string)); +} + +/** + * Remove trailing description part that follows `--` in comment directives. + * @param {string} string + * @returns {string} + * @example + * removeCommentDescription(" ruleA -- because of reasons"); // => " ruleA " + */ +export function removeCommentDescription(string) { + if (!string) { + return string; + } + const index = string.indexOf("--"); + if (index === -1) { + return string; + } + return string.slice(0, index); +} diff --git a/node_modules/textlint-filter-rule-comments/src/textlint-filter-rule-comments.js b/node_modules/textlint-filter-rule-comments/src/textlint-filter-rule-comments.js new file mode 100644 index 000000000..14c149fae --- /dev/null +++ b/node_modules/textlint-filter-rule-comments/src/textlint-filter-rule-comments.js @@ -0,0 +1,76 @@ +// LICENSE : MIT +"use strict"; +import StatusManager from "./StatusManager"; +import {parseRuleIds, getValuesFromHTMLComment, isHTMLComment, removeCommentDescription} from "./parse-comment"; +const defaultOptions = { + // enable comment directive + // if comment has the value, then enable textlint rule + "enablingComment": "textlint-enable", + // disable comment directive + // if comment has the value, then disable textlint rule + "disablingComment": "textlint-disable" +}; +module.exports = function(context, options = defaultOptions) { + const {Syntax, shouldIgnore, getSource} = context; + + const enablingComment = options.enablingComment || defaultOptions.enablingComment; + const disablingComment = options.disablingComment || defaultOptions.disablingComment; + + const content = getSource(); + const statusManager = new StatusManager(content.length); + // Get comment value + return { + /* + +This is wrong format. +https://github.com/wooorm/remark treat as one html block. + + +This is ignored. + + +should be + + + +This is ignored. + + + */ + [Syntax.Html](node){ + const nodeValue = getSource(node); + if (!isHTMLComment(nodeValue)) { + return; + } + const comments = getValuesFromHTMLComment(nodeValue); + comments.forEach(commentValue => { + if (commentValue.indexOf(enablingComment) !== -1) { + const configValue = removeCommentDescription(commentValue.replace(enablingComment, "")); + statusManager.enableReporting(node, parseRuleIds(configValue)); + } else if (commentValue.indexOf(disablingComment) !== -1) { + const configValue = removeCommentDescription(commentValue.replace(disablingComment, "")); + statusManager.disableReporting(node, parseRuleIds(configValue)); + } + }); + }, + [Syntax.Comment](node){ + const commentValue = node.value || ""; + if (commentValue.indexOf(enablingComment) !== -1) { + const configValue = removeCommentDescription(commentValue.replace(enablingComment, "")); + statusManager.enableReporting(node, parseRuleIds(configValue)); + } else if (commentValue.indexOf(disablingComment) !== -1) { + const configValue = removeCommentDescription(commentValue.replace(disablingComment, "")); + statusManager.disableReporting(node, parseRuleIds(configValue)); + } + }, + [`${Syntax.Document}:exit`](){ + const ignoringMessages = statusManager.getIgnoringMessages(); + ignoringMessages.forEach(message => { + const range = [message.startIndex, message.endIndex]; + shouldIgnore(range, { + ruleId: message.ruleId || "*" + }); + }) + } + } +}; diff --git a/node_modules/textlint-filter-rule-whitelist/LICENSE b/node_modules/textlint-filter-rule-whitelist/LICENSE new file mode 100644 index 000000000..ffd6b4aa2 --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/textlint-filter-rule-whitelist/README.md b/node_modules/textlint-filter-rule-whitelist/README.md new file mode 100644 index 000000000..133ded84d --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/README.md @@ -0,0 +1,153 @@ +# textlint-filter-rule-whitelist + +[textlint](https://github.com/textlint) [filter rule](https://github.com/textlint/textlint/blob/master/docs/filter-rule.md "Filter rule") that filter any word by white list. + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install textlint-filter-rule-whitelist + +## Usage + +Via `.textlintrc`(Recommended) + +```json +{ + "filters": { + "whitelist": { + "allow": [ + "ignored-word", + "/\\d{4}-\\d{2}-\\d{2}/", + "/===IGNORE===[\\s\\S]*?===\/IGNORE===/m" + ] + } + } +} +``` + +## Options + +- `allow`: `string[]` + - white list String or [RegExp-like String](https://github.com/textlint/regexp-string-matcher#regexp-like-string) +- `whitelistConfigPaths`: `string[]` + - File path list that includes allow words. + - The File path is relative path from your `.textlintrc`. + - Support file format: JSON, yml, js + +For example, you can specify `whitelistConfigPaths` to `.textlintrc`. + +```json +{ + "filters": { + "whitelist": { + "whitelistConfigPaths": [ + "./allow.json", + "./allow.yml" + ] + } + } +} +``` + +These files should be following formats. + +`allow.json`: +``` +[ + "ignore-word", + "/yes/i" +] +``` + +`allow.yml`: +``` +- "ignore-word", +- /yes/i +``` + + +## RegExp-like String + +This filter rule support [RegExp-like String](https://github.com/textlint/regexp-string-matcher#regexp-like-string). +RegExp-like String is that started with `/` and ended with `/` or `/flag`. + +:warning: Yous should escape special characters like `\d` in string literal. +`/\d/` should be `"\\d"`. + +For example, you want to ignore `/\d{4}-\d{2}-\d{2}/` pattern, you can write `allow` as follows: + +```js +[ + "/\\d{4}-\\d{2}-\\d{2}/" +] +``` + +### Example: Ignore pattern + +Some textlint rule has false-positive about unique noun. +You want to ignore the error about unique noun. + +For example, you want to ignore error about `/github/i`, you can write `allow` as follows: + +`allow.json`: +``` +[ + "/github/i` +] +``` + +### Example: Ignore range + +You want to ignore error between `===IGNORE===` mark. + +`allow.json`: +``` +[ + "/===IGNORE===[\\s\\S]*?===/IGNORE===/m` +] +``` + +**text:** +``` +ERROR Text => actual error + +===IGNORE=== +ERROR Text => it is ignored! +===/IGNORE=== + +ERROR Text => actual error +``` + +For more information, see [textlint/regexp-string-matcher – Example](https://github.com/textlint/regexp-string-matcher#examples) + +## Changelog + +See [Releases page](https://github.com/textlint/textlint-filter-rule-whitelist/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/textlint/textlint-filter-rule-whitelist/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu diff --git a/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/LICENSE b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/LICENSE new file mode 100644 index 000000000..97d7cf637 --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/README.md b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/README.md new file mode 100644 index 000000000..c0d8ba561 --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/README.md @@ -0,0 +1,170 @@ +# rc-config-loader [![Build Status](https://travis-ci.org/azu/rc-config-loader.svg?branch=master)](https://travis-ci.org/azu/rc-config-loader) + +Load config from `.{product}rc.{json,yml,js}` file. + +It is a Node.js library for loading `.textlintrc`, `.eslintrc`, `.stylelintrc` etc... + +## Features + +Find and load a configuration object from: + +- a `package.json` property if it is needed +- a JSON or YAML, JS "rc file" + - `.rc` or `.rc.json` or `.rc.js` or`.rc.yml`, `.rc.yaml` +- TypeScript support + - Includes `.d.ts` + +## Difference + +### with [MoOx/rc-loader](https://github.com/MoOx/rc-loader "MoOx/rc-loader") + +- Safe API + - `rc` contains shabang in `.js` file +- Enhance Error message + +### with [cosmiconfig](https://github.com/davidtheclark/cosmiconfig "cosmiconfig") + +- Sync loading + - [cosmiconfig@3+](https://github.com/davidtheclark/cosmiconfig/blob/master/CHANGELOG.md#300) support `sync` option + +## Install + +Install with [npm](https://www.npmjs.com/): + + npm install rc-config-loader + +## Usage + +### API + +```ts +export interface rcConfigLoaderOption { + // does look for `package.json` + packageJSON?: boolean | { + fieldName: string; + }; + // if config file name is not same with packageName, set the name + configFileName?: string; + // treat default(no ext file) as some extension + defaultExtension?: string | string[]; + // where start to load + cwd?: string; +} +export default function rcConfigLoader(packageName: string, options?: rcConfigLoaderOption): Object; +``` + +`rcConfigLoader` return `{ config, filePath }` object. + +- `config`: it is config object +- `filePath`: absolute path to config file + +If not found config file, return `undefined`. + +### Example + +```js +"use strict"; +const rcfile = require("rc-config-loader"); +// load .eslintrc from current dir +console.log(rcfile("eslint")); + +// load .eslintrc from specific path +console.log(rcfile("eslint", { + configFileName: `${__dirname}/test/fixtures/.eslintrc` +})); +/* +config: { extends: 'standard', + rules: + { 'comma-dangle': [ 2, 'always-multiline' ], + 'arrow-parens': [ 2, 'as-needed' ] } } +filePath: ${__dirname}/test/fixtures/.eslintrc + */ + +// load property from pacakge.json +console.log(rcfile("rc-config-loader", { + packageJSON: { + fieldName: "directories" + } +})); +/* +config: { test: 'test' } +filePath: /path/to/package.json + */ + +// load .eslintrc from specific dir +console.log(rcfile("eslint", { + cwd: `${__dirname}/test/fixtures` +})); + +// load specific filename from current dir +console.log(rcfile("travis", {configFileName: ".travis"})); +/* +config: { sudo: false, language: 'node_js', node_js: 'stable' } +filePath: /path/to/.travis + */ + +// try to load as .json, .yml, js +console.log(rcfile("bar", { + configFileName: `${__dirname}/test/fixtures/.barrc`, + defaultExtension: [".json", ".yml", ".js"] +})); + +// try to load as .json, but it is not json +// throw Error +try { + rcfile("unknown", { + // This is not json + configFileName: `${__dirname}/test/fixtures/.unknownrc`, + defaultExtension: ".json" + }) +} catch (error) { + console.log(error); + /* + SyntaxError: Cannot read config file: /test/fixtures/.unknownrc + */ +} + +``` + +## Users + +- [textlint](https://github.com/textlint/textlint "textlint") + +## Changelog + +See [Releases page](https://github.com/azu/rc-config-loader/releases). + +## Running tests + +Install devDependencies and Run `npm test`: + + 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/azu/rc-config-loader/issues). + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## Author + +- [github/azu](https://github.com/azu) +- [twitter/azu_re](https://twitter.com/azu_re) + +## License + +MIT © azu + +## Acknowledgement + +- [zkochan/rcfile: Loads library configuration in all possible ways](https://github.com/zkochan/rcfile "zkochan/rcfile: Loads library configuration in all possible ways") + +**Difference** + +- support multiple `defaultExtension` diff --git a/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/package.json b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/package.json new file mode 100644 index 000000000..163ff3830 --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/package.json @@ -0,0 +1,81 @@ +{ + "directories": { + "test": "test" + }, + "author": "azu", + "license": "MIT", + "files": [ + "bin/", + "lib/", + "src/" + ], + "name": "rc-config-loader", + "version": "2.0.5", + "description": "load config file from .{product}rc.{json,yml,js}", + "main": "lib/rc-config-loader.js", + "scripts": { + "test": "mocha test/", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --copy-files --source-maps", + "watch": "babel src --out-dir lib --watch --source-maps", + "prepublish": "npm run --if-present build", + "prettier": "prettier --write '**/*.{js,jsx,ts,tsx,css}'" + }, + "keywords": [ + "rc", + "config", + "configuration", + "loader", + "json", + "yaml", + "yml" + ], + "repository": { + "type": "git", + "url": "https://github.com/azu/rc-config-loader.git" + }, + "bugs": { + "url": "https://github.com/azu/rc-config-loader/issues" + }, + "homepage": "https://github.com/azu/rc-config-loader", + "dependencies": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.0", + "object-assign": "^4.1.0", + "object-keys": "^1.0.12", + "path-exists": "^3.0.0", + "require-from-string": "^2.0.2" + }, + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/register": "^7.0.0", + "babel-preset-jsdoc-to-assert": "^5.0.0", + "babel-preset-power-assert": "^3.0.0", + "chai": "^4.2.0", + "cross-env": "^5.2.0", + "eslint": "^6.0.1", + "husky": "^3.0.0", + "lint-staged": "^9.1.0", + "mocha": "^6.1.4", + "power-assert": "^1.4.2", + "prettier": "^1.8.2" + }, + "prettier": { + "printWidth": 120, + "tabWidth": 4 + }, + "lint-staged": { + "*.{js,jsx,ts,tsx,css}": [ + "prettier --write", + "git add" + ] + }, + "husky": { + "hooks": { + "post-commit": "git reset", + "pre-commit": "lint-staged" + } + } +} diff --git a/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/src/rc-config-loader.d.ts b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/src/rc-config-loader.d.ts new file mode 100644 index 000000000..fd6fd8ac8 --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/src/rc-config-loader.d.ts @@ -0,0 +1,15 @@ +export interface rcConfigLoaderOption { + // does look for `package.json` + packageJSON?: + | boolean + | { + fieldName: string; + }; + // if config file name is not same with packageName, set the name + configFileName?: string; + // treat default(no ext file) as some extension + defaultExtension?: string | string[]; + // where start to load + cwd?: string; +} +export default function rcConfigLoader(packageName: string, options?: rcConfigLoaderOption): Object; diff --git a/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/src/rc-config-loader.js b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/src/rc-config-loader.js new file mode 100644 index 000000000..34e36428f --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader/src/rc-config-loader.js @@ -0,0 +1,174 @@ +// MIT © 2017 azu +// MIT © Zoltan Kochan +// Original https://github.com/zkochan/rcfile +"use strict"; +const path = require("path"); +const debug = require("debug")("rc-config-loader"); +const requireFromString = require("require-from-string"); +const JSON5 = require("json5"); +const fs = require("fs"); +const pathExists = require("path-exists"); +const objectAssign = require("object-assign"); +const keys = require("object-keys"); + +const defaultLoaderByExt = { + ".js": loadJSConfigFile, + ".json": loadJSONConfigFile, + ".yaml": loadYAMLConfigFile, + ".yml": loadYAMLConfigFile +}; + +const defaultOptions = { + // does look for `package.json` + packageJSON: false, + // treat default(no ext file) as some extension + defaultExtension: [".json", ".yaml", ".yml", ".js"], + cwd: process.cwd() +}; + +/** + * @param {string} pkgName + * @param {rcConfigLoaderOption} [opts] + * @returns {{ config: Object, filePath:string } | undefined} + */ +module.exports = function rcConfigLoader(pkgName, opts = {}) { + // path/to/config or basename of config file. + const configFileName = opts.configFileName || `.${pkgName}rc`; + const defaultExtension = opts.defaultExtension || defaultOptions.defaultExtension; + const cwd = opts.cwd || defaultOptions.cwd; + const packageJSON = opts.packageJSON || defaultOptions.packageJSON; + const packageJSONFieldName = typeof packageJSON === "object" ? packageJSON.fieldName : pkgName; + + const parts = splitPath(cwd); + + const loaders = Array.isArray(defaultExtension) + ? defaultExtension.map(extension => defaultLoaderByExt[extension]) + : defaultLoaderByExt[defaultExtension]; + + const loaderByExt = objectAssign({}, defaultLoaderByExt, { + "": loaders + }); + + return findConfig({ parts, loaderByExt, configFileName, packageJSON, packageJSONFieldName }); +}; + +/** + * + * @param {string[]} parts + * @param {Object} loaderByExt + * @param {string} configFileName + * @param {boolean|Object} packageJSON + * @param {string} packageJSONFieldName + * @returns {{ + * config: string, + * filePath: string + * }|undefined} + */ +function findConfig({ parts, loaderByExt, configFileName, packageJSON, packageJSONFieldName }) { + const exts = keys(loaderByExt); + while (exts.length) { + const ext = exts.shift(); + const configLocation = join(parts, configFileName + ext); + if (!pathExists.sync(configLocation)) { + continue; + } + const loaders = loaderByExt[ext]; + if (!Array.isArray(loaders)) { + const loader = loaders; + const result = loader(configLocation); + if (!result) { + continue; + } + return { + config: result, + filePath: configLocation + }; + } + for (let i = 0; i < loaders.length; i++) { + const loader = loaders[i]; + const result = loader(configLocation, true); + if (!result) { + continue; + } + return { + config: result, + filePath: configLocation + }; + } + } + + if (packageJSON) { + const pkgJSONLoc = join(parts, "package.json"); + if (pathExists.sync(pkgJSONLoc)) { + const pkgJSON = require(pkgJSONLoc); + if (pkgJSON[packageJSONFieldName]) { + return { + config: pkgJSON[packageJSONFieldName], + filePath: pkgJSONLoc + }; + } + } + } + if (parts.pop()) { + return findConfig({ parts, loaderByExt, configFileName, packageJSON, packageJSONFieldName }); + } + return undefined; +} + +function splitPath(x) { + return path.resolve(x || "").split(path.sep); +} + +function join(parts, filename) { + return path.resolve(parts.join(path.sep) + path.sep, filename); +} + +function loadJSConfigFile(filePath, suppress) { + debug(`Loading JavaScript config file: ${filePath}`); + try { + const content = fs.readFileSync(filePath, "utf-8"); + return requireFromString(content, filePath); + } catch (e) { + debug(`Error reading JavaScript file: ${filePath}`); + if (!suppress) { + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } + } +} + +function loadJSONConfigFile(filePath, suppress) { + debug(`Loading JSON config file: ${filePath}`); + + try { + return JSON5.parse(readFile(filePath)); + } catch (e) { + debug(`Error reading JSON file: ${filePath}`); + if (!suppress) { + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } + } +} + +function readFile(filePath) { + return fs.readFileSync(filePath, "utf8"); +} + +function loadYAMLConfigFile(filePath, suppress) { + debug(`Loading YAML config file: ${filePath}`); + + // lazy load YAML to improve performance when not used + const yaml = require("js-yaml"); + + try { + // empty YAML file can be null, so always use + return yaml.safeLoad(readFile(filePath)) || {}; + } catch (e) { + debug(`Error reading YAML file: ${filePath}`); + if (!suppress) { + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } + } +} diff --git a/node_modules/textlint-filter-rule-whitelist/package.json b/node_modules/textlint-filter-rule-whitelist/package.json new file mode 100644 index 000000000..8b845f224 --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/package.json @@ -0,0 +1,72 @@ +{ + "name": "textlint-filter-rule-whitelist", + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint-filter-rule-whitelist.git" + }, + "author": "azu", + "email": "azuciao@gmail.com", + "homepage": "https://github.com/textlint/textlint-filter-rule-whitelist", + "license": "MIT", + "bugs": { + "url": "https://github.com/textlint/textlint-filter-rule-whitelist/issues" + }, + "files": [ + "src/", + "lib/" + ], + "version": "2.0.0", + "main": "lib/textlint-filter-rule-whitelist.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "mocha test/", + "build": "NODE_ENV=production babel src --out-dir lib --source-maps", + "watch": "babel src --out-dir lib --watch --source-maps", + "prepublish": "npm run --if-present build", + "prettier": "prettier --write '**/*.{js,jsx,ts,tsx,css}'", + "precommit": "lint-staged", + "postcommit": "git reset" + }, + "keywords": [ + "textlint", + "filter", + "rule" + ], + "description": "textlint filter rule that filter any word by white list.", + "devDependencies": { + "babel-cli": "^6.11.4", + "babel-preset-es2015": "^6.9.0", + "babel-preset-jsdoc-to-assert": "^4.0.0", + "babel-preset-power-assert": "^2.0.0", + "babel-register": "^6.11.6", + "husky": "^0.14.3", + "lint-staged": "^7.1.2", + "mocha": "^5.2.0", + "power-assert": "^1.5.0", + "prettier": "^1.8.2", + "textlint": "^10.2.1", + "textlint-rule-report-node-types": "^1.1.0", + "textlint-tester": "^4.1.3" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.0.2", + "@textlint/get-config-base-dir": "^2.0.0", + "@textlint/regexp-string-matcher": "^1.0.2", + "rc-config-loader": "^2.0.1" + }, + "peerDependencies": { + "textlint": ">= 9.0.0" + }, + "prettier": { + "printWidth": 120, + "tabWidth": 4 + }, + "lint-staged": { + "*.{js,jsx,ts,tsx,css}": [ + "prettier --write", + "git add" + ] + } +} diff --git a/node_modules/textlint-filter-rule-whitelist/src/textlint-filter-rule-whitelist.js b/node_modules/textlint-filter-rule-whitelist/src/textlint-filter-rule-whitelist.js new file mode 100644 index 000000000..860a4063f --- /dev/null +++ b/node_modules/textlint-filter-rule-whitelist/src/textlint-filter-rule-whitelist.js @@ -0,0 +1,56 @@ +// LICENSE : MIT +"use strict"; +const path = require("path"); +const rcfile = require("rc-config-loader"); +const { getConfigBaseDir } = require("@textlint/get-config-base-dir"); +const { matchPatterns } = require("@textlint/regexp-string-matcher"); +const getAllowWordsFromFiles = (files, baseDirectory) => { + let results = []; + files.forEach(filePath => { + // TODO: use other loader + const contents = rcfile("file", { + configFileName: path.resolve(baseDirectory, filePath) + }); + if (contents && Array.isArray(contents.config)) { + results = results.concat(contents.config); + } else { + throw new Error(`This allow file is not allow word list: ${filePath}`); + } + }); + return results; +}; + +const defaultOptions = { + /** + * White list strings or RegExp-like strings + * + * [ + * "string", + * "/\\d+/", + * "/^===/m", + * ] + */ + allow: [], + /** + * file path list that includes allow words. + */ + whitelistConfigPaths: [] +}; +module.exports = function(context, options) { + const { Syntax, shouldIgnore, getSource } = context; + const baseDirectory = getConfigBaseDir(context) || process.cwd(); + const allowWords = options.allow || defaultOptions.allow; + const whitelistConfigPaths = options.whitelistConfigPaths + ? getAllowWordsFromFiles(options.whitelistConfigPaths, baseDirectory) + : []; + const allAllowWords = allowWords.concat(whitelistConfigPaths); + return { + [Syntax.Document](node) { + const text = getSource(node); + const matchResults = matchPatterns(text, allAllowWords); + matchResults.forEach(result => { + shouldIgnore([result.startIndex, result.endIndex]); + }); + } + }; +}; diff --git a/node_modules/textlint-rule-helper/LICENSE b/node_modules/textlint-rule-helper/LICENSE new file mode 100644 index 000000000..d6a58d093 --- /dev/null +++ b/node_modules/textlint-rule-helper/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/textlint-rule-helper/README.md b/node_modules/textlint-rule-helper/README.md new file mode 100644 index 000000000..96cf1cbc7 --- /dev/null +++ b/node_modules/textlint-rule-helper/README.md @@ -0,0 +1,266 @@ +# textlint-rule-helper [![Actions Status: test](https://github.com/textlint/textlint-rule-helper/workflows/test/badge.svg)](https://github.com/textlint/textlint-rule-helper/actions?query=workflow%3A"test") + +This is helper library for creating [textlint](https://github.com/textlint/textlint "textlint") rule. + +## Installation + +``` +npm install textlint-rule-helper +``` + +### Support textlint version + +- ~2.2: textlint 12>= +- ~2.3: textlint 13>= + +## API + +### class RuleHelper + +Helper for traversing TxtAST. + +#### ruleHelper.getParents(node) : TxtNode[] + +Get parents of node. +The parent nodes are returned in order from the closest parent to the outer ones. +`node` is not contained in the results. + +**Params** + +- node `TxtNode` - the node is start point. + +#### ruleHelper.isChildNode(node, types): boolean + +Return true if `node` is wrapped any one of node `types`. + +**Params** + +- node `TxtNode` - is target node +- types `Array.` - are wrapped target node + +#### ruleHelper.isPlainStrNode(node): boolean + +`isPlainStrNode()` return true if the node is Str node and fill following conditions: + +- the node is Str node +- the node is under the Paragraph node +- the node is not under the BlockQuote + +**Params** + +- node `TxtNode` - is target node + +This function is useful for the common use case. + +If you want to lint Str node, but you do not want to lint styled node, this function is useful. +The styled node is `Link`, `Strong`, `BlockQuote`, `Header`, and it may be written by other people. + +For example, you have added a link to your document, the link's title is written by other people. + +Opposite of it, The plain Str node is just under the Paragraph node, and it was written by you. + +**Examples** + +Return true + +```markdown +str str str +- list text +``` + +Return false + +```markdown +# Header +![alt text](https://example.com) +[link title](https://example.com) +> BlockQuote text +**Strong text** +[linkReference][] +[^footnote text] +``` + +use case + +- [refactor: use isPlainStrNode helper by azu · Pull Request #29 · textlint-ja/textlint-rule-preset-ja-spacing](https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/pull/29) + +### class IgnoreNodeManager + +You can manager ignoring range in texts. + +#### ignore(node): void + +Add the range of `node` to ignoring range list. + +**Params** + +- node `TxtNode` - target node + +#### ignoreRange(range): void + +Add the `range` to ignoring range list + +**Params** + +- range `[number, number]` + +#### ignoreChildrenByTypes(targetNode, ignoredNodeTypes): void + +if the children node has the type that is included in `ignoredNodeTypes`, +Add range of children node of `node` to ignoring range list, + +**Params** + +- targetNode `TxtNode` - target node +- ignoredNodeTypes `Array.` - are node types for ignoring + +#### isIgnoredIndex(index): boolean + +If the `index` is included in ignoring range list, return true. +`index` should be absolute position. + +**Params** + +- index `number` - index value start with 0 + +#### isIgnoredRange(range): boolean + +If the `range` is included in ignoring range list, return true. +`range` should includes absolute positions. + +**Params** + +- range `[number, number]` + +#### isIgnored(node): boolean + +If the `range` of `node` is included in ignoring range list, return true. + +**Params** + +- node `TxtNode` - target node + +### RuleHelper and IgnoreNodeManager Example + +A rule for [textlint](https://github.com/textlint/textlint "textlint"). + +```js +import { RuleHelper } from "textlint-rule-helper"; +import { IgnoreNodeManager } from "textlint-rule-helper"; +export default function(context) { + var helper = new RuleHelper(context); + var ignoreNodeManager = new IgnoreNodeManager(); + var exports = {}; + var reportingErrors = []; + exports[context.Syntax.Paragraph] = function(node) { + // Add `Code` node to ignoring list + ignoreNodeManager.ignoreChildrenByTypes(node, [context.Syntax.Code]); + // do something + reportingErrors.push(node, ruleError); + }; + exports[context.Syntax.Str] = function(node) { + // parent nodes is any one Link or Image. + if (helper.isChildNode(node, [context.Syntax.Link, context.Syntax.Image])) { + return; + } + // get Parents + var parents = helper.getParents(node); + }; + exports[Syntax.Document + ":exit"] = function(node) { + reportingErrors.forEach(function(node, ruleError) { + // if the error is ignored, don't report + if (ignoreNodeManager.isIgnored(node)) { + return; + } + // report actual + }); + }; + return exports; +}; +``` + +## `wrapReportHandler(context, options, handler): TextlintRuleReportHandler` + +**Params** + +- context `TextlintRuleContent` - rule context object +- options `{{ignoreNodeTypes: TxtNodeType[]}}` - options +- handler `(report: (node: AnyTxtNode, ruleError: TextlintRuleError) => void) => any` - handler should return a object + +`wrapReportHandler` is high level API that use `RuleHelper` and `IgnoreNodeManager`. +It aim to easy to ignore some Node type for preventing unnecessary error report. + +Example: ignore `BlockQuote` and `Code` node. + +```js +import { wrapReportHandler } from "textlint-rule-helper"; +const reporter = function (context) { + const { Syntax, getSource } = context; + return wrapReportHandler(context, { + ignoreNodeTypes: [Syntax.BlockQuote, Syntax.Code] + },report => { // <= wrap version of context.report + // handler should return a rule handler object + return { + [Syntax.Paragraph](node) { + const text = getSource(node); + const index = text.search("code"); + /* + * Following text is matched, but it will not reported. + * ---- + * This is `code`. + * > code + * ---- + */ + if(index === -1){ + return; + } + report(node, new context.RuleError(item.name, { + index + })); + } + } + }); +}; +export default reporter; +``` + +The Mechanism of `wrapReportHandler`: ` + +- Ignore all parent nodes that are matched with `ignoreNodeTypes`. +- Ignore all children nodes that are matched with `ignoreNodeTypes`. + - `wrapReportHandler` create custom `report` function that ignore matched node + +## Use-Case + +You can see real use-case of this helper library. + +- [textlint/rule-advanced.md at master · textlint/textlint](https://github.com/textlint/textlint/blob/master/docs/rule-advanced.md "textlint/rule-advanced.md at master · textlint/textlint") +- [textlint-rule-no-mix-dearu-desumasu](https://github.com/azu/textlint-rule-no-mix-dearu-desumasu "textlint-rule-no-mix-dearu-desumasu") + +## ChangeLog + +- [Releases · textlint/textlint-rule-helper](https://github.com/textlint/textlint-rule-helper/releases "Releases · textlint/textlint-rule-helper") + +## Development + +``` +pnpm i --frozen-lockfile +# watch +pnpm run watch +# build +pnpm run build +# test +pnpm run test +``` + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/LICENSE b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/LICENSE new file mode 100644 index 000000000..fca71ec20 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-present azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/README.md b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/README.md new file mode 100644 index 000000000..a0e4d8a8f --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/README.md @@ -0,0 +1,65 @@ +# @textlint/ast-node-types + +The definition for textlint AST Node types. + +This module for parse plugin. + + +For more details, see [TxtNode document](https://github.com/textlint/textlint/blob/master/docs/txtnode.md). + +## Installation + + npm install @textlint/ast-node-types + +## Usage + +```js +import { ASTNodeTypes } from "@textlint/ast-node-types"; +console.log(ASTNodeTypes.Document); // => string +``` + +### Type interface for TxtNode + +This library include type interface of [TxtNode](https://github.com/textlint/textlint/blob/master/docs/txtnode.md). +TypeScript user can use it as type of TxtNode. + +```ts +// type interface +import { TxtNode } from "@textlint/ast-node-types"; + +``` + + +## For parser creator + +Please use it for creating your textlint-plugin parser. + +Use it by + +- textlint internal +- `@textlint/text-to-ast` +- `@textlint/markdown-to-ast` + +## Versioning + +- major: Breaking Change +- minor: Adding new type +- patch: Fixing issues + +## Tests + + npm test + +## Contributing + +If you want to new type for AST, Please file issue :) + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## License + +MIT diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/package.json b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/package.json new file mode 100644 index 000000000..786bff4a6 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/package.json @@ -0,0 +1,37 @@ +{ + "name": "@textlint/ast-node-types", + "version": "15.5.2", + "description": "textlint AST node type definition.", + "keywords": [ + "textlint" + ], + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "type": "commonjs", + "main": "./lib/src/index.js", + "types": "./lib/src/index.d.ts", + "files": [ + "bin/", + "lib/", + "src/", + "!*.tsbuildinfo" + ], + "scripts": { + "build": "tsc -b", + "clean": "rimraf lib/", + "prepack": "npm run build", + "test": "vitest run", + "test:watch": "vitest watch" + }, + "devDependencies": { + "@types/node": "^24.10.13", + "rimraf": "^6.1.3", + "typescript": "~5.8.3", + "vitest": "^3.2.4" + }, + "gitHead": "7320c69be4665acc74186834b435a32d283c1be5" +} diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/ASTNodeTypes.ts b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/ASTNodeTypes.ts new file mode 100644 index 000000000..59f1e6fc7 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/ASTNodeTypes.ts @@ -0,0 +1,73 @@ +// Notes: Add new Node types +// 1. Add new Node type to ASTNodeTypes +// 2. Update txtnode.md +// 3. Add test to packages/@textlint/types/test/Rule/TxtNode-test.ts + +/** + * ASTNodeTypes is a list of ASTNode type. + */ +export enum ASTNodeTypes { + Document = "Document", + DocumentExit = "Document:exit", + Paragraph = "Paragraph", + ParagraphExit = "Paragraph:exit", + BlockQuote = "BlockQuote", + BlockQuoteExit = "BlockQuote:exit", + ListItem = "ListItem", + ListItemExit = "ListItem:exit", + List = "List", + ListExit = "List:exit", + Header = "Header", + HeaderExit = "Header:exit", + CodeBlock = "CodeBlock", + CodeBlockExit = "CodeBlock:exit", + /** + * @deprecated use Html instead of it + */ + HtmlBlock = "HtmlBlock", + HtmlBlockExit = "HtmlBlock:exit", + HorizontalRule = "HorizontalRule", + HorizontalRuleExit = "HorizontalRule:exit", + Comment = "Comment", + CommentExit = "Comment:exit", + /** + * @deprecated + */ + ReferenceDef = "ReferenceDef", + /** + * @deprecated + */ + ReferenceDefExit = "ReferenceDef:exit", + // inline + Str = "Str", + StrExit = "Str:exit", + Break = "Break", // well-known Hard Break + BreakExit = "Break:exit", // well-known Hard Break + Emphasis = "Emphasis", + EmphasisExit = "Emphasis:exit", + Strong = "Strong", + StrongExit = "Strong:exit", + Html = "Html", + HtmlExit = "Html:exit", + Link = "Link", + LinkExit = "Link:exit", + LinkReference = "LinkReference", + LinkReferenceExit = "LinkReference:exit", + Image = "Image", + ImageExit = "Image:exit", + ImageReference = "ImageReference", + ImageReferenceExit = "ImageReference:exit", + Definition = "Definition", + DefinitionExit = "Definition:exit", + Code = "Code", + CodeExit = "Code:exit", + Delete = "Delete", + DeleteExit = "Delete:exit", + // Table is supported in textlint v13+ + Table = "Table", + TableExit = "Table:exit", + TableRow = "TableRow", + TableRowExit = "TableRow:exit", + TableCell = "TableCell", + TableCellExit = "TableCell:exit" +} diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/NodeType.ts b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/NodeType.ts new file mode 100644 index 000000000..5f93409b5 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/NodeType.ts @@ -0,0 +1,265 @@ +// ================================================================================ +// Node Abstract Syntax Tree +// ================================================================================ +/** + * AST Node types list on TxtNode. + * Constant value of types + * @see https://github.com/textlint/textlint/blob/master/docs/txtnode.md + */ +import type { ASTNodeTypes } from "./ASTNodeTypes.js"; + +/** + * Key of ASTNodeTypes or any string + * For example, TxtNodeType is "Document". + */ +export type TxtNodeType = keyof typeof ASTNodeTypes; + +/** + * Any TxtNode types + */ +export type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode; + +/** + * Position's line start with 1. + * Position's column start with 0. + * This is for compatibility with JavaScript AST. + * https://gist.github.com/azu/8866b2cb9b7a933e01fe + */ +export type TxtNodePosition = { + line: number; // start with 1 + column: number; // start with 0 +}; + +/** + * Location + */ +export type TxtNodeLocation = { + start: TxtNodePosition; + end: TxtNodePosition; +}; + +/** + * Range starts with 0 + */ +export type TxtNodeRange = readonly [startIndex: number, endIndex: number]; + +/** + * TxtNode is abstract interface of AST Node. + * Probably, Real TxtNode implementation has more properties. + */ +export interface TxtNode { + type: TxtNodeType; + raw: string; + range: TxtNodeRange; + loc: TxtNodeLocation; + // `parent` is created by runtime + parent?: TxtParentNode; +} + +/** + * Text Node. + * Text Node has inline value. + * For example, `Str` Node is an TxtTextNode. + */ +export interface TxtTextNode extends TxtNode { + value: string; +} + +/** + * Parent Node. + * Parent Node has children that are consist of TxtParentNode or TxtTextNode + */ +export interface TxtParentNode extends TxtNode { + children: Content[]; +} + +// ================================================================================ +// Node types +// ================================================================================ +export type AlignType = "left" | "right" | "center" | null; +export type ReferenceType = "shortcut" | "collapsed" | "full"; + +export type Content = TopLevelContent | ListContent | TableContent | RowContent | PhrasingContent; + +/** + * All node definition types. + */ +export type TopLevelContent = BlockContent; +/** + * All node types that may be used where markdown block content is accepted. + * These types are accepted inside block quotes, list items, and roots. + */ +export type BlockContent = + | TxtParagraphNode + | TxtHeaderNode + | TxtHorizontalRuleNode + | TxtBlockQuoteNode + | TxtListNode + | TxtTableNode + | TxtHtmlNode + | TxtCodeBlockNode; +/** + * All node types that are acceptable inside lists. + */ +export type ListContent = TxtListItemNode; +/** + * All node types that are acceptable inside tables (not table cells). + */ +export type TableContent = TxtTableRowNode; +/** + * All node types that are acceptable inside tables rows (not table cells) + */ +export type RowContent = TxtTableCellNode; +/** + * All node types that are acceptable in a (interactive) phrasing context (so not in links). + */ +export type PhrasingContent = TxtLinkNode | StaticPhrasingContent; +/** + * All node types that are acceptable in a static phrasing context. + */ +export type StaticPhrasingContent = + | TxtStrNode + | TxtEmphasisNode + | TxtStrongNode + | TxtDeleteNode + | TxtHtmlNode + | TxtCodeNode + | TxtBreakNode + | TxtImageNode + | TxtCommentNode; + +export interface TxtDocumentNode extends TxtParentNode { + type: "Document"; +} + +export interface TxtParagraphNode extends TxtParentNode { + type: "Paragraph"; + children: PhrasingContent[]; +} + +export interface TxtHeaderNode extends TxtParentNode { + type: "Header"; + depth: 1 | 2 | 3 | 4 | 5 | 6; + children: PhrasingContent[]; +} + +export interface TxtHorizontalRuleNode extends TxtNode { + type: "HorizontalRule"; +} + +export interface TxtBlockQuoteNode extends TxtParentNode { + type: "BlockQuote"; + children: BlockContent[]; +} + +export interface TxtListNode extends TxtParentNode { + type: "List"; + ordered?: boolean | null | undefined; + start?: number | null | undefined; + spread?: boolean | null | undefined; + children: ListContent[]; +} + +export interface TxtListItemNode extends TxtParentNode { + type: "ListItem"; + checked?: boolean | null | undefined; + spread?: boolean | null | undefined; + children: BlockContent[]; +} + +export interface TxtTableNode extends TxtParentNode { + type: "Table"; + align?: AlignType[] | null | undefined; + children: TableContent[]; +} + +export interface TxtTableRowNode extends TxtParentNode { + type: "TableRow"; + children: RowContent[]; +} + +export interface TxtTableCellNode extends TxtParentNode { + type: "TableCell"; + children: PhrasingContent[]; +} + +export interface TxtHtmlNode extends TxtTextNode { + type: "Html"; +} + +export interface TxtCommentNode extends TxtTextNode { + type: "Comment"; +} + +export interface TxtCodeBlockNode extends TxtTextNode { + type: "CodeBlock"; + lang?: string | null | undefined; + meta?: string | null | undefined; +} + +export interface TxtStrNode extends TxtTextNode { + type: "Str"; +} + +export interface TxtEmphasisNode extends TxtParentNode { + type: "Emphasis"; + children: PhrasingContent[]; +} + +export interface TxtStrongNode extends TxtParentNode { + type: "Strong"; + children: PhrasingContent[]; +} + +export interface TxtDeleteNode extends TxtParentNode { + type: "Delete"; + children: PhrasingContent[]; +} + +// Inline Code +export interface TxtCodeNode extends TxtTextNode { + type: "Code"; +} + +export interface TxtBreakNode extends TxtNode { + type: "Break"; +} + +export interface TxtLinkNode extends TxtParentNode, TxtResource { + type: "Link"; + children: StaticPhrasingContent[]; +} + +export interface TxtLinkReferenceNode extends TxtParentNode, TxtReference { + type: "LinkReference"; + children: StaticPhrasingContent[]; + referenceType: ReferenceType; +} + +export interface TxtImageNode extends TxtNode, TxtResource, TxtAlternative { + type: "Image"; +} + +export interface TxtImageReferenceNode extends TxtNode, TxtAlternative, TxtReference { + type: "ImageReference"; + referenceType: ReferenceType; +} + +export interface TxtDefinitionNode extends TxtNode, TxtResource, TxtReference { + type: "Definition"; +} + +// Mixin +export interface TxtResource { + url: string; + title?: string | null | undefined; +} + +export interface TxtAlternative { + alt?: string | null | undefined; +} + +export interface TxtReference { + identifier: string; + label: string; +} diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/TypeofTxtNode.ts b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/TypeofTxtNode.ts new file mode 100644 index 000000000..207f3e852 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/TypeofTxtNode.ts @@ -0,0 +1,145 @@ +import type { ASTNodeTypes } from "./ASTNodeTypes.js"; +import type { + AnyTxtNode, + TxtBlockQuoteNode, + TxtBreakNode, + TxtCodeBlockNode, + TxtCommentNode, + TxtDeleteNode, + TxtDocumentNode, + TxtEmphasisNode, + TxtHeaderNode, + TxtHorizontalRuleNode, + TxtHtmlNode, + TxtImageNode, + TxtImageReferenceNode, + TxtDefinitionNode, + TxtCodeNode, + TxtLinkNode, + TxtLinkReferenceNode, + TxtListItemNode, + TxtListNode, + TxtParagraphNode, + TxtStrNode, + TxtStrongNode, + TxtTableCellNode, + TxtTableNode, + TxtTableRowNode +} from "./NodeType.js"; + +/** + * Type utility for TxtNodeType + * Return TxtNode interface for the TxtNodeTYpe + * + * @example + * ```ts + * type NodeType = TxtNodeTypeOfNode; + * ``` + */ +export type TypeofTxtNode = + // Root + T extends ASTNodeTypes.Document + ? TxtDocumentNode + : T extends ASTNodeTypes.DocumentExit + ? TxtDocumentNode + : T extends ASTNodeTypes.Paragraph // Paragraph Str. + ? TxtParagraphNode + : T extends ASTNodeTypes.ParagraphExit + ? TxtParagraphNode + : T extends ASTNodeTypes.BlockQuote // > Str + ? TxtBlockQuoteNode + : T extends ASTNodeTypes.BlockQuoteExit + ? TxtBlockQuoteNode + : T extends ASTNodeTypes.List // - item + ? TxtListNode + : T extends ASTNodeTypes.ListExit + ? TxtListNode + : T extends ASTNodeTypes.ListItem // - item + ? TxtListItemNode + : T extends ASTNodeTypes.ListItemExit + ? TxtListItemNode + : T extends ASTNodeTypes.Header // # Str + ? TxtHeaderNode + : T extends ASTNodeTypes.HeaderExit + ? TxtHeaderNode + : T extends ASTNodeTypes.CodeBlock + ? /* ``` + * code block + * ``` + */ + TxtCodeBlockNode + : T extends ASTNodeTypes.CodeBlockExit + ? TxtCodeBlockNode + : T extends ASTNodeTypes.HtmlBlock //
\n
+ ? TxtHtmlNode + : T extends ASTNodeTypes.HtmlBlockExit + ? TxtHtmlNode + : T extends ASTNodeTypes.Link // [link](https://example.com) + ? TxtLinkNode + : T extends ASTNodeTypes.LinkExit + ? TxtLinkNode + : T extends ASTNodeTypes.LinkReference // [link][1] + ? TxtLinkReferenceNode + : T extends ASTNodeTypes.LinkReferenceExit + ? TxtLinkReferenceNode + : T extends ASTNodeTypes.Delete // ~~Str~~ + ? TxtDeleteNode + : T extends ASTNodeTypes.DeleteExit + ? TxtDeleteNode + : T extends ASTNodeTypes.Emphasis // *Str* + ? TxtEmphasisNode + : T extends ASTNodeTypes.EmphasisExit + ? TxtEmphasisNode + : T extends ASTNodeTypes.Strong // __Str__ + ? TxtStrongNode + : T extends ASTNodeTypes.StrongExit + ? TxtStrongNode + : T extends ASTNodeTypes.Break // Str + ? TxtBreakNode + : T extends ASTNodeTypes.BreakExit + ? TxtBreakNode + : T extends ASTNodeTypes.Image // ![alt](https://example.com/img) + ? TxtImageNode + : T extends ASTNodeTypes.ImageExit + ? TxtImageNode + : T extends ASTNodeTypes.ImageReference // ![alt][1] + ? TxtImageReferenceNode + : T extends ASTNodeTypes.ImageReferenceExit + ? TxtImageReferenceNode + : T extends ASTNodeTypes.Definition // [1]: https://example.com + ? TxtDefinitionNode + : T extends ASTNodeTypes.DefinitionExit + ? TxtDefinitionNode + : T extends ASTNodeTypes.HorizontalRule // ---- + ? TxtHorizontalRuleNode + : T extends ASTNodeTypes.HorizontalRuleExit + ? TxtHorizontalRuleNode + : T extends ASTNodeTypes.Comment // Markdown does not have comment(It is Html comment). Some plugins use comment as a marker. + ? TxtCommentNode + : T extends ASTNodeTypes.CommentExit + ? TxtCommentNode + : T extends ASTNodeTypes.Str // Str + ? TxtStrNode + : T extends ASTNodeTypes.StrExit + ? TxtStrNode + : T extends ASTNodeTypes.Code // `code` + ? TxtCodeNode + : T extends ASTNodeTypes.CodeExit + ? TxtCodeNode + : T extends ASTNodeTypes.Html // Str + ? TxtHtmlNode + : T extends ASTNodeTypes.HtmlExit + ? TxtHtmlNode + : T extends ASTNodeTypes.Table + ? TxtTableNode + : T extends ASTNodeTypes.TableExit + ? TxtTableNode + : T extends ASTNodeTypes.TableRow + ? TxtTableRowNode + : T extends ASTNodeTypes.TableRowExit + ? TxtTableRowNode + : T extends ASTNodeTypes.TableCell + ? TxtTableCellNode + : T extends ASTNodeTypes.TableCellExit + ? TxtTableCellNode + : AnyTxtNode; diff --git a/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/index.ts b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/index.ts new file mode 100644 index 000000000..4dbb15fe8 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types/src/index.ts @@ -0,0 +1,39 @@ +export { ASTNodeTypes } from "./ASTNodeTypes.js"; +export type { + // abstract node types + AnyTxtNode, + TxtNode, + TxtNodeType, + TxtParentNode, + TxtTextNode, + // properties + TxtNodeRange, + TxtNodeLocation, + TxtNodePosition, + // node types + TxtBlockQuoteNode, + TxtBreakNode, + TxtCodeBlockNode, + TxtCommentNode, + TxtDeleteNode, + TxtDocumentNode, + TxtEmphasisNode, + TxtHeaderNode, + TxtHorizontalRuleNode, + TxtHtmlNode, + TxtImageNode, + TxtImageReferenceNode, + TxtDefinitionNode, + TxtLinkNode, + TxtLinkReferenceNode, + TxtListItemNode, + TxtListNode, + TxtParagraphNode, + TxtCodeNode, + TxtStrNode, + TxtStrongNode, + TxtTableNode, + TxtTableRowNode, + TxtTableCellNode +} from "./NodeType.js"; +export type { TypeofTxtNode } from "./TypeofTxtNode.js"; diff --git a/node_modules/textlint-rule-helper/node_modules/boundary/LICENSE.BSD b/node_modules/textlint-rule-helper/node_modules/boundary/LICENSE.BSD new file mode 100644 index 000000000..3e580c355 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/boundary/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 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 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/textlint-rule-helper/node_modules/boundary/LICENSE.LIBCXX b/node_modules/textlint-rule-helper/node_modules/boundary/LICENSE.LIBCXX new file mode 100644 index 000000000..41ca5d19c --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/boundary/LICENSE.LIBCXX @@ -0,0 +1,76 @@ +============================================================================== +libc++ License +============================================================================== + +The libc++ library is dual licensed under both the University of Illinois +"BSD-Like" license and the MIT license. As a user of this code you may choose +to use it under either license. As a contributor, you agree to allow your code +to be used under both. + +Full text of the relevant licenses is included below. + +============================================================================== + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== + +Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/textlint-rule-helper/node_modules/boundary/README.md b/node_modules/textlint-rule-helper/node_modules/boundary/README.md new file mode 100644 index 000000000..7e47b81fe --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/boundary/README.md @@ -0,0 +1,73 @@ +# boundary [![Actions Status: test](https://github.com/textlint/boundary/workflows/test/badge.svg)](https://github.com/textlint/boundary/actions?query=workflow%3A"test") + +## About + +Provides binary search functions. + +## Installation + +```sh +npm install boundary +``` + +## Usage + +```js +import boundary from 'boundary'; +function lessThan(v1, v2) { + return v1 < v2; +} + +// boundary.upperBound(sortedArray, value, compare = lessThan); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], -1) === 0); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], 0) === 2); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], 1) === 2); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], 2) === 3); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], 3) === 4); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], 4) === 5); +assert(boundary.upperBound([ 0, 0, 2, 3, 4 ], 5) === 5); + +// boundary.lowerBound(sortedArray, value, compare = lessThan); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], -1) === 0); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], 0) === 0); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], 1) === 2); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], 2) === 2); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], 3) === 3); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], 4) === 4); +assert(boundary.lowerBound([ 0, 0, 2, 3, 4 ], 5) === 5); + +// boundary.binarySearch(sortedArray, value, compare = lessThan); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], -1) === false); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], 0) === true); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], 1) === false); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], 2) === true); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], 3) === true); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], 4) === true); +assert(boundary.binarySearch([ 0, 0, 2, 3, 4 ], 5) === false); +``` + +### License + +Copyright (C) 2012-2014 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 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 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/textlint-rule-helper/node_modules/boundary/package.json b/node_modules/textlint-rule-helper/node_modules/boundary/package.json new file mode 100644 index 000000000..f88c66ab1 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/boundary/package.json @@ -0,0 +1,45 @@ +{ + "name": "boundary", + "version": "2.0.0", + "description": "Provides boundary functions, (upper-bound and lower-bound).", + "keywords": [ + "algorithm" + ], + "homepage": "https://github.com/textlint/boundary", + "bugs": { + "url": "https://github.com/textlint/boundary/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/boundary.git" + }, + "license": "BSD-2-Clause", + "author": "Yusuke SUZUKI", + "maintainers": [ + { + "name": "Yusuke SUZUKI", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "tsc -p .", + "prepublishOnly": "npm run build", + "test": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -p . --watch" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "mocha": "^10.2.0", + "ts-node": "^10.9.1", + "ts-node-test-register": "^10.0.0", + "typescript": "^4.9.4" + }, + "packageManager": "npm@8.19.2" +} diff --git a/node_modules/textlint-rule-helper/node_modules/structured-source/LICENSE.BSD b/node_modules/textlint-rule-helper/node_modules/structured-source/LICENSE.BSD new file mode 100644 index 000000000..3e580c355 --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/structured-source/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 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 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/textlint-rule-helper/node_modules/structured-source/README.md b/node_modules/textlint-rule-helper/node_modules/structured-source/README.md new file mode 100644 index 000000000..0b4952a9b --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/structured-source/README.md @@ -0,0 +1,70 @@ +# StructuredSource [![npm version](https://badge.fury.io/js/structured-source.svg)](http://badge.fury.io/js/structured-source) [![Actions Status: test](https://github.com/textlint/structured-source/workflows/test/badge.svg)](https://github.com/textlint/structured-source/actions?query=workflow%3A"test") + +## About + +Provides StructuredSource and functionality for converting range and loc vice versa. + +## Installation + +```sh +npm install structured-source +``` + + +## Usage + +```js +import assert from "node:assert"; +import { StructuredSource } from "structured-source"; + +const src = new StructuredSource('aaa\u2028aaaa\u2029aaaaa\n'); + +// positionToIndex({ line: number, column: number) -> number +assert(src.positionToIndex({ line: 1, column: 2 }) === 2); + +// indexToPosition(number) -> { line: number, column: number } +assert.deepStrictEqual(src.indexToPosition(2), { line: 1, column: 2 }); + +// rangeToLocation([ number, number ]) -> { start: { line: number, column: number}, end: { line: number, column: number } } +assert.deepStrictEqual(src.rangeToLocation([0, 2]), { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } +}); + +// locationToRange({ start: { line: number, column: number}, end: { line: number, column: number } }) -> [ number, number ] +assert.deepStrictEqual(src.locationToRange({ + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } +}), [0, 2]); +``` + +## Note + +- Line number starts with **1**. +- Column number starts with **0**. + +### License + +Copyright (C) 2012-2014 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 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 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/textlint-rule-helper/node_modules/structured-source/package.json b/node_modules/textlint-rule-helper/node_modules/structured-source/package.json new file mode 100644 index 000000000..c951a94be --- /dev/null +++ b/node_modules/textlint-rule-helper/node_modules/structured-source/package.json @@ -0,0 +1,52 @@ +{ + "name": "structured-source", + "version": "4.0.0", + "description": "Provides StructuredSource and functionality for converting range and loc vice versa.", + "keywords": [ + "location", + "range", + "abstract", + "syntax", + "tree" + ], + "homepage": "https://github.com/textlint/structured-source", + "bugs": { + "url": "https://github.com/textlint/structured-source/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/structured-source.git" + }, + "license": "BSD-2-Clause", + "author": "Yusuke SUZUKI", + "maintainers": [ + { + "name": "Yusuke SUZUKI", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "main": "lib/structured-source.js", + "types": "lib/structured-source.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "tsc -p .", + "prepublishOnly": "npm run build", + "test": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -p . --watch" + }, + "dependencies": { + "boundary": "^2.0.0" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "mocha": "^10.2.0", + "ts-node": "^10.9.1", + "ts-node-test-register": "^10.0.0", + "typescript": "^4.9.4" + }, + "packageManager": "npm@8.19.2" +} diff --git a/node_modules/textlint-rule-helper/package.json b/node_modules/textlint-rule-helper/package.json new file mode 100644 index 000000000..a17ee8368 --- /dev/null +++ b/node_modules/textlint-rule-helper/package.json @@ -0,0 +1,45 @@ +{ + "name": "textlint-rule-helper", + "version": "2.5.0", + "description": "A helper library for textlint rule.", + "homepage": "https://github.com/textlint/textlint-rule-helper/", + "bugs": { + "url": "https://github.com/textlint/textlint-rule-helper/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint-rule-helper.git" + }, + "license": "MIT", + "author": "azu", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "build": "tsc -p .", + "prepublish": "pnpm run --if-present build", + "test": "mocha \"test/**/*.ts\"", + "watch": "tsc -p . --watch" + }, + "dependencies": { + "@textlint/ast-node-types": "^15.2.1", + "structured-source": "^4.0.0", + "unist-util-visit": "^2.0.3" + }, + "devDependencies": { + "@textlint/kernel": "^15.2.1", + "@textlint/markdown-to-ast": "^15.2.1", + "@textlint/textlint-plugin-markdown": "^15.2.1", + "@textlint/types": "^15.2.1", + "@types/mocha": "^10.0.10", + "@types/node": "^24.3.0", + "mocha": "^11.7.1", + "ts-node": "^10.9.2", + "ts-node-test-register": "^10.0.0", + "typescript": "^5.9.2" + }, + "packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748" +} diff --git a/node_modules/textlint-rule-helper/src/IgnoreNodeManager.ts b/node_modules/textlint-rule-helper/src/IgnoreNodeManager.ts new file mode 100644 index 000000000..eb4dcedf7 --- /dev/null +++ b/node_modules/textlint-rule-helper/src/IgnoreNodeManager.ts @@ -0,0 +1,93 @@ +// LICENSE : MIT +"use strict"; +import visit from "unist-util-visit"; +import { TxtNode, TxtNodeRange, TxtNodeType, TxtParentNode } from "@textlint/ast-node-types" + +/** + * Ignore node manager that manager ignored ranges. + * + */ +export default class IgnoreNodeManager { + private _ignoredRangeList: TxtNodeRange[]; + + constructor() { + /** + * @type {[number,number][]} + * @private + */ + this._ignoredRangeList = [] + } + + /** + * @returns {(number)[][]} + */ + get ignoredRanges() { + return this._ignoredRangeList; + } + + /** + * |.......| + * ^ ^ + * Ignored Range + * + * |........| + * ^ + * index + * @param {number} index + * @returns {boolean} + */ + isIgnoredIndex(index: number) { + return this._ignoredRangeList.some(range => { + const [start, end] = range; + return start <= index && index < end; + }) + } + + /** + * @param {[number, number]} aRange + * @returns {boolean} + * @deprecated This method will be removed + */ + isIgnoredRange(aRange: TxtNodeRange) { + return this.isIgnoredIndex(aRange[0]) || this.isIgnoredIndex(aRange[1]); + } + + /** + * @param {Object} node + * @returns {boolean} + */ + isIgnored(node: TxtNode | TxtParentNode) { + return this.isIgnoredRange(node.range); + } + + /** + * add node to ignore range list + * @param {TxtNode} node + */ + ignore(node: TxtNode | TxtParentNode) { + this.ignoreRange(node.range); + } + + /** + * add range to ignore range list + * @param {[number, number]} range + */ + ignoreRange(range: TxtNodeRange) { + this._ignoredRangeList.push(range); + } + + /** + * ignore children node of `node`, + * if the children node has the type that is included in `ignoredNodeTypes`. + * @param {TxtNode} targetNode + * @param {string[]} ignoredNodeTypes + */ + ignoreChildrenByTypes(targetNode: TxtNode | TxtParentNode, ignoredNodeTypes: TxtNodeType[]) { + visit(targetNode, (visitedNode) => { + // @ts-expect-error: type is TxtNodeType + if (ignoredNodeTypes.includes(visitedNode.type)) { + this.ignore(visitedNode as TxtNode | TxtParentNode); + } + }); + } +} diff --git a/node_modules/textlint-rule-helper/src/SourceLocation.ts b/node_modules/textlint-rule-helper/src/SourceLocation.ts new file mode 100644 index 000000000..501d085b7 --- /dev/null +++ b/node_modules/textlint-rule-helper/src/SourceLocation.ts @@ -0,0 +1,51 @@ +// LICENSE : MIT +"use strict"; +import { StructuredSource } from "structured-source"; +import type { TextlintRuleErrorDetails } from "@textlint/types"; +import { AnyTxtNode } from "@textlint/ast-node-types"; + +export class SourceLocation { + private source: StructuredSource; + + constructor(text: string) { + this.source = new StructuredSource(text); + } + + toAbsoluteLocation(node: AnyTxtNode, padding: TextlintRuleErrorDetails) { + const nodeRange = node.range; + const line = node.loc.start.line; + const column = node.loc.start.column; + + // when use {index} + if (padding.index !== undefined) { + const paddingIndex = padding.index; + return nodeRange[0] + paddingIndex; + } + // when use {line, column} + if (padding.line !== undefined && padding.column !== undefined) { + const addedLine = line + padding.line; + // when report with padding {line, column}, message.column should be 0 + padding.column. + // In other word, padding line > 0 and message.column start with 0. + if (padding.column > 0) { + return this.source.positionToIndex({ + line: addedLine, + column: padding.column + }); + } else { + return this.source.positionToIndex({ + line: addedLine, + column: column + }); + } + } + // when use { line } only + if (padding.line !== undefined && padding.line > 0) { + const addedLine = line + padding.line; + return this.source.positionToIndex({ + line: addedLine, + column: column + }); + } + return nodeRange[0]; + } +} diff --git a/node_modules/textlint-rule-helper/src/index.ts b/node_modules/textlint-rule-helper/src/index.ts new file mode 100644 index 000000000..d9bcbb56f --- /dev/null +++ b/node_modules/textlint-rule-helper/src/index.ts @@ -0,0 +1,10 @@ +"use strict"; +import RuleHelper from "./textlint-rule-helper"; +import IgnoreNodeManager from "./IgnoreNodeManager" +import { wrapReportHandler } from "./wrap-report-handler" + +export { + IgnoreNodeManager, + RuleHelper, + wrapReportHandler +}; diff --git a/node_modules/textlint-rule-helper/src/textlint-rule-helper.ts b/node_modules/textlint-rule-helper/src/textlint-rule-helper.ts new file mode 100644 index 000000000..b2885f4a4 --- /dev/null +++ b/node_modules/textlint-rule-helper/src/textlint-rule-helper.ts @@ -0,0 +1,107 @@ +import type { TextlintRuleContext } from "@textlint/types" +import { ASTNodeTypes, TxtNode } from "@textlint/ast-node-types" + +/** + * RuleHelper is helper class for textlint. + * @class RuleHelper + */ +export default class RuleHelper { + // @ts-expect-error + private _ruleContext: Readonly; + + /** + * Initialize RuleHelper with RuleContext object. + * @param ruleContext the ruleContext is context object of the rule. + */ + constructor(ruleContext: Readonly) { + this._ruleContext = ruleContext; + } + + /** + * Get parents of node. + * The parent nodes are returned in order from the closest parent to the outer ones. + * {@link node} is not contained in the results. + * @param {TxtNode} node the node is start point. + */ + getParents(node: TxtNode) { + const result = []; + let parent = node.parent; + while (parent != null) { + result.push(parent); + parent = parent.parent; + } + return result; + } + + /** + * Return true if `node` is wrapped any one of node {@link types}. + * @param {TxtNode} node is target node + * @param {string[]} types are wrapped target node + * @returns {boolean} + */ + isChildNode(node: TxtNode, types: string[]) { + const parents = this.getParents(node); + const parentsTypes = parents.map(function (parent) { + return parent.type; + }); + return types.some(function (type) { + return parentsTypes.some(function (parentType) { + return parentType === type; + }); + }); + } + + /** + * Return true if the node is Str node and fill following conditions + * + * - the node is Str node + * - the node is under the Paragraph node + * - the node is not under the BlockQuote + * + * This function is useful for common use-case. + * If you want to lint Str node, but you not want to lint styled node, this function is useful. + * styled node is Link, Strong, BlockQuote, Header etc... + * Opposite of it, plain str node is just under the Paragraph node. + * + * @example + * + * Return true + * + * --- + * str str str + * - list text + * --- + * + * Return false + * + * ---- + * # Header + * ![alt text](https://example.com) + * [link title](https://example.com) + * > BlockQuote + * **Strong** + * [^footnote]: text text + * ---- + * + * Summary: + * + * Return true if the node is plain text. + * In other words, return false if the node is styled + * + * @param node + */ + isPlainStrNode(node: TxtNode): boolean { + if (node.type !== ASTNodeTypes.Str) { + return false; + } + if (node.parent?.type !== ASTNodeTypes.Paragraph) { + return false; + } + + const isInUncontrollableNode = this.isChildNode(node, [ + //
is Block node in html. It can has Pragaraph node as children + ASTNodeTypes.BlockQuote + ]); + return !isInUncontrollableNode + } +} diff --git a/node_modules/textlint-rule-helper/src/wrap-report-handler.ts b/node_modules/textlint-rule-helper/src/wrap-report-handler.ts new file mode 100644 index 000000000..fdbaf9116 --- /dev/null +++ b/node_modules/textlint-rule-helper/src/wrap-report-handler.ts @@ -0,0 +1,61 @@ +// MIT © 2018 azu +"use strict"; +import { AnyTxtNode, TxtNodeType } from "@textlint/ast-node-types"; +import type { TextlintRuleContext, TextlintRuleError, TextlintRuleReportHandler } from "@textlint/types"; +import RuleHelper from "./textlint-rule-helper"; +import IgnoreNodeManager from "./IgnoreNodeManager"; +import { SourceLocation } from "./SourceLocation"; + +export interface wrapReportHandlerOptions { + /** + * Define ignore node's type. + * It the node.type is matched, report error that is related with the location of node. + * You also should use `report` function that is passed as wrapReportHandler 3rd argument. + */ + ignoreNodeTypes: TxtNodeType[] +} + +/** + * + * @param context + * @param options + * @param handler + */ +export function wrapReportHandler, R extends TextlintRuleReportHandler>( + context: T, + options: wrapReportHandlerOptions, + handler: (report: (node: AnyTxtNode, ruleError: TextlintRuleError) => void) => R +) { + const ignoreNodeTypes = options.ignoreNodeTypes || []; + const ignoreNodeManager = new IgnoreNodeManager(); + const ruleHelper = new RuleHelper(context); + const text = context.getSource(); + const sourceLocation = new SourceLocation(text); + const reportIfUnignored = function reportIfUnignored(node: AnyTxtNode, ruleError: TextlintRuleError): void | Promise { + const index = sourceLocation.toAbsoluteLocation(node, ruleError); + if (ignoreNodeManager.isIgnoredIndex(index)) { + return; + } + return context.report(node, ruleError); + }; + + const handlers = handler(reportIfUnignored); + Object.keys(handlers).forEach(nodeType => { + const nodeHandler = handlers[nodeType]; + const wrappedNodeHandler = (node: AnyTxtNode) => { + // child nodes + ignoreNodeManager.ignoreChildrenByTypes(node, ignoreNodeTypes); + // parent node + if (ruleHelper.isChildNode(node, ignoreNodeTypes)) { + return; + } + if (!nodeHandler) { + return; + } + return nodeHandler(node); + }; + // @ts-expect-error: ignore + handlers[nodeType] = wrappedNodeHandler + }); + return handlers; +} diff --git a/node_modules/textlint-rule-terminology/License.md b/node_modules/textlint-rule-terminology/License.md new file mode 100644 index 000000000..16ba13b8b --- /dev/null +++ b/node_modules/textlint-rule-terminology/License.md @@ -0,0 +1,9 @@ +# The MIT License + +Copyright 2019 Artem Sapegin, 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/textlint-rule-terminology/Readme.md b/node_modules/textlint-rule-terminology/Readme.md new file mode 100644 index 000000000..e768310a8 --- /dev/null +++ b/node_modules/textlint-rule-terminology/Readme.md @@ -0,0 +1,114 @@ +# textlint-rule-terminology + +[![textlint fixable rule](https://img.shields.io/badge/textlint-fixable-green.svg?style=social)](https://textlint.github.io/) [![Build Status](https://travis-ci.org/sapegin/textlint-rule-terminology.svg)](https://travis-ci.org/sapegin/textlint-rule-terminology) [![npm](https://img.shields.io/npm/v/textlint-rule-terminology.svg)](https://www.npmjs.com/package/textlint-rule-terminology) + +[Textlint](https://github.com/textlint/textlint) rule to check and fix terms, brands and technologies spelling in your tech writing in English. + +For example: + +- Javascript → JavaScript +- NPM → npm +- front-end → frontend +- website → site +- Internet → internet + +(You can customize the rules as you wish.) + +![](https://d3vv6lp55qjaqc.cloudfront.net/items/1p0s3e2p1U1m1r3N2Q41/terminology.png) + +## Installation + +```shell +npm install textlint-rule-terminology +``` + +## Usage + +```shell +textlint --fix --rule terminology Readme.md +``` + +## Configuration + +You can configure the rule in your `.textlintrc`: + +```js +{ + "rules": { + "terminology": { + // Load default terms (see terms.jsonc in the repository) + "defaultTerms": true, + // Syntax elements to skip. Overrides the default + "skip": ["Blockquote"], + // List of terms + "terms": [ + // Exact spelling including the case + "JavaScript", + "ESLint", + "Sass", + "Less", + "npm", + // RegExp (case-insensitive) → replacement + ["front[- ]end(\\w*)", "frontend$1"], + ["back[- ]end(\\w*)", "backend$1"], + ["web[- ]?site(s?)", "site$1"], + ["hot[- ]key", "hotkey"], + ["repo\\b", "repository"], + ["CLI tool(s?)", "command line tool$1"], + ["build system(s?)", "build tool$1"], + ["id['’]?s", "IDs"], + ["(\\w+[^.?!]\\)? )webpack", "$1webpack"], + ["(\\w+[^.?!]\\)? )internet", "$internet"] + ], + // OR load terms from a file + "terms": "~/terms.jsonc", + // OR load terms from npm + "terms": "@johnsmith/terms", + // Excludes terms + "exclude": [ + "CSS" + ] + } + } +} +``` + +Check [the default terminology](./terms.jsonc). Read more about [configuring textlint](https://github.com/textlint/textlint/blob/master/docs/configuring.md). + +## Tips & tricks + +Use [textlint-filter-rule-comments](https://github.com/textlint/textlint-filter-rule-comments) to disable terminology check for particular paragraphs: + +```markdown + + +Oh my javascript! + + +``` + +## Other textlint rules + +- [textlint-rule-apostrophe](https://github.com/sapegin/textlint-rule-apostrophe) — correct apostrophe usage +- [textlint-rule-diacritics](https://github.com/sapegin/textlint-rule-diacritics) — words with diacritics +- [textlint-rule-stop-words](https://github.com/sapegin/textlint-rule-stop-words) — filler words, buzzwords and clichés + +## Change log + +The change log can be found on the [Releases page](https://github.com/sapegin/textlint-rule-terminology/releases). + +## Contributing + +Everyone is welcome to contribute. Please take a moment to review the [contributing guidelines](Contributing.md). + +## Sponsoring + +This software has been developed with lots of coffee, buy me one more cup to keep it going. + +Buy Me A Coffee + +## Authors and license + +[Artem Sapegin](https://sapegin.me) and [contributors](https://github.com/sapegin/textlint-rule-terminology/graphs/contributors). + +MIT License, see the included [License.md](License.md) file. diff --git a/node_modules/textlint-rule-terminology/index.js b/node_modules/textlint-rule-terminology/index.js new file mode 100644 index 000000000..b22aee489 --- /dev/null +++ b/node_modules/textlint-rule-terminology/index.js @@ -0,0 +1,207 @@ +// @ts-check +const fs = require('fs'); +const path = require('path'); +const stripJsonComments = require('strip-json-comments'); +const { RuleHelper } = require('textlint-rule-helper'); +const { upperFirst } = require('lodash'); + +const DEFAULT_OPTIONS = { + terms: [], + skip: ['BlockQuote'], + defaultTerms: true, + exclude: [], +}; +const sentenceStartRegExp = /\w+[.?!]\)? $/; + +function reporter(context, opts = {}) { + const options = { ...DEFAULT_OPTIONS, ...opts }; + const terms = getTerms(options.defaultTerms, options.terms, options.exclude); + + // Match all words (plain strings) with a single regexp + const words = terms.filter(rule => typeof rule === 'string'); + const exactWordRules = [[getMultipleWordRegExp(words), words]]; + + // Create a separate regexp of each array rule ([pattern, replacement]) + const advancedRules = terms.filter(rule => typeof rule !== 'string'); + + const rules = [...exactWordRules, ...advancedRules]; + + const helper = new RuleHelper(context); + const { Syntax, RuleError, report, fixer, getSource } = context; + return { + [Syntax.Str](node) { + if ( + helper.isChildNode( + node, + options.skip.map(rule => Syntax[rule]) + ) + ) { + return false; + } + + return new Promise(resolve => { + const text = getSource(node); + + rules.forEach(([pattern, replacements]) => { + const regExp = + typeof pattern === 'string' ? getAdvancedRegExp(pattern) : pattern; + + let match; + // eslint-disable-next-line no-cond-assign + while ((match = regExp.exec(text))) { + const index = match.index; + const matched = match[0]; + + let replacement = getReplacement(pattern, replacements, matched); + + // Capitalize word in the beginning of a sentense if the original word was capitalized + const textBeforeMatch = text.substring(0, index); + const isSentenceStart = + index === 0 || sentenceStartRegExp.test(textBeforeMatch); + if (isSentenceStart && upperFirst(matched) === matched) { + replacement = upperFirst(replacement); + } + + // Skip correct spelling + if (matched === replacement) { + continue; + } + + const range = [index, index + matched.length]; + const fix = fixer.replaceTextRange(range, replacement); + const message = `Incorrect usage of the term: “${matched.trim()}”, use “${replacement.trim()}” instead`; + report(node, new RuleError(message, { index, fix })); + } + }); + + resolve(); + }); + }, + }; +} + +/** + * @param {boolean} defaultTerms + * @param {string | Array} terms + * @param {Array} [exclude] + */ +function getTerms(defaultTerms, terms, exclude) { + const defaults = defaultTerms + ? loadJson(path.resolve(__dirname, 'terms.jsonc')) + : []; + const extras = typeof terms === 'string' ? loadJson(terms) : terms; + // Order matters, the first term to match is used. We prioritize user 'extras' before defaults + const listTerms = [...(Array.isArray(extras) ? extras : []), ...defaults]; + + // Filter on all terms + if (Array.isArray(exclude)) { + return listTerms.filter(term => { + if (Array.isArray(term)) { + return !exclude.includes(term[0]); + } + return !exclude.includes(term); + }); + } + return listTerms; +} + +/** + * @param {string} filepath + */ +function loadJson(filepath) { + const json = readTermsFile(path.resolve(filepath)); + return JSON.parse(stripJsonComments(json)); +} + +/** + * @param {string} filepath + */ +function readTermsFile(filepath) { + try { + return fs.readFileSync(filepath, 'utf8'); + } catch (err) { + if (err.code === 'ENOENT') { + throw new Error(`Terms file not found: ${filepath}`); + } else { + throw err; + } + } +} + +/** + * Match exact word in the middle of the text + * @param {string} pattern + */ +function getExactMatchRegExp(pattern) { + return new RegExp( + // 1. Beginning of the string, or any character that isn't "-" or alphanumeric + // 2. Exact match of the pattern + // 3. Space, ". ", "." at the end of the string, end of the string + `(?<=^|[^-\\w])\\b${pattern}\\b(?= |\\. |\\.$|$)`, + 'ig' + ); +} + +/** + * Match any of given words exactly in the middle of the text + * @param {string[]} words + */ +function getMultipleWordRegExp(words) { + return getExactMatchRegExp(`(?:${words.join('|')})`); +} + +/** + * Match pattern on word boundaries in the middle of the text unless the pattern + * has look behinds + * @param {string} pattern + */ +function getAdvancedRegExp(pattern) { + if ( + // Look behind: (?<=...) and (? word.toLowerCase() === lowerCaseMatch); +} + +module.exports = { + linter: reporter, + fixer: reporter, + test: { + getTerms, + findWord, + getMultipleWordRegExp, + getExactMatchRegExp, + getAdvancedRegExp, + getReplacement, + }, +}; diff --git a/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/index.d.ts b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/index.d.ts new file mode 100644 index 000000000..28ba3c8a8 --- /dev/null +++ b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/index.d.ts @@ -0,0 +1,36 @@ +declare namespace stripJsonComments { + interface Options { + /** + Replace comments with whitespace instead of stripping them entirely. + + @default true + */ + readonly whitespace?: boolean; + } +} + +/** +Strip comments from JSON. Lets you use comments in your JSON files! + +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. + +@param jsonString - Accepts a string with JSON. +@returns A JSON string without comments. + +@example +``` +const json = `{ + // Rainbows + "unicorn": "cake" +}`; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` +*/ +declare function stripJsonComments( + jsonString: string, + options?: stripJsonComments.Options +): string; + +export = stripJsonComments; diff --git a/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/index.js b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/index.js new file mode 100644 index 000000000..bb00b38ba --- /dev/null +++ b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/index.js @@ -0,0 +1,77 @@ +'use strict'; +const singleComment = Symbol('singleComment'); +const multiComment = Symbol('multiComment'); +const stripWithoutWhitespace = () => ''; +const stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, ' '); + +const isEscaped = (jsonString, quotePosition) => { + let index = quotePosition - 1; + let backslashCount = 0; + + while (jsonString[index] === '\\') { + index -= 1; + backslashCount += 1; + } + + return Boolean(backslashCount % 2); +}; + +module.exports = (jsonString, options = {}) => { + if (typeof jsonString !== 'string') { + throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``); + } + + const strip = options.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; + + let insideString = false; + let insideComment = false; + let offset = 0; + let result = ''; + + for (let i = 0; i < jsonString.length; i++) { + const currentCharacter = jsonString[i]; + const nextCharacter = jsonString[i + 1]; + + if (!insideComment && currentCharacter === '"') { + const escaped = isEscaped(jsonString, i); + if (!escaped) { + insideString = !insideString; + } + } + + if (insideString) { + continue; + } + + if (!insideComment && currentCharacter + nextCharacter === '//') { + result += jsonString.slice(offset, i); + offset = i; + insideComment = singleComment; + i++; + } else if (insideComment === singleComment && currentCharacter + nextCharacter === '\r\n') { + i++; + insideComment = false; + result += strip(jsonString, offset, i); + offset = i; + continue; + } else if (insideComment === singleComment && currentCharacter === '\n') { + insideComment = false; + result += strip(jsonString, offset, i); + offset = i; + } else if (!insideComment && currentCharacter + nextCharacter === '/*') { + result += jsonString.slice(offset, i); + offset = i; + insideComment = multiComment; + i++; + continue; + } else if (insideComment === multiComment && currentCharacter + nextCharacter === '*/') { + i++; + insideComment = false; + result += strip(jsonString, offset, i + 1); + offset = i + 1; + continue; + } + } + + return result + (insideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset)); +}; diff --git a/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/license b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/license new file mode 100644 index 000000000..fa7ceba3e --- /dev/null +++ b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/textlint-rule-terminology/node_modules/strip-json-comments/package.json b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/package.json new file mode 100644 index 000000000..ce7875aa0 --- /dev/null +++ b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/package.json @@ -0,0 +1,47 @@ +{ + "name": "strip-json-comments", + "version": "3.1.1", + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "license": "MIT", + "repository": "sindresorhus/strip-json-comments", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "json", + "strip", + "comments", + "remove", + "delete", + "trim", + "multiline", + "parse", + "config", + "configuration", + "settings", + "util", + "env", + "environment", + "jsonc" + ], + "devDependencies": { + "ava": "^1.4.1", + "matcha": "^0.7.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/readme.md b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/readme.md new file mode 100644 index 000000000..cc542e50c --- /dev/null +++ b/node_modules/textlint-rule-terminology/node_modules/strip-json-comments/readme.md @@ -0,0 +1,78 @@ +# strip-json-comments [![Build Status](https://travis-ci.com/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.com/github/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 strip-json-comments +``` + +## Usage + +```js +const json = `{ + // Rainbows + "unicorn": /* ❤ */ "cake" +}`; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` + +## API + +### stripJsonComments(jsonString, options?) + +#### jsonString + +Type: `string` + +Accepts a string with JSON and returns a string without comments. + +#### options + +Type: `object` + +##### whitespace + +Type: `boolean`\ +Default: `true` + +Replace comments with whitespace instead of stripping them entirely. + +## Benchmark + +``` +$ npm run bench +``` + +## 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 + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/textlint-rule-terminology/package.json b/node_modules/textlint-rule-terminology/package.json new file mode 100644 index 000000000..2cf68a4d2 --- /dev/null +++ b/node_modules/textlint-rule-terminology/package.json @@ -0,0 +1,68 @@ +{ + "name": "textlint-rule-terminology", + "version": "2.1.6", + "description": "TextLint rule to check correct terms spelling", + "author": { + "name": "Artem Sapegin", + "url": "http://sapegin.me" + }, + "homepage": "https://github.com/sapegin/textlint-rule-terminology", + "repository": "sapegin/textlint-rule-terminology", + "license": "MIT", + "engines": { + "node": ">=8.9" + }, + "main": "index.js", + "files": [ + "index.js", + "terms.jsonc" + ], + "scripts": { + "pretest": "npm run lint", + "test": "npm run test:jest", + "posttest": "npm run format", + "lint": "eslint . --cache --fix", + "test:jest": "jest", + "test:watch": "jest --watch", + "test:coverage": "jest --coverage", + "format": "prettier --write \"**/*.{js,md}\"" + }, + "keywords": [ + "textlintrule", + "textlint", + "rule", + "misspelling", + "proofreading", + "terminology", + "terms" + ], + "devDependencies": { + "eslint": "^6.8.0", + "eslint-config-tamia": "^7.1.1", + "husky": "^4.0.7", + "jest": "^24.9.0", + "lint-staged": "^9.5.0", + "prettier": "^1.19.1", + "textlint-tester": "^5.1.13" + }, + "dependencies": { + "lodash": "^4.17.15", + "strip-json-comments": "^3.0.1", + "textlint-rule-helper": "^2.1.1" + }, + "husky": { + "hooks": { + "precommit": "lint-staged" + } + }, + "lint-staged": { + "*.{js,md}": [ + "prettier --write", + "git add" + ], + "*.js": [ + "eslint --fix", + "git add" + ] + } +} diff --git a/node_modules/textlint-rule-terminology/terms.jsonc b/node_modules/textlint-rule-terminology/terms.jsonc new file mode 100644 index 000000000..c51255eb4 --- /dev/null +++ b/node_modules/textlint-rule-terminology/terms.jsonc @@ -0,0 +1,187 @@ +[ + // Brands + "Airbnb", + "Android", + "AppleScript", + "AppVeyor", + "AVA", + "BrowserStack", + "Browsersync", + "Codecov", + "CodePen", + "CodeSandbox", + "DefinitelyTyped", + "EditorConfig", + "ESLint", + "GitHub", + "GraphQL", + "GraphiQL", + "iOS", + "JavaScript", + "JetBrains", + "jQuery", + "LinkedIn", + "Lodash", + "MacBook", + "Markdown", + "OpenType", + "PayPal", + "PhpStorm", + "RubyMine", + "Sass", + "SemVer", + "TypeScript", + "UglifyJS", + "Wasm", + "WebAssembly", + "WebStorm", + "WordPress", + "YouTube", + ["Common[ .]js", "CommonJS"], + ["JSDocs?", "JSDoc"], + ["Node(?:js)?", "Node.js"], + ["React[ .]js", "React"], + ["SauceLabs", "Sauce Labs"], + ["StackOverflow", "Stack Overflow"], + ["styled ?components", "styled-components"], + ["HTTP[ /]2(?:\\.0)?", "HTTP/2"], + ["OS X", "macOS"], + ["Mac ?OS", "macOS"], + ["a npm", "an npm"], + + // ECMAScript + "ECMAScript", + ["ES2015", "ES6"], + ["ES7", "ES2016"], + + // Abbreviations + "3D", + ["3-D", "3D"], + "Ajax", + "API", + ["API['’]?s", "APIs"], + "CSS", + "GIF", + "HTML", + "HTTPS", + "IoT", + "I/O", + ["I-O", "I/O"], + "JPEG", + "MIME", + "OK", + "PaaS", + "PDF", + "PNG", + "SaaS", + "URL", + ["URL['’]?s", "URLs"], + ["an URL", "a URL"], + ["wi[- ]?fi", "Wi-Fi"], + + // Names + "McKenzie", + "McConnell", + + // Words and phrases + "ID", // http://stackoverflow.com/questions/1151338/id-or-id-on-user-interface + ["id['’]?s", "IDs"], + ["backwards compatible", "backward compatible"], + ["build system(s)?", "build tool$1"], + ["CLI tool(s)?", "command-line tool$1"], + ["he or she", "they"], + ["he/she", "they"], + ["\\(s\\)he", "they"], + ["repo\\b", "repository"], + ["smartphone(s)?", "mobile phone$1"], + // https://stackoverflow.com/questions/44934828/is-it-spread-syntax-or-the-spread-operator + ["spread operator", "spread syntax"], + ["web[- ]?site(s)?", "site$1"], + + // Single word + ["auto[- ]complete", "autocomplete"], + ["auto[- ]format", "autoformat"], + ["auto[- ]fix", "autofix"], + ["auto[- ]fixing", "autofixing"], + ["back[- ]end(\\w*)", "backend$1"], + ["bug[- ]fix(es)?", "bugfix$1"], + ["change[- ]log(s)?", "changelog$1"], + ["check[- ]box(es)?", "checkbox$1"], + ["code[- ]base(es)?", "codebase$1"], + ["co[- ]locate(d?)", "colocate$1"], + ["end[- ]point(s)?", "endpoint$1"], + ["e[- ]mail(s)?", "email$1"], + ["file[- ]name(s)?", "filename$1"], + ["front[- ]end(\\w*)", "frontend$1"], + ["hack[- ]a[- ]thon(s)?", "hackathon$1"], + ["host[- ]name(s)?", "hostname$1"], + ["hot[- ]key(s)?", "hotkey$1"], + ["life[- ]cycle", "lifecycle"], + ["life[- ]stream(s)?", "lifestream$1"], + ["lock[- ]file(s)?", "lockfile$1"], + ["mark-up", "markup"], // “mark up” as a verb is OK + ["meta[- ]data", "metadata"], + ["micro[- ]service(s)?", "microservice$1"], + ["name[- ]space(s)?", "namespace$1"], + ["pre[- ]condition(s)?", "precondition$1"], + ["pre[- ]defined", "predefined"], + ["pre[- ]release(s)?", "prerelease$1"], + ["re[- ]write", "rewrite"], + ["run[- ]time", "runtime"], + ["screen[- ]shot(s)?", "screenshot$1"], + ["screen[- ]?snap(s)?", "screenshot$1"], + ["sub[- ]class((?:es|ing)?)", "subclass$1"], + ["sub[- ]tree(s)?", "subtree$1"], + ["time[- ]stamp(s)?", "timestamp$1"], + ["touch[- ]screen(s)?", "touchscreen$1"], + ["user[- ]name(s)?", "username$1"], + ["walk-through", "walkthrough"], // “walk through” as a verb is OK + ["white[- ]space", "whitespace"], + ["wild[- ]card(s)?", "wildcard$1"], + + // Multiple words + ["css-?in-?js", "CSS in JS"], + ["code-?review(s)?", "code review$1"], + ["code-?splitting", "code splitting"], + ["end-?user(s)?", "end user$1"], + ["file-?type(s)?", "file type$1"], + ["micro-?frontend(s)?", "micro frontend$1"], + ["open-?source(ed?)", "open source$1"], + ["regexp?(s)?", "regular expression$1"], + ["style-?guide(s)?", "style guide$1"], + ["tree-?shaking", "tree shaking"], + ["source-?map(s)?", "source map$1"], + ["style-?sheet(s)?", "style sheet$1"], + ["user-?base", "user base"], + ["web-?page(s)?", "web page$1"], + + // Hyphenated + ["built ?in", "built-in"], + ["client ?side", "client-side"], + ["command ?line", "command-line"], + ["end ?to ?end", "end-to-end"], + ["end[- ]?2[- ]?end", "end-to-end"], + ["error ?prone", "error-prone"], + ["higher ?order", "higher-order"], + ["key[/ ]?value", "key-value"], + ["server ?side", "server-side"], + ["two ?steps? authentication", "two-step authentication"], + ["two ?steps? verification", "two-step verification"], + ["2 ?steps? authentication", "two-step authentication"], + ["2 ?steps? verification", "two-step verification"], + ["3rd[- ]party", "third-party"], + + // Starts from a lower case letter in the middle of a sentence + ["(?<=(?:\\w+[^.?!])? )base64\\b", "base64"], + ["(?<=(?:\\w+[^.?!])? )internet\\b(?! explorer)", "internet"], + ["(?<=(?:\\w+[^.?!])? )stylelint\\b", "stylelint"], + ["(?<=(?:\\w+[^.?!])? )webpack\\b", "webpack"], + ["(?<=(?:\\w+[^.?!])? )npm\\b", "npm"], + + // Typos + ["environemnt(s)?", "environment$1"], + ["flacky test(s)?", "flaky test$1"], + ["pacakge(s)?", "package$1"], + ["tilda", "tilde"], + ["falsey", "falsy"] +] diff --git a/node_modules/textlint/CHANGELOG.md b/node_modules/textlint/CHANGELOG.md new file mode 100644 index 000000000..75c4ad30d --- /dev/null +++ b/node_modules/textlint/CHANGELOG.md @@ -0,0 +1,1019 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [11.9.1](https://github.com/textlint/textlint/compare/textlint@11.9.0...textlint@11.9.1) (2021-05-08) + + +### Bug Fixes + +* **deps:** update patch updates ([#761](https://github.com/textlint/textlint/issues/761)) ([73e81f9](https://github.com/textlint/textlint/commit/73e81f9b8e980f62b4107fb1a27ca6e3f050bb84)) + + + + + +# [11.9.0](https://github.com/textlint/textlint/compare/textlint@11.8.3...textlint@11.9.0) (2021-03-21) + + +### Features + +* **textlint:** Add .textlintignore support ([#748](https://github.com/textlint/textlint/issues/748)) ([637e9a5](https://github.com/textlint/textlint/commit/637e9a5ccc5cc82a40cc9f36636d78273bc74b90)) + + + + + + +## [11.8.3](https://github.com/textlint/textlint/compare/textlint@11.8.2...textlint@11.8.3) (2021-03-19) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.1 ([da2d6e7](https://github.com/textlint/textlint/commit/da2d6e7)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.27 ([c1c0b86](https://github.com/textlint/textlint/commit/c1c0b86)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.28 ([136e255](https://github.com/textlint/textlint/commit/136e255)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.29 ([74af03b](https://github.com/textlint/textlint/commit/74af03b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.30 ([4872821](https://github.com/textlint/textlint/commit/4872821)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.31 ([95821ad](https://github.com/textlint/textlint/commit/95821ad)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.32 ([0b0a384](https://github.com/textlint/textlint/commit/0b0a384)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.33 ([a05e2d9](https://github.com/textlint/textlint/commit/a05e2d9)) +* **deps:** update dependency mocha to ^8.3.0 ([0464adb](https://github.com/textlint/textlint/commit/0464adb)) +* **deps:** update dependency mocha to ^8.3.1 ([cc509ed](https://github.com/textlint/textlint/commit/cc509ed)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.7 ([f34083e](https://github.com/textlint/textlint/commit/f34083e)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.8 ([460239e](https://github.com/textlint/textlint/commit/460239e)) +* **deps:** update patch updates ([183eb8d](https://github.com/textlint/textlint/commit/183eb8d)) + + + + + + +## [11.8.2](https://github.com/textlint/textlint/compare/textlint@11.8.1...textlint@11.8.2) (2021-02-06) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.25 ([cc5c800](https://github.com/textlint/textlint/commit/cc5c800)) + + + + + + +## [11.8.1](https://github.com/textlint/textlint/compare/textlint@11.7.6...textlint@11.8.1) (2021-01-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.5 ([f9d619b](https://github.com/textlint/textlint/commit/f9d619b)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.6 ([8eafbbd](https://github.com/textlint/textlint/commit/8eafbbd)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* enable TypeScript incremental ([#716](https://github.com/textlint/textlint/issues/716)) ([199da5c](https://github.com/textlint/textlint/commit/199da5c)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +# [11.8.0](https://github.com/textlint/textlint/compare/textlint@11.7.6...textlint@11.8.0) (2021-01-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.16 ([7209803](https://github.com/textlint/textlint/commit/7209803)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.17 ([9ec5481](https://github.com/textlint/textlint/commit/9ec5481)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.19 ([bd050c9](https://github.com/textlint/textlint/commit/bd050c9)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.21 ([464d58a](https://github.com/textlint/textlint/commit/464d58a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.22 ([5e5d214](https://github.com/textlint/textlint/commit/5e5d214)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.5 ([f9d619b](https://github.com/textlint/textlint/commit/f9d619b)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.6 ([8eafbbd](https://github.com/textlint/textlint/commit/8eafbbd)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([24fe2a9](https://github.com/textlint/textlint/commit/24fe2a9)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* enable TypeScript incremental ([#716](https://github.com/textlint/textlint/issues/716)) ([199da5c](https://github.com/textlint/textlint/commit/199da5c)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + +### Features + +* **source-code-fixer:** add `[@textlint](https://github.com/textlint)/source-code-fixer` ([#736](https://github.com/textlint/textlint/issues/736)) ([bf7235a](https://github.com/textlint/textlint/commit/bf7235a)) + + + + + + +## [11.7.7](https://github.com/textlint/textlint/compare/textlint@11.7.6...textlint@11.7.7) (2020-12-22) + + +### Bug Fixes + +* **deps:** update dependency debug to ^4.2.0 ([6db0ba9](https://github.com/textlint/textlint/commit/6db0ba9)) +* **deps:** update dependency debug to ^4.3.0 ([9dea96a](https://github.com/textlint/textlint/commit/9dea96a)) + + +### Chores + +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.0.4 ([fd60f20](https://github.com/textlint/textlint/commit/fd60f20)) +* **deps:** update dependency [@types](https://github.com/types)/mocha to v8.2.0 ([5ced72d](https://github.com/textlint/textlint/commit/5ced72d)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.2 ([6ac372a](https://github.com/textlint/textlint/commit/6ac372a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.5 ([b0e73f5](https://github.com/textlint/textlint/commit/b0e73f5)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.11.8 ([33679af](https://github.com/textlint/textlint/commit/33679af)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.10 ([96ba315](https://github.com/textlint/textlint/commit/96ba315)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.12 ([f62f2e3](https://github.com/textlint/textlint/commit/f62f2e3)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.13 ([608afd4](https://github.com/textlint/textlint/commit/608afd4)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.14 ([8417f8a](https://github.com/textlint/textlint/commit/8417f8a)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.5 ([1ed7006](https://github.com/textlint/textlint/commit/1ed7006)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.6 ([507a41b](https://github.com/textlint/textlint/commit/507a41b)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.7 ([64f97eb](https://github.com/textlint/textlint/commit/64f97eb)) +* **deps:** update dependency [@types](https://github.com/types)/node to ^14.14.8 ([8de7d16](https://github.com/textlint/textlint/commit/8de7d16)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.5 ([f9d619b](https://github.com/textlint/textlint/commit/f9d619b)) +* **deps:** update dependency textlint-rule-preset-jtf-style to ^2.3.6 ([8eafbbd](https://github.com/textlint/textlint/commit/8eafbbd)) +* **deps:** update minor updates ([7ef0be6](https://github.com/textlint/textlint/commit/7ef0be6)) +* **deps:** update minor updates ([2f3dcb6](https://github.com/textlint/textlint/commit/2f3dcb6)) +* **deps:** update minor updates ([7a53517](https://github.com/textlint/textlint/commit/7a53517)) +* **deps:** update minor updates ([#712](https://github.com/textlint/textlint/issues/712)) ([8c42a19](https://github.com/textlint/textlint/commit/8c42a19)) +* **deps:** update patch updates ([3d9660b](https://github.com/textlint/textlint/commit/3d9660b)) +* **deps:** update patch updates ([fe2ad4f](https://github.com/textlint/textlint/commit/fe2ad4f)) +* **deps:** update patch updates ([e438ff2](https://github.com/textlint/textlint/commit/e438ff2)) +* **deps:** update patch updates ([9df50df](https://github.com/textlint/textlint/commit/9df50df)) +* enable TypeScript incremental ([#716](https://github.com/textlint/textlint/issues/716)) ([199da5c](https://github.com/textlint/textlint/commit/199da5c)) +* **deps:** update patch updates ([4f4c206](https://github.com/textlint/textlint/commit/4f4c206)) +* **deps:** update patch updates ([1a0e41f](https://github.com/textlint/textlint/commit/1a0e41f)) +* **deps:** update patch updates ([9157dda](https://github.com/textlint/textlint/commit/9157dda)) +* **deps:** update TypeScript deps ([#705](https://github.com/textlint/textlint/issues/705)) ([1baa72a](https://github.com/textlint/textlint/commit/1baa72a)) +* use [@monorepo-utils](https://github.com/monorepo-utils)/workspaces-to-typescript-project-references ([#699](https://github.com/textlint/textlint/issues/699)) ([eff1943](https://github.com/textlint/textlint/commit/eff1943)) + + + + + + +## [11.7.6](https://github.com/textlint/textlint/compare/textlint@11.7.5...textlint@11.7.6) (2020-07-24) + + +### Bug Fixes + +* improve "module" supports ([5ba5182](https://github.com/textlint/textlint/commit/5ba5182)) + + + + + + +## [11.7.5](https://github.com/textlint/textlint/compare/textlint@11.7.4...textlint@11.7.5) (2020-07-24) + + +### Bug Fixes + +* "clean" command should remove tsconfig.module.tsbuildinfo ([76ac72a](https://github.com/textlint/textlint/commit/76ac72a)) + + + + + + +## [11.7.4](https://github.com/textlint/textlint/compare/textlint@11.7.3...textlint@11.7.4) (2020-07-24) + + +### Bug Fixes + +* **@textlint/kernel:** fix export only type definition ([1234930](https://github.com/textlint/textlint/commit/1234930)) + + + + + + +## [11.7.3](https://github.com/textlint/textlint/compare/textlint@11.7.2...textlint@11.7.3) (2020-07-24) + +**Note:** Version bump only for package textlint + + + + + + +## [11.7.2](https://github.com/textlint/textlint/compare/textlint@11.7.1...textlint@11.7.2) (2020-07-24) + +**Note:** Version bump only for package textlint + + + + + + +## [11.7.1](https://github.com/textlint/textlint/compare/textlint@11.7.0...textlint@11.7.1) (2020-07-24) + + +### Bug Fixes + +* include module ([2de05f7](https://github.com/textlint/textlint/commit/2de05f7)) + + + + + + +# [11.7.0](https://github.com/textlint/textlint/compare/textlint@11.6.3...textlint@11.7.0) (2020-07-24) + + +### Chores + +* **deps:** update devDepencies ([#667](https://github.com/textlint/textlint/issues/667)) ([0503af6](https://github.com/textlint/textlint/commit/0503af6)) +* **textlint:** Change require [@textlint](https://github.com/textlint)/textlint-plugin-text to import ([e26a747](https://github.com/textlint/textlint/commit/e26a747)) +* **textlint-plugin-markdown:** change require to import ([a1646b9](https://github.com/textlint/textlint/commit/a1646b9)) +* **textlint-plugin-text:** Fix typescript project references ([5db0790](https://github.com/textlint/textlint/commit/5db0790)) + + +### Code Refactoring + +* **textlint:** Fix import default to named ([d8f3432](https://github.com/textlint/textlint/commit/d8f3432)) +* **textlint-plugin-markdown:** convert to typescript ([24f3f44](https://github.com/textlint/textlint/commit/24f3f44)) +* **typescript:** Use TypeScript Project References ([#668](https://github.com/textlint/textlint/issues/668)) ([bbffd43](https://github.com/textlint/textlint/commit/bbffd43)) + + +### Documentation + +* **textlint:** fix broken link ([7824aef](https://github.com/textlint/textlint/commit/7824aef)) + + +### Tests + +* migrate mocha.opts to .mocharc.json ([#682](https://github.com/textlint/textlint/issues/682)) ([332ae5e](https://github.com/textlint/textlint/commit/332ae5e)) + + + + + + +## [11.6.3](https://github.com/textlint/textlint/compare/textlint@11.6.2...textlint@11.6.3) (2020-02-07) + + +### Code Refactoring + +* **textlint:** use promise instead of bluebird ([218ce35](https://github.com/textlint/textlint/commit/218ce35)) + + + + + + +## [11.6.2](https://github.com/textlint/textlint/compare/textlint@11.6.1...textlint@11.6.2) (2020-02-01) + +**Note:** Version bump only for package textlint + + + + + + +## [11.6.1](https://github.com/textlint/textlint/compare/textlint@11.6.0...textlint@11.6.1) (2020-01-08) + +**Note:** Version bump only for package textlint + + + + + + +# [11.6.0](https://github.com/textlint/textlint/compare/textlint@11.4.0...textlint@11.6.0) (2020-01-07) + + +### Features + +* **kernel): support `prePrecess(:** { text, ast }` return value ([16301d7](https://github.com/textlint/textlint/commit/16301d7)) +* **textlint:** Add configuration support for "textlint" field in package.json ([#644](https://github.com/textlint/textlint/issues/644)) ([2ca0a37](https://github.com/textlint/textlint/commit/2ca0a37)) + + +### Tests + +* **textlint:** add text for package.json's "textlint" ([#645](https://github.com/textlint/textlint/issues/645)) ([f1a1ca3](https://github.com/textlint/textlint/commit/f1a1ca3)) + + + + + + +# [11.5.0](https://github.com/textlint/textlint/compare/textlint@11.4.0...textlint@11.5.0) (2019-11-03) + + +### Features + +* **textlint:** Add configuration support for "textlint" field in package.json ([#644](https://github.com/textlint/textlint/issues/644)) ([2ca0a37](https://github.com/textlint/textlint/commit/2ca0a37)) + + +### Tests + +* **textlint:** add text for package.json's "textlint" ([#645](https://github.com/textlint/textlint/issues/645)) ([f1a1ca3](https://github.com/textlint/textlint/commit/f1a1ca3)) + + + + + + +# [11.4.0](https://github.com/textlint/textlint/compare/textlint@11.3.1...textlint@11.4.0) (2019-10-14) + + +### Features + +* **textlint:** experimental support `--parallel` and `--max-concurrency` ([ef53631](https://github.com/textlint/textlint/commit/ef53631)) + + + + + + +## [11.3.1](https://github.com/textlint/textlint/compare/textlint@11.2.5...textlint@11.3.1) (2019-07-20) + + +### Bug Fixes + +* **textlint:** fix --rulesdir description ([#607](https://github.com/textlint/textlint/issues/607)) ([742fe59](https://github.com/textlint/textlint/commit/742fe59)) +* **textlint:** fix crypto's DeprecationWarning ([84cfa43](https://github.com/textlint/textlint/commit/84cfa43)) + + +### Chores + +* **deps:** update dependencies ([09bca08](https://github.com/textlint/textlint/commit/09bca08)) +* add publishConfig ([682c114](https://github.com/textlint/textlint/commit/682c114)) + + +### Code Refactoring + +* **test:** fix fixture package ([9dfa0ae](https://github.com/textlint/textlint/commit/9dfa0ae)) +* **textlint:** remove object-assign ([9c6275e](https://github.com/textlint/textlint/commit/9c6275e)) +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) +* use [@textlint](https://github.com/textlint)/module-interop instead of interop-require ([10d34a6](https://github.com/textlint/textlint/commit/10d34a6)) + + +### Features + +* **types:** add generics parameter to TextlintRuleReporter ([#615](https://github.com/textlint/textlint/issues/615)) ([963324b](https://github.com/textlint/textlint/commit/963324b)) + + + + + + +# [11.3.0](https://github.com/textlint/textlint/compare/textlint@11.2.5...textlint@11.3.0) (2019-07-13) + + +### Bug Fixes + +* **textlint:** fix --rulesdir description ([#607](https://github.com/textlint/textlint/issues/607)) ([742fe59](https://github.com/textlint/textlint/commit/742fe59)) + + +### Chores + +* **deps:** update dependencies ([09bca08](https://github.com/textlint/textlint/commit/09bca08)) + + +### Code Refactoring + +* **test:** fix fixture package ([9dfa0ae](https://github.com/textlint/textlint/commit/9dfa0ae)) +* **utils:** move implementation from types to utils ([#611](https://github.com/textlint/textlint/issues/611)) ([cd9adbe](https://github.com/textlint/textlint/commit/cd9adbe)) + + +### Features + +* **types:** add generics parameter to TextlintRuleReporter ([#615](https://github.com/textlint/textlint/issues/615)) ([963324b](https://github.com/textlint/textlint/commit/963324b)) + + + + + + +## [11.2.6](https://github.com/textlint/textlint/compare/textlint@11.2.5...textlint@11.2.6) (2019-07-04) + + +### Bug Fixes + +* **textlint:** fix --rulesdir description ([#607](https://github.com/textlint/textlint/issues/607)) ([742fe59](https://github.com/textlint/textlint/commit/742fe59)) + + +### Chores + +* **deps:** update dependencies ([09bca08](https://github.com/textlint/textlint/commit/09bca08)) + + +### Code Refactoring + +* **test:** fix fixture package ([9dfa0ae](https://github.com/textlint/textlint/commit/9dfa0ae)) + + + + + + +## [11.2.5](https://github.com/textlint/textlint/compare/textlint@11.2.4...textlint@11.2.5) (2019-04-30) + + +### Bug Fixes + +* **textlint:** add `[@textlint](https://github.com/textlint)/types` as dependencies ([7bad9a2](https://github.com/textlint/textlint/commit/7bad9a2)) +* **textlint:** require node >= 8.0.0 ([51275e0](https://github.com/textlint/textlint/commit/51275e0)) + + +### Chores + +* **deps:** update deps && devDeps ([a19463b](https://github.com/textlint/textlint/commit/a19463b)) + + +### Styles + +* apply prettier ([925a5a5](https://github.com/textlint/textlint/commit/925a5a5)) + + +### BREAKING CHANGES + +* **textlint:** textlint require Node.js 8.0.0 and more + + + + + + +## [11.2.4](https://github.com/textlint/textlint/compare/textlint@11.2.3...textlint@11.2.4) (2019-04-30) + + +### Bug Fixes + +* **textlint:** Config#hash return random value if can not get package.json ([f08d2db](https://github.com/textlint/textlint/commit/f08d2db)) +* **textlint:** should not refer `Config#hash` when no use --cache ([43d0842](https://github.com/textlint/textlint/commit/43d0842)) + + +### Code Refactoring + +* **textlint:** move normalization logic to [@textlint](https://github.com/textlint)/types ([9930809](https://github.com/textlint/textlint/commit/9930809)) + + + + + + +## [11.2.3](https://github.com/textlint/textlint/compare/textlint@11.2.2...textlint@11.2.3) (2019-02-10) + + +### Bug Fixes + +* **textlint:** fix regression for ignoreReport ([8d1c195](https://github.com/textlint/textlint/commit/8d1c195)), closes [#586](https://github.com/textlint/textlint/issues/586) [#586](https://github.com/textlint/textlint/issues/586) + + + + + + +## [11.2.2](https://github.com/textlint/textlint/compare/textlint@11.2.1...textlint@11.2.2) (2019-02-10) + + +### Bug Fixes + +* **textlint:** add normalization for rule config key ([a644d3d](https://github.com/textlint/textlint/commit/a644d3d)), closes [#583](https://github.com/textlint/textlint/issues/583) +* **textlint:** add reasonable debug log ([3931810](https://github.com/textlint/textlint/commit/3931810)) + + +### Chores + +* **textlint:** disable eslint at line ([6696c7f](https://github.com/textlint/textlint/commit/6696c7f)) +* **textlint:** expand path ([9cb0e6d](https://github.com/textlint/textlint/commit/9cb0e6d)) +* **textlint:** fix comment ([74a07d9](https://github.com/textlint/textlint/commit/74a07d9)) +* **textlint:** fix name ([75c34fe](https://github.com/textlint/textlint/commit/75c34fe)) +* **textlint:** remove unused object ([8423993](https://github.com/textlint/textlint/commit/8423993)) +* **textlint:** remove unused object ([110179f](https://github.com/textlint/textlint/commit/110179f)) +* **textlint:** use this.config instead of raw option ([596e941](https://github.com/textlint/textlint/commit/596e941)) + + +### Code Refactoring + +* **textlint:** move Prefix constant to pacakge-prefix.ts ([533d822](https://github.com/textlint/textlint/commit/533d822)) +* **textlint:** polish config ([25dc89d](https://github.com/textlint/textlint/commit/25dc89d)) +* **textlint:** polish config utility ([dc204a4](https://github.com/textlint/textlint/commit/dc204a4)) + + +### Documentation + +* **textlint:** add document to config ([403543a](https://github.com/textlint/textlint/commit/403543a)) +* **textlint:** Add README for textlint ([d39e66c](https://github.com/textlint/textlint/commit/d39e66c)) + + + + + + +## [11.2.1](https://github.com/textlint/textlint/compare/textlint@11.2.0...textlint@11.2.1) (2019-01-03) + +**Note:** Version bump only for package textlint + + + + + + +# [11.2.0](https://github.com/textlint/textlint/compare/textlint@11.1.0...textlint@11.2.0) (2019-01-03) + + +### Bug Fixes + +* **textlint:** fix package's keyword ([2a600b8](https://github.com/textlint/textlint/commit/2a600b8)) + + +### Features + +* **ast-node-types:** add `*Exit` type as constant value ([7106f5d](https://github.com/textlint/textlint/commit/7106f5d)) + + + + + + +# [11.1.0](https://github.com/textlint/textlint/compare/textlint@11.0.2...textlint@11.1.0) (2019-01-01) + + +### Bug Fixes + +* **kernel:** fix type error ([214c287](https://github.com/textlint/textlint/commit/214c287)) +* **textlint:** fix typing of converting function ([ab3b4ef](https://github.com/textlint/textlint/commit/ab3b4ef)) + + +### Chores + +* **deps:** update eslint deps ([5bf2d38](https://github.com/textlint/textlint/commit/5bf2d38)) +* **deps:** update TypeScript deps ([3ea7fb0](https://github.com/textlint/textlint/commit/3ea7fb0)) +* **textlint:** remove unused types ([5f86a62](https://github.com/textlint/textlint/commit/5f86a62)) +* **textlint:** restore get severity() ([6057210](https://github.com/textlint/textlint/commit/6057210)) + + +### Code Refactoring + +* **kernel:** simply typing ([f53ed51](https://github.com/textlint/textlint/commit/f53ed51)) + + +### Styles + +* **eslint:** apply eslint to all files ([6a9573f](https://github.com/textlint/textlint/commit/6a9573f)) +* **prettier:** format style by prettier ([19a2901](https://github.com/textlint/textlint/commit/19a2901)) + + + + + +## [11.0.2](https://github.com/textlint/textlint/compare/textlint@11.0.0...textlint@11.0.2) (2018-12-24) + + +### Code Refactoring + +* **textlint:** convert cli tests to TypeScript ([58f2f5e](https://github.com/textlint/textlint/commit/58f2f5e)) +* **textlint:** make arguments optional correctly ([3077921](https://github.com/textlint/textlint/commit/3077921)) + + + + + +## [11.0.1](https://github.com/textlint/textlint/compare/textlint@11.0.0...textlint@11.0.1) (2018-10-12) + + +### Code Refactoring + +* **textlint:** convert cli tests to TypeScript ([58f2f5e](https://github.com/textlint/textlint/commit/58f2f5e)) +* **textlint:** make arguments optional correctly ([3077921](https://github.com/textlint/textlint/commit/3077921)) + + + + + +# [11.0.0](https://github.com/textlint/textlint/compare/textlint@10.2.1...textlint@11.0.0) (2018-07-22) + + +### Bug Fixes + +* **textlint:** add engine.availableExtensions for backward-compatible ([e8652bc](https://github.com/textlint/textlint/commit/e8652bc)) +* **textlint:** fix config type ([0f2fd6f](https://github.com/textlint/textlint/commit/0f2fd6f)) + + +### Chores + +* **deps:** update mocha ([5df8af4](https://github.com/textlint/textlint/commit/5df8af4)) +* **textlint:** add type of public TextlintrcDescriptor ([7268b9e](https://github.com/textlint/textlint/commit/7268b9e)) +* **textlint:** make static availableExtensions() optional ([d471637](https://github.com/textlint/textlint/commit/d471637)) +* remove [@textlint](https://github.com/textlint)/textlintrc-descriptor ([3613e1f](https://github.com/textlint/textlint/commit/3613e1f)) +* **textlint:** use shallowMerge ([95d056d](https://github.com/textlint/textlint/commit/95d056d)) + + +### Code Refactoring + +* **kernel:** merge textlintrc-descriptor to kernel ([3c01067](https://github.com/textlint/textlint/commit/3c01067)) +* **kernel:** separate linter and fixer descriptor ([b5bc8bd](https://github.com/textlint/textlint/commit/b5bc8bd)) +* **textlint:** fix to import util ([6629bd5](https://github.com/textlint/textlint/commit/6629bd5)) +* **textlint:** remove `extensions` from Config ([7bc9ab8](https://github.com/textlint/textlint/commit/7bc9ab8)) +* **textlintrc-descriptor:** Introduce textlintrc-descriptor ([6177794](https://github.com/textlint/textlint/commit/6177794)) + + +### Features + +* **textlint:** show message if `textlint --init` is success ([#529](https://github.com/textlint/textlint/issues/529)) ([102d568](https://github.com/textlint/textlint/commit/102d568)) +* **textlint:** support availableExtensions() instance method in plugin ([a7cd053](https://github.com/textlint/textlint/commit/a7cd053)) + + +### Tests + +* **kernel:** add plugin's option tests ([f362257](https://github.com/textlint/textlint/commit/f362257)) +* **textlint:** add cli output test ([#533](https://github.com/textlint/textlint/issues/533)) ([abd314a](https://github.com/textlint/textlint/commit/abd314a)), closes [#532](https://github.com/textlint/textlint/issues/532) +* **textlint:** add tests for object-to-kernel-format ([5fbb22d](https://github.com/textlint/textlint/commit/5fbb22d)) +* **textlint:** fix plugin tests ([bbfc8f6](https://github.com/textlint/textlint/commit/bbfc8f6)) + + +### BREAKING CHANGES + +* **textlint:** potentially it is a breaking change for tool user + + + + + +## [10.2.1](https://github.com/textlint/textlint/compare/textlint@10.2.0...textlint@10.2.1) (2018-04-02) + + + + +**Note:** Version bump only for package textlint + + +# [10.2.0](https://github.com/textlint/textlint/compare/textlint@10.1.5...textlint@10.2.0) (2018-04-02) + + +### Bug Fixes + +* **textlint:** check textlintrc option exists for internal use ([744da23](https://github.com/textlint/textlint/commit/744da23)) + + +### Features + +* **textlint:** support --no-textlintrc ([466e257](https://github.com/textlint/textlint/commit/466e257)) + + +### Tests + +* **textlint:** add tests for --no-textlintrc ([289deb3](https://github.com/textlint/textlint/commit/289deb3)) +* **textlint:** pass textlintrc options for failure tests ([bc0804d](https://github.com/textlint/textlint/commit/bc0804d)) +* **textlint:** simplify textlint --help test ([0d2114d](https://github.com/textlint/textlint/commit/0d2114d)) + + + + + +## [10.1.5](https://github.com/textlint/textlint/compare/textlint@10.1.4...textlint@10.1.5) (2018-03-25) + + +### Bug Fixes + +* **textlint:** remove utf-8-validate ([7668c1b](https://github.com/textlint/textlint/commit/7668c1b)) + + +### Chores + +* **test:** use `ts-node-test-register` for TypeScript testing ([be746d8](https://github.com/textlint/textlint/commit/be746d8)), closes [#451](https://github.com/textlint/textlint/issues/451) + + + + + +## [10.1.4](https://github.com/textlint/textlint/compare/textlint@10.1.3...textlint@10.1.4) (2018-01-27) + + +### Code Refactoring + +* **ast-traverse:** update usage of [@textlint](https://github.com/textlint)/ast-traverse ([133ab5a](https://github.com/textlint/textlint/commit/133ab5a)) +* **plugin-markdown:** update usage of [@textlint](https://github.com/textlint)/textlint-plugin-markdown ([d34ee08](https://github.com/textlint/textlint/commit/d34ee08)) +* **plugin-text:** update usage of [@textlint](https://github.com/textlint)/textlint-plugin-text ([b040b33](https://github.com/textlint/textlint/commit/b040b33)) + + +### Tests + +* **textlint:** add non-scoped case to module-resolver ([5eeaa02](https://github.com/textlint/textlint/commit/5eeaa02)) + + + + + +## [10.1.3](https://github.com/textlint/textlint/compare/textlint@10.1.2...textlint@10.1.3) (2018-01-18) + + + + +**Note:** Version bump only for package textlint + + +## [10.1.2](https://github.com/textlint/textlint/compare/textlint@10.1.1...textlint@10.1.2) (2018-01-12) + + + + +**Note:** Version bump only for package textlint + + +# [10.1.0](https://github.com/textlint/textlint/compare/textlint@10.0.1...textlint@10.1.0) (2017-12-25) + + +### Bug Fixes + +* **textlint:** Return an exit status when no rules found ([#408](https://github.com/textlint/textlint/issues/408)) ([3dc76e4](https://github.com/textlint/textlint/commit/3dc76e4)), closes [#406](https://github.com/textlint/textlint/issues/406) + + +### Features + +* **textlint:** show available formatter in help ([af6b0da](https://github.com/textlint/textlint/commit/af6b0da)), closes [#85](https://github.com/textlint/textlint/issues/85) + + + + + +## [10.0.1](https://github.com/textlint/textlint/compare/textlint@10.0.0...textlint@10.0.1) (2017-12-19) + + +### Bug Fixes + +* **textlint:** throw an error if file is not encoded in UTF8 ([dfe7e28](https://github.com/textlint/textlint/commit/dfe7e28)) + + + + + +# [10.0.0](https://github.com/textlint/textlint/compare/textlint@10.0.0-next.2...textlint@10.0.0) (2017-12-18) + + + + +**Note:** Version bump only for package textlint + + +# [10.0.0-next.2](https://github.com/textlint/textlint/compare/textlint@10.0.0-next.1...textlint@10.0.0-next.2) (2017-12-18) + + + + +**Note:** Version bump only for package textlint + + +# [10.0.0-next.1](https://github.com/textlint/textlint/compare/textlint@10.0.0-next.0...textlint@10.0.0-next.1) (2017-12-17) + + +### Bug Fixes + +* **textlint:** Replace pkg-conf with read-pkg-up to get package version ([e3e6197](https://github.com/textlint/textlint/commit/e3e6197)) +* **textlint:** use read-pkg-up to get package version ([c1aeaa2](https://github.com/textlint/textlint/commit/c1aeaa2)), closes [#388](https://github.com/textlint/textlint/issues/388) + + + + + +# [10.0.0-next.0](https://github.com/textlint/textlint/compare/textlint@9.1.1...textlint@10.0.0-next.0) (2017-12-15) + + +### Bug Fixes + +* **textlint:** fix bin/cli.js ([3e0f103](https://github.com/textlint/textlint/commit/3e0f103)) +* **textlint:** fix build temp ([a0bc1af](https://github.com/textlint/textlint/commit/a0bc1af)) +* **textlint:** fix tsconfig resolution ([c2f588a](https://github.com/textlint/textlint/commit/c2f588a)) +* **textlint:** move textlint-fixer-formatter from devDeps to deps ([#367](https://github.com/textlint/textlint/issues/367)) ([da23f71](https://github.com/textlint/textlint/commit/da23f71)) +* **textlint:** overwrite tsconfig.json ([de60be3](https://github.com/textlint/textlint/commit/de60be3)) +* **textlint:** support nest read pkg ([bf14941](https://github.com/textlint/textlint/commit/bf14941)) +* **textlint:** Update README ([88cdb2e](https://github.com/textlint/textlint/commit/88cdb2e)) + + +### BREAKING CHANGES + +* **textlint:** It need to upgrade to 10.0.0 + + + + + +## [9.1.1](https://github.com/textlint/textlint/compare/textlint@9.1.0...textlint@9.1.1) (2017-11-05) + + +### Bug Fixes + +* **textlint:** support scoped preset module ([#329](https://github.com/textlint/textlint/issues/329)) ([a2c8f6b](https://github.com/textlint/textlint/commit/a2c8f6b)) + + + + + +# [9.1.0](https://github.com/textlint/textlint/compare/textlint@9.0.1...textlint@9.1.0) (2017-11-03) + + +### Features + +* **textlint:** support shortcut scoped package name ([#326](https://github.com/textlint/textlint/issues/326)) ([0dff2cc](https://github.com/textlint/textlint/commit/0dff2cc)) + + + + + +# [9.0.0](https://github.com/textlint/textlint/compare/textlint@9.0.0-beta.0...textlint@9.0.0) (2017-10-28) + + + + +**Note:** Version bump only for package textlint + + +## [8.2.1](https://github.com/textlint/textlint/compare/textlint@8.2.0...textlint@8.2.1) (2017-05-21) + + +### Bug Fixes + +* **textlint:** fix `config.configFile` is undefined at sometimes (#297) ([cd64560](https://github.com/textlint/textlint/commit/cd64560)), closes [#297](https://github.com/textlint/textlint/issues/297) + + + + + +# [8.2.0](https://github.com/textlint/textlint/compare/textlint@8.1.0...textlint@8.2.0) (2017-05-21) + + +### Features + +* **textlint-kernel:** add `configBaseDir` option (#295) ([85dad8a](https://github.com/textlint/textlint/commit/85dad8a)) + + + + + +# [8.1.0](https://github.com/textlint/textlint/compare/textlint@8.0.1...textlint@8.1.0) (2017-05-18) + + +### Features + +* **textlint-kernel:** Add [@textlint](https://github.com/textlint)/kernel (#292) ([30473c3](https://github.com/textlint/textlint/commit/30473c3)) + + + + + +## [8.0.1](https://github.com/textlint/textlint/compare/textlint@8.0.0...textlint@8.0.1) (2017-05-11) + + +### Bug Fixes + +* **textlint:** remove shelljs dependencies (#287) ([0e88942](https://github.com/textlint/textlint/commit/0e88942)) + + + + + +# 8.0.0 (2017-05-07) + + +### Bug Fixes + +* **babel:** ignore lib directory ([12e581d](https://github.com/textlint/textlint/commit/12e581d)) +* **fixer:** fix thrown error when empty result. (#274) ([7013cee](https://github.com/textlint/textlint/commit/7013cee)), closes [#274](https://github.com/textlint/textlint/issues/274) +* **textilnt:** fix JSDoc ([8a417e0](https://github.com/textlint/textlint/commit/8a417e0)) + + +### Features + +* **packages:** import textlint-plugin-text ([1b7a571](https://github.com/textlint/textlint/commit/1b7a571)) +* **textlint:** update built-in textlint-plugin-markdown@^2 (#282) ([448fef9](https://github.com/textlint/textlint/commit/448fef9)) + + +### BREAKING CHANGES + +* **textlint:** markdown-to-ast@4 includes some breaking change +It enhance some linting result. It found potential issue. + + + + +# 7.4.0 (2017-04-11) + + +### Features + +* **cli:** Support quiet mode (#268) ([7b1af88](https://github.com/textlint/textlint/commit/7b1af88)) + + + + +# 7.3.0 (2017-03-04) + + +### Features + +* **cli:** Support glob pattern (#264) ([d1cd6f3](https://github.com/textlint/textlint/commit/d1cd6f3)) + + + + +## 7.2.2 (2017-02-12) + + +### Bug Fixes + +* **config:** use rc-config-loader insteadof rc-loader (#262) ([df2154d](https://github.com/textlint/textlint/commit/df2154d)), closes [#39](https://github.com/textlint/textlint/issues/39) + + + + + +# 7.4.0 (2017-04-11) + + +### Features + +* **cli:** Support quiet mode (#268) ([7b1af88](https://github.com/textlint/textlint/commit/7b1af88)) + + + + +# 7.3.0 (2017-03-04) + + +### Features + +* **cli:** Support glob pattern (#264) ([d1cd6f3](https://github.com/textlint/textlint/commit/d1cd6f3)) + + + + +## 7.2.2 (2017-02-12) + + +### Bug Fixes + +* **config:** use rc-config-loader insteadof rc-loader (#262) ([df2154d](https://github.com/textlint/textlint/commit/df2154d)), closes [#39](https://github.com/textlint/textlint/issues/39) diff --git a/node_modules/textlint/LICENSE b/node_modules/textlint/LICENSE new file mode 100644 index 000000000..fca71ec20 --- /dev/null +++ b/node_modules/textlint/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-present azu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/textlint/README.md b/node_modules/textlint/README.md new file mode 100644 index 000000000..186a0ca04 --- /dev/null +++ b/node_modules/textlint/README.md @@ -0,0 +1,6 @@ +# textlint + +The pluggable linting tool for text. + +- Website: +- Repository: diff --git a/node_modules/textlint/module/cli.d.ts b/node_modules/textlint/module/cli.d.ts new file mode 100644 index 000000000..1006eb8c5 --- /dev/null +++ b/node_modules/textlint/module/cli.d.ts @@ -0,0 +1,29 @@ +/** + * Encapsulates all CLI behavior for eslint. Makes it easier to test as well as + * for other Node.js programs to effectively run the CLI. + */ +export declare const cli: { + /** + * Executes the CLI based on an array of arguments that is passed in. + * @param {string|Array|Object} args The arguments to process. + * @param {string} [text] The text to lint (used for TTY). + * @returns {Promise} The exit code for the operation. + */ + execute(args: string | Array | object, text?: string | undefined): Promise; + /** + * execute with cli options + * @param {object} cliOptions + * @param {string[]} files files are file path list + * @returns {Promise} exit status + */ + executeWithParallel(cliOptions: any, files: string[]): Promise; + /** + * execute with cli options + * @param {object} cliOptions + * @param {string[]} files files are file path list + * @param {string} [text] + * @param {string} [stdinFilename] + * @returns {Promise} exit status + */ + executeWithOptions(cliOptions: any, files: string[], text?: string | undefined, stdinFilename?: string | undefined): Promise; +}; diff --git a/node_modules/textlint/module/cli.js b/node_modules/textlint/module/cli.js new file mode 100644 index 000000000..242d0a8a4 --- /dev/null +++ b/node_modules/textlint/module/cli.js @@ -0,0 +1,219 @@ +// LICENSE : MIT +"use strict"; +import { throwWithoutExperimental } from "@textlint/feature-flag"; +var fs = require("fs"); +var path = require("path"); +var debug = require("debug")("textlint:cli"); +var mkdirp = require("mkdirp"); +import { options } from "./options"; +import { TextLintEngine } from "./textlint-engine"; +import { TextFixEngine } from "./textfix-engine"; +import { Config } from "./config/config"; +import { createConfigFile } from "./config/config-initializer"; +import { TextLintFixer } from "./fixer/textlint-fixer"; +import { Logger } from "./util/logger"; +import { lintParallel } from "./parallel/lint-worker-master"; +/* + cli.js is command line **interface** + + processing role is cli-engine.js. + @see cli-engine.js + */ +var showEmptyRuleWarning = function () { + Logger.log("\n== No rules found, textlint hasn\u2019t done anything ==\n\nPossible reasons:\n* Your textlint config file has no rules.\n* You have no config file and you aren\u2019t passing rules via command line.\n* Your textlint config has a syntax error.\n\n=> How to set up rules?\nhttps://github.com/textlint/textlint/blob/master/docs/configuring.md\n"); +}; +/** + * Print results of lining text. + * @param {string} output the output text which is formatted by {@link TextLintEngine.formatResults} + * @param {object} options cli option object {@lint ./options.js} + * @returns {boolean} does print result success? + */ +function printResults(output, options) { + if (!output) { + return true; + } + var outputFile = options.outputFile; + if (outputFile) { + var filePath = path.resolve(process.cwd(), outputFile); + if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) { + Logger.error("Cannot write to output file path, it is a directory: %s", outputFile); + return false; + } + try { + mkdirp.sync(path.dirname(filePath)); + fs.writeFileSync(filePath, output); + } + catch (ex) { + Logger.error("There was a problem writing the output file:\n%s", ex); + return false; + } + } + else { + Logger.log(output); + } + return true; +} +/** + * Encapsulates all CLI behavior for eslint. Makes it easier to test as well as + * for other Node.js programs to effectively run the CLI. + */ +export var cli = { + /** + * Executes the CLI based on an array of arguments that is passed in. + * @param {string|Array|Object} args The arguments to process. + * @param {string} [text] The text to lint (used for TTY). + * @returns {Promise} The exit code for the operation. + */ + execute: function (args, text) { + var currentOptions; + // version from package.json + var pkgConf = require("read-pkg-up"); + var version = pkgConf.sync({ cwd: __dirname }).pkg.version; + try { + currentOptions = options.parse(args); + } + catch (error) { + Logger.error(error.message); + return Promise.resolve(1); + } + var files = currentOptions._; + if (currentOptions.version) { + Logger.log("v" + version); + } + else if (currentOptions.init) { + return createConfigFile({ + dir: process.cwd(), + verbose: !currentOptions.quiet + }); + } + else if (currentOptions.help || (!files.length && !text)) { + Logger.log(options.generateHelp()); + } + else { + // specify file name of stdin content + var stdinFilename = currentOptions.stdinFilename; + debug("textlint --version: " + version); + debug("Running on " + (text ? "text" : "files") + ", stdin-filename: " + stdinFilename); + if (currentOptions.parallel) { + debug("textlint --parallel"); + throwWithoutExperimental("--parallel is experimental feature. It should be used with --experimental flag"); + return this.executeWithParallel(currentOptions, files); + } + return this.executeWithOptions(currentOptions, files, text, stdinFilename); + } + return Promise.resolve(0); + }, + /** + * execute with cli options + * @param {object} cliOptions + * @param {string[]} files files are file path list + * @returns {Promise} exit status + */ + executeWithParallel: function (cliOptions, files) { + var config = Config.initWithCLIOptions(cliOptions); + if (cliOptions.fix) { + // --fix + var fixEngine_1 = new TextFixEngine(config); + if (!fixEngine_1.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + var resultsPromise_1 = lintParallel(files, { + type: "fix", + config: config, + concurrency: cliOptions.maxConcurrency + }); + return resultsPromise_1.then(function (results) { + debug("fix results: %j", results); + var fixer = new TextLintFixer(); + var output = fixEngine_1.formatResults(results); + printResults(output, cliOptions); + // --dry-run + if (cliOptions.dryRun) { + debug("Enable dry-run mode"); + return Promise.resolve(0); + } + // modify file and return exit status + return fixer.write(results).then(function () { + return 0; + }); + }); + } + // lint as default + var lintEngine = new TextLintEngine(config); + if (!lintEngine.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + var resultsPromise = lintParallel(files, { + type: "lint", + config: config, + concurrency: cliOptions.maxConcurrency + }); + return resultsPromise.then(function (results) { + debug("lint results: %j", results); + var output = lintEngine.formatResults(results); + if (printResults(output, cliOptions)) { + return lintEngine.isErrorResults(results) ? 1 : 0; + } + else { + return 1; + } + }); + }, + /** + * execute with cli options + * @param {object} cliOptions + * @param {string[]} files files are file path list + * @param {string} [text] + * @param {string} [stdinFilename] + * @returns {Promise} exit status + */ + executeWithOptions: function (cliOptions, files, text, stdinFilename) { + var config = Config.initWithCLIOptions(cliOptions); + if (cliOptions.fix) { + // --fix + var fixEngine_2 = new TextFixEngine(config); + if (!fixEngine_2.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + var resultsPromise_2 = text + ? fixEngine_2.executeOnText(text, stdinFilename) + : fixEngine_2.executeOnFiles(files); + return resultsPromise_2.then(function (results) { + debug("fix results: %j", results); + var fixer = new TextLintFixer(); + var output = fixEngine_2.formatResults(results); + printResults(output, cliOptions); + // --dry-run + if (cliOptions.dryRun) { + debug("Enable dry-run mode"); + return Promise.resolve(0); + } + // modify file and return exit status + return fixer.write(results).then(function () { + return 0; + }); + }); + } + // lint as default + var lintEngine = new TextLintEngine(config); + if (!lintEngine.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + var resultsPromise = text ? lintEngine.executeOnText(text, stdinFilename) : lintEngine.executeOnFiles(files); + return resultsPromise.then(function (results) { + debug("lint results: %j", results); + var output = lintEngine.formatResults(results); + if (printResults(output, cliOptions)) { + return lintEngine.isErrorResults(results) ? 1 : 0; + } + else { + return 1; + } + }); + } +}; +//# sourceMappingURL=cli.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/cli.js.map b/node_modules/textlint/module/cli.js.map new file mode 100644 index 000000000..2edb4eafe --- /dev/null +++ b/node_modules/textlint/module/cli.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC;AAC/C,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;GAKG;AAEH,IAAM,oBAAoB,GAAG;IACzB,MAAM,CAAC,GAAG,CAAC,0VAUd,CAAC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAc,EAAE,OAAY;IAC9C,IAAI,CAAC,MAAM,EAAE;QACT,OAAO,IAAI,CAAC;KACf;IACD,IAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,IAAI,UAAU,EAAE;QACZ,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QACzD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,EAAE;YAChE,MAAM,CAAC,KAAK,CAAC,yDAAyD,EAAE,UAAU,CAAC,CAAC;YACpF,OAAO,KAAK,CAAC;SAChB;QACD,IAAI;YACA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACpC,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SACtC;QAAC,OAAO,EAAE,EAAE;YACT,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE,EAAE,CAAC,CAAC;YACrE,OAAO,KAAK,CAAC;SAChB;KACJ;SAAM;QACH,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACtB;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,GAAG,GAAG;IACf;;;;;OAKG;IACH,OAAO,EAAP,UAAQ,IAAkC,EAAE,IAAa;QACrD,IAAI,cAAc,CAAC;QACnB,4BAA4B;QAC5B,IAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;QACvC,IAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;QAC7D,IAAI;YACA,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxC;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC7B;QACD,IAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC;QAC/B,IAAI,cAAc,CAAC,OAAO,EAAE;YACxB,MAAM,CAAC,GAAG,CAAC,MAAI,OAAS,CAAC,CAAC;SAC7B;aAAM,IAAI,cAAc,CAAC,IAAI,EAAE;YAC5B,OAAO,gBAAgB,CAAC;gBACpB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;gBAClB,OAAO,EAAE,CAAC,cAAc,CAAC,KAAK;aACjC,CAAC,CAAC;SACN;aAAM,IAAI,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE;YACxD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;SACtC;aAAM;YACH,qCAAqC;YACrC,IAAM,aAAa,GAAG,cAAc,CAAC,aAAa,CAAC;YACnD,KAAK,CAAC,yBAAuB,OAAS,CAAC,CAAC;YACxC,KAAK,CAAC,iBAAc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,2BAAqB,aAAe,CAAC,CAAC;YACjF,IAAI,cAAc,CAAC,QAAQ,EAAE;gBACzB,KAAK,CAAC,qBAAqB,CAAC,CAAC;gBAC7B,wBAAwB,CACpB,gFAAgF,CACnF,CAAC;gBACF,OAAO,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;aAC1D;YACD,OAAO,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;SAC9E;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,mBAAmB,EAAnB,UAAoB,UAAe,EAAE,KAAe;QAChD,IAAM,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,UAAU,CAAC,GAAG,EAAE;YAChB,QAAQ;YACR,IAAM,WAAS,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC,WAAS,CAAC,iBAAiB,EAAE,EAAE;gBAChC,oBAAoB,EAAE,CAAC;gBACvB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aAC7B;YACD,IAAM,gBAAc,GAAG,YAAY,CAAC,KAAK,EAAE;gBACvC,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,UAAU,CAAC,cAAc;aACzC,CAAC,CAAC;YACH,OAAO,gBAAc,CAAC,IAAI,CAAC,UAAC,OAAO;gBAC/B,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;gBAClC,IAAM,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;gBAClC,IAAM,MAAM,GAAG,WAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAChD,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;gBACjC,YAAY;gBACZ,IAAI,UAAU,CAAC,MAAM,EAAE;oBACnB,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC7B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBAC7B;gBACD,qCAAqC;gBACrC,OAAO,KAAK,CAAC,KAAK,CAAC,OAA8B,CAAC,CAAC,IAAI,CAAC;oBACpD,OAAO,CAAC,CAAC;gBACb,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;QACD,kBAAkB;QAClB,IAAM,UAAU,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,EAAE;YACjC,oBAAoB,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC7B;QACD,IAAM,cAAc,GAAG,YAAY,CAAC,KAAK,EAAE;YACvC,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,UAAU,CAAC,cAAc;SACzC,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,IAAI,CAAC,UAAC,OAAO;YAC/B,KAAK,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;YACnC,IAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACjD,IAAI,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;gBAClC,OAAO,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACrD;iBAAM;gBACH,OAAO,CAAC,CAAC;aACZ;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACH,kBAAkB,EAAlB,UAAmB,UAAe,EAAE,KAAe,EAAE,IAAa,EAAE,aAAsB;QACtF,IAAM,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,UAAU,CAAC,GAAG,EAAE;YAChB,QAAQ;YACR,IAAM,WAAS,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC,WAAS,CAAC,iBAAiB,EAAE,EAAE;gBAChC,oBAAoB,EAAE,CAAC;gBACvB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aAC7B;YACD,IAAM,gBAAc,GAAG,IAAI;gBACvB,CAAC,CAAC,WAAS,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC;gBAC9C,CAAC,CAAC,WAAS,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO,gBAAc,CAAC,IAAI,CAAC,UAAC,OAAO;gBAC/B,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;gBAClC,IAAM,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;gBAClC,IAAM,MAAM,GAAG,WAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAChD,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;gBACjC,YAAY;gBACZ,IAAI,UAAU,CAAC,MAAM,EAAE;oBACnB,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC7B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBAC7B;gBACD,qCAAqC;gBACrC,OAAO,KAAK,CAAC,KAAK,CAAC,OAA8B,CAAC,CAAC,IAAI,CAAC;oBACpD,OAAO,CAAC,CAAC;gBACb,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;QACD,kBAAkB;QAClB,IAAM,UAAU,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,EAAE;YACjC,oBAAoB,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC7B;QACD,IAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC/G,OAAO,cAAc,CAAC,IAAI,CAAC,UAAC,OAAO;YAC/B,KAAK,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;YACnC,IAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACjD,IAAI,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;gBAClC,OAAO,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACrD;iBAAM;gBACH,OAAO,CAAC,CAAC;aACZ;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/config-initializer.d.ts b/node_modules/textlint/module/config/config-initializer.d.ts new file mode 100644 index 000000000..78495a65c --- /dev/null +++ b/node_modules/textlint/module/config/config-initializer.d.ts @@ -0,0 +1,10 @@ +export interface CreateConfigFileOption { + dir: string; + verbose: boolean; +} +/** + * Create .textlintrc file + * @params {string} dir The directory of .textlintrc file + * @returns {Promise.} The exit code for the operation. + */ +export declare const createConfigFile: (options: CreateConfigFileOption) => Promise; diff --git a/node_modules/textlint/module/config/config-initializer.js b/node_modules/textlint/module/config/config-initializer.js new file mode 100644 index 000000000..c04c59ab9 --- /dev/null +++ b/node_modules/textlint/module/config/config-initializer.js @@ -0,0 +1,88 @@ +// LICENSE : MIT +"use strict"; +import { TextlintPackageNamePrefix } from "@textlint/utils"; +var fs = require("fs"); +var path = require("path"); +var isFile = require("is-file"); +var readPkg = require("read-pkg"); +import { Config } from "./config"; +import { Logger } from "../util/logger"; +/** + * read package.json if found it + * @param {string} dir + * @returns {Promise.>} + */ +var getTextlintDependencyNames = function (dir) { + return readPkg(dir) + .then(function (pkg) { + var dependencies = pkg.dependencies || {}; + var devDependencies = pkg.devDependencies || {}; + var mergedDependencies = Object.assign({}, dependencies, devDependencies); + var pkgNames = Object.keys(mergedDependencies); + return pkgNames.filter(function (pkgName) { + var ruleOrFilter = pkgName.indexOf(TextlintPackageNamePrefix.filterRule) !== -1 || + pkgName.indexOf(TextlintPackageNamePrefix.rule) !== -1; + if (pkgName === "textlint-rule-helper") { + return false; + } + return ruleOrFilter; + }); + }) + .catch(function () { + return []; + }); +}; +/** + * create object that fill with `defaultValue` + * @param {Array} array + * @param {*} defaultValue + * @returns {Object} + */ +var arrayToObject = function (array, defaultValue) { + var object = {}; + array.forEach(function (item) { + object[item] = defaultValue; + }); + return object; +}; +/** + * Create .textlintrc file + * @params {string} dir The directory of .textlintrc file + * @returns {Promise.} The exit code for the operation. + */ +export var createConfigFile = function (options) { + var dir = options.dir; + return getTextlintDependencyNames(dir).then(function (pkgNames) { + var rcFile = "." + Config.CONFIG_FILE_NAME + "rc"; + var filePath = path.resolve(dir, rcFile); + if (isFile(filePath)) { + Logger.error(rcFile + " is already existed."); + return Promise.resolve(1); + } + var filters = pkgNames + .filter(function (pkgName) { + return pkgName.indexOf(TextlintPackageNamePrefix.filterRule) !== -1; + }) + .map(function (filterName) { + return filterName.replace(TextlintPackageNamePrefix.filterRule, ""); + }); + var rules = pkgNames + .filter(function (pkgName) { + return pkgName.indexOf(TextlintPackageNamePrefix.rule) !== -1; + }) + .map(function (filterName) { + return filterName.replace(TextlintPackageNamePrefix.rule, ""); + }); + var defaultTextlintRc = { + filters: arrayToObject(filters, true), + rules: arrayToObject(rules, true) + }; + var output = JSON.stringify(defaultTextlintRc, null, 2); + fs.writeFileSync(filePath, output); + if (options.verbose) { + Logger.log(rcFile + " is created."); + } + return Promise.resolve(0); + }); +}; +//# sourceMappingURL=config-initializer.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/config-initializer.js.map b/node_modules/textlint/module/config/config-initializer.js.map new file mode 100644 index 000000000..e0cad9b0d --- /dev/null +++ b/node_modules/textlint/module/config/config-initializer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-initializer.js","sourceRoot":"","sources":["../../src/config/config-initializer.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,IAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;GAIG;AACH,IAAM,0BAA0B,GAAG,UAAC,GAAW;IAC3C,OAAO,OAAO,CAAC,GAAG,CAAC;SACd,IAAI,CAAC,UAAC,GAAQ;QACX,IAAM,YAAY,GAAG,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;QAC5C,IAAM,eAAe,GAAG,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC;QAClD,IAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;QAC5E,IAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAC,OAAO;YAC3B,IAAM,YAAY,GACd,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC5D,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC3D,IAAI,OAAO,KAAK,sBAAsB,EAAE;gBACpC,OAAO,KAAK,CAAC;aAChB;YACD,OAAO,YAAY,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;SACD,KAAK,CAAC;QACH,OAAO,EAAE,CAAC;IACd,CAAC,CAAC,CAAC;AACX,CAAC,CAAC;AAEF;;;;;GAKG;AACH,IAAM,aAAa,GAAG,UAAC,KAAiB,EAAE,YAAiB;IACvD,IAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;QACf,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AASF;;;;GAIG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,OAA+B;IAC5D,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACxB,OAAO,0BAA0B,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,UAAC,QAAQ;QACjD,IAAM,MAAM,GAAG,MAAI,MAAM,CAAC,gBAAgB,OAAI,CAAC;QAC/C,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;YAClB,MAAM,CAAC,KAAK,CAAI,MAAM,yBAAsB,CAAC,CAAC;YAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC7B;QACD,IAAM,OAAO,GAAG,QAAQ;aACnB,MAAM,CAAC,UAAC,OAAO;YACZ,OAAO,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC;aACD,GAAG,CAAC,UAAC,UAAU;YACZ,OAAO,UAAU,CAAC,OAAO,CAAC,yBAAyB,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QACP,IAAM,KAAK,GAAG,QAAQ;aACjB,MAAM,CAAC,UAAC,OAAO;YACZ,OAAO,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC;aACD,GAAG,CAAC,UAAC,UAAU;YACZ,OAAO,UAAU,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QACP,IAAM,iBAAiB,GAAG;YACtB,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC;YACrC,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC;SACpC,CAAC;QACF,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,MAAM,CAAC,GAAG,CAAI,MAAM,iBAAc,CAAC,CAAC;SACvC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/config-loader.d.ts b/node_modules/textlint/module/config/config-loader.d.ts new file mode 100644 index 000000000..20a9b6e27 --- /dev/null +++ b/node_modules/textlint/module/config/config-loader.d.ts @@ -0,0 +1,18 @@ +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +/** + * @param configFileName "textlint" for .textlinrc + * @param cwd current working dir + * @param configFilePath it is preferred than configFileName + * @param moduleResolver + */ +export declare function loadConfig({ cwd, configFileName, configFilePath, moduleResolver }: { + cwd?: string; + configFileName: string; + configFilePath?: string; + moduleResolver: TextLintModuleResolver; +}): { + config: { + [index: string]: any; + }; + filePath: string | undefined; +}; diff --git a/node_modules/textlint/module/config/config-loader.js b/node_modules/textlint/module/config/config-loader.js new file mode 100644 index 000000000..e187eed98 --- /dev/null +++ b/node_modules/textlint/module/config/config-loader.js @@ -0,0 +1,44 @@ +import { moduleInterop } from "@textlint/module-interop"; +import { rcFile } from "rc-config-loader"; +/** + * @param configFileName "textlint" for .textlinrc + * @param cwd current working dir + * @param configFilePath it is preferred than configFileName + * @param moduleResolver + */ +export function loadConfig(_a) { + var cwd = _a.cwd, configFileName = _a.configFileName, configFilePath = _a.configFilePath, moduleResolver = _a.moduleResolver; + // if specify Config module, use it + if (configFilePath) { + try { + var modulePath = moduleResolver.resolveConfigPackageName(configFilePath); + return { + config: moduleInterop(require(modulePath)), + filePath: modulePath + }; + } + catch (error) { + // not found config module + } + } + // auto or specify path to config file + var result = rcFile(configFileName, { + configFileName: configFilePath, + defaultExtension: [".json", ".js", ".yml"], + packageJSON: { + fieldName: "textlint" + }, + cwd: cwd + }); + if (result === undefined) { + return { + config: {}, + filePath: undefined + }; + } + return { + config: result.config, + filePath: result.filePath + }; +} +//# sourceMappingURL=config-loader.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/config-loader.js.map b/node_modules/textlint/module/config/config-loader.js.map new file mode 100644 index 000000000..642cd6896 --- /dev/null +++ b/node_modules/textlint/module/config/config-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/config/config-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EAU1B;QATG,GAAG,SAAA,EACH,cAAc,oBAAA,EACd,cAAc,oBAAA,EACd,cAAc,oBAAA;IAUd,mCAAmC;IACnC,IAAI,cAAc,EAAE;QAChB,IAAI;YACA,IAAM,UAAU,GAAG,cAAc,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;YAC3E,OAAO;gBACH,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBAC1C,QAAQ,EAAE,UAAU;aACvB,CAAC;SACL;QAAC,OAAO,KAAK,EAAE;YACZ,0BAA0B;SAC7B;KACJ;IACD,sCAAsC;IACtC,IAAM,MAAM,GAAG,MAAM,CAAC,cAAc,EAAE;QAClC,cAAc,EAAE,cAAc;QAC9B,gBAAgB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC;QAC1C,WAAW,EAAE;YACT,SAAS,EAAE,UAAU;SACxB;QACD,GAAG,KAAA;KACN,CAAC,CAAC;IACH,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO;YACH,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,SAAS;SACtB,CAAC;KACL;IACD,OAAO;QACH,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC5B,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/config-util.d.ts b/node_modules/textlint/module/config/config-util.d.ts new file mode 100644 index 000000000..2a5c22d8a --- /dev/null +++ b/node_modules/textlint/module/config/config-util.d.ts @@ -0,0 +1,2 @@ +export declare function isPluginRuleKey(key: string): boolean; +export declare function isPresetRuleKey(key: string): boolean; diff --git a/node_modules/textlint/module/config/config-util.js b/node_modules/textlint/module/config/config-util.js new file mode 100644 index 000000000..e52f20e30 --- /dev/null +++ b/node_modules/textlint/module/config/config-util.js @@ -0,0 +1,28 @@ +// LICENSE : MIT +"use strict"; +export function isPluginRuleKey(key) { + // @/<>rule> + if (key[0] === "@" && key.indexOf("/textlint-plugin") !== -1) { + return true; + } + // not contain @, but contain / + // / + return key[0] !== "@" && key.indexOf("/") !== -1; +} +export function isPresetRuleKey(key) { + // "preset-name" is special pattern + if (/^preset-/.test(key)) { + return true; + } + if (/^textlint-rule-preset-/.test(key)) { + return true; + } + // scoped module: @textlint/textlint-rule-preset-foo + if (key[0] === "@") { + if (key.indexOf("/preset-") !== -1 || key.indexOf("/textlint-rule-preset-") !== -1) { + return true; + } + } + return false; +} +//# sourceMappingURL=config-util.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/config-util.js.map b/node_modules/textlint/module/config/config-util.js.map new file mode 100644 index 000000000..0a8845d40 --- /dev/null +++ b/node_modules/textlint/module/config/config-util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-util.js","sourceRoot":"","sources":["../../src/config/config-util.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,MAAM,UAAU,eAAe,CAAC,GAAW;IACvC,2BAA2B;IAC3B,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE;QAC1D,OAAO,IAAI,CAAC;KACf;IACD,+BAA+B;IAC/B,kBAAkB;IAClB,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW;IACvC,mCAAmC;IACnC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC;KACf;IACD,IAAI,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACpC,OAAO,IAAI,CAAC;KACf;IACD,oDAAoD;IACpD,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAChB,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,EAAE;YAChF,OAAO,IAAI,CAAC;SACf;KACJ;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/config.d.ts b/node_modules/textlint/module/config/config.d.ts new file mode 100644 index 000000000..966645893 --- /dev/null +++ b/node_modules/textlint/module/config/config.d.ts @@ -0,0 +1,94 @@ +export interface ConfigStatics { + CONFIG_PACKAGE_PREFIX: string; + FILTER_RULE_NAME_PREFIX: string; + RULE_NAME_PREFIX: string; + RULE_PRESET_NAME_PREFIX: string; + PLUGIN_NAME_PREFIX: string; +} +export interface ConfigAutoLoadingOptions { + rules?: string[]; + disabledRules?: string[]; + rulesConfig?: { + [index: string]: boolean | {}; + }; + filterRules?: string[]; + disabledFilterRules?: string[]; + filterRulesConfig?: { + [index: string]: boolean | {}; + }; + presets?: string[]; + plugins?: string[]; + pluginsConfig?: { + [index: string]: boolean | {}; + }; + rulesBaseDirectory?: string; + configFile?: string; + rulePaths?: string[]; + formatterName?: string; + quiet?: boolean; + color?: boolean; + textlintrc?: boolean; + cache?: boolean; + cacheLocation?: string; + cwd?: string; + ignoreFile?: string | undefined; +} +export declare class Config { + rules: any; + rulesBaseDirectory: string | undefined; + configFile: string | undefined; + disabledRules: string[]; + filterRules: string[]; + disabledFilterRules: string[]; + presets: string[]; + plugins: string[]; + pluginsConfig: { + [index: string]: any; + }; + rulesConfig: { + [index: string]: any; + }; + filterRulesConfig: { + [index: string]: any; + }; + rulePaths: string[]; + formatterName: string | undefined; + quiet: boolean; + color: boolean; + cache: boolean; + cacheLocation: string; + ignoreFile: string | undefined; + /** + * @return {string} rc config filename + * it's name use as `.rc` + */ + static get CONFIG_FILE_NAME(): string; + /** + * Create config object form command line options + * See options.js + * @param {object} cliOptions the options is command line option object. @see options.js + * @returns {Config} + */ + static initWithCLIOptions(cliOptions: any): Config; + /** + * load config and merge options. + * These config is user defined options. + * These config is prefer than preset packages's config that is defined by package author. + * @param options + */ + static initWithAutoLoading(options?: ConfigAutoLoadingOptions): Config; + /** + * Return hash string of the config and textlint version + * @returns {string} + */ + get hash(): any; + /** + * initialize with options. + * @param {TextlintConfig} options the option object is defined as TextlintConfig. + * @returns {Config} + * @constructor + */ + constructor(options?: Partial); + private _assertCacheLocation; + toJSON(): any; +} diff --git a/node_modules/textlint/module/config/config.js b/node_modules/textlint/module/config/config.js new file mode 100644 index 000000000..87247a549 --- /dev/null +++ b/node_modules/textlint/module/config/config.js @@ -0,0 +1,357 @@ +// LICENSE : MIT +"use strict"; +import crypto from "crypto"; +import { loadConfig } from "./config-loader"; +import { createFlatRulesConfigFromRawRulesConfig, loadRulesConfigFromPresets } from "./preset-loader"; +import { getPluginConfig, getPluginNames } from "./plugin-loader"; +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +import { separateEnabledOrDisabled } from "./separate-by-config-option"; +import { normalizeTextlintFilterRuleKey, normalizeTextlintPluginKey, normalizeTextlintRuleKey, normalizeTextlintRulePresetKey } from "@textlint/utils"; +import { Logger } from "../util/logger"; +var md5 = require("md5"); +var fs = require("fs"); +var assert = require("assert"); +var concat = require("unique-concat"); +var path = require("path"); +var pkgConf = require("read-pkg-up"); +function applyNormalizerToList(normalizer, names) { + return names.map(function (name) { + return normalizer(name); + }); +} +function applyNormalizerToConfig(normalizer, config) { + return Object.keys(config).reduce(function (results, key) { + var shortPluginName = normalizer(key); + results[shortPluginName] = config[key]; + return results; + }, {}); +} +/** + * @type {TextlintConfig} + */ +var defaultOptions = Object.freeze({ + // rule package names + rules: [], + // disabled rule package names + // always should start with empty + disabledRules: [], + // rules config object + rulesConfig: {}, + // filter rule package names + filterRules: [], + disabledFilterRules: [], + // rules config object + filterRulesConfig: {}, + // preset package names + // e.g.) ["preset-foo"] + presets: [], + // plugin package names + plugins: [], + // plugin config + pluginsConfig: {}, + // base directory for loading {rule, config, plugin} modules + rulesBaseDirectory: undefined, + // ".textlint" file path + configFile: undefined, + // rule directories + rulePaths: [], + // formatter file name + // e.g.) stylish.js => set "stylish" + // NOTE: default formatter is defined in Engine, + // because There is difference between TextLintEngine and TextFixEngine. + formatterName: undefined, + // --quiet + quiet: false, + // --no-color + color: true, + // --no-textlintrc + textlintrc: true, + // --cache : enable or disable + cache: false, + // --cache-location: cache file path + cacheLocation: path.resolve(process.cwd(), ".textlintcache"), + // --ignore-path: ".textlintignore" file path + ignoreFile: path.resolve(process.cwd(), ".textlintignore") +}); +// Priority: CLI > Code options > config file +var Config = /** @class */ (function () { + /** + * initialize with options. + * @param {TextlintConfig} options the option object is defined as TextlintConfig. + * @returns {Config} + * @constructor + */ + function Config(options) { + var _this = this; + if (options === void 0) { options = {}; } + /** + * @type {string|undefined} absolute path to .textlintrc file. + * - If using .textlintrc, return path to .textlintrc + * - If using npm config module, return path to main file of the module + * - If not using config file, return undefined + */ + this.configFile = options.configFile; + if (this.configFile) { + assert.ok(path.isAbsolute(this.configFile), "configFile should be absolute path: " + this.configFile); + } + this.rulesBaseDirectory = options.rulesBaseDirectory + ? options.rulesBaseDirectory + : defaultOptions.rulesBaseDirectory; + // rule names that are defined in ,textlintrc + var moduleResolver = new TextLintModuleResolver({ + rulesBaseDirectory: this.rulesBaseDirectory + }); + /** + * @type {string[]} rule key list + * These rule is set `false` to options + */ + this.disabledRules = applyNormalizerToList(normalizeTextlintRuleKey, options.disabledRules ? options.disabledRules : defaultOptions.disabledRules); + /** + * @type {string[]} rule key list + * rules does not includes disabledRules + */ + this.rules = applyNormalizerToList(normalizeTextlintRuleKey, options.rules ? options.rules : defaultOptions.rules).filter(function (ruleName) { + return !_this.disabledRules.includes(ruleName); + }); + /** + * @type {string[]} rule key list + * These rule is set `false` to options + */ + this.disabledFilterRules = applyNormalizerToList(normalizeTextlintFilterRuleKey, options.disabledFilterRules ? options.disabledFilterRules : defaultOptions.disabledFilterRules); + /** + * @type {string[]} filter rule key list + */ + this.filterRules = applyNormalizerToList(normalizeTextlintFilterRuleKey, options.filterRules ? options.filterRules : defaultOptions.filterRules).filter(function (ruleName) { + return !_this.disabledFilterRules.includes(ruleName); + }); + /** + * @type {string[]} preset key list + */ + this.presets = applyNormalizerToList(normalizeTextlintRulePresetKey, options.presets ? options.presets : defaultOptions.presets); + // => load plugins + // this.rules has not contain plugin rules + // ===================== + this.plugins = applyNormalizerToList(normalizeTextlintPluginKey, options.plugins ? options.plugins : defaultOptions.plugins); + this.pluginsConfig = applyNormalizerToConfig(normalizeTextlintPluginKey, options.pluginsConfig ? options.pluginsConfig : defaultOptions.pluginsConfig); + // rulesConfig + // load preset package's config and merge it to user defined rules config + // user config > default preset config + var presetRulesConfig = loadRulesConfigFromPresets(this.presets, moduleResolver); + this.rulesConfig = applyNormalizerToConfig(normalizeTextlintRuleKey, Object.assign({}, presetRulesConfig, options.rulesConfig)); + // filterRulesConfig + this.filterRulesConfig = applyNormalizerToConfig(normalizeTextlintFilterRuleKey, options.filterRulesConfig || defaultOptions.filterRulesConfig); + /** + * @type {string[]} + */ + this.rulePaths = options.rulePaths ? options.rulePaths : defaultOptions.rulePaths; + /** + * @type {string} + */ + this.formatterName = options.formatterName ? options.formatterName : defaultOptions.formatterName; + /** + * @type {boolean} + */ + this.quiet = options.quiet !== undefined ? options.quiet : defaultOptions.quiet; + /** + * @type {boolean} + */ + this.color = options.color !== undefined ? options.color : defaultOptions.color; + /** + * @type {boolean} + */ + this.cache = options.cache !== undefined ? options.cache : defaultOptions.cache; + /** + * @type {string} + */ + this.cacheLocation = options.cacheLocation !== undefined ? options.cacheLocation : defaultOptions.cacheLocation; + this._assertCacheLocation(this.cacheLocation); + /** + * @type {string} + */ + this.ignoreFile = options.ignoreFile !== undefined ? options.ignoreFile : defaultOptions.ignoreFile; + } + Object.defineProperty(Config, "CONFIG_FILE_NAME", { + /** + * @return {string} rc config filename + * it's name use as `.rc` + */ + get: function () { + return "textlint"; + }, + enumerable: false, + configurable: true + }); + /** + * Create config object form command line options + * See options.js + * @param {object} cliOptions the options is command line option object. @see options.js + * @returns {Config} + */ + Config.initWithCLIOptions = function (cliOptions) { + var options = {}; + options.rules = cliOptions.rule ? cliOptions.rule : defaultOptions.rules; + // TODO: CLI --filter ? + options.filterRules = defaultOptions.filterRules; + options.disabledFilterRules = defaultOptions.disabledFilterRules; + // TODO: CLI --disable ? + options.disabledRules = defaultOptions.disabledRules; + options.presets = cliOptions.preset ? cliOptions.preset : defaultOptions.presets; + options.plugins = cliOptions.plugin ? cliOptions.plugin : defaultOptions.plugins; + options.configFile = cliOptions.config ? cliOptions.config : defaultOptions.configFile; + options.rulePaths = cliOptions.rulesdir ? cliOptions.rulesdir : defaultOptions.rulePaths; + options.formatterName = cliOptions.format ? cliOptions.format : defaultOptions.formatterName; + options.quiet = cliOptions.quiet !== undefined ? cliOptions.quiet : defaultOptions.quiet; + options.color = cliOptions.color !== undefined ? cliOptions.color : defaultOptions.color; + // --no-textlintrc: disable textlint + options.textlintrc = cliOptions.textlintrc !== undefined ? cliOptions.textlintrc : defaultOptions.textlintrc; + // --cache + options.cache = cliOptions.cache !== undefined ? cliOptions.cache : defaultOptions.cache; + // --cache-location="path/to/file" + options.cacheLocation = + cliOptions.cacheLocation !== undefined + ? path.resolve(process.cwd(), cliOptions.cacheLocation) + : defaultOptions.cacheLocation; + // --rules-base-directory "other/node_modules" + options.rulesBaseDirectory = cliOptions.rulesBaseDirectory || defaultOptions.rulesBaseDirectory; + // --ignore-path="path/to/file" + options.ignoreFile = + cliOptions.ignorePath !== undefined + ? path.resolve(process.cwd(), cliOptions.ignorePath) + : defaultOptions.ignoreFile; + return this.initWithAutoLoading(options); + }; + /* eslint-disable complexity */ + /** + * load config and merge options. + * These config is user defined options. + * These config is prefer than preset packages's config that is defined by package author. + * @param options + */ + Config.initWithAutoLoading = function (options) { + if (options === void 0) { options = {}; } + // Base directory + var rulesBaseDirectory = options.rulesBaseDirectory + ? options.rulesBaseDirectory + : defaultOptions.rulesBaseDirectory; + // Create resolver + var moduleResolver = new TextLintModuleResolver({ + rulesBaseDirectory: rulesBaseDirectory + }); + // => ConfigFile + // configFile is optional + // => load .textlintrc + var loadedResult = typeof options.textlintrc === "undefined" || options.textlintrc + ? loadConfig({ + configFileName: this.CONFIG_FILE_NAME, + configFilePath: options.configFile, + moduleResolver: moduleResolver, + cwd: options.cwd + }) + : { + config: {}, + filePath: undefined + }; + var configFileRaw = loadedResult.config; + var configFilePath = loadedResult.filePath; + // => Load options from .textlintrc + var configRuleNamesObject = separateEnabledOrDisabled(configFileRaw.rules); + var configFilterRuleNamesObject = separateEnabledOrDisabled(configFileRaw.filters); + var configPresetNames = configRuleNamesObject.presetNames; + var configFilePlugins = getPluginNames(configFileRaw); + var configFilePluginConfig = getPluginConfig(configFileRaw); + // Notes: vs. loadRulesConfigFromPresets + // loadRulesConfigFromPresets load rules config from **preset package**. (It is not user defined config. It is defined by package author) + // In other hands, this line load rules config from .textlintrc. (It is user defined config) + var configFileRulesConfig = createFlatRulesConfigFromRawRulesConfig(configFileRaw.rules); + var configFileFilterRulesConfig = createFlatRulesConfigFromRawRulesConfig(configFileRaw.filters); + // => User specified Options + var optionRules = options.rules || []; + var optionFilterRules = options.filterRules || []; + var optionDisabledRules = options.disabledRules || []; + var optionDisabledFilterRules = options.disabledFilterRules || []; + var optionRulesConfig = options.rulesConfig || {}; + var optionFilterRulesConfig = options.filterRulesConfig || {}; + var optionPlugins = options.plugins || []; + var optionPresets = options.presets || []; + var optionPluginsConfig = options.pluginsConfig || {}; + // => Merge options and configFileOptions + // Priority options > configFile + var rules = concat(optionRules, configRuleNamesObject.enabledRuleNames); + var disabledRules = concat(optionDisabledRules, configRuleNamesObject.disabledRuleNames); + var filterRules = concat(optionFilterRules, configFilterRuleNamesObject.enabledRuleNames); + var disabledFilterRules = concat(optionDisabledFilterRules, configFilterRuleNamesObject.disabledRuleNames); + var rulesConfig = Object.assign({}, configFileRulesConfig, optionRulesConfig); + var filterRulesConfig = Object.assign({}, configFileFilterRulesConfig, optionFilterRulesConfig); + var plugins = concat(optionPlugins, configFilePlugins); + var pluginsConfig = Object.assign({}, configFilePluginConfig, optionPluginsConfig); + var presets = concat(optionPresets, configPresetNames); + var mergedOptions = Object.assign({}, options, { + rules: rules, + disabledRules: disabledRules, + rulesConfig: rulesConfig, + filterRules: filterRules, + disabledFilterRules: disabledFilterRules, + filterRulesConfig: filterRulesConfig, + plugins: plugins, + pluginsConfig: pluginsConfig, + presets: presets, + configFile: configFilePath + }); + return new this(mergedOptions); + }; + Object.defineProperty(Config.prototype, "hash", { + /** + * Return hash string of the config and textlint version + * @returns {string} + */ + get: function () { + try { + var version = pkgConf.sync({ cwd: __dirname }).pkg.version; + var toString_1 = JSON.stringify(this.toJSON()); + return md5(version + "-" + toString_1); + } + catch (error) { + // Fallback for some env + // https://github.com/textlint/textlint/issues/597 + Logger.warn("Use random value as hash because calculating hash value throw error", error); + return crypto.randomBytes(20).toString("hex"); + } + }, + enumerable: false, + configurable: true + }); + Config.prototype._assertCacheLocation = function (locationPath) { + var fileStats; + try { + fileStats = fs.lstatSync(locationPath); + } + catch (ex) { + fileStats = null; + } + if (!fileStats) { + return; + } + // TODO: --cache-location does not support directory + // We should defined what is default name. + assert.ok(!fileStats.isDirectory(), "--cache-location doesn't support directory"); + }; + /* eslint-enable complexity */ + Config.prototype.toJSON = function () { + var _this = this; + var r = Object.create(null); + Object.keys(this).forEach(function (key) { + if (!_this.hasOwnProperty(key)) { + return; + } + var value = _this[key]; + if (value == null) { + return; + } + r[key] = typeof value.toJSON !== "undefined" ? value.toJSON() : value; + }); + return r; + }; + return Config; +}()); +export { Config }; +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/config.js.map b/node_modules/textlint/module/config/config.js.map new file mode 100644 index 000000000..47267230c --- /dev/null +++ b/node_modules/textlint/module/config/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,uCAAuC,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACH,8BAA8B,EAC9B,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EACjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3B,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,IAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AACxC,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEvC,SAAS,qBAAqB,CAAC,UAAoC,EAAE,KAAe;IAChF,OAAO,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;QAClB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,uBAAuB,CAAC,UAAoC,EAAE,MAAmC;IACtG,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,UAAC,OAAO,EAAE,GAAG;QAC3C,IAAM,eAAe,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,OAAO,CAAC;IACnB,CAAC,EAAE,EAA8B,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,IAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,qBAAqB;IACrB,KAAK,EAAE,EAAE;IACT,8BAA8B;IAC9B,iCAAiC;IACjC,aAAa,EAAE,EAAE;IACjB,sBAAsB;IACtB,WAAW,EAAE,EAAE;IACf,4BAA4B;IAC5B,WAAW,EAAE,EAAE;IACf,mBAAmB,EAAE,EAAE;IACvB,sBAAsB;IACtB,iBAAiB,EAAE,EAAE;IACrB,uBAAuB;IACvB,uBAAuB;IACvB,OAAO,EAAE,EAAE;IACX,uBAAuB;IACvB,OAAO,EAAE,EAAE;IACX,gBAAgB;IAChB,aAAa,EAAE,EAAE;IACjB,4DAA4D;IAC5D,kBAAkB,EAAE,SAAS;IAC7B,wBAAwB;IACxB,UAAU,EAAE,SAAS;IACrB,mBAAmB;IACnB,SAAS,EAAE,EAAE;IACb,sBAAsB;IACtB,oCAAoC;IACpC,gDAAgD;IAChD,wEAAwE;IACxE,aAAa,EAAE,SAAS;IACxB,UAAU;IACV,KAAK,EAAE,KAAK;IACZ,aAAa;IACb,KAAK,EAAE,IAAI;IACX,kBAAkB;IAClB,UAAU,EAAE,IAAI;IAChB,8BAA8B;IAC9B,KAAK,EAAE,KAAK;IACZ,oCAAoC;IACpC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC;IAC5D,6CAA6C;IAC7C,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC;CAC7D,CAAC,CAAC;AAwDH,6CAA6C;AAC7C;IAqKI;;;;;OAKG;IACH,gBAAY,OAA6B;QAAzC,iBAmHC;QAnHW,wBAAA,EAAA,YAA6B;QACrC;;;;;WAKG;QACH,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,yCAAuC,IAAI,CAAC,UAAY,CAAC,CAAC;SACzG;QACD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB;YAChD,CAAC,CAAC,OAAO,CAAC,kBAAkB;YAC5B,CAAC,CAAC,cAAc,CAAC,kBAAkB,CAAC;QACxC,6CAA6C;QAC7C,IAAM,cAAc,GAAG,IAAI,sBAAsB,CAAC;YAC9C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;QACH;;;WAGG;QACH,IAAI,CAAC,aAAa,GAAG,qBAAqB,CACtC,wBAAwB,EACxB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAC/E,CAAC;QACF;;;WAGG;QACH,IAAI,CAAC,KAAK,GAAG,qBAAqB,CAC9B,wBAAwB,EACxB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CACvD,CAAC,MAAM,CAAC,UAAC,QAAQ;YACd,OAAO,CAAC,KAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH;;;WAGG;QACH,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAC5C,8BAA8B,EAC9B,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,cAAc,CAAC,mBAAmB,CACjG,CAAC;QAEF;;WAEG;QACH,IAAI,CAAC,WAAW,GAAG,qBAAqB,CACpC,8BAA8B,EAC9B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,CACzE,CAAC,MAAM,CAAC,UAAC,QAAQ;YACd,OAAO,CAAC,KAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QACH;;WAEG;QACH,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAChC,8BAA8B,EAC9B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAC7D,CAAC;QACF,kBAAkB;QAClB,0CAA0C;QAC1C,wBAAwB;QACxB,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAChC,0BAA0B,EAC1B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAC7D,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,uBAAuB,CACxC,0BAA0B,EAC1B,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAC/E,CAAC;QACF,cAAc;QACd,yEAAyE;QACzE,sCAAsC;QACtC,IAAM,iBAAiB,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACnF,IAAI,CAAC,WAAW,GAAG,uBAAuB,CACtC,wBAAwB,EACxB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,CAC5D,CAAC;QACF,oBAAoB;QACpB,IAAI,CAAC,iBAAiB,GAAG,uBAAuB,CAC5C,8BAA8B,EAC9B,OAAO,CAAC,iBAAiB,IAAI,cAAc,CAAC,iBAAiB,CAChE,CAAC;QACF;;WAEG;QACH,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC;QAClF;;WAEG;QACH,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC;QAClG;;WAEG;QACH,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QAChF;;WAEG;QACH,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QAChF;;WAEG;QACH,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QAChF;;WAEG;QACH,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC;QAChH,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9C;;WAEG;QACH,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC;IACxG,CAAC;IAtQD,sBAAW,0BAAgB;QAJ3B;;;WAGG;aACH;YACI,OAAO,UAAU,CAAC;QACtB,CAAC;;;OAAA;IAED;;;;;OAKG;IACI,yBAAkB,GAAzB,UAA0B,UAAe;QACrC,IAAM,OAAO,GAA6B,EAAE,CAAC;QAC7C,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QACzE,6BAA6B;QAC7B,OAAO,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC;QACjD,OAAO,CAAC,mBAAmB,GAAG,cAAc,CAAC,mBAAmB,CAAC;QACjE,8BAA8B;QAC9B,OAAO,CAAC,aAAa,GAAG,cAAc,CAAC,aAAa,CAAC;QACrD,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC;QACjF,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC;QACjF,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC;QACvF,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC;QACzF,OAAO,CAAC,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC;QAC7F,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QACzF,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QACzF,oCAAoC;QACpC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC;QAC7G,UAAU;QACV,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QACzF,kCAAkC;QAClC,OAAO,CAAC,aAAa;YACjB,UAAU,CAAC,aAAa,KAAK,SAAS;gBAClC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,aAAa,CAAC;gBACvD,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC;QACvC,8CAA8C;QAC9C,OAAO,CAAC,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,IAAI,cAAc,CAAC,kBAAkB,CAAC;QAChG,+BAA+B;QAC/B,OAAO,CAAC,UAAU;YACd,UAAU,CAAC,UAAU,KAAK,SAAS;gBAC/B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC;gBACpD,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC;QACpC,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,+BAA+B;IAC/B;;;;;OAKG;IACI,0BAAmB,GAA1B,UAA2B,OAAsC;QAAtC,wBAAA,EAAA,YAAsC;QAC7D,iBAAiB;QACjB,IAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB;YACjD,CAAC,CAAC,OAAO,CAAC,kBAAkB;YAC5B,CAAC,CAAC,cAAc,CAAC,kBAAkB,CAAC;QACxC,kBAAkB;QAClB,IAAM,cAAc,GAAG,IAAI,sBAAsB,CAAC;YAC9C,kBAAkB,oBAAA;SACrB,CAAC,CAAC;QACH,gBAAgB;QAChB,yBAAyB;QACzB,sBAAsB;QACtB,IAAM,YAAY,GACd,OAAO,OAAO,CAAC,UAAU,KAAK,WAAW,IAAI,OAAO,CAAC,UAAU;YAC3D,CAAC,CAAC,UAAU,CAAC;gBACP,cAAc,EAAE,IAAI,CAAC,gBAAgB;gBACrC,cAAc,EAAE,OAAO,CAAC,UAAU;gBAClC,cAAc,gBAAA;gBACd,GAAG,EAAE,OAAO,CAAC,GAAG;aACnB,CAAC;YACJ,CAAC,CAAC;gBACI,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,SAAS;aACtB,CAAC;QACZ,IAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC;QAC1C,IAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC;QAC7C,mCAAmC;QACnC,IAAM,qBAAqB,GAAG,yBAAyB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC7E,IAAM,2BAA2B,GAAG,yBAAyB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrF,IAAM,iBAAiB,GAAG,qBAAqB,CAAC,WAAW,CAAC;QAC5D,IAAM,iBAAiB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;QACxD,IAAM,sBAAsB,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;QAC9D,wCAAwC;QACxC,yIAAyI;QACzI,4FAA4F;QAC5F,IAAM,qBAAqB,GAAG,uCAAuC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3F,IAAM,2BAA2B,GAAG,uCAAuC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACnG,4BAA4B;QAC5B,IAAM,WAAW,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,IAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QACpD,IAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;QACxD,IAAM,yBAAyB,GAAG,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAAC;QACpE,IAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QACpD,IAAM,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC;QAChE,IAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAC5C,IAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAC5C,IAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;QACxD,yCAAyC;QACzC,gCAAgC;QAChC,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QAC1E,IAAM,aAAa,GAAG,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;QAC3F,IAAM,WAAW,GAAG,MAAM,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;QAC5F,IAAM,mBAAmB,GAAG,MAAM,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,iBAAiB,CAAC,CAAC;QAC7G,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;QAChF,IAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,2BAA2B,EAAE,uBAAuB,CAAC,CAAC;QAClG,IAAM,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QACzD,IAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAAE,mBAAmB,CAAC,CAAC;QACrF,IAAM,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QACzD,IAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;YAC7C,KAAK,OAAA;YACL,aAAa,eAAA;YACb,WAAW,aAAA;YACX,WAAW,aAAA;YACX,mBAAmB,qBAAA;YACnB,iBAAiB,mBAAA;YACjB,OAAO,SAAA;YACP,aAAa,eAAA;YACb,OAAO,SAAA;YACP,UAAU,EAAE,cAAc;SAC7B,CAAC,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAMD,sBAAI,wBAAI;QAJR;;;WAGG;aACH;YACI,IAAI;gBACA,IAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;gBAC7D,IAAM,UAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC/C,OAAO,GAAG,CAAI,OAAO,SAAI,UAAU,CAAC,CAAC;aACxC;YAAC,OAAO,KAAK,EAAE;gBACZ,wBAAwB;gBACxB,kDAAkD;gBAClD,MAAM,CAAC,IAAI,CAAC,qEAAqE,EAAE,KAAK,CAAC,CAAC;gBAC1F,OAAO,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACjD;QACL,CAAC;;;OAAA;IA6HO,qCAAoB,GAA5B,UAA6B,YAAoB;QAC7C,IAAI,SAAS,CAAC;QACd,IAAI;YACA,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;SAC1C;QAAC,OAAO,EAAE,EAAE;YACT,SAAS,GAAG,IAAI,CAAC;SACpB;QACD,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO;SACV;QACD,oDAAoD;QACpD,0CAA0C;QAC1C,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,4CAA4C,CAAC,CAAC;IACtF,CAAC;IAED,8BAA8B;IAE9B,uBAAM,GAAN;QAAA,iBAaC;QAZG,IAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC1B,IAAI,CAAC,KAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBAC3B,OAAO;aACV;YACD,IAAM,KAAK,GAAI,KAAY,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,KAAK,IAAI,IAAI,EAAE;gBACf,OAAO;aACV;YACD,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1E,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,CAAC;IACb,CAAC;IACL,aAAC;AAAD,CAAC,AA/TD,IA+TC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/package-prefix.d.ts b/node_modules/textlint/module/config/package-prefix.d.ts new file mode 100644 index 000000000..71baa556b --- /dev/null +++ b/node_modules/textlint/module/config/package-prefix.d.ts @@ -0,0 +1,13 @@ +/** + * Package name prefix list + * It is used for shortcut name. + * + * For example, textlint plugin package start with textlint-plugin prefix. + */ +export declare const PackageNamePrefix: { + config: string; + rule: string; + filterRule: string; + rulePreset: string; + plugin: string; +}; diff --git a/node_modules/textlint/module/config/package-prefix.js b/node_modules/textlint/module/config/package-prefix.js new file mode 100644 index 000000000..912544042 --- /dev/null +++ b/node_modules/textlint/module/config/package-prefix.js @@ -0,0 +1,14 @@ +/** + * Package name prefix list + * It is used for shortcut name. + * + * For example, textlint plugin package start with textlint-plugin prefix. + */ +export var PackageNamePrefix = { + config: "textlint-config-", + rule: "textlint-rule-", + filterRule: "textlint-filter-rule-", + rulePreset: "textlint-rule-preset-", + plugin: "textlint-plugin-" +}; +//# sourceMappingURL=package-prefix.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/package-prefix.js.map b/node_modules/textlint/module/config/package-prefix.js.map new file mode 100644 index 000000000..6e9e1656a --- /dev/null +++ b/node_modules/textlint/module/config/package-prefix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"package-prefix.js","sourceRoot":"","sources":["../../src/config/package-prefix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC7B,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,uBAAuB;IACnC,MAAM,EAAE,kBAAkB;CAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/plugin-loader.d.ts b/node_modules/textlint/module/config/plugin-loader.d.ts new file mode 100644 index 000000000..7f4bb0168 --- /dev/null +++ b/node_modules/textlint/module/config/plugin-loader.d.ts @@ -0,0 +1,52 @@ +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +/** + * get plugin names from `configFileRaw` object + * @param configFileRaw + * @returns {Array} + */ +export declare function getPluginNames(configFileRaw: { + plugins?: any; +}): any[]; +/** + * get pluginConfig object from `configFileRaw` that is loaded .textlintrc + * @param {Object} configFileRaw + * @returns {Object} + * @example + * ```js + * "plugins": { + * "pluginA": {}, + * "pluginB": {} + * } + * ``` + * + * to + * + * ```js + * { + * "pluginA": {}, + * "pluginB": {} + * } + * ``` + * + * + * + * ```js + * "plugins": ["pluginA", "pluginB"] + * ``` + * + * to + * + * ``` + * // `true` means turn on + * { + * "pluginA": true, + * "pluginB": true + * } + * ``` + */ +export declare function getPluginConfig(configFileRaw: { + [index: string]: any; +}): { + [index: string]: any; +}; +export declare function loadAvailableExtensions(pluginNames: string[] | undefined, moduleResolver: TextLintModuleResolver): string[]; diff --git a/node_modules/textlint/module/config/plugin-loader.js b/node_modules/textlint/module/config/plugin-loader.js new file mode 100644 index 000000000..45792800e --- /dev/null +++ b/node_modules/textlint/module/config/plugin-loader.js @@ -0,0 +1,89 @@ +import { moduleInterop } from "@textlint/module-interop"; +var debug = require("debug")("textlint:plugin-loader"); +var assert = require("assert"); +/** + * get plugin names from `configFileRaw` object + * @param configFileRaw + * @returns {Array} + */ +export function getPluginNames(configFileRaw) { + var plugins = configFileRaw.plugins; + if (!plugins) { + return []; + } + if (Array.isArray(plugins)) { + return plugins; + } + return Object.keys(plugins); +} +/** + * get pluginConfig object from `configFileRaw` that is loaded .textlintrc + * @param {Object} configFileRaw + * @returns {Object} + * @example + * ```js + * "plugins": { + * "pluginA": {}, + * "pluginB": {} + * } + * ``` + * + * to + * + * ```js + * { + * "pluginA": {}, + * "pluginB": {} + * } + * ``` + * + * + * + * ```js + * "plugins": ["pluginA", "pluginB"] + * ``` + * + * to + * + * ``` + * // `true` means turn on + * { + * "pluginA": true, + * "pluginB": true + * } + * ``` + */ +export function getPluginConfig(configFileRaw) { + var plugins = configFileRaw.plugins; + if (!plugins) { + return {}; + } + if (Array.isArray(plugins)) { + if (plugins.length === 0) { + return {}; + } + // { "pluginA": true, "pluginB": true } + return plugins.reduce(function (results, pluginName) { + results[pluginName] = true; + return results; + }, {}); + } + return plugins; +} +export function loadAvailableExtensions(pluginNames, moduleResolver) { + if (pluginNames === void 0) { pluginNames = []; } + var availableExtensions = []; + pluginNames.forEach(function (pluginName) { + var pkgPath = moduleResolver.resolvePluginPackageName(pluginName); + var plugin = moduleInterop(require(pkgPath)); + if (!plugin.hasOwnProperty("Processor")) { + return; + } + var Processor = plugin.Processor; + debug(pluginName + " has Processor"); + assert.ok(typeof Processor.availableExtensions === "function", "Processor.availableExtensions() should be implemented"); + availableExtensions.push.apply(availableExtensions, Processor.availableExtensions()); + }); + return availableExtensions; +} +//# sourceMappingURL=plugin-loader.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/plugin-loader.js.map b/node_modules/textlint/module/config/plugin-loader.js.map new file mode 100644 index 000000000..c493db550 --- /dev/null +++ b/node_modules/textlint/module/config/plugin-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/config/plugin-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAAC;AACzD,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,aAAgC;IAC3D,IAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;IACtC,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,EAAE,CAAC;KACb;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACxB,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,eAAe,CAAC,aAAuC;IACnE,IAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;IACtC,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,EAAE,CAAC;KACb;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACxB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,OAAO,EAAE,CAAC;SACb;QACD,uCAAuC;QACvC,OAAO,OAAO,CAAC,MAAM,CAAC,UAAC,OAAO,EAAE,UAAU;YACtC,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;YAC3B,OAAO,OAAO,CAAC;QACnB,CAAC,EAAE,EAAE,CAAC,CAAC;KACV;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,WAA0B,EAAE,cAAsC;IAAlE,4BAAA,EAAA,gBAA0B;IAC9D,IAAM,mBAAmB,GAAa,EAAE,CAAC;IACzC,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QAC3B,IAAM,OAAO,GAAG,cAAc,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACpE,IAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YACrC,OAAO;SACV;QACD,IAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACnC,KAAK,CAAI,UAAU,mBAAgB,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,CACL,OAAO,SAAS,CAAC,mBAAmB,KAAK,UAAU,EACnD,uDAAuD,CAC1D,CAAC;QACF,mBAAmB,CAAC,IAAI,OAAxB,mBAAmB,EAAS,SAAS,CAAC,mBAAmB,EAAE,EAAE;IACjE,CAAC,CAAC,CAAC;IACH,OAAO,mBAAmB,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/preset-loader.d.ts b/node_modules/textlint/module/config/preset-loader.d.ts new file mode 100644 index 000000000..6539b74bd --- /dev/null +++ b/node_modules/textlint/module/config/preset-loader.d.ts @@ -0,0 +1,39 @@ +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +/** + * Convert config of preset to rawRulesConfig flat path format. + * + * This function convert Preset nesting rule to flat path + * ``` + * { + * "x" : true + * "preset-a" : { "rule-name": "value" } + * } + * ``` + * => + * ``` + * { "x": true } + * { "a/rule-name": "value" } + * ``` + * + * @param rawRulesConfig + * @returns {{string: string}} + */ +export declare function createFlatRulesConfigFromRawRulesConfig(rawRulesConfig: any): { + [index: string]: any; +}; +/** + * create flat `/` option + * @param {Object} [rulesConfig] + * @param {string} presetName + * @returns {Object} + */ +export declare function createFlatPresetRulesConfigFromRawPresetRuleConfig(rulesConfig: { + [index: string]: string; +}, presetName: string): object; +/** + * + * @param presetNames + * @param {TextLintModuleResolver} moduleResolver + * @returns {{}} + */ +export declare function loadRulesConfigFromPresets(presetNames: string[] | undefined, moduleResolver: TextLintModuleResolver): {}; diff --git a/node_modules/textlint/module/config/preset-loader.js b/node_modules/textlint/module/config/preset-loader.js new file mode 100644 index 000000000..08570bf51 --- /dev/null +++ b/node_modules/textlint/module/config/preset-loader.js @@ -0,0 +1,84 @@ +// LICENSE : MIT +"use strict"; +import { moduleInterop } from "@textlint/module-interop"; +import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils"; +import { isPresetRuleKey } from "./config-util"; +/** + * Convert config of preset to rawRulesConfig flat path format. + * + * This function convert Preset nesting rule to flat path + * ``` + * { + * "x" : true + * "preset-a" : { "rule-name": "value" } + * } + * ``` + * => + * ``` + * { "x": true } + * { "a/rule-name": "value" } + * ``` + * + * @param rawRulesConfig + * @returns {{string: string}} + */ +export function createFlatRulesConfigFromRawRulesConfig(rawRulesConfig) { + if (!rawRulesConfig) { + return {}; + } + var rulesConfig = {}; + Object.keys(rawRulesConfig).forEach(function (key) { + if (isPresetRuleKey(key)) { + // / + var presetName = key; + var presetRuleConfig = rawRulesConfig[key]; + Object.assign(rulesConfig, createFlatPresetRulesConfigFromRawPresetRuleConfig(presetRuleConfig, presetName)); + return; + } + rulesConfig[key] = rawRulesConfig[key]; + }); + return rulesConfig; +} +/** + * create flat `/` option + * @param {Object} [rulesConfig] + * @param {string} presetName + * @returns {Object} + */ +export function createFlatPresetRulesConfigFromRawPresetRuleConfig(rulesConfig, presetName) { + var mapped = {}; + // missing "rulesConfig" + if (rulesConfig === undefined || typeof rulesConfig !== "object") { + return mapped; + } + Object.keys(rulesConfig).forEach(function (ruleName) { + var normalizedKey = normalizeTextlintPresetSubRuleKey({ preset: presetName, rule: ruleName }); + mapped[normalizedKey] = rulesConfig[ruleName]; + }); + return mapped; +} +// load rulesConfig from plugins +/** + * + * @param presetNames + * @param {TextLintModuleResolver} moduleResolver + * @returns {{}} + */ +export function loadRulesConfigFromPresets(presetNames, moduleResolver) { + if (presetNames === void 0) { presetNames = []; } + var presetRulesConfig = {}; + presetNames.forEach(function (presetName) { + var pkgPath = moduleResolver.resolvePresetPackageName(presetName); + var preset = moduleInterop(require(pkgPath)); + if (!preset.hasOwnProperty("rules")) { + throw new Error(presetName + " has not rules"); + } + if (!preset.hasOwnProperty("rulesConfig")) { + throw new Error(presetName + " has not rulesConfig"); + } + // set config of to "/" + Object.assign(presetRulesConfig, createFlatPresetRulesConfigFromRawPresetRuleConfig(preset.rulesConfig, presetName)); + }); + return presetRulesConfig; +} +//# sourceMappingURL=preset-loader.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/preset-loader.js.map b/node_modules/textlint/module/config/preset-loader.js.map new file mode 100644 index 000000000..098de5f34 --- /dev/null +++ b/node_modules/textlint/module/config/preset-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"preset-loader.js","sourceRoot":"","sources":["../../src/config/preset-loader.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uCAAuC,CAAC,cAAmB;IACvE,IAAI,CAAC,cAAc,EAAE;QACjB,OAAO,EAAE,CAAC;KACb;IACD,IAAM,WAAW,GAA6B,EAAE,CAAC;IACjD,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;QACpC,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;YACtB,kBAAkB;YAClB,IAAM,UAAU,GAAG,GAAG,CAAC;YACvB,IAAM,gBAAgB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;YAC7C,MAAM,CAAC,MAAM,CACT,WAAW,EACX,kDAAkD,CAAC,gBAAgB,EAAE,UAAU,CAAC,CACnF,CAAC;YACF,OAAO;SACV;QACD,WAAW,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kDAAkD,CAC9D,WAAwC,EACxC,UAAkB;IAElB,IAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,wBAAwB;IACxB,IAAI,WAAW,KAAK,SAAS,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QAC9D,OAAO,MAAM,CAAC;KACjB;IACD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,QAAQ;QACtC,IAAM,aAAa,GAAG,iCAAiC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChG,MAAM,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,gCAAgC;AAChC;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,WAA0B,EAAE,cAAsC;IAAlE,4BAAA,EAAA,gBAA0B;IACjE,IAAM,iBAAiB,GAAG,EAAE,CAAC;IAC7B,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QAC3B,IAAM,OAAO,GAAG,cAAc,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACpE,IAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAI,UAAU,mBAAgB,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAI,UAAU,yBAAsB,CAAC,CAAC;SACxD;QACD,4CAA4C;QAC5C,MAAM,CAAC,MAAM,CACT,iBAAiB,EACjB,kDAAkD,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,CACrF,CAAC;IACN,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/config/separate-by-config-option.d.ts b/node_modules/textlint/module/config/separate-by-config-option.d.ts new file mode 100644 index 000000000..6ad1f27d5 --- /dev/null +++ b/node_modules/textlint/module/config/separate-by-config-option.d.ts @@ -0,0 +1,11 @@ +export interface RuleOf { + presetNames: string[]; + enabledRuleNames: string[]; + disabledRuleNames: string[]; +} +/** + * Get rule keys from `.textlintrc` config object. + * @param {Object} [rulesConfig] + * @returns {{available: string[], disabledRuleNames: string[]}} + */ +export declare function separateEnabledOrDisabled(rulesConfig: any): RuleOf; diff --git a/node_modules/textlint/module/config/separate-by-config-option.js b/node_modules/textlint/module/config/separate-by-config-option.js new file mode 100644 index 000000000..61192ebe0 --- /dev/null +++ b/node_modules/textlint/module/config/separate-by-config-option.js @@ -0,0 +1,40 @@ +// LICENSE : MIT +"use strict"; +import { isPluginRuleKey, isPresetRuleKey } from "./config-util"; +/** + * Get rule keys from `.textlintrc` config object. + * @param {Object} [rulesConfig] + * @returns {{available: string[], disabledRuleNames: string[]}} + */ +export function separateEnabledOrDisabled(rulesConfig) { + var ruleOf = { + presetNames: [], + enabledRuleNames: [], + disabledRuleNames: [] + }; + if (!rulesConfig) { + return ruleOf; + } + Object.keys(rulesConfig).forEach(function (key) { + // `/` should ignored + if (isPluginRuleKey(key)) { + return; + } + // `textlint-rule-preset-XXX` + if (isPresetRuleKey(key)) { + if (typeof rulesConfig[key] === "object" || rulesConfig[key] === true) { + ruleOf.presetNames.push(key); + } + return; + } + // ignore `false` value + if (typeof rulesConfig[key] === "object" || rulesConfig[key] === true) { + ruleOf.enabledRuleNames.push(key); + } + else { + ruleOf.disabledRuleNames.push(key); + } + }); + return ruleOf; +} +//# sourceMappingURL=separate-by-config-option.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/config/separate-by-config-option.js.map b/node_modules/textlint/module/config/separate-by-config-option.js.map new file mode 100644 index 000000000..850e8a448 --- /dev/null +++ b/node_modules/textlint/module/config/separate-by-config-option.js.map @@ -0,0 +1 @@ +{"version":3,"file":"separate-by-config-option.js","sourceRoot":"","sources":["../../src/config/separate-by-config-option.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAMjE;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAAgB;IACtD,IAAM,MAAM,GAAW;QACnB,WAAW,EAAE,EAAE;QACf,gBAAgB,EAAE,EAAE;QACpB,iBAAiB,EAAE,EAAE;KACxB,CAAC;IACF,IAAI,CAAC,WAAW,EAAE;QACd,OAAO,MAAM,CAAC;KACjB;IACD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;QACjC,uCAAuC;QACvC,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;YACtB,OAAO;SACV;QACD,6BAA6B;QAC7B,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;gBACnE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAChC;YACD,OAAO;SACV;QACD,uBAAuB;QACvB,IAAI,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;YACnE,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrC;aAAM;YACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/execute-file-backer-manager.d.ts b/node_modules/textlint/module/engine/execute-file-backer-manager.d.ts new file mode 100644 index 000000000..450c04a91 --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backer-manager.d.ts @@ -0,0 +1,26 @@ +import { AbstractBacker } from "./execute-file-backers/abstruct-backer"; +import { TextlintResult } from "@textlint/kernel"; +export declare class ExecuteFileBackerManager { + _backers: AbstractBacker[]; + /** + * create MessageProcessManager with backers + * @param {AbstractBacker[]} backers + */ + constructor(backers?: AbstractBacker[]); + /** + * @param {AbstractBacker} backer + */ + add(backer: AbstractBacker): void; + /** + * @param {AbstractBacker} backer + */ + remove(backer: AbstractBacker): void; + /** + * process `messages` with registered processes + */ + process(files: string[], executeFile: (filePath: string) => Promise): Promise; + /** + * create fake result object + */ + private _createFakeResult; +} diff --git a/node_modules/textlint/module/engine/execute-file-backer-manager.js b/node_modules/textlint/module/engine/execute-file-backer-manager.js new file mode 100644 index 000000000..e56f9cd26 --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backer-manager.js @@ -0,0 +1,71 @@ +var ExecuteFileBackerManager = /** @class */ (function () { + /** + * create MessageProcessManager with backers + * @param {AbstractBacker[]} backers + */ + function ExecuteFileBackerManager(backers) { + if (backers === void 0) { backers = []; } + this._backers = backers; + } + /** + * @param {AbstractBacker} backer + */ + ExecuteFileBackerManager.prototype.add = function (backer) { + this._backers.push(backer); + }; + /** + * @param {AbstractBacker} backer + */ + ExecuteFileBackerManager.prototype.remove = function (backer) { + var index = this._backers.indexOf(backer); + if (index !== -1) { + this._backers.splice(index, 1); + } + }; + /** + * process `messages` with registered processes + */ + ExecuteFileBackerManager.prototype.process = function (files, executeFile) { + var _this = this; + var unExecutedResults = []; + var resultPromises = files + .filter(function (filePath) { + var shouldExecute = _this._backers.every(function (backer) { + return backer.shouldExecute({ filePath: filePath }); + }); + // add fake unExecutedResults for un-executed file. + if (!shouldExecute) { + unExecutedResults.push(_this._createFakeResult(filePath)); + } + return shouldExecute; + }) + .map(function (filePath) { + return executeFile(filePath).then(function (result) { + _this._backers.forEach(function (backer) { + backer.didExecute({ result: result }); + }); + return result; + }); + }) + .concat(unExecutedResults); + // wait all resolved, and call afterAll + return Promise.all(resultPromises).then(function (results) { + _this._backers.forEach(function (backer) { + backer.afterAll(); + }); + return results; + }); + }; + /** + * create fake result object + */ + ExecuteFileBackerManager.prototype._createFakeResult = function (filePath) { + return Promise.resolve({ + filePath: filePath, + messages: [] + }); + }; + return ExecuteFileBackerManager; +}()); +export { ExecuteFileBackerManager }; +//# sourceMappingURL=execute-file-backer-manager.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/execute-file-backer-manager.js.map b/node_modules/textlint/module/engine/execute-file-backer-manager.js.map new file mode 100644 index 000000000..f28cdbe4b --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backer-manager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"execute-file-backer-manager.js","sourceRoot":"","sources":["../../src/engine/execute-file-backer-manager.ts"],"names":[],"mappings":"AAGA;IAGI;;;OAGG;IACH,kCAAY,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QACtC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,sCAAG,GAAH,UAAI,MAAsB;QACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,yCAAM,GAAN,UAAO,MAAsB;QACzB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAClC;IACL,CAAC;IAED;;OAEG;IACH,0CAAO,GAAP,UAAQ,KAAe,EAAE,WAA0D;QAAnF,iBA6BC;QA5BG,IAAM,iBAAiB,GAAmC,EAAE,CAAC;QAC7D,IAAM,cAAc,GAAG,KAAK;aACvB,MAAM,CAAC,UAAC,QAAQ;YACb,IAAM,aAAa,GAAG,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAC,MAAM;gBAC7C,OAAO,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YACH,mDAAmD;YACnD,IAAI,CAAC,aAAa,EAAE;gBAChB,iBAAiB,CAAC,IAAI,CAAC,KAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC5D;YACD,OAAO,aAAa,CAAC;QACzB,CAAC,CAAC;aACD,GAAG,CAAC,UAAC,QAAQ;YACV,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,MAAM;gBACrC,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,MAAM;oBACzB,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;gBAClC,CAAC,CAAC,CAAC;gBACH,OAAO,MAAM,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;aACD,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/B,uCAAuC;QACvC,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAC,OAAyB;YAC9D,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,MAAM;gBACzB,MAAM,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,oDAAiB,GAAzB,UAA0B,QAAgB;QACtC,OAAO,OAAO,CAAC,OAAO,CAAC;YACnB,QAAQ,UAAA;YACR,QAAQ,EAAE,EAAE;SACf,CAAC,CAAC;IACP,CAAC;IACL,+BAAC;AAAD,CAAC,AAvED,IAuEC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.d.ts b/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.d.ts new file mode 100644 index 000000000..cb19bea86 --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.d.ts @@ -0,0 +1,21 @@ +import { TextlintResult } from "@textlint/kernel"; +export declare abstract class AbstractBacker { + /** + * @param {string} filePath + * @returns {boolean} + */ + abstract shouldExecute({ filePath }: { + filePath: string; + }): boolean; + /** + * @param {TextlintResult} result + * @returns {boolean} + */ + abstract didExecute({ result }: { + result: TextlintResult; + }): void; + /** + * call when after all execution is completed + */ + abstract afterAll(): void; +} diff --git a/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.js b/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.js new file mode 100644 index 000000000..6d6a51089 --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.js @@ -0,0 +1,10 @@ +// MIT © 2016 azu +"use strict"; +/* eslint-disable */ +var AbstractBacker = /** @class */ (function () { + function AbstractBacker() { + } + return AbstractBacker; +}()); +export { AbstractBacker }; +//# sourceMappingURL=abstruct-backer.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.js.map b/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.js.map new file mode 100644 index 000000000..696d1f47c --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backers/abstruct-backer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstruct-backer.js","sourceRoot":"","sources":["../../../src/engine/execute-file-backers/abstruct-backer.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,YAAY,CAAC;AAEb,oBAAoB;AACpB;IAAA;IAiBA,CAAC;IAAD,qBAAC;AAAD,CAAC,AAjBD,IAiBC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/execute-file-backers/cache-backer.d.ts b/node_modules/textlint/module/engine/execute-file-backers/cache-backer.d.ts new file mode 100644 index 000000000..22b9c0001 --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backers/cache-backer.d.ts @@ -0,0 +1,30 @@ +import { AbstractBacker } from "./abstruct-backer"; +import { Config } from "../../config/config"; +import { TextlintResult } from "@textlint/kernel"; +export declare class CacheBacker implements AbstractBacker { + config: Config; + fileCache: any; + isEnabled: boolean; + /** + * @param {Config} config + */ + constructor(config: Config); + /** + * @param {string} filePath + * @returns {boolean} + */ + shouldExecute({ filePath }: { + filePath: string; + }): any; + /** + * @param {TextlintResult} result + */ + didExecute({ result }: { + result: TextlintResult; + }): void; + /** + * destroy all cache + */ + destroyCache(): void; + afterAll(): void; +} diff --git a/node_modules/textlint/module/engine/execute-file-backers/cache-backer.js b/node_modules/textlint/module/engine/execute-file-backers/cache-backer.js new file mode 100644 index 000000000..1b5c3174f --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backers/cache-backer.js @@ -0,0 +1,71 @@ +// MIT © 2016 azu +"use strict"; +var fileEntryCache = require("file-entry-cache"); +var debug = require("debug")("textlint:CacheBacker"); +var CacheBacker = /** @class */ (function () { + /** + * @param {Config} config + */ + function CacheBacker(config) { + this.config = config; + /** + * @type {boolean} + */ + this.isEnabled = config.cache; + this.fileCache = fileEntryCache.create(config.cacheLocation); + } + /** + * @param {string} filePath + * @returns {boolean} + */ + CacheBacker.prototype.shouldExecute = function (_a) { + var filePath = _a.filePath; + if (!this.isEnabled) { + return true; + } + var descriptor = this.fileCache.getFileDescriptor(filePath); + var meta = descriptor.meta || {}; + // if the config is changed or file is changed, should execute return true + var isChanged = descriptor.changed || meta.hashOfConfig !== this.config.hash; + debug("Skipping file since hasn't changed: " + filePath); + return isChanged; + }; + /** + * @param {TextlintResult} result + */ + CacheBacker.prototype.didExecute = function (_a) { + var result = _a.result; + if (!this.isEnabled) { + return; + } + var filePath = result.filePath; + var descriptor = this.fileCache.getFileDescriptor(filePath); + var meta = descriptor.meta || {}; + /* + * if a file contains messages we don't want to store the file in the cache + * so we can guarantee that next execution will also operate on this file + */ + if (result.messages.length > 0) { + debug("File has problems, skipping it: " + filePath); + // remove the entry from the cache + this.fileCache.removeEntry(filePath); + } + else { + // cache `config.hash` + meta.hashOfConfig = this.config.hash; + } + }; + /** + * destroy all cache + */ + CacheBacker.prototype.destroyCache = function () { + this.fileCache.destroy(); + }; + CacheBacker.prototype.afterAll = function () { + // persist cache + this.fileCache.reconcile(); + }; + return CacheBacker; +}()); +export { CacheBacker }; +//# sourceMappingURL=cache-backer.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/execute-file-backers/cache-backer.js.map b/node_modules/textlint/module/engine/execute-file-backers/cache-backer.js.map new file mode 100644 index 000000000..58ea60a8b --- /dev/null +++ b/node_modules/textlint/module/engine/execute-file-backers/cache-backer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cache-backer.js","sourceRoot":"","sources":["../../../src/engine/execute-file-backers/cache-backer.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,YAAY,CAAC;AACb,IAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACnD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAAC;AAIvD;IAGI;;OAEG;IACH,qBAAmB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAC7B;;WAEG;QACH,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACH,mCAAa,GAAb,UAAc,EAAkC;YAAhC,QAAQ,cAAA;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,OAAO,IAAI,CAAC;SACf;QACD,IAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9D,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,0EAA0E;QAC1E,IAAM,SAAS,GAAG,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAC/E,KAAK,CAAC,yCAAuC,QAAU,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,gCAAU,GAAV,UAAW,EAAsC;YAApC,MAAM,YAAA;QACf,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,OAAO;SACV;QACD,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,IAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9D,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC;;;WAGG;QACH,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,KAAK,CAAC,qCAAmC,QAAU,CAAC,CAAC;YACrD,kCAAkC;YAClC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SACxC;aAAM;YACH,sBAAsB;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACH,kCAAY,GAAZ;QACI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,8BAAQ,GAAR;QACI,gBAAgB;QAChB,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;IAC/B,CAAC;IACL,kBAAC;AAAD,CAAC,AAjED,IAiEC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/processor-map.d.ts b/node_modules/textlint/module/engine/processor-map.d.ts new file mode 100644 index 000000000..af65acf7a --- /dev/null +++ b/node_modules/textlint/module/engine/processor-map.d.ts @@ -0,0 +1,7 @@ +import { MapLike } from "map-like"; +/** + * Processor Map object + */ +export declare class PluginMap extends MapLike { + toJSON(): {}; +} diff --git a/node_modules/textlint/module/engine/processor-map.js b/node_modules/textlint/module/engine/processor-map.js new file mode 100644 index 000000000..3887e59a4 --- /dev/null +++ b/node_modules/textlint/module/engine/processor-map.js @@ -0,0 +1,35 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { MapLike } from "map-like"; +/** + * Processor Map object + */ +var PluginMap = /** @class */ (function (_super) { + __extends(PluginMap, _super); + function PluginMap() { + return _super !== null && _super.apply(this, arguments) || this; + } + PluginMap.prototype.toJSON = function () { + var object = {}; + this.forEach(function (value, key) { + object[key] = value; + }); + return object; + }; + return PluginMap; +}(MapLike)); +export { PluginMap }; +//# sourceMappingURL=processor-map.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/processor-map.js.map b/node_modules/textlint/module/engine/processor-map.js.map new file mode 100644 index 000000000..053c0acb8 --- /dev/null +++ b/node_modules/textlint/module/engine/processor-map.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processor-map.js","sourceRoot":"","sources":["../../src/engine/processor-map.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;GAEG;AACH;IAA+B,6BAAyB;IAAxD;;IAQA,CAAC;IAPG,0BAAM,GAAN;QACI,IAAM,MAAM,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,GAAG;YACnB,MAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,gBAAC;AAAD,CAAC,AARD,CAA+B,OAAO,GAQrC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/rule-loader.d.ts b/node_modules/textlint/module/engine/rule-loader.d.ts new file mode 100644 index 000000000..7e59a8d6c --- /dev/null +++ b/node_modules/textlint/module/engine/rule-loader.d.ts @@ -0,0 +1,10 @@ +/** + * Load all rule modules from specified directory. + * These are filtered by [extname] + * @param {String} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`. + * @param {String} [extname] extension name + * @returns {Object} Loaded rule modules by rule ids (file names). + */ +export declare function loadFromDir(rulesDir: string, extname?: string): { + [index: string]: any; +}; diff --git a/node_modules/textlint/module/engine/rule-loader.js b/node_modules/textlint/module/engine/rule-loader.js new file mode 100644 index 000000000..35aba707e --- /dev/null +++ b/node_modules/textlint/module/engine/rule-loader.js @@ -0,0 +1,31 @@ +"use strict"; +import { moduleInterop } from "@textlint/module-interop"; +import * as fs from "fs"; +import * as path from "path"; +/** + * Load all rule modules from specified directory. + * These are filtered by [extname] + * @param {String} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`. + * @param {String} [extname] extension name + * @returns {Object} Loaded rule modules by rule ids (file names). + */ +export function loadFromDir(rulesDir, extname) { + if (extname === void 0) { extname = ".js"; } + var rulesDirAbsolutePath; + if (!rulesDir) { + rulesDirAbsolutePath = path.join(__dirname, "rules"); + } + else { + rulesDirAbsolutePath = path.resolve(process.cwd(), rulesDir); + } + var rules = Object.create(null); + fs.readdirSync(rulesDirAbsolutePath).forEach(function (file) { + if (path.extname(file) !== extname) { + return; + } + var withoutExt = path.basename(file, extname); + rules[withoutExt] = moduleInterop(require(path.join(rulesDirAbsolutePath, file))); + }); + return rules; +} +//# sourceMappingURL=rule-loader.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/rule-loader.js.map b/node_modules/textlint/module/engine/rule-loader.js.map new file mode 100644 index 000000000..5e34d980c --- /dev/null +++ b/node_modules/textlint/module/engine/rule-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rule-loader.js","sourceRoot":"","sources":["../../src/engine/rule-loader.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,OAAuB;IAAvB,wBAAA,EAAA,eAAuB;IACjE,IAAI,oBAA4B,CAAC;IACjC,IAAI,CAAC,QAAQ,EAAE;QACX,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;KACxD;SAAM;QACH,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;KAChE;IACD,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,EAAE,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,UAAC,IAAY;QACtD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE;YAChC,OAAO;SACV;QACD,IAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChD,KAAK,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/rule-map.d.ts b/node_modules/textlint/module/engine/rule-map.d.ts new file mode 100644 index 000000000..8bfc6b900 --- /dev/null +++ b/node_modules/textlint/module/engine/rule-map.d.ts @@ -0,0 +1,32 @@ +import { MapLike } from "map-like"; +/** + * @typedef {{key: Function}} RulesObject + */ +export declare class RuleMap extends MapLike { + /** + * has rule at least one > 0 + * @returns {boolean} + */ + hasRuleAtLeastOne(): boolean; + getAllRuleNames(): string[]; + getRule(ruleKey: string): Function | undefined; + /** + * @returns {RulesObject} + */ + getAllRules(): { + [index: string]: any; + }; + isDefinedRule(ruleKey: string): boolean; + /** + * @param {string} ruleKey + * @param ruleHandler + */ + defineRule(ruleKey: string, ruleHandler: Function | undefined): void; + /** + * reset defined rules + */ + resetRules(): void; + toJSON(): { + [index: string]: any; + }; +} diff --git a/node_modules/textlint/module/engine/rule-map.js b/node_modules/textlint/module/engine/rule-map.js new file mode 100644 index 000000000..4293abceb --- /dev/null +++ b/node_modules/textlint/module/engine/rule-map.js @@ -0,0 +1,70 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { MapLike } from "map-like"; +/** + * @typedef {{key: Function}} RulesObject + */ +var RuleMap = /** @class */ (function (_super) { + __extends(RuleMap, _super); + function RuleMap() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * has rule at least one > 0 + * @returns {boolean} + */ + RuleMap.prototype.hasRuleAtLeastOne = function () { + return this.keys().length > 0; + }; + RuleMap.prototype.getAllRuleNames = function () { + return this.keys(); + }; + RuleMap.prototype.getRule = function (ruleKey) { + return this.get(ruleKey); + }; + /** + * @returns {RulesObject} + */ + RuleMap.prototype.getAllRules = function () { + return this.toJSON(); + }; + RuleMap.prototype.isDefinedRule = function (ruleKey) { + return this.has(ruleKey); + }; + /** + * @param {string} ruleKey + * @param ruleHandler + */ + RuleMap.prototype.defineRule = function (ruleKey, ruleHandler) { + this.set(ruleKey, ruleHandler); + }; + /** + * reset defined rules + */ + RuleMap.prototype.resetRules = function () { + this.clear(); + }; + RuleMap.prototype.toJSON = function () { + var object = {}; + this.forEach(function (value, key) { + object[key] = value; + }); + return object; + }; + return RuleMap; +}(MapLike)); +export { RuleMap }; +//# sourceMappingURL=rule-map.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/rule-map.js.map b/node_modules/textlint/module/engine/rule-map.js.map new file mode 100644 index 000000000..c170ef67a --- /dev/null +++ b/node_modules/textlint/module/engine/rule-map.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rule-map.js","sourceRoot":"","sources":["../../src/engine/rule-map.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;GAEG;AACH;IAA6B,2BAAyB;IAAtD;;IAkDA,CAAC;IAjDG;;;OAGG;IACH,mCAAiB,GAAjB;QACI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,iCAAe,GAAf;QACI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAED,yBAAO,GAAP,UAAQ,OAAe;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,6BAAW,GAAX;QACI,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;IAED,+BAAa,GAAb,UAAc,OAAe;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,4BAAU,GAAV,UAAW,OAAe,EAAE,WAAiC;QACzD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,4BAAU,GAAV;QACI,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,wBAAM,GAAN;QACI,IAAM,MAAM,GAA6B,EAAE,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,GAAG;YACpB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,cAAC;AAAD,CAAC,AAlDD,CAA6B,OAAO,GAkDnC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-engine-core.d.ts b/node_modules/textlint/module/engine/textlint-engine-core.d.ts new file mode 100644 index 000000000..c1fe9eb8e --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-engine-core.d.ts @@ -0,0 +1,144 @@ +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { TextLintFormatterOption } from "../textlint-interface"; +import { TextLintCore } from "../textlint-core"; +import { Config } from "../config/config"; +import { TextlintMessage, TextlintResult } from "@textlint/kernel"; +/** + * Core of TextLintEngine. + * It is internal user. + * + * Hackable adaptor + * + * - executeOnFiles + * - executeOnText + * - formatResults + * + * There are hackable by `executor` option. + */ +export declare abstract class AbstractTextLintEngine { + private moduleLoader; + private pluginMap; + private ruleMap; + private filterRuleMap; + private executeFileBackerManger; + private textlint; + private config; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + abstract onFile: (textlintCore: TextLintCore) => (filePath: string) => Promise; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + abstract onText: (textlintCore: TextLintCore) => (text: string, ext?: string) => Promise; + /** + * @param {TextLintFormatterOption} formatterConfig + */ + abstract onFormat: (formatterConfig: TextLintFormatterOption) => (results: LintResult[]) => string; + /** + * Process files are wanted to lint. + * TextLintEngine is a wrapper of textlint.js. + * Aim to be called from cli with cli options. + * @param {Config|Object} [options] the options is command line options or Config object. + * @constructor + */ + constructor(options?: Config | object); + /** + * @deprecated remove this method + */ + setRulesBaseDirectory(): void; + /** + * load plugin manually + * Note: it high cost, please use config + * @param {string} pluginName + * @deprecated use Constructor(config) insteadof it + */ + loadPlugin(pluginName: string): void; + /** + * load plugin manually + * Note: it high cost, please use config + * @param {string} presetName + * @deprecated use Constructor(config) insteadof it + */ + loadPreset(presetName: string): void; + /** + * load rule manually + * Note: it high cost, please use config + * @param {string} ruleName + * @deprecated use Constructor(config) insteadof it + */ + loadRule(ruleName: string): void; + /** + * load filter rule manually + * Note: it high cost, please use config + * @param {string} ruleName + * @deprecated use Constructor(config) insteadof it + */ + loadFilerRule(ruleName: string): void; + /** + * Update rules from current config + * @private + */ + private _setupRules; + /** + * Remove all registered rule and clear messages. + * @private + */ + resetRules(): void; + /** + * Return available extensions of plugins that include built-in plugins + * @example + * ``` + * engine.availableExtensions; // => [".txt", ".md"] + * ``` + */ + get availableExtensions(): string[]; + /** + * Return meta descriptor object for this engine + * + * WARNING: This is experimental getter method. + * It will be renamed. + */ + get textlintrcDescriptor(): TextlintKernelDescriptor; + /** + * Executes the current configuration on an array of file and directory names. + * @param {String[]} files An array of file and directory names. + * @returns {Promise} The results for all files that were linted. + */ + executeOnFiles(files: string[]): Promise; + /** + * If want to lint a text, use it. + * But, if you have a target file, use {@link executeOnFiles} instead of it. + * @param {string} text linting text content + * @param {string} ext ext is a type for linting. default: ".txt" + * @returns {Promise} + */ + executeOnText(text: string, ext?: string): Promise; + /** + * format {@link results} and return output text. + * @param {TextlintResult[]} results the collection of result + * @returns {string} formatted output text + * @example + * console.log(formatResults(results)); + */ + formatResults(results: LintResult[]): string; + /** + * Checks if the given message is an error message. + * @param {TextlintMessage} message The message to check. + * @returns {boolean} Whether or not the message is an error message. + */ + isErrorMessage(message: TextlintMessage): boolean; + /** + * Checks if the given results contain error message. + * If there is even one error then return true. + * @param {TextlintResult[]} results Linting result collection + * @returns {Boolean} Whether or not the results contain error message. + */ + isErrorResults(results: TextlintResult[]): boolean; + /** + * @returns {boolean} + */ + hasRuleAtLeastOne(): boolean; +} diff --git a/node_modules/textlint/module/engine/textlint-engine-core.js b/node_modules/textlint/module/engine/textlint-engine-core.js new file mode 100644 index 000000000..83c670ef2 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-engine-core.js @@ -0,0 +1,281 @@ +// LICENSE : MIT +"use strict"; +import { TextLintCore } from "../textlint-core"; +import { RuleMap } from "./rule-map"; +import { PluginMap } from "./processor-map"; +import { Config } from "../config/config"; +import { findFiles, pathsToGlobPatterns, separateByAvailability } from "../util/find-util"; +import { TextLintModuleLoader } from "./textlint-module-loader"; +import { ExecuteFileBackerManager } from "./execute-file-backer-manager"; +import { CacheBacker } from "./execute-file-backers/cache-backer"; +import { SeverityLevel } from "../shared/type/SeverityLevel"; +var path = require("path"); +var debug = require("debug")("textlint:engine-core"); +/** + * Core of TextLintEngine. + * It is internal user. + * + * Hackable adaptor + * + * - executeOnFiles + * - executeOnText + * - formatResults + * + * There are hackable by `executor` option. + */ +var AbstractTextLintEngine = /** @class */ (function () { + /** + * Process files are wanted to lint. + * TextLintEngine is a wrapper of textlint.js. + * Aim to be called from cli with cli options. + * @param {Config|Object} [options] the options is command line options or Config object. + * @constructor + */ + function AbstractTextLintEngine(options) { + var _this = this; + /** + * @type {Config} + */ + if (options instanceof Config) { + // Almost internal use-case + this.config = options; + } + else { + this.config = Config.initWithAutoLoading(options); + } + /** + * @type {TextLintCore} + * @private + */ + this.textlint = new TextLintCore(this.config); + /** + * @type {ExecuteFileBackerManager} + * @private + */ + this.executeFileBackerManger = new ExecuteFileBackerManager(); + var cacheBaker = new CacheBacker(this.config); + if (this.config.cache) { + this.executeFileBackerManger.add(cacheBaker); + } + else { + cacheBaker.destroyCache(); + } + /** + * @type {RuleMap} ruleMap is used for linting/fixer + * @private + */ + this.ruleMap = new RuleMap(); + /** + * @type {RuleMap} filerRuleMap is used for filtering + * @private + */ + this.filterRuleMap = new RuleMap(); + /** + * @type {PluginMap} + * @private + */ + this.pluginMap = new PluginMap(); + /** + * @type {TextLintModuleLoader} + * @private + */ + this.moduleLoader = new TextLintModuleLoader(this.config); + this.moduleLoader.on(TextLintModuleLoader.Event.rule, function (_a) { + var ruleName = _a[0], ruleCreator = _a[1]; + _this.ruleMap.defineRule(ruleName, ruleCreator); + }); + this.moduleLoader.on(TextLintModuleLoader.Event.filterRule, function (_a) { + var ruleName = _a[0], ruleCreator = _a[1]; + _this.filterRuleMap.defineRule(ruleName, ruleCreator); + }); + this.moduleLoader.on(TextLintModuleLoader.Event.plugin, function (_a) { + var pluginName = _a[0], plugin = _a[1]; + _this.pluginMap.set(pluginName, plugin); + }); + // load rule/plugin/processor + this.moduleLoader.loadFromConfig(this.config); + // set settings to textlint core + this._setupRules(); + } + /** + * @deprecated remove this method + */ + AbstractTextLintEngine.prototype.setRulesBaseDirectory = function () { + throw new Error("Should not use setRulesBaseDirectory(), insteadof use \nnew TextLintEngine({\n rulesBaseDirectory: directory\n})\n "); + }; + /** + * load plugin manually + * Note: it high cost, please use config + * @param {string} pluginName + * @deprecated use Constructor(config) insteadof it + */ + AbstractTextLintEngine.prototype.loadPlugin = function (pluginName) { + this.moduleLoader.loadPlugin(pluginName); + this._setupRules(); + }; + /** + * load plugin manually + * Note: it high cost, please use config + * @param {string} presetName + * @deprecated use Constructor(config) insteadof it + */ + AbstractTextLintEngine.prototype.loadPreset = function (presetName) { + this.moduleLoader.loadPreset(presetName); + this._setupRules(); + }; + /** + * load rule manually + * Note: it high cost, please use config + * @param {string} ruleName + * @deprecated use Constructor(config) insteadof it + */ + AbstractTextLintEngine.prototype.loadRule = function (ruleName) { + this.moduleLoader.loadRule(ruleName); + this._setupRules(); + }; + /** + * load filter rule manually + * Note: it high cost, please use config + * @param {string} ruleName + * @deprecated use Constructor(config) insteadof it + */ + AbstractTextLintEngine.prototype.loadFilerRule = function (ruleName) { + this.moduleLoader.loadFilterRule(ruleName); + this._setupRules(); + }; + /** + * Update rules from current config + * @private + */ + AbstractTextLintEngine.prototype._setupRules = function () { + // set Rules + var textlintConfig = this.config ? this.config.toJSON() : {}; + this.textlint.setupRules(this.ruleMap.getAllRules(), textlintConfig.rulesConfig); + this.textlint.setupFilterRules(this.filterRuleMap.getAllRules(), textlintConfig.filterRulesConfig); + // set Processor + this.textlint.setupPlugins(this.pluginMap.toJSON(), textlintConfig.pluginsConfig); + }; + /** + * Remove all registered rule and clear messages. + * @private + */ + AbstractTextLintEngine.prototype.resetRules = function () { + this.textlint.resetRules(); + this.ruleMap.resetRules(); + this.filterRuleMap.resetRules(); + }; + Object.defineProperty(AbstractTextLintEngine.prototype, "availableExtensions", { + /** + * Return available extensions of plugins that include built-in plugins + * @example + * ``` + * engine.availableExtensions; // => [".txt", ".md"] + * ``` + */ + get: function () { + return this.textlint.textlintKernelDescriptor.availableExtensions; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractTextLintEngine.prototype, "textlintrcDescriptor", { + /** + * Return meta descriptor object for this engine + * + * WARNING: This is experimental getter method. + * It will be renamed. + */ + get: function () { + return this.textlint.textlintKernelDescriptor; + }, + enumerable: false, + configurable: true + }); + /** + * Executes the current configuration on an array of file and directory names. + * @param {String[]} files An array of file and directory names. + * @returns {Promise} The results for all files that were linted. + */ + AbstractTextLintEngine.prototype.executeOnFiles = function (files) { + var execFile = this.onFile(this.textlint); + var patterns = pathsToGlobPatterns(files, { + extensions: this.textlintrcDescriptor.availableExtensions + }); + var targetFiles = findFiles(patterns, { ignoreFilePath: this.config.ignoreFile }); + // Maybe, unAvailableFilePath should be warning. + // But, The user can use glob pattern like `src/**/*` as arguments. + // pathsToGlobPatterns not modified that pattern. + // So, unAvailableFilePath should be ignored silently. + var _a = separateByAvailability(targetFiles, { + extensions: this.textlintrcDescriptor.availableExtensions + }), availableFiles = _a.availableFiles, unAvailableFiles = _a.unAvailableFiles; + debug("Process files", availableFiles); + debug("No Process files that are un-support extensions:", unAvailableFiles); + // FIXME: remove cast + return this.executeFileBackerManger.process(availableFiles, execFile); + }; + /** + * If want to lint a text, use it. + * But, if you have a target file, use {@link executeOnFiles} instead of it. + * @param {string} text linting text content + * @param {string} ext ext is a type for linting. default: ".txt" + * @returns {Promise} + */ + AbstractTextLintEngine.prototype.executeOnText = function (text, ext) { + if (ext === void 0) { ext = ".txt"; } + var textlint = this.textlint; + var execText = this.onText(textlint); + // filePath or ext + var actualExt = ext[0] === "." ? ext : path.extname(ext); + if (actualExt.length === 0) { + throw new Error("should specify the extension.\nex) .md"); + } + return execText(text, actualExt).then(function (result) { + return [result]; + }); + }; + /** + * format {@link results} and return output text. + * @param {TextlintResult[]} results the collection of result + * @returns {string} formatted output text + * @example + * console.log(formatResults(results)); + */ + AbstractTextLintEngine.prototype.formatResults = function (results) { + // default formatter: "stylish" + var formatter = this.onFormat({ + formatterName: this.config.formatterName || "stylish", + color: this.config.color + }); + return formatter(results); + }; + /** + * Checks if the given message is an error message. + * @param {TextlintMessage} message The message to check. + * @returns {boolean} Whether or not the message is an error message. + */ + AbstractTextLintEngine.prototype.isErrorMessage = function (message) { + return message.severity === SeverityLevel.error; + }; + /** + * Checks if the given results contain error message. + * If there is even one error then return true. + * @param {TextlintResult[]} results Linting result collection + * @returns {Boolean} Whether or not the results contain error message. + */ + AbstractTextLintEngine.prototype.isErrorResults = function (results) { + var _this = this; + return results.some(function (result) { + return result.messages.some(_this.isErrorMessage); + }); + }; + /** + * @returns {boolean} + */ + AbstractTextLintEngine.prototype.hasRuleAtLeastOne = function () { + return this.ruleMap.hasRuleAtLeastOne(); + }; + return AbstractTextLintEngine; +}()); +export { AbstractTextLintEngine }; +//# sourceMappingURL=textlint-engine-core.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-engine-core.js.map b/node_modules/textlint/module/engine/textlint-engine-core.js.map new file mode 100644 index 000000000..cff6982ad --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-engine-core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-engine-core.js","sourceRoot":"","sources":["../../src/engine/textlint-engine-core.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH;IAyBI;;;;;;OAMG;IACH,gCAAY,OAAyB;QAArC,iBA2DC;QA1DG;;WAEG;QACH,IAAI,OAAO,YAAY,MAAM,EAAE;YAC3B,2BAA2B;YAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;SACzB;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;SACrD;QACD;;;WAGG;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C;;;WAGG;QACH,IAAI,CAAC,uBAAuB,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC9D,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;YACnB,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAChD;aAAM;YACH,UAAU,CAAC,YAAY,EAAE,CAAC;SAC7B;QACD;;;WAGG;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAC7B;;;WAGG;QACH,IAAI,CAAC,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;QACnC;;;WAGG;QACH,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;QACjC;;;WAGG;QACH,IAAI,CAAC,YAAY,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,UAAC,EAAuB;gBAAtB,QAAQ,QAAA,EAAE,WAAW,QAAA;YACzE,KAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,UAAC,EAAuB;gBAAtB,QAAQ,QAAA,EAAE,WAAW,QAAA;YAC/E,KAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,EAAE,UAAC,EAAoB;gBAAnB,UAAU,QAAA,EAAE,MAAM,QAAA;YACxE,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,6BAA6B;QAC7B,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,gCAAgC;QAChC,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,sDAAqB,GAArB;QACI,MAAM,IAAI,KAAK,CAAC,oIAIf,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,2CAAU,GAAV,UAAW,UAAkB;QACzB,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,2CAAU,GAAV,UAAW,UAAkB;QACzB,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,yCAAQ,GAAR,UAAS,QAAgB;QACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,8CAAa,GAAb,UAAc,QAAgB;QAC1B,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;OAGG;IACK,4CAAW,GAAnB;QACI,YAAY;QACZ,IAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;QACjF,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;QACnG,gBAAgB;QAChB,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACtF,CAAC;IAED;;;OAGG;IACH,2CAAU,GAAV;QACI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;IASD,sBAAI,uDAAmB;QAPvB;;;;;;WAMG;aACH;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,mBAAmB,CAAC;QACtE,CAAC;;;OAAA;IAQD,sBAAI,wDAAoB;QANxB;;;;;WAKG;aACH;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAClD,CAAC;;;OAAA;IAED;;;;OAIG;IACH,+CAAc,GAAd,UAAe,KAAe;QAC1B,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE;YACxC,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,mBAAmB;SAC5D,CAAC,CAAC;QACH,IAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QACpF,gDAAgD;QAChD,mEAAmE;QACnE,iDAAiD;QACjD,sDAAsD;QAChD,IAAA,KAAuC,sBAAsB,CAAC,WAAW,EAAE;YAC7E,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,mBAAmB;SAC5D,CAAC,EAFM,cAAc,oBAAA,EAAE,gBAAgB,sBAEtC,CAAC;QACH,KAAK,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACvC,KAAK,CAAC,kDAAkD,EAAE,gBAAgB,CAAC,CAAC;QAC5E,qBAAqB;QACrB,OAAO,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAA0B,CAAC;IACnG,CAAC;IAED;;;;;;OAMG;IACH,8CAAa,GAAb,UAAc,IAAY,EAAE,GAAoB;QAApB,oBAAA,EAAA,YAAoB;QAC5C,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,kBAAkB;QAClB,IAAM,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC7D;QACD,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,UAAC,MAAkB;YACrD,OAAO,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACH,8CAAa,GAAb,UAAc,OAAqB;QAC/B,+BAA+B;QAC/B,IAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,SAAS;YACrD,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SAC3B,CAAC,CAAC;QACH,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,+CAAc,GAAd,UAAe,OAAwB;QACnC,OAAO,OAAO,CAAC,QAAQ,KAAK,aAAa,CAAC,KAAK,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,+CAAc,GAAd,UAAe,OAAyB;QAAxC,iBAIC;QAHG,OAAO,OAAO,CAAC,IAAI,CAAC,UAAC,MAAM;YACvB,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,cAAc,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,kDAAiB,GAAjB;QACI,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC5C,CAAC;IACL,6BAAC;AAAD,CAAC,AAvRD,IAuRC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-module-loader.d.ts b/node_modules/textlint/module/engine/textlint-module-loader.d.ts new file mode 100644 index 000000000..5bb6dfcaf --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-loader.d.ts @@ -0,0 +1,43 @@ +/// +import { EventEmitter } from "events"; +import { TextLintModuleResolver } from "./textlint-module-resolver"; +import { Config } from "../config/config"; +export declare class TextLintModuleLoader extends EventEmitter { + moduleResolver: TextLintModuleResolver; + static get Event(): { + rule: string; + filterRule: string; + plugin: string; + error: string; + }; + constructor(config: { + rulesBaseDirectory?: string; + }); + /** + * set up lint rules using {@lint Config} object. + * The {@lint Config} object was created with initialized {@link TextLintEngine} (as-known Constructor). + * @param {Config} config the config is parsed object + */ + loadFromConfig(config: Config): void; + /** + * load rule from plugin name. + * plugin module has `rules` object and define rule with plugin prefix. + * @param {string} pluginName + */ + loadPlugin(pluginName: string): void; + loadPreset(presetName: string): void; + /** + * load rule file with `ruleName` and define rule. + * if rule is not found, then throw ReferenceError. + * if already rule is loaded, do not anything. + * @param {string} ruleName + */ + loadRule(ruleName: string): void; + /** + * load filter rule file with `ruleName` and define rule. + * if rule is not found, then throw ReferenceError. + * if already rule is loaded, do not anything. + * @param {string} ruleName + */ + loadFilterRule(ruleName: string): void; +} diff --git a/node_modules/textlint/module/engine/textlint-module-loader.js b/node_modules/textlint/module/engine/textlint-module-loader.js new file mode 100644 index 000000000..d6d66d4a2 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-loader.js @@ -0,0 +1,216 @@ +// LICENSE : MIT +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { EventEmitter } from "events"; +import { moduleInterop } from "@textlint/module-interop"; +var debug = require("debug")("textlint:module-loader"); +var isFile = require("is-file"); +import { isPluginRuleKey } from "../config/config-util"; +import { loadFromDir } from "./rule-loader"; +import { Logger } from "../util/logger"; +import { TextLintModuleResolver } from "./textlint-module-resolver"; +import { TextLintModuleMapper } from "./textlint-module-mapper"; +import { normalizeTextlintFilterRuleKey, normalizeTextlintPluginKey, normalizeTextlintRuleKey, normalizeTextlintRulePresetKey } from "@textlint/utils"; +var TextLintModuleLoader = /** @class */ (function (_super) { + __extends(TextLintModuleLoader, _super); + function TextLintModuleLoader(config) { + var _this = _super.call(this) || this; + _this.moduleResolver = new TextLintModuleResolver(config); + return _this; + } + Object.defineProperty(TextLintModuleLoader, "Event", { + get: function () { + return { + rule: "rule", + filterRule: "filterRule", + plugin: "plugin", + error: "error" + }; + }, + enumerable: false, + configurable: true + }); + /** + * set up lint rules using {@lint Config} object. + * The {@lint Config} object was created with initialized {@link TextLintEngine} (as-known Constructor). + * @param {Config} config the config is parsed object + */ + TextLintModuleLoader.prototype.loadFromConfig = function (config) { + var _this = this; + debug("config %O", config); + // --ruledir + if (config.rulePaths && this.listenerCount(TextLintModuleLoader.Event.rule) > 0) { + // load in additional rules + config.rulePaths.forEach(function (rulesDir) { + debug("Loading rules from %o", rulesDir); + var rules = loadFromDir(rulesDir); + Object.keys(rules).forEach(function (ruleName) { + var entry = [ruleName, rules[ruleName]]; + _this.emit(TextLintModuleLoader.Event.rule, entry); + }); + }); + } + // --rule + if (config.rules && this.listenerCount(TextLintModuleLoader.Event.rule) > 0) { + // load in additional rules + config.rules.forEach(function (ruleName) { + _this.loadRule(ruleName); + }); + } + // TODO: --filter + if (config.filterRules && this.listenerCount(TextLintModuleLoader.Event.filterRule) > 0) { + // load in additional filterRules + config.filterRules.forEach(function (ruleName) { + _this.loadFilterRule(ruleName); + }); + } + // --preset + if (config.presets && this.listenerCount(TextLintModuleLoader.Event.rule) > 0) { + config.presets.forEach(function (presetName) { + _this.loadPreset(presetName); + }); + } + // --plugin + if (config.plugins && this.listenerCount(TextLintModuleLoader.Event.plugin) > 0) { + // load in additional rules from plugin + config.plugins.forEach(function (pluginName) { + _this.loadPlugin(pluginName); + }); + } + }; + /** + * load rule from plugin name. + * plugin module has `rules` object and define rule with plugin prefix. + * @param {string} pluginName + */ + TextLintModuleLoader.prototype.loadPlugin = function (pluginName) { + var pkgPath = this.moduleResolver.resolvePluginPackageName(pluginName); + debug("Loading rules from plugin: %s", pkgPath); + var plugin = moduleInterop(require(pkgPath)); + var pluginNameWithoutPrefix = normalizeTextlintPluginKey(pluginName); + // Notes: plugins not support "rules" and "rulesConfig" + // https://github.com/textlint/textlint/issues/291 + if (plugin.hasOwnProperty("rules")) { + throw new Error("textlint plugins not support \"rules\" and \"rulesConfig\".\nBut " + pluginName + " has these filed.\nFor more details, See https://github.com/textlint/textlint/issues/291"); + } + // register plugin.Processor + if (!plugin.hasOwnProperty("Processor")) { + throw new Error("textlint plugin should have \"Processor\".\nFor more details. See https://github.com/textlint/textlint/blob/master/docs/plugin.md"); + } + var pluginEntry = [pluginNameWithoutPrefix, plugin]; + this.emit(TextLintModuleLoader.Event.plugin, pluginEntry); + }; + TextLintModuleLoader.prototype.loadPreset = function (presetName) { + var _this = this; + /* + Caution: Rules of preset are defined as following. + { + "rules": { + "preset-gizmo": { + "ruleA": false + + } + } + + It mean that "ruleA" is defined as "preset-gizmo/ruleA" + + */ + var presetRuleNameWithoutPrefix = normalizeTextlintRulePresetKey(presetName); + // ignore plugin's rule + if (isPluginRuleKey(presetRuleNameWithoutPrefix)) { + Logger.warn(presetRuleNameWithoutPrefix + " is Plugin's rule. This is unknown case, please report issue."); + return; + } + var pkgPath = this.moduleResolver.resolvePresetPackageName(presetName); + debug("Loading rules from preset: %s", pkgPath); + var preset = moduleInterop(require(pkgPath)); + var entities = TextLintModuleMapper.createEntities(preset.rules, presetRuleNameWithoutPrefix); + entities.forEach(function (entry) { + _this.emit(TextLintModuleLoader.Event.rule, entry); + }); + }; + /** + * load rule file with `ruleName` and define rule. + * if rule is not found, then throw ReferenceError. + * if already rule is loaded, do not anything. + * @param {string} ruleName + */ + TextLintModuleLoader.prototype.loadRule = function (ruleName) { + /* + Task + - check already define + - resolve package name + - load package + - emit rule + */ + // ruleName is filePath + if (isFile(ruleName)) { + var ruleCreator_1 = moduleInterop(require(ruleName)); + var ruleEntry_1 = [ruleName, ruleCreator_1]; + this.emit(TextLintModuleLoader.Event.rule, ruleEntry_1); + return; + } + // ignore already defined rule + // ignore rules from rulePaths because avoid ReferenceError is that try to require. + var definedRuleName = normalizeTextlintRuleKey(ruleName); + // ignore plugin's rule + if (isPluginRuleKey(definedRuleName)) { + Logger.warn(definedRuleName + " is Plugin's rule. This is unknown case, please report issue."); + return; + } + var pkgPath = this.moduleResolver.resolveRulePackageName(ruleName); + debug("Loading rules from %s", pkgPath); + var ruleCreator = moduleInterop(require(pkgPath)); + var ruleEntry = [definedRuleName, ruleCreator]; + this.emit(TextLintModuleLoader.Event.rule, ruleEntry); + }; + /** + * load filter rule file with `ruleName` and define rule. + * if rule is not found, then throw ReferenceError. + * if already rule is loaded, do not anything. + * @param {string} ruleName + */ + TextLintModuleLoader.prototype.loadFilterRule = function (ruleName) { + /* + Task + - check already define + - resolve package name + - load package + - emit rule + */ + // ignore already defined rule + // ignore rules from rulePaths because avoid ReferenceError is that try to require. + if (isFile(ruleName)) { + var ruleCreator_2 = moduleInterop(require(ruleName)); + var ruleEntry_2 = [ruleName, ruleCreator_2]; + this.emit(TextLintModuleLoader.Event.filterRule, ruleEntry_2); + return; + } + var definedRuleName = normalizeTextlintFilterRuleKey(ruleName); + // ignore plugin's rule + if (isPluginRuleKey(definedRuleName)) { + Logger.warn(definedRuleName + " is Plugin's rule. This is unknown case, please report issue."); + return; + } + var pkgPath = this.moduleResolver.resolveFilterRulePackageName(ruleName); + debug("Loading filter rules from %s", pkgPath); + var ruleCreator = moduleInterop(require(pkgPath)); + var ruleEntry = [definedRuleName, ruleCreator]; + this.emit(TextLintModuleLoader.Event.filterRule, ruleEntry); + }; + return TextLintModuleLoader; +}(EventEmitter)); +export { TextLintModuleLoader }; +//# sourceMappingURL=textlint-module-loader.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-module-loader.js.map b/node_modules/textlint/module/engine/textlint-module-loader.js.map new file mode 100644 index 000000000..22f89b930 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-module-loader.js","sourceRoot":"","sources":["../../src/engine/textlint-module-loader.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAAC;AACzD,IAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EACH,8BAA8B,EAC9B,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EACjC,MAAM,iBAAiB,CAAC;AAEzB;IAA0C,wCAAY;IAYlD,8BAAY,MAAuC;QAAnD,YACI,iBAAO,SAEV;QADG,KAAI,CAAC,cAAc,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;;IAC7D,CAAC;IAZD,sBAAW,6BAAK;aAAhB;YACI,OAAO;gBACH,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,YAAY;gBACxB,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,OAAO;aACjB,CAAC;QACN,CAAC;;;OAAA;IAOD;;;;OAIG;IACH,6CAAc,GAAd,UAAe,MAAc;QAA7B,iBAyCC;QAxCG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC3B,YAAY;QACZ,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC7E,2BAA2B;YAC3B,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,UAAC,QAAQ;gBAC9B,KAAK,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC;gBACzC,IAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;gBACpC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,QAAQ;oBAChC,IAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC1C,KAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACtD,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;QACD,SAAS;QACT,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACzE,2BAA2B;YAC3B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,QAAgB;gBAClC,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;SACN;QACD,iBAAiB;QACjB,IAAI,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACrF,iCAAiC;YACjC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,QAAQ;gBAChC,KAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;SACN;QACD,WAAW;QACX,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC3E,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,UAAU;gBAC9B,KAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;SACN;QACD,WAAW;QACX,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YAC7E,uCAAuC;YACvC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,UAAU;gBAC9B,KAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;;OAIG;IACH,yCAAU,GAAV,UAAW,UAAkB;QACzB,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACzE,KAAK,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;QAChD,IAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,IAAM,uBAAuB,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;QACvE,uDAAuD;QACvD,kDAAkD;QAClD,IAAI,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,sEACtB,UAAU,6FACsD,CAAC,CAAC;SAC/D;QACD,4BAA4B;QAC5B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,mIAC0D,CAAC,CAAC;SAC/E;QACD,IAAM,WAAW,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;IAED,yCAAU,GAAV,UAAW,UAAkB;QAA7B,iBA4BC;QA3BG;;;;;;;;;;;;WAYG;QACH,IAAM,2BAA2B,GAAG,8BAA8B,CAAC,UAAU,CAAC,CAAC;QAC/E,uBAAuB;QACvB,IAAI,eAAe,CAAC,2BAA2B,CAAC,EAAE;YAC9C,MAAM,CAAC,IAAI,CAAI,2BAA2B,kEAA+D,CAAC,CAAC;YAC3G,OAAO;SACV;QAED,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACzE,KAAK,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;QAChD,IAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,IAAM,QAAQ,GAAG,oBAAoB,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;QAChG,QAAQ,CAAC,OAAO,CAAC,UAAC,KAAK;YACnB,KAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,uCAAQ,GAAR,UAAS,QAAgB;QACrB;;;;;;UAME;QACF,uBAAuB;QACvB,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;YAClB,IAAM,aAAW,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrD,IAAM,WAAS,GAAG,CAAC,QAAQ,EAAE,aAAW,CAAC,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,WAAS,CAAC,CAAC;YACtD,OAAO;SACV;QACD,8BAA8B;QAC9B,mFAAmF;QACnF,IAAM,eAAe,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QAC3D,uBAAuB;QACvB,IAAI,eAAe,CAAC,eAAe,CAAC,EAAE;YAClC,MAAM,CAAC,IAAI,CAAI,eAAe,kEAA+D,CAAC,CAAC;YAC/F,OAAO;SACV;QACD,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QACrE,KAAK,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACxC,IAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,IAAM,SAAS,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACH,6CAAc,GAAd,UAAe,QAAgB;QAC3B;;;;;;UAME;QACF,8BAA8B;QAC9B,mFAAmF;QACnF,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;YAClB,IAAM,aAAW,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrD,IAAM,WAAS,GAAG,CAAC,QAAQ,EAAE,aAAW,CAAC,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,WAAS,CAAC,CAAC;YAC5D,OAAO;SACV;QACD,IAAM,eAAe,GAAG,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QACjE,uBAAuB;QACvB,IAAI,eAAe,CAAC,eAAe,CAAC,EAAE;YAClC,MAAM,CAAC,IAAI,CAAI,eAAe,kEAA+D,CAAC,CAAC;YAC/F,OAAO;SACV;QACD,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC;QAC3E,KAAK,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;QAC/C,IAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,IAAM,SAAS,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;IACL,2BAAC;AAAD,CAAC,AA/LD,CAA0C,YAAY,GA+LrD"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-module-mapper.d.ts b/node_modules/textlint/module/engine/textlint-module-mapper.d.ts new file mode 100644 index 000000000..4cf827ab5 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-mapper.d.ts @@ -0,0 +1,28 @@ +export declare class TextLintModuleMapper { + /** + * create entities from rules/rulesConfig and prefix + * entities is a array which contain [key, value] + * it just create entity without normalization + * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries + * @param {Object} pluginRules an object is like "rules" or "rulesConfig" of plugin + * @param {string} prefixKey prefix key is plugin name or preset name + * @returns {[string, string][]} + */ + static createEntities(pluginRules: { + [index: string]: string; + }, prefixKey: string): [string, string][]; + /** + * create an object from rules/rulesConfig and prefix + * the object shape is { key: value, key2: value } + * + * it just create object without normalization + * @param {Object} pluginRules an object is like "rules" or "rulesConfig" of plugin + * @param {string} prefixKey prefix key is plugin name or preset name + * @returns {Object} + */ + static createMappedObject(pluginRules: { + [index: string]: string; + }, prefixKey: string): { + [index: string]: string; + }; +} diff --git a/node_modules/textlint/module/engine/textlint-module-mapper.js b/node_modules/textlint/module/engine/textlint-module-mapper.js new file mode 100644 index 000000000..51664ea51 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-mapper.js @@ -0,0 +1,49 @@ +// LICENSE : MIT +"use strict"; +/** + * This class is a helper to create mapping of rules and rulesConfig + * Main purpose hide the RuleSeparator "/". + */ +// The separator of `/` +var RuleSeparator = "/"; +var TextLintModuleMapper = /** @class */ (function () { + function TextLintModuleMapper() { + } + /** + * create entities from rules/rulesConfig and prefix + * entities is a array which contain [key, value] + * it just create entity without normalization + * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries + * @param {Object} pluginRules an object is like "rules" or "rulesConfig" of plugin + * @param {string} prefixKey prefix key is plugin name or preset name + * @returns {[string, string][]} + */ + TextLintModuleMapper.createEntities = function (pluginRules, prefixKey) { + var entities = []; + Object.keys(pluginRules).forEach(function (ruleId) { + var qualifiedRuleId = prefixKey + RuleSeparator + ruleId; + var ruleCreator = pluginRules[ruleId]; + entities.push([qualifiedRuleId, ruleCreator]); + }); + return entities; + }; + /** + * create an object from rules/rulesConfig and prefix + * the object shape is { key: value, key2: value } + * + * it just create object without normalization + * @param {Object} pluginRules an object is like "rules" or "rulesConfig" of plugin + * @param {string} prefixKey prefix key is plugin name or preset name + * @returns {Object} + */ + TextLintModuleMapper.createMappedObject = function (pluginRules, prefixKey) { + var mapped = {}; + Object.keys(pluginRules).forEach(function (key) { + mapped[prefixKey + "/" + key] = pluginRules[key]; + }); + return mapped; + }; + return TextLintModuleMapper; +}()); +export { TextLintModuleMapper }; +//# sourceMappingURL=textlint-module-mapper.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-module-mapper.js.map b/node_modules/textlint/module/engine/textlint-module-mapper.js.map new file mode 100644 index 000000000..2219991d1 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-mapper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-module-mapper.js","sourceRoot":"","sources":["../../src/engine/textlint-module-mapper.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb;;;GAGG;AACH,qCAAqC;AACrC,IAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;IAAA;IAuCA,CAAC;IAtCG;;;;;;;;OAQG;IACI,mCAAc,GAArB,UAAsB,WAAwC,EAAE,SAAiB;QAC7E,IAAM,QAAQ,GAAuB,EAAE,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,MAAM;YACpC,IAAM,eAAe,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;YAC3D,IAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;YACxC,QAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACI,uCAAkB,GAAzB,UACI,WAAwC,EACxC,SAAiB;QAEjB,IAAM,MAAM,GAAgC,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YACjC,MAAM,CAAI,SAAS,SAAI,GAAK,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,2BAAC;AAAD,CAAC,AAvCD,IAuCC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-module-resolver.d.ts b/node_modules/textlint/module/engine/textlint-module-resolver.d.ts new file mode 100644 index 000000000..ff0b1c1e5 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-resolver.d.ts @@ -0,0 +1,59 @@ +export interface ConfigModulePrefix { + CONFIG_PACKAGE_PREFIX: string; + FILTER_RULE_NAME_PREFIX: string; + RULE_NAME_PREFIX: string; + RULE_PRESET_NAME_PREFIX: string; + PLUGIN_NAME_PREFIX: string; +} +/** + * This class aim to resolve textlint's package name and get the module path. + * + * Define + * + * - `package` is npm package + * - `module` is package's main module + * + * ## Support + * + * - textlint-rule-* + * - textlint-preset-* + * - textlint-plugin-* + * - textlint-config-* + */ +export declare class TextLintModuleResolver { + private baseDirectory; + constructor(config: { + rulesBaseDirectory?: string; + }); + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolveRulePackageName(packageName: string): string; + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolveFilterRulePackageName(packageName: string): string; + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolvePluginPackageName(packageName: string): string; + /** + * Take package name, and return path to module. + * @param {string} packageName + * The user must specify preset- prefix to these `packageName`. + * @returns {string} return path to module + */ + resolvePresetPackageName(packageName: string): string; + /** + * Take Config package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolveConfigPackageName(packageName: string): string; +} diff --git a/node_modules/textlint/module/engine/textlint-module-resolver.js b/node_modules/textlint/module/engine/textlint-module-resolver.js new file mode 100644 index 000000000..ec6cc4609 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-resolver.js @@ -0,0 +1,141 @@ +// LICENSE : MIT +"use strict"; +import * as path from "path"; +import { createFullPackageName } from "./textlint-package-name-util"; +import { PackageNamePrefix } from "../config/package-prefix"; +var tryResolve = require("try-resolve"); +var debug = require("debug")("textlint:module-resolver"); +/** + * This class aim to resolve textlint's package name and get the module path. + * + * Define + * + * - `package` is npm package + * - `module` is package's main module + * + * ## Support + * + * - textlint-rule-* + * - textlint-preset-* + * - textlint-plugin-* + * - textlint-config-* + */ +var TextLintModuleResolver = /** @class */ (function () { + function TextLintModuleResolver(config) { + /** + * @type {string} baseDirectory for resolving + */ + this.baseDirectory = config && config.rulesBaseDirectory ? config.rulesBaseDirectory : ""; + } + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + TextLintModuleResolver.prototype.resolveRulePackageName = function (packageName) { + var baseDir = this.baseDirectory; + var fullPackageName = createFullPackageName(PackageNamePrefix.rule, packageName); + // or textlint-rule- + var pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug("rule fullPackageName: " + fullPackageName); + throw new ReferenceError("Failed to load textlint's rule module: \"" + packageName + "\" is not found.\nSee FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md\n"); + } + return pkgPath; + }; + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + TextLintModuleResolver.prototype.resolveFilterRulePackageName = function (packageName) { + var baseDir = this.baseDirectory; + var fullPackageName = createFullPackageName(PackageNamePrefix.filterRule, packageName); + // or textlint-filter-rule- or @scope/ + var pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug("filter rule fullPackageName: " + fullPackageName); + throw new ReferenceError("Failed to load textlint's filter rule module: \"" + packageName + "\" is not found.\nSee FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md\n"); + } + return pkgPath; + }; + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + TextLintModuleResolver.prototype.resolvePluginPackageName = function (packageName) { + var baseDir = this.baseDirectory; + var fullPackageName = createFullPackageName(PackageNamePrefix.plugin, packageName); + // or textlint-plugin- + var pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug("plugin fullPackageName: " + fullPackageName); + throw new ReferenceError("Failed to load textlint's plugin module: \"" + packageName + "\" is not found.\nSee FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md\n"); + } + return pkgPath; + }; + /** + * Take package name, and return path to module. + * @param {string} packageName + * The user must specify preset- prefix to these `packageName`. + * @returns {string} return path to module + */ + TextLintModuleResolver.prototype.resolvePresetPackageName = function (packageName) { + var baseDir = this.baseDirectory; + var PREFIX = PackageNamePrefix.rulePreset; + /* Implementation Note + + preset name is defined in config file: + In the case, `packageName` is "preset-gizmo" + TextLintModuleResolver resolve "preset-gizmo" to "textlint-rule-preset-gizmo" + { + "rules": { + "preset-gizmo": { + "ruleA": false + } + } + } + */ + // preset- or textlint-rule-preset- + // @scope/preset- or @scope/textlint-rule-preset- + var packageNameWithoutPreset = packageName + .replace(/^preset-/, "") + .replace(/^@([^/]+)\/preset-(.*)$/, "@$1/$2"); + var fullPackageName = createFullPackageName(PREFIX, packageNameWithoutPreset); + var fullFullPackageName = "" + PREFIX + packageNameWithoutPreset; + var pkgPath = + // textlint-rule-preset- or @scope/textlint-rule-preset- + tryResolve(path.join(baseDir, fullFullPackageName)) || + // + tryResolve(path.join(baseDir, packageNameWithoutPreset)) || + // + tryResolve(path.join(baseDir, fullPackageName)) || + // + tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug("preset fullPackageName: " + fullPackageName); + debug("preset fullFullPackageName: " + fullFullPackageName); + throw new ReferenceError("Failed to load textlint's preset module: \"" + packageName + "\" is not found.\nSee FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md\n"); + } + return pkgPath; + }; + /** + * Take Config package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + TextLintModuleResolver.prototype.resolveConfigPackageName = function (packageName) { + var baseDir = this.baseDirectory; + var fullPackageName = createFullPackageName(PackageNamePrefix.config, packageName); + // or textlint-config- + var pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + throw new ReferenceError("Failed to load textlint's config module: \"" + packageName + "\" is not found.\nSee FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md\n"); + } + return pkgPath; + }; + return TextLintModuleResolver; +}()); +export { TextLintModuleResolver }; +//# sourceMappingURL=textlint-module-resolver.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-module-resolver.js.map b/node_modules/textlint/module/engine/textlint-module-resolver.js.map new file mode 100644 index 000000000..5835d04f2 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-module-resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-module-resolver.js","sourceRoot":"","sources":["../../src/engine/textlint-module-resolver.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC1C,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,0BAA0B,CAAC,CAAC;AAU3D;;;;;;;;;;;;;;GAcG;AACH;IAGI,gCAAY,MAAuC;QAC/C;;WAEG;QACH,IAAI,CAAC,aAAa,GAAG,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,CAAC;IAED;;;;OAIG;IACH,uDAAsB,GAAtB,UAAuB,WAAmB;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAM,eAAe,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACnF,2CAA2C;QAC3C,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/G,IAAI,CAAC,OAAO,EAAE;YACV,KAAK,CAAC,2BAAyB,eAAiB,CAAC,CAAC;YAClD,MAAM,IAAI,cAAc,CAAC,8CAA2C,WAAW,8HAE1F,CAAC,CAAC;SACM;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,6DAA4B,GAA5B,UAA6B,WAAmB;QAC5C,IAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAM,eAAe,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACzF,wEAAwE;QACxE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/G,IAAI,CAAC,OAAO,EAAE;YACV,KAAK,CAAC,kCAAgC,eAAiB,CAAC,CAAC;YACzD,MAAM,IAAI,cAAc,CAAC,qDAAkD,WAAW,8HAEjG,CAAC,CAAC;SACM;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,yDAAwB,GAAxB,UAAyB,WAAmB;QACxC,IAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAM,eAAe,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACrF,+CAA+C;QAC/C,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/G,IAAI,CAAC,OAAO,EAAE;YACV,KAAK,CAAC,6BAA2B,eAAiB,CAAC,CAAC;YACpD,MAAM,IAAI,cAAc,CAAC,gDAA6C,WAAW,8HAE5F,CAAC,CAAC;SACM;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,yDAAwB,GAAxB,UAAyB,WAAmB;QACxC,IAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAC5C;;;;;;;;;;;;WAYG;QACH,+CAA+C;QAC/C,6DAA6D;QAC7D,IAAM,wBAAwB,GAAG,WAAW;aACvC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;aACvB,OAAO,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;QAClD,IAAM,eAAe,GAAG,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;QAChF,IAAM,mBAAmB,GAAG,KAAG,MAAM,GAAG,wBAA0B,CAAC;QACnE,IAAM,OAAO;QACT,kFAAkF;QAClF,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;YACnD,gBAAgB;YAChB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;YACxD,cAAc;YACd,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YAC/C,iBAAiB;YACjB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,EAAE;YACV,KAAK,CAAC,6BAA2B,eAAiB,CAAC,CAAC;YACpD,KAAK,CAAC,iCAA+B,mBAAqB,CAAC,CAAC;YAC5D,MAAM,IAAI,cAAc,CAAC,gDAA6C,WAAW,8HAE5F,CAAC,CAAC;SACM;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,yDAAwB,GAAxB,UAAyB,WAAmB;QACxC,IAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAM,eAAe,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACrF,+CAA+C;QAC/C,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/G,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,cAAc,CAAC,gDAA6C,WAAW,8HAE5F,CAAC,CAAC;SACM;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IACL,6BAAC;AAAD,CAAC,AApID,IAoIC"} \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-package-name-util.d.ts b/node_modules/textlint/module/engine/textlint-package-name-util.d.ts new file mode 100644 index 000000000..c6f77ea73 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-package-name-util.d.ts @@ -0,0 +1,11 @@ +/** + * Remove `prefix` from `text`. + */ +export declare const removePrefixFromPackageName: (prefixList: string[], packageName: string) => string; +/** + * Create full package name and return + * @param {string} prefix + * @param {string} name + * @returns {string} + */ +export declare const createFullPackageName: (prefix: string, name: string) => string; diff --git a/node_modules/textlint/module/engine/textlint-package-name-util.js b/node_modules/textlint/module/engine/textlint-package-name-util.js new file mode 100644 index 000000000..c9a429632 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-package-name-util.js @@ -0,0 +1,44 @@ +/** + * Remove `prefix` from `text`. + */ +export var removePrefixFromPackageName = function (prefixList, packageName) { + for (var i = 0; i < prefixList.length; i++) { + var prefix = prefixList[i]; + // @scope/name -> @scope/name + // @scope/textlint-rule-name -> @scope/name + if (packageName.charAt(0) === "@") { + var _a = packageName.split("/"), namespace = _a[0], name_1 = _a[1]; + if (name_1.startsWith(prefix)) { + return namespace + "/" + name_1.slice(prefix.length); + } + } + // name -> name + // textlint-rule-name -> name + else if (packageName.startsWith(prefix)) { + return packageName.slice(prefix.length); + } + } + // No match + return packageName; +}; +/** + * Create full package name and return + * @param {string} prefix + * @param {string} name + * @returns {string} + */ +export var createFullPackageName = function (prefix, name) { + if (name.charAt(0) === "@") { + var scopedPackageNameRegex = new RegExp("^" + prefix + "(-|$)"); + // if @scope/ -> @scope/ + if (!scopedPackageNameRegex.test(name.split("/")[1])) { + /* + * for scoped packages, insert the textlint-rule after the first / unless + * the path is already @scope/ or @scope/textlint-rule- + */ + return name.replace(/^@([^/]+)\/(.*)$/, "@$1/" + prefix + "$2"); + } + } + return "" + prefix + name; +}; +//# sourceMappingURL=textlint-package-name-util.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/engine/textlint-package-name-util.js.map b/node_modules/textlint/module/engine/textlint-package-name-util.js.map new file mode 100644 index 000000000..282cee811 --- /dev/null +++ b/node_modules/textlint/module/engine/textlint-package-name-util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-package-name-util.js","sourceRoot":"","sources":["../../src/engine/textlint-package-name-util.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG,UAAC,UAAoB,EAAE,WAAmB;IACjF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,6BAA6B;QAC7B,2CAA2C;QAC3C,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACzB,IAAA,KAAoB,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAzC,SAAS,QAAA,EAAE,MAAI,QAA0B,CAAC;YACjD,IAAI,MAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBACzB,OAAU,SAAS,SAAI,MAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAG,CAAC;aACtD;SACJ;QACD,eAAe;QACf,6BAA6B;aACxB,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YACrC,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC3C;KACJ;IACD,WAAW;IACX,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAC,MAAc,EAAE,IAAY;IAC9D,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACxB,IAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,MAAI,MAAM,UAAO,CAAC,CAAC;QAC7D,4CAA4C;QAC5C,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YAClD;;;eAGG;YACH,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,SAAO,MAAM,OAAI,CAAC,CAAC;SAC9D;KACJ;IACD,OAAO,KAAG,MAAM,GAAG,IAAM,CAAC;AAC9B,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/fixer/textlint-fixer.d.ts b/node_modules/textlint/module/fixer/textlint-fixer.d.ts new file mode 100644 index 000000000..db66ec145 --- /dev/null +++ b/node_modules/textlint/module/fixer/textlint-fixer.d.ts @@ -0,0 +1,9 @@ +import { TextlintFixResult } from "@textlint/kernel"; +export declare class TextLintFixer { + /** + * write output to each files and return promise + * @param textFixMessages + * @returns {Promise} + */ + write(textFixMessages: TextlintFixResult[]): Promise; +} diff --git a/node_modules/textlint/module/fixer/textlint-fixer.js b/node_modules/textlint/module/fixer/textlint-fixer.js new file mode 100644 index 000000000..7c38c3efc --- /dev/null +++ b/node_modules/textlint/module/fixer/textlint-fixer.js @@ -0,0 +1,29 @@ +var fs = require("fs"); +function overWriteResult(result) { + return new Promise(function (resolve, reject) { + var targetFilePath = result.filePath; + var output = result.output; + fs.writeFile(targetFilePath, output, function (error, result) { + if (error) { + return reject(error); + } + resolve(result); + }); + }); +} +var TextLintFixer = /** @class */ (function () { + function TextLintFixer() { + } + /** + * write output to each files and return promise + * @param textFixMessages + * @returns {Promise} + */ + TextLintFixer.prototype.write = function (textFixMessages) { + var promises = textFixMessages.map(overWriteResult); + return Promise.all(promises); + }; + return TextLintFixer; +}()); +export { TextLintFixer }; +//# sourceMappingURL=textlint-fixer.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/fixer/textlint-fixer.js.map b/node_modules/textlint/module/fixer/textlint-fixer.js.map new file mode 100644 index 000000000..760f2258c --- /dev/null +++ b/node_modules/textlint/module/fixer/textlint-fixer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-fixer.js","sourceRoot":"","sources":["../../src/fixer/textlint-fixer.ts"],"names":[],"mappings":"AAEA,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,SAAS,eAAe,CAAC,MAAyB;IAC9C,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAC/B,IAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;QACvC,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC7B,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,UAAC,KAAU,EAAE,MAAyB;YACvE,IAAI,KAAK,EAAE;gBACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;aACxB;YACD,OAAO,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAED;IAAA;IAUA,CAAC;IATG;;;;OAIG;IACH,6BAAK,GAAL,UAAM,eAAoC;QACtC,IAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACL,oBAAC;AAAD,CAAC,AAVD,IAUC"} \ No newline at end of file diff --git a/node_modules/textlint/module/index.d.ts b/node_modules/textlint/module/index.d.ts new file mode 100644 index 000000000..d62d3d457 --- /dev/null +++ b/node_modules/textlint/module/index.d.ts @@ -0,0 +1,5 @@ +export { cli } from "./cli"; +export { textlint } from "./textlint"; +export { TextLintEngine } from "./textlint-engine"; +export { TextFixEngine } from "./textfix-engine"; +export { TextLintCore } from "./textlint-core"; diff --git a/node_modules/textlint/module/index.js b/node_modules/textlint/module/index.js new file mode 100644 index 000000000..ff904565a --- /dev/null +++ b/node_modules/textlint/module/index.js @@ -0,0 +1,23 @@ +// LICENSE : MIT +"use strict"; +// Level of abstraction(descending order) +// cli > TextLintEngine > TextLintCore(textlint) +// See: https://github.com/textlint/textlint/blob/master/docs/use-as-modules.md +// Command line interface +export { cli } from "./cli"; +// It is a singleton object of TextLintCore +// Recommend: use TextLintCore +export { textlint } from "./textlint"; +// TextLintEngine is a wrapper around `textlint` for linting **multiple** files +// include formatter, detecting utils +// : It is easy to use +// You can see engine/textlint-engine-core.js for more detail +export { TextLintEngine } from "./textlint-engine"; +// TextFixEngine is a wrapper around `textlint` for linting **multiple** files +// include formatter, detecting utils +// : It is easy to use +// You can see engine/textlint-engine-core.js for more detail +export { TextFixEngine } from "./textfix-engine"; +// Core API for linting a **single** text or file. +export { TextLintCore } from "./textlint-core"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/index.js.map b/node_modules/textlint/module/index.js.map new file mode 100644 index 000000000..ce9598ba8 --- /dev/null +++ b/node_modules/textlint/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,yCAAyC;AACzC,gDAAgD;AAChD,+EAA+E;AAE/E,yBAAyB;AACzB,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,2CAA2C;AAC3C,8BAA8B;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,+EAA+E;AAC/E,qCAAqC;AACrC,iCAAiC;AACjC,6DAA6D;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,8EAA8E;AAC9E,qCAAqC;AACrC,iCAAiC;AACjC,6DAA6D;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,kDAAkD;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/options.d.ts b/node_modules/textlint/module/options.d.ts new file mode 100644 index 000000000..9c782879e --- /dev/null +++ b/node_modules/textlint/module/options.d.ts @@ -0,0 +1 @@ +export declare const options: any; diff --git a/node_modules/textlint/module/options.js b/node_modules/textlint/module/options.js new file mode 100644 index 000000000..fc676d981 --- /dev/null +++ b/node_modules/textlint/module/options.js @@ -0,0 +1,192 @@ +// LICENSE : MIT +"use strict"; +import { getFormatterList } from "@textlint/linter-formatter"; +import { getFixerFormatterList } from "@textlint/fixer-formatter"; +var optionator = require("optionator"); +var concatFormatterList = function (formatterList) { + return formatterList + .map(function (formatter) { + return formatter.name; + }) + .join(", "); +}; +export var options = optionator({ + prepend: "textlint [options] file.md [file|dir|glob*]", + concatRepeatedArrays: true, + mergeRepeatedObjects: true, + options: [ + { heading: "Options" }, + { + option: "help", + alias: "h", + type: "Boolean", + description: "Show help." + }, + { + option: "config", + alias: "c", + type: "path::String", + description: "Use configuration from this file or sharable config.", + example: "--config /path/to/.textlintrc" + }, + { + option: "ignore-path", + type: "path::String", + description: "Specify path to a file containing patterns that describes files to ignore.", + default: ".textlintignore", + example: "--ignore-path /path/to/.textlintignore" + }, + { + option: "init", + type: "Boolean", + default: "false", + description: "Create the config file if not existed." + }, + { + option: "fix", + type: "Boolean", + default: false, + description: "Automatically fix problems", + example: "--fix" + }, + { + option: "dry-run", + type: "Boolean", + default: false, + description: "Enable dry-run mode for --fix. Only show result, don't change the file.", + example: "--fix --dry-run" + }, + { + option: "debug", + type: "Boolean", + default: false, + description: "Outputs debugging information" + }, + { + option: "version", + alias: "v", + type: "Boolean", + description: "Outputs the version number." + }, + { + heading: "Using stdin" + }, + { + option: "stdin", + type: "Boolean", + default: "false", + description: "Lint text provided on ." + }, + { + option: "stdin-filename", + type: "String", + description: "Specify filename to process STDIN as", + example: "cat ./README.md | textlint --stdin --stdin-filename README.md" + }, + { + heading: "Output" + }, + { + option: "output-file", + alias: "o", + type: "path::String", + description: "Enable report to be written to a file." + }, + { + option: "format", + alias: "f", + type: "String", + description: "Use a specific output format.\n Available formatter : " + concatFormatterList(getFormatterList()) + "\n Available formatter for --fix: " + concatFormatterList(getFixerFormatterList()), + example: "--format pretty-error" + }, + { + option: "color", + type: "Boolean", + default: "true", + description: "Disable color in piped output.", + example: "textlint --no-color" + }, + { + option: "quiet", + type: "Boolean", + default: "false", + description: "Report errors only." + }, + { + heading: "Specifying rules and plugins" + }, + { + option: "textlintrc", + type: "Boolean", + default: "true", + description: "Disable .textlintrc", + example: "textlint --no-textlintrc --rule textlint-no-todo README.md" + }, + { + option: "plugin", + type: "[String]", + description: "Set plugin package name", + example: "--plugin plugin-name" + }, + { + option: "rule", + type: "[String]", + description: "Set rule package name" + }, + { + option: "preset", + type: "[String]", + description: "Set preset package name and load rules from preset package." + }, + { + option: "rulesdir", + type: "[path::String]", + description: "Use additional rules from this directory" + }, + { + heading: "Caching" + }, + { + option: "cache", + type: "Boolean", + default: "false", + description: "Only check changed files", + example: "textlint --cache docs/" + }, + { + option: "cache-location", + type: "path::String", + description: "Path to the cache file or directory", + example: 'textlint --cache --cache-location "/Users/user/.textlintcache" docs/' + }, + { + heading: "Experimental" + }, + { + option: "experimental", + type: "Boolean", + default: false, + description: "Enable experimental flag.Some feature use on experimental.", + example: "--experimental" + }, + { + option: "rules-base-directory", + type: "path::String", + description: "Set module base directory. textlint load modules(rules/presets/plugins) from the base directory.", + example: 'textlint --rules-base-directory "/path/to/other/project/node_modules/"' + }, + { + option: "parallel", + type: "Boolean", + description: "Lint files in parallel", + example: 'textlint --experimental --parallel "*.md"' + }, + { + option: "max-concurrency", + type: "Number", + description: "maxConcurrency for --parallel", + example: "textlint --experimental --parallel --maxConcurrency 4" + } + ] +}); +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/options.js.map b/node_modules/textlint/module/options.js.map new file mode 100644 index 000000000..2ccdd6aee --- /dev/null +++ b/node_modules/textlint/module/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,OAAO,EAAE,gBAAgB,EAAmB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAwB,MAAM,2BAA2B,CAAC;AAExF,IAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEzC,IAAM,mBAAmB,GAAG,UAAC,aAAyD;IAClF,OAAO,aAAa;SACf,GAAG,CAAC,UAAC,SAAS;QACX,OAAO,SAAS,CAAC,IAAI,CAAC;IAC1B,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,OAAO,GAAG,UAAU,CAAC;IAC9B,OAAO,EAAE,6CAA6C;IACtD,oBAAoB,EAAE,IAAI;IAC1B,oBAAoB,EAAE,IAAI;IAC1B,OAAO,EAAE;QACL,EAAE,OAAO,EAAE,SAAS,EAAE;QACtB;YACI,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,YAAY;SAC5B;QACD;YACI,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,sDAAsD;YACnE,OAAO,EAAE,+BAA+B;SAC3C;QACD;YACI,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,4EAA4E;YACzF,OAAO,EAAE,iBAAiB;YAC1B,OAAO,EAAE,wCAAwC;SACpD;QACD;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,wCAAwC;SACxD;QACD;YACI,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,4BAA4B;YACzC,OAAO,EAAE,OAAO;SACnB;QACD;YACI,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,yEAAyE;YACtF,OAAO,EAAE,iBAAiB;SAC7B;QACD;YACI,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,+BAA+B;SAC/C;QACD;YACI,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,6BAA6B;SAC7C;QACD;YACI,OAAO,EAAE,aAAa;SACzB;QACD;YACI,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,gCAAgC;SAChD;QACD;YACI,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,sCAAsC;YACnD,OAAO,EAAE,+DAA+D;SAC3E;QACD;YACI,OAAO,EAAE,QAAQ;SACpB;QACD;YACI,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,wCAAwC;SACxD;QACD;YACI,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,gGACqC,mBAAmB,CAAC,gBAAgB,EAAE,CAAC,sEACvC,mBAAmB,CAAC,qBAAqB,EAAE,CAAG;YAChG,OAAO,EAAE,uBAAuB;SACnC;QACD;YACI,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,gCAAgC;YAC7C,OAAO,EAAE,qBAAqB;SACjC;QACD;YACI,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,qBAAqB;SACrC;QACD;YACI,OAAO,EAAE,8BAA8B;SAC1C;QACD;YACI,MAAM,EAAE,YAAY;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,qBAAqB;YAClC,OAAO,EAAE,4DAA4D;SACxE;QACD;YACI,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,yBAAyB;YACtC,OAAO,EAAE,sBAAsB;SAClC;QACD;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,uBAAuB;SACvC;QACD;YACI,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,6DAA6D;SAC7E;QACD;YACI,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,0CAA0C;SAC1D;QACD;YACI,OAAO,EAAE,SAAS;SACrB;QACD;YACI,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,wBAAwB;SACpC;QACD;YACI,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,qCAAqC;YAClD,OAAO,EAAE,sEAAsE;SAClF;QACD;YACI,OAAO,EAAE,cAAc;SAC1B;QACD;YACI,MAAM,EAAE,cAAc;YACtB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,4DAA4D;YACzE,OAAO,EAAE,gBAAgB;SAC5B;QACD;YACI,MAAM,EAAE,sBAAsB;YAC9B,IAAI,EAAE,cAAc;YACpB,WAAW,EACP,kGAAkG;YACtG,OAAO,EAAE,wEAAwE;SACpF;QACD;YACI,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,wBAAwB;YACrC,OAAO,EAAE,2CAA2C;SACvD;QACD;YACI,MAAM,EAAE,iBAAiB;YACzB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,+BAA+B;YAC5C,OAAO,EAAE,uDAAuD;SACnE;KACJ;CACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/parallel/lint-worker-master.d.ts b/node_modules/textlint/module/parallel/lint-worker-master.d.ts new file mode 100644 index 000000000..0bb9d461a --- /dev/null +++ b/node_modules/textlint/module/parallel/lint-worker-master.d.ts @@ -0,0 +1,8 @@ +import { LintWorkerResults } from "./lint-worker"; +import { Config } from "../config/config"; +export interface lintParallelOptions { + type: T; + config: Config; + concurrency?: number; +} +export declare const lintParallel: (files: string[], options: lintParallelOptions) => Promise>; diff --git a/node_modules/textlint/module/parallel/lint-worker-master.js b/node_modules/textlint/module/parallel/lint-worker-master.js new file mode 100644 index 000000000..1f727d2c8 --- /dev/null +++ b/node_modules/textlint/module/parallel/lint-worker-master.js @@ -0,0 +1,70 @@ +import os from "os"; +import { findFiles, pathsToGlobPatterns } from "../util/find-util"; +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { pluginsObjectToKernelRule } from "../util/object-to-kernel-format"; +import { TextLintModuleLoader } from "../engine/textlint-module-loader"; +import { PluginMap } from "../engine/processor-map"; +var debug = require("debug")("textlint:parallel/lint-worker-master"); +var workerPath = require.resolve("./lint-worker"); +var getPluginObject = function (config) { + var pluginMap = new PluginMap(); + var moduleLoader = new TextLintModuleLoader(config); + moduleLoader.on(TextLintModuleLoader.Event.plugin, function (_a) { + var pluginName = _a[0], plugin = _a[1]; + pluginMap.set(pluginName, plugin); + }); + // load plugin + moduleLoader.loadFromConfig(config); + return pluginMap.toJSON(); +}; +// TODO: Temporal config +var MAX_CHUNK_SIZE = 256; +export var lintParallel = function (files, options) { + // TODO: avoid error on Node.js 12< + var Worker = require("worker_threads").Worker; + var descriptor = new TextlintKernelDescriptor({ + rules: [], + plugins: pluginsObjectToKernelRule(getPluginObject(options.config), options.config.pluginsConfig), + filterRules: [] + }); + var patterns = pathsToGlobPatterns(files, { + extensions: descriptor.availableExtensions + }); + var targetFiles = findFiles(patterns, { ignoreFilePath: options.config.ignoreFile }); + var concurrency = options.concurrency !== undefined ? options.concurrency : os.cpus().length; + var chunkSize = Math.min(MAX_CHUNK_SIZE, Math.ceil(targetFiles.length / concurrency)); + var promises = []; + debug("Worker concurrency: %s, chunk size: %s, target files", concurrency, chunkSize, targetFiles.length); + var _loop_1 = function (i) { + promises.push(new Promise(function (resolve, reject) { + var workerData = { + config: options.config, + type: options.type, + files: targetFiles.slice(i, i + chunkSize) + }; + var worker = new Worker(workerPath, { workerData: workerData }); + var startDate = Date.now(); + worker.on("message", function (results) { + debug("Worker(%s) taken time: %s(ms)", worker.threadId, Date.now() - startDate); + resolve(results); + }); + worker.on("error", reject); + worker.on("exit", function (exitCode) { + if (exitCode) { + reject(new Error("Worker(" + worker.threadId + ") stopped with exit code " + exitCode)); + } + else { + resolve(); + } + }); + })); + }; + for (var i = 0; i < targetFiles.length; i += chunkSize) { + _loop_1(i); + } + debug("Worker count: %s", promises.length); + return Promise.all(promises).then(function (resultsInList) { + return resultsInList.flat(); + }); +}; +//# sourceMappingURL=lint-worker-master.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/parallel/lint-worker-master.js.map b/node_modules/textlint/module/parallel/lint-worker-master.js.map new file mode 100644 index 000000000..f6e5ce64c --- /dev/null +++ b/node_modules/textlint/module/parallel/lint-worker-master.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lint-worker-master.js","sourceRoot":"","sources":["../../src/parallel/lint-worker-master.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,CAAC;AAEvE,IAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;AAQpD,IAAM,eAAe,GAAG,UAAC,MAAc;IACnC,IAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IAClC,IAAM,YAAY,GAAG,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACtD,YAAY,CAAC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,EAAE,UAAC,EAAoB;YAAnB,UAAU,QAAA,EAAE,MAAM,QAAA;QACnE,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,cAAc;IACd,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC;AAC9B,CAAC,CAAC;AACF,wBAAwB;AACxB,IAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,CAAC,IAAM,YAAY,GAAG,UACxB,KAAe,EACf,OAA+B;IAE/B,mCAAmC;IACnC,IAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;IAChD,IAAM,UAAU,GAAG,IAAI,wBAAwB,CAAC;QAC5C,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,yBAAyB,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;QACjG,WAAW,EAAE,EAAE;KAClB,CAAC,CAAC;IACH,IAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE;QACxC,UAAU,EAAE,UAAU,CAAC,mBAAmB;KAC7C,CAAC,CAAC;IACH,IAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACvF,IAAM,WAAW,GAAG,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;IAC/F,IAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC;IACxF,IAAM,QAAQ,GAAyD,EAAE,CAAC;IAE1E,KAAK,CAAC,sDAAsD,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;4BACjG,CAAC;QACN,QAAQ,CAAC,IAAI,CACT,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACxB,IAAM,UAAU,GAAmB;gBAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;aAC7C,CAAC;YACF,IAAM,MAAM,GAAW,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,UAAU,YAAA,EAAE,CAAC,CAAC;YAC9D,IAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,UAAC,OAAO;gBACzB,KAAK,CAAC,+BAA+B,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;gBAChF,OAAO,CAAC,OAAO,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC3B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,QAAQ;gBACvB,IAAI,QAAQ,EAAE;oBACV,MAAM,CAAC,IAAI,KAAK,CAAC,YAAU,MAAM,CAAC,QAAQ,iCAA4B,QAAU,CAAC,CAAC,CAAC;iBACtF;qBAAM;oBACH,OAAO,EAAE,CAAC;iBACb;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;;IAvBN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS;gBAA7C,CAAC;KAwBT;IACD,KAAK,CAAC,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,aAAa;QAC5C,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC,CAAuD,CAAC;AAC7D,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/parallel/lint-worker.d.ts b/node_modules/textlint/module/parallel/lint-worker.d.ts new file mode 100644 index 000000000..e67541d2d --- /dev/null +++ b/node_modules/textlint/module/parallel/lint-worker.d.ts @@ -0,0 +1,8 @@ +import { Config } from "../config/config"; +import type { TextlintFixResult, TextlintResult } from "@textlint/types"; +export interface LintWorkerData { + files: string[]; + config: Config; + type: "lint" | "fix"; +} +export declare type LintWorkerResults = type extends "lint" ? TextlintResult[] : TextlintFixResult[]; diff --git a/node_modules/textlint/module/parallel/lint-worker.js b/node_modules/textlint/module/parallel/lint-worker.js new file mode 100644 index 000000000..fd5bacc4a --- /dev/null +++ b/node_modules/textlint/module/parallel/lint-worker.js @@ -0,0 +1,24 @@ +import { parentPort, threadId, isMainThread, workerData } from "worker_threads"; +import { TextLintEngine } from "../textlint-engine"; +import { TextFixEngine } from "../textfix-engine"; +var debug = require("debug")("textlint:parallel/lint-worker"); +var _a = workerData, config = _a.config, type = _a.type, files = _a.files; +debug("Worker(%s) Start", threadId); +// Worker Main +if (isMainThread) { + throw new Error("Worker should not be worked in mainThread"); +} +var engine = type === "lint" ? new TextLintEngine(config) : new TextFixEngine(config); +engine + .executeOnFiles(files) + .then(function (results) { + debug("Worker(%s) Done", threadId); + if (parentPort) { + parentPort.postMessage(results); + } +}) + .catch(function (error) { + debug("Worker(%s) Error", error.stack); + process.exitCode = 1; +}); +//# sourceMappingURL=lint-worker.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/parallel/lint-worker.js.map b/node_modules/textlint/module/parallel/lint-worker.js.map new file mode 100644 index 000000000..d6380e1b3 --- /dev/null +++ b/node_modules/textlint/module/parallel/lint-worker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lint-worker.js","sourceRoot":"","sources":["../../src/parallel/lint-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAW1D,IAAA,KAA0B,UAA4B,EAApD,MAAM,YAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAiC,CAAC;AAC7D,KAAK,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAEpC,cAAc;AACd,IAAI,YAAY,EAAE;IACd,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;CAChE;AACD,IAAM,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;AACxF,MAAM;KACD,cAAc,CAAC,KAAK,CAAC;KACrB,IAAI,CAAC,UAAC,OAAO;IACV,KAAK,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACnC,IAAI,UAAU,EAAE;QACZ,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;KACnC;AACL,CAAC,CAAC;KACD,KAAK,CAAC,UAAC,KAAK;IACT,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/shared/type/MessageType.d.ts b/node_modules/textlint/module/shared/type/MessageType.d.ts new file mode 100644 index 000000000..8d3afbc8e --- /dev/null +++ b/node_modules/textlint/module/shared/type/MessageType.d.ts @@ -0,0 +1,9 @@ +/** + * TextLintMessage type + * @typedef {Object} MessageType + * @type {{lint: string, ignore: string}} + */ +export declare const MessageType: { + lint: string; + ignore: string; +}; diff --git a/node_modules/textlint/module/shared/type/MessageType.js b/node_modules/textlint/module/shared/type/MessageType.js new file mode 100644 index 000000000..47da62d59 --- /dev/null +++ b/node_modules/textlint/module/shared/type/MessageType.js @@ -0,0 +1,12 @@ +/** + * TextLintMessage type + * @typedef {Object} MessageType + * @type {{lint: string, ignore: string}} + */ +export var MessageType = { + // Linting(also include Fix) Message Type + lint: "lint", + // Ignoring Message Type + ignore: "ignore" +}; +//# sourceMappingURL=MessageType.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/shared/type/MessageType.js.map b/node_modules/textlint/module/shared/type/MessageType.js.map new file mode 100644 index 000000000..04c87ac99 --- /dev/null +++ b/node_modules/textlint/module/shared/type/MessageType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageType.js","sourceRoot":"","sources":["../../../src/shared/type/MessageType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG;IACvB,yCAAyC;IACzC,IAAI,EAAE,MAAM;IACZ,wBAAwB;IACxB,MAAM,EAAE,QAAQ;CACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/shared/type/SeverityLevel.d.ts b/node_modules/textlint/module/shared/type/SeverityLevel.d.ts new file mode 100644 index 000000000..164543ecd --- /dev/null +++ b/node_modules/textlint/module/shared/type/SeverityLevel.d.ts @@ -0,0 +1,11 @@ +/** + * Severity level + * It is used in configuration and message + * @typedef {Object} SeverityLevel + */ +export declare const SeverityLevel: { + none: number; + info: number; + warning: number; + error: number; +}; diff --git a/node_modules/textlint/module/shared/type/SeverityLevel.js b/node_modules/textlint/module/shared/type/SeverityLevel.js new file mode 100644 index 000000000..59ad04242 --- /dev/null +++ b/node_modules/textlint/module/shared/type/SeverityLevel.js @@ -0,0 +1,14 @@ +// LICENSE : MIT +"use strict"; +/** + * Severity level + * It is used in configuration and message + * @typedef {Object} SeverityLevel + */ +export var SeverityLevel = { + none: 0, + info: 0, + warning: 1, + error: 2 +}; +//# sourceMappingURL=SeverityLevel.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/shared/type/SeverityLevel.js.map b/node_modules/textlint/module/shared/type/SeverityLevel.js.map new file mode 100644 index 000000000..bd86524dc --- /dev/null +++ b/node_modules/textlint/module/shared/type/SeverityLevel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SeverityLevel.js","sourceRoot":"","sources":["../../../src/shared/type/SeverityLevel.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb;;;;GAIG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG;IACzB,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;CACX,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/textfix-engine.d.ts b/node_modules/textlint/module/textfix-engine.d.ts new file mode 100644 index 000000000..49c51e334 --- /dev/null +++ b/node_modules/textlint/module/textfix-engine.d.ts @@ -0,0 +1,24 @@ +import { AbstractTextLintEngine } from "./engine/textlint-engine-core"; +import { TextLintCore } from "./textlint-core"; +import { TextLintFormatterOption } from "./textlint-interface"; +import { TextlintFixResult } from "@textlint/kernel"; +/** + * TextFixEngine a adapter for TextLintEngineCore. + * It aim to pull the whole look together. (TextLintEngine and TextFixEngine) + */ +export declare class TextFixEngine extends AbstractTextLintEngine { + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onFile: (textlintCore: TextLintCore) => (file: string) => Promise; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onText: (textlintCore: TextLintCore) => (text: string, ext?: string | undefined) => Promise; + /** + * @param {TextLintFormatterOption} formatterConfig + */ + onFormat: (formatterConfig: TextLintFormatterOption) => (results: TextlintFixResult[]) => string; +} diff --git a/node_modules/textlint/module/textfix-engine.js b/node_modules/textlint/module/textfix-engine.js new file mode 100644 index 000000000..c74506ea8 --- /dev/null +++ b/node_modules/textlint/module/textfix-engine.js @@ -0,0 +1,66 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { AbstractTextLintEngine } from "./engine/textlint-engine-core"; +import { createFormatter } from "@textlint/fixer-formatter"; +/** + * TextFixEngine a adapter for TextLintEngineCore. + * It aim to pull the whole look together. (TextLintEngine and TextFixEngine) + */ +var TextFixEngine = /** @class */ (function (_super) { + __extends(TextFixEngine, _super); + function TextFixEngine() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + _this.onFile = function (textlintCore) { + /** + * Fixes the current configuration on an array of file and directory names. + * TextFixEngine#executeOnFiles + * @returns {TextlintFixResult[]} The results for all files that were linted. + */ + return function (file) { + return textlintCore.fixFile(file); + }; + }; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + _this.onText = function (textlintCore) { + /** + * Fix texts with ext option. + * TextFixEngine#executeOnText + * @param {string} text linting text content + * @param {string} [ext] ext is a type for linting. default: ".txt" + * @returns {TextlintFixResult[]} + */ + return function (text, ext) { + return textlintCore.fixText(text, ext); + }; + }; + /** + * @param {TextLintFormatterOption} formatterConfig + */ + _this.onFormat = function (formatterConfig) { + return createFormatter(formatterConfig); + }; + return _this; + } + return TextFixEngine; +}(AbstractTextLintEngine)); +export { TextFixEngine }; +//# sourceMappingURL=textfix-engine.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/textfix-engine.js.map b/node_modules/textlint/module/textfix-engine.js.map new file mode 100644 index 000000000..a21eaba06 --- /dev/null +++ b/node_modules/textlint/module/textfix-engine.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textfix-engine.js","sourceRoot":"","sources":["../src/textfix-engine.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAK5D;;;GAGG;AACH;IAAmC,iCAAyC;IAA5E;QAAA,qEAsCC;QArCG;;;WAGG;QACH,YAAM,GAAG,UAAC,YAA0B;YAChC;;;;eAIG;YACH,OAAO,UAAC,IAAY;gBAChB,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACtC,CAAC,CAAC;QACN,CAAC,CAAC;QACF;;;WAGG;QACH,YAAM,GAAG,UAAC,YAA0B;YAChC;;;;;;eAMG;YACH,OAAO,UAAC,IAAY,EAAE,GAAY;gBAC9B,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC3C,CAAC,CAAC;QACN,CAAC,CAAC;QAEF;;WAEG;QACH,cAAQ,GAAG,UAAC,eAAwC;YAChD,OAAO,eAAe,CAAC,eAAe,CAAC,CAAC;QAC5C,CAAC,CAAC;;IACN,CAAC;IAAD,oBAAC;AAAD,CAAC,AAtCD,CAAmC,sBAAsB,GAsCxD"} \ No newline at end of file diff --git a/node_modules/textlint/module/textlint-core.d.ts b/node_modules/textlint/module/textlint-core.d.ts new file mode 100644 index 000000000..6ab022cdc --- /dev/null +++ b/node_modules/textlint/module/textlint-core.d.ts @@ -0,0 +1,94 @@ +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { TextlintFixResult, TextlintPluginCreator, TextlintPluginOptions, TextlintPluginProcessorConstructor, TextlintResult } from "@textlint/kernel"; +import { Config } from "./config/config"; +/** + * @class {TextLintCore} + */ +export declare class TextLintCore { + private kernel; + private config; + private defaultPlugins; + textlintKernelDescriptor: TextlintKernelDescriptor; + constructor(config?: Partial); + /** + * Use setupPlugins insteadof it. + * + * ```` + * textlint.setupPlugins({ + * yourPluginName: yourPlugin + * }); + * ```` + * + * @param {*} Processor + * @deprecated + * + * It will be removed until textlint@10 + */ + addProcessor(Processor: TextlintPluginProcessorConstructor): void; + /** + * register Processors + * @param {Object} plugins + * @param {Object} [pluginsConfig] + */ + setupPlugins(plugins?: { + [index: string]: TextlintPluginCreator; + }, pluginsConfig?: { + [index: string]: TextlintPluginOptions; + }): void; + /** + * Register rules and rulesConfig. + * if want to release rules, please call {@link resetRules}. + * @param {object} rules rule objects array + * @param {object} [rulesOption] ruleConfig is object + */ + setupRules(rules?: {}, rulesOption?: {}): void; + /** + * Register filterRules and filterRulesConfig. + * if want to release rules, please call {@link resetRules}. + * @param {object} filterRules rule objects array + * @param {object} [filterRulesOption] ruleConfig is object + */ + setupFilterRules(filterRules?: {}, filterRulesOption?: {}): void; + /** + * Remove all registered rule and clear messages. + */ + resetRules(): void; + /** + * lint text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text + * @param {string} ext ext is extension. default: .txt + * @returns {Promise.} + */ + lintText(text: string, ext?: string): Promise; + /** + * lint markdown text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text markdown format text + * @returns {Promise.} + */ + lintMarkdown(text: string): Promise; + /** + * lint file and return result object + * @param {string} filePath + * @returns {Promise.} result + */ + lintFile(filePath: string): Promise; + /** + * fix file and return fix result object + * @param {string} filePath + * @returns {Promise.} + */ + fixFile(filePath: string): Promise; + /** + * fix texts and return fix result object + * @param {string} text + * @param {string} ext + * @returns {Promise.} + */ + fixText(text: string, ext?: string): Promise; + /** + * @private + */ + private _mergeSetupOptions; +} diff --git a/node_modules/textlint/module/textlint-core.js b/node_modules/textlint/module/textlint-core.js new file mode 100644 index 000000000..d8446eb0a --- /dev/null +++ b/node_modules/textlint/module/textlint-core.js @@ -0,0 +1,209 @@ +// LICENSE : MIT +"use strict"; +/* + textlint-core.js is a class + textlint.js is a singleton object that is instance of textlint-core.js. + */ +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { TextlintKernel } from "@textlint/kernel"; +import { readFile } from "./util/fs-promise"; +import { filterRulesObjectToKernelRule, pluginsObjectToKernelRule, rulesObjectToKernelRule } from "./util/object-to-kernel-format"; +import textPlugin from "@textlint/textlint-plugin-text"; +import markdownPlugin from "@textlint/textlint-plugin-markdown"; +var path = require("path"); +var throwIfTesting = require("@textlint/feature-flag").throwIfTesting; +/** + * @class {TextLintCore} + */ +var TextLintCore = /** @class */ (function () { + function TextLintCore(config) { + if (config === void 0) { config = {}; } + // this.config often is undefined. + this.config = config; + // Markdown and Text is enabled by default + // Markdown and Text are for backward compatibility. + this.defaultPlugins = [ + { + pluginId: "markdown", + plugin: markdownPlugin + }, + { + pluginId: "text", + plugin: textPlugin + } + ]; + // TODO: remove `config` + // https://github.com/textlint/textlint/issues/296 + this.kernel = new TextlintKernel(config); + this.textlintKernelDescriptor = new TextlintKernelDescriptor({ + rules: [], + plugins: this.defaultPlugins, + filterRules: [] + }); + } + /** + * Use setupPlugins insteadof it. + * + * ```` + * textlint.setupPlugins({ + * yourPluginName: yourPlugin + * }); + * ```` + * + * @param {*} Processor + * @deprecated + * + * It will be removed until textlint@10 + */ + TextLintCore.prototype.addProcessor = function (Processor) { + throwIfTesting("Use setupPlugins insteadof addProcessor method.`addProcessor` will be removed in the future." + + "For more details, See https://github.com/textlint/textlint/issues/293"); + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + plugins: [ + { + pluginId: "`${Processor.name}@deprecated`", + plugin: { Processor: Processor } + } + ].concat(this.defaultPlugins) + }); + }; + /** + * register Processors + * @param {Object} plugins + * @param {Object} [pluginsConfig] + */ + TextLintCore.prototype.setupPlugins = function (plugins, pluginsConfig) { + if (plugins === void 0) { plugins = {}; } + if (pluginsConfig === void 0) { pluginsConfig = {}; } + // Append default plugin to the plugins list. + // Because, default plugin can be override by user plugins + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + plugins: pluginsObjectToKernelRule(plugins, pluginsConfig).concat(this.defaultPlugins) + }); + }; + /** + * Register rules and rulesConfig. + * if want to release rules, please call {@link resetRules}. + * @param {object} rules rule objects array + * @param {object} [rulesOption] ruleConfig is object + */ + TextLintCore.prototype.setupRules = function (rules, rulesOption) { + if (rules === void 0) { rules = {}; } + if (rulesOption === void 0) { rulesOption = {}; } + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + rules: rulesObjectToKernelRule(rules, rulesOption) + }); + }; + /** + * Register filterRules and filterRulesConfig. + * if want to release rules, please call {@link resetRules}. + * @param {object} filterRules rule objects array + * @param {object} [filterRulesOption] ruleConfig is object + */ + TextLintCore.prototype.setupFilterRules = function (filterRules, filterRulesOption) { + if (filterRules === void 0) { filterRules = {}; } + if (filterRulesOption === void 0) { filterRulesOption = {}; } + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + filterRules: filterRulesObjectToKernelRule(filterRules, filterRulesOption) + }); + }; + /** + * Remove all registered rule and clear messages. + */ + TextLintCore.prototype.resetRules = function () { + this.textlintKernelDescriptor = new TextlintKernelDescriptor({ + rules: [], + plugins: this.defaultPlugins, + filterRules: [] + }); + }; + /** + * lint text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text + * @param {string} ext ext is extension. default: .txt + * @returns {Promise.} + */ + TextLintCore.prototype.lintText = function (text, ext) { + if (ext === void 0) { ext = ".txt"; } + var options = this._mergeSetupOptions({ + ext: ext + }); + return this.kernel.lintText(text, options); + }; + /** + * lint markdown text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text markdown format text + * @returns {Promise.} + */ + TextLintCore.prototype.lintMarkdown = function (text) { + var ext = ".md"; + var options = this._mergeSetupOptions({ + ext: ext + }); + return this.kernel.lintText(text, options); + }; + /** + * lint file and return result object + * @param {string} filePath + * @returns {Promise.} result + */ + TextLintCore.prototype.lintFile = function (filePath) { + var _this = this; + var absoluteFilePath = path.resolve(process.cwd(), filePath); + var ext = path.extname(absoluteFilePath); + var options = this._mergeSetupOptions({ + ext: ext, + filePath: absoluteFilePath + }); + return readFile(absoluteFilePath).then(function (text) { + return _this.kernel.lintText(text, options); + }); + }; + /** + * fix file and return fix result object + * @param {string} filePath + * @returns {Promise.} + */ + TextLintCore.prototype.fixFile = function (filePath) { + var _this = this; + var absoluteFilePath = path.resolve(process.cwd(), filePath); + var ext = path.extname(absoluteFilePath); + var options = this._mergeSetupOptions({ + ext: ext, + filePath: absoluteFilePath + }); + return readFile(absoluteFilePath).then(function (text) { + return _this.kernel.fixText(text, options); + }); + }; + /** + * fix texts and return fix result object + * @param {string} text + * @param {string} ext + * @returns {Promise.} + */ + TextLintCore.prototype.fixText = function (text, ext) { + if (ext === void 0) { ext = ".txt"; } + var options = this._mergeSetupOptions({ + ext: ext + }); + return this.kernel.fixText(text, options); + }; + /** + * @private + */ + TextLintCore.prototype._mergeSetupOptions = function (options) { + var configFileBaseDir = typeof this.config.configFile === "string" ? path.dirname(this.config.configFile) : undefined; + return Object.assign({}, options, { + configBaseDir: configFileBaseDir, + plugins: this.textlintKernelDescriptor.plugin.toKernelPluginsFormat(), + rules: this.textlintKernelDescriptor.rule.toKernelRulesFormat(), + filterRules: this.textlintKernelDescriptor.filterRule.toKernelFilterRulesFormat() + }); + }; + return TextLintCore; +}()); +export { TextLintCore }; +//# sourceMappingURL=textlint-core.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/textlint-core.js.map b/node_modules/textlint/module/textlint-core.js.map new file mode 100644 index 000000000..fccc53216 --- /dev/null +++ b/node_modules/textlint/module/textlint-core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-core.js","sourceRoot":"","sources":["../src/textlint-core.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAEH,cAAc,EAMjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EACzB,uBAAuB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,gCAAgC,CAAC;AACxD,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAEhE,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,IAAA,cAAc,GAAK,OAAO,CAAC,wBAAwB,CAAC,eAAtC,CAAuC;AAE7D;;GAEG;AACH;IAMI,sBAAY,MAA4B;QAA5B,uBAAA,EAAA,WAA4B;QACpC,kCAAkC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,0CAA0C;QAC1C,oDAAoD;QACpD,IAAI,CAAC,cAAc,GAAG;YAClB;gBACI,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,cAAc;aACzB;YACD;gBACI,QAAQ,EAAE,MAAM;gBAChB,MAAM,EAAE,UAAU;aACrB;SACJ,CAAC;QACF,wBAAwB;QACxB,kDAAkD;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,wBAAwB,GAAG,IAAI,wBAAwB,CAAC;YACzD,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,IAAI,CAAC,cAAc;YAC5B,WAAW,EAAE,EAAE;SAClB,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,mCAAY,GAAZ,UAAa,SAA6C;QACtD,cAAc,CACV,8FAA8F;YAC1F,uEAAuE,CAC9E,CAAC;QACF,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC;YACvE,OAAO,EAAE;gBACL;oBACI,QAAQ,EAAE,gCAAgC;oBAC1C,MAAM,EAAE,EAAE,SAAS,WAAA,EAAE;iBACxB;aACJ,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;SAChC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,mCAAY,GAAZ,UACI,OAAwD,EACxD,aAA8D;QAD9D,wBAAA,EAAA,YAAwD;QACxD,8BAAA,EAAA,kBAA8D;QAE9D,6CAA6C;QAC7C,0DAA0D;QAC1D,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC;YACvE,OAAO,EAAE,yBAAyB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;SACzF,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,iCAAU,GAAV,UAAW,KAAU,EAAE,WAAgB;QAA5B,sBAAA,EAAA,UAAU;QAAE,4BAAA,EAAA,gBAAgB;QACnC,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC;YACvE,KAAK,EAAE,uBAAuB,CAAC,KAAK,EAAE,WAAW,CAAC;SACrD,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,uCAAgB,GAAhB,UAAiB,WAAgB,EAAE,iBAAsB;QAAxC,4BAAA,EAAA,gBAAgB;QAAE,kCAAA,EAAA,sBAAsB;QACrD,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC;YACvE,WAAW,EAAE,6BAA6B,CAAC,WAAW,EAAE,iBAAiB,CAAC;SAC7E,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,iCAAU,GAAV;QACI,IAAI,CAAC,wBAAwB,GAAG,IAAI,wBAAwB,CAAC;YACzD,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,IAAI,CAAC,cAAc;YAC5B,WAAW,EAAE,EAAE;SAClB,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACH,+BAAQ,GAAR,UAAS,IAAY,EAAE,GAAoB;QAApB,oBAAA,EAAA,YAAoB;QACvC,IAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC;YACpC,GAAG,KAAA;SACN,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,mCAAY,GAAZ,UAAa,IAAY;QACrB,IAAM,GAAG,GAAG,KAAK,CAAC;QAClB,IAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC;YACpC,GAAG,KAAA;SACN,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,+BAAQ,GAAR,UAAS,QAAgB;QAAzB,iBAUC;QATG,IAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC/D,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC3C,IAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC;YACpC,GAAG,KAAA;YACH,QAAQ,EAAE,gBAAgB;SAC7B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,UAAC,IAAY;YAChD,OAAO,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,8BAAO,GAAP,UAAQ,QAAgB;QAAxB,iBAUC;QATG,IAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC/D,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC3C,IAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC;YACpC,GAAG,KAAA;YACH,QAAQ,EAAE,gBAAgB;SAC7B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,UAAC,IAAY;YAChD,OAAO,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,8BAAO,GAAP,UAAQ,IAAY,EAAE,GAAoB;QAApB,oBAAA,EAAA,YAAoB;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC;YACpC,GAAG,KAAA;SACN,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACK,yCAAkB,GAA1B,UAA2B,OAAsD;QAC7E,IAAM,iBAAiB,GACnB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClG,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;YAC9B,aAAa,EAAE,iBAAiB;YAChC,OAAO,EAAE,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,qBAAqB,EAAE;YACrE,KAAK,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC/D,WAAW,EAAE,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,yBAAyB,EAAE;SACpF,CAAC,CAAC;IACP,CAAC;IACL,mBAAC;AAAD,CAAC,AAvMD,IAuMC"} \ No newline at end of file diff --git a/node_modules/textlint/module/textlint-engine.d.ts b/node_modules/textlint/module/textlint-engine.d.ts new file mode 100644 index 000000000..6eda6dbfa --- /dev/null +++ b/node_modules/textlint/module/textlint-engine.d.ts @@ -0,0 +1,24 @@ +import { AbstractTextLintEngine } from "./engine/textlint-engine-core"; +import { TextLintCore } from "./textlint-core"; +import { TextLintFormatterOption } from "./textlint-interface"; +import { TextlintResult } from "@textlint/kernel"; +/** + * TextLintEngine a adapter for TextLintEngineCore. + * It aim to pull the whole look together. (TextLintEngine and TextFixEngine) + */ +export declare class TextLintEngine extends AbstractTextLintEngine { + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onFile: (textlintCore: TextLintCore) => (file: string) => Promise; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onText: (textlintCore: TextLintCore) => (text: string, ext: string | undefined) => Promise; + /** + * @param {TextLintFormatterOption} formatterConfig + */ + onFormat: (formatterConfig: TextLintFormatterOption) => (results: TextlintResult[]) => string; +} diff --git a/node_modules/textlint/module/textlint-engine.js b/node_modules/textlint/module/textlint-engine.js new file mode 100644 index 000000000..ec44750ed --- /dev/null +++ b/node_modules/textlint/module/textlint-engine.js @@ -0,0 +1,67 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +import { createFormatter } from "@textlint/linter-formatter"; +import { AbstractTextLintEngine } from "./engine/textlint-engine-core"; +/** + * TextLintEngine a adapter for TextLintEngineCore. + * It aim to pull the whole look together. (TextLintEngine and TextFixEngine) + */ +var TextLintEngine = /** @class */ (function (_super) { + __extends(TextLintEngine, _super); + function TextLintEngine() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + _this.onFile = function (textlintCore) { + /** + * Executes the current configuration on an array of file and directory names. + * TextLintEngine#executeOnFile + * @param {String} file An array of file and directory names. + * @returns {TextlintResult[]} The results for all files that were linted. + */ + return function executeOnFile(file) { + return textlintCore.lintFile(file); + }; + }; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + _this.onText = function (textlintCore) { + /** + * lint text, and return TextlintResult[] + * TextLintEngine#executeOnText + * @param {string} text linting text content + * @param {string} ext ext is a type for linting. default: ".txt" + * @returns {TextlintResult[]} + */ + return function executeOnText(text, ext) { + return textlintCore.lintText(text, ext); + }; + }; + /** + * @param {TextLintFormatterOption} formatterConfig + */ + _this.onFormat = function (formatterConfig) { + return createFormatter(formatterConfig); + }; + return _this; + } + return TextLintEngine; +}(AbstractTextLintEngine)); +export { TextLintEngine }; +//# sourceMappingURL=textlint-engine.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/textlint-engine.js.map b/node_modules/textlint/module/textlint-engine.js.map new file mode 100644 index 000000000..189e13a47 --- /dev/null +++ b/node_modules/textlint/module/textlint-engine.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-engine.js","sourceRoot":"","sources":["../src/textlint-engine.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;AACb,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAKvE;;;GAGG;AACH;IAAoC,kCAAsC;IAA1E;QAAA,qEAuCC;QAtCG;;;WAGG;QACH,YAAM,GAAG,UAAC,YAA0B;YAChC;;;;;eAKG;YACH,OAAO,SAAS,aAAa,CAAC,IAAY;gBACtC,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACvC,CAAC,CAAC;QACN,CAAC,CAAC;QACF;;;WAGG;QACH,YAAM,GAAG,UAAC,YAA0B;YAChC;;;;;;eAMG;YACH,OAAO,SAAS,aAAa,CAAC,IAAY,EAAE,GAAuB;gBAC/D,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC5C,CAAC,CAAC;QACN,CAAC,CAAC;QAEF;;WAEG;QACH,cAAQ,GAAG,UAAC,eAAwC;YAChD,OAAO,eAAe,CAAC,eAAe,CAAC,CAAC;QAC5C,CAAC,CAAC;;IACN,CAAC;IAAD,qBAAC;AAAD,CAAC,AAvCD,CAAoC,sBAAsB,GAuCzD"} \ No newline at end of file diff --git a/node_modules/textlint/module/textlint-interface.d.ts b/node_modules/textlint/module/textlint-interface.d.ts new file mode 100644 index 000000000..e38f690f1 --- /dev/null +++ b/node_modules/textlint/module/textlint-interface.d.ts @@ -0,0 +1,8 @@ +/** @typedef {Object} TextLintFormatterOption + * @property {string} formatterName + * @property {boolean} noColor + */ +export interface TextLintFormatterOption { + formatterName: string; + color?: boolean; +} diff --git a/node_modules/textlint/module/textlint-interface.js b/node_modules/textlint/module/textlint-interface.js new file mode 100644 index 000000000..c40075356 --- /dev/null +++ b/node_modules/textlint/module/textlint-interface.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=textlint-interface.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/textlint-interface.js.map b/node_modules/textlint/module/textlint-interface.js.map new file mode 100644 index 000000000..708eecca2 --- /dev/null +++ b/node_modules/textlint/module/textlint-interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint-interface.js","sourceRoot":"","sources":["../src/textlint-interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/textlint/module/textlint.d.ts b/node_modules/textlint/module/textlint.d.ts new file mode 100644 index 000000000..88e48687d --- /dev/null +++ b/node_modules/textlint/module/textlint.d.ts @@ -0,0 +1,2 @@ +import { TextLintCore } from "./textlint-core"; +export declare const textlint: TextLintCore; diff --git a/node_modules/textlint/module/textlint.js b/node_modules/textlint/module/textlint.js new file mode 100644 index 000000000..42e6d7510 --- /dev/null +++ b/node_modules/textlint/module/textlint.js @@ -0,0 +1,40 @@ +// LICENSE : MIT +"use strict"; +/* + Api is an implemented of linting text. + + + # Usage + + First, register rules by `api.setupRules`. + Second, lint text and get `TextlintResult` by `api.lint*`. + Finally, cleanup by `api.resetRules`. + + ## Concept + + `textlint.js` intended to lint for a single file. + + `textlint.js` is Core API. So, carefully use it. + You should manage `setupRules` and `resetRules` by the hand. + + ## FAQ? + + Q. How to handle multiple files? + + A. Use `cli-engine` which is wrapped `textlint.js`. + + ## More detail workflow + + - load rules + - addEventLister each **event** of rule {@link api.setupRules} + - parse text to AST(TxtNode) + - traverse ast -> emit **event** + - report(push message) + - display messages with formatter + + + */ +import { TextLintCore } from "./textlint-core"; +// singleton instance +export var textlint = new TextLintCore(); +//# sourceMappingURL=textlint.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/textlint.js.map b/node_modules/textlint/module/textlint.js.map new file mode 100644 index 000000000..36a8b8bfc --- /dev/null +++ b/node_modules/textlint/module/textlint.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textlint.js","sourceRoot":"","sources":["../src/textlint.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,qBAAqB;AACrB,MAAM,CAAC,IAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/util/find-util.d.ts b/node_modules/textlint/module/util/find-util.d.ts new file mode 100644 index 000000000..5c661849d --- /dev/null +++ b/node_modules/textlint/module/util/find-util.d.ts @@ -0,0 +1,31 @@ +export declare type FindFilesOptions = { + cwd?: string; + ignoreFilePath?: string; +}; +/** + * filter files by config + * @param {string[]} patterns glob patterns + * @param {{extensions?: string[], cwd?: string }} options + */ +export declare function pathsToGlobPatterns(patterns: string[], options?: { + extensions?: string[]; + cwd?: string; +}): string[]; +/** + * found files by glob pattern + * @param {string[]} patterns + * @param {FindFilesOptions} options + * @returns {string[]} file path list + */ +export declare function findFiles(patterns: string[], options?: FindFilesOptions): string[]; +/** + * @param {string[]} files + * @param {{extensions?: string[]}} [options] + * @returns {{availableFiles: string[], unAvailableFiles: string[]}} + */ +export declare function separateByAvailability(files: string[], options?: { + extensions?: string[]; +}): { + availableFiles: string[]; + unAvailableFiles: string[]; +}; diff --git a/node_modules/textlint/module/util/find-util.js b/node_modules/textlint/module/util/find-util.js new file mode 100644 index 000000000..b78ac312e --- /dev/null +++ b/node_modules/textlint/module/util/find-util.js @@ -0,0 +1,113 @@ +// LICENSE : MIT +"use strict"; +var pathToGlob = require("path-to-glob-pattern"); +var glob = require("glob"); +var path = require("path"); +var fs = require("fs"); +var debug = require("debug")("textlint:find-util"); +var DEFAULT_IGNORE_PATTERNS = Object.freeze(["**/.git/**", "**/node_modules/**"]); +var mapGitIgnorePatternTo = function (base) { return function (ignore) { + if (ignore.startsWith("!")) { + return "!" + path.posix.join(base, ignore.slice(1)); + } + return path.posix.join(base, ignore); +}; }; +var isFile = function (filePath) { + try { + return fs.statSync(filePath).isFile(); + } + catch (error) { + return false; + } +}; +/** + * filter files by config + * @param {string[]} patterns glob patterns + * @param {{extensions?: string[], cwd?: string }} options + */ +export function pathsToGlobPatterns(patterns, options) { + if (options === void 0) { options = {}; } + var processPatterns = pathToGlob({ + extensions: options.extensions || [], + cwd: options.cwd || process.cwd() + }); + return patterns.map(processPatterns); +} +/** + * found files by glob pattern + * @param {string[]} patterns + * @param {FindFilesOptions} options + * @returns {string[]} file path list + */ +export function findFiles(patterns, options) { + if (options === void 0) { options = {}; } + var cwd = options.cwd || process.cwd(); + var ignoredPatterns = []; + ignoredPatterns.push.apply(ignoredPatterns, DEFAULT_IGNORE_PATTERNS); + if (options.ignoreFilePath) { + var baseDir = path.resolve(cwd, path.dirname(options.ignoreFilePath)); + var normalizeIgnoreFilePath = path.resolve(cwd, options.ignoreFilePath); + debug("findFiles ignore baseDir: %s, normalizeIgnoreFilePath: %s", baseDir, normalizeIgnoreFilePath); + if (fs.existsSync(normalizeIgnoreFilePath)) { + var ignored = fs + .readFileSync(normalizeIgnoreFilePath, "utf-8") + .split(/\r?\n/) + .filter(function (line) { return !/^\s*$/.test(line) && !/^\s*#/.test(line); }) + .map(mapGitIgnorePatternTo(baseDir)); + debug("ignored: %o", ignored); + ignoredPatterns.push.apply(ignoredPatterns, ignored); + } + } + debug("search patterns: %o", patterns); + debug("search ignore patterns: %o", ignoredPatterns); + var files = []; + var addFile = function (filePath) { + if (files.indexOf(filePath) === -1) { + files.push(filePath); + } + }; + patterns.forEach(function (pattern) { + var file = path.resolve(cwd, pattern); + if (isFile(file)) { + addFile(fs.realpathSync(file)); + } + else { + glob.sync(pattern, { + cwd: cwd, + absolute: true, + nodir: true, + ignore: ignoredPatterns + }).forEach(function (filePath) { + // workaround for windows + // https://github.com/isaacs/node-glob/issues/74#issuecomment-31548810 + addFile(path.resolve(filePath)); + }); + } + }); + return files; +} +/** + * @param {string[]} files + * @param {{extensions?: string[]}} [options] + * @returns {{availableFiles: string[], unAvailableFiles: string[]}} + */ +export function separateByAvailability(files, options) { + if (options === void 0) { options = {}; } + var extensions = options.extensions || []; + var availableFiles = []; + var unAvailableFiles = []; + files.forEach(function (filePath) { + var extname = path.extname(filePath); + if (extensions.indexOf(extname) === -1) { + unAvailableFiles.push(filePath); + } + else { + availableFiles.push(filePath); + } + }); + return { + availableFiles: availableFiles, + unAvailableFiles: unAvailableFiles + }; +} +//# sourceMappingURL=find-util.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/util/find-util.js.map b/node_modules/textlint/module/util/find-util.js.map new file mode 100644 index 000000000..de656922a --- /dev/null +++ b/node_modules/textlint/module/util/find-util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"find-util.js","sourceRoot":"","sources":["../../src/util/find-util.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,IAAM,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AACnD,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC;AACrD,IAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAKpF,IAAM,qBAAqB,GAAG,UAAC,IAAY,IAAK,OAAA,UAAC,MAAc;IAC3D,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACxB,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACvD;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC,EAL+C,CAK/C,CAAC;AACF,IAAM,MAAM,GAAG,UAAC,QAAgB;IAC5B,IAAI;QACA,OAAO,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;KACzC;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;AACL,CAAC,CAAC;AACF;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAC/B,QAAkB,EAClB,OAAqD;IAArD,wBAAA,EAAA,YAAqD;IAErD,IAAM,eAAe,GAAG,UAAU,CAAC;QAC/B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;KACpC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC;AACD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAAkB,EAAE,OAA8B;IAA9B,wBAAA,EAAA,YAA8B;IACxE,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,IAAM,eAAe,GAAa,EAAE,CAAC;IACrC,eAAe,CAAC,IAAI,OAApB,eAAe,EAAS,uBAAuB,EAAE;IACjD,IAAI,OAAO,CAAC,cAAc,EAAE;QACxB,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;QACxE,IAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1E,KAAK,CAAC,2DAA2D,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC;QACrG,IAAI,EAAE,CAAC,UAAU,CAAC,uBAAuB,CAAC,EAAE;YACxC,IAAM,OAAO,GAAG,EAAE;iBACb,YAAY,CAAC,uBAAuB,EAAE,OAAO,CAAC;iBAC9C,KAAK,CAAC,OAAO,CAAC;iBACd,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAA1C,CAA0C,CAAC;iBACpE,GAAG,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;YACzC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC9B,eAAe,CAAC,IAAI,OAApB,eAAe,EAAS,OAAO,EAAE;SACpC;KACJ;IACD,KAAK,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IACvC,KAAK,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;IACrD,IAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAM,OAAO,GAAG,UAAC,QAAgB;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;YAChC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACxB;IACL,CAAC,CAAC;IACF,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAO;QACrB,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;YACd,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;SAClC;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACf,GAAG,KAAA;gBACH,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,eAAe;aAC1B,CAAC,CAAC,OAAO,CAAC,UAAC,QAAgB;gBACxB,yBAAyB;gBACzB,sEAAsE;gBACtE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAClC,KAAe,EACf,OAAuC;IAAvC,wBAAA,EAAA,YAAuC;IAEvC,IAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;IAC5C,IAAM,cAAc,GAAa,EAAE,CAAC;IACpC,IAAM,gBAAgB,GAAa,EAAE,CAAC;IACtC,KAAK,CAAC,OAAO,CAAC,UAAC,QAAQ;QACnB,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;YACpC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACnC;aAAM;YACH,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;IACH,OAAO;QACH,cAAc,gBAAA;QACd,gBAAgB,kBAAA;KACnB,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/util/fs-promise.d.ts b/node_modules/textlint/module/util/fs-promise.d.ts new file mode 100644 index 000000000..2d990bdbd --- /dev/null +++ b/node_modules/textlint/module/util/fs-promise.d.ts @@ -0,0 +1 @@ +export declare function readFile(filePath: string): Promise; diff --git a/node_modules/textlint/module/util/fs-promise.js b/node_modules/textlint/module/util/fs-promise.js new file mode 100644 index 000000000..faff15c09 --- /dev/null +++ b/node_modules/textlint/module/util/fs-promise.js @@ -0,0 +1,14 @@ +// LICENSE : MIT +"use strict"; +var fs = require("fs"); +export function readFile(filePath) { + return new Promise(function (resolve, reject) { + fs.readFile(filePath, "utf-8", function (error, result) { + if (error) { + return reject(error); + } + resolve(result); + }); + }); +} +//# sourceMappingURL=fs-promise.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/util/fs-promise.js.map b/node_modules/textlint/module/util/fs-promise.js.map new file mode 100644 index 000000000..98ddecd09 --- /dev/null +++ b/node_modules/textlint/module/util/fs-promise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fs-promise.js","sourceRoot":"","sources":["../../src/util/fs-promise.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AACb,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,UAAU,QAAQ,CAAU,QAAgB;IAC9C,OAAO,IAAI,OAAO,CAAC,UAAC,OAAY,EAAE,MAAW;QACzC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAC,KAAsB,EAAE,MAAW;YAC/D,IAAI,KAAK,EAAE;gBACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;aACxB;YACD,OAAO,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/util/logger.d.ts b/node_modules/textlint/module/util/logger.d.ts new file mode 100644 index 000000000..9c838146a --- /dev/null +++ b/node_modules/textlint/module/util/logger.d.ts @@ -0,0 +1,10 @@ +/** + * Logger Utils class + * Use this instead of `console.log` + * Main purpose for helping linting. + */ +export declare class Logger { + static log(...message: any[]): void; + static warn(...message: any[]): void; + static error(...message: any[]): void; +} diff --git a/node_modules/textlint/module/util/logger.js b/node_modules/textlint/module/util/logger.js new file mode 100644 index 000000000..bdb27d098 --- /dev/null +++ b/node_modules/textlint/module/util/logger.js @@ -0,0 +1,36 @@ +// LICENSE : MIT +"use strict"; +/* eslint-disable no-console */ +/** + * Logger Utils class + * Use this instead of `console.log` + * Main purpose for helping linting. + */ +var Logger = /** @class */ (function () { + function Logger() { + } + Logger.log = function () { + var message = []; + for (var _i = 0; _i < arguments.length; _i++) { + message[_i] = arguments[_i]; + } + console.log.apply(console, message); + }; + Logger.warn = function () { + var message = []; + for (var _i = 0; _i < arguments.length; _i++) { + message[_i] = arguments[_i]; + } + console.warn.apply(console, message); + }; + Logger.error = function () { + var message = []; + for (var _i = 0; _i < arguments.length; _i++) { + message[_i] = arguments[_i]; + } + console.error.apply(console, message); + }; + return Logger; +}()); +export { Logger }; +//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/util/logger.js.map b/node_modules/textlint/module/util/logger.js.map new file mode 100644 index 000000000..210a6ff20 --- /dev/null +++ b/node_modules/textlint/module/util/logger.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,YAAY,CAAC;AAEb,+BAA+B;AAE/B;;;;GAIG;AACH;IAAA;IAYA,CAAC;IAXU,UAAG,GAAV;QAAW,iBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,4BAAiB;;QACxB,OAAO,CAAC,GAAG,OAAX,OAAO,EAAQ,OAAO,EAAE;IAC5B,CAAC;IAEM,WAAI,GAAX;QAAY,iBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,4BAAiB;;QACzB,OAAO,CAAC,IAAI,OAAZ,OAAO,EAAS,OAAO,EAAE;IAC7B,CAAC;IAEM,YAAK,GAAZ;QAAa,iBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,4BAAiB;;QAC1B,OAAO,CAAC,KAAK,OAAb,OAAO,EAAU,OAAO,EAAE;IAC9B,CAAC;IACL,aAAC;AAAD,CAAC,AAZD,IAYC"} \ No newline at end of file diff --git a/node_modules/textlint/module/util/object-to-kernel-format.d.ts b/node_modules/textlint/module/util/object-to-kernel-format.d.ts new file mode 100644 index 000000000..524504599 --- /dev/null +++ b/node_modules/textlint/module/util/object-to-kernel-format.d.ts @@ -0,0 +1,38 @@ +import { TextlintFilterRuleReporter, TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule, TextlintPluginCreator, TextlintRuleModule } from "@textlint/kernel"; +/** + * Convert rulesObject to TextlintKernelRule + * { + * "rule-name": rule + * }, + * { + * "rule-name": ruleOption + * } + * + * => TextlintKernelRule + */ +export declare const rulesObjectToKernelRule: (rules: { + [p: string]: TextlintRuleModule; +}, rulesOption: { + [p: string]: TextlintKernelRule["options"]; +}) => TextlintKernelRule[]; +export declare const filterRulesObjectToKernelRule: (rules: { + [p: string]: TextlintFilterRuleReporter; +}, rulesOption: { + [p: string]: TextlintKernelFilterRule["options"]; +}) => TextlintKernelFilterRule[]; +/** + * Convert pluginsObject to TextlintKernelPlugin + * { + * "plugin-name": plugin + * }, + * { + * "plugin-name": pluginOption + * } + * + * => TextlintKernelPlugin + */ +export declare const pluginsObjectToKernelRule: (plugins: { + [index: string]: TextlintPluginCreator; +}, pluginsOption: { + [index: string]: boolean | import("@textlint/kernel").TextlintPluginOptions | undefined; +}) => TextlintKernelPlugin[]; diff --git a/node_modules/textlint/module/util/object-to-kernel-format.js b/node_modules/textlint/module/util/object-to-kernel-format.js new file mode 100644 index 000000000..8ead11508 --- /dev/null +++ b/node_modules/textlint/module/util/object-to-kernel-format.js @@ -0,0 +1,50 @@ +/** + * Convert rulesObject to TextlintKernelRule + * { + * "rule-name": rule + * }, + * { + * "rule-name": ruleOption + * } + * + * => TextlintKernelRule + */ +export var rulesObjectToKernelRule = function (rules, rulesOption) { + return Object.keys(rules).map(function (ruleId) { + return { + ruleId: ruleId, + rule: rules[ruleId], + options: rulesOption[ruleId] + }; + }); +}; +export var filterRulesObjectToKernelRule = function (rules, rulesOption) { + return Object.keys(rules).map(function (ruleId) { + return { + ruleId: ruleId, + rule: rules[ruleId], + options: rulesOption[ruleId] + }; + }); +}; +/** + * Convert pluginsObject to TextlintKernelPlugin + * { + * "plugin-name": plugin + * }, + * { + * "plugin-name": pluginOption + * } + * + * => TextlintKernelPlugin + */ +export var pluginsObjectToKernelRule = function (plugins, pluginsOption) { + return Object.keys(plugins).map(function (pluginId) { + return { + pluginId: pluginId, + plugin: plugins[pluginId], + options: pluginsOption[pluginId] + }; + }); +}; +//# sourceMappingURL=object-to-kernel-format.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/util/object-to-kernel-format.js.map b/node_modules/textlint/module/util/object-to-kernel-format.js.map new file mode 100644 index 000000000..8c9410160 --- /dev/null +++ b/node_modules/textlint/module/util/object-to-kernel-format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-to-kernel-format.js","sourceRoot":"","sources":["../../src/util/object-to-kernel-format.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAGR,UAAC,KAAK,EAAE,WAAW;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAC,MAAM;QACjC,OAAO;YACH,MAAM,QAAA;YACN,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;SAC/B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,6BAA6B,GAGR,UAAC,KAAK,EAAE,WAAW;IACjD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAC,MAAM;QACjC,OAAO;YACH,MAAM,QAAA;YACN,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;SAC/B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,IAAM,yBAAyB,GAAG,UACrC,OAAmD,EACnD,aAAmE;IAEnE,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,UAAC,QAAQ;QACrC,OAAO;YACH,QAAQ,UAAA;YACR,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;YACzB,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC;SACnC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/module/util/traverse.d.ts b/node_modules/textlint/module/util/traverse.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/node_modules/textlint/module/util/traverse.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/textlint/module/util/traverse.js b/node_modules/textlint/module/util/traverse.js new file mode 100644 index 000000000..e1b7ca5f0 --- /dev/null +++ b/node_modules/textlint/module/util/traverse.js @@ -0,0 +1,82 @@ +/** + * @fileoverview Simple directory traversal logic. + * @author Nicholas C. Zakas + */ +"use strict"; +import fs from "fs"; +import path from "path"; +import debug0 from "debug"; +var debug = debug0("textlint:traverse"); +/** + * Walks a path recursively calling the callback on each file. + * @param {string} name The file or directory path. + * @param {string[]} extensions The file extensions that should cause the callback + * to be called. + * @param {Function} [exclude] The function to check if file/path should be excluded. + * @param {Function} callback The function to call on each file. + * @returns {void} + * @private + */ +function walk(name, extensions, exclude, callback) { + var stat = fs.statSync(name); + /** + * @param {string} dir + * @param {string[]} stack + */ + function traverse(dir, stack) { + stack.push(dir); + fs.readdirSync(path.join.apply(path, stack)).forEach(function (file) { + // skip all hidden things (dirs, files, links) + if (file[0] === ".") { + return; + } + var filePath = path.join.apply(path, stack.concat([file])); + var fileStat = fs.statSync(filePath); + // if this file or directory is excluded from linting, skip over it. + if (exclude && exclude(filePath)) { + debug("Ignoring " + filePath); + return; + } + // only call callback for files with correct extensions + if (fileStat.isFile() && extensions.indexOf(path.extname(filePath)) > -1) { + callback(filePath); + } + else if (fileStat.isDirectory()) { + traverse(file, stack); + } + }); + stack.pop(); + } + var basename = path.basename(name); + // don't ignore cases like 'textlint ./' + if ((basename !== "." && basename !== ".." && basename[0] === ".") || (exclude && exclude(name))) { + debug("Ignoring " + name); + return; + } + // always call callback for any files that are passed on the command line + if (stat.isFile()) { + if (extensions.indexOf(path.extname(name)) > -1) { + callback(name); + } + } + else { + traverse(name, []); + } +} +/** + * Traverses multiple directories and calls a callback on each file. + * @param {{files:string[], exclude:Function, extensions:string[]}} options The option for the traversal. + * param {string[]} options.files An array of file and directory paths to traverse. + * param {Function} options.exclude The function to check if file/path should be excluded. + * @param {Function} callback A function to call for each file. + * @returns {void} + */ +module.exports = function traverse(options, callback) { + var files = options.files; + var exclude = options.exclude; + var extensions = options.extensions; + files.forEach(function (file) { + walk(file, extensions, exclude, callback); + }); +}; +//# sourceMappingURL=traverse.js.map \ No newline at end of file diff --git a/node_modules/textlint/module/util/traverse.js.map b/node_modules/textlint/module/util/traverse.js.map new file mode 100644 index 000000000..63e5d1fb6 --- /dev/null +++ b/node_modules/textlint/module/util/traverse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/util/traverse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,CAAC;AACb,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,IAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC1C;;;;;;;;;GASG;AACH,SAAS,IAAI,CAAC,IAAY,EAAE,UAAoB,EAAE,OAAiB,EAAE,QAAkB;IACnF,IAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B;;;OAGG;IACH,SAAS,QAAQ,CAAC,GAAW,EAAE,KAAe;QAC1C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,OAAT,IAAI,EAAS,KAAK,EAAE,CAAC,OAAO,CAAC,UAAC,IAAY;YACrD,8CAA8C;YAC9C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBACjB,OAAO;aACV;YACD,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,OAAT,IAAI,EAAS,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpD,IAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACvC,oEAAoE;YACpE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAC9B,KAAK,CAAC,cAAY,QAAU,CAAC,CAAC;gBAC9B,OAAO;aACV;YACD,uDAAuD;YACvD,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;gBACtE,QAAQ,CAAC,QAAQ,CAAC,CAAC;aACtB;iBAAM,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE;gBAC/B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aACzB;QACL,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;IACD,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,wCAAwC;IACxC,IAAI,CAAC,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE;QAC9F,KAAK,CAAC,cAAY,IAAM,CAAC,CAAC;QAC1B,OAAO;KACV;IACD,yEAAyE;IACzE,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;QACf,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;YAC7C,QAAQ,CAAC,IAAI,CAAC,CAAC;SAClB;KACJ;SAAM;QACH,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;KACtB;AACL,CAAC;AACD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,GAAG,SAAS,QAAQ,CAC9B,OAAqE,EACrE,QAAkB;IAElB,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,IAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;QACf,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/textlint/node_modules/get-stdin/index.js b/node_modules/textlint/node_modules/get-stdin/index.js new file mode 100644 index 000000000..2083294e6 --- /dev/null +++ b/node_modules/textlint/node_modules/get-stdin/index.js @@ -0,0 +1,52 @@ +'use strict'; +var stdin = process.stdin; + +module.exports = function () { + var ret = ''; + + return new Promise(function (resolve) { + if (stdin.isTTY) { + resolve(ret); + return; + } + + stdin.setEncoding('utf8'); + + stdin.on('readable', function () { + var chunk; + + while ((chunk = stdin.read())) { + ret += chunk; + } + }); + + stdin.on('end', function () { + resolve(ret); + }); + }); +}; + +module.exports.buffer = function () { + var ret = []; + var len = 0; + + return new Promise(function (resolve) { + if (stdin.isTTY) { + resolve(new Buffer('')); + return; + } + + stdin.on('readable', function () { + var chunk; + + while ((chunk = stdin.read())) { + ret.push(chunk); + len += chunk.length; + } + }); + + stdin.on('end', function () { + resolve(Buffer.concat(ret, len)); + }); + }); +}; diff --git a/node_modules/textlint/node_modules/get-stdin/license b/node_modules/textlint/node_modules/get-stdin/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/textlint/node_modules/get-stdin/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/textlint/node_modules/get-stdin/package.json b/node_modules/textlint/node_modules/get-stdin/package.json new file mode 100644 index 000000000..df7cb599a --- /dev/null +++ b/node_modules/textlint/node_modules/get-stdin/package.json @@ -0,0 +1,41 @@ +{ + "name": "get-stdin", + "version": "5.0.1", + "description": "Get stdin as a string or buffer", + "license": "MIT", + "repository": "sindresorhus/get-stdin", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.12.0" + }, + "scripts": { + "test": "xo && ava test.js && echo unicorns | ava test-real.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "std", + "stdin", + "stdio", + "concat", + "buffer", + "stream", + "process", + "read" + ], + "devDependencies": { + "ava": "*", + "buffer-equals": "^1.0.3", + "xo": "*" + }, + "xo": { + "ignores": [ + "test.js" + ] + } +} diff --git a/node_modules/textlint/node_modules/get-stdin/readme.md b/node_modules/textlint/node_modules/get-stdin/readme.md new file mode 100644 index 000000000..95fcbaae7 --- /dev/null +++ b/node_modules/textlint/node_modules/get-stdin/readme.md @@ -0,0 +1,55 @@ +# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) + +> Get [stdin](https://nodejs.org/api/process.html#process_process_stdin) as a string or buffer + + +## Install + +``` +$ npm install --save get-stdin +``` + + +## Usage + +```js +// example.js +const getStdin = require('get-stdin'); + +getStdin().then(str => { + console.log(str); + //=> 'unicorns' +}); +``` + +``` +$ echo unicorns | node example.js +unicorns +``` + + +## API + +Both methods returns a promise that is resolved when the `end` event fires on the `stdin` stream, indicating that there is no more data to be read. + +### getStdin() + +Get `stdin` as a string. + +In a TTY context, a promise that resolves to an empty string is returned. + +### getStdin.buffer() + +Get `stdin` as a buffer. + +In a TTY context, a promise that resolves to an empty buffer is returned. + + +## Related + +- [get-stream](https://github.com/sindresorhus/get-stream) - Get a stream as a string or buffer + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/textlint/package.json b/node_modules/textlint/package.json new file mode 100644 index 000000000..b460d8b4a --- /dev/null +++ b/node_modules/textlint/package.json @@ -0,0 +1,106 @@ +{ + "name": "textlint", + "version": "11.9.1", + "description": "The pluggable linting tool for text and markdown.", + "keywords": [ + "AST", + "lint", + "linting", + "markdown", + "pluggable", + "text", + "textlint", + "nlp" + ], + "homepage": "https://github.com/textlint/textlint/", + "bugs": { + "url": "https://github.com/textlint/textlint/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/textlint/textlint.git" + }, + "license": "MIT", + "author": "azu", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bin": { + "textlint": "./bin/textlint.js" + }, + "directories": { + "test": "test/" + }, + "files": [ + "bin/", + "lib/", + "module/", + "src/" + ], + "scripts": { + "build": "tsc -b && tsc -b tsconfig.module.json", + "clean": "rimraf lib/ module/ tsconfig.tsbuildinfo tsconfig.module.tsbuildinfo", + "prepublish": "npm run build", + "test": "npm-run-all test:unit", + "test:unit": "mocha \"test/**/*.{js,ts}\"", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/fixer-formatter": "^3.3.5", + "@textlint/kernel": "^3.4.5", + "@textlint/linter-formatter": "^3.3.5", + "@textlint/module-interop": "^1.2.5", + "@textlint/textlint-plugin-markdown": "^5.3.5", + "@textlint/textlint-plugin-text": "^4.3.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "file-entry-cache": "^5.0.1", + "get-stdin": "^5.0.1", + "glob": "^7.1.7", + "is-file": "^1.0.0", + "log-symbols": "^1.0.2", + "map-like": "^2.0.0", + "md5": "^2.3.0", + "mkdirp": "^0.5.0", + "optionator": "^0.9.1", + "path-to-glob-pattern": "^1.0.2", + "rc-config-loader": "^3.0.0", + "read-pkg": "^1.1.0", + "read-pkg-up": "^3.0.0", + "structured-source": "^3.0.2", + "try-resolve": "^1.0.1", + "unique-concat": "^0.2.2" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.44", + "clone": "^2.1.2", + "cpx": "^1.5.0", + "cross-env": "^7.0.3", + "mocha": "^8.4.0", + "npm-run-all": "^4.1.5", + "power-assert": "^1.6.1", + "rimraf": "^3.0.2", + "shelljs": "^0.8.4", + "source-map-support": "^0.5.19", + "textlint-plugin-html": "^0.2.0", + "textlint-rule-helper": "^2.1.1", + "textlint-rule-no-todo": "^2.0.1", + "textlint-rule-preset-ja-spacing": "^2.1.1", + "textlint-rule-preset-jtf-style": "^2.3.9", + "ts-node": "^9.1.1", + "ts-node-test-register": "^9.0.1", + "typescript": "~4.0.2" + }, + "engines": { + "node": ">=6.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "4cb1e78aa38cd0e942c61f352ffb29bb36f80a7b" +} diff --git a/node_modules/textlint/src/README.md b/node_modules/textlint/src/README.md new file mode 100644 index 000000000..d20333d2f --- /dev/null +++ b/node_modules/textlint/src/README.md @@ -0,0 +1,89 @@ +# Architecture + +## Overview + +![overview](../../../docs/assets/architecture.png) + +``` +title: Architecture +CLI->Engine: file*s* +Engine->Core: file +Core->Kernel: text +Kernel->Kernel: Linting text +Kernel-->Core: Message +Core-->Engine: Results +Engine-->CLI: output +``` + +- CLI know Engine +- Engine know Core +- Core know [kernel](https://github.com/textlint/textlint/tree/master/packages/@textlint/kernel/) + +textlint apply [Separation of Concern](http://weblogs.asp.net/arturtrosin/separation-of-concern-vs-single-responsibility-principle-soc-vs-srp "Separation of Concern"). + +## CLI + +- [options.ts](./options.ts) + - Parse cli options +- [cli.ts](./cli.ts) + - create config + - run engine + - output result + +### Concern + +- Parse command line options +- Run Engine +- Receive results +- output to stdout/stderr + +## Engine + +Process file**s** are wanted to lint/fix and prepare configuration of rules and plugins. +After all, return a **array** of `TextLintResult` or `TextLintFixResult` + +- engine/ directory +- textlint-engine.js +- rule-manager.js +- textlint-module-resolver.js + +These are shared between config and engine. +Don't shared between engine and core. + +### Concern + +- Prepare rules from config +- Pass rules and configs to Core +- Could handle multiple files + +## Core + +Process file/text wanted to lint/fix. +After all, return a `TextLintResult` or `TextLintFixResult` + + +- `core/` directory +- textlint-core.js +- source-code.js +- rule-creator-set.js +- task/ +- linter/ +- fixer/ + +To be clear about difference of linter and fixer. + +- *Linter* process in parallel. +- *Fixer* process in series. + +### Concern + +- Handle AST of the text +- Do linting to the AST +- Create fixable messages from the result +- Could handle a single files + +## Terms + +- Ignore: a rule request to **ignore** range +- Filter: textlint filter requested range that is reported by rule + - a rule can't filter. diff --git a/node_modules/textlint/src/cli.ts b/node_modules/textlint/src/cli.ts new file mode 100644 index 000000000..644e2e23e --- /dev/null +++ b/node_modules/textlint/src/cli.ts @@ -0,0 +1,230 @@ +// LICENSE : MIT +"use strict"; +import { TextlintFixResult } from "@textlint/kernel"; +import { throwWithoutExperimental } from "@textlint/feature-flag"; + +const fs = require("fs"); +const path = require("path"); +const debug = require("debug")("textlint:cli"); +const mkdirp = require("mkdirp"); +import { options } from "./options"; +import { TextLintEngine } from "./textlint-engine"; +import { TextFixEngine } from "./textfix-engine"; +import { Config } from "./config/config"; +import { createConfigFile } from "./config/config-initializer"; +import { TextLintFixer } from "./fixer/textlint-fixer"; +import { Logger } from "./util/logger"; +import { lintParallel } from "./parallel/lint-worker-master"; + +/* + cli.js is command line **interface** + + processing role is cli-engine.js. + @see cli-engine.js + */ + +const showEmptyRuleWarning = () => { + Logger.log(` +== No rules found, textlint hasn’t done anything == + +Possible reasons: +* Your textlint config file has no rules. +* You have no config file and you aren’t passing rules via command line. +* Your textlint config has a syntax error. + +=> How to set up rules? +https://github.com/textlint/textlint/blob/master/docs/configuring.md +`); +}; + +/** + * Print results of lining text. + * @param {string} output the output text which is formatted by {@link TextLintEngine.formatResults} + * @param {object} options cli option object {@lint ./options.js} + * @returns {boolean} does print result success? + */ +function printResults(output: string, options: any): boolean { + if (!output) { + return true; + } + const outputFile = options.outputFile; + if (outputFile) { + const filePath = path.resolve(process.cwd(), outputFile); + if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) { + Logger.error("Cannot write to output file path, it is a directory: %s", outputFile); + return false; + } + try { + mkdirp.sync(path.dirname(filePath)); + fs.writeFileSync(filePath, output); + } catch (ex) { + Logger.error("There was a problem writing the output file:\n%s", ex); + return false; + } + } else { + Logger.log(output); + } + return true; +} + +/** + * Encapsulates all CLI behavior for eslint. Makes it easier to test as well as + * for other Node.js programs to effectively run the CLI. + */ +export const cli = { + /** + * Executes the CLI based on an array of arguments that is passed in. + * @param {string|Array|Object} args The arguments to process. + * @param {string} [text] The text to lint (used for TTY). + * @returns {Promise} The exit code for the operation. + */ + execute(args: string | Array | object, text?: string): Promise { + let currentOptions; + // version from package.json + const pkgConf = require("read-pkg-up"); + const version = pkgConf.sync({ cwd: __dirname }).pkg.version; + try { + currentOptions = options.parse(args); + } catch (error) { + Logger.error(error.message); + return Promise.resolve(1); + } + const files = currentOptions._; + if (currentOptions.version) { + Logger.log(`v${version}`); + } else if (currentOptions.init) { + return createConfigFile({ + dir: process.cwd(), + verbose: !currentOptions.quiet + }); + } else if (currentOptions.help || (!files.length && !text)) { + Logger.log(options.generateHelp()); + } else { + // specify file name of stdin content + const stdinFilename = currentOptions.stdinFilename; + debug(`textlint --version: ${version}`); + debug(`Running on ${text ? "text" : "files"}, stdin-filename: ${stdinFilename}`); + if (currentOptions.parallel) { + debug("textlint --parallel"); + throwWithoutExperimental( + "--parallel is experimental feature. It should be used with --experimental flag" + ); + return this.executeWithParallel(currentOptions, files); + } + return this.executeWithOptions(currentOptions, files, text, stdinFilename); + } + return Promise.resolve(0); + }, + + /** + * execute with cli options + * @param {object} cliOptions + * @param {string[]} files files are file path list + * @returns {Promise} exit status + */ + executeWithParallel(cliOptions: any, files: string[]): Promise { + const config = Config.initWithCLIOptions(cliOptions); + if (cliOptions.fix) { + // --fix + const fixEngine = new TextFixEngine(config); + if (!fixEngine.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + const resultsPromise = lintParallel(files, { + type: "fix", + config: config, + concurrency: cliOptions.maxConcurrency + }); + return resultsPromise.then((results) => { + debug("fix results: %j", results); + const fixer = new TextLintFixer(); + const output = fixEngine.formatResults(results); + printResults(output, cliOptions); + // --dry-run + if (cliOptions.dryRun) { + debug("Enable dry-run mode"); + return Promise.resolve(0); + } + // modify file and return exit status + return fixer.write(results as TextlintFixResult[]).then(() => { + return 0; + }); + }); + } + // lint as default + const lintEngine = new TextLintEngine(config); + if (!lintEngine.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + const resultsPromise = lintParallel(files, { + type: "lint", + config: config, + concurrency: cliOptions.maxConcurrency + }); + return resultsPromise.then((results) => { + debug("lint results: %j", results); + const output = lintEngine.formatResults(results); + if (printResults(output, cliOptions)) { + return lintEngine.isErrorResults(results) ? 1 : 0; + } else { + return 1; + } + }); + }, + + /** + * execute with cli options + * @param {object} cliOptions + * @param {string[]} files files are file path list + * @param {string} [text] + * @param {string} [stdinFilename] + * @returns {Promise} exit status + */ + executeWithOptions(cliOptions: any, files: string[], text?: string, stdinFilename?: string): Promise { + const config = Config.initWithCLIOptions(cliOptions); + if (cliOptions.fix) { + // --fix + const fixEngine = new TextFixEngine(config); + if (!fixEngine.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + const resultsPromise = text + ? fixEngine.executeOnText(text, stdinFilename) + : fixEngine.executeOnFiles(files); + return resultsPromise.then((results) => { + debug("fix results: %j", results); + const fixer = new TextLintFixer(); + const output = fixEngine.formatResults(results); + printResults(output, cliOptions); + // --dry-run + if (cliOptions.dryRun) { + debug("Enable dry-run mode"); + return Promise.resolve(0); + } + // modify file and return exit status + return fixer.write(results as TextlintFixResult[]).then(() => { + return 0; + }); + }); + } + // lint as default + const lintEngine = new TextLintEngine(config); + if (!lintEngine.hasRuleAtLeastOne()) { + showEmptyRuleWarning(); + return Promise.resolve(1); + } + const resultsPromise = text ? lintEngine.executeOnText(text, stdinFilename) : lintEngine.executeOnFiles(files); + return resultsPromise.then((results) => { + debug("lint results: %j", results); + const output = lintEngine.formatResults(results); + if (printResults(output, cliOptions)) { + return lintEngine.isErrorResults(results) ? 1 : 0; + } else { + return 1; + } + }); + } +}; diff --git a/node_modules/textlint/src/config/config-initializer.ts b/node_modules/textlint/src/config/config-initializer.ts new file mode 100644 index 000000000..37e5cd979 --- /dev/null +++ b/node_modules/textlint/src/config/config-initializer.ts @@ -0,0 +1,99 @@ +// LICENSE : MIT +"use strict"; +import { TextlintPackageNamePrefix } from "@textlint/utils"; + +const fs = require("fs"); +const path = require("path"); +const isFile = require("is-file"); +const readPkg = require("read-pkg"); +import { Config } from "./config"; +import { Logger } from "../util/logger"; + +/** + * read package.json if found it + * @param {string} dir + * @returns {Promise.>} + */ +const getTextlintDependencyNames = (dir: string): Promise> => { + return readPkg(dir) + .then((pkg: any) => { + const dependencies = pkg.dependencies || {}; + const devDependencies = pkg.devDependencies || {}; + const mergedDependencies = Object.assign({}, dependencies, devDependencies); + const pkgNames = Object.keys(mergedDependencies); + return pkgNames.filter((pkgName) => { + const ruleOrFilter = + pkgName.indexOf(TextlintPackageNamePrefix.filterRule) !== -1 || + pkgName.indexOf(TextlintPackageNamePrefix.rule) !== -1; + if (pkgName === "textlint-rule-helper") { + return false; + } + return ruleOrFilter; + }); + }) + .catch(() => { + return []; + }); +}; + +/** + * create object that fill with `defaultValue` + * @param {Array} array + * @param {*} defaultValue + * @returns {Object} + */ +const arrayToObject = (array: Array, defaultValue: any): object => { + const object: { [index: string]: string } = {}; + array.forEach((item) => { + object[item] = defaultValue; + }); + return object; +}; + +export interface CreateConfigFileOption { + // create .textlint in the `dir` + dir: string; + // display log message if it is `true` + verbose: boolean; +} + +/** + * Create .textlintrc file + * @params {string} dir The directory of .textlintrc file + * @returns {Promise.} The exit code for the operation. + */ +export const createConfigFile = (options: CreateConfigFileOption) => { + const dir = options.dir; + return getTextlintDependencyNames(dir).then((pkgNames) => { + const rcFile = `.${Config.CONFIG_FILE_NAME}rc`; + const filePath = path.resolve(dir, rcFile); + if (isFile(filePath)) { + Logger.error(`${rcFile} is already existed.`); + return Promise.resolve(1); + } + const filters = pkgNames + .filter((pkgName) => { + return pkgName.indexOf(TextlintPackageNamePrefix.filterRule) !== -1; + }) + .map((filterName) => { + return filterName.replace(TextlintPackageNamePrefix.filterRule, ""); + }); + const rules = pkgNames + .filter((pkgName) => { + return pkgName.indexOf(TextlintPackageNamePrefix.rule) !== -1; + }) + .map((filterName) => { + return filterName.replace(TextlintPackageNamePrefix.rule, ""); + }); + const defaultTextlintRc = { + filters: arrayToObject(filters, true), + rules: arrayToObject(rules, true) + }; + const output = JSON.stringify(defaultTextlintRc, null, 2); + fs.writeFileSync(filePath, output); + if (options.verbose) { + Logger.log(`${rcFile} is created.`); + } + return Promise.resolve(0); + }); +}; diff --git a/node_modules/textlint/src/config/config-loader.ts b/node_modules/textlint/src/config/config-loader.ts new file mode 100644 index 000000000..3af9696c6 --- /dev/null +++ b/node_modules/textlint/src/config/config-loader.ts @@ -0,0 +1,57 @@ +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +import { moduleInterop } from "@textlint/module-interop"; + +import { rcFile } from "rc-config-loader"; + +/** + * @param configFileName "textlint" for .textlinrc + * @param cwd current working dir + * @param configFilePath it is preferred than configFileName + * @param moduleResolver + */ +export function loadConfig({ + cwd, + configFileName, + configFilePath, + moduleResolver +}: { + cwd?: string; + configFileName: string; + configFilePath?: string; + moduleResolver: TextLintModuleResolver; +}): { + config: { [index: string]: any }; + filePath: string | undefined; +} { + // if specify Config module, use it + if (configFilePath) { + try { + const modulePath = moduleResolver.resolveConfigPackageName(configFilePath); + return { + config: moduleInterop(require(modulePath)), + filePath: modulePath + }; + } catch (error) { + // not found config module + } + } + // auto or specify path to config file + const result = rcFile(configFileName, { + configFileName: configFilePath, + defaultExtension: [".json", ".js", ".yml"], + packageJSON: { + fieldName: "textlint" + }, + cwd + }); + if (result === undefined) { + return { + config: {}, + filePath: undefined + }; + } + return { + config: result.config, + filePath: result.filePath + }; +} diff --git a/node_modules/textlint/src/config/config-util.ts b/node_modules/textlint/src/config/config-util.ts new file mode 100644 index 000000000..57730c060 --- /dev/null +++ b/node_modules/textlint/src/config/config-util.ts @@ -0,0 +1,29 @@ +// LICENSE : MIT +"use strict"; + +export function isPluginRuleKey(key: string) { + // @/<>rule> + if (key[0] === "@" && key.indexOf("/textlint-plugin") !== -1) { + return true; + } + // not contain @, but contain / + // / + return key[0] !== "@" && key.indexOf("/") !== -1; +} + +export function isPresetRuleKey(key: string) { + // "preset-name" is special pattern + if (/^preset-/.test(key)) { + return true; + } + if (/^textlint-rule-preset-/.test(key)) { + return true; + } + // scoped module: @textlint/textlint-rule-preset-foo + if (key[0] === "@") { + if (key.indexOf("/preset-") !== -1 || key.indexOf("/textlint-rule-preset-") !== -1) { + return true; + } + } + return false; +} diff --git a/node_modules/textlint/src/config/config.ts b/node_modules/textlint/src/config/config.ts new file mode 100644 index 000000000..4fde87f38 --- /dev/null +++ b/node_modules/textlint/src/config/config.ts @@ -0,0 +1,460 @@ +// LICENSE : MIT +"use strict"; +import crypto from "crypto"; +import { loadConfig } from "./config-loader"; +import { createFlatRulesConfigFromRawRulesConfig, loadRulesConfigFromPresets } from "./preset-loader"; +import { getPluginConfig, getPluginNames } from "./plugin-loader"; +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +import { separateEnabledOrDisabled } from "./separate-by-config-option"; +import { + normalizeTextlintFilterRuleKey, + normalizeTextlintPluginKey, + normalizeTextlintRuleKey, + normalizeTextlintRulePresetKey +} from "@textlint/utils"; +import { Logger } from "../util/logger"; + +const md5 = require("md5"); +const fs = require("fs"); +const assert = require("assert"); +const concat = require("unique-concat"); +const path = require("path"); +const pkgConf = require("read-pkg-up"); + +function applyNormalizerToList(normalizer: (name: string) => string, names: string[]) { + return names.map((name) => { + return normalizer(name); + }); +} + +function applyNormalizerToConfig(normalizer: (name: string) => string, config: { [index: string]: string }) { + return Object.keys(config).reduce((results, key) => { + const shortPluginName = normalizer(key); + results[shortPluginName] = config[key]; + return results; + }, {} as { [index: string]: any }); +} + +/** + * @type {TextlintConfig} + */ +const defaultOptions = Object.freeze({ + // rule package names + rules: [], + // disabled rule package names + // always should start with empty + disabledRules: [], + // rules config object + rulesConfig: {}, + // filter rule package names + filterRules: [], + disabledFilterRules: [], + // rules config object + filterRulesConfig: {}, + // preset package names + // e.g.) ["preset-foo"] + presets: [], + // plugin package names + plugins: [], + // plugin config + pluginsConfig: {}, + // base directory for loading {rule, config, plugin} modules + rulesBaseDirectory: undefined, + // ".textlint" file path + configFile: undefined, + // rule directories + rulePaths: [], + // formatter file name + // e.g.) stylish.js => set "stylish" + // NOTE: default formatter is defined in Engine, + // because There is difference between TextLintEngine and TextFixEngine. + formatterName: undefined, + // --quiet + quiet: false, + // --no-color + color: true, + // --no-textlintrc + textlintrc: true, + // --cache : enable or disable + cache: false, + // --cache-location: cache file path + cacheLocation: path.resolve(process.cwd(), ".textlintcache"), + // --ignore-path: ".textlintignore" file path + ignoreFile: path.resolve(process.cwd(), ".textlintignore") +}); + +export interface ConfigStatics { + CONFIG_PACKAGE_PREFIX: string; + FILTER_RULE_NAME_PREFIX: string; + RULE_NAME_PREFIX: string; + RULE_PRESET_NAME_PREFIX: string; + PLUGIN_NAME_PREFIX: string; +} + +export interface ConfigAutoLoadingOptions { + // rule package names + rules?: string[]; + // disabled rule package names + // always should start with empty + disabledRules?: string[]; + // rules config object + rulesConfig?: { [index: string]: boolean | {} }; + filterRules?: string[]; + disabledFilterRules?: string[]; + filterRulesConfig?: { [index: string]: boolean | {} }; + // preset package names + // e.g.) ["preset-foo"] + presets?: string[]; + // plugin package names + plugins?: string[]; + // plugin config + pluginsConfig?: { [index: string]: boolean | {} }; + // base directory for loading {rule, config, plugin} modules + rulesBaseDirectory?: string; + // ".textlint" file path + configFile?: string; + // rule directories + rulePaths?: string[]; + // formatter file name + // e.g.) stylish.js => set "stylish" + // NOTE: default formatter is defined in Engine, + // because There is difference between TextLintEngine and TextFixEngine. + formatterName?: string; + // --quiet + quiet?: boolean; + // --no-color + color?: boolean; + // --no-textlintrc + textlintrc?: boolean; + // --cache : enable or disable + cache?: boolean; + // --cache-location: cache file path + cacheLocation?: string; + // FIXME: current working dir + // It does not cover all working dir + cwd?: string; + // ".textlintignore" file path + ignoreFile?: string | undefined; +} + +// Priority: CLI > Code options > config file +export class Config { + rules: any; + rulesBaseDirectory: string | undefined; + configFile: string | undefined; + disabledRules: string[]; + filterRules: string[]; + disabledFilterRules: string[]; + presets: string[]; + plugins: string[]; + pluginsConfig: { [index: string]: any }; + rulesConfig: { [index: string]: any }; + filterRulesConfig: { [index: string]: any }; + rulePaths: string[]; + formatterName: string | undefined; + quiet: boolean; + color: boolean; + cache: boolean; + cacheLocation: string; + ignoreFile: string | undefined; + + /** + * @return {string} rc config filename + * it's name use as `.rc` + */ + static get CONFIG_FILE_NAME() { + return "textlint"; + } + + /** + * Create config object form command line options + * See options.js + * @param {object} cliOptions the options is command line option object. @see options.js + * @returns {Config} + */ + static initWithCLIOptions(cliOptions: any) { + const options: { [index: string]: any } = {}; + options.rules = cliOptions.rule ? cliOptions.rule : defaultOptions.rules; + // TODO: CLI --filter ? + options.filterRules = defaultOptions.filterRules; + options.disabledFilterRules = defaultOptions.disabledFilterRules; + // TODO: CLI --disable ? + options.disabledRules = defaultOptions.disabledRules; + options.presets = cliOptions.preset ? cliOptions.preset : defaultOptions.presets; + options.plugins = cliOptions.plugin ? cliOptions.plugin : defaultOptions.plugins; + options.configFile = cliOptions.config ? cliOptions.config : defaultOptions.configFile; + options.rulePaths = cliOptions.rulesdir ? cliOptions.rulesdir : defaultOptions.rulePaths; + options.formatterName = cliOptions.format ? cliOptions.format : defaultOptions.formatterName; + options.quiet = cliOptions.quiet !== undefined ? cliOptions.quiet : defaultOptions.quiet; + options.color = cliOptions.color !== undefined ? cliOptions.color : defaultOptions.color; + // --no-textlintrc: disable textlint + options.textlintrc = cliOptions.textlintrc !== undefined ? cliOptions.textlintrc : defaultOptions.textlintrc; + // --cache + options.cache = cliOptions.cache !== undefined ? cliOptions.cache : defaultOptions.cache; + // --cache-location="path/to/file" + options.cacheLocation = + cliOptions.cacheLocation !== undefined + ? path.resolve(process.cwd(), cliOptions.cacheLocation) + : defaultOptions.cacheLocation; + // --rules-base-directory "other/node_modules" + options.rulesBaseDirectory = cliOptions.rulesBaseDirectory || defaultOptions.rulesBaseDirectory; + // --ignore-path="path/to/file" + options.ignoreFile = + cliOptions.ignorePath !== undefined + ? path.resolve(process.cwd(), cliOptions.ignorePath) + : defaultOptions.ignoreFile; + return this.initWithAutoLoading(options); + } + + /* eslint-disable complexity */ + /** + * load config and merge options. + * These config is user defined options. + * These config is prefer than preset packages's config that is defined by package author. + * @param options + */ + static initWithAutoLoading(options: ConfigAutoLoadingOptions = {}) { + // Base directory + const rulesBaseDirectory = options.rulesBaseDirectory + ? options.rulesBaseDirectory + : defaultOptions.rulesBaseDirectory; + // Create resolver + const moduleResolver = new TextLintModuleResolver({ + rulesBaseDirectory + }); + // => ConfigFile + // configFile is optional + // => load .textlintrc + const loadedResult = + typeof options.textlintrc === "undefined" || options.textlintrc + ? loadConfig({ + configFileName: this.CONFIG_FILE_NAME, + configFilePath: options.configFile, + moduleResolver, + cwd: options.cwd + }) + : { + config: {}, + filePath: undefined + }; + const configFileRaw = loadedResult.config; + const configFilePath = loadedResult.filePath; + // => Load options from .textlintrc + const configRuleNamesObject = separateEnabledOrDisabled(configFileRaw.rules); + const configFilterRuleNamesObject = separateEnabledOrDisabled(configFileRaw.filters); + const configPresetNames = configRuleNamesObject.presetNames; + const configFilePlugins = getPluginNames(configFileRaw); + const configFilePluginConfig = getPluginConfig(configFileRaw); + // Notes: vs. loadRulesConfigFromPresets + // loadRulesConfigFromPresets load rules config from **preset package**. (It is not user defined config. It is defined by package author) + // In other hands, this line load rules config from .textlintrc. (It is user defined config) + const configFileRulesConfig = createFlatRulesConfigFromRawRulesConfig(configFileRaw.rules); + const configFileFilterRulesConfig = createFlatRulesConfigFromRawRulesConfig(configFileRaw.filters); + // => User specified Options + const optionRules = options.rules || []; + const optionFilterRules = options.filterRules || []; + const optionDisabledRules = options.disabledRules || []; + const optionDisabledFilterRules = options.disabledFilterRules || []; + const optionRulesConfig = options.rulesConfig || {}; + const optionFilterRulesConfig = options.filterRulesConfig || {}; + const optionPlugins = options.plugins || []; + const optionPresets = options.presets || []; + const optionPluginsConfig = options.pluginsConfig || {}; + // => Merge options and configFileOptions + // Priority options > configFile + const rules = concat(optionRules, configRuleNamesObject.enabledRuleNames); + const disabledRules = concat(optionDisabledRules, configRuleNamesObject.disabledRuleNames); + const filterRules = concat(optionFilterRules, configFilterRuleNamesObject.enabledRuleNames); + const disabledFilterRules = concat(optionDisabledFilterRules, configFilterRuleNamesObject.disabledRuleNames); + const rulesConfig = Object.assign({}, configFileRulesConfig, optionRulesConfig); + const filterRulesConfig = Object.assign({}, configFileFilterRulesConfig, optionFilterRulesConfig); + const plugins = concat(optionPlugins, configFilePlugins); + const pluginsConfig = Object.assign({}, configFilePluginConfig, optionPluginsConfig); + const presets = concat(optionPresets, configPresetNames); + const mergedOptions = Object.assign({}, options, { + rules, + disabledRules, + rulesConfig, + filterRules, + disabledFilterRules, + filterRulesConfig, + plugins, + pluginsConfig, + presets, + configFile: configFilePath + }); + return new this(mergedOptions); + } + + /** + * Return hash string of the config and textlint version + * @returns {string} + */ + get hash() { + try { + const version = pkgConf.sync({ cwd: __dirname }).pkg.version; + const toString = JSON.stringify(this.toJSON()); + return md5(`${version}-${toString}`); + } catch (error) { + // Fallback for some env + // https://github.com/textlint/textlint/issues/597 + Logger.warn("Use random value as hash because calculating hash value throw error", error); + return crypto.randomBytes(20).toString("hex"); + } + } + + /** + * initialize with options. + * @param {TextlintConfig} options the option object is defined as TextlintConfig. + * @returns {Config} + * @constructor + */ + constructor(options: Partial = {}) { + /** + * @type {string|undefined} absolute path to .textlintrc file. + * - If using .textlintrc, return path to .textlintrc + * - If using npm config module, return path to main file of the module + * - If not using config file, return undefined + */ + this.configFile = options.configFile; + if (this.configFile) { + assert.ok(path.isAbsolute(this.configFile), `configFile should be absolute path: ${this.configFile}`); + } + this.rulesBaseDirectory = options.rulesBaseDirectory + ? options.rulesBaseDirectory + : defaultOptions.rulesBaseDirectory; + // rule names that are defined in ,textlintrc + const moduleResolver = new TextLintModuleResolver({ + rulesBaseDirectory: this.rulesBaseDirectory + }); + /** + * @type {string[]} rule key list + * These rule is set `false` to options + */ + this.disabledRules = applyNormalizerToList( + normalizeTextlintRuleKey, + options.disabledRules ? options.disabledRules : defaultOptions.disabledRules + ); + /** + * @type {string[]} rule key list + * rules does not includes disabledRules + */ + this.rules = applyNormalizerToList( + normalizeTextlintRuleKey, + options.rules ? options.rules : defaultOptions.rules + ).filter((ruleName) => { + return !this.disabledRules.includes(ruleName); + }); + + /** + * @type {string[]} rule key list + * These rule is set `false` to options + */ + this.disabledFilterRules = applyNormalizerToList( + normalizeTextlintFilterRuleKey, + options.disabledFilterRules ? options.disabledFilterRules : defaultOptions.disabledFilterRules + ); + + /** + * @type {string[]} filter rule key list + */ + this.filterRules = applyNormalizerToList( + normalizeTextlintFilterRuleKey, + options.filterRules ? options.filterRules : defaultOptions.filterRules + ).filter((ruleName) => { + return !this.disabledFilterRules.includes(ruleName); + }); + /** + * @type {string[]} preset key list + */ + this.presets = applyNormalizerToList( + normalizeTextlintRulePresetKey, + options.presets ? options.presets : defaultOptions.presets + ); + // => load plugins + // this.rules has not contain plugin rules + // ===================== + this.plugins = applyNormalizerToList( + normalizeTextlintPluginKey, + options.plugins ? options.plugins : defaultOptions.plugins + ); + this.pluginsConfig = applyNormalizerToConfig( + normalizeTextlintPluginKey, + options.pluginsConfig ? options.pluginsConfig : defaultOptions.pluginsConfig + ); + // rulesConfig + // load preset package's config and merge it to user defined rules config + // user config > default preset config + const presetRulesConfig = loadRulesConfigFromPresets(this.presets, moduleResolver); + this.rulesConfig = applyNormalizerToConfig( + normalizeTextlintRuleKey, + Object.assign({}, presetRulesConfig, options.rulesConfig) + ); + // filterRulesConfig + this.filterRulesConfig = applyNormalizerToConfig( + normalizeTextlintFilterRuleKey, + options.filterRulesConfig || defaultOptions.filterRulesConfig + ); + /** + * @type {string[]} + */ + this.rulePaths = options.rulePaths ? options.rulePaths : defaultOptions.rulePaths; + /** + * @type {string} + */ + this.formatterName = options.formatterName ? options.formatterName : defaultOptions.formatterName; + /** + * @type {boolean} + */ + this.quiet = options.quiet !== undefined ? options.quiet : defaultOptions.quiet; + /** + * @type {boolean} + */ + this.color = options.color !== undefined ? options.color : defaultOptions.color; + /** + * @type {boolean} + */ + this.cache = options.cache !== undefined ? options.cache : defaultOptions.cache; + /** + * @type {string} + */ + this.cacheLocation = options.cacheLocation !== undefined ? options.cacheLocation : defaultOptions.cacheLocation; + this._assertCacheLocation(this.cacheLocation); + /** + * @type {string} + */ + this.ignoreFile = options.ignoreFile !== undefined ? options.ignoreFile : defaultOptions.ignoreFile; + } + + private _assertCacheLocation(locationPath: string) { + let fileStats; + try { + fileStats = fs.lstatSync(locationPath); + } catch (ex) { + fileStats = null; + } + if (!fileStats) { + return; + } + // TODO: --cache-location does not support directory + // We should defined what is default name. + assert.ok(!fileStats.isDirectory(), "--cache-location doesn't support directory"); + } + + /* eslint-enable complexity */ + + toJSON() { + const r = Object.create(null); + Object.keys(this).forEach((key) => { + if (!this.hasOwnProperty(key)) { + return; + } + const value = (this as any)[key]; + if (value == null) { + return; + } + r[key] = typeof value.toJSON !== "undefined" ? value.toJSON() : value; + }); + return r; + } +} diff --git a/node_modules/textlint/src/config/package-prefix.ts b/node_modules/textlint/src/config/package-prefix.ts new file mode 100644 index 000000000..80d1e890d --- /dev/null +++ b/node_modules/textlint/src/config/package-prefix.ts @@ -0,0 +1,13 @@ +/** + * Package name prefix list + * It is used for shortcut name. + * + * For example, textlint plugin package start with textlint-plugin prefix. + */ +export const PackageNamePrefix = { + config: "textlint-config-", + rule: "textlint-rule-", + filterRule: "textlint-filter-rule-", + rulePreset: "textlint-rule-preset-", + plugin: "textlint-plugin-" +}; diff --git a/node_modules/textlint/src/config/plugin-loader.ts b/node_modules/textlint/src/config/plugin-loader.ts new file mode 100644 index 000000000..9b25805a9 --- /dev/null +++ b/node_modules/textlint/src/config/plugin-loader.ts @@ -0,0 +1,94 @@ +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +import { moduleInterop } from "@textlint/module-interop"; +const debug = require("debug")("textlint:plugin-loader"); +const assert = require("assert"); + +/** + * get plugin names from `configFileRaw` object + * @param configFileRaw + * @returns {Array} + */ +export function getPluginNames(configFileRaw: { plugins?: any }) { + const plugins = configFileRaw.plugins; + if (!plugins) { + return []; + } + if (Array.isArray(plugins)) { + return plugins; + } + return Object.keys(plugins); +} + +/** + * get pluginConfig object from `configFileRaw` that is loaded .textlintrc + * @param {Object} configFileRaw + * @returns {Object} + * @example + * ```js + * "plugins": { + * "pluginA": {}, + * "pluginB": {} + * } + * ``` + * + * to + * + * ```js + * { + * "pluginA": {}, + * "pluginB": {} + * } + * ``` + * + * + * + * ```js + * "plugins": ["pluginA", "pluginB"] + * ``` + * + * to + * + * ``` + * // `true` means turn on + * { + * "pluginA": true, + * "pluginB": true + * } + * ``` + */ +export function getPluginConfig(configFileRaw: { [index: string]: any }): { [index: string]: any } { + const plugins = configFileRaw.plugins; + if (!plugins) { + return {}; + } + if (Array.isArray(plugins)) { + if (plugins.length === 0) { + return {}; + } + // { "pluginA": true, "pluginB": true } + return plugins.reduce((results, pluginName) => { + results[pluginName] = true; + return results; + }, {}); + } + return plugins; +} + +export function loadAvailableExtensions(pluginNames: string[] = [], moduleResolver: TextLintModuleResolver) { + const availableExtensions: string[] = []; + pluginNames.forEach((pluginName) => { + const pkgPath = moduleResolver.resolvePluginPackageName(pluginName); + const plugin = moduleInterop(require(pkgPath)); + if (!plugin.hasOwnProperty("Processor")) { + return; + } + const Processor = plugin.Processor; + debug(`${pluginName} has Processor`); + assert.ok( + typeof Processor.availableExtensions === "function", + "Processor.availableExtensions() should be implemented" + ); + availableExtensions.push(...Processor.availableExtensions()); + }); + return availableExtensions; +} diff --git a/node_modules/textlint/src/config/preset-loader.ts b/node_modules/textlint/src/config/preset-loader.ts new file mode 100644 index 000000000..5a8f5a1fc --- /dev/null +++ b/node_modules/textlint/src/config/preset-loader.ts @@ -0,0 +1,95 @@ +// LICENSE : MIT +"use strict"; +import { moduleInterop } from "@textlint/module-interop"; +import { TextLintModuleResolver } from "../engine/textlint-module-resolver"; +import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils"; +import { isPresetRuleKey } from "./config-util"; + +/** + * Convert config of preset to rawRulesConfig flat path format. + * + * This function convert Preset nesting rule to flat path + * ``` + * { + * "x" : true + * "preset-a" : { "rule-name": "value" } + * } + * ``` + * => + * ``` + * { "x": true } + * { "a/rule-name": "value" } + * ``` + * + * @param rawRulesConfig + * @returns {{string: string}} + */ +export function createFlatRulesConfigFromRawRulesConfig(rawRulesConfig: any) { + if (!rawRulesConfig) { + return {}; + } + const rulesConfig: { [index: string]: any } = {}; + Object.keys(rawRulesConfig).forEach((key) => { + if (isPresetRuleKey(key)) { + // / + const presetName = key; + const presetRuleConfig = rawRulesConfig[key]; + Object.assign( + rulesConfig, + createFlatPresetRulesConfigFromRawPresetRuleConfig(presetRuleConfig, presetName) + ); + return; + } + rulesConfig[key] = rawRulesConfig[key]; + }); + return rulesConfig; +} + +/** + * create flat `/` option + * @param {Object} [rulesConfig] + * @param {string} presetName + * @returns {Object} + */ +export function createFlatPresetRulesConfigFromRawPresetRuleConfig( + rulesConfig: { [index: string]: string }, + presetName: string +): object { + const mapped: { [index: string]: string } = {}; + // missing "rulesConfig" + if (rulesConfig === undefined || typeof rulesConfig !== "object") { + return mapped; + } + Object.keys(rulesConfig).forEach((ruleName) => { + const normalizedKey = normalizeTextlintPresetSubRuleKey({ preset: presetName, rule: ruleName }); + mapped[normalizedKey] = rulesConfig[ruleName]; + }); + return mapped; +} + +// load rulesConfig from plugins +/** + * + * @param presetNames + * @param {TextLintModuleResolver} moduleResolver + * @returns {{}} + */ +export function loadRulesConfigFromPresets(presetNames: string[] = [], moduleResolver: TextLintModuleResolver): {} { + const presetRulesConfig = {}; + presetNames.forEach((presetName) => { + const pkgPath = moduleResolver.resolvePresetPackageName(presetName); + const preset = moduleInterop(require(pkgPath)); + if (!preset.hasOwnProperty("rules")) { + throw new Error(`${presetName} has not rules`); + } + if (!preset.hasOwnProperty("rulesConfig")) { + throw new Error(`${presetName} has not rulesConfig`); + } + // set config of to "/" + Object.assign( + presetRulesConfig, + createFlatPresetRulesConfigFromRawPresetRuleConfig(preset.rulesConfig, presetName) + ); + }); + return presetRulesConfig; +} diff --git a/node_modules/textlint/src/config/separate-by-config-option.ts b/node_modules/textlint/src/config/separate-by-config-option.ts new file mode 100644 index 000000000..7da076f75 --- /dev/null +++ b/node_modules/textlint/src/config/separate-by-config-option.ts @@ -0,0 +1,43 @@ +// LICENSE : MIT +"use strict"; +import { isPluginRuleKey, isPresetRuleKey } from "./config-util"; +export interface RuleOf { + presetNames: string[]; + enabledRuleNames: string[]; + disabledRuleNames: string[]; +} +/** + * Get rule keys from `.textlintrc` config object. + * @param {Object} [rulesConfig] + * @returns {{available: string[], disabledRuleNames: string[]}} + */ +export function separateEnabledOrDisabled(rulesConfig: any): RuleOf { + const ruleOf: RuleOf = { + presetNames: [], + enabledRuleNames: [], + disabledRuleNames: [] + }; + if (!rulesConfig) { + return ruleOf; + } + Object.keys(rulesConfig).forEach((key) => { + // `/` should ignored + if (isPluginRuleKey(key)) { + return; + } + // `textlint-rule-preset-XXX` + if (isPresetRuleKey(key)) { + if (typeof rulesConfig[key] === "object" || rulesConfig[key] === true) { + ruleOf.presetNames.push(key); + } + return; + } + // ignore `false` value + if (typeof rulesConfig[key] === "object" || rulesConfig[key] === true) { + ruleOf.enabledRuleNames.push(key); + } else { + ruleOf.disabledRuleNames.push(key); + } + }); + return ruleOf; +} diff --git a/node_modules/textlint/src/engine/execute-file-backer-manager.ts b/node_modules/textlint/src/engine/execute-file-backer-manager.ts new file mode 100644 index 000000000..c36e8718d --- /dev/null +++ b/node_modules/textlint/src/engine/execute-file-backer-manager.ts @@ -0,0 +1,75 @@ +import { AbstractBacker } from "./execute-file-backers/abstruct-backer"; +import { TextlintResult } from "@textlint/kernel"; + +export class ExecuteFileBackerManager { + _backers: AbstractBacker[]; + + /** + * create MessageProcessManager with backers + * @param {AbstractBacker[]} backers + */ + constructor(backers: AbstractBacker[] = []) { + this._backers = backers; + } + + /** + * @param {AbstractBacker} backer + */ + add(backer: AbstractBacker) { + this._backers.push(backer); + } + + /** + * @param {AbstractBacker} backer + */ + remove(backer: AbstractBacker) { + const index = this._backers.indexOf(backer); + if (index !== -1) { + this._backers.splice(index, 1); + } + } + + /** + * process `messages` with registered processes + */ + process(files: string[], executeFile: (filePath: string) => Promise): Promise { + const unExecutedResults: Array> = []; + const resultPromises = files + .filter((filePath) => { + const shouldExecute = this._backers.every((backer) => { + return backer.shouldExecute({ filePath }); + }); + // add fake unExecutedResults for un-executed file. + if (!shouldExecute) { + unExecutedResults.push(this._createFakeResult(filePath)); + } + return shouldExecute; + }) + .map((filePath) => { + return executeFile(filePath).then((result) => { + this._backers.forEach((backer) => { + backer.didExecute({ result }); + }); + return result; + }); + }) + .concat(unExecutedResults); + // wait all resolved, and call afterAll + return Promise.all(resultPromises).then((results: TextlintResult[]) => { + this._backers.forEach((backer) => { + backer.afterAll(); + }); + return results; + }); + } + + /** + * create fake result object + */ + private _createFakeResult(filePath: string): Promise { + return Promise.resolve({ + filePath, + messages: [] + }); + } +} diff --git a/node_modules/textlint/src/engine/execute-file-backers/README.md b/node_modules/textlint/src/engine/execute-file-backers/README.md new file mode 100644 index 000000000..f3dbc32c9 --- /dev/null +++ b/node_modules/textlint/src/engine/execute-file-backers/README.md @@ -0,0 +1,16 @@ +# execute-file-backers + +These are `exeuteFile` middleware function. + +Each backer vote YES or No to process `exeuteFile`. + +Each backer should be implemented these methods. + +## `shouldExecute({filePath}): boolean` + +Should the `filePath` be executed? +If anyone opposed(`return false`) backer exist, does't `executeFile`. + +## `didExecute({filePath, results}): results` + +After process. diff --git a/node_modules/textlint/src/engine/execute-file-backers/abstruct-backer.ts b/node_modules/textlint/src/engine/execute-file-backers/abstruct-backer.ts new file mode 100644 index 000000000..ead96955c --- /dev/null +++ b/node_modules/textlint/src/engine/execute-file-backers/abstruct-backer.ts @@ -0,0 +1,22 @@ +// MIT © 2016 azu +"use strict"; +import { TextlintResult } from "@textlint/kernel"; +/* eslint-disable */ +export abstract class AbstractBacker { + /** + * @param {string} filePath + * @returns {boolean} + */ + abstract shouldExecute({ filePath }: { filePath: string }): boolean; + + /** + * @param {TextlintResult} result + * @returns {boolean} + */ + abstract didExecute({ result }: { result: TextlintResult }): void; + + /** + * call when after all execution is completed + */ + abstract afterAll(): void; +} diff --git a/node_modules/textlint/src/engine/execute-file-backers/cache-backer.ts b/node_modules/textlint/src/engine/execute-file-backers/cache-backer.ts new file mode 100644 index 000000000..5ae899e70 --- /dev/null +++ b/node_modules/textlint/src/engine/execute-file-backers/cache-backer.ts @@ -0,0 +1,73 @@ +// MIT © 2016 azu +"use strict"; +const fileEntryCache = require("file-entry-cache"); +const debug = require("debug")("textlint:CacheBacker"); +import { AbstractBacker } from "./abstruct-backer"; +import { Config } from "../../config/config"; +import { TextlintResult } from "@textlint/kernel"; +export class CacheBacker implements AbstractBacker { + fileCache: any; + isEnabled: boolean; + /** + * @param {Config} config + */ + constructor(public config: Config) { + /** + * @type {boolean} + */ + this.isEnabled = config.cache; + this.fileCache = fileEntryCache.create(config.cacheLocation); + } + + /** + * @param {string} filePath + * @returns {boolean} + */ + shouldExecute({ filePath }: { filePath: string }) { + if (!this.isEnabled) { + return true; + } + const descriptor = this.fileCache.getFileDescriptor(filePath); + const meta = descriptor.meta || {}; + // if the config is changed or file is changed, should execute return true + const isChanged = descriptor.changed || meta.hashOfConfig !== this.config.hash; + debug(`Skipping file since hasn't changed: ${filePath}`); + return isChanged; + } + + /** + * @param {TextlintResult} result + */ + didExecute({ result }: { result: TextlintResult }) { + if (!this.isEnabled) { + return; + } + const filePath = result.filePath; + const descriptor = this.fileCache.getFileDescriptor(filePath); + const meta = descriptor.meta || {}; + /* + * if a file contains messages we don't want to store the file in the cache + * so we can guarantee that next execution will also operate on this file + */ + if (result.messages.length > 0) { + debug(`File has problems, skipping it: ${filePath}`); + // remove the entry from the cache + this.fileCache.removeEntry(filePath); + } else { + // cache `config.hash` + meta.hashOfConfig = this.config.hash; + } + } + + /** + * destroy all cache + */ + destroyCache() { + this.fileCache.destroy(); + } + + afterAll() { + // persist cache + this.fileCache.reconcile(); + } +} diff --git a/node_modules/textlint/src/engine/processor-map.ts b/node_modules/textlint/src/engine/processor-map.ts new file mode 100644 index 000000000..3501ccc2a --- /dev/null +++ b/node_modules/textlint/src/engine/processor-map.ts @@ -0,0 +1,16 @@ +// LICENSE : MIT +"use strict"; +import { MapLike } from "map-like"; + +/** + * Processor Map object + */ +export class PluginMap extends MapLike { + toJSON() { + const object = {}; + this.forEach((value, key) => { + (object as any)[key] = value; + }); + return object; + } +} diff --git a/node_modules/textlint/src/engine/rule-loader.ts b/node_modules/textlint/src/engine/rule-loader.ts new file mode 100644 index 000000000..03a46d666 --- /dev/null +++ b/node_modules/textlint/src/engine/rule-loader.ts @@ -0,0 +1,29 @@ +"use strict"; +import { moduleInterop } from "@textlint/module-interop"; +import * as fs from "fs"; +import * as path from "path"; + +/** + * Load all rule modules from specified directory. + * These are filtered by [extname] + * @param {String} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`. + * @param {String} [extname] extension name + * @returns {Object} Loaded rule modules by rule ids (file names). + */ +export function loadFromDir(rulesDir: string, extname: string = ".js"): { [index: string]: any } { + let rulesDirAbsolutePath: string; + if (!rulesDir) { + rulesDirAbsolutePath = path.join(__dirname, "rules"); + } else { + rulesDirAbsolutePath = path.resolve(process.cwd(), rulesDir); + } + const rules = Object.create(null); + fs.readdirSync(rulesDirAbsolutePath).forEach((file: string) => { + if (path.extname(file) !== extname) { + return; + } + const withoutExt = path.basename(file, extname); + rules[withoutExt] = moduleInterop(require(path.join(rulesDirAbsolutePath, file))); + }); + return rules; +} diff --git a/node_modules/textlint/src/engine/rule-map.ts b/node_modules/textlint/src/engine/rule-map.ts new file mode 100644 index 000000000..55feb71fa --- /dev/null +++ b/node_modules/textlint/src/engine/rule-map.ts @@ -0,0 +1,58 @@ +// LICENSE : MIT +"use strict"; +import { MapLike } from "map-like"; + +/** + * @typedef {{key: Function}} RulesObject + */ +export class RuleMap extends MapLike { + /** + * has rule at least one > 0 + * @returns {boolean} + */ + hasRuleAtLeastOne() { + return this.keys().length > 0; + } + + getAllRuleNames() { + return this.keys(); + } + + getRule(ruleKey: string) { + return this.get(ruleKey); + } + + /** + * @returns {RulesObject} + */ + getAllRules() { + return this.toJSON(); + } + + isDefinedRule(ruleKey: string) { + return this.has(ruleKey); + } + + /** + * @param {string} ruleKey + * @param ruleHandler + */ + defineRule(ruleKey: string, ruleHandler: Function | undefined) { + this.set(ruleKey, ruleHandler); + } + + /** + * reset defined rules + */ + resetRules() { + this.clear(); + } + + toJSON() { + const object: { [index: string]: any } = {}; + this.forEach((value, key) => { + object[key] = value; + }); + return object; + } +} diff --git a/node_modules/textlint/src/engine/textlint-engine-core.ts b/node_modules/textlint/src/engine/textlint-engine-core.ts new file mode 100644 index 000000000..25d084693 --- /dev/null +++ b/node_modules/textlint/src/engine/textlint-engine-core.ts @@ -0,0 +1,310 @@ +// LICENSE : MIT +"use strict"; +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { TextLintFormatterOption } from "../textlint-interface"; +import { TextLintCore } from "../textlint-core"; +import { RuleMap } from "./rule-map"; +import { PluginMap } from "./processor-map"; +import { Config } from "../config/config"; +import { findFiles, pathsToGlobPatterns, separateByAvailability } from "../util/find-util"; +import { TextLintModuleLoader } from "./textlint-module-loader"; +import { ExecuteFileBackerManager } from "./execute-file-backer-manager"; +import { CacheBacker } from "./execute-file-backers/cache-backer"; +import { SeverityLevel } from "../shared/type/SeverityLevel"; +import { TextlintMessage, TextlintResult } from "@textlint/kernel"; + +const path = require("path"); +const debug = require("debug")("textlint:engine-core"); + +/** + * Core of TextLintEngine. + * It is internal user. + * + * Hackable adaptor + * + * - executeOnFiles + * - executeOnText + * - formatResults + * + * There are hackable by `executor` option. + */ +export abstract class AbstractTextLintEngine { + private moduleLoader: TextLintModuleLoader; + private pluginMap: PluginMap; + private ruleMap: RuleMap; + private filterRuleMap: RuleMap; + private executeFileBackerManger: ExecuteFileBackerManager; + private textlint: TextLintCore; + private config: Config; + // abstract interface + // Each engines should be implemented these + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + abstract onFile: (textlintCore: TextLintCore) => (filePath: string) => Promise; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + abstract onText: (textlintCore: TextLintCore) => (text: string, ext?: string) => Promise; + /** + * @param {TextLintFormatterOption} formatterConfig + */ + abstract onFormat: (formatterConfig: TextLintFormatterOption) => (results: LintResult[]) => string; + + /** + * Process files are wanted to lint. + * TextLintEngine is a wrapper of textlint.js. + * Aim to be called from cli with cli options. + * @param {Config|Object} [options] the options is command line options or Config object. + * @constructor + */ + constructor(options?: Config | object) { + /** + * @type {Config} + */ + if (options instanceof Config) { + // Almost internal use-case + this.config = options; + } else { + this.config = Config.initWithAutoLoading(options); + } + /** + * @type {TextLintCore} + * @private + */ + this.textlint = new TextLintCore(this.config); + /** + * @type {ExecuteFileBackerManager} + * @private + */ + this.executeFileBackerManger = new ExecuteFileBackerManager(); + const cacheBaker = new CacheBacker(this.config); + if (this.config.cache) { + this.executeFileBackerManger.add(cacheBaker); + } else { + cacheBaker.destroyCache(); + } + /** + * @type {RuleMap} ruleMap is used for linting/fixer + * @private + */ + this.ruleMap = new RuleMap(); + /** + * @type {RuleMap} filerRuleMap is used for filtering + * @private + */ + this.filterRuleMap = new RuleMap(); + /** + * @type {PluginMap} + * @private + */ + this.pluginMap = new PluginMap(); + /** + * @type {TextLintModuleLoader} + * @private + */ + this.moduleLoader = new TextLintModuleLoader(this.config); + this.moduleLoader.on(TextLintModuleLoader.Event.rule, ([ruleName, ruleCreator]) => { + this.ruleMap.defineRule(ruleName, ruleCreator); + }); + this.moduleLoader.on(TextLintModuleLoader.Event.filterRule, ([ruleName, ruleCreator]) => { + this.filterRuleMap.defineRule(ruleName, ruleCreator); + }); + this.moduleLoader.on(TextLintModuleLoader.Event.plugin, ([pluginName, plugin]) => { + this.pluginMap.set(pluginName, plugin); + }); + // load rule/plugin/processor + this.moduleLoader.loadFromConfig(this.config); + // set settings to textlint core + this._setupRules(); + } + + /** + * @deprecated remove this method + */ + setRulesBaseDirectory() { + throw new Error(`Should not use setRulesBaseDirectory(), insteadof use +new TextLintEngine({ + rulesBaseDirectory: directory +}) + `); + } + + /** + * load plugin manually + * Note: it high cost, please use config + * @param {string} pluginName + * @deprecated use Constructor(config) insteadof it + */ + loadPlugin(pluginName: string) { + this.moduleLoader.loadPlugin(pluginName); + this._setupRules(); + } + + /** + * load plugin manually + * Note: it high cost, please use config + * @param {string} presetName + * @deprecated use Constructor(config) insteadof it + */ + loadPreset(presetName: string) { + this.moduleLoader.loadPreset(presetName); + this._setupRules(); + } + + /** + * load rule manually + * Note: it high cost, please use config + * @param {string} ruleName + * @deprecated use Constructor(config) insteadof it + */ + loadRule(ruleName: string) { + this.moduleLoader.loadRule(ruleName); + this._setupRules(); + } + + /** + * load filter rule manually + * Note: it high cost, please use config + * @param {string} ruleName + * @deprecated use Constructor(config) insteadof it + */ + loadFilerRule(ruleName: string) { + this.moduleLoader.loadFilterRule(ruleName); + this._setupRules(); + } + + /** + * Update rules from current config + * @private + */ + private _setupRules() { + // set Rules + const textlintConfig = this.config ? this.config.toJSON() : {}; + this.textlint.setupRules(this.ruleMap.getAllRules(), textlintConfig.rulesConfig); + this.textlint.setupFilterRules(this.filterRuleMap.getAllRules(), textlintConfig.filterRulesConfig); + // set Processor + this.textlint.setupPlugins(this.pluginMap.toJSON(), textlintConfig.pluginsConfig); + } + + /** + * Remove all registered rule and clear messages. + * @private + */ + resetRules() { + this.textlint.resetRules(); + this.ruleMap.resetRules(); + this.filterRuleMap.resetRules(); + } + + /** + * Return available extensions of plugins that include built-in plugins + * @example + * ``` + * engine.availableExtensions; // => [".txt", ".md"] + * ``` + */ + get availableExtensions(): string[] { + return this.textlint.textlintKernelDescriptor.availableExtensions; + } + + /** + * Return meta descriptor object for this engine + * + * WARNING: This is experimental getter method. + * It will be renamed. + */ + get textlintrcDescriptor(): TextlintKernelDescriptor { + return this.textlint.textlintKernelDescriptor; + } + + /** + * Executes the current configuration on an array of file and directory names. + * @param {String[]} files An array of file and directory names. + * @returns {Promise} The results for all files that were linted. + */ + executeOnFiles(files: string[]): Promise { + const execFile = this.onFile(this.textlint); + const patterns = pathsToGlobPatterns(files, { + extensions: this.textlintrcDescriptor.availableExtensions + }); + const targetFiles = findFiles(patterns, { ignoreFilePath: this.config.ignoreFile }); + // Maybe, unAvailableFilePath should be warning. + // But, The user can use glob pattern like `src/**/*` as arguments. + // pathsToGlobPatterns not modified that pattern. + // So, unAvailableFilePath should be ignored silently. + const { availableFiles, unAvailableFiles } = separateByAvailability(targetFiles, { + extensions: this.textlintrcDescriptor.availableExtensions + }); + debug("Process files", availableFiles); + debug("No Process files that are un-support extensions:", unAvailableFiles); + // FIXME: remove cast + return this.executeFileBackerManger.process(availableFiles, execFile) as Promise; + } + + /** + * If want to lint a text, use it. + * But, if you have a target file, use {@link executeOnFiles} instead of it. + * @param {string} text linting text content + * @param {string} ext ext is a type for linting. default: ".txt" + * @returns {Promise} + */ + executeOnText(text: string, ext: string = ".txt"): Promise { + const textlint = this.textlint; + const execText = this.onText(textlint); + // filePath or ext + const actualExt = ext[0] === "." ? ext : path.extname(ext); + if (actualExt.length === 0) { + throw new Error("should specify the extension.\nex) .md"); + } + return execText(text, actualExt).then((result: LintResult) => { + return [result]; + }); + } + + /** + * format {@link results} and return output text. + * @param {TextlintResult[]} results the collection of result + * @returns {string} formatted output text + * @example + * console.log(formatResults(results)); + */ + formatResults(results: LintResult[]): string { + // default formatter: "stylish" + const formatter = this.onFormat({ + formatterName: this.config.formatterName || "stylish", + color: this.config.color + }); + return formatter(results); + } + + /** + * Checks if the given message is an error message. + * @param {TextlintMessage} message The message to check. + * @returns {boolean} Whether or not the message is an error message. + */ + isErrorMessage(message: TextlintMessage): boolean { + return message.severity === SeverityLevel.error; + } + + /** + * Checks if the given results contain error message. + * If there is even one error then return true. + * @param {TextlintResult[]} results Linting result collection + * @returns {Boolean} Whether or not the results contain error message. + */ + isErrorResults(results: TextlintResult[]): boolean { + return results.some((result) => { + return result.messages.some(this.isErrorMessage); + }); + } + + /** + * @returns {boolean} + */ + hasRuleAtLeastOne() { + return this.ruleMap.hasRuleAtLeastOne(); + } +} diff --git a/node_modules/textlint/src/engine/textlint-module-loader.ts b/node_modules/textlint/src/engine/textlint-module-loader.ts new file mode 100644 index 000000000..5ed3ebe46 --- /dev/null +++ b/node_modules/textlint/src/engine/textlint-module-loader.ts @@ -0,0 +1,211 @@ +// LICENSE : MIT +"use strict"; +import { EventEmitter } from "events"; +import { moduleInterop } from "@textlint/module-interop"; +const debug = require("debug")("textlint:module-loader"); +const isFile = require("is-file"); +import { isPluginRuleKey } from "../config/config-util"; +import { loadFromDir } from "./rule-loader"; +import { Logger } from "../util/logger"; +import { TextLintModuleResolver } from "./textlint-module-resolver"; +import { TextLintModuleMapper } from "./textlint-module-mapper"; +import { Config } from "../config/config"; +import { + normalizeTextlintFilterRuleKey, + normalizeTextlintPluginKey, + normalizeTextlintRuleKey, + normalizeTextlintRulePresetKey +} from "@textlint/utils"; + +export class TextLintModuleLoader extends EventEmitter { + moduleResolver: TextLintModuleResolver; + + static get Event() { + return { + rule: "rule", + filterRule: "filterRule", + plugin: "plugin", + error: "error" + }; + } + + constructor(config: { rulesBaseDirectory?: string }) { + super(); + this.moduleResolver = new TextLintModuleResolver(config); + } + + /** + * set up lint rules using {@lint Config} object. + * The {@lint Config} object was created with initialized {@link TextLintEngine} (as-known Constructor). + * @param {Config} config the config is parsed object + */ + loadFromConfig(config: Config) { + debug("config %O", config); + // --ruledir + if (config.rulePaths && this.listenerCount(TextLintModuleLoader.Event.rule) > 0) { + // load in additional rules + config.rulePaths.forEach((rulesDir) => { + debug("Loading rules from %o", rulesDir); + const rules = loadFromDir(rulesDir); + Object.keys(rules).forEach((ruleName) => { + const entry = [ruleName, rules[ruleName]]; + this.emit(TextLintModuleLoader.Event.rule, entry); + }); + }); + } + // --rule + if (config.rules && this.listenerCount(TextLintModuleLoader.Event.rule) > 0) { + // load in additional rules + config.rules.forEach((ruleName: string) => { + this.loadRule(ruleName); + }); + } + // TODO: --filter + if (config.filterRules && this.listenerCount(TextLintModuleLoader.Event.filterRule) > 0) { + // load in additional filterRules + config.filterRules.forEach((ruleName) => { + this.loadFilterRule(ruleName); + }); + } + // --preset + if (config.presets && this.listenerCount(TextLintModuleLoader.Event.rule) > 0) { + config.presets.forEach((presetName) => { + this.loadPreset(presetName); + }); + } + // --plugin + if (config.plugins && this.listenerCount(TextLintModuleLoader.Event.plugin) > 0) { + // load in additional rules from plugin + config.plugins.forEach((pluginName) => { + this.loadPlugin(pluginName); + }); + } + } + + /** + * load rule from plugin name. + * plugin module has `rules` object and define rule with plugin prefix. + * @param {string} pluginName + */ + loadPlugin(pluginName: string) { + const pkgPath = this.moduleResolver.resolvePluginPackageName(pluginName); + debug("Loading rules from plugin: %s", pkgPath); + const plugin = moduleInterop(require(pkgPath)); + const pluginNameWithoutPrefix = normalizeTextlintPluginKey(pluginName); + // Notes: plugins not support "rules" and "rulesConfig" + // https://github.com/textlint/textlint/issues/291 + if (plugin.hasOwnProperty("rules")) { + throw new Error(`textlint plugins not support "rules" and "rulesConfig". +But ${pluginName} has these filed. +For more details, See https://github.com/textlint/textlint/issues/291`); + } + // register plugin.Processor + if (!plugin.hasOwnProperty("Processor")) { + throw new Error(`textlint plugin should have "Processor". +For more details. See https://github.com/textlint/textlint/blob/master/docs/plugin.md`); + } + const pluginEntry = [pluginNameWithoutPrefix, plugin]; + this.emit(TextLintModuleLoader.Event.plugin, pluginEntry); + } + + loadPreset(presetName: string) { + /* + Caution: Rules of preset are defined as following. + { + "rules": { + "preset-gizmo": { + "ruleA": false + + } + } + + It mean that "ruleA" is defined as "preset-gizmo/ruleA" + + */ + const presetRuleNameWithoutPrefix = normalizeTextlintRulePresetKey(presetName); + // ignore plugin's rule + if (isPluginRuleKey(presetRuleNameWithoutPrefix)) { + Logger.warn(`${presetRuleNameWithoutPrefix} is Plugin's rule. This is unknown case, please report issue.`); + return; + } + + const pkgPath = this.moduleResolver.resolvePresetPackageName(presetName); + debug("Loading rules from preset: %s", pkgPath); + const preset = moduleInterop(require(pkgPath)); + const entities = TextLintModuleMapper.createEntities(preset.rules, presetRuleNameWithoutPrefix); + entities.forEach((entry) => { + this.emit(TextLintModuleLoader.Event.rule, entry); + }); + } + + /** + * load rule file with `ruleName` and define rule. + * if rule is not found, then throw ReferenceError. + * if already rule is loaded, do not anything. + * @param {string} ruleName + */ + loadRule(ruleName: string) { + /* + Task + - check already define + - resolve package name + - load package + - emit rule + */ + // ruleName is filePath + if (isFile(ruleName)) { + const ruleCreator = moduleInterop(require(ruleName)); + const ruleEntry = [ruleName, ruleCreator]; + this.emit(TextLintModuleLoader.Event.rule, ruleEntry); + return; + } + // ignore already defined rule + // ignore rules from rulePaths because avoid ReferenceError is that try to require. + const definedRuleName = normalizeTextlintRuleKey(ruleName); + // ignore plugin's rule + if (isPluginRuleKey(definedRuleName)) { + Logger.warn(`${definedRuleName} is Plugin's rule. This is unknown case, please report issue.`); + return; + } + const pkgPath = this.moduleResolver.resolveRulePackageName(ruleName); + debug("Loading rules from %s", pkgPath); + const ruleCreator = moduleInterop(require(pkgPath)); + const ruleEntry = [definedRuleName, ruleCreator]; + this.emit(TextLintModuleLoader.Event.rule, ruleEntry); + } + + /** + * load filter rule file with `ruleName` and define rule. + * if rule is not found, then throw ReferenceError. + * if already rule is loaded, do not anything. + * @param {string} ruleName + */ + loadFilterRule(ruleName: string) { + /* + Task + - check already define + - resolve package name + - load package + - emit rule + */ + // ignore already defined rule + // ignore rules from rulePaths because avoid ReferenceError is that try to require. + if (isFile(ruleName)) { + const ruleCreator = moduleInterop(require(ruleName)); + const ruleEntry = [ruleName, ruleCreator]; + this.emit(TextLintModuleLoader.Event.filterRule, ruleEntry); + return; + } + const definedRuleName = normalizeTextlintFilterRuleKey(ruleName); + // ignore plugin's rule + if (isPluginRuleKey(definedRuleName)) { + Logger.warn(`${definedRuleName} is Plugin's rule. This is unknown case, please report issue.`); + return; + } + const pkgPath = this.moduleResolver.resolveFilterRulePackageName(ruleName); + debug("Loading filter rules from %s", pkgPath); + const ruleCreator = moduleInterop(require(pkgPath)); + const ruleEntry = [definedRuleName, ruleCreator]; + this.emit(TextLintModuleLoader.Event.filterRule, ruleEntry); + } +} diff --git a/node_modules/textlint/src/engine/textlint-module-mapper.ts b/node_modules/textlint/src/engine/textlint-module-mapper.ts new file mode 100644 index 000000000..4e6f758a6 --- /dev/null +++ b/node_modules/textlint/src/engine/textlint-module-mapper.ts @@ -0,0 +1,49 @@ +// LICENSE : MIT +"use strict"; +/** + * This class is a helper to create mapping of rules and rulesConfig + * Main purpose hide the RuleSeparator "/". + */ +// The separator of `/` +const RuleSeparator = "/"; + +export class TextLintModuleMapper { + /** + * create entities from rules/rulesConfig and prefix + * entities is a array which contain [key, value] + * it just create entity without normalization + * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries + * @param {Object} pluginRules an object is like "rules" or "rulesConfig" of plugin + * @param {string} prefixKey prefix key is plugin name or preset name + * @returns {[string, string][]} + */ + static createEntities(pluginRules: { [index: string]: string }, prefixKey: string): [string, string][] { + const entities: [string, string][] = []; + Object.keys(pluginRules).forEach((ruleId) => { + const qualifiedRuleId = prefixKey + RuleSeparator + ruleId; + const ruleCreator = pluginRules[ruleId]; + entities.push([qualifiedRuleId, ruleCreator]); + }); + return entities; + } + + /** + * create an object from rules/rulesConfig and prefix + * the object shape is { key: value, key2: value } + * + * it just create object without normalization + * @param {Object} pluginRules an object is like "rules" or "rulesConfig" of plugin + * @param {string} prefixKey prefix key is plugin name or preset name + * @returns {Object} + */ + static createMappedObject( + pluginRules: { [index: string]: string }, + prefixKey: string + ): { [index: string]: string } { + const mapped: { [index: string]: string } = {}; + Object.keys(pluginRules).forEach((key) => { + mapped[`${prefixKey}/${key}`] = pluginRules[key]; + }); + return mapped; + } +} diff --git a/node_modules/textlint/src/engine/textlint-module-resolver.ts b/node_modules/textlint/src/engine/textlint-module-resolver.ts new file mode 100644 index 000000000..3ba7ae4ac --- /dev/null +++ b/node_modules/textlint/src/engine/textlint-module-resolver.ts @@ -0,0 +1,165 @@ +// LICENSE : MIT +"use strict"; +import * as path from "path"; +import { createFullPackageName } from "./textlint-package-name-util"; +import { PackageNamePrefix } from "../config/package-prefix"; + +const tryResolve = require("try-resolve"); +const debug = require("debug")("textlint:module-resolver"); + +export interface ConfigModulePrefix { + CONFIG_PACKAGE_PREFIX: string; + FILTER_RULE_NAME_PREFIX: string; + RULE_NAME_PREFIX: string; + RULE_PRESET_NAME_PREFIX: string; + PLUGIN_NAME_PREFIX: string; +} + +/** + * This class aim to resolve textlint's package name and get the module path. + * + * Define + * + * - `package` is npm package + * - `module` is package's main module + * + * ## Support + * + * - textlint-rule-* + * - textlint-preset-* + * - textlint-plugin-* + * - textlint-config-* + */ +export class TextLintModuleResolver { + private baseDirectory: string; + + constructor(config: { rulesBaseDirectory?: string }) { + /** + * @type {string} baseDirectory for resolving + */ + this.baseDirectory = config && config.rulesBaseDirectory ? config.rulesBaseDirectory : ""; + } + + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolveRulePackageName(packageName: string): string { + const baseDir = this.baseDirectory; + const fullPackageName = createFullPackageName(PackageNamePrefix.rule, packageName); + // or textlint-rule- + const pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug(`rule fullPackageName: ${fullPackageName}`); + throw new ReferenceError(`Failed to load textlint's rule module: "${packageName}" is not found. +See FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md +`); + } + return pkgPath; + } + + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolveFilterRulePackageName(packageName: string): string { + const baseDir = this.baseDirectory; + const fullPackageName = createFullPackageName(PackageNamePrefix.filterRule, packageName); + // or textlint-filter-rule- or @scope/ + const pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug(`filter rule fullPackageName: ${fullPackageName}`); + throw new ReferenceError(`Failed to load textlint's filter rule module: "${packageName}" is not found. +See FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md +`); + } + return pkgPath; + } + + /** + * Take package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolvePluginPackageName(packageName: string): string { + const baseDir = this.baseDirectory; + const fullPackageName = createFullPackageName(PackageNamePrefix.plugin, packageName); + // or textlint-plugin- + const pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug(`plugin fullPackageName: ${fullPackageName}`); + throw new ReferenceError(`Failed to load textlint's plugin module: "${packageName}" is not found. +See FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md +`); + } + return pkgPath; + } + + /** + * Take package name, and return path to module. + * @param {string} packageName + * The user must specify preset- prefix to these `packageName`. + * @returns {string} return path to module + */ + resolvePresetPackageName(packageName: string): string { + const baseDir = this.baseDirectory; + const PREFIX = PackageNamePrefix.rulePreset; + /* Implementation Note + + preset name is defined in config file: + In the case, `packageName` is "preset-gizmo" + TextLintModuleResolver resolve "preset-gizmo" to "textlint-rule-preset-gizmo" + { + "rules": { + "preset-gizmo": { + "ruleA": false + } + } + } + */ + // preset- or textlint-rule-preset- + // @scope/preset- or @scope/textlint-rule-preset- + const packageNameWithoutPreset = packageName + .replace(/^preset-/, "") + .replace(/^@([^/]+)\/preset-(.*)$/, `@$1/$2`); + const fullPackageName = createFullPackageName(PREFIX, packageNameWithoutPreset); + const fullFullPackageName = `${PREFIX}${packageNameWithoutPreset}`; + const pkgPath = + // textlint-rule-preset- or @scope/textlint-rule-preset- + tryResolve(path.join(baseDir, fullFullPackageName)) || + // + tryResolve(path.join(baseDir, packageNameWithoutPreset)) || + // + tryResolve(path.join(baseDir, fullPackageName)) || + // + tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + debug(`preset fullPackageName: ${fullPackageName}`); + debug(`preset fullFullPackageName: ${fullFullPackageName}`); + throw new ReferenceError(`Failed to load textlint's preset module: "${packageName}" is not found. +See FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md +`); + } + return pkgPath; + } + + /** + * Take Config package name, and return path to module. + * @param {string} packageName + * @returns {string} return path to module + */ + resolveConfigPackageName(packageName: string): string { + const baseDir = this.baseDirectory; + const fullPackageName = createFullPackageName(PackageNamePrefix.config, packageName); + // or textlint-config- + const pkgPath = tryResolve(path.join(baseDir, fullPackageName)) || tryResolve(path.join(baseDir, packageName)); + if (!pkgPath) { + throw new ReferenceError(`Failed to load textlint's config module: "${packageName}" is not found. +See FAQ: https://github.com/textlint/textlint/blob/master/docs/faq/failed-to-load-textlints-module.md +`); + } + return pkgPath; + } +} diff --git a/node_modules/textlint/src/engine/textlint-package-name-util.ts b/node_modules/textlint/src/engine/textlint-package-name-util.ts new file mode 100644 index 000000000..a621bb34d --- /dev/null +++ b/node_modules/textlint/src/engine/textlint-package-name-util.ts @@ -0,0 +1,44 @@ +/** + * Remove `prefix` from `text`. + */ +export const removePrefixFromPackageName = (prefixList: string[], packageName: string) => { + for (let i = 0; i < prefixList.length; i++) { + const prefix = prefixList[i]; + // @scope/name -> @scope/name + // @scope/textlint-rule-name -> @scope/name + if (packageName.charAt(0) === "@") { + const [namespace, name] = packageName.split("/"); + if (name.startsWith(prefix)) { + return `${namespace}/${name.slice(prefix.length)}`; + } + } + // name -> name + // textlint-rule-name -> name + else if (packageName.startsWith(prefix)) { + return packageName.slice(prefix.length); + } + } + // No match + return packageName; +}; + +/** + * Create full package name and return + * @param {string} prefix + * @param {string} name + * @returns {string} + */ +export const createFullPackageName = (prefix: string, name: string): string => { + if (name.charAt(0) === "@") { + const scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`); + // if @scope/ -> @scope/ + if (!scopedPackageNameRegex.test(name.split("/")[1])) { + /* + * for scoped packages, insert the textlint-rule after the first / unless + * the path is already @scope/ or @scope/textlint-rule- + */ + return name.replace(/^@([^/]+)\/(.*)$/, `@$1/${prefix}$2`); + } + } + return `${prefix}${name}`; +}; diff --git a/node_modules/textlint/src/fixer/textlint-fixer.ts b/node_modules/textlint/src/fixer/textlint-fixer.ts new file mode 100644 index 000000000..b6e788b88 --- /dev/null +++ b/node_modules/textlint/src/fixer/textlint-fixer.ts @@ -0,0 +1,28 @@ +import { TextlintFixResult } from "@textlint/kernel"; + +const fs = require("fs"); + +function overWriteResult(result: TextlintFixResult): Promise { + return new Promise((resolve, reject) => { + const targetFilePath = result.filePath; + const output = result.output; + fs.writeFile(targetFilePath, output, (error: any, result: TextlintFixResult) => { + if (error) { + return reject(error); + } + resolve(result); + }); + }); +} + +export class TextLintFixer { + /** + * write output to each files and return promise + * @param textFixMessages + * @returns {Promise} + */ + write(textFixMessages: TextlintFixResult[]) { + const promises = textFixMessages.map(overWriteResult); + return Promise.all(promises); + } +} diff --git a/node_modules/textlint/src/index.ts b/node_modules/textlint/src/index.ts new file mode 100644 index 000000000..9bd3f0e28 --- /dev/null +++ b/node_modules/textlint/src/index.ts @@ -0,0 +1,28 @@ +// LICENSE : MIT +"use strict"; + +// Level of abstraction(descending order) +// cli > TextLintEngine > TextLintCore(textlint) +// See: https://github.com/textlint/textlint/blob/master/docs/use-as-modules.md + +// Command line interface +export { cli } from "./cli"; + +// It is a singleton object of TextLintCore +// Recommend: use TextLintCore +export { textlint } from "./textlint"; + +// TextLintEngine is a wrapper around `textlint` for linting **multiple** files +// include formatter, detecting utils +// : It is easy to use +// You can see engine/textlint-engine-core.js for more detail +export { TextLintEngine } from "./textlint-engine"; + +// TextFixEngine is a wrapper around `textlint` for linting **multiple** files +// include formatter, detecting utils +// : It is easy to use +// You can see engine/textlint-engine-core.js for more detail +export { TextFixEngine } from "./textfix-engine"; + +// Core API for linting a **single** text or file. +export { TextLintCore } from "./textlint-core"; diff --git a/node_modules/textlint/src/options.ts b/node_modules/textlint/src/options.ts new file mode 100644 index 000000000..b01340558 --- /dev/null +++ b/node_modules/textlint/src/options.ts @@ -0,0 +1,197 @@ +// LICENSE : MIT +"use strict"; +import { getFormatterList, FormatterDetail } from "@textlint/linter-formatter"; +import { getFixerFormatterList, FixerFormatterDetail } from "@textlint/fixer-formatter"; + +const optionator = require("optionator"); + +const concatFormatterList = (formatterList: FormatterDetail[] | FixerFormatterDetail[]) => { + return formatterList + .map((formatter) => { + return formatter.name; + }) + .join(", "); +}; + +export const options = optionator({ + prepend: "textlint [options] file.md [file|dir|glob*]", + concatRepeatedArrays: true, + mergeRepeatedObjects: true, + options: [ + { heading: "Options" }, + { + option: "help", + alias: "h", + type: "Boolean", + description: "Show help." + }, + { + option: "config", + alias: "c", + type: "path::String", + description: "Use configuration from this file or sharable config.", + example: "--config /path/to/.textlintrc" + }, + { + option: "ignore-path", + type: "path::String", + description: "Specify path to a file containing patterns that describes files to ignore.", + default: ".textlintignore", + example: "--ignore-path /path/to/.textlintignore" + }, + { + option: "init", + type: "Boolean", + default: "false", + description: "Create the config file if not existed." + }, + { + option: "fix", + type: "Boolean", + default: false, + description: "Automatically fix problems", + example: "--fix" + }, + { + option: "dry-run", + type: "Boolean", + default: false, + description: "Enable dry-run mode for --fix. Only show result, don't change the file.", + example: "--fix --dry-run" + }, + { + option: "debug", + type: "Boolean", + default: false, + description: "Outputs debugging information" + }, + { + option: "version", + alias: "v", + type: "Boolean", + description: "Outputs the version number." + }, + { + heading: "Using stdin" + }, + { + option: "stdin", + type: "Boolean", + default: "false", + description: "Lint text provided on ." + }, + { + option: "stdin-filename", + type: "String", + description: "Specify filename to process STDIN as", + example: "cat ./README.md | textlint --stdin --stdin-filename README.md" + }, + { + heading: "Output" + }, + { + option: "output-file", + alias: "o", + type: "path::String", + description: "Enable report to be written to a file." + }, + { + option: "format", + alias: "f", + type: "String", + description: `Use a specific output format. + Available formatter : ${concatFormatterList(getFormatterList())} + Available formatter for --fix: ${concatFormatterList(getFixerFormatterList())}`, + example: "--format pretty-error" + }, + { + option: "color", + type: "Boolean", + default: "true", + description: "Disable color in piped output.", + example: "textlint --no-color" + }, + { + option: "quiet", + type: "Boolean", + default: "false", + description: "Report errors only." + }, + { + heading: "Specifying rules and plugins" + }, + { + option: "textlintrc", + type: "Boolean", + default: "true", + description: "Disable .textlintrc", + example: "textlint --no-textlintrc --rule textlint-no-todo README.md" + }, + { + option: "plugin", + type: "[String]", + description: "Set plugin package name", + example: "--plugin plugin-name" + }, + { + option: "rule", + type: "[String]", + description: "Set rule package name" + }, + { + option: "preset", + type: "[String]", + description: "Set preset package name and load rules from preset package." + }, + { + option: "rulesdir", + type: "[path::String]", + description: "Use additional rules from this directory" + }, + { + heading: "Caching" + }, + { + option: "cache", + type: "Boolean", + default: "false", + description: "Only check changed files", + example: "textlint --cache docs/" + }, + { + option: "cache-location", + type: "path::String", + description: "Path to the cache file or directory", + example: 'textlint --cache --cache-location "/Users/user/.textlintcache" docs/' + }, + { + heading: "Experimental" + }, + { + option: "experimental", + type: "Boolean", + default: false, + description: "Enable experimental flag.Some feature use on experimental.", + example: "--experimental" + }, + { + option: "rules-base-directory", + type: "path::String", + description: + "Set module base directory. textlint load modules(rules/presets/plugins) from the base directory.", + example: 'textlint --rules-base-directory "/path/to/other/project/node_modules/"' + }, + { + option: "parallel", + type: "Boolean", + description: "Lint files in parallel", + example: 'textlint --experimental --parallel "*.md"' + }, + { + option: "max-concurrency", + type: "Number", + description: "maxConcurrency for --parallel", + example: "textlint --experimental --parallel --maxConcurrency 4" + } + ] +}); diff --git a/node_modules/textlint/src/parallel/lint-worker-master.ts b/node_modules/textlint/src/parallel/lint-worker-master.ts new file mode 100644 index 000000000..f003a92ca --- /dev/null +++ b/node_modules/textlint/src/parallel/lint-worker-master.ts @@ -0,0 +1,82 @@ +import os from "os"; +import { LintWorkerData, LintWorkerResults } from "./lint-worker"; +import { Config } from "../config/config"; +import { findFiles, pathsToGlobPatterns } from "../util/find-util"; +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { pluginsObjectToKernelRule } from "../util/object-to-kernel-format"; +import { TextLintModuleLoader } from "../engine/textlint-module-loader"; +import { PluginMap } from "../engine/processor-map"; + +type Worker = import("worker_threads").Worker; +const debug = require("debug")("textlint:parallel/lint-worker-master"); + +const workerPath = require.resolve("./lint-worker"); + +export interface lintParallelOptions { + type: T; + config: Config; + concurrency?: number; +} + +const getPluginObject = (config: Config) => { + const pluginMap = new PluginMap(); + const moduleLoader = new TextLintModuleLoader(config); + moduleLoader.on(TextLintModuleLoader.Event.plugin, ([pluginName, plugin]) => { + pluginMap.set(pluginName, plugin); + }); + // load plugin + moduleLoader.loadFromConfig(config); + return pluginMap.toJSON(); +}; +// TODO: Temporal config +const MAX_CHUNK_SIZE = 256; +export const lintParallel = ( + files: string[], + options: lintParallelOptions +): Promise> => { + // TODO: avoid error on Node.js 12< + const Worker = require("worker_threads").Worker; + const descriptor = new TextlintKernelDescriptor({ + rules: [], + plugins: pluginsObjectToKernelRule(getPluginObject(options.config), options.config.pluginsConfig), + filterRules: [] + }); + const patterns = pathsToGlobPatterns(files, { + extensions: descriptor.availableExtensions + }); + const targetFiles = findFiles(patterns, { ignoreFilePath: options.config.ignoreFile }); + const concurrency = options.concurrency !== undefined ? options.concurrency : os.cpus().length; + const chunkSize = Math.min(MAX_CHUNK_SIZE, Math.ceil(targetFiles.length / concurrency)); + const promises: Promise>[] = []; + + debug("Worker concurrency: %s, chunk size: %s, target files", concurrency, chunkSize, targetFiles.length); + for (let i = 0; i < targetFiles.length; i += chunkSize) { + promises.push( + new Promise((resolve, reject) => { + const workerData: LintWorkerData = { + config: options.config, + type: options.type, + files: targetFiles.slice(i, i + chunkSize) + }; + const worker: Worker = new Worker(workerPath, { workerData }); + const startDate = Date.now(); + worker.on("message", (results) => { + debug("Worker(%s) taken time: %s(ms)", worker.threadId, Date.now() - startDate); + resolve(results); + }); + worker.on("error", reject); + worker.on("exit", (exitCode) => { + if (exitCode) { + reject(new Error(`Worker(${worker.threadId}) stopped with exit code ${exitCode}`)); + } else { + resolve(); + } + }); + }) + ); + } + debug("Worker count: %s", promises.length); + return Promise.all(promises).then((resultsInList) => { + return resultsInList.flat(); + }) as Promise>; +}; diff --git a/node_modules/textlint/src/parallel/lint-worker.ts b/node_modules/textlint/src/parallel/lint-worker.ts new file mode 100644 index 000000000..69d37ee17 --- /dev/null +++ b/node_modules/textlint/src/parallel/lint-worker.ts @@ -0,0 +1,37 @@ +import { parentPort, threadId, isMainThread, workerData } from "worker_threads"; +import { Config } from "../config/config"; +import { TextLintEngine } from "../textlint-engine"; +import { TextFixEngine } from "../textfix-engine"; +import type { TextlintFixResult, TextlintResult } from "@textlint/types"; + +const debug = require("debug")("textlint:parallel/lint-worker"); + +export interface LintWorkerData { + files: string[]; + config: Config; + type: "lint" | "fix"; +} + +export type LintWorkerResults = type extends "lint" + ? TextlintResult[] + : TextlintFixResult[]; +const { config, type, files } = workerData as LintWorkerData; +debug("Worker(%s) Start", threadId); + +// Worker Main +if (isMainThread) { + throw new Error("Worker should not be worked in mainThread"); +} +const engine = type === "lint" ? new TextLintEngine(config) : new TextFixEngine(config); +engine + .executeOnFiles(files) + .then((results) => { + debug("Worker(%s) Done", threadId); + if (parentPort) { + parentPort.postMessage(results); + } + }) + .catch((error) => { + debug("Worker(%s) Error", error.stack); + process.exitCode = 1; + }); diff --git a/node_modules/textlint/src/shared/README.md b/node_modules/textlint/src/shared/README.md new file mode 100644 index 000000000..f3e4cd5f9 --- /dev/null +++ b/node_modules/textlint/src/shared/README.md @@ -0,0 +1,5 @@ +# THIS DIRECTORY WILL BE REMOVED + +NOT USE IT IN TEXTLINT. + +These file are copied to textlint-kernel. diff --git a/node_modules/textlint/src/shared/type/MessageType.ts b/node_modules/textlint/src/shared/type/MessageType.ts new file mode 100644 index 000000000..ed4d046e3 --- /dev/null +++ b/node_modules/textlint/src/shared/type/MessageType.ts @@ -0,0 +1,11 @@ +/** + * TextLintMessage type + * @typedef {Object} MessageType + * @type {{lint: string, ignore: string}} + */ +export const MessageType = { + // Linting(also include Fix) Message Type + lint: "lint", + // Ignoring Message Type + ignore: "ignore" +}; diff --git a/node_modules/textlint/src/shared/type/SeverityLevel.ts b/node_modules/textlint/src/shared/type/SeverityLevel.ts new file mode 100644 index 000000000..dc07fcb30 --- /dev/null +++ b/node_modules/textlint/src/shared/type/SeverityLevel.ts @@ -0,0 +1,13 @@ +// LICENSE : MIT +"use strict"; +/** + * Severity level + * It is used in configuration and message + * @typedef {Object} SeverityLevel + */ +export const SeverityLevel = { + none: 0, + info: 0, + warning: 1, + error: 2 +}; diff --git a/node_modules/textlint/src/textfix-engine.ts b/node_modules/textlint/src/textfix-engine.ts new file mode 100644 index 000000000..7ece5a511 --- /dev/null +++ b/node_modules/textlint/src/textfix-engine.ts @@ -0,0 +1,50 @@ +"use strict"; +import { AbstractTextLintEngine } from "./engine/textlint-engine-core"; +import { createFormatter } from "@textlint/fixer-formatter"; +import { TextLintCore } from "./textlint-core"; +import { TextLintFormatterOption } from "./textlint-interface"; +import { TextlintFixResult } from "@textlint/kernel"; + +/** + * TextFixEngine a adapter for TextLintEngineCore. + * It aim to pull the whole look together. (TextLintEngine and TextFixEngine) + */ +export class TextFixEngine extends AbstractTextLintEngine { + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onFile = (textlintCore: TextLintCore) => { + /** + * Fixes the current configuration on an array of file and directory names. + * TextFixEngine#executeOnFiles + * @returns {TextlintFixResult[]} The results for all files that were linted. + */ + return (file: string) => { + return textlintCore.fixFile(file); + }; + }; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onText = (textlintCore: TextLintCore) => { + /** + * Fix texts with ext option. + * TextFixEngine#executeOnText + * @param {string} text linting text content + * @param {string} [ext] ext is a type for linting. default: ".txt" + * @returns {TextlintFixResult[]} + */ + return (text: string, ext?: string) => { + return textlintCore.fixText(text, ext); + }; + }; + + /** + * @param {TextLintFormatterOption} formatterConfig + */ + onFormat = (formatterConfig: TextLintFormatterOption) => { + return createFormatter(formatterConfig); + }; +} diff --git a/node_modules/textlint/src/textlint-core.ts b/node_modules/textlint/src/textlint-core.ts new file mode 100644 index 000000000..2f23b22a9 --- /dev/null +++ b/node_modules/textlint/src/textlint-core.ts @@ -0,0 +1,233 @@ +// LICENSE : MIT +"use strict"; +/* + textlint-core.js is a class + textlint.js is a singleton object that is instance of textlint-core.js. + */ +import { TextlintKernelDescriptor } from "@textlint/kernel"; +import { + TextlintFixResult, + TextlintKernel, + TextlintKernelPlugin, + TextlintPluginCreator, + TextlintPluginOptions, + TextlintPluginProcessorConstructor, + TextlintResult +} from "@textlint/kernel"; +import { readFile } from "./util/fs-promise"; +import { Config } from "./config/config"; +import { + filterRulesObjectToKernelRule, + pluginsObjectToKernelRule, + rulesObjectToKernelRule +} from "./util/object-to-kernel-format"; +import textPlugin from "@textlint/textlint-plugin-text"; +import markdownPlugin from "@textlint/textlint-plugin-markdown"; + +const path = require("path"); + +const { throwIfTesting } = require("@textlint/feature-flag"); + +/** + * @class {TextLintCore} + */ +export class TextLintCore { + private kernel: TextlintKernel; + private config: Partial; + private defaultPlugins: TextlintKernelPlugin[]; + public textlintKernelDescriptor: TextlintKernelDescriptor; + + constructor(config: Partial = {}) { + // this.config often is undefined. + this.config = config; + // Markdown and Text is enabled by default + // Markdown and Text are for backward compatibility. + this.defaultPlugins = [ + { + pluginId: "markdown", + plugin: markdownPlugin + }, + { + pluginId: "text", + plugin: textPlugin + } + ]; + // TODO: remove `config` + // https://github.com/textlint/textlint/issues/296 + this.kernel = new TextlintKernel(config); + this.textlintKernelDescriptor = new TextlintKernelDescriptor({ + rules: [], + plugins: this.defaultPlugins, + filterRules: [] + }); + } + + /** + * Use setupPlugins insteadof it. + * + * ```` + * textlint.setupPlugins({ + * yourPluginName: yourPlugin + * }); + * ```` + * + * @param {*} Processor + * @deprecated + * + * It will be removed until textlint@10 + */ + addProcessor(Processor: TextlintPluginProcessorConstructor) { + throwIfTesting( + "Use setupPlugins insteadof addProcessor method.`addProcessor` will be removed in the future." + + "For more details, See https://github.com/textlint/textlint/issues/293" + ); + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + plugins: [ + { + pluginId: "`${Processor.name}@deprecated`", + plugin: { Processor } + } + ].concat(this.defaultPlugins) + }); + } + + /** + * register Processors + * @param {Object} plugins + * @param {Object} [pluginsConfig] + */ + setupPlugins( + plugins: { [index: string]: TextlintPluginCreator } = {}, + pluginsConfig: { [index: string]: TextlintPluginOptions } = {} + ) { + // Append default plugin to the plugins list. + // Because, default plugin can be override by user plugins + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + plugins: pluginsObjectToKernelRule(plugins, pluginsConfig).concat(this.defaultPlugins) + }); + } + + /** + * Register rules and rulesConfig. + * if want to release rules, please call {@link resetRules}. + * @param {object} rules rule objects array + * @param {object} [rulesOption] ruleConfig is object + */ + setupRules(rules = {}, rulesOption = {}) { + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + rules: rulesObjectToKernelRule(rules, rulesOption) + }); + } + + /** + * Register filterRules and filterRulesConfig. + * if want to release rules, please call {@link resetRules}. + * @param {object} filterRules rule objects array + * @param {object} [filterRulesOption] ruleConfig is object + */ + setupFilterRules(filterRules = {}, filterRulesOption = {}) { + this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({ + filterRules: filterRulesObjectToKernelRule(filterRules, filterRulesOption) + }); + } + + /** + * Remove all registered rule and clear messages. + */ + resetRules() { + this.textlintKernelDescriptor = new TextlintKernelDescriptor({ + rules: [], + plugins: this.defaultPlugins, + filterRules: [] + }); + } + + /** + * lint text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text + * @param {string} ext ext is extension. default: .txt + * @returns {Promise.} + */ + lintText(text: string, ext: string = ".txt"): Promise { + const options = this._mergeSetupOptions({ + ext + }); + return this.kernel.lintText(text, options); + } + + /** + * lint markdown text by registered rules. + * The result contains target filePath and error messages. + * @param {string} text markdown format text + * @returns {Promise.} + */ + lintMarkdown(text: string): Promise { + const ext = ".md"; + const options = this._mergeSetupOptions({ + ext + }); + return this.kernel.lintText(text, options); + } + + /** + * lint file and return result object + * @param {string} filePath + * @returns {Promise.} result + */ + lintFile(filePath: string): Promise { + const absoluteFilePath = path.resolve(process.cwd(), filePath); + const ext = path.extname(absoluteFilePath); + const options = this._mergeSetupOptions({ + ext, + filePath: absoluteFilePath + }); + return readFile(absoluteFilePath).then((text: string) => { + return this.kernel.lintText(text, options); + }); + } + + /** + * fix file and return fix result object + * @param {string} filePath + * @returns {Promise.} + */ + fixFile(filePath: string): Promise { + const absoluteFilePath = path.resolve(process.cwd(), filePath); + const ext = path.extname(absoluteFilePath); + const options = this._mergeSetupOptions({ + ext, + filePath: absoluteFilePath + }); + return readFile(absoluteFilePath).then((text: string) => { + return this.kernel.fixText(text, options); + }); + } + + /** + * fix texts and return fix result object + * @param {string} text + * @param {string} ext + * @returns {Promise.} + */ + fixText(text: string, ext: string = ".txt"): Promise { + const options = this._mergeSetupOptions({ + ext + }); + return this.kernel.fixText(text, options); + } + + /** + * @private + */ + private _mergeSetupOptions(options: { ext: string } | { ext: any; filePath: any }) { + const configFileBaseDir = + typeof this.config.configFile === "string" ? path.dirname(this.config.configFile) : undefined; + return Object.assign({}, options, { + configBaseDir: configFileBaseDir, + plugins: this.textlintKernelDescriptor.plugin.toKernelPluginsFormat(), + rules: this.textlintKernelDescriptor.rule.toKernelRulesFormat(), + filterRules: this.textlintKernelDescriptor.filterRule.toKernelFilterRulesFormat() + }); + } +} diff --git a/node_modules/textlint/src/textlint-engine.ts b/node_modules/textlint/src/textlint-engine.ts new file mode 100644 index 000000000..07ba89ea7 --- /dev/null +++ b/node_modules/textlint/src/textlint-engine.ts @@ -0,0 +1,51 @@ +"use strict"; +import { createFormatter } from "@textlint/linter-formatter"; +import { AbstractTextLintEngine } from "./engine/textlint-engine-core"; +import { TextLintCore } from "./textlint-core"; +import { TextLintFormatterOption } from "./textlint-interface"; +import { TextlintResult } from "@textlint/kernel"; + +/** + * TextLintEngine a adapter for TextLintEngineCore. + * It aim to pull the whole look together. (TextLintEngine and TextFixEngine) + */ +export class TextLintEngine extends AbstractTextLintEngine { + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onFile = (textlintCore: TextLintCore) => { + /** + * Executes the current configuration on an array of file and directory names. + * TextLintEngine#executeOnFile + * @param {String} file An array of file and directory names. + * @returns {TextlintResult[]} The results for all files that were linted. + */ + return function executeOnFile(file: string) { + return textlintCore.lintFile(file); + }; + }; + /** + * @param {TextLintCore} textlintCore + * @returns {function()} + */ + onText = (textlintCore: TextLintCore) => { + /** + * lint text, and return TextlintResult[] + * TextLintEngine#executeOnText + * @param {string} text linting text content + * @param {string} ext ext is a type for linting. default: ".txt" + * @returns {TextlintResult[]} + */ + return function executeOnText(text: string, ext: string | undefined) { + return textlintCore.lintText(text, ext); + }; + }; + + /** + * @param {TextLintFormatterOption} formatterConfig + */ + onFormat = (formatterConfig: TextLintFormatterOption) => { + return createFormatter(formatterConfig); + }; +} diff --git a/node_modules/textlint/src/textlint-interface.ts b/node_modules/textlint/src/textlint-interface.ts new file mode 100644 index 000000000..e38f690f1 --- /dev/null +++ b/node_modules/textlint/src/textlint-interface.ts @@ -0,0 +1,8 @@ +/** @typedef {Object} TextLintFormatterOption + * @property {string} formatterName + * @property {boolean} noColor + */ +export interface TextLintFormatterOption { + formatterName: string; + color?: boolean; +} diff --git a/node_modules/textlint/src/textlint.ts b/node_modules/textlint/src/textlint.ts new file mode 100644 index 000000000..3f1e01071 --- /dev/null +++ b/node_modules/textlint/src/textlint.ts @@ -0,0 +1,39 @@ +// LICENSE : MIT +"use strict"; +/* + Api is an implemented of linting text. + + + # Usage + + First, register rules by `api.setupRules`. + Second, lint text and get `TextlintResult` by `api.lint*`. + Finally, cleanup by `api.resetRules`. + + ## Concept + + `textlint.js` intended to lint for a single file. + + `textlint.js` is Core API. So, carefully use it. + You should manage `setupRules` and `resetRules` by the hand. + + ## FAQ? + + Q. How to handle multiple files? + + A. Use `cli-engine` which is wrapped `textlint.js`. + + ## More detail workflow + + - load rules + - addEventLister each **event** of rule {@link api.setupRules} + - parse text to AST(TxtNode) + - traverse ast -> emit **event** + - report(push message) + - display messages with formatter + + + */ +import { TextLintCore } from "./textlint-core"; +// singleton instance +export const textlint = new TextLintCore(); diff --git a/node_modules/textlint/src/util/find-util.ts b/node_modules/textlint/src/util/find-util.ts new file mode 100644 index 000000000..e7f750507 --- /dev/null +++ b/node_modules/textlint/src/util/find-util.ts @@ -0,0 +1,117 @@ +// LICENSE : MIT +"use strict"; +const pathToGlob = require("path-to-glob-pattern"); +const glob = require("glob"); +const path = require("path"); +const fs = require("fs"); +const debug = require("debug")("textlint:find-util"); +const DEFAULT_IGNORE_PATTERNS = Object.freeze(["**/.git/**", "**/node_modules/**"]); +export type FindFilesOptions = { + cwd?: string; + ignoreFilePath?: string; +}; +const mapGitIgnorePatternTo = (base: string) => (ignore: string) => { + if (ignore.startsWith("!")) { + return "!" + path.posix.join(base, ignore.slice(1)); + } + return path.posix.join(base, ignore); +}; +const isFile = (filePath: string) => { + try { + return fs.statSync(filePath).isFile(); + } catch (error) { + return false; + } +}; +/** + * filter files by config + * @param {string[]} patterns glob patterns + * @param {{extensions?: string[], cwd?: string }} options + */ +export function pathsToGlobPatterns( + patterns: string[], + options: { extensions?: string[]; cwd?: string } = {} +): string[] { + const processPatterns = pathToGlob({ + extensions: options.extensions || [], + cwd: options.cwd || process.cwd() + }); + return patterns.map(processPatterns); +} +/** + * found files by glob pattern + * @param {string[]} patterns + * @param {FindFilesOptions} options + * @returns {string[]} file path list + */ +export function findFiles(patterns: string[], options: FindFilesOptions = {}): string[] { + const cwd = options.cwd || process.cwd(); + const ignoredPatterns: string[] = []; + ignoredPatterns.push(...DEFAULT_IGNORE_PATTERNS); + if (options.ignoreFilePath) { + const baseDir = path.resolve(cwd, path.dirname(options.ignoreFilePath)); + const normalizeIgnoreFilePath = path.resolve(cwd, options.ignoreFilePath); + debug("findFiles ignore baseDir: %s, normalizeIgnoreFilePath: %s", baseDir, normalizeIgnoreFilePath); + if (fs.existsSync(normalizeIgnoreFilePath)) { + const ignored = fs + .readFileSync(normalizeIgnoreFilePath, "utf-8") + .split(/\r?\n/) + .filter((line: string) => !/^\s*$/.test(line) && !/^\s*#/.test(line)) + .map(mapGitIgnorePatternTo(baseDir)); + debug("ignored: %o", ignored); + ignoredPatterns.push(...ignored); + } + } + debug("search patterns: %o", patterns); + debug("search ignore patterns: %o", ignoredPatterns); + const files: string[] = []; + const addFile = (filePath: string) => { + if (files.indexOf(filePath) === -1) { + files.push(filePath); + } + }; + patterns.forEach((pattern) => { + const file = path.resolve(cwd, pattern); + if (isFile(file)) { + addFile(fs.realpathSync(file)); + } else { + glob.sync(pattern, { + cwd, + absolute: true, + nodir: true, + ignore: ignoredPatterns + }).forEach((filePath: string) => { + // workaround for windows + // https://github.com/isaacs/node-glob/issues/74#issuecomment-31548810 + addFile(path.resolve(filePath)); + }); + } + }); + return files; +} + +/** + * @param {string[]} files + * @param {{extensions?: string[]}} [options] + * @returns {{availableFiles: string[], unAvailableFiles: string[]}} + */ +export function separateByAvailability( + files: string[], + options: { extensions?: string[] } = {} +): { availableFiles: string[]; unAvailableFiles: string[] } { + const extensions = options.extensions || []; + const availableFiles: string[] = []; + const unAvailableFiles: string[] = []; + files.forEach((filePath) => { + const extname = path.extname(filePath); + if (extensions.indexOf(extname) === -1) { + unAvailableFiles.push(filePath); + } else { + availableFiles.push(filePath); + } + }); + return { + availableFiles, + unAvailableFiles + }; +} diff --git a/node_modules/textlint/src/util/fs-promise.ts b/node_modules/textlint/src/util/fs-promise.ts new file mode 100644 index 000000000..9e8ef2787 --- /dev/null +++ b/node_modules/textlint/src/util/fs-promise.ts @@ -0,0 +1,13 @@ +// LICENSE : MIT +"use strict"; +const fs = require("fs"); +export function readFile(filePath: string): Promise { + return new Promise((resolve: any, reject: any) => { + fs.readFile(filePath, "utf-8", (error: any | undefined, result: any) => { + if (error) { + return reject(error); + } + resolve(result); + }); + }); +} diff --git a/node_modules/textlint/src/util/logger.ts b/node_modules/textlint/src/util/logger.ts new file mode 100644 index 000000000..12c7f77fe --- /dev/null +++ b/node_modules/textlint/src/util/logger.ts @@ -0,0 +1,25 @@ +// LICENSE : MIT +"use strict"; + +/* eslint-disable no-console */ + +/** + * Logger Utils class + * Use this instead of `console.log` + * Main purpose for helping linting. + */ +export class Logger { + static log(...message: any[]) { + console.log(...message); + } + + static warn(...message: any[]) { + console.warn(...message); + } + + static error(...message: any[]) { + console.error(...message); + } +} + +/* eslint-enable no-console */ diff --git a/node_modules/textlint/src/util/object-to-kernel-format.ts b/node_modules/textlint/src/util/object-to-kernel-format.ts new file mode 100644 index 000000000..eaaff28b4 --- /dev/null +++ b/node_modules/textlint/src/util/object-to-kernel-format.ts @@ -0,0 +1,69 @@ +import { + TextlintFilterRuleReporter, + TextlintKernelFilterRule, + TextlintKernelPlugin, + TextlintKernelRule, + TextlintPluginCreator, + TextlintRuleModule +} from "@textlint/kernel"; + +/** + * Convert rulesObject to TextlintKernelRule + * { + * "rule-name": rule + * }, + * { + * "rule-name": ruleOption + * } + * + * => TextlintKernelRule + */ +export const rulesObjectToKernelRule: ( + rules: { [p: string]: TextlintRuleModule }, + rulesOption: { [p: string]: TextlintKernelRule["options"] } +) => TextlintKernelRule[] = (rules, rulesOption) => { + return Object.keys(rules).map((ruleId) => { + return { + ruleId, + rule: rules[ruleId], + options: rulesOption[ruleId] + }; + }); +}; + +export const filterRulesObjectToKernelRule: ( + rules: { [p: string]: TextlintFilterRuleReporter }, + rulesOption: { [p: string]: TextlintKernelFilterRule["options"] } +) => TextlintKernelFilterRule[] = (rules, rulesOption): TextlintKernelFilterRule[] => { + return Object.keys(rules).map((ruleId) => { + return { + ruleId, + rule: rules[ruleId], + options: rulesOption[ruleId] + }; + }); +}; + +/** + * Convert pluginsObject to TextlintKernelPlugin + * { + * "plugin-name": plugin + * }, + * { + * "plugin-name": pluginOption + * } + * + * => TextlintKernelPlugin + */ +export const pluginsObjectToKernelRule = ( + plugins: { [index: string]: TextlintPluginCreator }, + pluginsOption: { [index: string]: TextlintKernelPlugin["options"] } +): TextlintKernelPlugin[] => { + return Object.keys(plugins).map((pluginId) => { + return { + pluginId, + plugin: plugins[pluginId], + options: pluginsOption[pluginId] + }; + }); +}; diff --git a/node_modules/textlint/src/util/traverse.ts b/node_modules/textlint/src/util/traverse.ts new file mode 100644 index 000000000..dde05da96 --- /dev/null +++ b/node_modules/textlint/src/util/traverse.ts @@ -0,0 +1,82 @@ +/** + * @fileoverview Simple directory traversal logic. + * @author Nicholas C. Zakas + */ +"use strict"; +import fs from "fs"; +import path from "path"; +import debug0 from "debug"; +const debug = debug0("textlint:traverse"); +/** + * Walks a path recursively calling the callback on each file. + * @param {string} name The file or directory path. + * @param {string[]} extensions The file extensions that should cause the callback + * to be called. + * @param {Function} [exclude] The function to check if file/path should be excluded. + * @param {Function} callback The function to call on each file. + * @returns {void} + * @private + */ +function walk(name: string, extensions: string[], exclude: Function, callback: Function): void { + const stat = fs.statSync(name); + /** + * @param {string} dir + * @param {string[]} stack + */ + function traverse(dir: string, stack: string[]) { + stack.push(dir); + fs.readdirSync(path.join(...stack)).forEach((file: string) => { + // skip all hidden things (dirs, files, links) + if (file[0] === ".") { + return; + } + const filePath = path.join(...stack.concat([file])); + const fileStat = fs.statSync(filePath); + // if this file or directory is excluded from linting, skip over it. + if (exclude && exclude(filePath)) { + debug(`Ignoring ${filePath}`); + return; + } + // only call callback for files with correct extensions + if (fileStat.isFile() && extensions.indexOf(path.extname(filePath)) > -1) { + callback(filePath); + } else if (fileStat.isDirectory()) { + traverse(file, stack); + } + }); + stack.pop(); + } + const basename = path.basename(name); + // don't ignore cases like 'textlint ./' + if ((basename !== "." && basename !== ".." && basename[0] === ".") || (exclude && exclude(name))) { + debug(`Ignoring ${name}`); + return; + } + // always call callback for any files that are passed on the command line + if (stat.isFile()) { + if (extensions.indexOf(path.extname(name)) > -1) { + callback(name); + } + } else { + traverse(name, []); + } +} +/** + * Traverses multiple directories and calls a callback on each file. + * @param {{files:string[], exclude:Function, extensions:string[]}} options The option for the traversal. + * param {string[]} options.files An array of file and directory paths to traverse. + * param {Function} options.exclude The function to check if file/path should be excluded. + * @param {Function} callback A function to call for each file. + * @returns {void} + */ +module.exports = function traverse( + options: { files: string[]; exclude: Function; extensions: string[] }, + callback: Function +): void { + const files = options.files; + const exclude = options.exclude; + const extensions = options.extensions; + files.forEach((file) => { + walk(file, extensions, exclude, callback); + }); +}; diff --git a/node_modules/to-regex/LICENSE b/node_modules/to-regex/LICENSE new file mode 100644 index 000000000..7c9987bc6 --- /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 000000000..5a28fc33b --- /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 000000000..a87d01591 --- /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 000000000..e4277d316 --- /dev/null +++ b/node_modules/to-regex/package.json @@ -0,0 +1,62 @@ +{ + "name": "to-regex", + "description": "Generate a regex from a string or array of strings.", + "version": "3.0.2", + "homepage": "https://github.com/jonschlinkert/to-regex", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/to-regex", + "bugs": { + "url": "https://github.com/jonschlinkert/to-regex/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "keywords": [ + "match", + "regex", + "regular expression", + "test", + "to" + ], + "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 + } + } +} diff --git a/node_modules/traverse/.eslintrc b/node_modules/traverse/.eslintrc new file mode 100644 index 000000000..4729eb60f --- /dev/null +++ b/node_modules/traverse/.eslintrc @@ -0,0 +1,44 @@ +{ + "root": true, + + "extends": "@ljharb/eslint-config/node/0.4", + + "rules": { + "array-bracket-newline": 0, + "array-callback-return": 0, + "array-element-newline": 0, + "complexity": 0, + "func-style": [2, "declaration"], + "global-require": 1, + "max-lines-per-function": 0, + "max-statements-per-line": [1, {"max": 2}], + "multiline-comment-style": 0, + "no-proto": 0, + "no-sparse-arrays": 1, + "no-underscore-dangle": 0, + "no-invalid-this": 0, + "object-curly-newline": 0, + "sort-keys": 0, + "max-lines": "warn", + }, + + "overrides": [ + { + "files": "examples/**", + "rules": { + "no-console": 0, + "no-plusplus": 0, + "no-magic-numbers": 0, + }, + }, + { + "files": [ + "test/typed-array.js", + "test/mutability.js", + ], + "globals": { + "Uint8Array": false + }, + } + ], +} diff --git a/node_modules/traverse/.github/FUNDING.yml b/node_modules/traverse/.github/FUNDING.yml new file mode 100644 index 000000000..e7dd4fa37 --- /dev/null +++ b/node_modules/traverse/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/traverse +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/node_modules/traverse/CHANGELOG.md b/node_modules/traverse/CHANGELOG.md new file mode 100644 index 000000000..4d78c1a4c --- /dev/null +++ b/node_modules/traverse/CHANGELOG.md @@ -0,0 +1,485 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v0.6.11](https://github.com/ljharb/js-traverse/compare/v0.6.10...v0.6.11) - 2025-01-15 + +### Fixed + +- [Fix] `.has` should not return true on a falsy node [`#20`](https://github.com/ljharb/js-traverse/issues/20) + +### Commits + +- [Deps] update `gopd`, `typedarray.prototype.slice`, `which-typed-array` [`cc24fd2`](https://github.com/ljharb/js-traverse/commit/cc24fd22dfab620238d60967d12a6416cbc73770) +- [Dev Deps] update `es-value-fixtures`, `tape` [`d26f1b4`](https://github.com/ljharb/js-traverse/commit/d26f1b4cf2176849ebb22a28d8072b503f66b694) + +## [v0.6.10](https://github.com/ljharb/js-traverse/compare/v0.6.9...v0.6.10) - 2024-09-12 + +### Fixed + +- [Fix] continue iterating properly when items are removed [`#18`](https://github.com/ljharb/js-traverse/issues/18) + +### Commits + +- [Robustness] minimize use of prototype methods [`14f3ef3`](https://github.com/ljharb/js-traverse/commit/14f3ef33c2f86dcc557e1978e102d3b274e83719) +- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `tape` [`c232f79`](https://github.com/ljharb/js-traverse/commit/c232f79d7202eddfbad765532a24d260e3fac5ee) +- [Refactor] protect against an impossible bug [`368e82c`](https://github.com/ljharb/js-traverse/commit/368e82c5d8141e212ecaea1b3496c61af0e93bfe) +- [Tests] replace `aud` with `npm audit` [`343a68f`](https://github.com/ljharb/js-traverse/commit/343a68f0a73878150e42385434909ea60a2823e9) +- [Robustness] use a null object in `modifiers` [`8edc266`](https://github.com/ljharb/js-traverse/commit/8edc2669ba22e0112bb7f68bf8e3c99b018f0f51) +- [Dev Deps] add missing peer dep [`ecfc692`](https://github.com/ljharb/js-traverse/commit/ecfc6922eec7dde1dfd97d6048e638ef8de828d7) + +## [v0.6.9](https://github.com/ljharb/js-traverse/compare/v0.6.8...v0.6.9) - 2024-04-08 + +### Commits + +- [New] support cloning Typed Arrays [`18c32c5`](https://github.com/ljharb/js-traverse/commit/18c32c5ba8ebc84344925198bb29b6def97471fd) +- [New] [Fix] add `includeSymbols` option; partial revert of "[New] support enumerable Symbol properties" [`aab373f`](https://github.com/ljharb/js-traverse/commit/aab373f503f80f62ea958124c0cc9321f9fe0b78) +- [Fix] Add "isWritable" before writing to properties [`595d64e`](https://github.com/ljharb/js-traverse/commit/595d64e307452b805c4d209a6f77916e54c031ab) +- [actions] remove redundant finisher [`7539473`](https://github.com/ljharb/js-traverse/commit/7539473f969589ca19eee197d02b568b299cfebc) +- [Refactor] use an internal null options object instead of an `immutable` boolean [`0f1e6f1`](https://github.com/ljharb/js-traverse/commit/0f1e6f126a3d847864d3a80fc8227a2bb1f97c78) +- [Deps] update `typedarray.prototype.slice`, `which-typed-array` [`165f954`](https://github.com/ljharb/js-traverse/commit/165f954e540975b4a5db7f4b7134de2c0b48ee29) +- [Deps] update `typedarray.prototype.slice` [`ed483ed`](https://github.com/ljharb/js-traverse/commit/ed483ed7aa1cc85e8d7e25d2b2cd1e0881eb6522) +- [Dev Deps] update `tape` [`5ee670c`](https://github.com/ljharb/js-traverse/commit/5ee670cdc074026f087f18860d80a30c86921e46) + +## [v0.6.8](https://github.com/ljharb/js-traverse/compare/v0.6.7...v0.6.8) - 2023-12-20 + +### Commits + +- [New] support enumerable Symbol properties [`7d659e7`](https://github.com/ljharb/js-traverse/commit/7d659e78d43e69e6afc604e12b3ba3a5def0e46f) +- [actions] use reusable rebase action [`8a04a68`](https://github.com/ljharb/js-traverse/commit/8a04a68ea1b9651a4f07a2c87fb58c98633a9714) +- [meta] update license text so GitHub can identify it [`f94bda4`](https://github.com/ljharb/js-traverse/commit/f94bda4e5734f76891d8c3455b136ec615c9e6ce) +- [eslint] fix indentation [`7c907d6`](https://github.com/ljharb/js-traverse/commit/7c907d6d9cc476a02672c0b198e99205fca8e739) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`8ca47dc`](https://github.com/ljharb/js-traverse/commit/8ca47dcbab9210716b0085f03771c8bb60a83c15) +- [Tests] Stop equal Dates from being flaky [`b5a9d3a`](https://github.com/ljharb/js-traverse/commit/b5a9d3a20ab64a3231b3ef5ac63b92f078d52946) +- [meta] add missing `engines.node` [`22952cf`](https://github.com/ljharb/js-traverse/commit/22952cf05165fc1ea1e148b2ddc2217ef1ecaa7e) +- [actions] update checkout action [`17d9faa`](https://github.com/ljharb/js-traverse/commit/17d9faa97c3b532d9b29ce44b13421c11e839629) +- [actions] update checkout action [`5462b41`](https://github.com/ljharb/js-traverse/commit/5462b4187387a625ce4efd564c4fb85e7d6c922f) + +## [v0.6.7](https://github.com/ljharb/js-traverse/compare/v0.6.6...v0.6.7) - 2022-10-12 + +### Commits + +- [eslint] fix indentation and whitespace [`89fc65c`](https://github.com/ljharb/js-traverse/commit/89fc65c5c9f2778cb63d583b1fcd83a31ca104f4) +- [eslint] cleanup [`1921966`](https://github.com/ljharb/js-traverse/commit/1921966fff1933e086d413acc44c2cf43a130fae) +- [meta] add `auto-changelog` [`c291ed2`](https://github.com/ljharb/js-traverse/commit/c291ed225c7b5257372a3d30951eaefc186107e7) +- [actions] add reusable workflows [`9a8fd34`](https://github.com/ljharb/js-traverse/commit/9a8fd34a6111f3f6dff43a7f22d272c46243d68f) +- [Dev Deps] update `tape` [`afd6a95`](https://github.com/ljharb/js-traverse/commit/afd6a95c5ab6b8ed2e29d044b5ff8724ed992c4d) +- [eslint] add eslint [`559372e`](https://github.com/ljharb/js-traverse/commit/559372ec96b460c45953c4c00f931f7fee36dce7) +- [readme] rename, add badges [`0e613fd`](https://github.com/ljharb/js-traverse/commit/0e613fdf7d3712e9b18a678d45cadd639233c79e) +- [meta] create FUNDING.yml; add `funding` in package.json [`26a9ae3`](https://github.com/ljharb/js-traverse/commit/26a9ae3a2e6ff06a3af9f1301ec4ef08ceb99bec) +- [meta] use `npmignore` to autogenerate an npmignore file [`0e09fe6`](https://github.com/ljharb/js-traverse/commit/0e09fe6105466f5e11ff4e1d12fa5cb77848b900) +- Only apps should have lockfiles [`e1ac253`](https://github.com/ljharb/js-traverse/commit/e1ac253acfa4917617c01b7d76d80741cbe379ce) +- [meta] update URLs [`035e2c0`](https://github.com/ljharb/js-traverse/commit/035e2c05c52acde26d5c13599748a901d1bbf237) +- [meta] add `safe-publish-latest` [`c2797ac`](https://github.com/ljharb/js-traverse/commit/c2797ac1218e9c8da1a9dd3863ecf3698e57878f) +- [Tests] add `aud` in `posttest` [`ff93f53`](https://github.com/ljharb/js-traverse/commit/ff93f5380201ccbd0bf22188ed4943b739174589) + +## [v0.6.6](https://github.com/ljharb/js-traverse/compare/v0.6.5...v0.6.6) - 2013-09-23 + +### Commits + +- remove tap as a dep to get around the cyclic library issues [`85e1b23`](https://github.com/ljharb/js-traverse/commit/85e1b23ea360b4e6918f998c95ef84d8a0d9a1d2) +- guard for the presence of getTime [`98f278a`](https://github.com/ljharb/js-traverse/commit/98f278a34a957134688e147ec65b1b1115244234) +- use getTime() for firefox browser support [`ee928ca`](https://github.com/ljharb/js-traverse/commit/ee928ca5c2b6a3b19cecd01a743d38d3cddaccf5) + +## [v0.6.5](https://github.com/ljharb/js-traverse/compare/v0.6.4...v0.6.5) - 2013-08-30 + +### Commits + +- merge the null fix [`c405df2`](https://github.com/ljharb/js-traverse/commit/c405df2c8a8d49321ac8081b928b4e5df5f80237) +- fix for Cannot convert null to object at hasOwnProperty (native) when node is null [`d9f52fa`](https://github.com/ljharb/js-traverse/commit/d9f52fa400c53f5bf1b5e388c0dd457c4dc651e3) + +## [v0.6.4](https://github.com/ljharb/js-traverse/compare/v0.6.3...v0.6.4) - 2012-12-17 + +### Commits + +- upgraded readme [`c45db75`](https://github.com/ljharb/js-traverse/commit/c45db75c4a606b724156e50b14688b503e146cf3) +- using tape [`5c8e966`](https://github.com/ljharb/js-traverse/commit/5c8e966e8636fdab2c55cac0e4e0958f06f7ca1f) +- using testling-ci [`73f3061`](https://github.com/ljharb/js-traverse/commit/73f306146afa8ccc884cb0d43788338e294320cc) +- hasOwnProperty stub [`c889666`](https://github.com/ljharb/js-traverse/commit/c889666d81d79cbfd99372bea641e6938bd5531c) +- add a comma [`3f8d778`](https://github.com/ljharb/js-traverse/commit/3f8d778dbc0b070c972839fd1ac23b253a99cce2) + +## [v0.6.3](https://github.com/ljharb/js-traverse/compare/v0.6.2...v0.6.3) - 2012-06-18 + +### Commits + +- 0.6.3, fixes bugs when the replacement for an object is not an object [`09f560c`](https://github.com/ljharb/js-traverse/commit/09f560c0f910a9ac76fa0fc507655627cda6dd6f) +- fixed merge conflicts [`576832a`](https://github.com/ljharb/js-traverse/commit/576832a2e4d91197b88a002dec643310fa9b3b26) +- Update state with the current node before recursing [`3857dca`](https://github.com/ljharb/js-traverse/commit/3857dcaeaceca9a739300b0b846c1094ddf3b26f) +- Add test for replacing objects with strings and vice-versa [`28d5fb6`](https://github.com/ljharb/js-traverse/commit/28d5fb64e44237e21c01904d6e46b34626d66d33) +- s/Object_keys/objectKeys/g [`ef3694f`](https://github.com/ljharb/js-traverse/commit/ef3694f1fcfe948c39a5caaded33480bcbdafdfa) +- Only set state.keys when necessary [`ee66cd1`](https://github.com/ljharb/js-traverse/commit/ee66cd1c71db7701769323548916ce860f442d03) +- Fix crash when node is a string and this.update is called with an object. [`5c6f161`](https://github.com/ljharb/js-traverse/commit/5c6f161f2006df87f231317f3413bc38ad799b7d) + +## [v0.6.2](https://github.com/ljharb/js-traverse/compare/v0.6.1...v0.6.2) - 2012-06-16 + +### Commits + +- using tap [`4f4a3e5`](https://github.com/ljharb/js-traverse/commit/4f4a3e504e702bffa88ea15b687a3712b56938dd) +- re-generate the package.json [`99a0a15`](https://github.com/ljharb/js-traverse/commit/99a0a159b28d8175c159a208e276256a0240c056) +- fix to reconstruct prototypes in browsers without Object.create() [`0cb3f34`](https://github.com/ljharb/js-traverse/commit/0cb3f349e381109287c9fac1391472796b7fc0bd) +- using travis [`57e7ccd`](https://github.com/ljharb/js-traverse/commit/57e7ccd6b10e92e737ef41b332172b38b4d5cc2e) +- s/^js-// [`1c2bae3`](https://github.com/ljharb/js-traverse/commit/1c2bae3a286b38c5f7cd22ffe4bbcc165bab7245) +- drop 0.4 [`2331189`](https://github.com/ljharb/js-traverse/commit/2331189e047b94fc95edc6f6fce11cb0cfcbb435) + +## [v0.6.1](https://github.com/ljharb/js-traverse/compare/v0.6.0...v0.6.1) - 2012-04-06 + +### Commits + +- check builtins using the toString.call trick [`459378b`](https://github.com/ljharb/js-traverse/commit/459378b6dd18ea95e9a012fd96a5d0d30ce83d64) +- support for traversing an Error object. [`642dd51`](https://github.com/ljharb/js-traverse/commit/642dd51c41ca7e41774bbde948913d9a7996633e) +- fixed the tests for how typeof a regex is now "object" [`9250084`](https://github.com/ljharb/js-traverse/commit/925008491725beec15216147329f3df907285975) +- less annoying constructor [`2c5f693`](https://github.com/ljharb/js-traverse/commit/2c5f693b60daa8b0f2cc9566fa62ec6b733d6a84) +- bump for error fixes [`6b78600`](https://github.com/ljharb/js-traverse/commit/6b78600f53284b324e733f836b9fd3b47fa5b28d) + +## [v0.6.0](https://github.com/ljharb/js-traverse/compare/v0.5.2...v0.6.0) - 2012-02-20 + +### Commits + +- has() with tests, documented get() and set() too [`aeebf14`](https://github.com/ljharb/js-traverse/commit/aeebf1466c2b7b5660545cc4365b0a66bc54a765) + +## [v0.5.2](https://github.com/ljharb/js-traverse/compare/v0.5.1...v0.5.2) - 2011-10-16 + +### Commits + +- Should be able to stop traversing when removing or deleting [`4aa61ef`](https://github.com/ljharb/js-traverse/commit/4aa61ef874d81a633aec4b72c3b2bc5ede64947f) +- relative requires for the tests [`9d4d4c5`](https://github.com/ljharb/js-traverse/commit/9d4d4c5d4c3abb9ef38c6f878a7ee8c61f0264c1) +- Added documentation for stopHere-flag on remove and delete [`2bb8018`](https://github.com/ljharb/js-traverse/commit/2bb80186f15d860cd5e17934c270bd0814236004) +- bump for stopHere on delete and remove [`a23839a`](https://github.com/ljharb/js-traverse/commit/a23839a473d0e91814911210f01d2ec4a95d1098) + +## [v0.5.1](https://github.com/ljharb/js-traverse/compare/v0.5.0...v0.5.1) - 2011-08-23 + +### Commits + +- fix for brokenness in IE with using the wrong variable name for the prototype checking [`4cb7bcb`](https://github.com/ljharb/js-traverse/commit/4cb7bcbd155df29268c8b8fc249f0f838aaa94f3) + +## [v0.5.0](https://github.com/ljharb/js-traverse/compare/v0.4.6...v0.5.0) - 2011-08-23 + +### Commits + +- spun off deepEqual into a utility library [`9d5148a`](https://github.com/ljharb/js-traverse/commit/9d5148a22dbe1484286c216959625168275457db) +- traverse now works with all the IEs [`96d9e25`](https://github.com/ljharb/js-traverse/commit/96d9e2564fc0f1413a7a1371cfd9cc5600896771) +- tests all updated for the removal of deepEqual from the main lib [`9ebde92`](https://github.com/ljharb/js-traverse/commit/9ebde9226720231d4390ebdaea04a0c4652caf21) +- stubs for non-es5 browsers, didn't break any unit tests [`559a6f1`](https://github.com/ljharb/js-traverse/commit/559a6f18873d48a97b293c058cc2a8f334dfd535) + +## [v0.4.6](https://github.com/ljharb/js-traverse/compare/v0.4.5...v0.4.6) - 2011-07-27 + +### Commits + +- some minor adjustments to expose keys for sibling calculations [`a936bea`](https://github.com/ljharb/js-traverse/commit/a936bea1e4d164ab33459352234eaea9a1d84a38) + +## [v0.4.5](https://github.com/ljharb/js-traverse/compare/v0.4.4...v0.4.5) - 2011-07-24 + +### Commits + +- include circular ref example in the readme, Traverse => traverse [`4a6285f`](https://github.com/ljharb/js-traverse/commit/4a6285f71f4220550d4587090fd832ec9fcb10b7) +- scrub example [`ec1fb18`](https://github.com/ljharb/js-traverse/commit/ec1fb18b494f1bcb6b1ce4a2a86dce6560ae746d) +- bump for exposing parents [`5cb4ecb`](https://github.com/ljharb/js-traverse/commit/5cb4ecb37b2af64367f466cd1994d18c45def070) +- export 'parents' to context [`5af2f8d`](https://github.com/ljharb/js-traverse/commit/5af2f8d24e2e9dce5c43ae5abbe2ff23384610fc) + +## [v0.4.4](https://github.com/ljharb/js-traverse/compare/v0.4.3...v0.4.4) - 2011-07-20 + +### Commits + +- allow setting of keys (ordering) in before modifier [`9fb8e2c`](https://github.com/ljharb/js-traverse/commit/9fb8e2c126e5bcec59e382b59e040ae764ea9045) +- note about this.keys, bump [`1148bc7`](https://github.com/ljharb/js-traverse/commit/1148bc7603411c423b41a5cb396b27ab6ca2c565) + +## [v0.4.3](https://github.com/ljharb/js-traverse/compare/v0.4.2...v0.4.3) - 2011-06-14 + +### Commits + +- bump to 0.4.3 for guybrush's IE fixes [`c74a7ea`](https://github.com/ljharb/js-traverse/commit/c74a7eaa83edb86e20b2427bbd2068339b385aa8) +- another fix for IE [`ed86376`](https://github.com/ljharb/js-traverse/commit/ed86376b826284a858d040f8d0a40532a8d4d919) +- fix for IE [`35949ef`](https://github.com/ljharb/js-traverse/commit/35949ef979662e6a9118beca80d0f6a080828ddc) + +## [v0.4.2](https://github.com/ljharb/js-traverse/compare/v0.4.1...v0.4.2) - 2011-06-11 + +### Commits + +- bump to 0.4.2 for this.block() with a passing test [`d945818`](https://github.com/ljharb/js-traverse/commit/d945818e0e489d9ffe2dd25ea64c598085139c69) +- note about stopHere for update() in the readme [`18f3e27`](https://github.com/ljharb/js-traverse/commit/18f3e273c7ec22b7121438d517eaeb7832f18d99) + +## [v0.4.1](https://github.com/ljharb/js-traverse/compare/v0.4.0...v0.4.1) - 2011-06-10 + +### Commits + +- moved stop behavior in updates into a second keepGoing argument [`1d31897`](https://github.com/ljharb/js-traverse/commit/1d318974255df34a821da53cb3d573153a0682b2) + +## [v0.4.0](https://github.com/ljharb/js-traverse/compare/v0.3.8...v0.4.0) - 2011-06-10 + +### Commits + +- an amazing number of test descriptions were getting ignored [`1d043f0`](https://github.com/ljharb/js-traverse/commit/1d043f09e6eb6ecf8456295efdbe4e7298f7c3c8) +- better failing super deep test [`01d35ce`](https://github.com/ljharb/js-traverse/commit/01d35ce70d514243d1854bd4c50eb0fa5321ef2b) +- stop() passes its test [`79d615f`](https://github.com/ljharb/js-traverse/commit/79d615f8dc60dc491da82d80f0fdab1a53974d3d) +- passing test for deep reduce and this.stop() [`9aea0a1`](https://github.com/ljharb/js-traverse/commit/9aea0a10cdd48f23ef40aeaee54f2d50053d77ff) +- subexpr test passes by checking if update() happened [`44e731b`](https://github.com/ljharb/js-traverse/commit/44e731b972b864b1de1ef315bf1ce4dbba3a7d67) +- passing new tests yay [`3d5057a`](https://github.com/ljharb/js-traverse/commit/3d5057a832c14f51d07ddb7f3331769c37f6192d) +- failing test for this.stop() [`090c3d4`](https://github.com/ljharb/js-traverse/commit/090c3d4d2de99586ad89a8b51ab8ea5664747e3e) +- subexpressions from update()s shouldn't be traversed, failing test [`be2b574`](https://github.com/ljharb/js-traverse/commit/be2b5746670b213d1c57c8f1f6d59a78e8ff88e6) +- passing test for stop map too hooray [`0ee24cc`](https://github.com/ljharb/js-traverse/commit/0ee24cc01673ea3dfd63e854b70bcd7b36b9884d) +- test for arity shows more bugs [`da698d6`](https://github.com/ljharb/js-traverse/commit/da698d6c7f5b712c9d89b3fa42a00b9cf2b42b4c) + +## [v0.3.8](https://github.com/ljharb/js-traverse/compare/v0.3.7...v0.3.8) - 2011-06-06 + +### Commits + +- tests for some bugs in deepEqual [`2b15a41`](https://github.com/ljharb/js-traverse/commit/2b15a410f723f0ed5b3bdc019803deff7d70b7c0) +- deep equal tests now pass, delete map tests fail though [`bfdc40e`](https://github.com/ljharb/js-traverse/commit/bfdc40e35f7a3ec3acf96f7f8599602747ef999d) +- delete map redux test also passes for deleted element construction syntax [,,,] etc [`56553ff`](https://github.com/ljharb/js-traverse/commit/56553ff7753e21480023caa488791a4d88f36673) +- now passing all the equality tests again [`6721461`](https://github.com/ljharb/js-traverse/commit/6721461c4fc1323c5784f16ee5efcd7a18d77122) +- tests for remove() and delete() [`f5d429a`](https://github.com/ljharb/js-traverse/commit/f5d429a15a77e2a7ce33c2485a2b3ee43f41d341) +- remove tests [`7010fe2`](https://github.com/ljharb/js-traverse/commit/7010fe2bdc568f59576da576c09b5a7c90291b89) +- better failing levels test for deepEqual [`73efbe5`](https://github.com/ljharb/js-traverse/commit/73efbe5ea5f2c61c8c3f6e4cd6fbc2d290e33188) +- failing deepEqual comparison with undefined throws [`0a6d27d`](https://github.com/ljharb/js-traverse/commit/0a6d27d139baefbd2a19411a6a4805b2bbd5d664) +- remove unused seq devDependency, bump expresso version [`0c1e021`](https://github.com/ljharb/js-traverse/commit/0c1e0218a991fa6fd71468ee54cdd364cab5d1b5) + +## [v0.3.7](https://github.com/ljharb/js-traverse/compare/v0.3.6...v0.3.7) - 2011-06-05 + +### Commits + +- now with syntax-highlightable markdown snippets [`d4a7710`](https://github.com/ljharb/js-traverse/commit/d4a771015d6483859784a585912a816bd4d82484) +- failing circular map scrub test [`9f36635`](https://github.com/ljharb/js-traverse/commit/9f3663533d34d4280c6dd49387a8516b40ae67c4) +- fix for immutable removal, bump to 0.3.7 [`9528471`](https://github.com/ljharb/js-traverse/commit/9528471cad4bbe810d7b10133f53ea0937e6667d) + +## [v0.3.6](https://github.com/ljharb/js-traverse/compare/v0.3.5...v0.3.6) - 2011-06-03 + +### Commits + +- tests for not-yet-written deepEqual() [`5267ae1`](https://github.com/ljharb/js-traverse/commit/5267ae183ac44d82438da0c3665a31c456e27fdb) +- deepEqual now passes several tests [`6fe06a5`](https://github.com/ljharb/js-traverse/commit/6fe06a5a7e7d76e4cdeaae148fbd40964a8bd478) +- dox for deepEqual [`5eab662`](https://github.com/ljharb/js-traverse/commit/5eab662f486e423e8d1d4bde65c47f99243aa1fe) +- untested get and set [`7fa7247`](https://github.com/ljharb/js-traverse/commit/7fa7247dcfe2b2ddcc0ea9ecd2c7329a1e034151) +- missing comma fixed the regexp test and also an implementation for typeof "function" [`fc23e4f`](https://github.com/ljharb/js-traverse/commit/fc23e4fb50e8adf0891c416c994390b02545a197) +- a passing test for the other case of structural deep circular reference checking [`04e5492`](https://github.com/ljharb/js-traverse/commit/04e54928da73b2d02a4430bfa79e2505af51068a) +- some tests were wrong, regexp test rightly still fails [`b9d1110`](https://github.com/ljharb/js-traverse/commit/b9d11107f62367453eaf707b2cb29df1533043ea) +- circular test for topological circular equality passes [`b423996`](https://github.com/ljharb/js-traverse/commit/b4239962ab0312d660a7895b74fda36368d057f9) +- and another test just in case for non-root circular ref checks [`a914717`](https://github.com/ljharb/js-traverse/commit/a9147171961cbf7ae8a9a45fb73cd3c0591da33b) +- actually check function equality, all tests now passing [`cb7c1b0`](https://github.com/ljharb/js-traverse/commit/cb7c1b04cb7b4b1037419349000e96b13d824ab7) + +## [v0.3.5](https://github.com/ljharb/js-traverse/compare/v0.3.4...v0.3.5) - 2011-05-28 + +### Commits + +- took out up-front cloning, only fails date test [`718d01b`](https://github.com/ljharb/js-traverse/commit/718d01b06cdb9f9c948d1ac5886a7a3fc17d1008) +- cleaned up root handling, fails circDubMap still [`9ed99f3`](https://github.com/ljharb/js-traverse/commit/9ed99f3dd74123c17eb2787bfac6207c643d39d6) +- updated tests for expresso updates ages ago [`f95bf5e`](https://github.com/ljharb/js-traverse/commit/f95bf5e0eb7300832d326960289ec7f395630bfd) +- passes all its tests again [`d0dac52`](https://github.com/ljharb/js-traverse/commit/d0dac529201dc8b3e6a7dba3d853d839b746ffbf) + +## [v0.3.4](https://github.com/ljharb/js-traverse/compare/v0.3.3...v0.3.4) - 2011-04-16 + +### Commits + +- updated readme for this.delete() and this.remove() [`e4cea30`](https://github.com/ljharb/js-traverse/commit/e4cea309a1f035400c8f4e9ebd55e6e0cecf8a35) +- quote the delete keyword [`42d0460`](https://github.com/ljharb/js-traverse/commit/42d0460fc6624a38775bd65a4788cfa8b3f08825) + +## [v0.3.3](https://github.com/ljharb/js-traverse/compare/v0.3.2...v0.3.3) - 2011-04-15 + +### Commits + +- this.remove() and this.delete() with passing tests [`d603771`](https://github.com/ljharb/js-traverse/commit/d603771e1381e0d62c70bc1f47736c8eaa6cfa6f) + +## [v0.3.2](https://github.com/ljharb/js-traverse/compare/v0.3.1...v0.3.2) - 2011-04-10 + +### Commits + +- now traverses over dates correctly and should work for other builtins [`bb8d1b5`](https://github.com/ljharb/js-traverse/commit/bb8d1b567489a94507941f4a6bda2224ed2d9692) +- failing date map test [`a504425`](https://github.com/ljharb/js-traverse/commit/a504425aa3021371f67498b27d4a98e6f7a4283f) +- forgot the console.dir [`fb2c472`](https://github.com/ljharb/js-traverse/commit/fb2c4729ac1a7824358ee04ea840a35ac3ea17af) + +## [v0.3.1](https://github.com/ljharb/js-traverse/compare/v0.3.0...v0.3.1) - 2011-02-18 + +### Commits + +- updated readme and examples for the new interface changes [`aa2d4f3`](https://github.com/ljharb/js-traverse/commit/aa2d4f3f1cc88a230cdb8fae3b1b416773860ef4) +- mutability tests all pass [`36df874`](https://github.com/ljharb/js-traverse/commit/36df874ae431b0e31dc809c0b949073774f624b4) +- updated tests to not use sys anymore [`7a0969f`](https://github.com/ljharb/js-traverse/commit/7a0969fbb39a7a66f4bd46ca8172edef15b675ea) +- simpler clone implementation [`6a6cb49`](https://github.com/ljharb/js-traverse/commit/6a6cb49f2da571470a6b024b1e8db5ef2080b946) +- double circular ref test failing, not aggressive enough [`d190897`](https://github.com/ljharb/js-traverse/commit/d190897a9763549e2a077c01378520d519b402f7) +- reduce() now too [`c89ae4b`](https://github.com/ljharb/js-traverse/commit/c89ae4be025534494422cc1265f50595828398b3) +- fix for isRoot, check path.length, not node === root [`423066e`](https://github.com/ljharb/js-traverse/commit/423066e821070ffb8f8a29022175b08f4bfc5d99) +- passing circular ref update forEach test but failing for likewise with map [`d411695`](https://github.com/ljharb/js-traverse/commit/d4116955a4fbc00a2fd716e3885e334b9664d670) +- trade some space savings for less agressive circular reference algorithm (the same as console.dir it seems) [`ee52d80`](https://github.com/ljharb/js-traverse/commit/ee52d80d2b18ea069f38039b210f68b00aa29d4b) +- failing test for circular ref updates [`42b6b84`](https://github.com/ljharb/js-traverse/commit/42b6b84917f34f80729339127360c36bd62fa9bd) + +## [v0.3.0](https://github.com/ljharb/js-traverse/compare/v0.2.4...v0.3.0) - 2011-02-18 + +### Commits + +- completely rewrote Traverse, deleted hash.js and web.js [`414c726`](https://github.com/ljharb/js-traverse/commit/414c72637807c0e6e86f38f66146d729d0bbf3f2) +- tests pass again with the rewrite [`f0f76cc`](https://github.com/ljharb/js-traverse/commit/f0f76cc6b08849644a79a828e249be2d8896797a) + +## [v0.2.4](https://github.com/ljharb/js-traverse/compare/v0.2.3...v0.2.4) - 2011-02-03 + +### Commits + +- for some silly reason I was requiring sys [`95712d9`](https://github.com/ljharb/js-traverse/commit/95712d9de9e6182860418754690bb98c40462d62) + +## [v0.2.3](https://github.com/ljharb/js-traverse/compare/v0.2.2...v0.2.3) - 2010-11-19 + +### Commits + +- a hash exclude test and a package bump [`536b93d`](https://github.com/ljharb/js-traverse/commit/536b93dc0474a27a0f5c3f53b8a80cf3eb32e4e4) +- exclude to remove keys [`752f64f`](https://github.com/ljharb/js-traverse/commit/752f64f66da9fb424a4f78fc2d4ad0ef096ba65d) + +## [v0.2.2](https://github.com/ljharb/js-traverse/compare/v0.2.1...v0.2.2) - 2010-10-25 + +### Commits + +- detect test, package bump [`04b1d50`](https://github.com/ljharb/js-traverse/commit/04b1d50e73870026fd21ab9ccea609c3f1351080) +- detect like in ruby [`441f3b4`](https://github.com/ljharb/js-traverse/commit/441f3b4bef547cb4b07b10e139fa68ec1b9b4a95) + +## [v0.2.1](https://github.com/ljharb/js-traverse/compare/v0.2.0...v0.2.1) - 2010-09-11 + +### Commits + +- better compatability fallbacks for ff, maybe ie [`33577aa`](https://github.com/ljharb/js-traverse/commit/33577aae0ccdc441e40fab0a945d831805cc8148) +- compact and size for Hash (can't do .length since the function prototype has that) [`b9e6db5`](https://github.com/ljharb/js-traverse/commit/b9e6db57addbcc67a1cfec0ab9a380573d0cab8e) +- more correct string behavior in stringify example [`b9750ff`](https://github.com/ljharb/js-traverse/commit/b9750ff32be6ad76892bdf01a533bd13907d92f7) + +## [v0.2.0](https://github.com/ljharb/js-traverse/compare/v0.1.4...v0.2.0) - 2010-09-08 + +### Commits + +- deepEquals to make the tests simpler [`a962ed8`](https://github.com/ljharb/js-traverse/commit/a962ed8d0e5e3baf8279e5b3bf2476e5d2c7dbb8) +- top-level Hash functions more closely mirror Hash() functions [`35298be`](https://github.com/ljharb/js-traverse/commit/35298be61b782681f6d0a555a0ab8db673419293) +- .has with tests [`02727cf`](https://github.com/ljharb/js-traverse/commit/02727cfe1d86cf6c36daa700513861fe1f4a8066) +- test for valuesAt and now takes a single non-array key too [`3487771`](https://github.com/ljharb/js-traverse/commit/348777160fe2008186d5089fddd8e5686d0c1c3a) +- take out memoization since it breaks if the hash gets modified outside the fluent interface [`67b6d3d`](https://github.com/ljharb/js-traverse/commit/67b6d3d5ea7d8ed7127f7f9129660510f9292716) +- zip and zip constructor [`616514e`](https://github.com/ljharb/js-traverse/commit/616514ebd72a9c8a4e4b59763ee0462dcae89de0) +- zip test passes [`0226636`](https://github.com/ljharb/js-traverse/commit/0226636db7b8d3a49c2a7cbb26d18f7eeba061c1) + +## [v0.1.4](https://github.com/ljharb/js-traverse/compare/v0.1.3...v0.1.4) - 2010-09-08 + +### Commits + +- test for compact passes [`ec171ba`](https://github.com/ljharb/js-traverse/commit/ec171bab4d2b2339752cbab00c0d4b65652de0f0) +- compact like in ruby, but for hashes [`0d8e1e6`](https://github.com/ljharb/js-traverse/commit/0d8e1e624005b58aecd6a6dddaefc20da33cdf4a) + +## [v0.1.3](https://github.com/ljharb/js-traverse/compare/v0.1.2...v0.1.3) - 2010-09-04 + +### Commits + +- add stringify to examples [`6683529`](https://github.com/ljharb/js-traverse/commit/668352964878c1f896b3f57b69a989717c0fae5c) +- now isArray and instanceof works for arrays [`fa2d72b`](https://github.com/ljharb/js-traverse/commit/fa2d72b33705adccc74bf12e94e4e68d7261469c) + +## [v0.1.2](https://github.com/ljharb/js-traverse/compare/v0.1.1...v0.1.2) - 2010-09-04 + +### Commits + +- pushed walk() out of map [`e7ec7de`](https://github.com/ljharb/js-traverse/commit/e7ec7dee4b33968b0b380e54202d5d01af5e9a80) +- modifiers seem to work [`f0ee567`](https://github.com/ljharb/js-traverse/commit/f0ee567968c4b218ae729d76520ab2f3fe2c372f) +- stringify test for new modifiers [`6de18e5`](https://github.com/ljharb/js-traverse/commit/6de18e5012578b4a71faf442962ce999fc72624c) +- before, after, and between callbacks to fancier traversing [`5662b6f`](https://github.com/ljharb/js-traverse/commit/5662b6f5265bfec32dccb999b9749cf2569e7d9f) +- updated readme and negative example with new style [`5aa3f84`](https://github.com/ljharb/js-traverse/commit/5aa3f84584fb1a74652485e3cf809f5982a4cb88) +- deprecated .get() in favor of .value [`a8d1645`](https://github.com/ljharb/js-traverse/commit/a8d1645665ebb832ff82eca3317e61bf62ca83ed) +- non-coerced root test fixes an odd bug with array traversal [`f22580a`](https://github.com/ljharb/js-traverse/commit/f22580aacec7b2eb60c38ba8ba1b89324ed3e209) + +## [v0.1.1](https://github.com/ljharb/js-traverse/compare/v0.1.0...v0.1.1) - 2010-09-04 + +### Commits + +- only update when this.update is still around, tests for Traverse.functions [`cc59d56`](https://github.com/ljharb/js-traverse/commit/cc59d56b994759f6acd9efd70d9063ea40f45fbf) +- deprecate modify in favor of map [`f018025`](https://github.com/ljharb/js-traverse/commit/f018025989afdd6c9474d9e9095331500826d553) +- fix nodes and paths [`78edd30`](https://github.com/ljharb/js-traverse/commit/78edd30685e1d47deac4edd7bdd1e1b360a0244f) +- use return values to auto-update [`bc68fa5`](https://github.com/ljharb/js-traverse/commit/bc68fa5426363872835f1b4b73b8abf7920c9bfc) + +## [v0.1.0](https://github.com/ljharb/js-traverse/compare/v0.0.9...v0.1.0) - 2010-09-03 + +### Commits + +- circular refs don't crash it now [`2cdd854`](https://github.com/ljharb/js-traverse/commit/2cdd85460054f91e3130b269a6020e20cb59d7c0) +- new top-level map forEach paths and nodes [`e508823`](https://github.com/ljharb/js-traverse/commit/e5088233c9e09221f2ac766bd95c0ea55e7d0761) +- package bump to 0.1.0 and should work in IE better now too [`4400d88`](https://github.com/ljharb/js-traverse/commit/4400d886d7e33dd811121e7cd5ac5a31a0ca25b0) + +## [v0.0.9](https://github.com/ljharb/js-traverse/compare/v0.0.8...v0.0.9) - 2010-08-27 + +### Commits + +- broke up test into separate exports [`92046a4`](https://github.com/ljharb/js-traverse/commit/92046a4e0622d0db9502a2d6090041935d1bede6) +- forgot the return in ('traverse/web').source() [`188ee17`](https://github.com/ljharb/js-traverse/commit/188ee170de8b087a6bbec6dad92b39a0f1ffc67e) + +## [v0.0.8](https://github.com/ljharb/js-traverse/compare/v0.0.7...v0.0.8) - 2010-08-26 + +### Commits + +- memoization for keys, values, length [`9cffe15`](https://github.com/ljharb/js-traverse/commit/9cffe158a70f4945a6bf000dace4eddf4ca2c344) +- merge, update, and tap [`df5b737`](https://github.com/ljharb/js-traverse/commit/df5b737a7b82711261be325b7f9aa0e7aedc6804) +- length, clone, and copy [`249ec0f`](https://github.com/ljharb/js-traverse/commit/249ec0fcd2b62c6701488c17083433049060ae15) +- updated readme and f.call(self) [`03f6f1e`](https://github.com/ljharb/js-traverse/commit/03f6f1e03c9ccc2a6afb0525393acde13d2b009f) +- more explicit about the licensing (MIT/X11) [`c452103`](https://github.com/ljharb/js-traverse/commit/c4521038e845878ebb20984204f1db7520df9cad) +- oh right and this example file [`d98c125`](https://github.com/ljharb/js-traverse/commit/d98c125d9f9f17ca08260ed57ede2b1fac26da11) +- updated readme for hash traversal [`a56b629`](https://github.com/ljharb/js-traverse/commit/a56b629aae33e6bfe45bc3ec72b65bc84536f57b) +- tests for update, concat, and merge all pass [`7fc4eca`](https://github.com/ljharb/js-traverse/commit/7fc4ecaf203924becd9c88d800216ddad7ecbd4b) +- updated readme for hash stuff [`094ab55`](https://github.com/ljharb/js-traverse/commit/094ab556f795e554e8227016d8fd6acc36f0257c) +- more tests, all pass [`2d9f7a2`](https://github.com/ljharb/js-traverse/commit/2d9f7a245ac6793e8e58ba4c751e551650cfbaac) +- key and value getters [`459def9`](https://github.com/ljharb/js-traverse/commit/459def9529e381d38909f75b182b330e20d3f2f9) +- stupid markdown parens [`0bd932b`](https://github.com/ljharb/js-traverse/commit/0bd932bc6517d08f02ab3aac8cc551425072ead7) +- new valuesAt and extract functions [`883f015`](https://github.com/ljharb/js-traverse/commit/883f015c79ea79acc188a98be3bfa7ad54186266) +- tests for valuesAt and extract pass [`86d71a9`](https://github.com/ljharb/js-traverse/commit/86d71a97241ff84b071a0ff4aed68a99919014ff) +- hash example, some() [`c7a133c`](https://github.com/ljharb/js-traverse/commit/c7a133cbb59d5fa9aedfe3958b9a0898fc5dea4c) +- key and value tests [`92212e5`](https://github.com/ljharb/js-traverse/commit/92212e55cfb1f16f68c14885d644125a83951589) +- copy instead of clone for merge [`4fcece2`](https://github.com/ljharb/js-traverse/commit/4fcece2de64fbe90ef0250f31f4f399a103ec7ed) + +## [v0.0.7](https://github.com/ljharb/js-traverse/compare/v0.0.6...v0.0.7) - 2010-08-26 + +### Commits + +- new hash lib and clone sugar [`586124c`](https://github.com/ljharb/js-traverse/commit/586124cebb2b613ee63d0c76a0d636058c5c9213) +- hash test for map [`393444a`](https://github.com/ljharb/js-traverse/commit/393444a2add24b9dba4f68385518b96a3900de33) +- a test for instances [`1adf75a`](https://github.com/ljharb/js-traverse/commit/1adf75a9cdc13b094b660f17bc496a94fd9576fd) +- new modules format for package.json, boost to 0.0.7 [`0f11600`](https://github.com/ljharb/js-traverse/commit/0f11600d5cfb67b50fb4f4f79dda522d17c9df4f) +- __proto__ trick to make instanceof work on cloned objects [`130a833`](https://github.com/ljharb/js-traverse/commit/130a833014477b7463cb8fbf4de246fd93f990a5) + +## [v0.0.6](https://github.com/ljharb/js-traverse/compare/v0.0.5...v0.0.6) - 2010-08-01 + +### Commits + +- magical webified version of traverse with require('dnode/web').source() [`0043cd6`](https://github.com/ljharb/js-traverse/commit/0043cd6b57327a0d1962b7378e9f6897d963e3c0) +- directories.lib, I forgot. Also scrub requires for later [`2a1f530`](https://github.com/ljharb/js-traverse/commit/2a1f5301601984b09a1746bd0b1699fb88a18264) + +## [v0.0.5](https://github.com/ljharb/js-traverse/compare/v0.0.4...v0.0.5) - 2010-07-28 + +### Commits + +- test for stupid .constructor() bug [`6b9d85d`](https://github.com/ljharb/js-traverse/commit/6b9d85dac5eedd3e043c63fe2cff4881c25f9f98) +- stupid traversal bug, version bump [`4cf36f3`](https://github.com/ljharb/js-traverse/commit/4cf36f3f987a71704064dd6ab6b695ddce0cac47) + +## [v0.0.4](https://github.com/ljharb/js-traverse/compare/v0.0.3...v0.0.4) - 2010-07-27 + +### Commits + +- now using expresso for test suite, json test written [`7d448da`](https://github.com/ljharb/js-traverse/commit/7d448daa7c93444b302095da394f8f47bf3fb61f) +- leaves and negative tests to go with the example, also s/tests/test/ [`13e19bf`](https://github.com/ljharb/js-traverse/commit/13e19bf5441abc903a270eb5abfc985d75a7507b) +- clone in the constructor so updates don't mess up the root object's refs [`fc5903b`](https://github.com/ljharb/js-traverse/commit/fc5903b3b008377d7f06e83ad3bce84957900c8c) +- readme updates for expresso tests and version bump to 0.0.4 [`6993515`](https://github.com/ljharb/js-traverse/commit/69935153c1b54afaee42c58c8e33f15d21f55efe) + +## [v0.0.3](https://github.com/ljharb/js-traverse/compare/v0.0.2...v0.0.3) - 2010-07-21 + +### Commits + +- backwards compatible update for var Traverse = require('traverse') style [`d0f50e9`](https://github.com/ljharb/js-traverse/commit/d0f50e9a6f428b68fc51e1c582148196deb9e209) + +## [v0.0.2](https://github.com/ljharb/js-traverse/compare/v0.0.1...v0.0.2) - 2010-07-14 + +### Commits + +- special check for null, for which typeof(null) == 'object' [`a4128c0`](https://github.com/ljharb/js-traverse/commit/a4128c01a666132b40c69d57d9176a33a1f5046c) +- installation in readme [`a6fc0d6`](https://github.com/ljharb/js-traverse/commit/a6fc0d641970984fefab29773a930f22c925eb91) +- add output to negative example [`590045e`](https://github.com/ljharb/js-traverse/commit/590045e3bc9daf8dbb884f59b3579bf57a7dc42d) +- license file [`519fd1f`](https://github.com/ljharb/js-traverse/commit/519fd1ff6d225d2465899d102519e93ef5334bba) +- s/127/128/ [`5fcb3f5`](https://github.com/ljharb/js-traverse/commit/5fcb3f5256207e392e9500db720aa2aeb3f85304) + +## v0.0.1 - 2010-07-08 + +### Commits + +- initial commit with forEach, modify, get, paths, nodes [`e73bba8`](https://github.com/ljharb/js-traverse/commit/e73bba81dbc8630a0ef6003fa3c12ceaafc4188d) +- more examples [`16bf66e`](https://github.com/ljharb/js-traverse/commit/16bf66e5cf5c537441a98001eae9368d4bae7317) +- readme with json example [`fa8265b`](https://github.com/ljharb/js-traverse/commit/fa8265badad1dfe3df5d1aa6e561a3698e4b1338) +- json example [`607de69`](https://github.com/ljharb/js-traverse/commit/607de691cd1bdeb0ced603d5177e3f855dc20417) +- leaf example [`23ccea5`](https://github.com/ljharb/js-traverse/commit/23ccea575ce9b6984fcd8bb64ccd7f9ee765c258) +- package.json file for version 0.0.1 [`c3266e0`](https://github.com/ljharb/js-traverse/commit/c3266e060d8b5ebfb6472385dba323c7e951fd14) +- npm doesn't like newlines in package.json strings [`6840d4e`](https://github.com/ljharb/js-traverse/commit/6840d4e7c75aaafeca6778a48600759641dfa7f1) diff --git a/node_modules/traverse/LICENSE b/node_modules/traverse/LICENSE new file mode 100644 index 000000000..e4031e80c --- /dev/null +++ b/node_modules/traverse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2010 James Halliday and 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/traverse/README.md b/node_modules/traverse/README.md new file mode 100644 index 000000000..0bce518b4 --- /dev/null +++ b/node_modules/traverse/README.md @@ -0,0 +1,228 @@ +# traverse [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Traverse and transform objects by visiting every node on a recursive walk. + +# examples + +## transform negative numbers in-place + +negative.js + +````javascript +var traverse = require('traverse'); +var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; + +traverse(obj).forEach(function (x) { + if (x < 0) this.update(x + 128); +}); + +console.dir(obj); +```` + +Output: + + [ 5, 6, 125, [ 7, 8, 126, 1 ], { f: 10, g: 115 } ] + +## collect leaf nodes + +leaves.js + +````javascript +var traverse = require('traverse'); + +var obj = { + a : [1,2,3], + b : 4, + c : [5,6], + d : { e : [7,8], f : 9 }, +}; + +var leaves = traverse(obj).reduce(function (acc, x) { + if (this.isLeaf) acc.push(x); + return acc; +}, []); + +console.dir(leaves); +```` + +Output: + + [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] + +## scrub circular references + +scrub.js: + +````javascript +var traverse = require('traverse'); + +var obj = { a : 1, b : 2, c : [ 3, 4 ] }; +obj.c.push(obj); + +var scrubbed = traverse(obj).map(function (x) { + if (this.circular) this.remove() +}); +console.dir(scrubbed); +```` + +output: + + { a: 1, b: 2, c: [ 3, 4 ] } + +# methods + +Each method that takes an `fn` uses the context documented below in the context +section. + +## .map(fn) + +Execute `fn` for each node in the object and return a new object with the +results of the walk. To update nodes in the result use `this.update(value)`. + +## .forEach(fn) + +Execute `fn` for each node in the object but unlike `.map()`, when +`this.update()` is called it updates the object in-place. + +## .reduce(fn, acc) + +For each node in the object, perform a +[left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) +with the return value of `fn(acc, node)`. + +If `acc` isn't specified, `acc` is set to the root object for the first step +and the root element is skipped. + +## .paths() + +Return an `Array` of every possible non-cyclic path in the object. +Paths are `Array`s of string keys. + +## .nodes() + +Return an `Array` of every node in the object. + +## .clone() + +Create a deep clone of the object. + +## .get(path) + +Get the element at the array `path`. + +## .set(path, value) + +Set the element at the array `path` to `value`. + +## .has(path) + +Return whether the element at the array `path` exists. + +# context + +Each method that takes a callback has a context (its `this` object) with these +attributes: + +## this.node + +The present node on the recursive walk + +## this.path + +An array of string keys from the root to the present node + +## this.parent + +The context of the node's parent. +This is `undefined` for the root node. + +## this.key + +The name of the key of the present node in its parent. +This is `undefined` for the root node. + +## this.isRoot, this.notRoot + +Whether the present node is the root node + +## this.isLeaf, this.notLeaf + +Whether or not the present node is a leaf node (has no children) + +## this.level + +Depth of the node within the traversal + +## this.circular + +If the node equals one of its parents, the `circular` attribute is set to the +context of that parent and the traversal progresses no deeper. + +## this.update(value, stopHere=false) + +Set a new value for the present node. + +All the elements in `value` will be recursively traversed unless `stopHere` is +true. + +## this.remove(stopHere=false) + +Remove the current element from the output. If the node is in an Array it will +be spliced off. Otherwise it will be deleted from its parent. + +## this.delete(stopHere=false) + +Delete the current element from its parent in the output. Calls `delete` even on +Arrays. + +## this.before(fn) + +Call this function before any of the children are traversed. + +You can assign into `this.keys` here to traverse in a custom order. + +## this.after(fn) + +Call this function after any of the children are traversed. + +## this.pre(fn) + +Call this function before each of the children are traversed. + +## this.post(fn) + +Call this function after each of the children are traversed. + + +# install + +Using [npm](http://npmjs.org) do: + + $ npm install traverse + +# license + +MIT + +[package-url]: https://npmjs.org/package/traverse +[npm-version-svg]: https://versionbadg.es/ljharb/traverse.svg +[deps-svg]: https://david-dm.org/ljharb/traverse.svg +[deps-url]: https://david-dm.org/ljharb/traverse +[dev-deps-svg]: https://david-dm.org/ljharb/traverse/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/traverse#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/traverse.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/traverse.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/traverse.svg +[downloads-url]: https://npm-stat.com/charts.html?package=traverse +[codecov-image]: https://codecov.io/gh/ljharb/traverse/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/traverse/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/traverse +[actions-url]: https://github.com/ljharb/traverse/actions diff --git a/node_modules/traverse/examples/json.js b/node_modules/traverse/examples/json.js new file mode 100755 index 000000000..af71883e3 --- /dev/null +++ b/node_modules/traverse/examples/json.js @@ -0,0 +1,18 @@ +'use strict'; + +var traverse = require('traverse'); + +var id = 54; +var callbacks = {}; +var obj = { moo: function () {}, foo: [2, 3, 4, function () {}] }; + +var scrubbed = traverse(obj).map(function (x) { + if (typeof x === 'function') { + callbacks[id] = { id: id, f: x, path: this.path }; + this.update('[Function]'); + id++; + } +}); + +console.dir(scrubbed); +console.dir(callbacks); diff --git a/node_modules/traverse/examples/leaves.js b/node_modules/traverse/examples/leaves.js new file mode 100755 index 000000000..0bbd67abd --- /dev/null +++ b/node_modules/traverse/examples/leaves.js @@ -0,0 +1,17 @@ +'use strict'; + +var traverse = require('traverse'); + +var obj = { + a: [1, 2, 3], + b: 4, + c: [5, 6], + d: { e: [7, 8], f: 9 }, +}; + +var leaves = traverse(obj).reduce(function (acc, x) { + if (this.isLeaf) { acc.push(x); } + return acc; +}, []); + +console.dir(leaves); diff --git a/node_modules/traverse/examples/negative.js b/node_modules/traverse/examples/negative.js new file mode 100755 index 000000000..9224facd3 --- /dev/null +++ b/node_modules/traverse/examples/negative.js @@ -0,0 +1,10 @@ +'use strict'; + +var traverse = require('traverse'); +var obj = [5, 6, -3, [7, 8, -2, 1], { f: 10, g: -13 }]; + +traverse(obj).forEach(function (x) { + if (x < 0) { this.update(x + 128); } +}); + +console.dir(obj); diff --git a/node_modules/traverse/examples/scrub.js b/node_modules/traverse/examples/scrub.js new file mode 100755 index 000000000..7a8d1e259 --- /dev/null +++ b/node_modules/traverse/examples/scrub.js @@ -0,0 +1,12 @@ +'use strict'; + +// scrub out circular references +var traverse = require('traverse'); + +var obj = { a: 1, b: 2, c: [3, 4] }; +obj.c.push(obj); + +var scrubbed = traverse(obj).map(function () { + if (this.circular) { this.remove(); } +}); +console.dir(scrubbed); diff --git a/node_modules/traverse/examples/stringify.js b/node_modules/traverse/examples/stringify.js new file mode 100755 index 000000000..2f6e14afb --- /dev/null +++ b/node_modules/traverse/examples/stringify.js @@ -0,0 +1,37 @@ +#!/usr/bin/env node + +'use strict'; + +var traverse = require('traverse'); + +var obj = ['five', 6, -3, [7, 8, -2, 1], { f: 10, g: -13 }]; + +var s = ''; +traverse(obj).forEach(function toS(node) { + if (Array.isArray(node)) { + this.before(function () { s += '['; }); + this.post(function (child) { + if (!child.isLast) { s += ','; } + }); + this.after(function () { s += ']'; }); + } else if (typeof node === 'object') { + this.before(function () { s += '{'; }); + this.pre(function (x, key) { + toS(key); + s += ':'; + }); + this.post(function (child) { + if (!child.isLast) { s += ','; } + }); + this.after(function () { s += '}'; }); + } else if (typeof node === 'string') { + s += '"' + node.toString().replace(/"/g, '\\"') + '"'; + } else if (typeof node === 'function') { + s += 'null'; + } else { + s += node.toString(); + } +}); + +console.log('JSON.stringify: ' + JSON.stringify(obj)); +console.log('this stringify: ' + s); diff --git a/node_modules/traverse/index.js b/node_modules/traverse/index.js new file mode 100644 index 000000000..1ff291975 --- /dev/null +++ b/node_modules/traverse/index.js @@ -0,0 +1,395 @@ +'use strict'; + +var whichTypedArray = require('which-typed-array'); +var taSlice = require('typedarray.prototype.slice'); +var gopd = require('gopd'); + +// TODO: use call-bind, is-date, is-regex, is-string, is-boolean-object, is-number-object +function toS(obj) { return Object.prototype.toString.call(obj); } +function isDate(obj) { return toS(obj) === '[object Date]'; } +function isRegExp(obj) { return toS(obj) === '[object RegExp]'; } +function isError(obj) { return toS(obj) === '[object Error]'; } +function isBoolean(obj) { return toS(obj) === '[object Boolean]'; } +function isNumber(obj) { return toS(obj) === '[object Number]'; } +function isString(obj) { return toS(obj) === '[object String]'; } + +// TODO: use isarray +var isArray = Array.isArray || function isArray(xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +// TODO: use for-each? +function forEach(xs, fn) { + if (xs.forEach) { return xs.forEach(fn); } + for (var i = 0; i < xs.length; i++) { + fn(xs[i], i, xs); + } + return void undefined; +} + +// TODO: use object-keys +var objectKeys = Object.keys || function keys(obj) { + var res = []; + for (var key in obj) { res[res.length] = key; } // eslint-disable-line no-restricted-syntax + return res; +}; + +var propertyIsEnumerable = Object.prototype.propertyIsEnumerable; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; // eslint-disable-line id-length + +// TODO: use reflect.ownkeys and filter out non-enumerables +function ownEnumerableKeys(obj) { + var res = objectKeys(obj); + + // Include enumerable symbol properties. + if (getOwnPropertySymbols) { + var symbols = getOwnPropertySymbols(obj); + for (var i = 0; i < symbols.length; i++) { + if (propertyIsEnumerable.call(obj, symbols[i])) { + res[res.length] = symbols[i]; + } + } + } + return res; +} + +// TODO: use object.hasown +var hasOwnProperty = Object.prototype.hasOwnProperty || function (obj, key) { + return key in obj; +}; + +function isWritable(object, key) { + if (typeof gopd !== 'function') { + return true; + } + + var desc = gopd(object, key); + return !desc || !desc.writable; +} + +function copy(src, options) { + if (typeof src === 'object' && src !== null) { + var dst; + + if (isArray(src)) { + dst = []; + } else if (isDate(src)) { + dst = new Date(src.getTime ? src.getTime() : src); + } else if (isRegExp(src)) { + dst = new RegExp(src); + } else if (isError(src)) { + dst = { message: src.message }; + } else if (isBoolean(src) || isNumber(src) || isString(src)) { + dst = Object(src); + } else { + var ta = whichTypedArray(src); + if (ta) { + return taSlice(src); + } else if (Object.create && Object.getPrototypeOf) { + dst = Object.create(Object.getPrototypeOf(src)); + } else if (src.constructor === Object) { + dst = {}; + } else { + var proto = (src.constructor && src.constructor.prototype) + || src.__proto__ + || {}; + var T = function T() {}; // eslint-disable-line func-style, func-name-matching + T.prototype = proto; + dst = new T(); + } + } + + var iteratorFunction = options.includeSymbols ? ownEnumerableKeys : objectKeys; + forEach(iteratorFunction(src), function (key) { + dst[key] = src[key]; + }); + return dst; + } + return src; +} + +/** @type {TraverseOptions} */ +var emptyNull = { __proto__: null }; + +function walk(root, cb) { + var path = []; + var parents = []; + var alive = true; + var options = arguments.length > 2 ? arguments[2] : emptyNull; + var iteratorFunction = options.includeSymbols ? ownEnumerableKeys : objectKeys; + var immutable = !!options.immutable; + + return (function walker(node_) { + var node = immutable ? copy(node_, options) : node_; + var modifiers = { __proto__: null }; + + var keepGoing = true; + + var state = { + node: node, + node_: node_, + path: [].concat(path), + parent: parents[parents.length - 1], + parents: parents, + key: path[path.length - 1], + removedKeys: { __proto__: null }, + isRoot: path.length === 0, + level: path.length, + circular: null, + update: function (x, stopHere) { + if (!state.isRoot) { + state.parent.node[state.key] = x; + } + state.node = x; + if (stopHere) { keepGoing = false; } + }, + delete: function (stopHere) { + delete state.parent.node[state.key]; + state.parent.removedKeys[state.key] = true; + if (stopHere) { keepGoing = false; } + }, + remove: function (stopHere) { + if (isArray(state.parent.node)) { + state.parent.node.splice(state.key, 1); + state.parent.removedKeys[state.key] = true; + if (stopHere) { keepGoing = false; } + } else { + state.delete(stopHere); + } + }, + keys: null, + before: function (f) { modifiers.before = f; }, + after: function (f) { modifiers.after = f; }, + pre: function (f) { modifiers.pre = f; }, + post: function (f) { modifiers.post = f; }, + stop: function () { alive = false; }, + block: function () { keepGoing = false; }, + }; + + if (!alive) { return state; } + + function updateState() { + if (typeof state.node === 'object' && state.node !== null) { + if (!state.keys || state.node_ !== state.node) { + state.keys = iteratorFunction(state.node); + } + + state.isLeaf = state.keys.length === 0; + + for (var i = 0; i < parents.length; i++) { + if (parents[i].node_ === node_) { + state.circular = parents[i]; + break; // eslint-disable-line no-restricted-syntax + } + } + } else { + state.isLeaf = true; + state.keys = null; + } + + state.notLeaf = !state.isLeaf; + state.notRoot = !state.isRoot; + } + + updateState(); + + // use return values to update if defined + var ret = cb.call(state, state.node); + if (ret !== undefined && state.update) { state.update(ret); } + + if (modifiers.before) { modifiers.before.call(state, state.node); } + + if (!keepGoing) { return state; } + + if ( + typeof state.node === 'object' + && state.node !== null + && !state.circular + ) { + parents[parents.length] = state; + + updateState(); + + forEach(state.keys, function (key, i) { + var prevIsRemoved = (i - 1) in state.removedKeys; + if (prevIsRemoved) { + key = state.keys[i - 1]; // eslint-disable-line no-param-reassign + } + + path[path.length] = (key); + + if (modifiers.pre) { modifiers.pre.call(state, state.node[key], key); } + + var child = walker(state.node[key]); + if ( + immutable + && hasOwnProperty.call(state.node, key) + && !isWritable(state.node, key) + && !prevIsRemoved + ) { + state.node[key] = child.node; + } + + child.isLast = i === state.keys.length - 1; + child.isFirst = i === 0; + + if (modifiers.post) { modifiers.post.call(state, child); } + + path.pop(); + }); + parents.pop(); + } + + if (modifiers.after) { modifiers.after.call(state, state.node); } + + return state; + }(root)).node; +} + +/** @typedef {{ immutable?: boolean, includeSymbols?: boolean }} TraverseOptions */ + +/** + * A traverse constructor + * @param {object} obj - the object to traverse + * @param {TraverseOptions | undefined} [options] - options for the traverse + * @constructor + */ +function Traverse(obj) { + /** @type {TraverseOptions} */ + this.options = arguments.length > 1 ? arguments[1] : emptyNull; + this.value = obj; +} + +/** @type {(ps: PropertyKey[]) => Traverse['value']} */ +Traverse.prototype.get = function (ps) { + var node = this.value; + for (var i = 0; node && i < ps.length; i++) { + var key = ps[i]; + if ( + !hasOwnProperty.call(node, key) + || (!this.options.includeSymbols && typeof key === 'symbol') + ) { + return void undefined; + } + node = node[key]; + } + return node; +}; + +/** @type {(ps: PropertyKey[]) => boolean} */ +Traverse.prototype.has = function (ps) { + var node = this.value; + // TODO: remove ps.length check + if (!node && ps.length > 0) { + return false; + } + for (var i = 0; node && i < ps.length; i++) { + var key = ps[i]; + if (!hasOwnProperty.call(node, key) || (!this.options.includeSymbols && typeof key === 'symbol')) { + return false; + } + node = node[key]; + } + return true; +}; + +Traverse.prototype.set = function (ps, value) { + var node = this.value; + for (var i = 0; i < ps.length - 1; i++) { + var key = ps[i]; + if (!hasOwnProperty.call(node, key)) { node[key] = {}; } + node = node[key]; + } + node[ps[i]] = value; + return value; +}; + +Traverse.prototype.map = function (cb) { + return walk(this.value, cb, { __proto__: null, immutable: true, includeSymbols: !!this.options.includeSymbols }); +}; + +Traverse.prototype.forEach = function (cb) { + this.value = walk(this.value, cb, this.options); + return this.value; +}; + +Traverse.prototype.reduce = function (cb, init) { + var skip = arguments.length === 1; + var acc = skip ? this.value : init; + this.forEach(function (x) { + if (!this.isRoot || !skip) { + acc = cb.call(this, acc, x); + } + }); + return acc; +}; + +Traverse.prototype.paths = function () { + var acc = []; + this.forEach(function () { + acc[acc.length] = this.path; + }); + return acc; +}; + +Traverse.prototype.nodes = function () { + var acc = []; + this.forEach(function () { + acc[acc.length] = this.node; + }); + return acc; +}; + +Traverse.prototype.clone = function () { + var parents = []; + var nodes = []; + var options = this.options; + + if (whichTypedArray(this.value)) { + return taSlice(this.value); + } + + return (function clone(src) { + for (var i = 0; i < parents.length; i++) { + if (parents[i] === src) { + return nodes[i]; + } + } + + if (typeof src === 'object' && src !== null) { + var dst = copy(src, options); + + parents[parents.length] = (src); + nodes[nodes.length] = (dst); + + var iteratorFunction = options.includeSymbols ? ownEnumerableKeys : objectKeys; + forEach(iteratorFunction(src), function (key) { + dst[key] = clone(src[key]); + }); + + parents.pop(); + nodes.pop(); + return dst; + } + + return src; + + }(this.value)); +}; + +/** @type {(obj: object, options?: TraverseOptions) => Traverse} */ +function traverse(obj) { + var options = arguments.length > 1 ? arguments[1] : emptyNull; + return new Traverse(obj, options); +} + +// TODO: replace with object.assign? +forEach(ownEnumerableKeys(Traverse.prototype), function (key) { + traverse[key] = function (obj) { + var args = [].slice.call(arguments, 1); + var t = new Traverse(obj); + return t[key].apply(t, args); + }; +}); + +module.exports = traverse; diff --git a/node_modules/traverse/package.json b/node_modules/traverse/package.json new file mode 100644 index 000000000..154f89bf4 --- /dev/null +++ b/node_modules/traverse/package.json @@ -0,0 +1,102 @@ +{ + "name": "traverse", + "version": "0.6.11", + "description": "traverse and transform objects by visiting every node on a recursive walk", + "main": "index.js", + "directories": { + "example": "example", + "test": "test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.7.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "iexplore": [ + "6.0", + "7.0", + "8.0", + "9.0" + ], + "chrome": [ + "10.0", + "20.0" + ], + "firefox": [ + "10.0", + "15.0" + ], + "safari": [ + "5.1" + ], + "opera": [ + "12.0" + ] + } + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/js-traverse.git" + }, + "homepage": "https://github.com/ljharb/js-traverse", + "keywords": [ + "traverse", + "walk", + "recursive", + "map", + "forEach", + "deep", + "clone" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "dependencies": { + "gopd": "^1.2.0", + "typedarray.prototype.slice": "^1.0.5", + "which-typed-array": "^1.1.18" + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/traverse/test/circular.js b/node_modules/traverse/test/circular.js new file mode 100644 index 000000000..89743cdd3 --- /dev/null +++ b/node_modules/traverse/test/circular.js @@ -0,0 +1,118 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); +var deepEqual = require('./lib/deep_equal'); +var util = require('util'); + +test('circular', function (t) { + t.plan(1); + + var obj = { x: 3 }; + obj.y = obj; + traverse(obj).forEach(function () { + if (this.path.join('') === 'y') { + t.equal( + util.inspect(this.circular.node), + util.inspect(obj) + ); + } + }); +}); + +test('deepCirc', function (t) { + t.plan(2); + var obj = { x: [1, 2, 3], y: [4, 5] }; + obj.y[2] = obj; + + traverse(obj).forEach(function () { + if (this.circular) { + t.deepEqual(this.circular.path, []); + t.deepEqual(this.path, ['y', '2']); + } + }); +}); + +test('doubleCirc', function (t) { + var obj = { x: [1, 2, 3], y: [4, 5] }; + obj.y[2] = obj; + obj.x.push(obj.y); + + var circs = []; + traverse(obj).forEach(function (x) { + if (this.circular) { + circs.push({ circ: this.circular, self: this, node: x }); + } + }); + + t.deepEqual(circs[0].self.path, ['x', '3', '2']); + t.deepEqual(circs[0].circ.path, []); + + t.deepEqual(circs[1].self.path, ['y', '2']); + t.deepEqual(circs[1].circ.path, []); + + t.deepEqual(circs.length, 2); + t.end(); +}); + +test('circDubForEach', function (t) { + var obj = { x: [1, 2, 3], y: [4, 5] }; + obj.y[2] = obj; + obj.x.push(obj.y); + + traverse(obj).forEach(function () { + if (this.circular) { this.update('...'); } + }); + + t.same(obj, { x: [1, 2, 3, [4, 5, '...']], y: [4, 5, '...'] }); + t.end(); +}); + +test('circDubMap', function (t) { + var obj = { x: [1, 2, 3], y: [4, 5] }; + obj.y[2] = obj; + obj.x.push(obj.y); + + var c = traverse(obj).map(function () { + if (this.circular) { + this.update('...'); + } + }); + + t.same(c, { x: [1, 2, 3, [4, 5, '...']], y: [4, 5, '...'] }); + t.end(); +}); + +test('circClone', function (t) { + var obj = { x: [1, 2, 3], y: [4, 5] }; + obj.y[2] = obj; + obj.x.push(obj.y); + + var clone = traverse.clone(obj); + t.ok(obj !== clone); + + t.ok(clone.y[2] === clone); + t.ok(clone.y[2] !== obj); + t.ok(clone.x[3][2] === clone); + t.ok(clone.x[3][2] !== obj); + t.same(clone.x.slice(0, 3), [1, 2, 3]); + t.same(clone.y.slice(0, 2), [4, 5]); + t.end(); +}); + +test('circMapScrub', function (t) { + var obj = { a: 1, b: 2 }; + obj.c = obj; + + var scrubbed = traverse(obj).map(function () { + if (this.circular) { this.remove(); } + }); + t.same( + Object.keys(scrubbed).sort(), + ['a', 'b'] + ); + t.ok(deepEqual(scrubbed, { a: 1, b: 2 })); + + t.equal(obj.c, obj); + t.end(); +}); diff --git a/node_modules/traverse/test/date.js b/node_modules/traverse/test/date.js new file mode 100644 index 000000000..2df5a5f0e --- /dev/null +++ b/node_modules/traverse/test/date.js @@ -0,0 +1,39 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('dateEach', function (t) { + var obj = { x: new Date(), y: 10, z: 5 }; + + var counts = {}; + + traverse(obj).forEach(function (node) { + var type = (node instanceof Date && 'Date') || typeof node; + counts[type] = (counts[type] || 0) + 1; + }); + + t.same(counts, { + object: 1, + Date: 1, + number: 2, + }); + t.end(); +}); + +test('dateMap', function (t) { + var obj = { x: new Date(), y: 10, z: 5 }; + + var res = traverse(obj).map(function (node) { + if (typeof node === 'number') { this.update(node + 100); } + }); + + t.ok(obj.x !== res.x); + t.same(res, { + x: obj.x, + y: 110, + z: 105, + }); + t.end(); +}); + diff --git a/node_modules/traverse/test/equal.js b/node_modules/traverse/test/equal.js new file mode 100644 index 000000000..d42cb5e46 --- /dev/null +++ b/node_modules/traverse/test/equal.js @@ -0,0 +1,239 @@ +'use strict'; + +var test = require('tape'); +var deepEqual = require('./lib/deep_equal'); + +test('deepDates', function (t) { + t.plan(2); + + var now = new Date(); + t.ok( + deepEqual( + { d: new Date(now), x: [1, 2, 3] }, + { d: new Date(now), x: [1, 2, 3] } + ), + 'dates should be equal' + ); + + var d0 = new Date(); + setTimeout(function () { + t.ok( + !deepEqual( + { d: d0, x: [1, 2, 3] }, + { d: new Date(), x: [1, 2, 3] } + ), + 'microseconds should count in date equality' + ); + }, 5); +}); + +test('deepCircular', function (t) { + var a = [1]; + a.push(a); // a = [ 1, *a ] + + var b = [1]; + b.push(a); // b = [ 1, [ 1, *a ] ] + + t.ok( + !deepEqual(a, b), + 'circular ref mount points count towards equality' + ); + + var c = [1]; + c.push(c); // c = [ 1, *c ] + t.ok( + deepEqual(a, c), + 'circular refs are structurally the same here' + ); + + var d = [1]; + d.push(a); // c = [ 1, [ 1, *d ] ] + t.ok( + deepEqual(b, d), + 'non-root circular ref structural comparison' + ); + + t.end(); +}); + +test('deepInstances', function (t) { + t.ok( + !deepEqual([Object(false)], [false]), + 'boolean instances are not real booleans' + ); + + t.ok( + !deepEqual([Object('x')], ['x']), + 'string instances are not real strings' + ); + + t.ok( + !deepEqual([Object(4)], [4]), + 'number instances are not real numbers' + ); + + t.ok( + deepEqual([new RegExp('x')], [/x/]), + 'regexp instances are real regexps' + ); + + t.ok( + !deepEqual([new RegExp(/./)], [/../]), + 'these regexps aren\'t the same' + ); + + t.ok( + !deepEqual( + [function (x) { return x * 2; }], + [function (x) { return x * 2; }] + ), + 'functions with the same .toString() aren\'t necessarily the same' + ); + + function f(x) { return x * 2; } + t.ok( + deepEqual([f], [f]), + 'these functions are actually equal' + ); + + t.end(); +}); + +test('deepEqual', function (t) { + t.ok( + !deepEqual([1, 2, 3], { 0: 1, 1: 2, 2: 3 }), + 'arrays are not objects' + ); + t.end(); +}); + +test('falsy', function (t) { + t.ok( + !deepEqual([undefined], [null]), + 'null is not undefined!' + ); + + t.ok( + !deepEqual([null], [undefined]), + 'undefined is not null!' + ); + + t.ok( + !deepEqual( + { a: 1, b: 2, c: [3, undefined, 5] }, + { a: 1, b: 2, c: [3, null, 5] } + ), + 'undefined is not null, however deeply!' + ); + + t.ok( + !deepEqual( + { a: 1, b: 2, c: [3, undefined, 5] }, + { a: 1, b: 2, c: [3, null, 5] } + ), + 'null is not undefined, however deeply!' + ); + + t.ok( + !deepEqual( + { a: 1, b: 2, c: [3, undefined, 5] }, + { a: 1, b: 2, c: [3, null, 5] } + ), + 'null is not undefined, however deeply!' + ); + + t.end(); +}); + +test('deletedArrayEqual', function (t) { + var xs = [1, 2, 3, 4]; + delete xs[2]; + + var ys = Object.create(Array.prototype); + ys[0] = 1; + ys[1] = 2; + ys[3] = 4; + + t.ok( + deepEqual(xs, ys), + 'arrays with deleted elements are only equal to arrays with similarly deleted elements' + ); + + t.ok( + !deepEqual(xs, [1, 2, undefined, 4]), + 'deleted array elements cannot be undefined' + ); + + t.ok( + !deepEqual(xs, [1, 2, null, 4]), + 'deleted array elements cannot be null' + ); + + t.end(); +}); + +test('deletedObjectEqual', function (t) { + var obj = { a: 1, b: 2, c: 3 }; + delete obj.c; + + t.ok( + deepEqual(obj, { a: 1, b: 2 }), + 'deleted object elements should not show up' + ); + + t.ok( + !deepEqual(obj, { a: 1, b: 2, c: undefined }), + 'deleted object elements are not undefined' + ); + + t.ok( + !deepEqual(obj, { a: 1, b: 2, c: null }), + 'deleted object elements are not null' + ); + + t.end(); +}); + +test('emptyKeyEqual', function (t) { + t.ok(!deepEqual({ a: 1 }, { a: 1, '': 55 })); + + t.end(); +}); + +test('deepArguments', function (t) { + t.ok( + !deepEqual( + [4, 5, 6], + (function () { return arguments; }(4, 5, 6)) + ), + 'arguments are not arrays' + ); + + t.ok( + deepEqual( + (function () { return arguments; }(4, 5, 6)), + (function () { return arguments; }(4, 5, 6)) + ), + 'arguments should equal' + ); + + t.end(); +}); + +test('deepUn', function (t) { + t.ok(!deepEqual({ a: 1, b: 2 }, undefined)); + t.ok(!deepEqual({ a: 1, b: 2 }, {})); + t.ok(!deepEqual(undefined, { a: 1, b: 2 })); + t.ok(!deepEqual({}, { a: 1, b: 2 })); + t.ok(deepEqual(undefined, undefined)); + t.ok(deepEqual(null, null)); + t.ok(!deepEqual(undefined, null)); + + t.end(); +}); + +test('deepLevels', function (t) { + var xs = [1, 2, [3, 4, [5, 6]]]; + t.ok(!deepEqual(xs, [])); + t.end(); +}); diff --git a/node_modules/traverse/test/error.js b/node_modules/traverse/test/error.js new file mode 100644 index 000000000..8c4aca11e --- /dev/null +++ b/node_modules/traverse/test/error.js @@ -0,0 +1,13 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('traverse an Error', function (t) { + var obj = new Error('test'); + var results = traverse(obj).map(function () {}); + t.same(results, { message: 'test' }); + + t.end(); +}); + diff --git a/node_modules/traverse/test/has.js b/node_modules/traverse/test/has.js new file mode 100644 index 000000000..e8aa90cf0 --- /dev/null +++ b/node_modules/traverse/test/has.js @@ -0,0 +1,58 @@ +'use strict'; + +var test = require('tape'); +var v = require('es-value-fixtures'); +var traverse = require('../'); + +test('has', function (t) { + var obj = { a: 2, b: [4, 5, { c: 6 }] }; + + t.equal(traverse(obj).has(['b', 2, 'c']), true); + t.equal(traverse(obj).has(['b', 2, 'c', 0]), false); + t.equal(traverse(obj).has(['b', 2, 'd']), false); + t.equal(traverse(obj).has([]), true); + t.equal(traverse(obj).has(['a']), true); + t.equal(traverse(obj).has(['a', 2]), false); + + // TODO: change this to `false` + t.equal(traverse(undefined).has([]), true, 'traversing a non-object somehow returns true for no paths'); + t.equal(traverse(undefined).has(['my', 'path']), false, 'traversing a non-object does not have any paths'); + + t.test('symbols', { skip: !v.hasSymbols }, function (st) { + /* eslint no-restricted-properties: 1 */ + var globalSymbol = Symbol.for('d'); + var localSymbol = Symbol('e'); + + obj[globalSymbol] = {}; + obj[globalSymbol][localSymbol] = 7; + obj[localSymbol] = 8; + + st.equal(traverse(obj).has([globalSymbol]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([globalSymbol]), true); + + st.equal(traverse(obj).has([globalSymbol, globalSymbol]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([globalSymbol, globalSymbol]), false); + + st.equal(traverse(obj).has([globalSymbol, localSymbol]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([globalSymbol, localSymbol]), true); + + st.equal(traverse(obj).has([localSymbol]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([localSymbol]), true); + + st.equal(traverse(obj).has([Symbol('d')]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([Symbol('d')]), false); + + st.equal(traverse(obj).has([Symbol('e')]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([Symbol('e')]), false); + + st.equal(traverse(obj).has([Symbol.for('d')]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([Symbol.for('d')]), true); + + st.equal(traverse(obj).has([Symbol.for('e')]), false); + st.equal(traverse(obj, { includeSymbols: true }).has([Symbol.for('e')]), false); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/traverse/test/instance.js b/node_modules/traverse/test/instance.js new file mode 100644 index 000000000..b181b26be --- /dev/null +++ b/node_modules/traverse/test/instance.js @@ -0,0 +1,17 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); +var EventEmitter = require('events').EventEmitter; + +test('check instanceof on node elems', function (t) { + var counts = { emitter: 0 }; + + traverse([new EventEmitter(), 3, 4, { ev: new EventEmitter() }]) + .forEach(function (node) { + if (node instanceof EventEmitter) { counts.emitter += 1; } + }); + t.equal(counts.emitter, 2); + + t.end(); +}); diff --git a/node_modules/traverse/test/interface.js b/node_modules/traverse/test/interface.js new file mode 100644 index 000000000..02735b920 --- /dev/null +++ b/node_modules/traverse/test/interface.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('interface map', function (t) { + var obj = { a: [5, 6, 7], b: { c: [8] } }; + + t.same( + traverse.paths(obj) + .sort() + .map(function (path) { return path.join('/'); }) + .slice(1) + .join(' ') + , + 'a a/0 a/1 a/2 b b/c b/c/0' + ); + + t.same( + traverse.nodes(obj), + [ + { a: [5, 6, 7], b: { c: [8] } }, + [5, 6, 7], 5, 6, 7, + { c: [8] }, [8], 8, + ] + ); + + t.same( + traverse.map(obj, function (node) { + if (typeof node === 'number') { + return node + 1000; + } + if (Array.isArray(node)) { + return node.join(' '); + } + return void undefined; + }), + { a: '5 6 7', b: { c: '8' } } + ); + + var nodes = 0; + traverse.forEach(obj, function () { nodes += 1; }); + t.equal(nodes, 8); + + t.end(); +}); diff --git a/node_modules/traverse/test/json.js b/node_modules/traverse/test/json.js new file mode 100644 index 000000000..244a44453 --- /dev/null +++ b/node_modules/traverse/test/json.js @@ -0,0 +1,55 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('json test', function (t) { + var id = 54; + var callbacks = {}; + var obj = { moo: function () {}, foo: [2, 3, 4, function () {}] }; + + var scrubbed = traverse(obj).map(function (x) { + if (typeof x === 'function') { + callbacks[id] = { id: id, f: x, path: this.path }; + this.update('[Function]'); + id += 1; + } + }); + + t.equal( + scrubbed.moo, + '[Function]', + 'obj.moo replaced with "[Function]"' + ); + + t.equal( + scrubbed.foo[3], + '[Function]', + 'obj.foo[3] replaced with "[Function]"' + ); + + t.same(scrubbed, { + moo: '[Function]', + foo: [2, 3, 4, '[Function]'], + }, 'Full JSON string matches'); + + t.same( + typeof obj.moo, + 'function', + 'Original obj.moo still a function' + ); + + t.same( + typeof obj.foo[3], + 'function', + 'Original obj.foo[3] still a function' + ); + + t.same(callbacks, { + 54: { id: 54, f: obj.moo, path: ['moo'] }, + 55: { id: 55, f: obj.foo[3], path: ['foo', '3'] }, + }, 'Check the generated callbacks list'); + + t.end(); +}); + diff --git a/node_modules/traverse/test/keys.js b/node_modules/traverse/test/keys.js new file mode 100644 index 000000000..6544eb919 --- /dev/null +++ b/node_modules/traverse/test/keys.js @@ -0,0 +1,33 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('sort test', function (t) { + var acc = []; + traverse({ + a: 30, + b: 22, + id: 9, + }).forEach(function (node) { + if (!Array.isArray(node) && typeof node === 'object') { + this.before(function (beforeNode) { + this.keys = Object.keys(beforeNode); + this.keys.sort(function (a, b) { + var aA = [a === 'id' ? 0 : 1, a]; + var bA = [b === 'id' ? 0 : 1, b]; + return aA < bA ? -1 : aA > bA ? 1 : 0; + }); + }); + } + if (this.isLeaf) { acc.push(node); } + }); + + t.equal( + acc.join(' '), + '9 30 22', + 'Traversal in a custom order' + ); + + t.end(); +}); diff --git a/node_modules/traverse/test/leaves.js b/node_modules/traverse/test/leaves.js new file mode 100644 index 000000000..d59849975 --- /dev/null +++ b/node_modules/traverse/test/leaves.js @@ -0,0 +1,24 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('leaves test', function (t) { + var acc = []; + traverse({ + a: [1, 2, 3], + b: 4, + c: [5, 6], + d: { e: [7, 8], f: 9 }, + }).forEach(function (x) { + if (this.isLeaf) { acc.push(x); } + }); + + t.equal( + acc.join(' '), + '1 2 3 4 5 6 7 8 9', + 'Traversal in the right(?) order' + ); + + t.end(); +}); diff --git a/node_modules/traverse/test/mutability.js b/node_modules/traverse/test/mutability.js new file mode 100644 index 000000000..d0c029bbb --- /dev/null +++ b/node_modules/traverse/test/mutability.js @@ -0,0 +1,319 @@ +'use strict'; + +var test = require('tape'); +var assert = require('assert'); +var traverse = require('../'); +var deepEqual = require('./lib/deep_equal'); + +test('mutate', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).forEach(function (x) { + if (typeof x === 'number' && x % 2 === 0) { + this.update(x * 10); + } + }); + t.same(obj, res); + t.same(obj, { a: 1, b: 20, c: [3, 40] }); + t.end(); +}); + +test('mutateT', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse.forEach(obj, function (x) { + if (typeof x === 'number' && x % 2 === 0) { + this.update(x * 10); + } + }); + t.same(obj, res); + t.same(obj, { a: 1, b: 20, c: [3, 40] }); + t.end(); +}); + +test('map', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).map(function (x) { + if (typeof x === 'number' && x % 2 === 0) { + this.update(x * 10); + } + }); + t.same(obj, { a: 1, b: 2, c: [3, 4] }); + t.same(res, { a: 1, b: 20, c: [3, 40] }); + t.end(); +}); + +test('mapT', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse.map(obj, function (x) { + if (typeof x === 'number' && x % 2 === 0) { + this.update(x * 10); + } + }); + t.same(obj, { a: 1, b: 2, c: [3, 4] }); + t.same(res, { a: 1, b: 20, c: [3, 40] }); + t.end(); +}); + +test('clone', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).clone(); + t.same(obj, res); + t.ok(obj !== res); + obj.a += 1; + t.same(res.a, 1); + obj.c.push(5); + t.same(res.c, [3, 4]); + t.end(); +}); + +test('cloneT', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse.clone(obj); + t.same(obj, res); + t.ok(obj !== res); + obj.a += 1; + t.same(res.a, 1); + obj.c.push(5); + t.same(res.c, [3, 4]); + t.end(); +}); + +test('cloneTypedArray', { skip: typeof Uint8Array !== 'function' }, function (t) { + var obj = new Uint8Array([1]); + var res = traverse.clone(obj); + + t.same(obj, res); + t.ok(obj !== res); + obj.set([2], 0); + res.set([3], 0); + t.same(obj, new Uint8Array([2])); + t.same(res, new Uint8Array([3])); + t.end(); +}); + +test('reduce', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).reduce(function (acc, x) { + if (this.isLeaf) { acc.push(x); } + return acc; + }, []); + t.same(obj, { a: 1, b: 2, c: [3, 4] }); + t.same(res, [1, 2, 3, 4]); + t.end(); +}); + +test('reduceInit', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).reduce(function (acc) { + if (this.isRoot) { assert.fail('got root'); } + return acc; + }); + t.same(obj, { a: 1, b: 2, c: [3, 4] }); + t.same(res, obj); + t.end(); +}); + +test('remove', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + traverse(obj).forEach(function (x) { + if (this.isLeaf && x % 2 === 0) { this.remove(); } + }); + + t.same(obj, { a: 1, c: [3] }); + t.end(); +}); + +test('removeNoStop', function (t) { + var obj = { a: 1, b: 2, c: { d: 3, e: 4 }, f: 5 }; + + var keys = []; + traverse(obj).forEach(function () { + keys.push(this.key); + if (this.key === 'c') { this.remove(); } + }); + + t.same(keys, [undefined, 'a', 'b', 'c', 'd', 'e', 'f']); + t.end(); +}); + +test('removeStop', function (t) { + var obj = { a: 1, b: 2, c: { d: 3, e: 4 }, f: 5 }; + + var keys = []; + traverse(obj).forEach(function () { + keys.push(this.key); + if (this.key === 'c') { this.remove(true); } + }); + + t.same(keys, [undefined, 'a', 'b', 'c', 'f']); + t.end(); +}); + +test('removeMap', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).map(function (x) { + if (this.isLeaf && x % 2 === 0) { this.remove(); } + }); + + t.same(obj, { a: 1, b: 2, c: [3, 4] }); + t.same(res, { a: 1, c: [3] }); + t.end(); +}); + +test('delete', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + traverse(obj).forEach(function (x) { + if (this.isLeaf && x % 2 === 0) { this.delete(); } + }); + + t.ok(!deepEqual(obj, { a: 1, c: [3, undefined] })); + + t.ok(deepEqual(obj, { a: 1, c: [3] })); + + t.ok(!deepEqual(obj, { a: 1, c: [3, null] })); + t.end(); +}); + +test('deleteNoStop', function (t) { + var obj = { a: 1, b: 2, c: { d: 3, e: 4 } }; + + var keys = []; + traverse(obj).forEach(function () { + keys.push(this.key); + if (this.key === 'c') { this.delete(); } + }); + + t.same(keys, [undefined, 'a', 'b', 'c', 'd', 'e']); + t.end(); +}); + +test('deleteStop', function (t) { + var obj = { a: 1, b: 2, c: { d: 3, e: 4 } }; + + var keys = []; + traverse(obj).forEach(function () { + keys.push(this.key); + if (this.key === 'c') { this.delete(true); } + }); + + t.same(keys, [undefined, 'a', 'b', 'c']); + t.end(); +}); + +test('deleteRedux', function (t) { + var obj = { a: 1, b: 2, c: [3, 4, 5] }; + traverse(obj).forEach(function (x) { + if (this.isLeaf && x % 2 === 0) { this.delete(); } + }); + + t.ok(!deepEqual(obj, { a: 1, c: [3, undefined, 5] })); + + // eslint-disable-next-line no-sparse-arrays + t.ok(deepEqual(obj, { a: 1, c: [3,, 5] })); + + t.ok(!deepEqual(obj, { a: 1, c: [3, null, 5] })); + + t.ok(!deepEqual(obj, { a: 1, c: [3, 5] })); + + t.end(); +}); + +test('deleteMap', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).map(function (x) { + if (this.isLeaf && x % 2 === 0) { this.delete(); } + }); + + t.ok(deepEqual( + obj, + { a: 1, b: 2, c: [3, 4] } + )); + + var xs = [3, 4]; + delete xs[1]; + + t.ok(deepEqual(res, { a: 1, c: xs })); + + // eslint-disable-next-line comma-spacing, no-sparse-arrays + t.ok(deepEqual(res, { a: 1, c: [3,,] })); + + t.ok(deepEqual(res, { a: 1, c: [3] })); + + t.end(); +}); + +test('deleteMapRedux', function (t) { + var obj = { a: 1, b: 2, c: [3, 4, 5] }; + var res = traverse(obj).map(function (x) { + if (this.isLeaf && x % 2 === 0) { this.delete(); } + }); + + t.ok(deepEqual( + obj, + { a: 1, b: 2, c: [3, 4, 5] } + )); + + var xs = [3, 4, 5]; + delete xs[1]; + + t.ok(deepEqual(res, { a: 1, c: xs })); + + t.ok(!deepEqual(res, { a: 1, c: [3, 5] })); + + // eslint-disable-next-line no-sparse-arrays + t.ok(deepEqual(res, { a: 1, c: [3,, 5] })); + + t.end(); +}); + +test('objectToString', function (t) { + var obj = { a: 1, b: 2, c: [3, 4] }; + var res = traverse(obj).forEach(function (x) { + if (typeof x === 'object' && !this.isRoot) { + this.update(JSON.stringify(x)); + } + }); + t.same(obj, res); + t.same(obj, { a: 1, b: 2, c: '[3,4]' }); + t.end(); +}); + +test('stringToObject', function (t) { + var obj = { a: 1, b: 2, c: '[3,4]' }; + var res = traverse(obj).forEach(function (x) { + if (typeof x === 'string') { + this.update(JSON.parse(x)); + } else if (typeof x === 'number' && x % 2 === 0) { + this.update(x * 10); + } + }); + t.deepEqual(obj, res); + t.deepEqual(obj, { a: 1, b: 20, c: [3, 40] }); + t.end(); +}); + +test('array item removal', function (t) { + var obj = [ + function a() {}, + function b() {}, + 'a', + ]; + + function cb(x) { + if (x !== obj) { + // console.log("**", x, typeof x) + if (typeof x === 'function') { this.remove(); } + } + } + + var result = traverse(obj, { immutable: true }).forEach(cb); + + t.equal(obj.length, 3, 'immutable: makes no changes'); + + t.deepEqual(result, ['a'], 'immutable result: removes all functions'); + + traverse(obj).forEach(cb); + + t.deepEqual(obj, ['a'], 'removes all functions'); + + t.end(); +}); diff --git a/node_modules/traverse/test/negative.js b/node_modules/traverse/test/negative.js new file mode 100644 index 000000000..b3806c4b1 --- /dev/null +++ b/node_modules/traverse/test/negative.js @@ -0,0 +1,25 @@ +'use strict'; + +var traverse = require('../'); +var test = require('tape'); + +test('negative update test', function (t) { + var obj = [5, 6, -3, [7, 8, -2, 1], { f: 10, g: -13 }]; + var fixed = traverse.map(obj, function (x) { + if (x < 0) { this.update(x + 128); } + }); + + t.same( + fixed, + [5, 6, 125, [7, 8, 126, 1], { f: 10, g: 115 }], + 'Negative values += 128' + ); + + t.same( + obj, + [5, 6, -3, [7, 8, -2, 1], { f: 10, g: -13 }], + 'Original references not modified' + ); + + t.end(); +}); diff --git a/node_modules/traverse/test/obj.js b/node_modules/traverse/test/obj.js new file mode 100644 index 000000000..fa3daeaff --- /dev/null +++ b/node_modules/traverse/test/obj.js @@ -0,0 +1,13 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('traverse an object with nested functions', function (t) { + t.plan(1); + + function Cons(x) { + t.equal(x, 10); + } + traverse(new Cons(10)); +}); diff --git a/node_modules/traverse/test/siblings.js b/node_modules/traverse/test/siblings.js new file mode 100644 index 000000000..049632ef9 --- /dev/null +++ b/node_modules/traverse/test/siblings.js @@ -0,0 +1,39 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('siblings', function (t) { + var obj = { a: 1, b: 2, c: [4, 5, 6] }; + + var res = traverse(obj).reduce(function (acc) { + /* eslint no-param-reassign: 0 */ + var p = '/' + this.path.join('/'); + if (this.parent) { + acc[p] = { + siblings: this.parent.keys, + key: this.key, + index: this.parent.keys.indexOf(this.key), + }; + } else { + acc[p] = { + siblings: [], + key: this.key, + index: -1, + }; + } + return acc; + }, {}); + + t.same(res, { + '/': { siblings: [], key: undefined, index: -1 }, + '/a': { siblings: ['a', 'b', 'c'], key: 'a', index: 0 }, + '/b': { siblings: ['a', 'b', 'c'], key: 'b', index: 1 }, + '/c': { siblings: ['a', 'b', 'c'], key: 'c', index: 2 }, + '/c/0': { siblings: ['0', '1', '2'], key: '0', index: 0 }, + '/c/1': { siblings: ['0', '1', '2'], key: '1', index: 1 }, + '/c/2': { siblings: ['0', '1', '2'], key: '2', index: 2 }, + }); + + t.end(); +}); diff --git a/node_modules/traverse/test/stop.js b/node_modules/traverse/test/stop.js new file mode 100644 index 000000000..86fc12805 --- /dev/null +++ b/node_modules/traverse/test/stop.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('stop', function (t) { + var visits = 0; + traverse('abcdefghij'.split('')).forEach(function (node) { + if (typeof node === 'string') { + visits += 1; + if (node === 'e') { this.stop(); } + } + }); + + t.equal(visits, 5); + t.end(); +}); + +test('stopMap', function (t) { + var s = traverse('abcdefghij'.split('')).map(function (node) { + if (typeof node === 'string') { + if (node === 'e') { this.stop(); } + return node.toUpperCase(); + } + return void undefined; + }).join(''); + + t.equal(s, 'ABCDEfghij'); + t.end(); +}); + +test('stopReduce', function (t) { + var obj = { + a: [4, 5], + b: [6, [7, 8, 9]], + }; + var xs = traverse(obj).reduce(function (acc, node) { + if (this.isLeaf) { + if (node === 7) { this.stop(); } else { acc.push(node); } + } + return acc; + }, []); + + t.same(xs, [4, 5, 6]); + t.end(); +}); diff --git a/node_modules/traverse/test/stringify.js b/node_modules/traverse/test/stringify.js new file mode 100644 index 000000000..e7bf65df5 --- /dev/null +++ b/node_modules/traverse/test/stringify.js @@ -0,0 +1,35 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('stringify', function (t) { + var obj = [5, 6, -3, [7, 8, -2, 1], { f: 10, g: -13 }]; + + var s = ''; + traverse(obj).forEach(function (node) { + if (Array.isArray(node)) { + this.before(function () { s += '['; }); + this.post(function (child) { + if (!child.isLast) { s += ','; } + }); + this.after(function () { s += ']'; }); + } else if (typeof node === 'object') { + this.before(function () { s += '{'; }); + this.pre(function (x, key) { + s += '"' + key + '":'; + }); + this.post(function (child) { + if (!child.isLast) { s += ','; } + }); + this.after(function () { s += '}'; }); + } else if (typeof node === 'function') { + s += 'null'; + } else { + s += node.toString(); + } + }); + + t.equal(s, JSON.stringify(obj)); + t.end(); +}); diff --git a/node_modules/traverse/test/subexpr.js b/node_modules/traverse/test/subexpr.js new file mode 100644 index 000000000..6aeba0544 --- /dev/null +++ b/node_modules/traverse/test/subexpr.js @@ -0,0 +1,41 @@ +'use strict'; + +var traverse = require('../'); +var test = require('tape'); + +test('subexpr', function (t) { + var obj = ['a', 4, 'b', 5, 'c', 6]; + var r = traverse(obj).map(function (x) { + if (typeof x === 'number') { + this.update([x - 0.1, x, x + 0.1], true); + } + }); + + t.same(obj, ['a', 4, 'b', 5, 'c', 6]); + t.same(r, [ + 'a', [3.9, 4, 4.1], + 'b', [4.9, 5, 5.1], + 'c', [5.9, 6, 6.1], + ]); + t.end(); +}); + +test('block', function (t) { + var obj = [[1], [2], [3]]; + var r = traverse(obj).map(function (x) { + if (Array.isArray(x) && !this.isRoot) { + if (x[0] === 5) { + this.block(); + } else { + this.update([[x[0] + 1]]); + } + } + }); + + t.same(r, [ + [[[[[5]]]]], + [[[[5]]]], + [[[5]]], + ]); + t.end(); +}); diff --git a/node_modules/traverse/test/super_deep.js b/node_modules/traverse/test/super_deep.js new file mode 100644 index 000000000..f7fd9718f --- /dev/null +++ b/node_modules/traverse/test/super_deep.js @@ -0,0 +1,56 @@ +'use strict'; + +var test = require('tape'); +var deepEqual = require('./lib/deep_equal'); + +function make() { + var a = { self: 'a' }; + var b = { self: 'b' }; + var c = { self: 'c' }; + var d = { self: 'd' }; + var e = { self: 'e' }; + + a.a = a; + a.b = b; + a.c = c; + + b.a = a; + b.b = b; + b.c = c; + + c.a = a; + c.b = b; + c.c = c; + c.d = d; + + d.a = a; + d.b = b; + d.c = c; + d.d = d; + d.e = e; + + e.a = a; + e.b = b; + e.c = c; + e.d = d; + e.e = e; + + return a; +} + +test('super_deep', function (t) { + var a0 = make(); + var a1 = make(); + t.ok(deepEqual(a0, a1)); + + a0.c.d.moo = true; + t.ok(!deepEqual(a0, a1)); + + a1.c.d.moo = true; + t.ok(deepEqual(a0, a1)); + + // TODO: this one + // a0.c.a = a1; + // t.ok(!deepEqual(a0, a1)); + t.end(); +}); diff --git a/node_modules/traverse/test/typed-array.js b/node_modules/traverse/test/typed-array.js new file mode 100644 index 000000000..b73992feb --- /dev/null +++ b/node_modules/traverse/test/typed-array.js @@ -0,0 +1,12 @@ +'use strict'; + +var test = require('tape'); +var traverse = require('../'); + +test('traverse an Uint8Array', { skip: typeof Uint8Array !== 'function' }, function (t) { + var obj = new Uint8Array(4); + var results = traverse(obj).map(function () {}); + t.same(results, obj); + t.end(); +}); + diff --git a/node_modules/trim-trailing-lines/index.js b/node_modules/trim-trailing-lines/index.js new file mode 100644 index 000000000..eff85c6ba --- /dev/null +++ b/node_modules/trim-trailing-lines/index.js @@ -0,0 +1,8 @@ +'use strict' + +module.exports = trimTrailingLines + +// Remove final newline characters from `value`. +function trimTrailingLines(value) { + return String(value).replace(/\n+$/, '') +} diff --git a/node_modules/trim-trailing-lines/license b/node_modules/trim-trailing-lines/license new file mode 100644 index 000000000..611b67581 --- /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 000000000..861198394 --- /dev/null +++ b/node_modules/trim-trailing-lines/package.json @@ -0,0 +1,72 @@ +{ + "name": "trim-trailing-lines", + "version": "1.1.4", + "description": "Remove final line feeds from a string", + "license": "MIT", + "keywords": [ + "trim", + "final", + "line", + "newline", + "characters" + ], + "repository": "wooorm/trim-trailing-lines", + "bugs": "https://github.com/wooorm/trim-trailing-lines/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": {}, + "devDependencies": { + "browserify": "^17.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark-cli": "^9.0.0", + "remark-preset-wooorm": "^8.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "xo": "^0.34.0" + }, + "scripts": { + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "build-bundle": "browserify . -s trimTrailingLines -o trim-trailing-lines.js", + "build-mangle": "browserify . -s trimTrailingLines -p tinyify -o trim-trailing-lines.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "trim-trailing-lines.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/trim-trailing-lines/readme.md b/node_modules/trim-trailing-lines/readme.md new file mode 100644 index 000000000..a9c1f441b --- /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 000000000..f1250e584 --- /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 000000000..c8aa68fa8 --- /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 000000000..4e9c8d36e --- /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 000000000..3460f523f --- /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 000000000..560b25891 --- /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 000000000..640c24cf3 --- /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 000000000..64ee5c69d --- /dev/null +++ b/node_modules/trim/package.json @@ -0,0 +1,18 @@ +{ + "name": "trim", + "version": "0.0.1", + "description": "Trim string whitespace", + "keywords": ["string", "trim"], + "author": "TJ Holowaychuk ", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index", + "component": { + "scripts": { + "trim/index.js": "index.js" + } + } +} diff --git a/node_modules/trough/index.js b/node_modules/trough/index.js new file mode 100644 index 000000000..2b73d8680 --- /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 000000000..3f0166f62 --- /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 000000000..cbf7782f8 --- /dev/null +++ b/node_modules/trough/package.json @@ -0,0 +1,75 @@ +{ + "name": "trough", + "version": "1.0.5", + "description": "Middleware: a channel used to convey a liquid", + "license": "MIT", + "keywords": [ + "middleware", + "ware" + ], + "repository": "wooorm/trough", + "bugs": "https://github.com/wooorm/trough/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js", + "wrap.js" + ], + "dependencies": {}, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify index.js -s trough > trough.js", + "build-mangle": "browserify index.js -s trough -p tinyify > trough.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-reflect-apply": "off", + "unicorn/prefer-type-error": "off", + "guard-for-in": "off" + }, + "ignores": [ + "trough.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + } +} diff --git a/node_modules/trough/readme.md b/node_modules/trough/readme.md new file mode 100644 index 000000000..ce3d38bca --- /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 000000000..cf568c07a --- /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/try-resolve/README.md b/node_modules/try-resolve/README.md new file mode 100644 index 000000000..9fe88837e --- /dev/null +++ b/node_modules/try-resolve/README.md @@ -0,0 +1,34 @@ +# try-resolve + +## Installation + +```sh +$ npm install try-resolve +``` + +## Usage + +```javascrpt +var resolve = require("try-resolve"); +``` + +### `resolve(filename, [require])` + + - `filename` is a filename to be resolved. + - `require` is an optional instance of the `require` function from any file. + +Returns `null` if the file can't be required, otherwise it returns an absolute filename string. + +#### Example + +```javascript +if (require("try-resolve")("/home/sebastian/file")) { + // this file can be required +} else { + // it can't +} +``` + +### `resolve.relative(filename)` + +Resolve a filename relative to the cwd. diff --git a/node_modules/try-resolve/index.js b/node_modules/try-resolve/index.js new file mode 100644 index 000000000..d2652c6e9 --- /dev/null +++ b/node_modules/try-resolve/index.js @@ -0,0 +1,27 @@ +var Module = require("module"); + +var resolve = module.exports = function (loc, _require) { + try { + return (_require || require).resolve(loc); + } catch (err) { + return null; + } +}; + +var relativeMod; + +resolve.relative = function (loc) { + // we're in the browser, probably + if (typeof Module === "object") return null; + + if (!relativeMod) { + relativeMod = new Module; + relativeMod.paths = Module._nodeModulePaths(process.cwd()); + } + + try { + return Module._resolveFilename(loc, relativeMod); + } catch (err) { + return null; + } +}; diff --git a/node_modules/try-resolve/package.json b/node_modules/try-resolve/package.json new file mode 100644 index 000000000..1345ecf44 --- /dev/null +++ b/node_modules/try-resolve/package.json @@ -0,0 +1,9 @@ +{ + "name": "try-resolve", + "version": "1.0.1", + "description": "Try and resolve a filename", + "main": "index.js", + "repository": "sebmck/try-resolve", + "author": "Sebastian McKenzie ", + "license": "MIT" +} diff --git a/node_modules/type-check/LICENSE b/node_modules/type-check/LICENSE new file mode 100644 index 000000000..525b11850 --- /dev/null +++ b/node_modules/type-check/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/type-check/README.md b/node_modules/type-check/README.md new file mode 100644 index 000000000..b170d67c2 --- /dev/null +++ b/node_modules/type-check/README.md @@ -0,0 +1,210 @@ +# type-check [![Build Status](https://travis-ci.org/gkz/type-check.png?branch=master)](https://travis-ci.org/gkz/type-check) + + + +`type-check` is a library which allows you to check the types of JavaScript values at runtime with a Haskell like type syntax. It is great for checking external input, for testing, or even for adding a bit of safety to your internal code. It is a major component of [levn](https://github.com/gkz/levn). MIT license. Version 0.4.0. Check out the [demo](http://gkz.github.io/type-check/). + +For updates on `type-check`, [follow me on twitter](https://twitter.com/gkzahariev). + + npm install type-check + +## Quick Examples + +```js +// Basic types: +var typeCheck = require('type-check').typeCheck; +typeCheck('Number', 1); // true +typeCheck('Number', 'str'); // false +typeCheck('Error', new Error); // true +typeCheck('Undefined', undefined); // true + +// Comment +typeCheck('count::Number', 1); // true + +// One type OR another type: +typeCheck('Number | String', 2); // true +typeCheck('Number | String', 'str'); // true + +// Wildcard, matches all types: +typeCheck('*', 2) // true + +// Array, all elements of a single type: +typeCheck('[Number]', [1, 2, 3]); // true +typeCheck('[Number]', [1, 'str', 3]); // false + +// Tuples, or fixed length arrays with elements of different types: +typeCheck('(String, Number)', ['str', 2]); // true +typeCheck('(String, Number)', ['str']); // false +typeCheck('(String, Number)', ['str', 2, 5]); // false + +// Object properties: +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2}); // false +typeCheck('{x: Number, y: Maybe Boolean}', {x: 2}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false, z: 3}); // false +typeCheck('{x: Number, y: Boolean, ...}', {x: 2, y: false, z: 3}); // true + +// A particular type AND object properties: +typeCheck('RegExp{source: String, ...}', /re/i); // true +typeCheck('RegExp{source: String, ...}', {source: 're'}); // false + +// Custom types: +var opt = {customTypes: + {Even: { typeOf: 'Number', validate: function(x) { return x % 2 === 0; }}}}; +typeCheck('Even', 2, opt); // true + +// Nested: +var type = '{a: (String, [Number], {y: Array, ...}), b: Error{message: String, ...}}' +typeCheck(type, {a: ['hi', [1, 2, 3], {y: [1, 'ms']}], b: new Error('oh no')}); // true +``` + +Check out the [type syntax format](#syntax) and [guide](#guide). + +## Usage + +`require('type-check');` returns an object that exposes four properties. `VERSION` is the current version of the library as a string. `typeCheck`, `parseType`, and `parsedTypeCheck` are functions. + +```js +// typeCheck(type, input, options); +typeCheck('Number', 2); // true + +// parseType(type); +var parsedType = parseType('Number'); // object + +// parsedTypeCheck(parsedType, input, options); +parsedTypeCheck(parsedType, 2); // true +``` + +### typeCheck(type, input, options) + +`typeCheck` checks a JavaScript value `input` against `type` written in the [type format](#type-format) (and taking account the optional `options`) and returns whether the `input` matches the `type`. + +##### arguments +* type - `String` - the type written in the [type format](#type-format) which to check against +* input - `*` - any JavaScript value, which is to be checked against the type +* options - `Maybe Object` - an optional parameter specifying additional options, currently the only available option is specifying [custom types](#custom-types) + +##### returns +`Boolean` - whether the input matches the type + +##### example +```js +typeCheck('Number', 2); // true +``` + +### parseType(type) + +`parseType` parses string `type` written in the [type format](#type-format) into an object representing the parsed type. + +##### arguments +* type - `String` - the type written in the [type format](#type-format) which to parse + +##### returns +`Object` - an object in the parsed type format representing the parsed type + +##### example +```js +parseType('Number'); // [{type: 'Number'}] +``` +### parsedTypeCheck(parsedType, input, options) + +`parsedTypeCheck` checks a JavaScript value `input` against parsed `type` in the parsed type format (and taking account the optional `options`) and returns whether the `input` matches the `type`. Use this in conjunction with `parseType` if you are going to use a type more than once. + +##### arguments +* type - `Object` - the type in the parsed type format which to check against +* input - `*` - any JavaScript value, which is to be checked against the type +* options - `Maybe Object` - an optional parameter specifying additional options, currently the only available option is specifying [custom types](#custom-types) + +##### returns +`Boolean` - whether the input matches the type + +##### example +```js +parsedTypeCheck([{type: 'Number'}], 2); // true +var parsedType = parseType('String'); +parsedTypeCheck(parsedType, 'str'); // true +``` + + +## Type Format + +### Syntax + +White space is ignored. The root node is a __Types__. + +* __Identifier__ = `[\$\w]+` - a group of any lower or upper case letters, numbers, underscores, or dollar signs - eg. `String` +* __Type__ = an `Identifier`, an `Identifier` followed by a `Structure`, just a `Structure`, or a wildcard `*` - eg. `String`, `Object{x: Number}`, `{x: Number}`, `Array{0: String, 1: Boolean, length: Number}`, `*` +* __Types__ = optionally a comment (an `Identifier` followed by a `::`), optionally the identifier `Maybe`, one or more `Type`, separated by `|` - eg. `Number`, `String | Date`, `Maybe Number`, `Maybe Boolean | String` +* __Structure__ = `Fields`, or a `Tuple`, or an `Array` - eg. `{x: Number}`, `(String, Number)`, `[Date]` +* __Fields__ = a `{`, followed one or more `Field` separated by a comma `,` (trailing comma `,` is permitted), optionally an `...` (always preceded by a comma `,`), followed by a `}` - eg. `{x: Number, y: String}`, `{k: Function, ...}` +* __Field__ = an `Identifier`, followed by a colon `:`, followed by `Types` - eg. `x: Date | String`, `y: Boolean` +* __Tuple__ = a `(`, followed by one or more `Types` separated by a comma `,` (trailing comma `,` is permitted), followed by a `)` - eg `(Date)`, `(Number, Date)` +* __Array__ = a `[` followed by exactly one `Types` followed by a `]` - eg. `[Boolean]`, `[Boolean | Null]` + +### Guide + +`type-check` uses `Object.toString` to find out the basic type of a value. Specifically, + +```js +{}.toString.call(VALUE).slice(8, -1) +{}.toString.call(true).slice(8, -1) // 'Boolean' +``` +A basic type, eg. `Number`, uses this check. This is much more versatile than using `typeof` - for example, with `document`, `typeof` produces `'object'` which isn't that useful, and our technique produces `'HTMLDocument'`. + +You may check for multiple types by separating types with a `|`. The checker proceeds from left to right, and passes if the value is any of the types - eg. `String | Boolean` first checks if the value is a string, and then if it is a boolean. If it is none of those, then it returns false. + +Adding a `Maybe` in front of a list of multiple types is the same as also checking for `Null` and `Undefined` - eg. `Maybe String` is equivalent to `Undefined | Null | String`. + +You may add a comment to remind you of what the type is for by following an identifier with a `::` before a type (or multiple types). The comment is simply thrown out. + +The wildcard `*` matches all types. + +There are three types of structures for checking the contents of a value: 'fields', 'tuple', and 'array'. + +If used by itself, a 'fields' structure will pass with any type of object as long as it is an instance of `Object` and the properties pass - this allows for duck typing - eg. `{x: Boolean}`. + +To check if the properties pass, and the value is of a certain type, you can specify the type - eg. `Error{message: String}`. + +If you want to make a field optional, you can simply use `Maybe` - eg. `{x: Boolean, y: Maybe String}` will still pass if `y` is undefined (or null). + +If you don't care if the value has properties beyond what you have specified, you can use the 'etc' operator `...` - eg. `{x: Boolean, ...}` will match an object with an `x` property that is a boolean, and with zero or more other properties. + +For an array, you must specify one or more types (separated by `|`) - it will pass for something of any length as long as each element passes the types provided - eg. `[Number]`, `[Number | String]`. + +A tuple checks for a fixed number of elements, each of a potentially different type. Each element is separated by a comma - eg. `(String, Number)`. + +An array and tuple structure check that the value is of type `Array` by default, but if another type is specified, they will check for that instead - eg. `Int32Array[Number]`. You can use the wildcard `*` to search for any type at all. + +Check out the [type precedence](https://github.com/zaboco/type-precedence) library for type-check. + +## Options + +Options is an object. It is an optional parameter to the `typeCheck` and `parsedTypeCheck` functions. The only current option is `customTypes`. + + +### Custom Types + +__Example:__ + +```js +var options = { + customTypes: { + Even: { + typeOf: 'Number', + validate: function(x) { + return x % 2 === 0; + } + } + } +}; +typeCheck('Even', 2, options); // true +typeCheck('Even', 3, options); // false +``` + +`customTypes` allows you to set up custom types for validation. The value of this is an object. The keys of the object are the types you will be matching. Each value of the object will be an object having a `typeOf` property - a string, and `validate` property - a function. + +The `typeOf` property is the type the value should be (optional - if not set only `validate` will be used), and `validate` is a function which should return true if the value is of that type. `validate` receives one parameter, which is the value that we are checking. + +## Technical About + +`type-check` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/type-check/package.json b/node_modules/type-check/package.json new file mode 100644 index 000000000..2a57ea064 --- /dev/null +++ b/node_modules/type-check/package.json @@ -0,0 +1,39 @@ +{ + "name": "type-check", + "version": "0.4.0", + "author": "George Zahariev ", + "description": "type-check allows you to check the types of JavaScript values at runtime with a Haskell like type syntax.", + "homepage": "https://github.com/gkz/type-check", + "keywords": [ + "type", + "check", + "checking", + "library" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": "https://github.com/gkz/type-check/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/type-check.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "devDependencies": { + "livescript": "^1.6.0", + "mocha": "^7.1.1", + "browserify": "^16.5.1" + } +} diff --git a/node_modules/typed-array-buffer/.eslintrc b/node_modules/typed-array-buffer/.eslintrc new file mode 100644 index 000000000..46f3b120b --- /dev/null +++ b/node_modules/typed-array-buffer/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/typed-array-buffer/.github/FUNDING.yml b/node_modules/typed-array-buffer/.github/FUNDING.yml new file mode 100644 index 000000000..bf630d0a3 --- /dev/null +++ b/node_modules/typed-array-buffer/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/typed-array-buffer +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/node_modules/typed-array-buffer/.nycrc b/node_modules/typed-array-buffer/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/typed-array-buffer/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/typed-array-buffer/CHANGELOG.md b/node_modules/typed-array-buffer/CHANGELOG.md new file mode 100644 index 000000000..bf2db5895 --- /dev/null +++ b/node_modules/typed-array-buffer/CHANGELOG.md @@ -0,0 +1,50 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/typed-array-buffer/compare/v1.0.2...v1.0.3) - 2024-12-18 + +### Commits + +- [meta] update URLs [`aca9484`](https://github.com/inspect-js/typed-array-buffer/commit/aca9484b41f96767408e26e63854b5d86f759de8) +- [types] use shared config [`fcdcb05`](https://github.com/inspect-js/typed-array-buffer/commit/fcdcb05941a771826e1478a77aadd89c582e37cd) +- [actions] split out node 10-20, and 20+ [`5f5a406`](https://github.com/inspect-js/typed-array-buffer/commit/5f5a4067752d7bccecbaa8f6e143863d55197af9) +- [types] improve types [`f45042c`](https://github.com/inspect-js/typed-array-buffer/commit/f45042c07c04007217404d73aa77c26a73885210) +- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`0c937e7`](https://github.com/inspect-js/typed-array-buffer/commit/0c937e72e93dccc359c08cf1a9ef060e5f5e1a8d) +- [Refactor] use `call-bound` directly [`cf4aba4`](https://github.com/inspect-js/typed-array-buffer/commit/cf4aba4d8c1702ee9130abaf8a6a72907ca96ce0) +- [Tests] replace `aud` with `npm audit` [`a3abb73`](https://github.com/inspect-js/typed-array-buffer/commit/a3abb739300d1de6e88736019d718d831c7a4cca) +- [Dev Deps] update `@types/tape` [`548ffdc`](https://github.com/inspect-js/typed-array-buffer/commit/548ffdc881726b060ac92fc0c59ab0bb150df91f) +- [Deps] update `is-typed-array` [`3b5deb1`](https://github.com/inspect-js/typed-array-buffer/commit/3b5deb191a1c942deced0273b07fe69bc8de39ab) +- [Deps] update `call-bind` [`02cbc0c`](https://github.com/inspect-js/typed-array-buffer/commit/02cbc0cca2f69d81cdeedf7beebae2a5dd9dd4f7) +- [Tests] add attw and `postlint` [`f6daa66`](https://github.com/inspect-js/typed-array-buffer/commit/f6daa6695a69878d845070b90ab0bbf6392ebb03) +- [Dev Deps] add missing peer dep [`c9faf2a`](https://github.com/inspect-js/typed-array-buffer/commit/c9faf2ac04fc78410aeb144405db110fe9b60b6c) + +## [v1.0.2](https://github.com/inspect-js/typed-array-buffer/compare/v1.0.1...v1.0.2) - 2024-02-19 + +### Commits + +- add types [`23c6fba`](https://github.com/inspect-js/typed-array-buffer/commit/23c6fba167dbc8c1e9291eed3f68e64a5651075a) +- [Deps] update `available-typed-arrays` [`5f68ba1`](https://github.com/inspect-js/typed-array-buffer/commit/5f68ba1fdcd004af46d529fbb08220de2254cf43) +- [Deps] update `call-bind` [`54a92ce`](https://github.com/inspect-js/typed-array-buffer/commit/54a92ce4caf023c8680ffe64534ba881b78cdc17) +- [Dev Deps] update `tape` [`b0b3342`](https://github.com/inspect-js/typed-array-buffer/commit/b0b3342bcbefae5f3dff01b0e3734b08ca927f58) + +## [v1.0.1](https://github.com/inspect-js/typed-array-buffer/compare/v1.0.0...v1.0.1) - 2024-02-06 + +### Commits + +- [Dev Deps] update `aud`, `available-typed-arrays`, `npmignore`, `object-inspect`, `tape` [`5334477`](https://github.com/inspect-js/typed-array-buffer/commit/53344773866f35820dc4deef1aa47ec7890f2b02) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`e2511e0`](https://github.com/inspect-js/typed-array-buffer/commit/e2511e011a2331bd4a36ad6003a98b1cf766bc26) +- [Deps] update `call-bind`, `get-intrinsic`, `is-typed-array` [`36c3b11`](https://github.com/inspect-js/typed-array-buffer/commit/36c3b11efc9bce98de8bee5f81dcae4305876893) +- [meta] add `sideEffects` flag [`46cc1f4`](https://github.com/inspect-js/typed-array-buffer/commit/46cc1f4a8b8875fc6e84b33182602ec37655bbbd) + +## v1.0.0 - 2023-06-05 + +### Commits + +- Initial implementation, tests, readme [`5bc2953`](https://github.com/inspect-js/typed-array-buffer/commit/5bc295337b4310659832fc08699a4d10c2dbbded) +- Initial commit [`98b8ac9`](https://github.com/inspect-js/typed-array-buffer/commit/98b8ac90f407c368effa25d395aeea1d72e1d4b6) +- npm init [`6a4a73c`](https://github.com/inspect-js/typed-array-buffer/commit/6a4a73c66b1f13fd17699c6500a4979003676696) +- Only apps should have lockfiles [`7226abf`](https://github.com/inspect-js/typed-array-buffer/commit/7226abfda329b99dc25526c48740b076d128a7be) diff --git a/node_modules/typed-array-buffer/LICENSE b/node_modules/typed-array-buffer/LICENSE new file mode 100644 index 000000000..b4213ac64 --- /dev/null +++ b/node_modules/typed-array-buffer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/typed-array-buffer/README.md b/node_modules/typed-array-buffer/README.md new file mode 100644 index 000000000..da71d75f4 --- /dev/null +++ b/node_modules/typed-array-buffer/README.md @@ -0,0 +1,42 @@ +# typed-array-buffer [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Get the ArrayBuffer out of a TypedArray, robustly. + +This will work in node <= 0.10 and < 0.11.4, where there's no prototype accessor, only a nonconfigurable own property. +It will also work in modern engines where `TypedArray.prototype.buffer` has been deleted after this module has loaded. + +## Example + +```js +const typedArrayBuffer = require('typed-array-buffer'); +const assert = require('assert'); + +const arr = new Uint8Array(0); +assert.equal(arr.buffer, typedArrayBuffer(arr)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/typed-array-buffer +[npm-version-svg]: https://versionbadg.es/inspect-js/typed-array-buffer.svg +[deps-svg]: https://david-dm.org/inspect-js/typed-array-buffer.svg +[deps-url]: https://david-dm.org/inspect-js/typed-array-buffer +[dev-deps-svg]: https://david-dm.org/inspect-js/typed-array-buffer/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/typed-array-buffer#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/typed-array-buffer.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/typed-array-buffer.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/typed-array-buffer.svg +[downloads-url]: https://npm-stat.com/charts.html?package=typed-array-buffer +[codecov-image]: https://codecov.io/gh/inspect-js/typed-array-buffer/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/typed-array-buffer/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/typed-array-buffer +[actions-url]: https://github.com/inspect-js/typed-array-buffer/actions diff --git a/node_modules/typed-array-buffer/index.d.ts b/node_modules/typed-array-buffer/index.d.ts new file mode 100644 index 000000000..68ce88d6e --- /dev/null +++ b/node_modules/typed-array-buffer/index.d.ts @@ -0,0 +1,9 @@ +import type { TypedArray } from 'is-typed-array'; + +declare namespace typedArrayBuffer{ + export type { TypedArray }; +} + +declare function typedArrayBuffer(x: typedArrayBuffer.TypedArray): ArrayBuffer; + +export = typedArrayBuffer; diff --git a/node_modules/typed-array-buffer/index.js b/node_modules/typed-array-buffer/index.js new file mode 100644 index 000000000..a27c2b97a --- /dev/null +++ b/node_modules/typed-array-buffer/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var $TypeError = require('es-errors/type'); + +var callBound = require('call-bound'); + +/** @type {undefined | ((thisArg: import('.').TypedArray) => Buffer)} */ +var $typedArrayBuffer = callBound('TypedArray.prototype.buffer', true); + +var isTypedArray = require('is-typed-array'); + +/** @type {import('.')} */ +// node <= 0.10, < 0.11.4 has a nonconfigurable own property instead of a prototype getter +module.exports = $typedArrayBuffer || function typedArrayBuffer(x) { + if (!isTypedArray(x)) { + throw new $TypeError('Not a Typed Array'); + } + return x.buffer; +}; diff --git a/node_modules/typed-array-buffer/package.json b/node_modules/typed-array-buffer/package.json new file mode 100644 index 000000000..bef6fb8a6 --- /dev/null +++ b/node_modules/typed-array-buffer/package.json @@ -0,0 +1,82 @@ +{ + "name": "typed-array-buffer", + "version": "1.0.3", + "description": "Get the ArrayBuffer out of a TypedArray, robustly.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/typed-array-buffer.git" + }, + "keywords": [ + "typed array", + "arraybuffer", + "buffer" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/typed-array-buffer/issues" + }, + "homepage": "https://github.com/inspect-js/typed-array-buffer#readme", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.8.0", + "auto-changelog": "^2.5.0", + "available-typed-arrays": "^1.0.7", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/typed-array-buffer/test/index.js b/node_modules/typed-array-buffer/test/index.js new file mode 100644 index 000000000..9596317ed --- /dev/null +++ b/node_modules/typed-array-buffer/test/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var test = require('tape'); +var availableTypedArrays = require('available-typed-arrays')(); +var forEach = require('for-each'); +var v = require('es-value-fixtures'); +var inspect = require('object-inspect'); + +var typedArrayBuffer = require('../'); + +test('typedArrayBuffer', function (t) { + // @ts-expect-error TS sucks at concat + forEach([].concat(v.primitives, v.objects), function (nonTA) { + t['throws'](function () { typedArrayBuffer(nonTA); }, TypeError, inspect(nonTA) + ' is not a Typed Array'); + }); + + forEach(availableTypedArrays, function (TA) { + var ta = new global[TA](0); + t.equal(typedArrayBuffer(ta), ta.buffer, inspect(ta) + ' has the same buffer as its own buffer property'); + }); + + t.end(); +}); diff --git a/node_modules/typed-array-buffer/tsconfig.json b/node_modules/typed-array-buffer/tsconfig.json new file mode 100644 index 000000000..d9a6668c3 --- /dev/null +++ b/node_modules/typed-array-buffer/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/typed-array-byte-length/.eslintrc b/node_modules/typed-array-byte-length/.eslintrc new file mode 100644 index 000000000..7c87f5690 --- /dev/null +++ b/node_modules/typed-array-byte-length/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + + "extends": "@ljharb", + + "globals": { + "Uint8Array": false, + }, + + "rules": { + }, +} diff --git a/node_modules/typed-array-byte-length/.github/FUNDING.yml b/node_modules/typed-array-byte-length/.github/FUNDING.yml new file mode 100644 index 000000000..7d6aac43f --- /dev/null +++ b/node_modules/typed-array-byte-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/typed-array-length +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/typed-array-byte-length/.nycrc b/node_modules/typed-array-byte-length/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/typed-array-byte-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/typed-array-byte-length/CHANGELOG.md b/node_modules/typed-array-byte-length/CHANGELOG.md new file mode 100644 index 000000000..15cb1ba3f --- /dev/null +++ b/node_modules/typed-array-byte-length/CHANGELOG.md @@ -0,0 +1,44 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/typed-array-byte-length/compare/v1.0.2...v1.0.3) - 2024-12-17 + +### Commits + +- [types] oops, this is a type export, not a value export [`2fcf3e8`](https://github.com/inspect-js/typed-array-byte-length/commit/2fcf3e87f0312bca866dd24e805641f9c2c0798b) + +## [v1.0.2](https://github.com/inspect-js/typed-array-byte-length/compare/v1.0.1...v1.0.2) - 2024-12-17 + +### Commits + +- [types] improve types [`fcc9606`](https://github.com/inspect-js/typed-array-byte-length/commit/fcc9606bf4f27d1299aacbfa3011973ecf3f25bc) +- [types] use shared config [`ca29c46`](https://github.com/inspect-js/typed-array-byte-length/commit/ca29c46795620d624bcb6cbdbc32c1b0580ab0f8) +- [actions] split out node 10-20, and 20+ [`9a38c81`](https://github.com/inspect-js/typed-array-byte-length/commit/9a38c81be40d6e34b4a1cbe3d83dde8806a998cc) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `object-inspect`, `tape` [`78cd1f2`](https://github.com/inspect-js/typed-array-byte-length/commit/78cd1f274612d46207951cf16a05615d2d14d13e) +- [Deps] update `call-bind`, `gopd`, `has-proto`, `is-typed-array` [`8c13b84`](https://github.com/inspect-js/typed-array-byte-length/commit/8c13b84060a47865c6f6f5fafdeccfdf8f304258) +- [Tests] replace `aud` with `npm audit` [`0d9aee3`](https://github.com/inspect-js/typed-array-byte-length/commit/0d9aee379568e90c7898163b43163c3287004e71) +- [Tests] use `@arethetypeswrong/cli` [`abf28fa`](https://github.com/inspect-js/typed-array-byte-length/commit/abf28fa1baff255683c3f38fe594271178199743) +- [Dev Deps] add missing peer dep [`dfd248d`](https://github.com/inspect-js/typed-array-byte-length/commit/dfd248d58080f8c74990d76202e72acd4f3e9fa0) + +## [v1.0.1](https://github.com/inspect-js/typed-array-byte-length/compare/v1.0.0...v1.0.1) - 2024-02-20 + +### Commits + +- add types [`3144671`](https://github.com/inspect-js/typed-array-byte-length/commit/3144671ca4035136c558a107ce61af255ae3e858) +- [actions] skip ls check on node < 10; remove redundant finisher [`0f83947`](https://github.com/inspect-js/typed-array-byte-length/commit/0f83947bfe641fd87253330a6a83e8b7571e5c6a) +- [Refactor] use `gopd` [`507b948`](https://github.com/inspect-js/typed-array-byte-length/commit/507b948f9e754ad5b0888a15558448ec879c04c4) +- [Dev Deps] update `aud`, `available-typed-arrays`, `npmignore`, `object-inspect`, `tape` [`aba282d`](https://github.com/inspect-js/typed-array-byte-length/commit/aba282da3a3e16f648ceb4bc4f174cf4942a94e9) +- [Deps] update `call-bind`, `has-proto`, `is-typed-array` [`acfe4a9`](https://github.com/inspect-js/typed-array-byte-length/commit/acfe4a9081f35cea3b450b07a4736e1ab037a708) +- [meta] add `sideEffects` flag [`063a8a7`](https://github.com/inspect-js/typed-array-byte-length/commit/063a8a7ec8c134a012903531beccfc4418f701d0) + +## v1.0.0 - 2023-07-14 + +### Commits + +- Initial implementation, tests, readme [`b8800c8`](https://github.com/inspect-js/typed-array-byte-length/commit/b8800c8f7f0fddd8744fd13dfa6239a504b4dc8d) +- Initial commit [`72723d8`](https://github.com/inspect-js/typed-array-byte-length/commit/72723d8f8fbff27d74b19f5e096d2eb2087d90dc) +- Only apps should have lockfiles [`a7dfc57`](https://github.com/inspect-js/typed-array-byte-length/commit/a7dfc57098655049b9c43cf1c3a39f24205821be) diff --git a/node_modules/typed-array-byte-length/LICENSE b/node_modules/typed-array-byte-length/LICENSE new file mode 100644 index 000000000..707437b57 --- /dev/null +++ b/node_modules/typed-array-byte-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/typed-array-byte-length/README.md b/node_modules/typed-array-byte-length/README.md new file mode 100644 index 000000000..a6172618f --- /dev/null +++ b/node_modules/typed-array-byte-length/README.md @@ -0,0 +1,70 @@ +# typed-array-byte-offset [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly get the byte offset of a Typed Array, or `false` if it is not a Typed Array. Works cross-realm, in every engine, even if the `byteOffset` property is overridden. + +## Example + +```js +var typedArrayByteOffset = require('typed-array-byte-offset'); +var assert = require('assert'); + +assert.equal(false, typedArrayByteOffset(undefined)); +assert.equal(false, typedArrayByteOffset(null)); +assert.equal(false, typedArrayByteOffset(false)); +assert.equal(false, typedArrayByteOffset(true)); +assert.equal(false, typedArrayByteOffset([])); +assert.equal(false, typedArrayByteOffset({})); +assert.equal(false, typedArrayByteOffset(/a/g)); +assert.equal(false, typedArrayByteOffset(new RegExp('a', 'g'))); +assert.equal(false, typedArrayByteOffset(new Date())); +assert.equal(false, typedArrayByteOffset(42)); +assert.equal(false, typedArrayByteOffset(NaN)); +assert.equal(false, typedArrayByteOffset(Infinity)); +assert.equal(false, typedArrayByteOffset(new Number(42))); +assert.equal(false, typedArrayByteOffset('foo')); +assert.equal(false, typedArrayByteOffset(Object('foo'))); +assert.equal(false, typedArrayByteOffset(function () {})); +assert.equal(false, typedArrayByteOffset(function* () {})); +assert.equal(false, typedArrayByteOffset(x => x * x)); +assert.equal(false, typedArrayByteOffset([])); + +const buffer = new ArrayBuffer(32); + +assert.equal(8, typedArrayByteOffset(new Int8Array(buffer, 8))); +assert.equal(8, typedArrayByteOffset(new Uint8Array(buffer, 8))); +assert.equal(8, typedArrayByteOffset(new Uint8ClampedArray(buffer, 8))); +assert.equal(4, typedArrayByteOffset(new Int16Array(buffer, 4))); +assert.equal(4, typedArrayByteOffset(new Uint16Array(buffer, 4))); +assert.equal(8, typedArrayByteOffset(new Int32Array(buffer, 8))); +assert.equal(8, typedArrayByteOffset(new Uint32Array(buffer, 8))); +assert.equal(16, typedArrayByteOffset(new Float32Array(buffer, 16))); +assert.equal(16, typedArrayByteOffset(new Float64Array(buffer, 16))); +assert.equal(16, typedArrayByteOffset(new BigInt64Array(buffer, 16))); +assert.equal(16, typedArrayByteOffset(new BigUint64Array(buffer, 16))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/typed-array-byte-offset +[npm-version-svg]: https://versionbadg.es/inspect-js/typed-array-byte-offset.svg +[deps-svg]: https://david-dm.org/inspect-js/typed-array-byte-offset.svg +[deps-url]: https://david-dm.org/inspect-js/typed-array-byte-offset +[dev-deps-svg]: https://david-dm.org/inspect-js/typed-array-byte-offset/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/typed-array-byte-offset#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/typed-array-byte-offset.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/typed-array-byte-offset.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/typed-array-byte-offset.svg +[downloads-url]: https://npm-stat.com/charts.html?package=typed-array-byte-offset +[codecov-image]: https://codecov.io/gh/inspect-js/typed-array-byte-offset/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/typed-array-byte-offset/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/typed-array-byte-offset +[actions-url]: https://github.com/inspect-js/typed-array-byte-offset/actions diff --git a/node_modules/typed-array-byte-length/index.d.ts b/node_modules/typed-array-byte-length/index.d.ts new file mode 100644 index 000000000..31b834e93 --- /dev/null +++ b/node_modules/typed-array-byte-length/index.d.ts @@ -0,0 +1,10 @@ +import type { TypedArray } from 'is-typed-array'; + +declare namespace typedArrayByteLength { + export type { TypedArray }; +} + +declare function typedArrayByteLength(value: TypedArray): number; +declare function typedArrayByteLength(value: unknown): false; + +export = typedArrayByteLength; \ No newline at end of file diff --git a/node_modules/typed-array-byte-length/index.js b/node_modules/typed-array-byte-length/index.js new file mode 100644 index 000000000..3200a6437 --- /dev/null +++ b/node_modules/typed-array-byte-length/index.js @@ -0,0 +1,85 @@ +'use strict'; + +var callBind = require('call-bind'); +var forEach = require('for-each'); +var gOPD = require('gopd'); +var hasProto = require('has-proto')(); +var isTypedArray = require('is-typed-array'); + +var typedArrays = require('available-typed-arrays')(); + +/** @typedef {import('possible-typed-array-names')[number]} TypedArrayName */ +/** @typedef {(value: import('.').TypedArray) => number} Getter */ + +/** @type {Partial & { __proto__: null }>} */ +var getters = { + __proto__: null +}; + +var oDP = Object.defineProperty; +if (gOPD) { + /** @type {Getter} */ + var getByteLength = function (x) { + return x.byteLength; + }; + forEach(typedArrays, function (typedArray) { + // In Safari 7, Typed Array constructors are typeof object + if (typeof global[typedArray] === 'function' || typeof global[typedArray] === 'object') { + var TA = global[typedArray]; + /** @type {import('.').TypedArray} */ + var Proto = TA.prototype; + // @ts-expect-error TS doesn't narrow properly inside callbacks + var descriptor = gOPD(Proto, 'byteLength'); + if (!descriptor && hasProto) { + // @ts-expect-error hush, TS, every object has a dunder proto + var superProto = Proto.__proto__; // eslint-disable-line no-proto + // @ts-expect-error TS doesn't narrow properly inside callbacks + descriptor = gOPD(superProto, 'byteLength'); + } + // Opera 12.16 has a magic byteLength data property on instances AND on Proto + if (descriptor && descriptor.get) { + getters[typedArray] = callBind(descriptor.get); + } else if (oDP) { + // this is likely an engine where instances have a magic byteLength data property + var arr = new global[typedArray](2); + // @ts-expect-error TS doesn't narrow properly inside callbacks + descriptor = gOPD(arr, 'byteLength'); + if (descriptor && descriptor.configurable) { + oDP(arr, 'length', { value: 3 }); + } + if (arr.length === 2) { + getters[typedArray] = getByteLength; + } + } + } + }); +} + +/** @type {Getter} */ +var tryTypedArrays = function tryAllTypedArrays(value) { + /** @type {number} */ var foundByteLength; + forEach( + // eslint-disable-next-line no-extra-parens + /** @type {Record} */ (getters), + /** @type {(getter: Getter) => void} */ function (getter) { + if (typeof foundByteLength !== 'number') { + try { + var byteLength = getter(value); + if (typeof byteLength === 'number') { + foundByteLength = byteLength; + } + } catch (e) {} + } + } + ); + // @ts-expect-error TS can't guarantee the callback is invoked sync + return foundByteLength; +}; + +/** @type {import('.')} */ +module.exports = function typedArrayByteLength(value) { + if (!isTypedArray(value)) { + return false; + } + return tryTypedArrays(value); +}; diff --git a/node_modules/typed-array-byte-length/package.json b/node_modules/typed-array-byte-length/package.json new file mode 100644 index 000000000..289379e2b --- /dev/null +++ b/node_modules/typed-array-byte-length/package.json @@ -0,0 +1,113 @@ +{ + "name": "typed-array-byte-length", + "version": "1.0.3", + "description": "Robustly get the byte length of a Typed Array", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/typed-array-byte-length.git" + }, + "keywords": [ + "typed", + "array", + "byteLength", + "byte", + "length", + "robust", + "es", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + "BigInt64Array", + "BigUint64Array" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/typed-array-byte-length/issues" + }, + "homepage": "https://github.com/inspect-js/typed-array-byte-length#readme", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/call-bind": "^1.0.5", + "@types/for-each": "^0.3.3", + "@types/gopd": "^1.0.3", + "@types/is-callable": "^1.1.2", + "@types/make-arrow-function": "^1.2.2", + "@types/make-generator-function": "^2.0.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.7.0", + "auto-changelog": "^2.5.0", + "available-typed-arrays": "^1.0.7", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "is-callable": "^1.2.7", + "make-arrow-function": "^1.2.0", + "make-generator-function": "^2.0.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "testling": { + "files": "test/index.js" + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/typed-array-byte-length/test/index.js b/node_modules/typed-array-byte-length/test/index.js new file mode 100644 index 000000000..0bf215366 --- /dev/null +++ b/node_modules/typed-array-byte-length/test/index.js @@ -0,0 +1,83 @@ +'use strict'; + +var test = require('tape'); +var typedArrayByteLength = require('../'); +var isCallable = require('is-callable'); +var generators = require('make-generator-function')(); +var arrowFn = require('make-arrow-function')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var availableTypedArrays = require('available-typed-arrays')(); + +test('not arrays', function (t) { + t.test('non-number/string primitives', function (st) { + // @ts-expect-error + st.equal(false, typedArrayByteLength(), 'undefined is not typed array'); + st.equal(false, typedArrayByteLength(null), 'null is not typed array'); + st.equal(false, typedArrayByteLength(false), 'false is not typed array'); + st.equal(false, typedArrayByteLength(true), 'true is not typed array'); + st.end(); + }); + + t.equal(false, typedArrayByteLength({}), 'object is not typed array'); + t.equal(false, typedArrayByteLength(/a/g), 'regex literal is not typed array'); + t.equal(false, typedArrayByteLength(new RegExp('a', 'g')), 'regex object is not typed array'); + t.equal(false, typedArrayByteLength(new Date()), 'new Date() is not typed array'); + + t.test('numbers', function (st) { + st.equal(false, typedArrayByteLength(42), 'number is not typed array'); + st.equal(false, typedArrayByteLength(Object(42)), 'number object is not typed array'); + st.equal(false, typedArrayByteLength(NaN), 'NaN is not typed array'); + st.equal(false, typedArrayByteLength(Infinity), 'Infinity is not typed array'); + st.end(); + }); + + t.test('strings', function (st) { + st.equal(false, typedArrayByteLength('foo'), 'string primitive is not typed array'); + st.equal(false, typedArrayByteLength(Object('foo')), 'string object is not typed array'); + st.end(); + }); + + t.end(); +}); + +test('Functions', function (t) { + t.equal(false, typedArrayByteLength(function () {}), 'function is not typed array'); + t.end(); +}); + +test('Generators', { skip: generators.length === 0 }, function (t) { + forEach(generators, function (genFn) { + t.equal(false, typedArrayByteLength(genFn), 'generator function ' + inspect(genFn) + ' is not typed array'); + }); + t.end(); +}); + +test('Arrow functions', { skip: !arrowFn }, function (t) { + t.equal(false, typedArrayByteLength(arrowFn), 'arrow function is not typed array'); + t.end(); +}); + +test('Typed Arrays', { skip: availableTypedArrays.length === 0 }, function (t) { + var length = 64; + var byteLength = 32; + + forEach(availableTypedArrays, function (typedArray) { + var buffer = new ArrayBuffer(length); + var TypedArray = global[typedArray]; + if (isCallable(TypedArray)) { + // @ts-expect-error TS doesn't seem to know about the second TA arg + var arr = new TypedArray(buffer, byteLength); + t.equal(typedArrayByteLength(arr), byteLength, 'new ' + typedArray + '(new ArrayBuffer(' + length + '), ' + byteLength + ') is typed array of byte Length ' + byteLength); + } else { + t.comment('# SKIP ' + typedArray + ' is not supported'); + } + }); + + var buffer = new ArrayBuffer(8); + var uint8 = new Uint8Array(buffer, 2); + + t.equal(typedArrayByteLength(uint8), 6, 'byteLength is as expected'); + + t.end(); +}); diff --git a/node_modules/typed-array-byte-length/tsconfig.json b/node_modules/typed-array-byte-length/tsconfig.json new file mode 100644 index 000000000..dabbe230d --- /dev/null +++ b/node_modules/typed-array-byte-length/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ES2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/typed-array-byte-offset/.eslintrc b/node_modules/typed-array-byte-offset/.eslintrc new file mode 100644 index 000000000..7376ac839 --- /dev/null +++ b/node_modules/typed-array-byte-offset/.eslintrc @@ -0,0 +1,8 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + }, +} diff --git a/node_modules/typed-array-byte-offset/.github/FUNDING.yml b/node_modules/typed-array-byte-offset/.github/FUNDING.yml new file mode 100644 index 000000000..7d6aac43f --- /dev/null +++ b/node_modules/typed-array-byte-offset/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/typed-array-length +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/typed-array-byte-offset/.nycrc b/node_modules/typed-array-byte-offset/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/typed-array-byte-offset/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/typed-array-byte-offset/CHANGELOG.md b/node_modules/typed-array-byte-offset/CHANGELOG.md new file mode 100644 index 000000000..05a0360d7 --- /dev/null +++ b/node_modules/typed-array-byte-offset/CHANGELOG.md @@ -0,0 +1,61 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.4](https://github.com/inspect-js/typed-array-byte-offset/compare/v1.0.3...v1.0.4) - 2024-12-18 + +### Commits + +- [Tests] split out and enhance "no-proto" tests [`64d1a73`](https://github.com/inspect-js/typed-array-byte-offset/commit/64d1a73a0a7f20484ee817c4a6758121887e30d3) +- [types] improve types [`21f484f`](https://github.com/inspect-js/typed-array-byte-offset/commit/21f484f55f9c6e3406b5eacbc937aa2e195da731) +- [Tests] add `--disable-proto=delete` tests [`8f77f2a`](https://github.com/inspect-js/typed-array-byte-offset/commit/8f77f2af48e1522aae10e0429810907df9f9f6fc) +- [actions] re-add a finisher; add perms [`59c1b7b`](https://github.com/inspect-js/typed-array-byte-offset/commit/59c1b7bfab826bceb43441c60affb1c1ad4e6cc7) +- [Deps] update `call-bind`, `gopd`, `has-proto`, `reflect.getprototypeof` [`c0c30d5`](https://github.com/inspect-js/typed-array-byte-offset/commit/c0c30d57642858c8327b3d90b6104ccbb459d71a) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`2638bd5`](https://github.com/inspect-js/typed-array-byte-offset/commit/2638bd5d7000e6d902414aeac88c00a148f5b152) +- [Deps] update `is-typed-array`, `reflect.getprototypeof` [`11540a5`](https://github.com/inspect-js/typed-array-byte-offset/commit/11540a577044442ce42d684d00d4686d7613bed4) +- [Deps] update `is-typed-array` [`ad9cb70`](https://github.com/inspect-js/typed-array-byte-offset/commit/ad9cb70bcc09eaf535c24ce24a00716058833d64) +- [Dev Deps] update `@types/tape` [`2838854`](https://github.com/inspect-js/typed-array-byte-offset/commit/2838854db6053003b0818a337f1e2f95ab383bce) + +## [v1.0.3](https://github.com/inspect-js/typed-array-byte-offset/compare/v1.0.2...v1.0.3) - 2024-11-21 + +### Fixed + +- [Fix] avoid relying on `__proto__` accessor [`#4`](https://github.com/inspect-js/typed-array-byte-offset/issues/4) + +### Commits + +- [types] use shared config [`10b0823`](https://github.com/inspect-js/typed-array-byte-offset/commit/10b0823ecc13b95920cfa8f27fe61af5678fb67b) +- [actions] split out node 10-20, and 20+ [`11554a9`](https://github.com/inspect-js/typed-array-byte-offset/commit/11554a96ca11b85c7ad87118e1d811bfde2b9f32) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/object-inspect`, `auto-changelog`, `object-inspect`, `tape` [`c39dd06`](https://github.com/inspect-js/typed-array-byte-offset/commit/c39dd06d2868a724463722ff2f416b5c41171140) +- [Tests] run tsc and `@arethetypeswrong/cli` in CI [`0b984aa`](https://github.com/inspect-js/typed-array-byte-offset/commit/0b984aa64c86f4bcb476b716cdd16d67c39b68ca) +- [Tests] replace `aud` with `npm audit` [`512b59d`](https://github.com/inspect-js/typed-array-byte-offset/commit/512b59df0e567592282795bfec331193d828f2fc) + +## [v1.0.2](https://github.com/inspect-js/typed-array-byte-offset/compare/v1.0.1...v1.0.2) - 2024-02-20 + +### Commits + +- add types [`9eecdd2`](https://github.com/inspect-js/typed-array-byte-offset/commit/9eecdd245b089610d6ad49ef63c9df2b58c3e8a6) +- [actions] skip ls check on node < 10; remove redundant finisher [`4fb4c91`](https://github.com/inspect-js/typed-array-byte-offset/commit/4fb4c912f5eb8034f4e3705b30f3f7dcc7080039) +- [Deps] update `available-typed-arrays`, `has-proto` [`805cee2`](https://github.com/inspect-js/typed-array-byte-offset/commit/805cee207d73e12d526ff23d2c161f38283a1ed9) + +## [v1.0.1](https://github.com/inspect-js/typed-array-byte-offset/compare/v1.0.0...v1.0.1) - 2024-02-17 + +### Commits + +- [Dev Deps] update `aud`, `npmignore`, `object-inspect`, `tape` [`ffe7494`](https://github.com/inspect-js/typed-array-byte-offset/commit/ffe7494826fbb6d6bd11c40e03619b12a4ec2266) +- [Deps] update `available-typed-arrays`, `call-bind`, `is-typed-array` [`3006bd7`](https://github.com/inspect-js/typed-array-byte-offset/commit/3006bd7e343d191093802473277801d12bfdc7b2) +- [Refactor] use `gopd` [`45827ea`](https://github.com/inspect-js/typed-array-byte-offset/commit/45827ea7d9709cb1b3a9f2313eed76b71052b9c5) +- [Dev Deps] update `tape` [`e33d080`](https://github.com/inspect-js/typed-array-byte-offset/commit/e33d080ef6488b5f15afe1078a9e5711d9656538) +- [meta] add `sideEffects` flag [`f1dc0db`](https://github.com/inspect-js/typed-array-byte-offset/commit/f1dc0db73c1c4b93c15076602a3e30353878312c) + +## v1.0.0 - 2023-06-06 + +### Commits + +- Initial implementation, tests, readme [`f227633`](https://github.com/inspect-js/typed-array-byte-offset/commit/f2276337a907bdfe9725af1b36c3109e76f2430d) +- Initial commit [`806bbaf`](https://github.com/inspect-js/typed-array-byte-offset/commit/806bbaf81e0267aebce5ae68cbf138718513642a) +- npm init [`1151981`](https://github.com/inspect-js/typed-array-byte-offset/commit/1151981427eb1fddab8599d36e6afea50a78293f) +- Only apps should have lockfiles [`5fa9933`](https://github.com/inspect-js/typed-array-byte-offset/commit/5fa9933275f10bdb9e8a175cc70a8228d4811642) diff --git a/node_modules/typed-array-byte-offset/LICENSE b/node_modules/typed-array-byte-offset/LICENSE new file mode 100644 index 000000000..707437b57 --- /dev/null +++ b/node_modules/typed-array-byte-offset/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/typed-array-byte-offset/README.md b/node_modules/typed-array-byte-offset/README.md new file mode 100644 index 000000000..a6172618f --- /dev/null +++ b/node_modules/typed-array-byte-offset/README.md @@ -0,0 +1,70 @@ +# typed-array-byte-offset [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly get the byte offset of a Typed Array, or `false` if it is not a Typed Array. Works cross-realm, in every engine, even if the `byteOffset` property is overridden. + +## Example + +```js +var typedArrayByteOffset = require('typed-array-byte-offset'); +var assert = require('assert'); + +assert.equal(false, typedArrayByteOffset(undefined)); +assert.equal(false, typedArrayByteOffset(null)); +assert.equal(false, typedArrayByteOffset(false)); +assert.equal(false, typedArrayByteOffset(true)); +assert.equal(false, typedArrayByteOffset([])); +assert.equal(false, typedArrayByteOffset({})); +assert.equal(false, typedArrayByteOffset(/a/g)); +assert.equal(false, typedArrayByteOffset(new RegExp('a', 'g'))); +assert.equal(false, typedArrayByteOffset(new Date())); +assert.equal(false, typedArrayByteOffset(42)); +assert.equal(false, typedArrayByteOffset(NaN)); +assert.equal(false, typedArrayByteOffset(Infinity)); +assert.equal(false, typedArrayByteOffset(new Number(42))); +assert.equal(false, typedArrayByteOffset('foo')); +assert.equal(false, typedArrayByteOffset(Object('foo'))); +assert.equal(false, typedArrayByteOffset(function () {})); +assert.equal(false, typedArrayByteOffset(function* () {})); +assert.equal(false, typedArrayByteOffset(x => x * x)); +assert.equal(false, typedArrayByteOffset([])); + +const buffer = new ArrayBuffer(32); + +assert.equal(8, typedArrayByteOffset(new Int8Array(buffer, 8))); +assert.equal(8, typedArrayByteOffset(new Uint8Array(buffer, 8))); +assert.equal(8, typedArrayByteOffset(new Uint8ClampedArray(buffer, 8))); +assert.equal(4, typedArrayByteOffset(new Int16Array(buffer, 4))); +assert.equal(4, typedArrayByteOffset(new Uint16Array(buffer, 4))); +assert.equal(8, typedArrayByteOffset(new Int32Array(buffer, 8))); +assert.equal(8, typedArrayByteOffset(new Uint32Array(buffer, 8))); +assert.equal(16, typedArrayByteOffset(new Float32Array(buffer, 16))); +assert.equal(16, typedArrayByteOffset(new Float64Array(buffer, 16))); +assert.equal(16, typedArrayByteOffset(new BigInt64Array(buffer, 16))); +assert.equal(16, typedArrayByteOffset(new BigUint64Array(buffer, 16))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/typed-array-byte-offset +[npm-version-svg]: https://versionbadg.es/inspect-js/typed-array-byte-offset.svg +[deps-svg]: https://david-dm.org/inspect-js/typed-array-byte-offset.svg +[deps-url]: https://david-dm.org/inspect-js/typed-array-byte-offset +[dev-deps-svg]: https://david-dm.org/inspect-js/typed-array-byte-offset/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/typed-array-byte-offset#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/typed-array-byte-offset.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/typed-array-byte-offset.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/typed-array-byte-offset.svg +[downloads-url]: https://npm-stat.com/charts.html?package=typed-array-byte-offset +[codecov-image]: https://codecov.io/gh/inspect-js/typed-array-byte-offset/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/typed-array-byte-offset/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/typed-array-byte-offset +[actions-url]: https://github.com/inspect-js/typed-array-byte-offset/actions diff --git a/node_modules/typed-array-byte-offset/index.d.ts b/node_modules/typed-array-byte-offset/index.d.ts new file mode 100644 index 000000000..a664336ed --- /dev/null +++ b/node_modules/typed-array-byte-offset/index.d.ts @@ -0,0 +1,14 @@ +import TypedArrayNames from 'possible-typed-array-names'; + +declare namespace typedArrayByteOffset { + export type TypedArrayName = typeof TypedArrayNames[number]; + + export type TypedArrayConstructor = typeof globalThis[TypedArrayName]; + + export type TypedArray = TypedArrayConstructor['prototype']; +} + +declare function typedArrayByteOffset(value: typedArrayByteOffset.TypedArray): number; +declare function typedArrayByteOffset(value: unknown): false; + +export = typedArrayByteOffset; diff --git a/node_modules/typed-array-byte-offset/index.js b/node_modules/typed-array-byte-offset/index.js new file mode 100644 index 000000000..2ee4c5211 --- /dev/null +++ b/node_modules/typed-array-byte-offset/index.js @@ -0,0 +1,79 @@ +'use strict'; + +var forEach = require('for-each'); +var callBind = require('call-bind'); +var gPO = require('reflect.getprototypeof/polyfill')(); + +var typedArrays = require('available-typed-arrays')(); + +/** @typedef {(x: import('.').TypedArray) => number} ByteOffsetGetter */ + +/** @type {Record} */ +var getters = { + // @ts-expect-error TS can't handle __proto__ or `satisfies` in jsdoc + __proto__: null +}; + +var gOPD = require('gopd'); +var oDP = Object.defineProperty; +if (gOPD) { + /** @type {ByteOffsetGetter} */ + var getByteOffset = function (x) { + return x.byteOffset; + }; + forEach(typedArrays, function (typedArray) { + // In Safari 7, Typed Array constructors are typeof object + if (typeof global[typedArray] === 'function' || typeof global[typedArray] === 'object') { + var Proto = global[typedArray].prototype; + // @ts-expect-error TS can't guarantee the callback is invoked sync + var descriptor = gOPD(Proto, 'byteOffset'); + if (!descriptor) { + var superProto = gPO(Proto); + // @ts-expect-error TS can't guarantee the callback is invoked sync + descriptor = gOPD(superProto, 'byteOffset'); + } + // Opera 12.16 has a magic byteOffset data property on instances AND on Proto + if (descriptor && descriptor.get) { + getters[typedArray] = callBind(descriptor.get); + } else if (oDP) { + // this is likely an engine where instances have a magic byteOffset data property + var arr = new global[typedArray](2); + // @ts-expect-error TS can't guarantee the callback is invoked sync + descriptor = gOPD(arr, 'byteOffset'); + if (descriptor && descriptor.configurable) { + oDP(arr, 'length', { value: 3 }); + } + if (arr.length === 2) { + getters[typedArray] = getByteOffset; + } + } + } + }); +} + +/** @type {ByteOffsetGetter} */ +var tryTypedArrays = function tryAllTypedArrays(value) { + /** @type {number} */ var foundOffset; + forEach(getters, /** @type {(getter: ByteOffsetGetter) => void} */ function (getter) { + if (typeof foundOffset !== 'number') { + try { + var offset = getter(value); + if (typeof offset === 'number') { + foundOffset = offset; + } + } catch (e) {} + } + }); + // @ts-expect-error TS can't guarantee the callback is invoked sync + return foundOffset; +}; + +var isTypedArray = require('is-typed-array'); + +/** @type {import('.')} */ +module.exports = function typedArrayByteOffset(value) { + if (!isTypedArray(value)) { + return false; + } + return tryTypedArrays(value); +}; diff --git a/node_modules/typed-array-byte-offset/package.json b/node_modules/typed-array-byte-offset/package.json new file mode 100644 index 000000000..8707997be --- /dev/null +++ b/node_modules/typed-array-byte-offset/package.json @@ -0,0 +1,116 @@ +{ + "name": "typed-array-byte-offset", + "version": "1.0.4", + "description": "Robustly get the byte offset of a Typed Array", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/typed-array-byte-offset.git" + }, + "keywords": [ + "typed", + "array", + "byteOffset", + "byte", + "offset", + "robust", + "es", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + "BigInt64Array", + "BigUint64Array" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/typed-array-byte-offset/issues" + }, + "homepage": "https://github.com/inspect-js/typed-array-byte-offset#readme", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/call-bind": "^1.0.5", + "@types/es-abstract": "^1.17.9", + "@types/for-each": "^0.3.3", + "@types/gopd": "^1.0.3", + "@types/is-callable": "^1.1.2", + "@types/make-arrow-function": "^1.2.2", + "@types/make-generator-function": "^2.0.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.8.0", + "auto-changelog": "^2.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "is-callable": "^1.2.7", + "make-arrow-function": "^1.2.0", + "make-generator-function": "^2.0.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "possible-typed-array-names": "^1.0.0", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "testling": { + "files": "test/index.js" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types" + ] + } +} diff --git a/node_modules/typed-array-byte-offset/test/index.js b/node_modules/typed-array-byte-offset/test/index.js new file mode 100644 index 000000000..e3b140075 --- /dev/null +++ b/node_modules/typed-array-byte-offset/test/index.js @@ -0,0 +1,78 @@ +'use strict'; + +var test = require('tape'); +var typedArrayByteOffset = require('../'); +var isCallable = require('is-callable'); +var generators = require('make-generator-function')(); +var arrowFn = require('make-arrow-function')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); + +var typedArrayNames = require('possible-typed-array-names'); + +test('not arrays', function (t) { + t.test('non-number/string primitives', function (st) { + // @ts-expect-error + st.equal(false, typedArrayByteOffset(), 'undefined is not typed array'); + st.equal(false, typedArrayByteOffset(null), 'null is not typed array'); + st.equal(false, typedArrayByteOffset(false), 'false is not typed array'); + st.equal(false, typedArrayByteOffset(true), 'true is not typed array'); + st.end(); + }); + + t.equal(false, typedArrayByteOffset({}), 'object is not typed array'); + t.equal(false, typedArrayByteOffset(/a/g), 'regex literal is not typed array'); + t.equal(false, typedArrayByteOffset(new RegExp('a', 'g')), 'regex object is not typed array'); + t.equal(false, typedArrayByteOffset(new Date()), 'new Date() is not typed array'); + + t.test('numbers', function (st) { + st.equal(false, typedArrayByteOffset(42), 'number is not typed array'); + st.equal(false, typedArrayByteOffset(Object(42)), 'number object is not typed array'); + st.equal(false, typedArrayByteOffset(NaN), 'NaN is not typed array'); + st.equal(false, typedArrayByteOffset(Infinity), 'Infinity is not typed array'); + st.end(); + }); + + t.test('strings', function (st) { + st.equal(false, typedArrayByteOffset('foo'), 'string primitive is not typed array'); + st.equal(false, typedArrayByteOffset(Object('foo')), 'string object is not typed array'); + st.end(); + }); + + t.end(); +}); + +test('Functions', function (t) { + t.equal(false, typedArrayByteOffset(function () {}), 'function is not typed array'); + t.end(); +}); + +test('Generators', { skip: generators.length === 0 }, function (t) { + forEach(generators, function (genFn) { + t.equal(false, typedArrayByteOffset(genFn), 'generator function ' + inspect(genFn) + ' is not typed array'); + }); + t.end(); +}); + +test('Arrow functions', { skip: !arrowFn }, function (t) { + t.equal(false, typedArrayByteOffset(arrowFn), 'arrow function is not typed array'); + t.end(); +}); + +test('Typed Arrays', function (t) { + var length = 32; + var byteOffset = 16; + + forEach(typedArrayNames, function (typedArray) { + var buffer = new ArrayBuffer(length); + var TypedArray = global[typedArray]; + if (isCallable(TypedArray)) { + // @ts-expect-error hush, TS, TAs can take an optional byte offset arg + var arr = new TypedArray(buffer, byteOffset); + t.equal(typedArrayByteOffset(arr), byteOffset, 'new ' + typedArray + '(new ArrayBuffer(' + length + '), ' + byteOffset + ') is typed array of byte offset ' + byteOffset); + } else { + t.comment('# SKIP ' + typedArray + ' is not supported'); + } + }); + t.end(); +}); diff --git a/node_modules/typed-array-byte-offset/tsconfig.json b/node_modules/typed-array-byte-offset/tsconfig.json new file mode 100644 index 000000000..06f500a95 --- /dev/null +++ b/node_modules/typed-array-byte-offset/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ES2021", + "maxNodeModuleJsDepth": 0, + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/typed-array-length/.eslintrc b/node_modules/typed-array-length/.eslintrc new file mode 100644 index 000000000..bc84181cc --- /dev/null +++ b/node_modules/typed-array-length/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 11], + "max-statements": [2, 15], + "new-cap": [2, { "capIsNewExceptions": ["IsCallable"] }], + }, +} diff --git a/node_modules/typed-array-length/.github/FUNDING.yml b/node_modules/typed-array-length/.github/FUNDING.yml new file mode 100644 index 000000000..7d6aac43f --- /dev/null +++ b/node_modules/typed-array-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/typed-array-length +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/typed-array-length/.nycrc b/node_modules/typed-array-length/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/typed-array-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/typed-array-length/CHANGELOG.md b/node_modules/typed-array-length/CHANGELOG.md new file mode 100644 index 000000000..fc7f9b842 --- /dev/null +++ b/node_modules/typed-array-length/CHANGELOG.md @@ -0,0 +1,106 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.7](https://github.com/inspect-js/typed-array-length/compare/v1.0.6...v1.0.7) - 2024-11-22 + +### Fixed + +- [Fix] avoid relying on `__proto__` accessor [`#9`](https://github.com/inspect-js/typed-array-length/issues/9) + +### Commits + +- [Tests] fix TS issues [`f36b6bd`](https://github.com/inspect-js/typed-array-length/commit/f36b6bdbe472923cdd24158705a19b91ae5f512c) +- [actions] split out node 10-20, and 20+ [`d81efa0`](https://github.com/inspect-js/typed-array-length/commit/d81efa0b275161e82f78ceddb3ccf0bd63c2b834) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/object-inspect`, `auto-changelog`, `object-inspect`, `tape` [`a61b15b`](https://github.com/inspect-js/typed-array-length/commit/a61b15baa1dbc40d0fdd0e23779bfa32acab6f5e) +- [Tests] replace `aud` with `npm audit` [`b0b4e8f`](https://github.com/inspect-js/typed-array-length/commit/b0b4e8fa9a3050edcddead80e86765d8fd78298c) + +## [v1.0.6](https://github.com/inspect-js/typed-array-length/compare/v1.0.5...v1.0.6) - 2024-03-21 + +### Commits + +- [types] vastly improve types [`9f68d36`](https://github.com/inspect-js/typed-array-length/commit/9f68d36cdc1abeb412f47e91de289b5fb903a696) +- [types] use shared config [`b6b3cbc`](https://github.com/inspect-js/typed-array-length/commit/b6b3cbcaf8f4a46f5bcb77226d4cea2b3f62ffe2) +- [actions] remove redundant finisher [`c69896e`](https://github.com/inspect-js/typed-array-length/commit/c69896e0d71e9f6da562b9ae0eaba415e4cbff26) +- [Tests] actually check types in tests, and add attw [`e2c3f94`](https://github.com/inspect-js/typed-array-length/commit/e2c3f948bd0b898c38e1d9f63cd9702e728a7109) + +## [v1.0.5](https://github.com/inspect-js/typed-array-length/compare/v1.0.4...v1.0.5) - 2024-02-20 + +### Commits + +- add types [`df51e65`](https://github.com/inspect-js/typed-array-length/commit/df51e65a85fa6d1a98571ab30398b36ac2c981bb) +- [Refactor] use `possible-typed-array-names` for a single source of truth [`84503a3`](https://github.com/inspect-js/typed-array-length/commit/84503a3d406e8ae1cc84cf6e893cacc556be664a) +- [actions] update rebase action to use reusable workflow [`f163023`](https://github.com/inspect-js/typed-array-length/commit/f16302365bbb353b0504a41d997fa18196757c80) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `object-inspect`, `tape` [`57ca930`](https://github.com/inspect-js/typed-array-length/commit/57ca93013d607c0ac46b749d8258bb341b903567) +- [Dev Deps] update `aud`, `is-callable`, `object-inspect`, `tape` [`99343f4`](https://github.com/inspect-js/typed-array-length/commit/99343f477d68f2d53597bc0cadf93e532a498138) +- [Refactor] use `gopd` and `has-proto` [`b134a5c`](https://github.com/inspect-js/typed-array-length/commit/b134a5cc4bea1666f4195d6b6c6e97617305420f) +- [Deps] update `call-bind`, `is-typed-array` [`3b62f55`](https://github.com/inspect-js/typed-array-length/commit/3b62f55cc52da8b4c9548fb8839f0e4db222ac1b) +- [meta] add missing `engines.node` [`ff3e9f7`](https://github.com/inspect-js/typed-array-length/commit/ff3e9f7b8d72c0c2d1e9c2122a701ac454e6552c) +- [Deps] update `is-typed-array` [`877f507`](https://github.com/inspect-js/typed-array-length/commit/877f507048ece8b1db6402b56d512c7eb3337ce9) +- [meta] add `sideEffects` flag [`6e91309`](https://github.com/inspect-js/typed-array-length/commit/6e913098eaca5132a3595b0653d211ffec93f2c6) + +## [v1.0.4](https://github.com/inspect-js/typed-array-length/compare/v1.0.3...v1.0.4) - 2022-05-23 + +### Commits + +- [actions] reuse common workflows [`dfd4a37`](https://github.com/inspect-js/typed-array-length/commit/dfd4a37d851a28e3d74d892a69874e02f2e58c37) +- [meta] use `npmignore` to autogenerate an npmignore file [`a837e80`](https://github.com/inspect-js/typed-array-length/commit/a837e80d4029f26785ab9f3aa571ca782ac8e851) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `object-inspect`, `tape` [`7b05a87`](https://github.com/inspect-js/typed-array-length/commit/7b05a8772af399e52bb448618a246cd34d3e3273) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c495f6e`](https://github.com/inspect-js/typed-array-length/commit/c495f6e050a4a7463a82c9195f31f44cf2760945) +- [meta] simplify "exports" [`e42a6b6`](https://github.com/inspect-js/typed-array-length/commit/e42a6b6b0dc243fce32df20a75a7962782ef2a83) +- [Fix] ensure `for-each` dependency is properly listed [`8ec761c`](https://github.com/inspect-js/typed-array-length/commit/8ec761ca56c13927281d626958a2f55211e14f45) +- [Deps] update `call-bind`, `is-typed-array` [`2cc173a`](https://github.com/inspect-js/typed-array-length/commit/2cc173a4216e167db896bea7b8e03edf8b2d3833) +- [meta] add `safe-publish-latest` [`e8e3afa`](https://github.com/inspect-js/typed-array-length/commit/e8e3afa431ce98bbdbb68c9f8e3c029cc5128c6c) +- [Deps] update `is-typed-array` [`cd8084d`](https://github.com/inspect-js/typed-array-length/commit/cd8084db59b734ac4519b6d47f96233b6f73b1a6) + +## [v1.0.3](https://github.com/inspect-js/typed-array-length/compare/v1.0.2...v1.0.3) - 2020-12-05 + +### Commits + +- [Tests] migrate tests to Github Actions [`a578b83`](https://github.com/inspect-js/typed-array-length/commit/a578b83e68055c1e7c7120bc4583e1d6926fc268) +- [meta] avoid publishing github workflows [`f064a4b`](https://github.com/inspect-js/typed-array-length/commit/f064a4bf9090202154249d969be0799c34804ad4) +- [Tests] run `nyc` on all tests [`69b841e`](https://github.com/inspect-js/typed-array-length/commit/69b841e43042358c71c3290342514b6d107f08d1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`4594e83`](https://github.com/inspect-js/typed-array-length/commit/4594e83250579cdbff870aa951e7af56ca169489) +- [actions] add "Allow Edits" workflow [`81e953b`](https://github.com/inspect-js/typed-array-length/commit/81e953ba6b3f59c5657e0d17fa1e7619b94891f5) +- [Deps] update `is-typed-array`; use `call-bind` instead of `es-abstract` [`e7da56b`](https://github.com/inspect-js/typed-array-length/commit/e7da56b3c03b7f0db9bb110444ec1ccf19d7e9f9) +- [readme] remove travis badge [`6d610d8`](https://github.com/inspect-js/typed-array-length/commit/6d610d83cb78ac5286c5ca273f4b3c7289f7686e) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`2d0ad64`](https://github.com/inspect-js/typed-array-length/commit/2d0ad644a11f754e61b49d327fdf891605abbe58) + +## [v1.0.2](https://github.com/inspect-js/typed-array-length/compare/v1.0.1...v1.0.2) - 2020-04-22 + +### Commits + +- [Dev Deps] update `make-arrow-function`, `make-generator-function` [`4facf69`](https://github.com/inspect-js/typed-array-length/commit/4facf697cafb36b9c1057dc4ca1a21d8550c564e) +- [Deps] update `is-typed-array`, `es-abstract` [`aaf3585`](https://github.com/inspect-js/typed-array-length/commit/aaf3585429896b9520dedd886c07aa4a96b50615) +- [Dev Deps] update `aud`, `auto-changelog` [`f10e298`](https://github.com/inspect-js/typed-array-length/commit/f10e298c7733b8de59231c1581c9b000c205edbd) +- [meta] allow `package.json` to be required/imported [`104f4c6`](https://github.com/inspect-js/typed-array-length/commit/104f4c6a6363e600d54aeb7abd90e37d99693aaf) +- [Tests] only audit prod deps [`c748ab5`](https://github.com/inspect-js/typed-array-length/commit/c748ab596de505483df14ca7eeda7f27aeb20383) +- [Deps] update `es-abstract` [`6cd213e`](https://github.com/inspect-js/typed-array-length/commit/6cd213ec654da3325abc8190f8c07c860474d944) +- [Dev Deps] update `tape` [`2b0b2ea`](https://github.com/inspect-js/typed-array-length/commit/2b0b2ea9be106e8a068597c3f499ef703cce1edb) +- [Dev Deps] update `@ljharb/eslint-config` [`cf462f3`](https://github.com/inspect-js/typed-array-length/commit/cf462f3352cf2fd592e624746371e3de800a265d) +- [Deps] update `is-typed-array` [`ff46995`](https://github.com/inspect-js/typed-array-length/commit/ff469955b5d92942ba066c77eac7467e0c4de1ec) + +## [v1.0.1](https://github.com/inspect-js/typed-array-length/compare/v1.0.0...v1.0.1) - 2020-01-19 + +### Commits + +- readme [`d3643fd`](https://github.com/inspect-js/typed-array-length/commit/d3643fd11919844b1f42041ef980a1f33215b515) +- [meta] fix "exports" field [`006e28b`](https://github.com/inspect-js/typed-array-length/commit/006e28b30b11f8948e607d13ef0e96c3d7d7f61f) + +## v1.0.0 - 2020-01-18 + +### Commits + +- Initial commit [`5f9e2ec`](https://github.com/inspect-js/typed-array-length/commit/5f9e2ec6650f80dc894e354e9e98181b09006346) +- Tests [`6b9cadb`](https://github.com/inspect-js/typed-array-length/commit/6b9cadb0c274933bc7ee5e3fc6a5a380163cbe76) +- Implementation [`6a3cb50`](https://github.com/inspect-js/typed-array-length/commit/6a3cb50429f40fc4ac9020bbf9539560c1b70213) +- npm init [`41d42cd`](https://github.com/inspect-js/typed-array-length/commit/41d42cddfd3d47df6c9d480cf77787eae1109432) +- [meta] add `auto-changelog` [`4fd159b`](https://github.com/inspect-js/typed-array-length/commit/4fd159bc6535e86c370a2186d60a68656f0d8917) +- [meta] add `funding` field; create FUNDING.yml [`6a9fca7`](https://github.com/inspect-js/typed-array-length/commit/6a9fca7e0fdf3ff3fd4b0f18596471ca3d050a39) +- [actions] add automatic rebasing / merge commit blocking [`8303296`](https://github.com/inspect-js/typed-array-length/commit/83032967b14afd37c382d4bf2c1fc5c95e3764bd) +- [Tests] add `npm run lint` [`47a9c21`](https://github.com/inspect-js/typed-array-length/commit/47a9c211f474dbe8528f6b28f50080eacd5bf7eb) +- [Tests] use shared travis-ci configs [`d0c8915`](https://github.com/inspect-js/typed-array-length/commit/d0c89153e1c50f1eadd0b42521bcdcf3366b8af5) +- Only apps should have lockfiles [`3eaef9c`](https://github.com/inspect-js/typed-array-length/commit/3eaef9cd192b1a25d1930739e7c0044e39ad3c0d) diff --git a/node_modules/typed-array-length/LICENSE b/node_modules/typed-array-length/LICENSE new file mode 100644 index 000000000..707437b57 --- /dev/null +++ b/node_modules/typed-array-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/typed-array-length/README.md b/node_modules/typed-array-length/README.md new file mode 100644 index 000000000..5e78c2004 --- /dev/null +++ b/node_modules/typed-array-length/README.md @@ -0,0 +1,64 @@ +# typed-array-length [![Version Badge][2]][1] + +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Robustly get the length of a Typed Array, or `false` if it is not a Typed Array. Works cross-realm, in every engine, even if the `length` property is overridden. + +## Example + +```js +var typedArrayLength = require('typed-array-length'); +var assert = require('assert'); + +assert.equal(false, typedArrayLength(undefined)); +assert.equal(false, typedArrayLength(null)); +assert.equal(false, typedArrayLength(false)); +assert.equal(false, typedArrayLength(true)); +assert.equal(false, typedArrayLength([])); +assert.equal(false, typedArrayLength({})); +assert.equal(false, typedArrayLength(/a/g)); +assert.equal(false, typedArrayLength(new RegExp('a', 'g'))); +assert.equal(false, typedArrayLength(new Date())); +assert.equal(false, typedArrayLength(42)); +assert.equal(false, typedArrayLength(NaN)); +assert.equal(false, typedArrayLength(Infinity)); +assert.equal(false, typedArrayLength(new Number(42))); +assert.equal(false, typedArrayLength('foo')); +assert.equal(false, typedArrayLength(Object('foo'))); +assert.equal(false, typedArrayLength(function () {})); +assert.equal(false, typedArrayLength(function* () {})); +assert.equal(false, typedArrayLength(x => x * x)); +assert.equal(false, typedArrayLength([])); + +assert.equal(1, typedArrayLength(new Int8Array(1))); +assert.equal(2, typedArrayLength(new Uint8Array(2))); +assert.equal(3, typedArrayLength(new Uint8ClampedArray(3))); +assert.equal(4, typedArrayLength(new Int16Array(4))); +assert.equal(5, typedArrayLength(new Uint16Array(5))); +assert.equal(6, typedArrayLength(new Int32Array(6))); +assert.equal(7, typedArrayLength(new Uint32Array(7))); +assert.equal(8, typedArrayLength(new Float32Array(8))); +assert.equal(9, typedArrayLength(new Float64Array(9))); +assert.equal(10, typedArrayLength(new BigInt64Array(10))); +assert.equal(11, typedArrayLength(new BigUint64Array(11))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/typed-array-length +[2]: https://versionbadg.es/inspect-js/typed-array-length.svg +[5]: https://david-dm.org/inspect-js/typed-array-length.svg +[6]: https://david-dm.org/inspect-js/typed-array-length +[7]: https://david-dm.org/inspect-js/typed-array-length/dev-status.svg +[8]: https://david-dm.org/inspect-js/typed-array-length#info=devDependencies +[11]: https://nodei.co/npm/typed-array-length.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/typed-array-length.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/typed-array-length.svg +[downloads-url]: http://npm-stat.com/charts.html?package=typed-array-length diff --git a/node_modules/typed-array-length/index.d.ts b/node_modules/typed-array-length/index.d.ts new file mode 100644 index 000000000..13cf2d202 --- /dev/null +++ b/node_modules/typed-array-length/index.d.ts @@ -0,0 +1,23 @@ +import type names from 'possible-typed-array-names'; + +declare function typedArrayLength(value: typedArrayLength.TypedArray): number; +declare function typedArrayLength(value: unknown): false; + +declare namespace typedArrayLength { + type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | BigInt64Array + | BigUint64Array; + + type TypedArrayName = typeof names[number]; +} + +export = typedArrayLength; diff --git a/node_modules/typed-array-length/index.js b/node_modules/typed-array-length/index.js new file mode 100644 index 000000000..316ca442c --- /dev/null +++ b/node_modules/typed-array-length/index.js @@ -0,0 +1,80 @@ +'use strict'; + +// / + +var callBind = require('call-bind'); +var forEach = require('for-each'); +var gOPD = require('gopd'); +var isTypedArray = require('is-typed-array'); +var typedArrays = require('possible-typed-array-names'); +var gPO = require('reflect.getprototypeof/polyfill')(); + +/** @typedef {(value: import('.').TypedArray) => number} TypedArrayLengthGetter */ +/** @typedef {{ [k in `$${import('.').TypedArrayName}` | '__proto__']: k extends '__proto__' ? null : TypedArrayLengthGetter }} Cache */ + +/** @type {Cache} */ +// @ts-expect-error TS doesn't seem to have a "will eventually satisfy" type +var getters = { __proto__: null }; +var oDP = Object.defineProperty; +if (gOPD) { + var getLength = /** @type {TypedArrayLengthGetter} */ function (x) { + return x.length; + }; + forEach(typedArrays, /** @type {(typedArray: import('.').TypedArrayName) => void} */ function (typedArray) { + var TA = global[typedArray]; + // In Safari 7, Typed Array constructors are typeof object + if (typeof TA === 'function' || typeof TA === 'object') { + var Proto = TA.prototype; + // @ts-expect-error TS doesn't narrow types inside callbacks, which is weird + var descriptor = gOPD(Proto, 'length'); + if (!descriptor) { + var superProto = gPO(Proto); + // @ts-expect-error TS doesn't narrow types inside callbacks, which is weird + descriptor = gOPD(superProto, 'length'); + } + // Opera 12.16 has a magic length data property on instances AND on Proto + if (descriptor && descriptor.get) { + // eslint-disable-next-line no-extra-parens + getters[/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)] = callBind(descriptor.get); + } else if (oDP) { + // this is likely an engine where instances have a magic length data property + var arr = new global[typedArray](2); + // @ts-expect-error TS doesn't narrow types inside callbacks, which is weird + descriptor = gOPD(arr, 'length'); + if (descriptor && descriptor.configurable) { + oDP(arr, 'length', { value: 3 }); + } + if (arr.length === 2) { + // eslint-disable-next-line no-extra-parens + getters[/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)] = getLength; + } + } + } + }); +} + +/** @type {TypedArrayLengthGetter} */ +var tryTypedArrays = function tryAllTypedArrays(value) { + /** @type {number} */ var foundLength; + // @ts-expect-error not sure why this won't work + forEach(getters, /** @type {(getter: TypedArrayLengthGetter) => void} */ function (getter) { + if (typeof foundLength !== 'number') { + try { + var length = getter(value); + if (typeof length === 'number') { + foundLength = length; + } + } catch (e) {} + } + }); + // @ts-expect-error TS can't guarantee the above callback is invoked sync + return foundLength; +}; + +/** @type {import('.')} */ +module.exports = function typedArrayLength(value) { + if (!isTypedArray(value)) { + return false; + } + return tryTypedArrays(value); +}; diff --git a/node_modules/typed-array-length/package.json b/node_modules/typed-array-length/package.json new file mode 100644 index 000000000..16a405ac4 --- /dev/null +++ b/node_modules/typed-array-length/package.json @@ -0,0 +1,110 @@ +{ + "name": "typed-array-length", + "version": "1.0.7", + "description": "Robustly get the length of a Typed Array", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "./index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test:harmony": "nyc node --harmony --es-staging test", + "test": "npm run tests-only && npm run test:harmony", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/typed-array-length.git" + }, + "keywords": [ + "typed", + "array", + "length", + "robust", + "es", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/typed-array-length/issues" + }, + "homepage": "https://github.com/inspect-js/typed-array-length#readme", + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.0", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.0", + "@types/call-bind": "^1.0.5", + "@types/for-each": "^0.3.3", + "@types/gopd": "^1.0.3", + "@types/is-callable": "^1.1.2", + "@types/make-arrow-function": "^1.2.2", + "@types/make-generator-function": "^2.0.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.6.4", + "auto-changelog": "^2.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "is-callable": "^1.2.7", + "make-arrow-function": "^1.2.0", + "make-generator-function": "^2.0.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "testling": { + "files": "test/index.js" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/typed-array-length/test/index.js b/node_modules/typed-array-length/test/index.js new file mode 100644 index 000000000..da0295752 --- /dev/null +++ b/node_modules/typed-array-length/test/index.js @@ -0,0 +1,74 @@ +'use strict'; + +var test = require('tape'); +var typedArrayLength = require('../'); +var isCallable = require('is-callable'); +var generators = require('make-generator-function')(); +var arrowFn = require('make-arrow-function')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var typedArrayNames = require('possible-typed-array-names'); + +test('not arrays', function (t) { + t.test('non-number/string primitives', function (st) { + // @ts-expect-error + st.equal(false, typedArrayLength(), 'undefined is not typed array'); + st.equal(false, typedArrayLength(null), 'null is not typed array'); + st.equal(false, typedArrayLength(false), 'false is not typed array'); + st.equal(false, typedArrayLength(true), 'true is not typed array'); + st.end(); + }); + + t.equal(false, typedArrayLength({}), 'object is not typed array'); + t.equal(false, typedArrayLength(/a/g), 'regex literal is not typed array'); + t.equal(false, typedArrayLength(new RegExp('a', 'g')), 'regex object is not typed array'); + t.equal(false, typedArrayLength(new Date()), 'new Date() is not typed array'); + + t.test('numbers', function (st) { + st.equal(false, typedArrayLength(42), 'number is not typed array'); + st.equal(false, typedArrayLength(Object(42)), 'number object is not typed array'); + st.equal(false, typedArrayLength(NaN), 'NaN is not typed array'); + st.equal(false, typedArrayLength(Infinity), 'Infinity is not typed array'); + st.end(); + }); + + t.test('strings', function (st) { + st.equal(false, typedArrayLength('foo'), 'string primitive is not typed array'); + st.equal(false, typedArrayLength(Object('foo')), 'string object is not typed array'); + st.end(); + }); + + t.end(); +}); + +test('Functions', function (t) { + t.equal(false, typedArrayLength(function () {}), 'function is not typed array'); + t.end(); +}); + +test('Generators', { skip: generators.length === 0 }, function (t) { + forEach(generators, function (genFn) { + t.equal(false, typedArrayLength(genFn), 'generator function ' + inspect(genFn) + ' is not typed array'); + }); + t.end(); +}); + +test('Arrow functions', { skip: !arrowFn }, function (t) { + t.equal(false, typedArrayLength(arrowFn), 'arrow function is not typed array'); + t.end(); +}); + +test('Typed Arrays', function (t) { + forEach(typedArrayNames, function (typedArray) { + /** @type {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor} */ + var TypedArray = global[typedArray]; + if (isCallable(TypedArray)) { + var length = 10; + var arr = new TypedArray(length); + t.equal(typedArrayLength(arr), length, 'new ' + typedArray + '(10) is typed array of length ' + length); + } else { + t.comment('# SKIP ' + typedArray + ' is not supported'); + } + }); + t.end(); +}); diff --git a/node_modules/typed-array-length/tsconfig.json b/node_modules/typed-array-length/tsconfig.json new file mode 100644 index 000000000..06f500a95 --- /dev/null +++ b/node_modules/typed-array-length/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ES2021", + "maxNodeModuleJsDepth": 0, + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/typedarray.prototype.slice/.editorconfig b/node_modules/typedarray.prototype.slice/.editorconfig new file mode 100644 index 000000000..eaa214161 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/typedarray.prototype.slice/.eslintrc b/node_modules/typedarray.prototype.slice/.eslintrc new file mode 100644 index 000000000..1d114f708 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/.eslintrc @@ -0,0 +1,55 @@ +{ + "root": true, + + "extends": "@ljharb", + + "globals": { + "Float32Array": false, + "Float64Array": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + }, + + "rules": { + "func-style": 0, + "id-length": 0, + "max-lines-per-function": 0, + "max-params": 0, + "max-statements": 0, + "multiline-comment-style": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "Get", + "GetIntrinsic", + "GetValueFromBuffer", + "IsDetachedBuffer", + "Set", + "SetValueInBuffer", + "ToIntegerOrInfinity", + "ToString", + "TypedArrayElementSize", + "TypedArrayElementType", + "TypedArraySpeciesCreate", + "ValidateTypedArray", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "globals": { + "ArrayBuffer": false, + "Uint8Array": false, + }, + "rules": { + "max-lines-per-function": 0, + }, + }, + ], +} diff --git a/node_modules/typedarray.prototype.slice/.nycrc b/node_modules/typedarray.prototype.slice/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/typedarray.prototype.slice/CHANGELOG.md b/node_modules/typedarray.prototype.slice/CHANGELOG.md new file mode 100644 index 000000000..79469df33 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/CHANGELOG.md @@ -0,0 +1,58 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.5](https://github.com/es-shims/TypedArray.prototype.slice/compare/v1.0.4...v1.0.5) - 2025-01-02 + +### Commits + +- [Fix] (-‸ლ) typo in specifier from dd67051195bdc0a9a5a2252c0fd3bd9155f6b08b [`cffa05e`](https://github.com/es-shims/TypedArray.prototype.slice/commit/cffa05e88cb2c3044f367ba9541f2894f51c99d0) + +## [v1.0.4](https://github.com/es-shims/TypedArray.prototype.slice/compare/v1.0.3...v1.0.4) - 2025-01-02 + +### Commits + +- [actions] split out node 10-20, and 20+ [`1ca7eb2`](https://github.com/es-shims/TypedArray.prototype.slice/commit/1ca7eb25ea741498bc6aff9df2d7a439e7cc374e) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`259de62`](https://github.com/es-shims/TypedArray.prototype.slice/commit/259de620bf2fa073e3c33492d0928cdf0a1a693e) +- [Deps] update `call-bind`, `es-abstract`, `typed-array-buffer`, `typed-array-byte-offset` [`5c9dbf9`](https://github.com/es-shims/TypedArray.prototype.slice/commit/5c9dbf99d524c02d0f67a7ceff1a7f9586c28311) +- [Refactor] use `math-intrinsics` directly [`dd67051`](https://github.com/es-shims/TypedArray.prototype.slice/commit/dd67051195bdc0a9a5a2252c0fd3bd9155f6b08b) +- [Refactor] use `get-proto` and `math-intrinsics` directly [`20395cc`](https://github.com/es-shims/TypedArray.prototype.slice/commit/20395cc9425ef1794023b69916a0702c6d94f4e4) +- [Tests] replace `aud` with `npm audit` [`53d2fef`](https://github.com/es-shims/TypedArray.prototype.slice/commit/53d2fefed9c793e51d265aa56360be042b405f3b) +- [Dev Deps] add missing peer dep [`70a2f57`](https://github.com/es-shims/TypedArray.prototype.slice/commit/70a2f57f29091ffdc14fd43e03520151a825e2b3) + +## [v1.0.3](https://github.com/es-shims/TypedArray.prototype.slice/compare/v1.0.2...v1.0.3) - 2024-03-15 + +### Commits + +- [Deps] update `es-abstract` [`9067824`](https://github.com/es-shims/TypedArray.prototype.slice/commit/906782435b34ec0ce54a9dd613974601e08b5c2e) +- [Deps] update `call-bind`, `typed-array-buffer`, `typed-array-byte-offset` [`33da086`](https://github.com/es-shims/TypedArray.prototype.slice/commit/33da086e39deedf551abd8398fdf5d189cbe3d77) +- [Dev Deps] update `available-typed-arrays`, `tape` [`2f8d038`](https://github.com/es-shims/TypedArray.prototype.slice/commit/2f8d038eb15b8ac3206c2368036b988b01e5c417) + +## [v1.0.2](https://github.com/es-shims/TypedArray.prototype.slice/compare/v1.0.1...v1.0.2) - 2024-02-06 + +### Commits + +- [Dev Deps] update `aud`, `anvailable-typed-arrays`, `npmignore`, `object-inspect`, `tape` [`9334d4e`](https://github.com/es-shims/TypedArray.prototype.slice/commit/9334d4e47106747bdf08072c362352b189fa7778) +- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `get-intrinsic` [`0acd649`](https://github.com/es-shims/TypedArray.prototype.slice/commit/0acd649f03baf849a88e27cd0dcfd78c400a5cb3) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`70215ad`](https://github.com/es-shims/TypedArray.prototype.slice/commit/70215adca0d4b948a9945cc7d5c0a7a70fbac2a8) + +## [v1.0.1](https://github.com/es-shims/TypedArray.prototype.slice/compare/v1.0.0...v1.0.1) - 2023-07-18 + +### Commits + +- [readme] fix title and URLs [`391dc87`](https://github.com/es-shims/TypedArray.prototype.slice/commit/391dc876acb64d7780fded8be0d65d5f0caab688) + +## v1.0.0 - 2023-07-18 + +### Commits + +- Initial implementation, tests, readme [`7684f32`](https://github.com/es-shims/TypedArray.prototype.slice/commit/7684f32983b444734c6293af807fcf5f3e20a9ad) +- Initial commit [`e4ff962`](https://github.com/es-shims/TypedArray.prototype.slice/commit/e4ff962b319dbc568f48e312e0396130e91d5df4) +- [Fix] node v0.11.4 - 3 have an own slice method that works incorrectly [`361b2c6`](https://github.com/es-shims/TypedArray.prototype.slice/commit/361b2c6046f756fb6f6851b0d8759b5e88324521) +- [Fix] `node < v0.6` lacks proper toString behavior on Typed Arrays [`bcf30f9`](https://github.com/es-shims/TypedArray.prototype.slice/commit/bcf30f916c59d2744f5a0c2e8a9ea38da2092413) +- npm init [`a24ef46`](https://github.com/es-shims/TypedArray.prototype.slice/commit/a24ef465139926277e5b85b8d9b17e96070aa6c8) +- [Fix] update `es-abstract` and move it to runtime deps [`b70eb79`](https://github.com/es-shims/TypedArray.prototype.slice/commit/b70eb7926485148733d56bec6c9ce91ac820bd0d) +- Only apps should have lockfiles [`3361cbe`](https://github.com/es-shims/TypedArray.prototype.slice/commit/3361cbe1c5a986a194f250360cfd4a52a2e255a5) diff --git a/node_modules/typedarray.prototype.slice/LICENSE b/node_modules/typedarray.prototype.slice/LICENSE new file mode 100644 index 000000000..eb970aa5c --- /dev/null +++ b/node_modules/typedarray.prototype.slice/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 ECMAScript Shims + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/typedarray.prototype.slice/README.md b/node_modules/typedarray.prototype.slice/README.md new file mode 100644 index 000000000..9a13efd01 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/README.md @@ -0,0 +1,65 @@ +# TypedArray.prototype.slice [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES spec-compliant `TypedArray.prototype.slice` shim. Invoke its "shim" method to shim TypedArray.prototype.slice if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice). + +Most common usage: +```js +var assert = require('assert'); +var slice = require('typedarray.prototype.slice'); + +var arr = new Uint8Array([1, 2, 3]); + +var arr2 = slice(arr); + +arr2[0] = 2; +arr2[1] = 3; + +assert.deepEqual(arr, new Uint8Array([1, 2, 3])); +assert.deepEqual(arr2, new Uint8Array([2, 3, 3])); +assert.notEqual(arr.buffer, arr2.buffer); + +if (!Uint8Array.prototype.slice) { + slice.shim(); +} + +var arr3 = arr.slice(); +arr3[0] = 2; +arr3[1] = 3; + +assert.deepEqual(arr, new Uint8Array([1, 2, 3])); +assert.deepEqual(arr3, new Uint8Array([2, 3, 3])); +assert.notEqual(arr.buffer, arr3.buffer); +``` + +## Engines where this is needed + + - node v0.11.4 - v4: no prototype or own `slice` method + - node < v0.11.3: own `slice` method that fails to clone the underlying buffer + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/typedarray.prototype.slice +[npm-version-svg]: https://versionbadg.es/es-shims/TypedArray.prototype.slice.svg +[deps-svg]: https://david-dm.org/es-shims/TypedArray.prototype.slice.svg +[deps-url]: https://david-dm.org/es-shims/TypedArray.prototype.slice +[dev-deps-svg]: https://david-dm.org/es-shims/TypedArray.prototype.slice/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/TypedArray.prototype.slice#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/typedarray.prototype.slice.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/typedarray.prototype.slice.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/typedarray.prototype.slice.svg +[downloads-url]: https://npm-stat.com/charts.html?package=typedarray.prototype.slice +[codecov-image]: https://codecov.io/gh/es-shims/TypedArray.prototype.slice/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/TypedArray.prototype.slice/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/TypedArray.prototype.slice +[actions-url]: https://github.com/es-shims/TypedArray.prototype.slice/actions diff --git a/node_modules/typedarray.prototype.slice/auto.js b/node_modules/typedarray.prototype.slice/auto.js new file mode 100644 index 000000000..8ebf606cb --- /dev/null +++ b/node_modules/typedarray.prototype.slice/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/typedarray.prototype.slice/implementation.js b/node_modules/typedarray.prototype.slice/implementation.js new file mode 100644 index 000000000..f1d4eb9a0 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/implementation.js @@ -0,0 +1,92 @@ +'use strict'; + +var $TypeError = require('es-errors/type'); + +var Get = require('es-abstract/2024/Get'); +var GetValueFromBuffer = require('es-abstract/2024/GetValueFromBuffer'); +var IsDetachedBuffer = require('es-abstract/2024/IsDetachedBuffer'); +var max = require('math-intrinsics/max'); +var min = require('math-intrinsics/min'); +var Set = require('es-abstract/2024/Set'); +var SetValueInBuffer = require('es-abstract/2024/SetValueInBuffer'); +var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity'); +var ToString = require('es-abstract/2024/ToString'); +var TypedArrayElementSize = require('es-abstract/2024/TypedArrayElementSize'); +var TypedArrayElementType = require('es-abstract/2024/TypedArrayElementType'); +var TypedArraySpeciesCreate = require('es-abstract/2024/TypedArraySpeciesCreate'); +var ValidateTypedArray = require('es-abstract/2024/ValidateTypedArray'); + +var typedArrayBuffer = require('typed-array-buffer'); +var typedArrayByteOffset = require('typed-array-byte-offset'); + +// https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice + +module.exports = function slice(start, end) { + var O = this; // step 1 + + ValidateTypedArray(O, 'SEQ-CST'); // step 2 + + // 3. Let len be O.[[ArrayLength]]. + var len = O.length; // steps 3 + + var relativeStart = ToIntegerOrInfinity(start); // step 4 + + var k; + if (relativeStart === -Infinity) { + k = 0; // step 5 + } else if (relativeStart < 0) { + k = max(len + relativeStart, 0); // step 6 + } else { + k = min(relativeStart, len); // step 7 + } + + var relativeEnd = typeof end === 'undefined' ? len : ToIntegerOrInfinity(end); // step 8 + + var final; + if (relativeEnd === -Infinity) { + final = 0; // step 9 + } else if (relativeEnd < 0) { + final = max(len + relativeEnd, 0); // step 10 + } else { + final = min(relativeEnd, len); // step 11 + } + + var count = max(final - k, 0); // step 12 + + var A = TypedArraySpeciesCreate(O, [count]); // step 13 + + if (count > 0) { // step 14 + if (IsDetachedBuffer(typedArrayBuffer(O))) { + throw new $TypeError('Cannot use a Typed Array with an underlying ArrayBuffer that is detached'); // step 14.a + } + var srcType = TypedArrayElementType(O); // step 14.b + var targetType = TypedArrayElementType(A); // step 14.c + if (srcType === targetType) { // step 14.d + // 1. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data. + var srcBuffer = typedArrayBuffer(O); // step 14.d.ii + var targetBuffer = typedArrayBuffer(A); // step 14.d.iii + var elementSize = TypedArrayElementSize(O); // step 14.d.iv + var srcByteOffset = typedArrayByteOffset(O); // step 14.d.v + var srcByteIndex = (k * elementSize) + srcByteOffset; // step 14.d.vi + var targetByteIndex = typedArrayByteOffset(A); // step 14.d.vii + var limit = targetByteIndex + (count * elementSize); // step 14.d.viii + while (targetByteIndex < limit) { // step 14.d.ix + var value = GetValueFromBuffer(srcBuffer, srcByteIndex, 'UINT8', true, 'UNORDERED'); // step 14.d.ix.1 + SetValueInBuffer(targetBuffer, targetByteIndex, 'UINT8', value, true, 'UNORDERED'); // step 14.d.ix.2 + srcByteIndex += 1; // step 14.d.ix.3 + targetByteIndex += 1; // step 14.d.ix.4 + } + } else { // step 14.e + var n = 0; // step 14.e.i + while (k < final) { // step 14.e.ii + var Pk = ToString(k); // step 14.e.ii.1 + var kValue = Get(O, Pk); // step 14.e.ii.2 + Set(A, ToString(n), kValue, true); // step 14.e.ii.3 + k += 1; // step 14.e.ii.4 + n += 1; // step 14.e.ii.5 + } + } + } + + return A; // step 15 +}; diff --git a/node_modules/typedarray.prototype.slice/index.js b/node_modules/typedarray.prototype.slice/index.js new file mode 100644 index 000000000..517c4147e --- /dev/null +++ b/node_modules/typedarray.prototype.slice/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); + +define(bound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = bound; diff --git a/node_modules/typedarray.prototype.slice/package.json b/node_modules/typedarray.prototype.slice/package.json new file mode 100644 index 000000000..6e21065b4 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/package.json @@ -0,0 +1,104 @@ +{ + "name": "typedarray.prototype.slice", + "version": "1.0.5", + "description": "ES spec-compliant shim for TypedArray.prototype.slice", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "main": "index.js", + "exports": { + ".": "./index.js", + "./auto": "./auto.js", + "./polyfill": "./polyfill.js", + "./implementation": "./implementation.js", + "./shim": "./shim.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "evalmd README.md && es-shim-api --bound", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/es-shims/TypedArray.prototype.slice.git" + }, + "homepage": "https://github.com/es-shims/TypedArray.prototype.slice#readme", + "bugs": { + "url": "https://github.com/es-shims/TypedArray.prototype.slice/issues" + }, + "keywords": [ + "javascript", + "ecmascript", + "TypedArray.prototype.slice", + "polyfill", + "shim", + "Typed Arrays", + "array", + "buffer", + "TypedArray#slice", + "slice", + "typed array", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "math-intrinsics": "^1.1.0", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-offset": "^1.0.4" + }, + "devDependencies": { + "@es-shims/api": "^2.5.1", + "@ljharb/eslint-config": "^21.1.1", + "auto-changelog": "^2.5.0", + "available-typed-arrays": "^1.0.7", + "eclint": "^2.8.1", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0" + }, + "testling": { + "files": "test/index.js" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/typedarray.prototype.slice/polyfill.js b/node_modules/typedarray.prototype.slice/polyfill.js new file mode 100644 index 000000000..93769c551 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/polyfill.js @@ -0,0 +1,7 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + return (typeof Uint8Array === 'function' && Uint8Array.prototype.slice) || implementation; +}; diff --git a/node_modules/typedarray.prototype.slice/shim.js b/node_modules/typedarray.prototype.slice/shim.js new file mode 100644 index 000000000..0d517460a --- /dev/null +++ b/node_modules/typedarray.prototype.slice/shim.js @@ -0,0 +1,20 @@ +'use strict'; + +var define = require('define-properties'); +var getProto = require('get-proto'); + +var getPolyfill = require('./polyfill'); + +module.exports = function shimTypedArraySlice() { + if (typeof Uint8Array === 'function') { + var polyfill = getPolyfill(); + var proto = getProto(Uint8Array.prototype); + define( + proto, + { slice: polyfill }, + { slice: function () { return proto.slice !== polyfill; } } + ); + } + + return polyfill; +}; diff --git a/node_modules/typedarray.prototype.slice/test/implementation.js b/node_modules/typedarray.prototype.slice/test/implementation.js new file mode 100644 index 000000000..49bd2a3e8 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/test/implementation.js @@ -0,0 +1,25 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + + st.end(); + }); + + t.test('Typed Array support', { skip: typeof Uint8Array === 'undefined' }, function (st) { + runTests(callBind(implementation), st); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/typedarray.prototype.slice/test/index.js b/node_modules/typedarray.prototype.slice/test/index.js new file mode 100644 index 000000000..5c67383f2 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/test/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var index = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { index(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { index(null); }, TypeError, 'null is not an object'); + + st.end(); + }); + + t.test('Typed Array support', { skip: typeof Uint8Array === 'undefined' }, function (st) { + runTests(index, st); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/typedarray.prototype.slice/test/shimmed.js b/node_modules/typedarray.prototype.slice/test/shimmed.js new file mode 100644 index 000000000..a66b01bad --- /dev/null +++ b/node_modules/typedarray.prototype.slice/test/shimmed.js @@ -0,0 +1,56 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); +var hasStrictMode = require('has-strict-mode')(); +var getProto = require('get-proto'); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.test('Typed Array support', { skip: typeof Uint8Array === 'undefined' }, function (st) { + var proto = getProto(Uint8Array.prototype); + var method = proto.slice; + + st.equal(method.length, 2, 'TypedArray#slice has a length of 2'); + + st.test('Function name', { skip: !functionsHaveNames }, function (s2t) { + s2t.equal(method.name, 'slice', 'TypedArray#slice name "slice"'); + s2t.end(); + }); + + st.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(proto, 'slice'), 'TypedArray#slice is not enumerable'); + et.end(); + }); + + st.test('bad array/this value', { skip: !hasStrictMode }, function (s2t) { + /* eslint no-useless-call: 0 */ + s2t['throws'](function () { return method.call(undefined); }, TypeError, 'undefined is not an object'); + s2t['throws'](function () { return method.call(null); }, TypeError, 'null is not an object'); + s2t.end(); + }); + + t.test('has the correct descriptor', { skip: !Object.getOwnPropertyDescriptor }, function (s2t) { + var descriptor = Object.getOwnPropertyDescriptor(proto, 'slice'); + + s2t.equal(descriptor.configurable, true); + s2t.equal(descriptor.enumerable, false); + s2t.equal(typeof descriptor.value, 'function'); + s2t.equal(descriptor.writable, true); + s2t.end(); + }); + + runTests(callBind(method), st); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/typedarray.prototype.slice/test/tests.js b/node_modules/typedarray.prototype.slice/test/tests.js new file mode 100644 index 000000000..4d2b87716 --- /dev/null +++ b/node_modules/typedarray.prototype.slice/test/tests.js @@ -0,0 +1,49 @@ +'use strict'; + +var inspect = require('object-inspect'); +// var IsDetachedBuffer = require('es-abstract/2023/IsDetachedBuffer'); + +var forEach = require('for-each'); +var availableTypedArrays = require('available-typed-arrays')(); +var v = require('es-value-fixtures'); + +module.exports = function runTests(slice, t) { + forEach(v.primitives.concat(v.objects), function (nonTA) { + t['throws']( + function () { slice(nonTA); }, + TypeError, + inspect(nonTA) + ' is not a Typed Array' + ); + }); + + t.test('Typed Arrays', { skip: availableTypedArrays.length === 0 }, function (st) { + forEach(availableTypedArrays, function (name) { + st.test(name, function (s2t) { + var TA = global[name]; + var isBigInt = name.slice(0, 3) === 'Big'; + + var ta = new TA(isBigInt ? [BigInt(1), BigInt(2), BigInt(3)] : [1, 2, 3]); + + var copy = slice(ta); + s2t.notEqual(copy, ta, 'returns a new instance when sliced with no args'); + s2t.ok(copy instanceof TA, 'returns an instance of the same type when sliced with no args'); + s2t.deepEqual(copy, ta, 'returns a new instance with the same values when sliced with no args'); + s2t.notEqual(copy.buffer, ta.buffer, 'the new instance has a different buffer than the original when sliced with no args'); + + var subset = slice(ta, 1); + s2t.notEqual(subset, ta, 'returns a new instance when sliced with a start index'); + s2t.ok(copy instanceof TA, 'returns an instance of the same type when sliced with a start index'); + s2t.deepEqual( + subset, + new TA(isBigInt ? [BigInt(2), BigInt(3)] : [2, 3]), + 'returns a new instance with the expected subset of values when sliced with a start index' + ); + s2t.notEqual(copy.buffer, ta.buffer, 'the new instance has a different buffer than the original when sliced with a start index'); + + s2t.end(); + }); + }); + + return st.end(); + }); +}; diff --git a/node_modules/typedarray/.travis.yml b/node_modules/typedarray/.travis.yml new file mode 100644 index 000000000..cc4dba29d --- /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 000000000..11adfaec9 --- /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 000000000..8423d7c9b --- /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 000000000..5e540841f --- /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 000000000..a7854a0fc --- /dev/null +++ b/node_modules/typedarray/package.json @@ -0,0 +1,55 @@ +{ + "name": "typedarray", + "version": "0.0.6", + "description": "TypedArray polyfill for old browsers", + "main": "index.js", + "devDependencies": { + "tape": "~2.3.2" + }, + "scripts": { + "test": "tape test/*.js test/server/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/typedarray.git" + }, + "homepage": "https://github.com/substack/typedarray", + "keywords": [ + "ArrayBuffer", + "DataView", + "Float32Array", + "Float64Array", + "Int8Array", + "Int16Array", + "Int32Array", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "typed", + "array", + "polyfill" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "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" + ] + } +} diff --git a/node_modules/typedarray/readme.markdown b/node_modules/typedarray/readme.markdown new file mode 100644 index 000000000..d18f6f719 --- /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 000000000..425950f9f --- /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 000000000..df596a34f --- /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/uc.micro/CHANGELOG.md b/node_modules/uc.micro/CHANGELOG.md new file mode 100644 index 000000000..974a9690e --- /dev/null +++ b/node_modules/uc.micro/CHANGELOG.md @@ -0,0 +1,52 @@ +1.0.6 / 2019-01-31 +------------------ + +- Unicode update to 10.0.0. +- Fixed `Z` content (added missed line and paragraph seperators), #10. + + +1.0.5 / 2018-01-26 +------------------ + +- Remove outdated license info from readme (missed in previous update). + + +1.0.4 / 2018-01-26 +------------------ + +- Unicode update to 10.0.0. +- Clarified license, should be MIT, #6. + + +1.0.3 / 2016-09-14 +------------------ + +- Unicode update to 9.0.0. +- Rewrite update script (use npm instead of Makefile). +- Added integrity tests. + + +1.0.2 / 2015-06-24 +------------------ + +- License info clarify, #3. + + +1.0.1 / 2015-05-30 +------------------ + +- Update to Unicode 8.+. +- Also automatically fix possible ReDOS in `Any`, if source used to generate + patterns like `(Any)+`. + + +1.0.0 / 2015-03-10 +------------------ + +- Export all in index.js. + + +0.1.0 / 2015-02-22 +------------------ + +- First release. diff --git a/node_modules/uc.micro/LICENSE.txt b/node_modules/uc.micro/LICENSE.txt new file mode 100644 index 000000000..a41e0a7ef --- /dev/null +++ b/node_modules/uc.micro/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/uc.micro/README.md b/node_modules/uc.micro/README.md new file mode 100644 index 000000000..3c555ea7c --- /dev/null +++ b/node_modules/uc.micro/README.md @@ -0,0 +1,14 @@ +# uc.micro + +[![Build Status](https://img.shields.io/travis/markdown-it/uc.micro/master.svg?style=flat)](https://travis-ci.org/markdown-it/uc.micro) +[![NPM version](https://img.shields.io/npm/v/uc.micro.svg?style=flat)](https://www.npmjs.org/package/uc.micro) + +> Micro subset of unicode data files for [markdown-it](https://github.com/markdown-it) projects. + +Content of this repo is autogenerated from `unicode-` package, +maintained by [Mathias Bynens](https://github.com/mathiasbynens). + +That's just a proxy to reduce dependencies/install size. + +**This package content is ONLY for [markdown-it](https://github.com/markdown-it) +projects needs. Don't ask to extend it!** diff --git a/node_modules/uc.micro/categories/Cc/regex.js b/node_modules/uc.micro/categories/Cc/regex.js new file mode 100644 index 000000000..99be991fe --- /dev/null +++ b/node_modules/uc.micro/categories/Cc/regex.js @@ -0,0 +1 @@ +module.exports=/[\0-\x1F\x7F-\x9F]/ \ No newline at end of file diff --git a/node_modules/uc.micro/categories/Cf/regex.js b/node_modules/uc.micro/categories/Cf/regex.js new file mode 100644 index 000000000..e89eff621 --- /dev/null +++ b/node_modules/uc.micro/categories/Cf/regex.js @@ -0,0 +1 @@ +module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/ \ No newline at end of file diff --git a/node_modules/uc.micro/categories/P/regex.js b/node_modules/uc.micro/categories/P/regex.js new file mode 100644 index 000000000..7e18fa732 --- /dev/null +++ b/node_modules/uc.micro/categories/P/regex.js @@ -0,0 +1 @@ +module.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/ \ No newline at end of file diff --git a/node_modules/uc.micro/categories/Z/regex.js b/node_modules/uc.micro/categories/Z/regex.js new file mode 100644 index 000000000..76976a4d9 --- /dev/null +++ b/node_modules/uc.micro/categories/Z/regex.js @@ -0,0 +1 @@ +module.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/ \ No newline at end of file diff --git a/node_modules/uc.micro/index.js b/node_modules/uc.micro/index.js new file mode 100644 index 000000000..03b6d4ab3 --- /dev/null +++ b/node_modules/uc.micro/index.js @@ -0,0 +1,7 @@ +'use strict'; + +exports.Any = require('./properties/Any/regex'); +exports.Cc = require('./categories/Cc/regex'); +exports.Cf = require('./categories/Cf/regex'); +exports.P = require('./categories/P/regex'); +exports.Z = require('./categories/Z/regex'); diff --git a/node_modules/uc.micro/package.json b/node_modules/uc.micro/package.json new file mode 100644 index 000000000..798e4bba9 --- /dev/null +++ b/node_modules/uc.micro/package.json @@ -0,0 +1,21 @@ +{ + "name": "uc.micro", + "version": "1.0.6", + "description": "Micro subset of unicode data files for markdown-it projects.", + "repository": "markdown-it/uc.micro", + "license": "MIT", + "files": [ + "categories/", + "properties/", + "index.js" + ], + "scripts": { + "test": "mocha", + "update": "node update.js && npm test" + }, + "devDependencies": { + "mocha": "^5.0.0", + "shelljs": "^0.8.1", + "unicode-11.0.0": "^0.7.8" + } +} diff --git a/node_modules/uc.micro/properties/Any/regex.js b/node_modules/uc.micro/properties/Any/regex.js new file mode 100644 index 000000000..22afa15ac --- /dev/null +++ b/node_modules/uc.micro/properties/Any/regex.js @@ -0,0 +1 @@ +module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ \ No newline at end of file diff --git a/node_modules/unbox-primitive/.editorconfig b/node_modules/unbox-primitive/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/unbox-primitive/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/unbox-primitive/.eslintrc b/node_modules/unbox-primitive/.eslintrc new file mode 100644 index 000000000..3b5d9e90e --- /dev/null +++ b/node_modules/unbox-primitive/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/unbox-primitive/.github/FUNDING.yml b/node_modules/unbox-primitive/.github/FUNDING.yml new file mode 100644 index 000000000..30cbba95b --- /dev/null +++ b/node_modules/unbox-primitive/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/unbox-primitive +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/unbox-primitive/.nycrc b/node_modules/unbox-primitive/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/unbox-primitive/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/unbox-primitive/CHANGELOG.md b/node_modules/unbox-primitive/CHANGELOG.md new file mode 100644 index 000000000..ec16dfc19 --- /dev/null +++ b/node_modules/unbox-primitive/CHANGELOG.md @@ -0,0 +1,79 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.0](https://github.com/ljharb/unbox-primitive/compare/v1.0.2...v1.1.0) - 2024-12-15 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`348a5ad`](https://github.com/ljharb/unbox-primitive/commit/348a5ad5d353e7fcd6353934073ca3a982f40a4e) +- [New] add types [`a324230`](https://github.com/ljharb/unbox-primitive/commit/a32423092f81bfbf3c4dff77a5fa549ffae87daa) +- [Tests] use `es-value-fixtures` [`a321ae5`](https://github.com/ljharb/unbox-primitive/commit/a321ae56aaf30ea843c708bf6c6c13ee52eee205) +- [actions] split out node 10-20, and 20+ [`04a0e0d`](https://github.com/ljharb/unbox-primitive/commit/04a0e0d09907c2643e25ad69b49864c1c34e59d0) +- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `npmignore`, `object-inspect`, `object-is`, `tape` [`7fff971`](https://github.com/ljharb/unbox-primitive/commit/7fff97161bf83ebe348290ef27992af630ca92e9) +- [actions] update rebase action [`91d6807`](https://github.com/ljharb/unbox-primitive/commit/91d6807c562a39ce876feda777b641eb0ee64ce9) +- [Deps] update `call-bind`, `has-symbols`, `which-boxed-primitive` [`f8b6597`](https://github.com/ljharb/unbox-primitive/commit/f8b6597e071d05f0792f6eef0e2fbc30ddfe43d4) +- [Dev Deps] update `aud`, `object-inspect`, `tape` [`b3362a1`](https://github.com/ljharb/unbox-primitive/commit/b3362a164fdbee9006be765d99d5d835d6493326) +- [Refactor] use `call-bound` directly [`e29ff5f`](https://github.com/ljharb/unbox-primitive/commit/e29ff5f4cbcc58d32e670bce11d5c3137eae0c44) +- [meta] add missing `engines.node` [`d3420bc`](https://github.com/ljharb/unbox-primitive/commit/d3420bc8cda471cf62119e08d9581b72962f74f6) +- [Tests] replace `aud` with `npm audit` [`5e6a6d0`](https://github.com/ljharb/unbox-primitive/commit/5e6a6d0459b6fa8a812d00362fe60854333f1b64) +- [Deps] update `which-boxed-primitive` [`0ff873d`](https://github.com/ljharb/unbox-primitive/commit/0ff873dadf31962c2f00e24d8d7d30cfa8c60ac6) +- [Dev Deps] update `aud` [`dd0e373`](https://github.com/ljharb/unbox-primitive/commit/dd0e3733bb9db65d254492d6c1d1b710005b932f) +- [Dev Deps] add missing peer dep [`4f79b24`](https://github.com/ljharb/unbox-primitive/commit/4f79b240212d847276dba9a0044f356506eaeaa6) + +## [v1.0.2](https://github.com/ljharb/unbox-primitive/compare/v1.0.1...v1.0.2) - 2022-04-24 + +### Commits + +- [actions] reuse common workflows [`e6420b9`](https://github.com/ljharb/unbox-primitive/commit/e6420b94eed3558ef3ecddbd3d85fe2f400d1db1) +- [actions] update codecov uploader [`b90aff2`](https://github.com/ljharb/unbox-primitive/commit/b90aff2b17b70c1a7200eb5faa3f9e64ebf055f9) +- [readme] add github actions/codecov badges; update URLs [`bcc39b9`](https://github.com/ljharb/unbox-primitive/commit/bcc39b9d6d101bad199c95604f94999f80d6da97) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`a704a32`](https://github.com/ljharb/unbox-primitive/commit/a704a32ec4af43cd0631317ae3a537012adc1610) +- [Refactor] use `call-bind` instead of `function-bind` [`0a609f1`](https://github.com/ljharb/unbox-primitive/commit/0a609f1be6269cbf501482aacd9a0a1bd8596108) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`6a45317`](https://github.com/ljharb/unbox-primitive/commit/6a4531757d74af97c9d0770b102f81ce6ff0a8dc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`795c76f`](https://github.com/ljharb/unbox-primitive/commit/795c76f14c4df3c7ae934f7b14a98c07951ea9c7) +- [Deps] update `has-bigints`, `has-symbols` [`257a065`](https://github.com/ljharb/unbox-primitive/commit/257a065496b4190c296d674bff342ea40cf8e176) + +## [v1.0.1](https://github.com/ljharb/unbox-primitive/compare/v1.0.0...v1.0.1) - 2021-03-25 + +### Commits + +- [Tests] use shared travis-ci configs [`f977e5f`](https://github.com/ljharb/unbox-primitive/commit/f977e5f8fa532dbc519bd78a48cf4b81c14720fe) +- [Tests] migrate tests to Github Actions [`b89def6`](https://github.com/ljharb/unbox-primitive/commit/b89def60908a236aa1b5c756426f7cc61cf458dd) +- [meta] do not publish github action workflow files [`325d1f1`](https://github.com/ljharb/unbox-primitive/commit/325d1f1836cecbe57ee148545de5aefcbe7a7dce) +- readme [`810cd70`](https://github.com/ljharb/unbox-primitive/commit/810cd70f7b3c670cd55eae64466c89595175ee2a) +- [Tests] run `nyc` on all tests; use `tape` runner [`2f5fb08`](https://github.com/ljharb/unbox-primitive/commit/2f5fb08930c8f8e5e069ac61891dc9bd76cb762b) +- [meta] add `auto-changelog` [`03ed375`](https://github.com/ljharb/unbox-primitive/commit/03ed3759284493f19323eb0500f726d0851fc085) +- [actions] add automatic rebasing / merge commit blocking [`6dec48d`](https://github.com/ljharb/unbox-primitive/commit/6dec48daa357fa79a5cac1add9ca33f7b56276cc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `object-is`, `tape` [`528ed88`](https://github.com/ljharb/unbox-primitive/commit/528ed8826664b67f7eaf1fe7e2031c063b2d315f) +- [actions] check out the entire repo [`5095b29`](https://github.com/ljharb/unbox-primitive/commit/5095b2981f44a78b3f9bfaa1a526f17a6823e383) +- [actions] add "Allow Edits" workflow [`5aa26d7`](https://github.com/ljharb/unbox-primitive/commit/5aa26d7f0c32e0e78ba4bf3e5f9abb5478fd97fa) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `object-is`, `safe-publish-latest`, `tape` [`afc18c6`](https://github.com/ljharb/unbox-primitive/commit/afc18c6cb59cbb6b514e0d8004c6fd264e2a27eb) +- [readme] remove travis badge [`a025899`](https://github.com/ljharb/unbox-primitive/commit/a0258997a21604e1266840e6d167f0a870966e9b) +- [Dev Deps] update `auto-changelog` [`9219a32`](https://github.com/ljharb/unbox-primitive/commit/9219a32844b2ce3ed0a7ea12a5910a3e92424e4e) +- [readme] Fix missing paren in example [`73f5a33`](https://github.com/ljharb/unbox-primitive/commit/73f5a3340ca1ab6c227ed4632117d816d5e35317) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`e450acc`](https://github.com/ljharb/unbox-primitive/commit/e450accb54ab452f240768a5f0a98e5887b0ba8c) +- [Deps] update `has-bigints`, `has-symbols`, `which-boxed-primitive` [`a4279b5`](https://github.com/ljharb/unbox-primitive/commit/a4279b504732002074e5dcb9c5509038d605f563) +- [Dev Deps] update `auto-changelog`, `in-publish`, `tape` [`b351548`](https://github.com/ljharb/unbox-primitive/commit/b351548d31789c0d0af4c3bce55c2bdefe51b40f) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`f600382`](https://github.com/ljharb/unbox-primitive/commit/f600382db83025270969354ac52a72aadb0a7ffa) +- [readme] fix travis links [`4d02fa9`](https://github.com/ljharb/unbox-primitive/commit/4d02fa9a4990812b048f8aefe6e46be80b68beef) +- [Dev Deps] update `auto-changelog`; add `aud` [`07e74a3`](https://github.com/ljharb/unbox-primitive/commit/07e74a3ca90688122593095849757e3c05c46db0) +- [meta] add `funding` field [`7ca4bd7`](https://github.com/ljharb/unbox-primitive/commit/7ca4bd71196e90a2fc9c7cb0ef4e30f949d5a853) +- [Tests] only audit prod deps [`47d8d5f`](https://github.com/ljharb/unbox-primitive/commit/47d8d5fbd58bf472e7e83f79ccef7e8379d06b35) +- [Deps] update `has-symbols` [`c70c15e`](https://github.com/ljharb/unbox-primitive/commit/c70c15e924191d11a271cff25bde657b0c3c3016) + +## v1.0.0 - 2019-08-10 + +### Commits + +- [Tests] add `.travis.yml` [`8c9a5ef`](https://github.com/ljharb/unbox-primitive/commit/8c9a5efdb54be4866e2884bf32cbe830788b2c2a) +- Initial commit [`feaff15`](https://github.com/ljharb/unbox-primitive/commit/feaff159eb999adc8763ff3e51d2d3d56d6164f8) +- [Tests] add tests [`3dd18d6`](https://github.com/ljharb/unbox-primitive/commit/3dd18d65748efb4af9b8ca66f8d8c5521d8f2dec) +- implementation [`472fb41`](https://github.com/ljharb/unbox-primitive/commit/472fb41d049ddee80ebf3219a5837e639a6e9341) +- npm init [`e9e426f`](https://github.com/ljharb/unbox-primitive/commit/e9e426fc90b9a3f07ffc48db75f78c414f77bc2b) +- [Tests] add linting [`139e74b`](https://github.com/ljharb/unbox-primitive/commit/139e74b94cdfd187b43b24de76c6d84af21ee467) +- [meta] create FUNDING.yml [`a9509e1`](https://github.com/ljharb/unbox-primitive/commit/a9509e122163e2b9d98af421e5c0575df36e2310) +- Only apps should have lockfiles [`b3d0834`](https://github.com/ljharb/unbox-primitive/commit/b3d0834d69dcbf4cbc1e61ccfaef05acf96cf630) diff --git a/node_modules/unbox-primitive/LICENSE b/node_modules/unbox-primitive/LICENSE new file mode 100644 index 000000000..3900dd7e2 --- /dev/null +++ b/node_modules/unbox-primitive/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/unbox-primitive/README.md b/node_modules/unbox-primitive/README.md new file mode 100644 index 000000000..1ce1cabb2 --- /dev/null +++ b/node_modules/unbox-primitive/README.md @@ -0,0 +1,47 @@ +# unbox-primitive [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Unbox a boxed JS primitive value. This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and works despite ES6 Symbol.toStringTag. + +## Example + +```js +var unboxPrimitive = require('unbox-primitive'); +var assert = require('assert'); + +assert.equal(unboxPrimitive(new Boolean(false)), false); +assert.equal(unboxPrimitive(new String('f')), 'f'); +assert.equal(unboxPrimitive(new Number(42)), 42); +const s = Symbol(); +assert.equal(unboxPrimitive(Object(s)), s); +assert.equal(unboxPrimitive(new BigInt(42)), 42n); + +// any primitive, or non-boxed-primitive object, will throw +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/unbox-primitive +[npm-version-svg]: https://versionbadg.es/ljharb/unbox-primitive.svg +[deps-svg]: https://david-dm.org/ljharb/unbox-primitive.svg +[deps-url]: https://david-dm.org/ljharb/unbox-primitive +[dev-deps-svg]: https://david-dm.org/ljharb/unbox-primitive/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/unbox-primitive#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/unbox-primitive.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/unbox-primitive.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/unbox-primitive.svg +[downloads-url]: https://npm-stat.com/charts.html?package=unbox-primitive +[codecov-image]: https://codecov.io/gh/ljharb/unbox-primitive/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/unbox-primitive/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/unbox-primitive +[actions-url]: https://github.com/ljharb/unbox-primitive/actions diff --git a/node_modules/unbox-primitive/index.d.ts b/node_modules/unbox-primitive/index.d.ts new file mode 100644 index 000000000..d8ca84e1a --- /dev/null +++ b/node_modules/unbox-primitive/index.d.ts @@ -0,0 +1,13 @@ +declare function unboxPrimitive(value: T): unboxPrimitive.Unbox; + +declare namespace unboxPrimitive { + type Boxed = String | Number | Boolean | Symbol | BigInt; + type Unbox = T extends String ? string + : T extends Number ? number + : T extends Boolean ? boolean + : T extends Symbol ? symbol + : T extends BigInt ? bigint + : never; +} + +export = unboxPrimitive; diff --git a/node_modules/unbox-primitive/index.js b/node_modules/unbox-primitive/index.js new file mode 100644 index 000000000..348fb4c7b --- /dev/null +++ b/node_modules/unbox-primitive/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var whichBoxedPrimitive = require('which-boxed-primitive'); +var callBound = require('call-bound'); +var hasSymbols = require('has-symbols')(); +var hasBigInts = require('has-bigints')(); + +var stringToString = callBound('String.prototype.toString'); +var numberValueOf = callBound('Number.prototype.valueOf'); +var booleanValueOf = callBound('Boolean.prototype.valueOf'); +var symbolValueOf = hasSymbols && callBound('Symbol.prototype.valueOf'); +var bigIntValueOf = hasBigInts && callBound('BigInt.prototype.valueOf'); + +/** @type {import('.')} */ +module.exports = function unboxPrimitive(value) { + var which = whichBoxedPrimitive(value); + if (typeof which !== 'string') { + throw new TypeError(which === null ? 'value is an unboxed primitive' : 'value is a non-boxed-primitive object'); + } + + if (which === 'String') { + return stringToString(value); + } + if (which === 'Number') { + return numberValueOf(value); + } + if (which === 'Boolean') { + return booleanValueOf(value); + } + if (which === 'Symbol') { + if (!hasSymbols) { + throw new EvalError('somehow this environment does not have Symbols, but you have a boxed Symbol value. Please report this!'); + } + // eslint-disable-next-line no-extra-parens + return /** @type {Exclude} */ (symbolValueOf)(value); + } + if (which === 'BigInt') { + // eslint-disable-next-line no-extra-parens + return /** @type {Exclude} */ (bigIntValueOf)(value); + } + throw new RangeError('unknown boxed primitive found: ' + which); +}; diff --git a/node_modules/unbox-primitive/package.json b/node_modules/unbox-primitive/package.json new file mode 100644 index 000000000..63cdad8a5 --- /dev/null +++ b/node_modules/unbox-primitive/package.json @@ -0,0 +1,84 @@ +{ + "name": "unbox-primitive", + "version": "1.1.0", + "description": "Unbox a boxed JS primitive value.", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>= 10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/unbox-primitive.git" + }, + "keywords": [ + "unbox", + "boxed", + "primitive", + "object", + "javascript", + "ecmascript" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/unbox-primitive/issues" + }, + "homepage": "https://github.com/ljharb/unbox-primitive#readme", + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/for-each": "^0.3.3", + "@types/object-inspect": "^1.13.0", + "@types/object-is": "^1.1.0", + "@types/tape": "^5.7.0", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "object-is": "^1.1.6", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/unbox-primitive/test/index.js b/node_modules/unbox-primitive/test/index.js new file mode 100644 index 000000000..bb4fc195f --- /dev/null +++ b/node_modules/unbox-primitive/test/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var is = require('object-is'); +var forEach = require('for-each'); +var v = require('es-value-fixtures'); + +var unboxPrimitive = require('..'); + +test('primitives', function (t) { + forEach([null, undefined], function (nullValue) { + t['throws']( + // @ts-expect-error + function () { unboxPrimitive(nullValue); }, + TypeError, + inspect(nullValue) + ' is not a primitive' + ); + }); + + // eslint-disable-next-line no-extra-parens + forEach(/** @type {typeof v.nonNullPrimitives} */ ([].concat( + // @ts-expect-error TS sucks with concat + v.nonNullPrimitives, + v.zeroes, + v.infinities, + NaN + )), function (primitive) { + var obj = Object(primitive); + t.ok( + is(unboxPrimitive(obj), primitive), + inspect(obj) + 'unboxes to ' + inspect(primitive) + ); + }); + + t.end(); +}); + +test('objects', function (t) { + // eslint-disable-next-line no-extra-parens + forEach(/** @type {typeof v.objects} */ (/** @type {unknown} */ ([].concat( + // @ts-expect-error TS sucks with concat + v.objects, + {}, + [], + function () {}, + /a/g, + new Date() + ))), function (object) { + t['throws']( + // @ts-expect-error + function () { unboxPrimitive(object); }, + TypeError, + inspect(object) + ' is not a primitive' + ); + }); + + t.end(); +}); diff --git a/node_modules/unbox-primitive/tsconfig.json b/node_modules/unbox-primitive/tsconfig.json new file mode 100644 index 000000000..ac228e226 --- /dev/null +++ b/node_modules/unbox-primitive/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@ljharb/tsconfig", + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/unherit/index.js b/node_modules/unherit/index.js new file mode 100644 index 000000000..32ead7770 --- /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 000000000..f3722d94b --- /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 000000000..445a50065 --- /dev/null +++ b/node_modules/unherit/package.json @@ -0,0 +1,72 @@ +{ + "name": "unherit", + "version": "1.1.3", + "description": "Clone a constructor without affecting the super-class", + "license": "MIT", + "keywords": [ + "clone", + "super", + "class", + "constructor" + ], + "repository": "wooorm/unherit", + "bugs": "https://github.com/wooorm/unherit/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": { + "inherits": "^2.0.0", + "xtend": "^4.0.0" + }, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s unherit -o unherit.js", + "build-mangle": "browserify . -s unherit -p tinyify -o unherit.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-reflect-apply": "off", + "guard-for-in": "off" + }, + "ignores": [ + "unherit.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unherit/readme.md b/node_modules/unherit/readme.md new file mode 100644 index 000000000..bf679597d --- /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/LICENSE b/node_modules/unified/LICENSE new file mode 100644 index 000000000..f3722d94b --- /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 000000000..b8f9011d1 --- /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 000000000..217772169 --- /dev/null +++ b/node_modules/unified/package.json @@ -0,0 +1,86 @@ +{ + "name": "unified", + "version": "6.2.0", + "description": "Pluggable text processing interface", + "license": "MIT", + "keywords": [ + "process", + "parse", + "transform", + "compile", + "stringify", + "rehype", + "retext", + "remark" + ], + "repository": "unifiedjs/unified", + "bugs": "https://github.com/unifiedjs/unified/issues", + "author": "Titus Wormer (http://wooorm.com)", + "contributors": [ + "Titus Wormer (http://wooorm.com)" + ], + "files": [ + "index.js", + "lib" + ], + "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" + }, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", + "build-bundle": "browserify index.js -s unified > unified.js", + "build-mangle": "esmangle unified.js > unified.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "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" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unified/readme.md b/node_modules/unified/readme.md new file mode 100644 index 000000000..e979e0b36 --- /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/unique-concat/.npmignore b/node_modules/unique-concat/.npmignore new file mode 100644 index 000000000..a72b52ebe --- /dev/null +++ b/node_modules/unique-concat/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/node_modules/unique-concat/.travis.yml b/node_modules/unique-concat/.travis.yml new file mode 100644 index 000000000..cc4dba29d --- /dev/null +++ b/node_modules/unique-concat/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/unique-concat/LICENSE b/node_modules/unique-concat/LICENSE new file mode 100644 index 000000000..41702c504 --- /dev/null +++ b/node_modules/unique-concat/LICENSE @@ -0,0 +1,23 @@ +Copyright 2013 Thorsten Lorenz. +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/unique-concat/README.md b/node_modules/unique-concat/README.md new file mode 100644 index 000000000..02d96dbb5 --- /dev/null +++ b/node_modules/unique-concat/README.md @@ -0,0 +1,51 @@ +# unique-concat [![build status](https://secure.travis-ci.org/thlorenz/unique-concat.png)](http://travis-ci.org/thlorenz/unique-concat) + +[![testling badge](https://ci.testling.com/thlorenz/unique-concat.png)](https://ci.testling.com/thlorenz/unique-concat) + +Concatenates two arrays, removing duplicates in the process and returns one array with unique values. + +```js +var concat = require('unique-concat'); +var res = concat([ 1, 2, 3 ], [ 1, 2, 3, 4, 5, 6]) +console.log(res); +// => [1, 2, 3, 4, 5, 6] +``` + +## Installation + + npm install unique-concat + +## API + +###*function uniqueConcat(arr1, arr2[, identity])* +``` +/** + * Concatenates two arrays, removing duplicates in the process and returns one array with unique values. + * In case the elements in the array don't have a proper built in way to determine their identity, + * a custom identity function must be provided. + * + * As an example, {Object}s all return '[ 'object' ]' when .toString()ed and therefore require a custom + * identity function. + * + * @name exports + * @function unique-concat + * @param arr1 {Array} first batch of elements + * @param arr2 {Array} second batch of elements + * @param identity {Function} (optional) supply an alternative way to get an element's identity + */ +``` + +## Identity function example + +```js +var identity = function (obj) { return obj.a; } +var res = concat([{ a: 1 }, { a: 2, b: 1}], [{ a: 2, b: 2 }, { a: 3 }], identity); +console.log(res); +// => [ { a: 1 }, { a: 2, b: 2 }, { a: 3 } ] +``` + +For more examples see [tests](https://github.com/thlorenz/unique-concat/blob/master/test/index.js) + +## License + +MIT diff --git a/node_modules/unique-concat/index.js b/node_modules/unique-concat/index.js new file mode 100644 index 000000000..423f7e583 --- /dev/null +++ b/node_modules/unique-concat/index.js @@ -0,0 +1,33 @@ +'use strict'; + +/** + * Concatenates two arrays, removing duplicates in the process and returns one array with unique values. + * In case the elements in the array don't have a proper built in way to determine their identity, + * a custom identity function must be provided. + * + * As an example, {Object}s all return '[ 'object' ]' when .toString()ed and therefore require a custom + * identity function. + * + * @name exports + * @function unique-concat + * @param arr1 {Array} first batch of elements + * @param arr2 {Array} second batch of elements + * @param identity {Function} (optional) supply an alternative way to get an element's identity + */ +var go = module.exports = function uniqueConcat(arr1, arr2, identity) { + + if (!arr1 || !arr2) throw new Error('Need two arrays to merge'); + if (!Array.isArray(arr1)) throw new Error('First argument is not an array, but a ' + typeof arr1); + if (!Array.isArray(arr2)) throw new Error('Second argument is not an array, but a ' + typeof arr2); + if (identity && typeof identity !== 'function') throw new Error('Third argument should be a function'); + + function hashify(acc, k) { + acc[identity ? identity(k) : k] = k; + return acc; + } + + var arr1Hash = arr1.reduce(hashify, {}); + var mergedHash = arr2.reduce(hashify, arr1Hash); + + return Object.keys(mergedHash).map(function (key) { return mergedHash[key]; }); +}; diff --git a/node_modules/unique-concat/package.json b/node_modules/unique-concat/package.json new file mode 100644 index 000000000..3035be8e6 --- /dev/null +++ b/node_modules/unique-concat/package.json @@ -0,0 +1,62 @@ +{ + "name": "unique-concat", + "version": "0.2.2", + "description": "Concatenates two arrays, removing duplicates in the process and returns one array with unique values.", + "main": "index.js", + "scripts": { + "test-main": "tap test/*.js", + "test-0.8": "nave use 0.8 npm run test-main", + "test-0.10": "nave use 0.10 npm run test-main", + "test-all": "npm run test-main && npm run test-0.8 && npm run test-0.10", + "test": "if [ -e $TRAVIS ]; then npm run test-all; else npm run test-main; fi", + "tape": "testling -x open" + }, + "repository": { + "type": "git", + "url": "git://github.com/thlorenz/unique-concat.git" + }, + "homepage": "https://github.com/thlorenz/unique-concat", + "dependencies": {}, + "devDependencies": { + "nave": "~0.4.3", + "tape": "~1.0.4", + "tap": "~0.4.3", + "testling": "~1.5.1" + }, + "keywords": [ + "concat", + "concatenate", + "Array", + "unique", + "duplicates", + "hash" + ], + "author": { + "name": "Thorsten Lorenz", + "email": "thlorenz@gmx.de", + "url": "http://thlorenz.com" + }, + "license": { + "type": "MIT", + "url": "https://github.com/thlorenz/unique-concat/blob/master/LICENSE" + }, + "engine": { + "node": ">=0.6" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/9..latest", + "firefox/17..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/6.0.latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/node_modules/unique-concat/test/index.js b/node_modules/unique-concat/test/index.js new file mode 100644 index 000000000..b812aab63 --- /dev/null +++ b/node_modules/unique-concat/test/index.js @@ -0,0 +1,82 @@ +'use strict'; +/*jshint asi: true */ + +var test = require('tape') +var concat = require('../') + +test('\nconcating two empty arrays', function (t) { + var res = concat([], []) + t.deepEqual(res, []) + t.end() +}) + +test('\nconcating first array empty', function (t) { + var res = concat([], [ 1, 2 ]) + t.deepEqual(res, [ 1, 2 ]) + t.end() +}) + +test('\nconcating first array empty with non-unique values', function (t) { + var res = concat([], [ 1, 2, 1 ]) + t.deepEqual(res, [ 1, 2 ]) + t.end() +}) + +test('\nconcating second array empty with non-unique values', function (t) { + var res = concat([ 1, 2, 2 ], [ ]) + t.deepEqual(res, [ 1, 2 ]) + t.end() +}) + +test('\nconcating two non-empty arrays with unique values', function (t) { + var res = concat([ 1, 2, 3 ], [ 4, 5, 6]) + t.deepEqual(res, [1, 2, 3, 4, 5, 6]) + t.end() +}) + +test('\nconcating two non-empty arrays with non-unique values', function (t) { + var res = concat([ 1, 2, 3 ], [ 1, 2, 3, 4, 5, 6]) + t.deepEqual(res, [1, 2, 3, 4, 5, 6]) + t.end() +}) + +test('\nstrings: concating two non-empty arrays with non-unique values', function (t) { + var res = concat([ '1', '2', '3' ], [ '1', '2', '3', '4', '5', '6']) + t.deepEqual(res, ['1', '2', '3', '4', '5', '6']) + t.end() +}) + +test('\nfloats: concating two non-empty arrays with non-unique values', function (t) { + var res = concat([ 1.1, 2.1, 3.1 ], [ 1.1, 2.2, 3.1, 4, 5, 6]) + + // FF seems to order these differently (by weird logic) than other browers, so we need to sort to make the test consistent + res = res.sort(function (a, b) { return a < b ? -1 : 1 }); + + t.deepEqual(res, [ '1.1', '2.1', '2.2', '3.1', '4', '5', '6' ]) + t.end() +}) + +test('\nobjects: concating two non-empty arrays with non-unique values', function (t) { + var res = concat ([ { foo: true }, { bar: true} ], [ { foo: false }, { czar: true }]) + t.equal(res.length, 1, 'stores \'[object Object]\' and therefore has only one unique value') + t.end() +}) + +test('\nargument validation', function (t) { + t.throws(function () { concat(null, []) }, /two arrays/) + t.throws(function () { concat(1, []) }, /First argument is not an array/) + t.throws(function () { concat([], 2) }, /Second argument is not an array/) + t.end() +}) + +test('\ncustom identity function', function (t) { + var identity = function (obj) { return obj.a; } + var res = concat([{ a: 1 }, { a: 2, b: 1}], [{ a: 2, b: 2 }, { a: 3 }], identity); + t.deepEqual(res, [{ a: 1 }, { a: 2, b: 2 }, { a: 3 }], 'returns set of object with unique "a" property values') + t.end() +}) + +test('\nnon-function passed as identity', function (t) { + t.throws(function () { concat([1], [2], 'not a function') }, /Third argument should be a function/) + t.end() +}) diff --git a/node_modules/unist-util-is/convert.d.ts b/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 000000000..96b64df39 --- /dev/null +++ b/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/unist-util-is/convert.js b/node_modules/unist-util-is/convert.js new file mode 100644 index 000000000..938ff36d5 --- /dev/null +++ b/node_modules/unist-util-is/convert.js @@ -0,0 +1,77 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (test == null) { + return ok + } + + if (typeof test === 'string') { + return typeFactory(test) + } + + if (typeof test === 'object') { + return 'length' in test ? anyFactory(test) : allFactory(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function allFactory(test) { + return all + + function all(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) return false + } + + return true + } +} + +function anyFactory(tests) { + var checks = [] + var index = -1 + + while (++index < tests.length) { + checks[index] = convert(tests[index]) + } + + return any + + function any() { + var index = -1 + + while (++index < checks.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/unist-util-is/index.d.ts b/node_modules/unist-util-is/index.d.ts new file mode 100644 index 000000000..0cea73f90 --- /dev/null +++ b/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,71 @@ +// 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 + | null + | undefined +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When nullish, 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/unist-util-is/index.js b/node_modules/unist-util-is/index.js new file mode 100644 index 000000000..a8e15786c --- /dev/null +++ b/node_modules/unist-util-is/index.js @@ -0,0 +1,32 @@ +'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. +function is(node, test, index, parent, context) { + var check = convert(test) + + if ( + index != null && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index') + } + + if (parent != null && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if ((parent == null) !== (index == null)) { + throw new Error('Expected both parent and index') + } + + return node && node.type && typeof node.type === 'string' + ? Boolean(check.call(context, node, index, parent)) + : false +} diff --git a/node_modules/unist-util-is/license b/node_modules/unist-util-is/license new file mode 100644 index 000000000..cfa79e66c --- /dev/null +++ b/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/unist-util-is/package.json b/node_modules/unist-util-is/package.json new file mode 100644 index 000000000..2064685cf --- /dev/null +++ b/node_modules/unist-util-is/package.json @@ -0,0 +1,105 @@ +{ + "name": "unist-util-is", + "version": "4.1.0", + "description": "unist utility to check if a node passes a test", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "repository": "syntax-tree/unist-util-is", + "bugs": "https://github.com/syntax-tree/unist-util-is/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)", + "Christian Murphy ", + "Lucas Brandstaetter (https://github.com/Roang-zero1)" + ], + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "types": "index.d.ts", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^17.0.0", + "dtslint": "^4.0.0", + "fast-check": "^2.0.0", + "lodash": "^4.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark-cli": "^9.0.0", + "remark-preset-wooorm": "^8.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.38.0" + }, + "scripts": { + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "build-bundle": "browserify . -s unistUtilIs -o unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -o unist-util-is.min.js -p tinyify", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test", + "test-types": "dtslint .", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "@typescript-eslint/no-unused-expressions": "off", + "eqeqeq": [ + "error", + "always", + { + "null": "ignore" + } + ], + "max-params": "off", + "no-eq-null": "off", + "unicorn/prefer-number-properties": "off", + "unicorn/prefer-reflect-apply": "off", + "unicorn/prefer-type-error": "off" + }, + "ignore": [ + "*.ts", + "unist-util-is.js" + ] + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-is/readme.md b/node_modules/unist-util-is/readme.md new file mode 100644 index 000000000..a2097627e --- /dev/null +++ b/node_modules/unist-util-is/readme.md @@ -0,0 +1,203 @@ +# 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 nullish, 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-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/syntax-tree/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://github.com/syntax-tree/unist-util-is/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/unist-util-is/actions + +[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-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[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 + +[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/unist-util-remove-position/index.js b/node_modules/unist-util-remove-position/index.js new file mode 100644 index 000000000..096395981 --- /dev/null +++ b/node_modules/unist-util-remove-position/index.js @@ -0,0 +1,18 @@ +'use strict' + +var visit = require('unist-util-visit') + +module.exports = removePosition + +function removePosition(node, force) { + visit(node, force ? hard : soft) + return node +} + +function hard(node) { + delete node.position +} + +function soft(node) { + node.position = undefined +} diff --git a/node_modules/unist-util-remove-position/license b/node_modules/unist-util-remove-position/license new file mode 100644 index 000000000..8d8660d36 --- /dev/null +++ b/node_modules/unist-util-remove-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/unist-util-remove-position/node_modules/unist-util-is/convert.js b/node_modules/unist-util-remove-position/node_modules/unist-util-is/convert.js new file mode 100644 index 000000000..f92f34f10 --- /dev/null +++ b/node_modules/unist-util-remove-position/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/unist-util-remove-position/node_modules/unist-util-is/index.js b/node_modules/unist-util-remove-position/node_modules/unist-util-is/index.js new file mode 100644 index 000000000..f18d416e0 --- /dev/null +++ b/node_modules/unist-util-remove-position/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/unist-util-remove-position/node_modules/unist-util-is/license b/node_modules/unist-util-remove-position/node_modules/unist-util-is/license new file mode 100644 index 000000000..cfa79e66c --- /dev/null +++ b/node_modules/unist-util-remove-position/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/unist-util-remove-position/node_modules/unist-util-is/package.json b/node_modules/unist-util-remove-position/node_modules/unist-util-is/package.json new file mode 100644 index 000000000..25193acdd --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-is/package.json @@ -0,0 +1,75 @@ +{ + "name": "unist-util-is", + "version": "3.0.0", + "description": "Utility to check if a node passes a test", + "license": "MIT", + "keywords": [ + "unist", + "node", + "is", + "equal", + "test", + "type", + "util", + "utility" + ], + "repository": "syntax-tree/unist-util-is", + "bugs": "https://github.com/syntax-tree/unist-util-is/issues", + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js", + "convert.js" + ], + "dependencies": {}, + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.0.0", + "prettier": "^1.0.0", + "remark-cli": "^6.0.0", + "remark-preset-wooorm": "^5.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.24.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-remove-position/node_modules/unist-util-is/readme.md b/node_modules/unist-util-remove-position/node_modules/unist-util-is/readme.md new file mode 100644 index 000000000..7d53629ab --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-is/readme.md @@ -0,0 +1,202 @@ +# 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 +``` + +## Usage + +```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. + +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, 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-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/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 + +[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/unist-util-remove-position/node_modules/unist-util-visit-parents/index.js b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 000000000..c72635924 --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,78 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') + +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 (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, []) + + // Visit a single node. + function one(node, index, parents) { + var result = [] + var subresult + + if (!test || is(node, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(node, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (node.children && result[0] !== SKIP) { + subresult = toResult(all(node.children, parents.concat(node))) + return subresult[0] === EXIT ? subresult : result + } + + return result + } + + // Visit children in `parent`. + function all(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var result + + while (index > min && index < children.length) { + result = one(children[index], index, parents) + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (value !== null && typeof value === 'object' && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} diff --git a/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/license b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/license new file mode 100644 index 000000000..8d8660d36 --- /dev/null +++ b/node_modules/unist-util-remove-position/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/unist-util-remove-position/node_modules/unist-util-visit-parents/package.json b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 000000000..26e187202 --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,70 @@ +{ + "name": "unist-util-visit-parents", + "version": "2.1.2", + "description": "Recursively walk over unist nodes, with ancestral information", + "license": "MIT", + "keywords": [ + "unist", + "walk", + "util", + "utility" + ], + "repository": "syntax-tree/unist-util-visit-parents", + "bugs": "https://github.com/syntax-tree/unist-util-visit-parents/issues", + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": { + "unist-util-is": "^3.0.0" + }, + "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", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.24.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "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", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-visit-parents.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/readme.md b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 000000000..ec7efc7bd --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,218 @@ +# 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 +``` + +## Usage + +```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. + +###### 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 walked in [preorder][] + (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is stilled walked in preorder, but now + in NRL (the node itself, 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 parent 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/eush77/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 provided function and + then flattening +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/eush77/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, 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-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/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 + +[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/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 + +[is]: https://github.com/syntax-tree/unist-util-is + +[preorder]: https://www.geeksforgeeks.org/tree-traversals-inorder-preorder-and-postorder/ + +[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/unist-util-remove-position/node_modules/unist-util-visit/index.js b/node_modules/unist-util-remove-position/node_modules/unist-util-visit/index.js new file mode 100644 index 000000000..39970e7de --- /dev/null +++ b/node_modules/unist-util-remove-position/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/unist-util-remove-position/node_modules/unist-util-visit/license b/node_modules/unist-util-remove-position/node_modules/unist-util-visit/license new file mode 100644 index 000000000..32e7a3d93 --- /dev/null +++ b/node_modules/unist-util-remove-position/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/unist-util-remove-position/node_modules/unist-util-visit/package.json b/node_modules/unist-util-remove-position/node_modules/unist-util-visit/package.json new file mode 100644 index 000000000..44b8bd489 --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-visit/package.json @@ -0,0 +1,79 @@ +{ + "name": "unist-util-visit", + "version": "1.4.1", + "description": "Recursively walk over unist nodes", + "license": "MIT", + "keywords": [ + "unist", + "remark", + "markdown", + "retext", + "natural", + "language", + "node", + "visit", + "walk", + "util", + "utility" + ], + "repository": "syntax-tree/unist-util-visit", + "bugs": "https://github.com/syntax-tree/unist-util-visit/issues", + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)", + "Eugene Sharygin ", + "Richard Gibson " + ], + "files": [ + "index.js" + ], + "dependencies": { + "unist-util-visit-parents": "^2.0.0" + }, + "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", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.24.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-visit.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-remove-position/node_modules/unist-util-visit/readme.md b/node_modules/unist-util-remove-position/node_modules/unist-util-visit/readme.md new file mode 100644 index 000000000..25808a27a --- /dev/null +++ b/node_modules/unist-util-remove-position/node_modules/unist-util-visit/readme.md @@ -0,0 +1,121 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```bash +npm install unist-util-visit +``` + +## Usage + +```javascript +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/eush77/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-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/eush77/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, 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-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 + +[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 + +[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/unist-util-remove-position/package.json b/node_modules/unist-util-remove-position/package.json new file mode 100644 index 000000000..e1166471c --- /dev/null +++ b/node_modules/unist-util-remove-position/package.json @@ -0,0 +1,76 @@ +{ + "name": "unist-util-remove-position", + "version": "1.1.4", + "description": "Remove `position`s from a unist tree", + "license": "MIT", + "keywords": [ + "unist", + "utility", + "remove", + "position", + "location" + ], + "repository": "syntax-tree/unist-util-remove-position", + "bugs": "https://github.com/syntax-tree/unist-util-remove-position/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": { + "unist-util-visit": "^1.1.0" + }, + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.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", + "unist-builder": "^2.0.0", + "xo": "^0.25.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s unistUtilRemovePosition > unist-util-remove-position.js", + "build-mangle": "browserify . -s unistUtilRemovePosition -p tinyify > unist-util-remove-position.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-remove-position.js" + ] + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-remove-position/readme.md b/node_modules/unist-util-remove-position/readme.md new file mode 100644 index 000000000..e79ed14b3 --- /dev/null +++ b/node_modules/unist-util-remove-position/readme.md @@ -0,0 +1,131 @@ +# unist-util-remove-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 remove [`position`][position]s from tree. + +## Install + +[npm][]: + +```sh +npm install unist-util-remove-position +``` + +## Usage + +```js +var remark = require('remark') +var removePosition = require('unist-util-remove-position') + +var tree = remark().parse('Some _emphasis_, **importance**, and `code`.') + +removePosition(tree, true) + +console.dir(tree, {depth: null}) +``` + +Yields: + +```js +{ + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { type: 'text', value: 'Some ' }, + { + type: 'emphasis', + children: [ { type: 'text', value: 'emphasis' } ] + }, + { type: 'text', value: ', ' }, + { + type: 'strong', + children: [ { type: 'text', value: 'importance' } ] + }, + { type: 'text', value: ', and ' }, + { type: 'inlineCode', value: 'code' }, + { type: 'text', value: '.' } + ] + } + ] +} +``` + +## API + +### `removePosition(node[, force])` + +Remove [`position`][position]s from [`node`][node]. +If `force` is given, uses `delete`, otherwise, sets `position`s to `undefined`. + +###### Returns + +The given `node`. + +## 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-remove-position.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-remove-position + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-remove-position.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-remove-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-remove-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-remove-position + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-remove-position.svg + +[size]: https://bundlephobia.com/result?p=unist-util-remove-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/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 + +[position]: https://github.com/syntax-tree/unist#position + +[node]: https://github.com/syntax-tree/unist#node diff --git a/node_modules/unist-util-stringify-position/LICENSE b/node_modules/unist-util-stringify-position/LICENSE new file mode 100644 index 000000000..8d8660d36 --- /dev/null +++ b/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/unist-util-stringify-position/index.js b/node_modules/unist-util-stringify-position/index.js new file mode 100644 index 000000000..3be1e1427 --- /dev/null +++ b/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 null + } + + /* 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 null +} + +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/unist-util-stringify-position/package.json b/node_modules/unist-util-stringify-position/package.json new file mode 100644 index 000000000..2e20b6720 --- /dev/null +++ b/node_modules/unist-util-stringify-position/package.json @@ -0,0 +1,77 @@ +{ + "name": "unist-util-stringify-position", + "version": "1.1.2", + "description": "Stringify a Unist node, position, or point", + "license": "MIT", + "keywords": [ + "unist", + "position", + "location", + "point", + "node", + "stringify", + "tostring", + "util", + "utility" + ], + "repository": "syntax-tree/unist-util-stringify-position", + "bugs": "https://github.com/syntax-tree/unist-util-stringify-position/issues", + "author": "Titus Wormer (http://wooorm.com)", + "contributors": [ + "Titus Wormer (http://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": {}, + "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.5.1", + "xo": "^0.20.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", + "build-bundle": "browserify index.js --no-builtins -s unistUtilStringifyPosition > unist-util-stringify-position.js", + "build-mangle": "esmangle unist-util-stringify-position.js > unist-util-stringify-position.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "guard-for-in": "off", + "no-var": "off", + "prefer-arrow-callback": "off" + }, + "ignores": [ + "unist-util-stringify-position.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-stringify-position/readme.md b/node_modules/unist-util-stringify-position/readme.md new file mode 100644 index 000000000..85c753b5e --- /dev/null +++ b/node_modules/unist-util-stringify-position/readme.md @@ -0,0 +1,100 @@ +# unist-util-stringify-position [![Build Status][build-badge]][build-page] [![Coverage Status][coverage-badge]][coverage-page] + +Stringify a [**Unist**][unist] [`Position`][position] or [`Point`][point]. + +## Installation + +[npm][]: + +```bash +npm install unist-util-stringify-position +``` + +## Usage + +```javascript +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 points), or +a node’s position. + +###### 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. `null` is returned if the given value is neither `node`, +`position`, nor `point`. + +## Contribute + +See [`contributing.md` in `syntax-tree/unist`][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/syntax-tree/unist-util-stringify-position.svg + +[build-page]: 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-page]: https://codecov.io/github/syntax-tree/unist-util-stringify-position?branch=master + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[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 + +[contributing]: https://github.com/syntax-tree/unist/blob/master/contributing.md + +[coc]: https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md diff --git a/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 000000000..db22a1e69 --- /dev/null +++ b/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/unist-util-visit-parents/color.js b/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 000000000..2e2974c93 --- /dev/null +++ b/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/unist-util-visit-parents/index.js b/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 000000000..c24b8f5fb --- /dev/null +++ b/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,93 @@ +'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 step + var is + + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + step = reverse ? -1 : 1 + + factory(tree, null, [])() + + function factory(node, index, parents) { + var value = typeof node === 'object' && node !== null ? node : {} + var name + + if (typeof value.type === 'string') { + name = + typeof value.tagName === 'string' + ? value.tagName + : typeof value.name === 'string' + ? value.name + : undefined + + visit.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return visit + + function visit() { + var grandparents = parents.concat(node) + var result = [] + var subresult + var offset + + if (!test || is(node, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(node, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (node.children && result[0] !== SKIP) { + offset = (reverse ? node.children.length : -1) + step + + while (offset > -1 && offset < node.children.length) { + subresult = factory(node.children[offset], offset, grandparents)() + + if (subresult[0] === EXIT) { + return subresult + } + + offset = + typeof subresult[1] === 'number' ? subresult[1] : offset + step + } + } + + return result + } + } +} + +function toResult(value) { + if (value !== null && typeof value === 'object' && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} diff --git a/node_modules/unist-util-visit-parents/license b/node_modules/unist-util-visit-parents/license new file mode 100644 index 000000000..8d8660d36 --- /dev/null +++ b/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/unist-util-visit-parents/package.json b/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 000000000..85d2c517d --- /dev/null +++ b/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,104 @@ +{ + "name": "unist-util-visit-parents", + "version": "3.1.1", + "description": "unist utility to recursively walk over nodes, with ancestral information", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "repository": "syntax-tree/unist-util-visit-parents", + "bugs": "https://github.com/syntax-tree/unist-util-visit-parents/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "browser": { + "./color.js": "./color.browser.js" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "types": "types/index.d.ts", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "devDependencies": { + "browserify": "^17.0.0", + "dtslint": "^4.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^13.0.0", + "remark-cli": "^9.0.0", + "remark-gfm": "^1.0.0", + "remark-preset-wooorm": "^8.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "typescript": "^4.0.0", + "unified": "^9.0.0", + "xo": "^0.34.0" + }, + "scripts": { + "format": "remark . -qfo && prettier . --write && xo --fix", + "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", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-visit-parents/readme.md b/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 000000000..72417534d --- /dev/null +++ b/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-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[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/unist-util-visit-parents/types/index.d.ts b/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 000000000..53a37c4bf --- /dev/null +++ b/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/unist-util-visit/index.js b/node_modules/unist-util-visit/index.js new file mode 100644 index 000000000..39970e7de --- /dev/null +++ b/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/unist-util-visit/license b/node_modules/unist-util-visit/license new file mode 100644 index 000000000..32e7a3d93 --- /dev/null +++ b/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/unist-util-visit/package.json b/node_modules/unist-util-visit/package.json new file mode 100644 index 000000000..080ee619a --- /dev/null +++ b/node_modules/unist-util-visit/package.json @@ -0,0 +1,105 @@ +{ + "name": "unist-util-visit", + "version": "2.0.3", + "description": "unist utility to visit nodes", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "repository": "syntax-tree/unist-util-visit", + "bugs": "https://github.com/syntax-tree/unist-util-visit/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)", + "Eugene Sharygin ", + "Richard Gibson " + ], + "files": [ + "index.js", + "types/index.d.ts" + ], + "types": "types/index.d.ts", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "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" + }, + "scripts": { + "format": "remark . -qfo && prettier . --write && xo --fix", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/unist-util-visit/readme.md b/node_modules/unist-util-visit/readme.md new file mode 100644 index 000000000..60464ce4d --- /dev/null +++ b/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/unist-util-visit/types/index.d.ts b/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 000000000..75e23ec94 --- /dev/null +++ b/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/util-deprecate/History.md b/node_modules/util-deprecate/History.md new file mode 100644 index 000000000..acc867537 --- /dev/null +++ b/node_modules/util-deprecate/History.md @@ -0,0 +1,16 @@ + +1.0.2 / 2015-10-07 +================== + + * use try/catch when checking `localStorage` (#3, @kumavis) + +1.0.1 / 2014-11-25 +================== + + * browser: use `console.warn()` for deprecation calls + * browser: more jsdocs + +1.0.0 / 2014-04-30 +================== + + * initial commit diff --git a/node_modules/util-deprecate/LICENSE b/node_modules/util-deprecate/LICENSE new file mode 100644 index 000000000..6a60e8c22 --- /dev/null +++ b/node_modules/util-deprecate/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/util-deprecate/README.md b/node_modules/util-deprecate/README.md new file mode 100644 index 000000000..75622fa7c --- /dev/null +++ b/node_modules/util-deprecate/README.md @@ -0,0 +1,53 @@ +util-deprecate +============== +### The Node.js `util.deprecate()` function with browser support + +In Node.js, this module simply re-exports the `util.deprecate()` function. + +In the web browser (i.e. via browserify), a browser-specific implementation +of the `util.deprecate()` function is used. + + +## API + +A `deprecate()` function is the only thing exposed by this module. + +``` javascript +// setup: +exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); + + +// users see: +foo(); +// foo() is deprecated, use bar() instead +foo(); +foo(); +``` + + +## License + +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/util-deprecate/browser.js b/node_modules/util-deprecate/browser.js new file mode 100644 index 000000000..549ae2f06 --- /dev/null +++ b/node_modules/util-deprecate/browser.js @@ -0,0 +1,67 @@ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} diff --git a/node_modules/util-deprecate/node.js b/node_modules/util-deprecate/node.js new file mode 100644 index 000000000..5e6fcff5d --- /dev/null +++ b/node_modules/util-deprecate/node.js @@ -0,0 +1,6 @@ + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = require('util').deprecate; diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json new file mode 100644 index 000000000..2e79f89a9 --- /dev/null +++ b/node_modules/util-deprecate/package.json @@ -0,0 +1,27 @@ +{ + "name": "util-deprecate", + "version": "1.0.2", + "description": "The Node.js `util.deprecate()` function with browser support", + "main": "node.js", + "browser": "browser.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/util-deprecate.git" + }, + "keywords": [ + "util", + "deprecate", + "browserify", + "browser", + "node" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/TooTallNate/util-deprecate/issues" + }, + "homepage": "https://github.com/TooTallNate/util-deprecate" +} diff --git a/node_modules/validate-npm-package-license/LICENSE b/node_modules/validate-npm-package-license/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/node_modules/validate-npm-package-license/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/validate-npm-package-license/README.md b/node_modules/validate-npm-package-license/README.md new file mode 100644 index 000000000..702bc7b4f --- /dev/null +++ b/node_modules/validate-npm-package-license/README.md @@ -0,0 +1,113 @@ +validate-npm-package-license +============================ + +Give me a string and I'll tell you if it's a valid npm package license string. + +```javascript +var valid = require('validate-npm-package-license'); +``` + +SPDX license identifiers are valid license strings: + +```javascript + +var assert = require('assert'); +var validSPDXExpression = { + validForNewPackages: true, + validForOldPackages: true, + spdx: true +}; + +assert.deepEqual(valid('MIT'), validSPDXExpression); +assert.deepEqual(valid('BSD-2-Clause'), validSPDXExpression); +assert.deepEqual(valid('Apache-2.0'), validSPDXExpression); +assert.deepEqual(valid('ISC'), validSPDXExpression); +``` +The function will return a warning and suggestion for nearly-correct license identifiers: + +```javascript +assert.deepEqual( + valid('Apache 2.0'), + { + validForOldPackages: false, + validForNewPackages: false, + warnings: [ + 'license should be ' + + 'a valid SPDX license expression (without "LicenseRef"), ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN "', + 'license is similar to the valid expression "Apache-2.0"' + ] + } +); +``` + +SPDX expressions are valid, too ... + +```javascript +// Simple SPDX license expression for dual licensing +assert.deepEqual( + valid('(GPL-3.0-only OR BSD-2-Clause)'), + validSPDXExpression +); +``` + +... except if they contain `LicenseRef`: + +```javascript +var warningAboutLicenseRef = { + validForOldPackages: false, + validForNewPackages: false, + spdx: true, + warnings: [ + 'license should be ' + + 'a valid SPDX license expression (without "LicenseRef"), ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN "', + ] +}; + +assert.deepEqual( + valid('LicenseRef-Made-Up'), + warningAboutLicenseRef +); + +assert.deepEqual( + valid('(MIT OR LicenseRef-Made-Up)'), + warningAboutLicenseRef +); +``` + +If you can't describe your licensing terms with standardized SPDX identifiers, put the terms in a file in the package and point users there: + +```javascript +assert.deepEqual( + valid('SEE LICENSE IN LICENSE.txt'), + { + validForNewPackages: true, + validForOldPackages: true, + inFile: 'LICENSE.txt' + } +); + +assert.deepEqual( + valid('SEE LICENSE IN license.md'), + { + validForNewPackages: true, + validForOldPackages: true, + inFile: 'license.md' + } +); +``` + +If there aren't any licensing terms, use `UNLICENSED`: + +```javascript +var unlicensed = { + validForNewPackages: true, + validForOldPackages: true, + unlicensed: true +}; +assert.deepEqual(valid('UNLICENSED'), unlicensed); +assert.deepEqual(valid('UNLICENCED'), unlicensed); +``` diff --git a/node_modules/validate-npm-package-license/index.js b/node_modules/validate-npm-package-license/index.js new file mode 100644 index 000000000..35eaa7325 --- /dev/null +++ b/node_modules/validate-npm-package-license/index.js @@ -0,0 +1,86 @@ +var parse = require('spdx-expression-parse'); +var correct = require('spdx-correct'); + +var genericWarning = ( + 'license should be ' + + 'a valid SPDX license expression (without "LicenseRef"), ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN "' +); + +var fileReferenceRE = /^SEE LICEN[CS]E IN (.+)$/; + +function startsWith(prefix, string) { + return string.slice(0, prefix.length) === prefix; +} + +function usesLicenseRef(ast) { + if (ast.hasOwnProperty('license')) { + var license = ast.license; + return ( + startsWith('LicenseRef', license) || + startsWith('DocumentRef', license) + ); + } else { + return ( + usesLicenseRef(ast.left) || + usesLicenseRef(ast.right) + ); + } +} + +module.exports = function(argument) { + var ast; + + try { + ast = parse(argument); + } catch (e) { + var match + if ( + argument === 'UNLICENSED' || + argument === 'UNLICENCED' + ) { + return { + validForOldPackages: true, + validForNewPackages: true, + unlicensed: true + }; + } else if (match = fileReferenceRE.exec(argument)) { + return { + validForOldPackages: true, + validForNewPackages: true, + inFile: match[1] + }; + } else { + var result = { + validForOldPackages: false, + validForNewPackages: false, + warnings: [genericWarning] + }; + if (argument.trim().length !== 0) { + var corrected = correct(argument); + if (corrected) { + result.warnings.push( + 'license is similar to the valid expression "' + corrected + '"' + ); + } + } + return result; + } + } + + if (usesLicenseRef(ast)) { + return { + validForNewPackages: false, + validForOldPackages: false, + spdx: true, + warnings: [genericWarning] + }; + } else { + return { + validForNewPackages: true, + validForOldPackages: true, + spdx: true + }; + } +}; diff --git a/node_modules/validate-npm-package-license/package.json b/node_modules/validate-npm-package-license/package.json new file mode 100644 index 000000000..9e92af4f4 --- /dev/null +++ b/node_modules/validate-npm-package-license/package.json @@ -0,0 +1,28 @@ +{ + "name": "validate-npm-package-license", + "description": "Give me a string and I'll tell you if it's a valid npm package license string", + "version": "3.0.4", + "author": "Kyle E. Mitchell (https://kemitchell.com)", + "contributors": [ + "Mark Stacey " + ], + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^2.0.1", + "replace-require-self": "^1.0.0" + }, + "keywords": [ + "license", + "npm", + "package", + "validation" + ], + "license": "Apache-2.0", + "repository": "kemitchell/validate-npm-package-license.js", + "scripts": { + "test": "defence README.md | replace-require-self | node" + } +} diff --git a/node_modules/vfile-location/index.js b/node_modules/vfile-location/index.js new file mode 100644 index 000000000..2d7c21c18 --- /dev/null +++ b/node_modules/vfile-location/index.js @@ -0,0 +1,74 @@ +'use strict' + +module.exports = factory + +function factory(file) { + var contents = indices(String(file)) + + return { + toPosition: offsetToPositionFactory(contents), + toOffset: positionToOffsetFactory(contents) + } +} + +// Factory to get the line and column-based `position` for `offset` in the bound +// indices. +function offsetToPositionFactory(indices) { + return offsetToPosition + + // Get the line and column-based `position` for `offset` in the bound indices. + function offsetToPosition(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 `position` in the +// bound indices. +function positionToOffsetFactory(indices) { + return positionToOffset + + // Get the `offset` for a line and column-based `position` in the bound + // indices. + function positionToOffset(position) { + var line = position && position.line + var column = position && position.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/vfile-location/license b/node_modules/vfile-location/license new file mode 100644 index 000000000..8d8660d36 --- /dev/null +++ b/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/vfile-location/package.json b/node_modules/vfile-location/package.json new file mode 100644 index 000000000..f66857cf1 --- /dev/null +++ b/node_modules/vfile-location/package.json @@ -0,0 +1,73 @@ +{ + "name": "vfile-location", + "version": "2.0.6", + "description": "Convert between positions (line and column-based) and offsets (range-based) locations in a virtual file", + "license": "MIT", + "keywords": [ + "remark", + "comment", + "message", + "marker", + "control" + ], + "repository": "vfile/vfile-location", + "bugs": "https://github.com/vfile/vfile-location/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": {}, + "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", + "vfile": "^4.0.0", + "xo": "^0.25.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "build-bundle": "browserify . -s vfileLocation > vfile-location.js", + "build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "vfile-location.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/vfile-location/readme.md b/node_modules/vfile-location/readme.md new file mode 100644 index 000000000..aa126a3fe --- /dev/null +++ b/node_modules/vfile-location/readme.md @@ -0,0 +1,115 @@ +# 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 positions (line and column-based) and offsets (range-based) +locations in a [virtual file][vfile]. + +## Install + +[npm][]: + +```sh +npm install vfile-location +``` + +## Usage + +```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.toPosition(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 [`toPosition`][to-position]. + +### `location.toOffset(position)` + +Get the `offset` (`number`) for a line and column-based [`position`][position] +in the bound file. +Returns `-1` when given invalid or out of bounds input. + +### `location.toPosition(offset)` + +Get the line and column-based [`position`][position] 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, organisation, 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/join%20the%20community-on%20spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/vfile + +[npm]: https://docs.npmjs.com/cli/install + +[contributing]: https://github.com/vfile/.github/blob/master/contributing.md + +[support]: https://github.com/vfile/.github/blob/master/support.md + +[health]: https://github.com/vfile/.github + +[coc]: https://github.com/vfile/.github/blob/master/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[vfile]: https://github.com/vfile/vfile + +[to-offset]: #locationtooffsetposition + +[to-position]: #locationtopositionoffset + +[position]: https://github.com/syntax-tree/unist#position diff --git a/node_modules/vfile-message/index.js b/node_modules/vfile-message/index.js new file mode 100644 index 000000000..c91375324 --- /dev/null +++ b/node_modules/vfile-message/index.js @@ -0,0 +1,94 @@ +'use strict' + +var stringify = require('unist-util-stringify-position') + +module.exports = VMessage + +// Inherit from `Error#`. +function VMessagePrototype() {} +VMessagePrototype.prototype = Error.prototype +VMessage.prototype = new VMessagePrototype() + +// Message properties. +var proto = VMessage.prototype + +proto.file = '' +proto.name = '' +proto.reason = '' +proto.message = '' +proto.stack = '' +proto.fatal = null +proto.column = null +proto.line = null + +// Construct a new VMessage. +// +// Note: We cannot invoke `Error` on the created context, as that adds readonly +// `line` and `column` attributes on Safari 9, thus throwing and failing the +// data. +function VMessage(reason, position, origin) { + var parts + var range + var location + + if (typeof position === 'string') { + origin = position + position = null + } + + parts = parseOrigin(origin) + range = stringify(position) || '1:1' + + location = { + start: {line: null, column: null}, + end: {line: null, column: null} + } + + // Node. + if (position && position.position) { + position = position.position + } + + if (position) { + // Position. + if (position.start) { + location = position + position = position.start + } else { + // Point. + location.start = position + } + } + + if (reason.stack) { + this.stack = reason.stack + reason = reason.message + } + + this.message = reason + this.name = range + this.reason = reason + this.line = position ? position.line : null + this.column = position ? position.column : null + this.location = location + this.source = parts[0] + this.ruleId = parts[1] +} + +function parseOrigin(origin) { + var result = [null, null] + var index + + if (typeof origin === 'string') { + index = origin.indexOf(':') + + if (index === -1) { + result[1] = origin + } else { + result[0] = origin.slice(0, index) + result[1] = origin.slice(index + 1) + } + } + + return result +} diff --git a/node_modules/vfile-message/license b/node_modules/vfile-message/license new file mode 100644 index 000000000..045ffe0e0 --- /dev/null +++ b/node_modules/vfile-message/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2017 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/vfile-message/package.json b/node_modules/vfile-message/package.json new file mode 100644 index 000000000..7396bb68e --- /dev/null +++ b/node_modules/vfile-message/package.json @@ -0,0 +1,73 @@ +{ + "name": "vfile-message", + "version": "1.1.1", + "description": "Create a virtual message", + "license": "MIT", + "keywords": [ + "vfile", + "virtual", + "message" + ], + "repository": "vfile/vfile-message", + "bugs": "https://github.com/vfile/vfile-message/issues", + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "files": [ + "index.js" + ], + "dependencies": { + "unist-util-stringify-position": "^1.1.1" + }, + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^13.0.0", + "prettier": "^1.12.1", + "remark-cli": "^6.0.0", + "remark-preset-wooorm": "^4.0.0", + "tape": "^4.0.0", + "tinyify": "^2.4.3", + "xo": "^0.23.0" + }, + "scripts": { + "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", + "build-bundle": "browserify . -s vfileMessage > vfile-message.js", + "build-mangle": "browserify . -s vfileMessage -p tinyify > vfile-message.min.js", + "build": "npm run build-bundle && npm run build-mangle", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run format && npm run build && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "no-var": "off", + "prefer-arrow-callback": "off", + "object-shorthand": "off" + }, + "ignores": [ + "vfile-message.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/vfile-message/readme.md b/node_modules/vfile-message/readme.md new file mode 100644 index 000000000..0c88353a5 --- /dev/null +++ b/node_modules/vfile-message/readme.md @@ -0,0 +1,194 @@ +# vfile-message + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Chat][chat-badge]][chat] + +Create [vfile][] messages. + +## Installation + +[npm][]: + +```bash +npm install vfile-message +``` + +## Usage + +```js +var VMessage = require('vfile-message') + +var message = new VMessage( + '`braavo` is misspelt; did you mean `bravo`?', + {line: 1, column: 8}, + 'spell:typo' +) + +console.log(message) +``` + +Yields: + +```js +{ [1:8: `braavo` is misspelt; did you mean `bravo`?] + reason: '`braavo` is misspelt; did you mean `bravo`?', + fatal: null, + line: 1, + column: 8, + location: + { start: { line: 1, column: 8 }, + end: { line: null, column: null } }, + source: 'spell', + ruleId: 'typo' } +``` + +## API + +### `VMessage(reason[, position][, origin])` + +Constructor of a message for `reason` at `position` from `origin`. When +an error is passed in as `reason`, copies the stack. + +##### Parameters + +###### `reason` + +Reason for message (`string` or `Error`). Uses the stack and message of the +error if given. + +###### `position` + +Place at which the message occurred in a file ([`Node`][node], +[`Position`][position], or [`Point`][point], optional). + +###### `origin` + +Place in code the message originates from (`string`, optional). + +Can either be the [`ruleId`][ruleid] (`'rule'`), or a string with both a +[`source`][source] and a [`ruleId`][ruleid] delimited with a colon +(`'source:rule'`). + +##### Extends + +[`Error`][error]. + +##### Returns + +An instance of itself. + +##### Properties + +###### `reason` + +Reason for message (`string`). + +###### `fatal` + +If `true`, marks associated file as no longer processable (`boolean?`). If +`false`, necessitates a (potential) change. The value can also be `null` or +`undefined`. + +###### `line` + +Starting line of error (`number?`). + +###### `column` + +Starting column of error (`number?`). + +###### `location` + +Full range information, when available ([`Position`][position]). Has `start` +and `end` properties, both set to an object with `line` and `column`, set to +`number?`. + +###### `source` + +Namespace of warning (`string?`). + +###### `ruleId` + +Category of message (`string?`). + +###### `stack` + +Stack of message (`string?`). + +##### Custom properties + +It’s OK to store custom data directly on the `VMessage`, some of those are +handled by [utilities][util]. + +###### `file` + +You may add a `file` property with a path of a file (used throughout the +[**VFile**][vfile] ecosystem). + +###### `note` + +You may add a `note` property with a long form description of the message +(supported by [`vfile-reporter`][reporter]). + +###### `url` + +You may add a `url` property with a link to documentation for the message. + +## Contribute + +See [`contributing.md` in `vfile/vfile`][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/vfile/vfile-message.svg + +[build]: https://travis-ci.org/vfile/vfile-message + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg + +[coverage]: https://codecov.io/github/vfile/vfile-message + +[downloads-badge]: https://img.shields.io/npm/dm/vfile-message.svg + +[downloads]: https://www.npmjs.com/package/vfile-message + +[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/vfile + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error + +[node]: https://github.com/syntax-tree/unist#node + +[position]: https://github.com/syntax-tree/unist#position + +[point]: https://github.com/syntax-tree/unist#point + +[vfile]: https://github.com/vfile/vfile + +[contributing]: https://github.com/vfile/vfile/blob/master/contributing.md + +[coc]: https://github.com/vfile/vfile/blob/master/code-of-conduct.md + +[util]: https://github.com/vfile/vfile#utilities + +[reporter]: https://github.com/vfile/vfile-reporter + +[ruleid]: #ruleid + +[source]: #source diff --git a/node_modules/vfile/LICENSE b/node_modules/vfile/LICENSE new file mode 100644 index 000000000..f3722d94b --- /dev/null +++ b/node_modules/vfile/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/vfile/core.js b/node_modules/vfile/core.js new file mode 100644 index 000000000..2d88a3339 --- /dev/null +++ b/node_modules/vfile/core.js @@ -0,0 +1,169 @@ +'use strict'; + +var path = require('path'); +var replace = require('replace-ext'); +var buffer = require('is-buffer'); + +module.exports = VFile; + +var own = {}.hasOwnProperty; +var proto = VFile.prototype; + +proto.toString = toString; + +/* Order of setting (least specific to most), we need this because + * otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path + * is needed before a stem can be set. */ +var order = [ + 'history', + 'path', + 'basename', + 'stem', + 'extname', + 'dirname' +]; + +/* Construct a new file. */ +function VFile(options) { + var prop; + var index; + var length; + + if (!options) { + options = {}; + } else if (typeof options === 'string' || buffer(options)) { + options = {contents: options}; + } else if ('message' in options && 'messages' in options) { + return options; + } + + if (!(this instanceof VFile)) { + return new VFile(options); + } + + this.data = {}; + this.messages = []; + this.history = []; + this.cwd = process.cwd(); + + /* Set path related properties in the correct order. */ + index = -1; + length = order.length; + + while (++index < length) { + prop = order[index]; + + if (own.call(options, prop)) { + this[prop] = options[prop]; + } + } + + /* Set non-path related properties. */ + for (prop in options) { + if (order.indexOf(prop) === -1) { + this[prop] = options[prop]; + } + } +} + +/* Access full path (`~/index.min.js`). */ +Object.defineProperty(proto, 'path', { + get: function () { + return this.history[this.history.length - 1]; + }, + set: function (path) { + assertNonEmpty(path, 'path'); + + if (path !== this.path) { + this.history.push(path); + } + } +}); + +/* Access parent path (`~`). */ +Object.defineProperty(proto, 'dirname', { + get: function () { + return typeof this.path === 'string' ? path.dirname(this.path) : undefined; + }, + set: function (dirname) { + assertPath(this.path, 'dirname'); + this.path = path.join(dirname || '', this.basename); + } +}); + +/* Access basename (`index.min.js`). */ +Object.defineProperty(proto, 'basename', { + get: function () { + return typeof this.path === 'string' ? path.basename(this.path) : undefined; + }, + set: function (basename) { + assertNonEmpty(basename, 'basename'); + assertPart(basename, 'basename'); + this.path = path.join(this.dirname || '', basename); + } +}); + +/* Access extname (`.js`). */ +Object.defineProperty(proto, 'extname', { + get: function () { + return typeof this.path === 'string' ? path.extname(this.path) : undefined; + }, + set: function (extname) { + var ext = extname || ''; + + assertPart(ext, 'extname'); + assertPath(this.path, 'extname'); + + if (ext) { + if (ext.charAt(0) !== '.') { + throw new Error('`extname` must start with `.`'); + } + + if (ext.indexOf('.', 1) !== -1) { + throw new Error('`extname` cannot contain multiple dots'); + } + } + + this.path = replace(this.path, ext); + } +}); + +/* Access stem (`index.min`). */ +Object.defineProperty(proto, 'stem', { + get: function () { + return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined; + }, + set: function (stem) { + assertNonEmpty(stem, 'stem'); + assertPart(stem, 'stem'); + this.path = path.join(this.dirname || '', stem + (this.extname || '')); + } +}); + +/* Get the value of the file. */ +function toString(encoding) { + var value = this.contents || ''; + return buffer(value) ? value.toString(encoding) : String(value); +} + +/* Assert that `part` is not a path (i.e., does + * not contain `path.sep`). */ +function assertPart(part, name) { + if (part.indexOf(path.sep) !== -1) { + throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); + } +} + +/* Assert that `part` is not empty. */ +function assertNonEmpty(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty'); + } +} + +/* Assert `path` exists. */ +function assertPath(path, name) { + if (!path) { + throw new Error('Setting `' + name + '` requires `path` to be set too'); + } +} diff --git a/node_modules/vfile/index.js b/node_modules/vfile/index.js new file mode 100644 index 000000000..9b3c7e0d1 --- /dev/null +++ b/node_modules/vfile/index.js @@ -0,0 +1,53 @@ +'use strict'; + +var VMessage = require('vfile-message'); +var VFile = require('./core.js'); + +module.exports = VFile; + +var proto = VFile.prototype; + +proto.message = message; +proto.info = info; +proto.fail = fail; + +/* Slight backwards compatibility. Remove in the future. */ +proto.warn = message; + +/* Create a message with `reason` at `position`. + * When an error is passed in as `reason`, copies the stack. */ +function message(reason, position, origin) { + var filePath = this.path; + var message = new VMessage(reason, position, origin); + + if (filePath) { + message.name = filePath + ':' + message.name; + message.file = filePath; + } + + message.fatal = false; + + this.messages.push(message); + + return message; +} + +/* Fail. Creates a vmessage, associates it with the file, + * and throws it. */ +function fail() { + var message = this.message.apply(this, arguments); + + message.fatal = true; + + throw message; +} + +/* Info. Creates a vmessage, associates it with the file, + * and marks the fatality as null. */ +function info() { + var message = this.message.apply(this, arguments); + + message.fatal = null; + + return message; +} diff --git a/node_modules/vfile/package.json b/node_modules/vfile/package.json new file mode 100644 index 000000000..aba5f34dd --- /dev/null +++ b/node_modules/vfile/package.json @@ -0,0 +1,78 @@ +{ + "name": "vfile", + "version": "2.3.0", + "description": "Virtual file format for text processing", + "license": "MIT", + "keywords": [ + "virtual", + "file", + "text", + "processing", + "message", + "warning", + "error", + "remark", + "retext" + ], + "repository": "vfile/vfile", + "bugs": "https://github.com/vfile/vfile/issues", + "author": "Titus Wormer (http://wooorm.com)", + "contributors": [ + "Titus Wormer (http://wooorm.com)", + "Brendan Abbott ", + "Denys Dovhan ", + "Kyle Mathews ", + "Shinnosuke Watanabe ", + "Sindre Sorhus " + ], + "files": [ + "core.js", + "index.js" + ], + "dependencies": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + }, + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.0", + "nyc": "^11.0.0", + "remark-cli": "^4.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.4.0", + "xo": "^0.18.0" + }, + "scripts": { + "build-md": "remark . -qfo", + "build-bundle": "browserify index.js -s VFile > vfile.js", + "build-mangle": "esmangle vfile.js > vfile.min.js", + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "lint": "xo", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test": "npm run build && npm run lint && npm run test-coverage" + }, + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "xo": { + "space": true, + "esnext": false, + "rules": { + "unicorn/no-new-buffer": "off" + }, + "ignores": [ + "vfile.js" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/vfile/readme.md b/node_modules/vfile/readme.md new file mode 100644 index 000000000..1488031d7 --- /dev/null +++ b/node_modules/vfile/readme.md @@ -0,0 +1,285 @@ +# ![vfile][] + +[![Build Status][build-badge]][build-status] +[![Coverage Status][coverage-badge]][coverage-status] + +**VFile** is a virtual file format used by [**unified**][unified], +a text processing umbrella (it powers [**retext**][retext] for +natural language, [**remark**][remark] for markdown, and +[**rehype**][rehype] for HTML). Each processors that parse, transform, +and compile text, and need a virtual representation of files and a +place to store [messages][] about them. Plus, they work in the browser. +**VFile** provides these requirements at a small size, in IE 9 and up. + +> **VFile** is different from the excellent [**vinyl**][vinyl] +> in that it has a smaller API, a smaller size, and focuses on +> [messages][]. + +VFile can be used anywhere where files need a lightweight representation. +For example, it’s used in: + +* [`documentation`](https://github.com/documentationjs/documentation) + — The documentation system for modern JavaScript +* [`weh`](https://github.com/wehjs/weh) + — Declarative small site generator +* [`geojsonhint`](https://github.com/mapbox/geojsonhint) + — Complete, fast, standards-based validation for geojson + +## Installation + +[npm][]: + +```bash +npm install vfile +``` + +## Table of Contents + +* [Usage](#usage) +* [Utilities](#utilities) +* [Reporters](#reporters) +* [API](#api) + * [VFile(\[options\])](#vfileoptions) + * [vfile.contents](#vfilecontents) + * [vfile.cwd](#vfilecwd) + * [vfile.path](#vfilepath) + * [vfile.basename](#vfilebasename) + * [vfile.stem](#vfilestem) + * [vfile.extname](#vfileextname) + * [vfile.dirname](#vfiledirname) + * [vfile.history](#vfilehistory) + * [vfile.messages](#vfilemessages) + * [vfile.data](#vfiledata) + * [VFile#toString(\[encoding\])](#vfiletostringencoding) + * [VFile#message(reason\[, position\]\[, origin\])](#vfilemessagereason-position-origin) + * [VFile#info(reason\[, position\]\[, origin\])](#vfileinforeason-position-origin) + * [VFile#fail(reason\[, position\]\[, origin\])](#vfilefailreason-position-origin) +* [License](#license) + +## Usage + +```js +var vfile = require('vfile'); + +var file = vfile({path: '~/example.txt', contents: 'Alpha *braavo* charlie.'}); + +file.path; //=> '~/example.txt' +file.dirname; //=> '~' + +file.extname = '.md'; + +file.basename; //=> 'example.md' + +file.basename = 'index.text'; + +file.history; //=> ['~/example.txt', '~/example.md', '~/index.text'] + +file.message('`braavo` is misspelt; did you mean `bravo`?', {line: 1, column: 8}); + +console.log(file.messages); +``` + +Yields: + +```js +[ { [~/index.text:1:8: `braavo` is misspelt; did you mean `bravo`?] + message: '`braavo` is misspelt; did you mean `bravo`?', + name: '~/index.text:1:8', + file: '~/index.text', + reason: '`braavo` is misspelt; did you mean `bravo`?', + line: 1, + column: 8, + location: { start: [Object], end: [Object] }, + ruleId: null, + source: null, + fatal: false } ] +``` + +## Utilities + +The following list of projects includes tools for working with virtual +files. See [**Unist**][unist] for projects working with nodes. + +* [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile) + — Convert from [Vinyl][] +* [`is-vfile-message`](https://github.com/shinnn/is-vfile-message) + — Check if a value is a `VMessage` object +* [`to-vfile`](https://github.com/vfile/to-vfile) + — Create a virtual file from a file-path (and optionally read it) +* [`vfile-find-down`](https://github.com/vfile/vfile-find-down) + — Find files by searching the file system downwards +* [`vfile-find-up`](https://github.com/vfile/vfile-find-up) + — Find files by searching the file system upwards +* [`vfile-location`](https://github.com/vfile/vfile-location) + — Convert between line/column- and range-based locations +* [`vfile-statistics`](https://github.com/vfile/vfile-statistics) + — Count messages per category +* [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics) + — Convert to VS Code diagnostics +* [`vfile-sort`](https://github.com/vfile/vfile-sort) + — Sort messages by line/column +* [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint) + — Convert VFiles to ESLint formatter compatible output + +## Reporters + +The following list of projects show linting results for given virtual files. +Reporters _must_ accept `Array.` as their first argument, and return +`string`. Reporters _may_ accept other values too, in which case it’s suggested +to stick to `vfile-reporter`s interface. + +* [`vfile-reporter`][reporter] + — Stylish reporter +* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json) + — JSON reporter +* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty) + — Pretty reporter + +## API + +### `VFile([options])` + +Create a new virtual file. If `options` is `string` or `Buffer`, treats +it as `{contents: options}`. If `options` is a `VFile`, returns it. +All other options are set on the newly created `vfile`. + +Path related properties are set in the following order (least specific +to most specific): `history`, `path`, `basename`, `stem`, `extname`, +`dirname`. + +It’s not possible to set either `dirname` or `extname` without setting +either `history`, `path`, `basename`, or `stem` as well. + +###### Example + +```js +vfile(); +vfile('console.log("alpha");'); +vfile(Buffer.from('exit 1')); +vfile({path: path.join(__dirname, 'readme.md')}); +vfile({stem: 'readme', extname: '.md', dirname: __dirname}); +vfile({other: 'properties', are: 'copied', ov: {e: 'r'}}); +``` + +### `vfile.contents` + +`Buffer`, `string`, `null` — Raw value. + +### `vfile.cwd` + +`string` — Base of `path`. Defaults to `process.cwd()`. + +### `vfile.path` + +`string?` — Path of `vfile`. Cannot be nullified. + +### `vfile.basename` + +`string?` — Current name (including extension) of `vfile`. Cannot +contain path separators. Cannot be nullified either (use +`file.path = file.dirname` instead). + +### `vfile.stem` + +`string?` — Name (without extension) of `vfile`. Cannot be nullified, +and cannot contain path separators. + +### `vfile.extname` + +`string?` — Extension (with dot) of `vfile`. Cannot be set if +there’s no `path` yet and cannot contain path separators. + +### `vfile.dirname` + +`string?` — Path to parent directory of `vfile`. Cannot be set if +there’s no `path` yet. + +### `vfile.history` + +`Array.` — List of file-paths the file moved between. + +### `vfile.messages` + +[`Array.`][message] — List of messages associated with the file. + +### `vfile.data` + +`Object` — Place to store custom information. It’s OK to store custom +data directly on the `vfile`, moving it to `data` gives a _little_ more +privacy. + +### `VFile#toString([encoding])` + +Convert contents of `vfile` to string. If `contents` is a buffer, +`encoding` is used to stringify buffers (default: `'utf8'`). + +### `VFile#message(reason[, position][, origin])` + +Associates a message with the file, where `fatal` is set to `false`. +Constructs a new [`VMessage`][vmessage] and adds it to +[`vfile.messages`][messages]. + +##### Returns + +[`VMessage`][vmessage]. + +### `VFile#info(reason[, position][, origin])` + +Associates an informational message with the file, where `fatal` is set to +`null`. Calls [`#message()`][message] internally. + +##### Returns + +[`VMessage`][vmessage]. + +### `VFile#fail(reason[, position][, origin])` + +Associates a fatal message with the file, then immediately throws it. +Note: fatal errors mean a file is no longer processable. +Calls [`#message()`][message] internally. + +##### Throws + +[`VMessage`][vmessage]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/vfile/vfile.svg + +[build-status]: https://travis-ci.org/vfile/vfile + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile.svg + +[coverage-status]: https://codecov.io/github/vfile/vfile + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[vfile]: https://cdn.rawgit.com/vfile/vfile/f65510e/logo.svg + +[unified]: https://github.com/unifiedjs/unified + +[retext]: https://github.com/wooorm/retext + +[remark]: https://github.com/wooorm/remark + +[rehype]: https://github.com/wooorm/rehype + +[vinyl]: https://github.com/gulpjs/vinyl + +[unist]: https://github.com/syntax-tree/unist#list-of-utilities + +[reporter]: https://github.com/vfile/vfile-reporter + +[vmessage]: https://github.com/vfile/vfile-message + +[messages]: #vfilemessages + +[message]: #vfilemessagereason-position-origin diff --git a/node_modules/which-boxed-primitive/.editorconfig b/node_modules/which-boxed-primitive/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/which-boxed-primitive/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/which-boxed-primitive/.eslintrc b/node_modules/which-boxed-primitive/.eslintrc new file mode 100644 index 000000000..3b5d9e90e --- /dev/null +++ b/node_modules/which-boxed-primitive/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/which-boxed-primitive/.github/FUNDING.yml b/node_modules/which-boxed-primitive/.github/FUNDING.yml new file mode 100644 index 000000000..0cdbbd813 --- /dev/null +++ b/node_modules/which-boxed-primitive/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/which-boxed-primitive +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/which-boxed-primitive/.nycrc b/node_modules/which-boxed-primitive/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/which-boxed-primitive/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/which-boxed-primitive/CHANGELOG.md b/node_modules/which-boxed-primitive/CHANGELOG.md new file mode 100644 index 000000000..1f9415761 --- /dev/null +++ b/node_modules/which-boxed-primitive/CHANGELOG.md @@ -0,0 +1,82 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.1](https://github.com/inspect-js/which-boxed-primitive/compare/v1.1.0...v1.1.1) - 2024-12-15 + +### Commits + +- [Deps] update `is-boolean-object`, `is-number-object`, `is-string`, `is-symbol` [`5266e0c`](https://github.com/inspect-js/which-boxed-primitive/commit/5266e0cb87a814e42b4e8de9574430d27e562070) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`a660339`](https://github.com/inspect-js/which-boxed-primitive/commit/a66033981b3f2b4ba4261cf477fd5a6dc40b38d6) + +## [v1.1.0](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.2...v1.1.0) - 2024-12-02 + +### Commits + +- [actions] reuse common workflows [`893df44`](https://github.com/inspect-js/which-boxed-primitive/commit/893df44f4d4ad653878aa0b470fc3437f25ad240) +- [meta] use `npmignore` to autogenerate an npmignore file [`bab1ff8`](https://github.com/inspect-js/which-boxed-primitive/commit/bab1ff84d391d94a419bb22a0be3d589b16732a4) +- [Tests] use `es-value-fixtures` and `for-each` [`ecacfa0`](https://github.com/inspect-js/which-boxed-primitive/commit/ecacfa01438228830b77fc006e3d366c8227c2b3) +- [New] add types [`ab38e78`](https://github.com/inspect-js/which-boxed-primitive/commit/ab38e78885752258f1e90487f2793173a3e81e5e) +- [actions] split out node 10-20, and 20+ [`7ee9c3c`](https://github.com/inspect-js/which-boxed-primitive/commit/7ee9c3c27b31289db6970cb2024621cdef4dc5ae) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`142215a`](https://github.com/inspect-js/which-boxed-primitive/commit/142215aeb898604e356e46708a7fad0d1113d764) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `has-symbols`, `object-inspect`, `tape` [`3559371`](https://github.com/inspect-js/which-boxed-primitive/commit/3559371556c26688418e6ea06e52dfd51cce29e7) +- [actions] update rebase action to use reusable workflow [`928901a`](https://github.com/inspect-js/which-boxed-primitive/commit/928901a781ddcb75cec158f3d0a273100d8f3f80) +- [Deps] update `is-bigint`, `is-boolean-object`, `is-number-object`, `is-string`, `is-symbol` [`f7b14be`](https://github.com/inspect-js/which-boxed-primitive/commit/f7b14bed64b6f784221dfe229b583c512d2bcb2c) +- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `npmignore`, `object-inspect`, `tape` [`5296738`](https://github.com/inspect-js/which-boxed-primitive/commit/5296738a192d9d006a5874dcc262080df108da62) +- [Deps] update `is-bigint`, `is-boolean-object`, `is-number-object`, `is-string`, `is-symbol` [`caa6d1c`](https://github.com/inspect-js/which-boxed-primitive/commit/caa6d1cb8e44c6b8100431dd643e9817f361921c) +- [meta] add missing `engines.node` [`ca40880`](https://github.com/inspect-js/which-boxed-primitive/commit/ca40880bb94282871229a7f1d678609b71f4d120) +- [Tests] replace `aud` with `npm audit` [`b0f4069`](https://github.com/inspect-js/which-boxed-primitive/commit/b0f40690697c2a963dd7100eec500f138a79f4ae) +- [Dev Deps] update `aud` [`8d0e336`](https://github.com/inspect-js/which-boxed-primitive/commit/8d0e336ee7385ed6a94d6362e62e25c54d155a2d) +- [Deps] update `is-number-object` [`eafcabf`](https://github.com/inspect-js/which-boxed-primitive/commit/eafcabf3f00c7d716bffdfc0ceeca62387349c7d) +- [Dev Deps] add missing peer dep [`ec4dd52`](https://github.com/inspect-js/which-boxed-primitive/commit/ec4dd520dbe77e33341d94479aec3b42817b4cbf) + +## [v1.0.2](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.1...v1.0.2) - 2020-12-14 + +### Commits + +- [Tests] use shared travis-ci configs [`8674582`](https://github.com/inspect-js/which-boxed-primitive/commit/86745829b6a92cff2cfb0d3c0414ec9afdc2a087) +- [Tests] migrate tests to Github Actions [`dff6643`](https://github.com/inspect-js/which-boxed-primitive/commit/dff6643405ba4d6dc6694a25904c8f72f273ece8) +- [meta] do not publish github action workflow files [`b26112a`](https://github.com/inspect-js/which-boxed-primitive/commit/b26112a4e4ac6beec8f54c734135dbf9e9ba16f9) +- [meta] make `auto-changelog` config consistent [`8d10175`](https://github.com/inspect-js/which-boxed-primitive/commit/8d10175171154cd6c8f8a016aa7fb71b5044acf6) +- [readme] fix repo URLs, remove defunct badges [`ab8db24`](https://github.com/inspect-js/which-boxed-primitive/commit/ab8db247573723dbcda68469118d08c7c2692c67) +- [Tests] run `nyc` on all tests; use `tape` runner [`7d084df`](https://github.com/inspect-js/which-boxed-primitive/commit/7d084dfc5251230e9399a81782c0b9d7ae5d1901) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`576f6f3`](https://github.com/inspect-js/which-boxed-primitive/commit/576f6f308aed35ef1d3392bb9472def59482ed13) +- [actions] add automatic rebasing / merge commit blocking [`97efa53`](https://github.com/inspect-js/which-boxed-primitive/commit/97efa53a307678323e63f576c07db9ff84846fd3) +- [actions] add "Allow Edits" workflow [`fb1b4f7`](https://github.com/inspect-js/which-boxed-primitive/commit/fb1b4f7cd753fcced74ac054b20c8b2bfafe7953) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols`, `object-inspect`, `safe-publish-latest` [`1e03c61`](https://github.com/inspect-js/which-boxed-primitive/commit/1e03c6153693d385833acc15178f675e6ce5ddd0) +- [Deps] update `is-boolean-object`, `is-number-object`, `is-string`, `is-symbol` [`13673df`](https://github.com/inspect-js/which-boxed-primitive/commit/13673dff6e43f0a915377c3e5740ec24e86d6bb7) +- [Dev Deps] update `auto-changelog`, `in-publish`, `tape` [`65a0e15`](https://github.com/inspect-js/which-boxed-primitive/commit/65a0e155fc46a9237692233a51ec9573621135d2) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`f8a0afe`](https://github.com/inspect-js/which-boxed-primitive/commit/f8a0afea82938d64f3d2d240268afbd346d0c4da) +- [Deps] update `is-bigint`, `is-boolean-object` [`e7a1ce2`](https://github.com/inspect-js/which-boxed-primitive/commit/e7a1ce25371c00ee726f1c0cc5b6acf10d51ec50) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`e46f193`](https://github.com/inspect-js/which-boxed-primitive/commit/e46f193298b158db5c8aba889803513e4ee38957) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`df3da14`](https://github.com/inspect-js/which-boxed-primitive/commit/df3da1424552a5d22e203a0abf1710106bfd4ae2) +- [Dev Deps] update `auto-changelog`; add `aud` [`e2e8a12`](https://github.com/inspect-js/which-boxed-primitive/commit/e2e8a12c6fbf8c48e760ea1d1ccd5e8d2d6fbf24) +- [meta] add `funding` field [`7df404b`](https://github.com/inspect-js/which-boxed-primitive/commit/7df404b20cd50b2b87e6645b130fefa8ee98810e) +- [Dev Deps] update `auto-changelog` [`0d6b76d`](https://github.com/inspect-js/which-boxed-primitive/commit/0d6b76dbbe760581fa86a0c3f254988fe5d27770) +- [Tests] only audit prod deps [`246151c`](https://github.com/inspect-js/which-boxed-primitive/commit/246151cc1407b3b1ef42014db993f62670bd82ff) +- [meta] fix changelog [`c2d1685`](https://github.com/inspect-js/which-boxed-primitive/commit/c2d16856deffbf86e0b5029e69b65d8aa758ec3d) +- [readme] Fix spelling error [`25fb2b5`](https://github.com/inspect-js/which-boxed-primitive/commit/25fb2b56e1f708c6364923e4bae384f818ecf57f) + +## [v1.0.1](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.0...v1.0.1) - 2019-08-10 + +### Commits + +- [meta] avoid running `safe-publish-latest` when not publishing [`df44b27`](https://github.com/inspect-js/which-boxed-primitive/commit/df44b27875a8f5c3c596663ecb4a063f9fc7bde3) + +## v1.0.0 - 2019-08-10 + +### Commits + +- [Tests] add `.travis.yml` [`764b0cf`](https://github.com/inspect-js/which-boxed-primitive/commit/764b0cf75f8d2b3a0ad2056de5f4ad85d5d1b765) +- Initial commit [`da7d068`](https://github.com/inspect-js/which-boxed-primitive/commit/da7d068913d591294bf155db5d438f7804d71b9a) +- readme [`1395bb2`](https://github.com/inspect-js/which-boxed-primitive/commit/1395bb27b72137ac01e48ee398a0f54e93fd87f5) +- [Tests] add tests [`0ff580f`](https://github.com/inspect-js/which-boxed-primitive/commit/0ff580f99579cd4424af7b814bd76fcb69a2b04e) +- implementation [`8811c32`](https://github.com/inspect-js/which-boxed-primitive/commit/8811c3262a57963634cdc83ceb5bb2c5e9ae4e7e) +- npm init [`cffdea9`](https://github.com/inspect-js/which-boxed-primitive/commit/cffdea9755eabfa2f9ec62a6fcbce0c28f04495b) +- [Tests] add `npm run lint` [`a8be993`](https://github.com/inspect-js/which-boxed-primitive/commit/a8be9933fec1b21267acd847df77f6438e07e3b9) +- [meta] add FUNDING.yml [`941258c`](https://github.com/inspect-js/which-boxed-primitive/commit/941258c70c9a397466e05b614126cb8c7be77b99) +- Only apps should have lockfiles [`6857316`](https://github.com/inspect-js/which-boxed-primitive/commit/68573165d8ce842cdf15d94af82f8cccb961b8cf) +- [Tests] use `npx aud` in `posttest` [`ee48a91`](https://github.com/inspect-js/which-boxed-primitive/commit/ee48a9144bea23bde5cc47788a54d5aa7969d489) diff --git a/node_modules/which-boxed-primitive/LICENSE b/node_modules/which-boxed-primitive/LICENSE new file mode 100644 index 000000000..3900dd7e2 --- /dev/null +++ b/node_modules/which-boxed-primitive/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/which-boxed-primitive/README.md b/node_modules/which-boxed-primitive/README.md new file mode 100644 index 000000000..e08f26af8 --- /dev/null +++ b/node_modules/which-boxed-primitive/README.md @@ -0,0 +1,73 @@ +# which-boxed-primitive [![Version Badge][2]][1] + +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Which kind of boxed JS primitive is this? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and works despite ES6 Symbol.toStringTag. + +## Example + +```js +var whichBoxedPrimitive = require('which-boxed-primitive'); +var assert = require('assert'); + +// unboxed primitives return `null` +// boxed primitives return the builtin constructor name + +assert.equal(whichBoxedPrimitive(undefined), null); +assert.equal(whichBoxedPrimitive(null), null); + +assert.equal(whichBoxedPrimitive(false), null); +assert.equal(whichBoxedPrimitive(true), null); +assert.equal(whichBoxedPrimitive(new Boolean(false)), 'Boolean'); +assert.equal(whichBoxedPrimitive(new Boolean(true)), 'Boolean'); + +assert.equal(whichBoxedPrimitive(42), null); +assert.equal(whichBoxedPrimitive(NaN), null); +assert.equal(whichBoxedPrimitive(Infinity), null); +assert.equal(whichBoxedPrimitive(new Number(42)), 'Number'); +assert.equal(whichBoxedPrimitive(new Number(NaN)), 'Number'); +assert.equal(whichBoxedPrimitive(new Number(Infinity)), 'Number'); + +assert.equal(whichBoxedPrimitive(''), null); +assert.equal(whichBoxedPrimitive('foo'), null); +assert.equal(whichBoxedPrimitive(new String('')), 'String'); +assert.equal(whichBoxedPrimitive(new String('foo')), 'String'); + +assert.equal(whichBoxedPrimitive(Symbol()), null); +assert.equal(whichBoxedPrimitive(Object(Symbol()), 'Symbol'); + +assert.equal(whichBoxedPrimitive(42n), null); +assert.equal(whichBoxedPrimitive(Object(42n), 'BigInt'); + +// non-boxed-primitive objects return `undefined` +assert.equal(whichBoxedPrimitive([]), undefined); +assert.equal(whichBoxedPrimitive({}), undefined); +assert.equal(whichBoxedPrimitive(/a/g), undefined); +assert.equal(whichBoxedPrimitive(new RegExp('a', 'g')), undefined); +assert.equal(whichBoxedPrimitive(new Date()), undefined); +assert.equal(whichBoxedPrimitive(function () {}), undefined); +assert.equal(whichBoxedPrimitive(function* () {}), undefined); +assert.equal(whichBoxedPrimitive(x => x * x), undefined); +assert.equal(whichBoxedPrimitive([]), undefined); + +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/which-boxed-primitive +[2]: https://versionbadg.es/inspect-js/which-boxed-primitive.svg +[5]: https://david-dm.org/inspect-js/which-boxed-primitive.svg +[6]: https://david-dm.org/inspect-js/which-boxed-primitive +[7]: https://david-dm.org/inspect-js/which-boxed-primitive/dev-status.svg +[8]: https://david-dm.org/inspect-js/which-boxed-primitive#info=devDependencies +[11]: https://nodei.co/npm/which-boxed-primitive.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/which-boxed-primitive.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/which-boxed-primitive.svg +[downloads-url]: https://npm-stat.com/charts.html?package=which-boxed-primitive diff --git a/node_modules/which-boxed-primitive/index.d.ts b/node_modules/which-boxed-primitive/index.d.ts new file mode 100644 index 000000000..96d9daf6b --- /dev/null +++ b/node_modules/which-boxed-primitive/index.d.ts @@ -0,0 +1,11 @@ +type primitive = string | number | bigint | boolean | symbol | null | undefined; + +declare function whichBoxedPrimitive(value: primitive): null; +declare function whichBoxedPrimitive(value: BigInt): 'BigInt'; +declare function whichBoxedPrimitive(value: Boolean): 'Boolean'; +declare function whichBoxedPrimitive(value: Number): 'Number'; +declare function whichBoxedPrimitive(value: String): 'String'; +declare function whichBoxedPrimitive(value: Symbol): 'Symbol'; +declare function whichBoxedPrimitive(value: unknown): undefined; + +export = whichBoxedPrimitive; diff --git a/node_modules/which-boxed-primitive/index.js b/node_modules/which-boxed-primitive/index.js new file mode 100644 index 000000000..e8ca93390 --- /dev/null +++ b/node_modules/which-boxed-primitive/index.js @@ -0,0 +1,31 @@ +'use strict'; + +var isString = require('is-string'); +var isNumber = require('is-number-object'); +var isBoolean = require('is-boolean-object'); +var isSymbol = require('is-symbol'); +var isBigInt = require('is-bigint'); + +/** @type {import('.')} */ +// eslint-disable-next-line consistent-return +module.exports = function whichBoxedPrimitive(value) { + // eslint-disable-next-line eqeqeq + if (value == null || (typeof value !== 'object' && typeof value !== 'function')) { + return null; + } + if (isString(value)) { + return 'String'; + } + if (isNumber(value)) { + return 'Number'; + } + if (isBoolean(value)) { + return 'Boolean'; + } + if (isSymbol(value)) { + return 'Symbol'; + } + if (isBigInt(value)) { + return 'BigInt'; + } +}; diff --git a/node_modules/which-boxed-primitive/package.json b/node_modules/which-boxed-primitive/package.json new file mode 100644 index 000000000..6540d89ee --- /dev/null +++ b/node_modules/which-boxed-primitive/package.json @@ -0,0 +1,83 @@ +{ + "name": "which-boxed-primitive", + "version": "1.1.1", + "description": "Which kind of boxed JS primitive is this?", + "main": "index.js", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/which-boxed-primitive.git" + }, + "keywords": [ + "boxed", + "primitive", + "object", + "ecmascript", + "javascript", + "which" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/which-boxed-primitive/issues" + }, + "homepage": "https://github.com/inspect-js/which-boxed-primitive#readme", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/for-each": "^0.3.3", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.7.0", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.5.0", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/which-boxed-primitive/test/index.js b/node_modules/which-boxed-primitive/test/index.js new file mode 100644 index 000000000..a2751578b --- /dev/null +++ b/node_modules/which-boxed-primitive/test/index.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('for-each'); +var v = require('es-value-fixtures'); + +var whichBoxedPrimitive = require('../'); + +var objects = [ + /a/g, + new Date(), + function () {}, + [], + {} +].concat(v.objects); + +test('isBoxedPrimitive', function (t) { + t.test('unboxed primitives', function (st) { + forEach(v.primitives, function (primitive) { + st.equal(null, whichBoxedPrimitive(primitive), inspect(primitive) + ' is a primitive, but not a boxed primitive'); + }); + st.end(); + }); + + t.test('boxed primitives', function (st) { + forEach(v.primitives, function (primitive) { + if (primitive != null) { // eslint-disable-line eqeqeq + var boxed = Object(primitive); + var expected = boxed.constructor.name; + st.equal(typeof expected, 'string', 'expected is string'); + st.equal(whichBoxedPrimitive(boxed), expected, inspect(boxed) + ' is a boxed primitive: ' + expected); + } + }); + st.end(); + }); + + t.test('non-primitive objects', function (st) { + forEach(objects, function (object) { + st.equal(undefined, whichBoxedPrimitive(object), inspect(object) + ' is not a primitive, boxed or otherwise'); + }); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/which-boxed-primitive/tsconfig.json b/node_modules/which-boxed-primitive/tsconfig.json new file mode 100644 index 000000000..707cf9510 --- /dev/null +++ b/node_modules/which-boxed-primitive/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ES2021", + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/which-builtin-type/.eslintrc b/node_modules/which-builtin-type/.eslintrc new file mode 100644 index 000000000..f9c333a22 --- /dev/null +++ b/node_modules/which-builtin-type/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": 0, + "eqeqeq": [2, "allow-null"], + "func-name-matching": 0, + "id-length": 0, + "max-lines-per-function": 0, + "max-statements": 0, + }, +} diff --git a/node_modules/which-builtin-type/.nycrc b/node_modules/which-builtin-type/.nycrc new file mode 100644 index 000000000..bdd626ce9 --- /dev/null +++ b/node_modules/which-builtin-type/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/which-builtin-type/CHANGELOG.md b/node_modules/which-builtin-type/CHANGELOG.md new file mode 100644 index 000000000..fd64f01e7 --- /dev/null +++ b/node_modules/which-builtin-type/CHANGELOG.md @@ -0,0 +1,113 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.1](https://github.com/inspect-js/which-builtin-type/compare/v1.2.0...v1.2.1) - 2024-12-12 + +### Commits + +- [meta] sort package.json [`8305bf9`](https://github.com/inspect-js/which-builtin-type/commit/8305bf9a47674564c84dde5856829444ac59e379) +- [actions] re-add finishers [`67140db`](https://github.com/inspect-js/which-builtin-type/commit/67140dba99e8f204c6f1abce315711fae4239032) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/function.prototype.name`, `@types/tape`, `has-symbols` [`5adff02`](https://github.com/inspect-js/which-builtin-type/commit/5adff02870f00eafe144250b0ea2181f59b0d337) +- [Deps] update `call-bind`, `is-date-object`, `is-regex`, `which-boxed-primitive` [`87922d3`](https://github.com/inspect-js/which-builtin-type/commit/87922d3a0a21ee2b0991d9f3832123f5ff149eed) +- [Refactor] use `call-bound` directly [`8f633bc`](https://github.com/inspect-js/which-builtin-type/commit/8f633bc7587f481877f3965fdf0c74885753d824) +- [Deps] update `is-regex`, `which-typed-array` [`a912742`](https://github.com/inspect-js/which-builtin-type/commit/a9127421b702943a57927bf3e4d867cdc5862419) + +## [v1.2.0](https://github.com/inspect-js/which-builtin-type/compare/v1.1.4...v1.2.0) - 2024-11-23 + +### Commits + +- [New] add types [`d4aa2db`](https://github.com/inspect-js/which-builtin-type/commit/d4aa2db289a8d97c6917c0edb1edcb32001488a8) +- [actions] split out node 10-20, and 20+ [`7b3d28b`](https://github.com/inspect-js/which-builtin-type/commit/7b3d28bcb1258cdfd5a7df5606622351596fb442) +- [Refactor] use `callBound` to cache Promise#then [`a000377`](https://github.com/inspect-js/which-builtin-type/commit/a0003772dabdd5fd4b84c2ed8e139df008a437e8) +- [Dev Deps] update `auto-changelog`, `object-inspect`, `tape` [`37062d2`](https://github.com/inspect-js/which-builtin-type/commit/37062d280a8c36c1bd96b6cfbe053f10cf8d71b6) +- [Tests] replace `aud` with `npm audit` [`337aac1`](https://github.com/inspect-js/which-builtin-type/commit/337aac1d88fc63d935bd15a97926e9b0b462a735) +- [Deps] update `is-finalizationregistry` [`4ef8763`](https://github.com/inspect-js/which-builtin-type/commit/4ef8763a19709df7ad50d790bd2b724f531a65d9) +- [Dev Deps] add missing peer dep [`1cb2842`](https://github.com/inspect-js/which-builtin-type/commit/1cb28421438eb4ee8f0f284b535f1cfc6b9c9757) + +## [v1.1.4](https://github.com/inspect-js/which-builtin-type/compare/v1.1.3...v1.1.4) - 2024-07-29 + +### Commits + +- [readme] fix URLs [`f26fc22`](https://github.com/inspect-js/which-builtin-type/commit/f26fc2243220277874e36ace85f48f87ec8ab502) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `available-typed-arrays`, `npmignore`, `object-inspect`, `object.assign`, `tape` [`f724135`](https://github.com/inspect-js/which-builtin-type/commit/f724135d44efd74ee067102c8c499566d73b849c) +- [Deps] update `function.prototype.name`, `has-tostringtag`, `which-collection`, `which-typed-array` [`831119b`](https://github.com/inspect-js/which-builtin-type/commit/831119b76ce79004c368deab141e8a9bd680950c) + +## [v1.1.3](https://github.com/inspect-js/which-builtin-type/compare/v1.1.2...v1.1.3) - 2022-11-02 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`0ccf168`](https://github.com/inspect-js/which-builtin-type/commit/0ccf168604ddaab1d40de8fde5140f5dca942c5b) +- [Dev Deps] update `aud`, `has-bigints`, `has-symbols`, `in-publish`, `object-inspect`, `object.assign`, `tape` [`2c87b2e`](https://github.com/inspect-js/which-builtin-type/commit/2c87b2ed58c397a26953dbe2cb2aae452e32ee21) +- [actions] update rebase action to use reusable workflow [`ab27caf`](https://github.com/inspect-js/which-builtin-type/commit/ab27caf0d6cd1fccc5738fda4cebee7bf47eca14) +- [meta] simplify `exports` [`680d056`](https://github.com/inspect-js/which-builtin-type/commit/680d05674f979c1a02ae7c6b9f885114e962324e) +- [Deps] update `which-typed-array` [`3ca0216`](https://github.com/inspect-js/which-builtin-type/commit/3ca02166585c6e7350fe0bc7518fccce269fc5ac) +- [meta] add `sideEffects` flag [`caa2221`](https://github.com/inspect-js/which-builtin-type/commit/caa22214c751674f1959944a0ece81b032141e3b) + +## [v1.1.2](https://github.com/inspect-js/which-builtin-type/compare/v1.1.1...v1.1.2) - 2022-04-12 + +### Commits + +- [actions] reuse common workflows [`b1b60aa`](https://github.com/inspect-js/which-builtin-type/commit/b1b60aa01b20f613a97b456c3062412f0aba67dd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`8115a20`](https://github.com/inspect-js/which-builtin-type/commit/8115a20941ca702c1a927a0aea08ffa0b37821c0) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`86b3c3b`](https://github.com/inspect-js/which-builtin-type/commit/86b3c3ba155a2a292a69d507be85ede12896163d) +- [actions] update codecov uploader [`de30f4b`](https://github.com/inspect-js/which-builtin-type/commit/de30f4bdd613b36a11270085974013c1e0025b74) +- [Deps] update `function.prototype.name`, `is-finalizationregistry`, `which-typed-array` [`0ba20f5`](https://github.com/inspect-js/which-builtin-type/commit/0ba20f53824455b2fcdd90027a64bc34f09bec6b) +- [Refactor] use `is-async-function` [`6f36d89`](https://github.com/inspect-js/which-builtin-type/commit/6f36d8942a158cc41f486ba9e29d08f75a6d1406) +- [Deps] update `is-weakref` [`d775476`](https://github.com/inspect-js/which-builtin-type/commit/d775476f5f0dccab56b13c839ce6ada377b67ca0) + +## [v1.1.1](https://github.com/inspect-js/which-builtin-type/compare/v1.1.0...v1.1.1) - 2021-08-06 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `available-typed-arrays`, `object-inspect`, `tape` [`8adae7d`](https://github.com/inspect-js/which-builtin-type/commit/8adae7d7ba4a49309f87e990d9787589f8c978a1) +- [Deps] update `is-date-object`, `is-generator-function`, `is-regex`, `which-typed-array` [`805b158`](https://github.com/inspect-js/which-builtin-type/commit/805b158f86d258983868b45ceb4a3a9417fed08e) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`9ec250a`](https://github.com/inspect-js/which-builtin-type/commit/9ec250a652c6607053d63c3e662547cf36c8cb9b) +- [readme] add github actions/codecov badges [`75b51b4`](https://github.com/inspect-js/which-builtin-type/commit/75b51b4c96280a05014c97efba6b8291b18af5cb) + +## [v1.1.0](https://github.com/inspect-js/which-builtin-type/compare/v1.0.1...v1.1.0) - 2021-04-18 + +### Commits + +- [Fix] prevent constructor or Symbol.toStringTag from lying about builtins [`7638412`](https://github.com/inspect-js/which-builtin-type/commit/7638412d9b6cca9af3999b4bf45d3a630f84409e) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`6a06770`](https://github.com/inspect-js/which-builtin-type/commit/6a06770548aec6948ab0aaa28babc0423f0fe745) +- [New] recognize Promise [`0d79e3a`](https://github.com/inspect-js/which-builtin-type/commit/0d79e3a0916438e1c808f83d8928af29914de08a) +- [New] recognize WeakRef and FinalizationRegistry [`020de6a`](https://github.com/inspect-js/which-builtin-type/commit/020de6a84242e12a5cd956b74f4457a8d3cba6fb) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `object-inspect`, `tape` [`71e47f5`](https://github.com/inspect-js/which-builtin-type/commit/71e47f50c534e2e37ba654bdc2851f9fb8b9f435) +- [Deps] update `function.prototype.name`, `is-regex` [`f2d56b9`](https://github.com/inspect-js/which-builtin-type/commit/f2d56b9ba12962f6432d869e14a73c43b0bfaeb0) +- [meta] use `prepublishOnly` script for npm 7+ [`daae0a0`](https://github.com/inspect-js/which-builtin-type/commit/daae0a018594cef507a0d5bc3304ec950db15925) +- [Tests] increase coverage [`bd406f2`](https://github.com/inspect-js/which-builtin-type/commit/bd406f212ac79af48c0ca11fb36c770fe106bf5f) + +## [v1.0.1](https://github.com/inspect-js/which-builtin-type/compare/v1.0.0...v1.0.1) - 2020-12-14 + +### Commits + +- [Tests] migrate tests to Github Actions [`165a1b5`](https://github.com/inspect-js/which-builtin-type/commit/165a1b5924c242db86749e9691bb310fce3e2b05) +- [meta] do not publish github action workflow files [`851f508`](https://github.com/inspect-js/which-builtin-type/commit/851f508ad644248621ca2d465ba440913e865d4e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `has-bigints`, `object-inspect`, `object.assign`, `tape` [`5b0906c`](https://github.com/inspect-js/which-builtin-type/commit/5b0906cf115aa7b77073262a3fb34134c214c444) +- [Tests] run `nyc` on all tests; use `tape` runner [`85924cd`](https://github.com/inspect-js/which-builtin-type/commit/85924cd70d665f79fd8f1a439706412d7e8e6455) +- [readme] fix repo URLs, remove defunct badges [`8fb4bb5`](https://github.com/inspect-js/which-builtin-type/commit/8fb4bb51219e956916583ba9a34a9a2d0228716e) +- [Dev Deps] update `@ljharb/eslint-config`, `available-typed-arrays`, `make-arrow-function`, `make-generator-function` [`9d65291`](https://github.com/inspect-js/which-builtin-type/commit/9d652910fc84589669f9bfe7accc0272df911a0f) +- [Deps] update `function.prototype.name`, `is-generator-function`, `is-regex`, `which-boxed-primitive`, `which-collection`, `which-typed-array` [`7900c10`](https://github.com/inspect-js/which-builtin-type/commit/7900c10e8113fb9b087103f313bda71f4204a935) +- [actions] add "Allow Edits" workflow [`f9f04f5`](https://github.com/inspect-js/which-builtin-type/commit/f9f04f5999f564b921b9678792a3db8ad4268709) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`4452dee`](https://github.com/inspect-js/which-builtin-type/commit/4452dee4fe2bc3cdb29470f25a184031b1c267ee) + +## v1.0.0 - 2020-01-24 + +### Commits + +- Tests [`d65924f`](https://github.com/inspect-js/which-builtin-type/commit/d65924fea79cd13609d3155b018f9db12f995b71) +- Initial commit [`a6208ff`](https://github.com/inspect-js/which-builtin-type/commit/a6208ff57dfbf9b6368adc5a22ca5d2db2c123e5) +- Implementation [`0d1c341`](https://github.com/inspect-js/which-builtin-type/commit/0d1c341b71de6b475db6f8cb430cace4be54c93b) +- readme [`23ecfb6`](https://github.com/inspect-js/which-builtin-type/commit/23ecfb6b5c5e30cbae73148f3d01adbb6229d064) +- npm init [`cce1b17`](https://github.com/inspect-js/which-builtin-type/commit/cce1b17caa4d56bae6980d898e8ad223da073fcc) +- [meta] add `auto-changelog` [`f903f62`](https://github.com/inspect-js/which-builtin-type/commit/f903f629cf70d725a2d0c1fd0e76112c39b88b70) +- [actions] add automatic rebasing / merge commit blocking [`71f9295`](https://github.com/inspect-js/which-builtin-type/commit/71f92950bdbcd1eb79d8ce8c3b7584bd4db45733) +- [Tests] use shared travis-ci configs [`2d7a1f4`](https://github.com/inspect-js/which-builtin-type/commit/2d7a1f4105de53def9b1652e53e900debb2a99a5) +- [Tests] add `npm run lint` [`a6372e2`](https://github.com/inspect-js/which-builtin-type/commit/a6372e203dbdb4ad42da15af7927cd21e0f94618) +- Only apps should have lockfiles [`d6bd083`](https://github.com/inspect-js/which-builtin-type/commit/d6bd083310cd713e6e1e3f16fcd35277194663e7) +- [meta] add `funding` field [`377f67a`](https://github.com/inspect-js/which-builtin-type/commit/377f67a24bef750dca957c8ccde62c3e8af6932b) +- [meta] add `safe-publish-latest` [`99295e9`](https://github.com/inspect-js/which-builtin-type/commit/99295e921f5cb898a62081b6719c30cf537f58f9) diff --git a/node_modules/which-builtin-type/LICENSE b/node_modules/which-builtin-type/LICENSE new file mode 100644 index 000000000..c5412d4aa --- /dev/null +++ b/node_modules/which-builtin-type/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 ECMAScript Shims + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/which-builtin-type/README.md b/node_modules/which-builtin-type/README.md new file mode 100644 index 000000000..31a15b884 --- /dev/null +++ b/node_modules/which-builtin-type/README.md @@ -0,0 +1,67 @@ +# which-builtin-type [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +What is the type of this builtin JavaScript value? Works cross-realm, without `instanceof`, and can not be fooled by a `constructor` property. + +## Example + +```js +var whichBuiltinType = require('which-builtin-type'); +var assert = require('assert'); + +assert.equal(undefined, whichBuiltinType(undefined)); +assert.equal(null, whichBuiltinType(null)); +assert.equal('Boolean', whichBuiltinType(false)); +assert.equal('Boolean', whichBuiltinType(true)); +assert.equal('Array', whichBuiltinType([])); +assert.equal('Object', whichBuiltinType({})); +assert.equal('RegExp', whichBuiltinType(/a/g)); +assert.equal('RegExp', whichBuiltinType(new RegExp('a', 'g'))); +assert.equal('Date', whichBuiltinType(new Date())); +assert.equal('Number', whichBuiltinType(42)); +assert.equal('Number', whichBuiltinType(NaN)); +assert.equal('Number', whichBuiltinType(Infinity)); +assert.equal('Number', whichBuiltinType(new Number(42))); +assert.equal('String', whichBuiltinType('foo')); +assert.equal('String', whichBuiltinType(Object('foo'))); +assert.equal('Function', whichBuiltinType(function () {})); +assert.equal('GeneratorFunction', whichBuiltinType(function* () {})); +assert.equal('Function', whichBuiltinType(x => x * x)); +assert.equal('Array', whichBuiltinType([])); +assert.equal('Int8Array', whichBuiltinType(new Int8Array())); +assert.equal('Uint8Array', whichBuiltinType(new Uint8Array())); +assert.equal('Uint8ClampedArray', whichBuiltinType(new Uint8ClampedArray())); +assert.equal('Int16Array', whichBuiltinType(new Int16Array())); +assert.equal('Uint16Array', whichBuiltinType(new Uint16Array())); +assert.equal('Int32Array', whichBuiltinType(new Int32Array())); +assert.equal('Uint32Array', whichBuiltinType(new Uint32Array())); +assert.equal('Float32Array', whichBuiltinType(new Float32Array())); +assert.equal('Float64Array', whichBuiltinType(new Float64Array())); +assert.equal('BigInt64Array', whichBuiltinType(new BigInt64Array())); +assert.equal('BigUint64Array', whichBuiltinType(new BigUint64Array())); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/which-builtin-type +[npm-version-svg]: https://versionbadg.es/inspect-js/which-builtin-type.svg +[deps-svg]: https://david-dm.org/inspect-js/which-builtin-type.svg +[deps-url]: https://david-dm.org/inspect-js/which-builtin-type +[dev-deps-svg]: https://david-dm.org/inspect-js/which-builtin-type/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/which-builtin-type#info=devDependencies +[npm-badge-png]: https://which-builtin-type/which-builtin-type.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/which-builtin-type.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/which-builtin-type.svg +[downloads-url]: https://npm-stat.com/charts.html?package=which-builtin-type +[codecov-image]: https://codecov.io/gh/inspect-js/which-builtin-type/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/which-builtin-type/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/which-builtin-type +[actions-url]: https://github.com/inspect-js/which-builtin-type/actions diff --git a/node_modules/which-builtin-type/index.d.ts b/node_modules/which-builtin-type/index.d.ts new file mode 100644 index 000000000..6f194b34e --- /dev/null +++ b/node_modules/which-builtin-type/index.d.ts @@ -0,0 +1,21 @@ +import whichBoxedPrimitive from 'which-boxed-primitive'; +import whichCollection from 'which-collection'; +import whichTypedArray from 'which-typed-array'; + +type AsyncFunction = (...args: unknown[]) => Promise; + +declare function whichBuiltinType(value: Parameters[0]): ReturnType; +declare function whichBuiltinType(value: Parameters[0]): ReturnType; +declare function whichBuiltinType(value: ReadonlyArray): 'Array'; +declare function whichBuiltinType(value: Date): 'Date'; +declare function whichBuiltinType(value: RegExp): 'RegExp'; +declare function whichBuiltinType(value: T extends object ? WeakRef : never): 'WeakRef'; +declare function whichBuiltinType(value: FinalizationRegistry): 'FinalizationRegistry'; +declare function whichBuiltinType(value: GeneratorFunction): 'GeneratorFunction'; +declare function whichBuiltinType(value: AsyncFunction): 'AsyncFunction'; +declare function whichBuiltinType(value: Function): 'Function'; +declare function whichBuiltinType(value: Promise): 'Promise'; + +declare function whichBuiltinType(value: T): 'Object' | Exclude, null | undefined> | string; + +export = whichBuiltinType; diff --git a/node_modules/which-builtin-type/index.js b/node_modules/which-builtin-type/index.js new file mode 100644 index 000000000..dd9da17d2 --- /dev/null +++ b/node_modules/which-builtin-type/index.js @@ -0,0 +1,132 @@ +'use strict'; + +var whichBoxedPrimitive = require('which-boxed-primitive'); +var whichCollection = require('which-collection'); +var whichTypedArray = require('which-typed-array'); +var isArray = require('isarray'); +var isDate = require('is-date-object'); +var isRegex = require('is-regex'); +var isWeakRef = require('is-weakref'); +var isFinalizationRegistry = require('is-finalizationregistry'); +var name = require('function.prototype.name'); +var isGeneratorFunction = require('is-generator-function'); +var isAsyncFunction = require('is-async-function'); +var callBound = require('call-bound'); +var hasToStringTag = require('has-tostringtag/shams')(); +var toStringTag = hasToStringTag && Symbol.toStringTag; + +var $Object = Object; + +/** @type {undefined | ((value: ThisParameterType, ...args: Parameters) => ReturnType)} */ +var promiseThen = callBound('Promise.prototype.then', true); +/** @type {(value: unknown) => value is Promise} */ +var isPromise = function isPromise(value) { + if (!value || typeof value !== 'object' || !promiseThen) { + return false; + } + try { + promiseThen(value, null, function () {}); + return true; + } catch (e) {} + return false; +}; + +/** @type {(builtinName: unknown) => boolean} */ +var isKnownBuiltin = function isKnownBuiltin(builtinName) { + return !!builtinName + // primitives + && builtinName !== 'BigInt' + && builtinName !== 'Boolean' + && builtinName !== 'Null' + && builtinName !== 'Number' + && builtinName !== 'String' + && builtinName !== 'Symbol' + && builtinName !== 'Undefined' + // namespaces + && builtinName !== 'Math' + && builtinName !== 'JSON' + && builtinName !== 'Reflect' + && builtinName !== 'Atomics' + // collections + && builtinName !== 'Map' + && builtinName !== 'Set' + && builtinName !== 'WeakMap' + && builtinName !== 'WeakSet' + // typed arrays + && builtinName !== 'BigInt64Array' + && builtinName !== 'BigUint64Array' + && builtinName !== 'Float32Array' + && builtinName !== 'Float64Array' + && builtinName !== 'Int16Array' + && builtinName !== 'Int32Array' + && builtinName !== 'Int8Array' + && builtinName !== 'Uint16Array' + && builtinName !== 'Uint32Array' + && builtinName !== 'Uint8Array' + && builtinName !== 'Uint8ClampedArray' + // checked explicitly + && builtinName !== 'Array' + && builtinName !== 'Date' + && builtinName !== 'FinalizationRegistry' + && builtinName !== 'Promise' + && builtinName !== 'RegExp' + && builtinName !== 'WeakRef' + // functions + && builtinName !== 'Function' + && builtinName !== 'GeneratorFunction' + && builtinName !== 'AsyncFunction'; +}; + +/** @type {import('.')} */ +module.exports = function whichBuiltinType(value) { + if (value == null) { + return value; + } + // covers: primitives, {,Weak}Map/Set, typed arrays + var which = whichBoxedPrimitive($Object(value)) || whichCollection(value) || whichTypedArray(value); + if (which) { + return which; + } + if (isArray(value)) { + return 'Array'; + } + if (isDate(value)) { + return 'Date'; + } + if (isRegex(value)) { + return 'RegExp'; + } + if (isWeakRef(value)) { + return 'WeakRef'; + } + if (isFinalizationRegistry(value)) { + return 'FinalizationRegistry'; + } + if (typeof value === 'function') { + if (isGeneratorFunction(value)) { + return 'GeneratorFunction'; + } + if (isAsyncFunction(value)) { + return 'AsyncFunction'; + } + return 'Function'; + } + if (isPromise(value)) { + return 'Promise'; + } + // @ts-expect-error TS can't figure out that `value` is an `object` after the `which` check above + if (toStringTag && toStringTag in value) { + var tag = value[toStringTag]; + if (isKnownBuiltin(tag)) { + return tag; + } + } + if (typeof value.constructor === 'function') { + // eslint-disable-next-line no-extra-parens + var constructorName = name(/** @type {Parameters[0]} */ (value.constructor)); + if (isKnownBuiltin(constructorName)) { + return constructorName; + } + } + return 'Object'; +}; diff --git a/node_modules/which-builtin-type/node_modules/isarray/LICENSE b/node_modules/which-builtin-type/node_modules/isarray/LICENSE new file mode 100644 index 000000000..de3226673 --- /dev/null +++ b/node_modules/which-builtin-type/node_modules/isarray/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/which-builtin-type/node_modules/isarray/README.md b/node_modules/which-builtin-type/node_modules/isarray/README.md new file mode 100644 index 000000000..3e160b2b7 --- /dev/null +++ b/node_modules/which-builtin-type/node_modules/isarray/README.md @@ -0,0 +1,38 @@ + +# isarray + +`Array#isArray` for older browsers and deprecated Node.js versions. + +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + +__Just use Array.isArray directly__, unless you need to support those older versions. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](https://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/node-browserify). + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! diff --git a/node_modules/which-builtin-type/node_modules/isarray/index.js b/node_modules/which-builtin-type/node_modules/isarray/index.js new file mode 100644 index 000000000..a57f63495 --- /dev/null +++ b/node_modules/which-builtin-type/node_modules/isarray/index.js @@ -0,0 +1,5 @@ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/which-builtin-type/node_modules/isarray/package.json b/node_modules/which-builtin-type/node_modules/isarray/package.json new file mode 100644 index 000000000..fb0e89be3 --- /dev/null +++ b/node_modules/which-builtin-type/node_modules/isarray/package.json @@ -0,0 +1,48 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "2.0.5", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "files": [ + "index.js" + ], + "dependencies": {}, + "devDependencies": { + "tape": "~2.13.4" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test.js", + "browsers": [ + "ie/8..latest", + "firefox/17..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" + ] + }, + "scripts": { + "test": "tape test.js" + } +} diff --git a/node_modules/which-builtin-type/package.json b/node_modules/which-builtin-type/package.json new file mode 100644 index 000000000..b74ef4739 --- /dev/null +++ b/node_modules/which-builtin-type/package.json @@ -0,0 +1,111 @@ +{ + "name": "which-builtin-type", + "version": "1.2.1", + "description": "What is the type of this builtin JS value?", + "main": "index.js", + "types": "index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -P . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/which-builtin-type.git" + }, + "keywords": [ + "type", + "builtin", + "ecmascript" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/which-builtin-type/issues" + }, + "homepage": "https://github.com/inspect-js/which-builtin-type#readme", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.1", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.2", + "@types/for-each": "^0.3.3", + "@types/function.prototype.name": "^1.1.4", + "@types/is-async-function": "^2.0.3", + "@types/is-date-object": "^1.0.4", + "@types/is-generator-function": "^1.0.3", + "@types/is-weakref": "^1.0.0", + "@types/make-arrow-function": "^1.2.2", + "@types/make-async-function": "^1.0.2", + "@types/object-inspect": "^1.13.0", + "@types/object.assign": "^4.1.0", + "@types/tape": "^5.6.5", + "@types/which-boxed-primitive": "^1.0.3", + "auto-changelog": "^2.5.0", + "available-typed-arrays": "^1.0.7", + "encoding": "^0.1.13", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "in-publish": "^2.0.1", + "make-arrow-function": "^1.2.0", + "make-async-function": "^1.0.0", + "make-generator-function": "^2.0.0", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.3", + "object.assign": "^4.1.5", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/which-builtin-type/test/index.js b/node_modules/which-builtin-type/test/index.js new file mode 100644 index 000000000..bdb7c30f0 --- /dev/null +++ b/node_modules/which-builtin-type/test/index.js @@ -0,0 +1,184 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var assign = require('object.assign'); +var forEach = require('for-each'); +var arrows = require('make-arrow-function').list(); +var generators = require('make-generator-function')(); +var asyncs = require('make-async-function').list(); +var hasSymbols = require('has-symbols')(); +var hasToStringTag = require('has-tostringtag/shams')(); +var hasBigInts = require('has-bigints')(); +var availableTypedArrays = require('available-typed-arrays'); + +var which = require('../'); + +if (typeof process !== 'undefined') { + process.on('unhandledRejection', function () {}); +} + +test('nullish', function (t) { + t.equal(which(null), null, 'null is null'); + t.equal(which(undefined), undefined, 'undefined is undefined'); + // @ts-expect-error + t.equal(which(), undefined, 'absent is undefined'); + + t.end(); +}); + +test('non-nullish', function (t) { + /** @constructor */ + var F = function Foo() {}; + + var tests = { + Number: [ + 0, + -0, + 42, + Infinity, + -Infinity, + NaN, + 0.5 + ], + Boolean: [ + true, + false + ], + String: [ + '', + 'foo' + ], + Date: [ + new Date(), + new Date(NaN), + assign(new Date(), { constructor: Object }) + ], + RegExp: [ + /(?:)/, + /a/g, + assign(/constructor/, { constructor: Object }) + ], + Array: [ + [], + [42], + assign([], { constructor: Object }) + ], + Function: [ + function () {}, + function f() {}, + assign(function constructor() {}, { constructor: Object }) + ].concat(arrows), + GeneratorFunction: generators, + AsyncFunction: asyncs, + // eslint-disable-next-line no-extra-parens + Object: /** @type {object[]} */ ([ + {}, + { constructor: null }, + Math + ]), + Symbol: hasSymbols ? [ + Symbol.iterator, + Symbol(), + Symbol('foo'), + Symbol['for'] ? Symbol['for']('bar') : Symbol('no "for" support') // eslint-disable-line no-restricted-properties + ] : [], + BigInt: hasBigInts ? [ + BigInt(0), + BigInt(42) + ] : [], + Foo: [ + new F() + ], + Map: typeof Map === 'function' ? [ + new Map(), + new Map([[1, 2], [3, 4]]), + assign(new Map(), { constructor: Object }) + ] : [], + WeakMap: typeof WeakMap === 'function' ? [ + new WeakMap(), + assign(new WeakMap(), { constructor: Object }) + ] : [], + Set: typeof Set === 'function' ? [ + new Set(), + new Set([1, 2, 3, 4]), + assign(new Set(), { constructor: Object }) + ] : [], + WeakSet: typeof WeakSet === 'function' ? [ + new WeakSet(), + assign(new WeakSet(), { constructor: Object }) + ] : [], + WeakRef: typeof WeakRef === 'function' ? [ + new WeakRef({}), + assign(new WeakRef({}), { constructor: Object }) + ] : [], + FinalizationRegistry: typeof FinalizationRegistry === 'function' ? [ + new FinalizationRegistry(function () {}), + assign(new FinalizationRegistry(function () {}), { constructor: Object }) + ] : [], + Promise: typeof Promise === 'function' ? [ + Promise.resolve(42), + Promise.reject(NaN), + new Promise(function () {}) + ] : [] + }; + forEach(availableTypedArrays(), function (TypedArray) { + // @ts-expect-error not sure how to infer this as being spreaded into the above object literal + tests[TypedArray] = [ + new global[TypedArray](0), + new global[TypedArray](2) + ]; + }); + forEach(tests, function (values, expected) { + forEach(values, function (value) { + t.equal(which(value), expected, inspect(value) + ' is ' + inspect(expected)); + var obj = Object(value); + if (value !== obj) { + t.equal(which(obj), expected, inspect(obj) + ' is ' + inspect(expected)); + } + if ( + expected !== 'Object' // the fallback can't fall back + && expected !== 'Foo' // not a builtin + ) { + if (hasToStringTag) { + /** @type {{ [k in typeof Symbol.toStringTag]?: string }} */ + var fakerTag = {}; + fakerTag[Symbol.toStringTag] = expected; + t.equal( + which(fakerTag), + 'Object', + inspect(fakerTag) + ' lies and claims it is a ' + expected + ', but instead it is Object' + ); + } + + /** @typedef {Exclude} GlobalKey */ + + var fakerConstructor = { + // eslint-disable-next-line no-extra-parens + constructor: global[/** @type {GlobalKey} */ (expected)] || tests[expected] + }; + t.equal( + which(fakerConstructor), + 'Object', + inspect(fakerConstructor) + ' lies and claims it is a ' + expected + ', but instead it is Object' + ); + + if (hasToStringTag) { + /** @type {{ constructor: Function } & { [k in typeof Symbol.toStringTag]?: string }} */ + var fakerConstructorTag = { + // eslint-disable-next-line no-extra-parens + constructor: global[/** @type {GlobalKey} */ (expected)] || tests[expected] + }; + fakerConstructorTag[Symbol.toStringTag] = expected; + t.equal( + which(fakerConstructorTag), + 'Object', + inspect(fakerConstructorTag) + ' lies with a tag and claims it is a ' + expected + ', but instead it is Object' + ); + } + } + }); + }); + + t.end(); +}); diff --git a/node_modules/which-builtin-type/tsconfig.json b/node_modules/which-builtin-type/tsconfig.json new file mode 100644 index 000000000..6716d81ce --- /dev/null +++ b/node_modules/which-builtin-type/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ES2021", + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/which-collection/.eslintrc b/node_modules/which-collection/.eslintrc new file mode 100644 index 000000000..3b5d9e90e --- /dev/null +++ b/node_modules/which-collection/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/which-collection/.github/FUNDING.yml b/node_modules/which-collection/.github/FUNDING.yml new file mode 100644 index 000000000..7570eaa7f --- /dev/null +++ b/node_modules/which-collection/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/which-collection +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/which-collection/.nycrc b/node_modules/which-collection/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/which-collection/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/which-collection/CHANGELOG.md b/node_modules/which-collection/CHANGELOG.md new file mode 100644 index 000000000..229184ff1 --- /dev/null +++ b/node_modules/which-collection/CHANGELOG.md @@ -0,0 +1,63 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/inspect-js/which-collection/compare/v1.0.1...v1.0.2) - 2024-03-08 + +### Commits + +- [actions] reuse common workflows [`a5b2949`](https://github.com/inspect-js/which-collection/commit/a5b294901933131cf753c260c0dccf15c1aeeadc) +- [Tests] migrate tests to Github Actions [`283ec03`](https://github.com/inspect-js/which-collection/commit/283ec03d70ad8fdc94b3d77c1b11de011617a04d) +- add types [`bf576db`](https://github.com/inspect-js/which-collection/commit/bf576db80dbc9bca1332622f0b6c4772706dca45) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`24968a2`](https://github.com/inspect-js/which-collection/commit/24968a2aa55109520e2ec0532343224e11a6e311) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`f60b277`](https://github.com/inspect-js/which-collection/commit/f60b27727206261a0359adb5588cba645eb56cf8) +- [Tests] run `nyc` on all tests [`5700269`](https://github.com/inspect-js/which-collection/commit/57002694f9b5f40078bd2777ecc934ece544a556) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`eb1f1a4`](https://github.com/inspect-js/which-collection/commit/eb1f1a468f53bcbed6ddf7459f0811a0f5ea37a7) +- [actions] remove redundant finisher [`cd5b8fc`](https://github.com/inspect-js/which-collection/commit/cd5b8fcddb9d8ea9ea5132b88c50357e2409a277) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`f5786fa`](https://github.com/inspect-js/which-collection/commit/f5786fa3189c884debfa4f160a1733a738acccec) +- [actions] update rebase action to use reusable workflow [`7ac7b67`](https://github.com/inspect-js/which-collection/commit/7ac7b6777797230ca105f9c1560e7b5fc3ba901f) +- [actions] update codecov uploader [`b074105`](https://github.com/inspect-js/which-collection/commit/b074105e5001df42a8889cd8cadaabd2a2fc276c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`ec640d6`](https://github.com/inspect-js/which-collection/commit/ec640d667a48428aec41e19769ae9490da8301e1) +- [actions] add "Allow Edits" workflow [`65d842e`](https://github.com/inspect-js/which-collection/commit/65d842ee9c09ed60370cf14a721b94f9a5de43cd) +- [readme] remove travis badge [`f106289`](https://github.com/inspect-js/which-collection/commit/f10628946ad70286f503497850f6dd2350311577) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `object-inspect`, `tape` [`e784a1f`](https://github.com/inspect-js/which-collection/commit/e784a1fe96f8bc3eb21350ec7a35c3cf24c66a35) +- [meta] use `npmignore` to autogenerate an npmignore file [`95b503f`](https://github.com/inspect-js/which-collection/commit/95b503fd95f30deca71415da97937a3620e24912) +- [readme] add actions and codecov badges [`121ba2d`](https://github.com/inspect-js/which-collection/commit/121ba2d320ecefd51e4af06cacae2f71dd51b59d) +- [Deps] update `is-map`, `is-set`, `is-weakmap`, `is-weakset` [`4aa150f`](https://github.com/inspect-js/which-collection/commit/4aa150fdad7b8c0728972d6b074cb43464681e97) +- [meta] simplify "exports" [`2afaed7`](https://github.com/inspect-js/which-collection/commit/2afaed7f8918aa87a380c333944db274670838ae) +- [Deps] update `is-map`, `is-set` [`ce44763`](https://github.com/inspect-js/which-collection/commit/ce447638a94303f0571b4c3d12389c20a61d7817) +- [actions] switch Automatic Rease workflow to `pull_request_target` event [`b16b664`](https://github.com/inspect-js/which-collection/commit/b16b6641301c3c9ef7df8000be13a69b8087474f) +- [Dev Deps] update `auto-changelog`, `tape` [`2b9c953`](https://github.com/inspect-js/which-collection/commit/2b9c953b469d7fd0e86d96b89f20ef0c424e4ba1) +- [meta] add missing `engines.node` [`dcdbfde`](https://github.com/inspect-js/which-collection/commit/dcdbfdecc9f77daf99735d1f5377d9f3894fead3) +- [Dev Deps] update `auto-changelog`; add `aud` [`8e7f28d`](https://github.com/inspect-js/which-collection/commit/8e7f28d82f6240b2eaf763c32a3ede53be6cdfe1) +- [meta] add `sideEffects` flag [`3e0376b`](https://github.com/inspect-js/which-collection/commit/3e0376b80d7a18b78fdc898a9a166e9ffc83eee3) +- [Deps] update `is-weakset` [`7b3e922`](https://github.com/inspect-js/which-collection/commit/7b3e922ca0f9f356c1cbf4701857d71b378eb7d7) +- [Tests] only audit prod deps [`3339fea`](https://github.com/inspect-js/which-collection/commit/3339fea827a7fdcf8db868bb52278a3186593d48) + +## [v1.0.1](https://github.com/inspect-js/which-collection/compare/v1.0.0...v1.0.1) - 2020-01-26 + +### Commits + +- [actions] add automatic rebasing / merge commit blocking [`c3820b2`](https://github.com/inspect-js/which-collection/commit/c3820b2e8c88548f2c7da4080b1d1b6b41be97a4) +- [patch] add "exports" [`10983b5`](https://github.com/inspect-js/which-collection/commit/10983b5fdcc453c64216c3d6aa3fb93340091818) +- [Deps] update `is-map`, `is-set`, `is-weakmap`, `is-weakset` [`1565925`](https://github.com/inspect-js/which-collection/commit/1565925705c4abfe88065b211d1d960791f7cd3c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`92ef871`](https://github.com/inspect-js/which-collection/commit/92ef871338395352f1bafc3156088361a3fd917a) +- [Dev Deps] update `@ljharb/eslint-config` [`61e9cde`](https://github.com/inspect-js/which-collection/commit/61e9cde1830ccc2b551dd6a1a873ae2cf27a74c7) + +## v1.0.0 - 2019-11-13 + +### Commits + +- Initial commit [`a21fddf`](https://github.com/inspect-js/which-collection/commit/a21fddffef3b2f21923e4d056295dd63661d8155) +- Tests [`ec86bc1`](https://github.com/inspect-js/which-collection/commit/ec86bc12f0516bd662c6e2966b36de2e1128a431) +- readme [`ffe969c`](https://github.com/inspect-js/which-collection/commit/ffe969cf4388d18e12c664cc51498bbdef08e565) +- implementation [`9acb669`](https://github.com/inspect-js/which-collection/commit/9acb6695e6a5e60f4c0b6de59eaf8b1f681d78e5) +- npm init [`124a63e`](https://github.com/inspect-js/which-collection/commit/124a63ee68a0015b47cbcc08b0d5598e553e7c9a) +- [meta] add `auto-changelog`, `safe-publish-latest` [`df0d6d4`](https://github.com/inspect-js/which-collection/commit/df0d6d4f1efbc4d9b327471b9c659bd487b25b49) +- [meta] add `funding` field; create FUNDING.yml [`032c81c`](https://github.com/inspect-js/which-collection/commit/032c81c826d68acd6242fa87fd6348db70135506) +- [Tests] add `npm run lint` [`6ae406d`](https://github.com/inspect-js/which-collection/commit/6ae406d9e459779abbdd90f48559552f740b05c9) +- fixup [`a2cad36`](https://github.com/inspect-js/which-collection/commit/a2cad363f12e30afe7619597187c5d4dc840a2a7) +- Only apps should have lockfiles [`30b3aae`](https://github.com/inspect-js/which-collection/commit/30b3aae37155f0786e4582501369f738b3282cd7) diff --git a/node_modules/which-collection/LICENSE b/node_modules/which-collection/LICENSE new file mode 100644 index 000000000..c05eb206b --- /dev/null +++ b/node_modules/which-collection/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/which-collection/README.md b/node_modules/which-collection/README.md new file mode 100644 index 000000000..640b880db --- /dev/null +++ b/node_modules/which-collection/README.md @@ -0,0 +1,65 @@ +# which-collection [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag. + +## Example + +```js +var whichCollection = require('which-collection'); +var assert = require('assert'); + +assert.equal(false, whichCollection(undefined)); +assert.equal(false, whichCollection(null)); +assert.equal(false, whichCollection(false)); +assert.equal(false, whichCollection(true)); +assert.equal(false, whichCollection([])); +assert.equal(false, whichCollection({})); +assert.equal(false, whichCollection(/a/g)); +assert.equal(false, whichCollection(new RegExp('a', 'g'))); +assert.equal(false, whichCollection(new Date())); +assert.equal(false, whichCollection(42)); +assert.equal(false, whichCollection(NaN)); +assert.equal(false, whichCollection(Infinity)); +assert.equal(false, whichCollection(new Number(42))); +assert.equal(false, whichCollection(42n)); +assert.equal(false, whichCollection(Object(42n))); +assert.equal(false, whichCollection('foo')); +assert.equal(false, whichCollection(Object('foo'))); +assert.equal(false, whichCollection(function () {})); +assert.equal(false, whichCollection(function* () {})); +assert.equal(false, whichCollection(x => x * x)); +assert.equal(false, whichCollection([])); + +assert.equal('Map', whichCollection(new Map())); +assert.equal('Set', whichCollection(new Set())); +assert.equal('WeakMap', whichCollection(new WeakMap())); +assert.equal('WeakSet', whichCollection(new WeakSet())); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/which-collection +[2]: https://versionbadg.es/inspect-js/which-collection.svg +[5]: https://david-dm.org/inspect-js/which-collection.svg +[6]: https://david-dm.org/inspect-js/which-collection +[7]: https://david-dm.org/inspect-js/which-collection/dev-status.svg +[8]: https://david-dm.org/inspect-js/which-collection#info=devDependencies +[11]: https://nodei.co/npm/which-collection.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/which-collection.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/which-collection.svg +[downloads-url]: https://npm-stat.com/charts.html?package=which-collection +[codecov-image]: https://codecov.io/gh/inspect-js/which-collection/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/which-collection/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/which-collection +[actions-url]: https://github.com/inspect-js/which-collection/actions diff --git a/node_modules/which-collection/index.d.ts b/node_modules/which-collection/index.d.ts new file mode 100644 index 000000000..27005a892 --- /dev/null +++ b/node_modules/which-collection/index.d.ts @@ -0,0 +1,13 @@ +/** + * Determines the type of the given collection, or returns false. + * + * @param {unknown} value The potential collection + * @returns {'Map' | 'Set' | 'WeakMap' | 'WeakSet' | false} 'Map' | 'Set' | 'WeakMap' | 'WeakSet' | false + */ +declare function whichCollection(value: Map): 'Map'; +declare function whichCollection(value: Set): 'Set'; +declare function whichCollection(value: WeakMap): 'WeakMap'; +declare function whichCollection(value: WeakSet): 'WeakSet'; +declare function whichCollection(value: null | undefined | boolean | number | bigint | symbol | unknown): false; + +export = whichCollection; diff --git a/node_modules/which-collection/index.js b/node_modules/which-collection/index.js new file mode 100644 index 000000000..cc8d097bf --- /dev/null +++ b/node_modules/which-collection/index.js @@ -0,0 +1,25 @@ +'use strict'; + +var isMap = require('is-map'); +var isSet = require('is-set'); +var isWeakMap = require('is-weakmap'); +var isWeakSet = require('is-weakset'); + +/** @type {import('.')} */ +module.exports = function whichCollection(/** @type {unknown} */ value) { + if (value && typeof value === 'object') { + if (isMap(value)) { + return 'Map'; + } + if (isSet(value)) { + return 'Set'; + } + if (isWeakMap(value)) { + return 'WeakMap'; + } + if (isWeakSet(value)) { + return 'WeakSet'; + } + } + return false; +}; diff --git a/node_modules/which-collection/package.json b/node_modules/which-collection/package.json new file mode 100644 index 000000000..fc3cacc67 --- /dev/null +++ b/node_modules/which-collection/package.json @@ -0,0 +1,85 @@ +{ + "name": "which-collection", + "version": "1.0.2", + "description": "Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "postlint": "tsc -p . && attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/which-collection.git" + }, + "keywords": [ + "map", + "set", + "weakmap", + "weakset", + "collection.es6", + "es2015" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/which-collection/issues" + }, + "homepage": "https://github.com/inspect-js/which-collection#readme", + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.0", + "@ljharb/eslint-config": "^21.1.0", + "@types/for-each": "^0.3.3", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/which-collection/test/index.js b/node_modules/which-collection/test/index.js new file mode 100644 index 000000000..3a5beccdd --- /dev/null +++ b/node_modules/which-collection/test/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var test = require('tape'); +var debug = require('object-inspect'); +var forEach = require('for-each'); + +var whichCollection = require('..'); + +test('non-collections', function (t) { + forEach([ + null, + undefined, + true, + false, + 42, + 0, + -0, + NaN, + Infinity, + '', + 'foo', + /a/g, + [], + {}, + function () {} + ], function (nonCollection) { + t.equal(whichCollection(nonCollection), false, debug(nonCollection) + ' is not a collection'); + }); + + t.end(); +}); + +test('Maps', { skip: typeof Map !== 'function' }, function (t) { + var m = new Map(); + t.equal(whichCollection(m), 'Map', debug(m) + ' is a Map'); + + t.end(); +}); + +test('Sets', { skip: typeof Set !== 'function' }, function (t) { + var s = new Set(); + t.equal(whichCollection(s), 'Set', debug(s) + ' is a Set'); + + t.end(); +}); + +test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) { + var wm = new WeakMap(); + t.equal(whichCollection(wm), 'WeakMap', debug(wm) + ' is a WeakMap'); + + t.end(); +}); + +test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) { + var ws = new WeakSet(); + t.equal(whichCollection(ws), 'WeakSet', debug(ws) + ' is a WeakSet'); + + t.end(); +}); diff --git a/node_modules/which-collection/tsconfig.json b/node_modules/which-collection/tsconfig.json new file mode 100644 index 000000000..2002ce5a5 --- /dev/null +++ b/node_modules/which-collection/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 0, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + //"skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/which-typed-array/.editorconfig b/node_modules/which-typed-array/.editorconfig new file mode 100644 index 000000000..bc228f826 --- /dev/null +++ b/node_modules/which-typed-array/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/which-typed-array/.eslintrc b/node_modules/which-typed-array/.eslintrc new file mode 100644 index 000000000..35d40f11c --- /dev/null +++ b/node_modules/which-typed-array/.eslintrc @@ -0,0 +1,10 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements-per-line": [2, { "max": 2 }], + "no-extra-parens": 0, + }, +} diff --git a/node_modules/which-typed-array/.github/FUNDING.yml b/node_modules/which-typed-array/.github/FUNDING.yml new file mode 100644 index 000000000..d6aa18036 --- /dev/null +++ b/node_modules/which-typed-array/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/which-typed-array +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/which-typed-array/.nycrc b/node_modules/which-typed-array/.nycrc new file mode 100644 index 000000000..1826526e0 --- /dev/null +++ b/node_modules/which-typed-array/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/which-typed-array/CHANGELOG.md b/node_modules/which-typed-array/CHANGELOG.md new file mode 100644 index 000000000..ff17cecb3 --- /dev/null +++ b/node_modules/which-typed-array/CHANGELOG.md @@ -0,0 +1,269 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.20](https://github.com/inspect-js/which-typed-array/compare/v1.1.19...v1.1.20) - 2026-01-14 + +### Commits + +- [types] add Float16Array to TypedArray [`b04301f`](https://github.com/inspect-js/which-typed-array/commit/b04301f737aaa500ac2ee9a0578d6e3a52a65b94) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `eslint`, `make-generator-function`, `npmignore` [`215b3a1`](https://github.com/inspect-js/which-typed-array/commit/215b3a1a39300a3a305d9f9b6885d00d44387ef6) +- [readme] replace runkit CI badge with shields.io check-runs badge [`32def83`](https://github.com/inspect-js/which-typed-array/commit/32def83f46fdfe0d324ed32de2146554855ed140) + +## [v1.1.19](https://github.com/inspect-js/which-typed-array/compare/v1.1.18...v1.1.19) - 2025-03-08 + +### Commits + +- [Refactor] use `get-proto`, improve types [`e05d535`](https://github.com/inspect-js/which-typed-array/commit/e05d535fe4e4c4e674937718fe1cae90abff3606) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`0dade9c`](https://github.com/inspect-js/which-typed-array/commit/0dade9c4c334f37ed14083a35724eea56a496991) +- [Deps] update `call-bound`, `for-each` [`490791a`](https://github.com/inspect-js/which-typed-array/commit/490791af49605390f9805660492976f86c64feb1) +- [Tests] skip `npm ls` in older nodes [`f83aaca`](https://github.com/inspect-js/which-typed-array/commit/f83aaca6b6634ce795f8caf9a1e14ab15d35161c) +- [Dev Deps] update `@ljharb/tsconfig` [`63c4795`](https://github.com/inspect-js/which-typed-array/commit/63c479564e5f3cb022c784ffe505673597341aab) + +## [v1.1.18](https://github.com/inspect-js/which-typed-array/compare/v1.1.17...v1.1.18) - 2024-12-18 + +### Commits + +- [types] improve types [`4b57173`](https://github.com/inspect-js/which-typed-array/commit/4b5717349976578c6b48966d581687df5dcc2e9b) +- [Dev Deps] update `@types/tape` [`81853b0`](https://github.com/inspect-js/which-typed-array/commit/81853b075c018538859a5533578be654fafecdae) + +## [v1.1.17](https://github.com/inspect-js/which-typed-array/compare/v1.1.16...v1.1.17) - 2024-12-18 + +### Commits + +- [types] improve types [`86bc612`](https://github.com/inspect-js/which-typed-array/commit/86bc61207e5970c2c7e13cdda4ccdeb0981ac40b) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`2e9bed6`](https://github.com/inspect-js/which-typed-array/commit/2e9bed67f1d623b176b1a7f06c5eab006c21cf96) +- [Deps] update `call-bind`, `gopd` [`34579df`](https://github.com/inspect-js/which-typed-array/commit/34579df639e35ceb3a7e54f8e680a4077a950b8b) +- [Refactor] use `call-bound` directly [`2a2d84e`](https://github.com/inspect-js/which-typed-array/commit/2a2d84e91045266841ddb47afe594899bae2f483) + +## [v1.1.16](https://github.com/inspect-js/which-typed-array/compare/v1.1.15...v1.1.16) - 2024-11-27 + +### Commits + +- [actions] split out node 10-20, and 20+ [`8e289a9`](https://github.com/inspect-js/which-typed-array/commit/8e289a9665a32f7ea267c3ffed7451b154adbe26) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/node`, `@types/tape`, `auto-changelog`, `tape` [`3d4a678`](https://github.com/inspect-js/which-typed-array/commit/3d4a67872d0dbecb755e63ba4101e9ec030a5e7e) +- [Tests] replace `aud` with `npm audit` [`6fbada9`](https://github.com/inspect-js/which-typed-array/commit/6fbada976743192db47000e47eefc07708713ea0) +- [types] add an additional overload [`db5a791`](https://github.com/inspect-js/which-typed-array/commit/db5a791642cd8b4d78fe4ed4da151c4543ee0840) +- [Dev Deps] remove an unused DT package [`6bfff4c`](https://github.com/inspect-js/which-typed-array/commit/6bfff4c3b0c415cb32cd12be6fab3cbbe9e10e13) +- [Dev Deps] add missing peer dep [`05fd582`](https://github.com/inspect-js/which-typed-array/commit/05fd582a703cd68ee7613af0ef2c45546ea5d2ba) + +## [v1.1.15](https://github.com/inspect-js/which-typed-array/compare/v1.1.14...v1.1.15) - 2024-03-10 + +### Commits + +- [types] use a namespace; improve type [`f42bec3`](https://github.com/inspect-js/which-typed-array/commit/f42bec34d5c47bd9e4ab1b48dcde60c09c666712) +- [types] use shared config [`464a9e3`](https://github.com/inspect-js/which-typed-array/commit/464a9e358c2597253c747970b12032406a19b8d2) +- [actions] remove redundant finisher; use reusable workflow [`d114ee8`](https://github.com/inspect-js/which-typed-array/commit/d114ee83ceb6c7898386f4b5935a3ed9e2ec61e4) +- [Dev Deps] update `@types/node`, `tape`, `typescript`; add `@arethetypeswrong/cli` [`9cc63d8`](https://github.com/inspect-js/which-typed-array/commit/9cc63d8635e80ce6dabcb352d23050111040d747) +- [types] add a helpful hover description [`29ccf8d`](https://github.com/inspect-js/which-typed-array/commit/29ccf8dab0f805cdac6ec56d7b9cc27476708273) +- [Deps] update `available-typed-arrays`, `call-bind`, `has-tostringtag` [`7ecfd8e`](https://github.com/inspect-js/which-typed-array/commit/7ecfd8e29d09f8708f7cab7cc41fea9ae5a20867) + +## [v1.1.14](https://github.com/inspect-js/which-typed-array/compare/v1.1.13...v1.1.14) - 2024-02-01 + +### Commits + +- [patch] add types [`49c4d4c`](https://github.com/inspect-js/which-typed-array/commit/49c4d4c5db9bebb8d6f8c18a01047e44eea15e17) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`e5fab7b`](https://github.com/inspect-js/which-typed-array/commit/e5fab7b3dc9df2bceb88f15c3d0a2c0176cf2567) +- [Deps] update `available-typed-arrays`, `call-bind` [`97e2b44`](https://github.com/inspect-js/which-typed-array/commit/97e2b44bad85c9183f1219e28211b3abd167677c) +- [Deps] update `has-tostringtag` [`1efa8bf`](https://github.com/inspect-js/which-typed-array/commit/1efa8bf910c080c14f011aa7c645ac88bc7a7078) + +## [v1.1.13](https://github.com/inspect-js/which-typed-array/compare/v1.1.12...v1.1.13) - 2023-10-19 + +### Commits + +- [Refactor] avoid call-binding entirely when there is no method to bind [`9ff452b`](https://github.com/inspect-js/which-typed-array/commit/9ff452b88fbd8e4419bd768d86d0ea9a87d7e310) + +## [v1.1.12](https://github.com/inspect-js/which-typed-array/compare/v1.1.11...v1.1.12) - 2023-10-19 + +### Commits + +- [Fix] somehow node 0.12 - 3 can hit here, and they lack slice but have set [`c28e9b8`](https://github.com/inspect-js/which-typed-array/commit/c28e9b84d6d68ad5f52236ba59c26b06cde6300b) +- [Deps] update `call-bind` [`a648554`](https://github.com/inspect-js/which-typed-array/commit/a64855495106235352ebb3550a860d3bfd4a1ce1) +- [Dev Deps] update `tape` [`7a094d6`](https://github.com/inspect-js/which-typed-array/commit/7a094d6f9219b903c9a9e13c559e68f0e9672b59) + +## [v1.1.11](https://github.com/inspect-js/which-typed-array/compare/v1.1.10...v1.1.11) - 2023-07-17 + +### Commits + +- [Fix] `node < v0.6` lacks proper Object toString behavior [`b8fd654`](https://github.com/inspect-js/which-typed-array/commit/b8fd65479c0bd18385378cfae79750ebf7cb6ee7) +- [Dev Deps] update `tape` [`e1734c9`](https://github.com/inspect-js/which-typed-array/commit/e1734c99d79880ab11efa55220498a7a1e887834) + +## [v1.1.10](https://github.com/inspect-js/which-typed-array/compare/v1.1.9...v1.1.10) - 2023-07-10 + +### Commits + +- [actions] update rebase action to use reusable workflow [`2c10582`](https://github.com/inspect-js/which-typed-array/commit/2c105820d77274c079cb6d040cb348396e516ef5) +- [Robustness] use `call-bind` [`b2335fd`](https://github.com/inspect-js/which-typed-array/commit/b2335fdfca80840995eea5e6fcfffc6d712279a1) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`ad5e41b`](https://github.com/inspect-js/which-typed-array/commit/ad5e41ba18e7d23af1f9b211215c43a64bf75d70) + +## [v1.1.9](https://github.com/inspect-js/which-typed-array/compare/v1.1.8...v1.1.9) - 2022-11-02 + +### Commits + +- [Dev Deps] update `aud`, `is-callable`, `tape` [`9a20b3c`](https://github.com/inspect-js/which-typed-array/commit/9a20b3cb8f5d087789a8160395517bffe27b4339) +- [Refactor] use `gopd` instead of `es-abstract` helper [`00157af`](https://github.com/inspect-js/which-typed-array/commit/00157af909842b8b5affa5485d3574ec92d94065) +- [Deps] update `is-typed-array` [`6714240`](https://github.com/inspect-js/which-typed-array/commit/6714240e748cbbb634cb1e405ad762bc52acde66) +- [meta] add `sideEffects` flag [`89b96cc`](https://github.com/inspect-js/which-typed-array/commit/89b96cc3decc78d9621598e94fa1c2bb87eabf2e) + +## [v1.1.8](https://github.com/inspect-js/which-typed-array/compare/v1.1.7...v1.1.8) - 2022-05-14 + +### Commits + +- [actions] reuse common workflows [`95ea6c0`](https://github.com/inspect-js/which-typed-array/commit/95ea6c02dc5ec4ed0ee1b9c4692bb060108c8637) +- [meta] use `npmignore` to autogenerate an npmignore file [`d08436a`](https://github.com/inspect-js/which-typed-array/commit/d08436a19cdd76219732f5040a01cdb92ef2820e) +- [readme] add github actions/codecov badges [`35ae3af`](https://github.com/inspect-js/which-typed-array/commit/35ae3af6a0bb328c9d9b9bbb53e47122f269d81a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`86e6e3a`](https://github.com/inspect-js/which-typed-array/commit/86e6e3af60b2436f0ff34968d9d6240a23f40528) +- [actions] update codecov uploader [`0aa6e30`](https://github.com/inspect-js/which-typed-array/commit/0aa6e3026ab4198c4364737ed4f0315a2ecc432a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`a881a78`](https://github.com/inspect-js/which-typed-array/commit/a881a785f094e823e1cefe2ae9e4ebe31a8e996e) +- [Refactor] use `for-each` instead of `foreach` [`9dafa03`](https://github.com/inspect-js/which-typed-array/commit/9dafa0377fc5c690059a9d454f1dd4d365c5c902) +- [Deps] update `es-abstract`, `is-typed-array` [`0684022`](https://github.com/inspect-js/which-typed-array/commit/068402297608f321a4ec99ebce741b3eb38fcfdd) +- [Deps] update `es-abstract`, `is-typed-array` [`633a529`](https://github.com/inspect-js/which-typed-array/commit/633a529081b5c48d9675abb8aea425e6e33d528e) + +## [v1.1.7](https://github.com/inspect-js/which-typed-array/compare/v1.1.6...v1.1.7) - 2021-08-30 + +### Commits + +- [Refactor] use `globalThis` if available [`2a16d1f`](https://github.com/inspect-js/which-typed-array/commit/2a16d1fd520871ce6b23c60f0bd2113cf33b2533) +- [meta] changelog cleanup [`ba99f56`](https://github.com/inspect-js/which-typed-array/commit/ba99f56b45e6acde7aef4a1f34bb00e44088ccee) +- [Dev Deps] update `@ljharb/eslint-config` [`19a6e04`](https://github.com/inspect-js/which-typed-array/commit/19a6e04ce0094fb3fd6d0d2cbc58d320556ddf50) +- [Deps] update `available-typed-arrays` [`50dbc58`](https://github.com/inspect-js/which-typed-array/commit/50dbc5810a24c468b49409e1f0a79d03501e3dd6) +- [Deps] update `is-typed-array` [`c1b83ea`](https://github.com/inspect-js/which-typed-array/commit/c1b83eae65f042e46b6ae941ac4e814b7965a0f7) + +## [v1.1.6](https://github.com/inspect-js/which-typed-array/compare/v1.1.5...v1.1.6) - 2021-08-06 + +### Fixed + +- [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString [`#51`](https://github.com/inspect-js/which-typed-array/issues/51) [`#49`](https://github.com/inspect-js/which-typed-array/issues/49) + +### Commits + +- [Dev Deps] update `is-callable`, `tape` [`63eb1e3`](https://github.com/inspect-js/which-typed-array/commit/63eb1e3faede3f328bbbb4a5fcffc2e4769cf4ec) +- [Deps] update `is-typed-array` [`c5056f0`](https://github.com/inspect-js/which-typed-array/commit/c5056f0007d4c9434f1fa69eff183109468b4769) + +## [v1.1.5](https://github.com/inspect-js/which-typed-array/compare/v1.1.4...v1.1.5) - 2021-08-05 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`63fa8dd`](https://github.com/inspect-js/which-typed-array/commit/63fa8dd1dc9c0f0dbbaa16d1de0eb89797324c5d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `tape` [`1107c74`](https://github.com/inspect-js/which-typed-array/commit/1107c74c52ed6eb4a719faec88e16c4343976d73) +- [Deps] update `available-typed-arrays`, `call-bind`, `es-abstract`, `is-typed-array` [`f953454`](https://github.com/inspect-js/which-typed-array/commit/f953454b2c6f589f09573ddc961431f970c2e1b6) +- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`8aee720`](https://github.com/inspect-js/which-typed-array/commit/8aee7207abcd72c799ac324b214fbb6ca7ae4a28) +- [meta] use `prepublishOnly` script for npm 7+ [`6c5167b`](https://github.com/inspect-js/which-typed-array/commit/6c5167b4cd06cb62a5487a2e797d8e41cc2970b1) + +## [v1.1.4](https://github.com/inspect-js/which-typed-array/compare/v1.1.3...v1.1.4) - 2020-12-05 + +### Commits + +- [meta] npmignore github action workflows [`aa427e7`](https://github.com/inspect-js/which-typed-array/commit/aa427e79a230a985953695a8129ceb6bb7d42527) + +## [v1.1.3](https://github.com/inspect-js/which-typed-array/compare/v1.1.2...v1.1.3) - 2020-12-05 + +### Commits + +- [Tests] migrate tests to Github Actions [`803d4dd`](https://github.com/inspect-js/which-typed-array/commit/803d4ddb601ff03e587be792bd452de0e2783d03) +- [Tests] run `nyc` on all tests [`205a13f`](https://github.com/inspect-js/which-typed-array/commit/205a13f7aa172e014ddc2079c84af6ba575581c8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `tape` [`97ceb07`](https://github.com/inspect-js/which-typed-array/commit/97ceb070d5aea1c3a696c6f695800ae468bafc0b) +- [actions] add "Allow Edits" workflow [`b140492`](https://github.com/inspect-js/which-typed-array/commit/b14049211eff32bd4149767def4f939483810051) +- [Deps] update `es-abstract`; use `call-bind` where applicable [`2abdb87`](https://github.com/inspect-js/which-typed-array/commit/2abdb871961b4e1b58925115a7d56a9cc5966a02) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`256d34b`](https://github.com/inspect-js/which-typed-array/commit/256d34b8bdb67b8af0e9f83c9a318e54f3340e3b) +- [Dev Deps] update `auto-changelog`; add `aud` [`ddea96f`](https://github.com/inspect-js/which-typed-array/commit/ddea96fe320dbdd0c7d7569812399a7f64d43e04) +- [meta] gitignore nyc output [`8a812bd`](https://github.com/inspect-js/which-typed-array/commit/8a812bd1ce7c5609988fb4fe2e9af2089eccd07d) + +## [v1.1.2](https://github.com/inspect-js/which-typed-array/compare/v1.1.1...v1.1.2) - 2020-04-07 + +### Commits + +- [Dev Deps] update `make-arrow-function`, `make-generator-function` [`28c61ef`](https://github.com/inspect-js/which-typed-array/commit/28c61eff4903ff6509f65c2f500858b9cb4636f1) +- [Dev Deps] update `@ljharb/eslint-config` [`a233879`](https://github.com/inspect-js/which-typed-array/commit/a2338798d3a4a3169cda54e322b2f2eb0e976ad0) +- [Dev Deps] update `auto-changelog` [`df0134c`](https://github.com/inspect-js/which-typed-array/commit/df0134c0e20ec6d94993988ad670e1b3cf350bea) +- [Fix] move `foreach` to dependencies [`6ef29c0`](https://github.com/inspect-js/which-typed-array/commit/6ef29c0dbb91a7ec21df7ce8736f99f41efea39e) +- [Tests] only audit prod deps [`eb21044`](https://github.com/inspect-js/which-typed-array/commit/eb210446bd7a433657204d2314ef56fe264c21ad) +- [Deps] update `es-abstract` [`5ef0236`](https://github.com/inspect-js/which-typed-array/commit/5ef02368d9876a1074123aa7725d6759b4f3e358) +- [Dev Deps] update `tape` [`7456037`](https://github.com/inspect-js/which-typed-array/commit/745603728c6c3da8bdddee321e8a9196f4827aa3) +- [Deps] update `available-typed-arrays` [`8a856c9`](https://github.com/inspect-js/which-typed-array/commit/8a856c9aa707c1e6f7a52e834485356b31395ea6) + +## [v1.1.1](https://github.com/inspect-js/which-typed-array/compare/v1.1.0...v1.1.1) - 2020-01-24 + +### Commits + +- [Tests] use shared travis-ci configs [`0a627d9`](https://github.com/inspect-js/which-typed-array/commit/0a627d9694d0eabdaee63b19e605584166995a79) +- [meta] add `auto-changelog` [`2a14c58`](https://github.com/inspect-js/which-typed-array/commit/2a14c58b79f72e32ef2078efb40d31a4bf8c197a) +- [meta] remove unused Makefile and associated utilities [`75f7f22`](https://github.com/inspect-js/which-typed-array/commit/75f7f222199f42618c290de363c542b11f5a5632) +- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`4162327`](https://github.com/inspect-js/which-typed-array/commit/416232725e7d127cbd886af0f8988dae612a342f) +- [Refactor] use `es-abstract`’s `callBound`, `available-typed-arrays`, `has-symbols` [`9b04a2a`](https://github.com/inspect-js/which-typed-array/commit/9b04a2a14c758600cffcf59485b7b3c85839c266) +- [readme] fix repo URLs, remove testling [`03ed52f`](https://github.com/inspect-js/which-typed-array/commit/03ed52f3ae4fcd35614bcda7e947b14e62009c71) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `replace`, `semver`, `tape` [`bfbcf3e`](https://github.com/inspect-js/which-typed-array/commit/bfbcf3ec9c449bd0089ed805c01a32ba4e7e5938) +- [actions] add automatic rebasing / merge commit blocking [`cc88ac5`](https://github.com/inspect-js/which-typed-array/commit/cc88ac56bcfb71cb26c656ebde4c560a22fadd85) +- [meta] create FUNDING.yml [`acbc723`](https://github.com/inspect-js/which-typed-array/commit/acbc7230929b1256c83df28be4a456eed3e147e9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `tape` [`f1ab63e`](https://github.com/inspect-js/which-typed-array/commit/f1ab63e9366027eae2e29398c035181dac164132) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` [`ac9f50b`](https://github.com/inspect-js/which-typed-array/commit/ac9f50b59558933292dff993df2e68eaa44b07e2) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`aaaa15d`](https://github.com/inspect-js/which-typed-array/commit/aaaa15dfb5bd8228c0cfb8f2aba267efb405b0a1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`602fc9a`](https://github.com/inspect-js/which-typed-array/commit/602fc9a0a7d708236f90c76f592e6a980ecde940) +- [Deps] update `available-typed-arrays`, `is-typed-array` [`b2d69b6`](https://github.com/inspect-js/which-typed-array/commit/b2d69b639bf14344d09f8512dbc060cd4f533161) +- [meta] add `funding` field [`156f613`](https://github.com/inspect-js/which-typed-array/commit/156f613d0ce547c4b15e1ae279198b66e3cef55e) + +## [v1.1.0](https://github.com/inspect-js/which-typed-array/compare/v1.0.1...v1.1.0) - 2019-02-16 + +### Commits + +- [Tests] remove `jscs` [`381c9b4`](https://github.com/inspect-js/which-typed-array/commit/381c9b4bd858da1adedf23d8555af3a3ed901a83) +- [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`, `v5.8`; improve matrix; newer npm breaks on older node [`7015c19`](https://github.com/inspect-js/which-typed-array/commit/7015c196ba86540b04d18d9b1d2c368909492023) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`ad67885`](https://github.com/inspect-js/which-typed-array/commit/ad678853e245986720d7650be1c974a9ff3ac814) +- [Tests] up to `node` `v11.6`, `v10.15`, `v8.15`, `v6.16` [`dd94bfb`](https://github.com/inspect-js/which-typed-array/commit/dd94bfb6309a92d1537352f2d1100f9e913ebc01) +- [Refactor] use an array instead of an object for storing Typed Array names [`de98bc1`](https://github.com/inspect-js/which-typed-array/commit/de98bc1d44af92909a34212e276deb5d79ac428a) +- [meta] ignore `test.html` [`06cfb1b`](https://github.com/inspect-js/which-typed-array/commit/06cfb1bc0ca7881d1bd1621fa946a16366cd6afc) +- [Tests] up to `node` `v7.0`, `v6.9`, `v4.6`; improve test matrix [`df76eaa`](https://github.com/inspect-js/which-typed-array/commit/df76eaa39b94b28147e81a89bb587e8aa3e3dba3) +- [New] add `BigInt64Array` and `BigUint64Array` [`d6bca3a`](https://github.com/inspect-js/which-typed-array/commit/d6bca3a68ccfe33f6659a24b770068e89dab1592) +- [Dev Deps] update `jscs`, `nsp`, `eslint` [`f23b45b`](https://github.com/inspect-js/which-typed-array/commit/f23b45b2796bd1f63ddddf28b4b80b9709478cb3) +- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `semver`, `tape` [`ddb4484`](https://github.com/inspect-js/which-typed-array/commit/ddb4484adc3b45c4396632611556055f3b2f5990) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `is-callable`, `replace`, `semver`, `tape` [`4524e59`](https://github.com/inspect-js/which-typed-array/commit/4524e593e9387c185d5632696c62c1600c0b380f) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`1ec7056`](https://github.com/inspect-js/which-typed-array/commit/1ec70568565c479a6168b03e0a5aec6ec9ac5a21) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`799487d`](https://github.com/inspect-js/which-typed-array/commit/799487d666b32d1ae0d27cfededf2f5480c5faea) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`8092598`](https://github.com/inspect-js/which-typed-array/commit/8092598998a1f9f8005b4e3d299eb09c96fa2e21) +- [Tests] up to `node` `v11.10` [`a5aabb1`](https://github.com/inspect-js/which-typed-array/commit/a5aabb1910e8408f857a791253487824c7c758d3) +- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `nsp`, `semver`, `tape` [`277be33`](https://github.com/inspect-js/which-typed-array/commit/277be331d9f05ff95644d6bcd896547ca620cd8e) +- [Tests] use `npm audit` instead of `nsp` [`ee97dc7`](https://github.com/inspect-js/which-typed-array/commit/ee97dc7c5d384d68f60ce6cb5a85d9509e75f72b) +- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` [`262ffb0`](https://github.com/inspect-js/which-typed-array/commit/262ffb025facb0795b33fbd5131183bdbc0a40f6) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`d6bbcfc`](https://github.com/inspect-js/which-typed-array/commit/d6bbcfc3eea427f0156fbdcf9ae11dbf3745a755) +- [Tests] up to `node` `v6.2` [`2ff89eb`](https://github.com/inspect-js/which-typed-array/commit/2ff89eb91754146c0bc1ae689f37458d84f6e690) +- Only apps should have lockfiles [`e2bc271`](https://github.com/inspect-js/which-typed-array/commit/e2bc271e1e9a6481a2836f892177825a808c331c) +- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`b79e93b`](https://github.com/inspect-js/which-typed-array/commit/b79e93bf15c871ce0ff24fa3ad61001707eea463) +- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`016dbff`](https://github.com/inspect-js/which-typed-array/commit/016dbff8c49c32cda7ec80d86006c8a7c43bc40c) +- [Dev Deps] update `eslint`, `tape` [`6ce4bbc`](https://github.com/inspect-js/which-typed-array/commit/6ce4bbc5f6caf632cbcf9ababbfe36e1bf4093d7) +- [Tests] on `node` `v10.1` [`f0683a0`](https://github.com/inspect-js/which-typed-array/commit/f0683a0c17e039e926ecaad4c4c341cd8e5878f1) +- [Tests] up to `node` `v7.2` [`2f29cef`](https://github.com/inspect-js/which-typed-array/commit/2f29cef42d30f87259cd6687c25a79ae4651d0c9) +- [Dev Deps] update `replace` [`73b5ba6`](https://github.com/inspect-js/which-typed-array/commit/73b5ba6e87638d13553985977cab9d1bad33e242) +- [Deps] update `function-bind` [`c8a18c2`](https://github.com/inspect-js/which-typed-array/commit/c8a18c2982e6b126ecc1d4655ec2e53b05535b20) +- [Tests] on `node` `v5.12` [`812102b`](https://github.com/inspect-js/which-typed-array/commit/812102bf223422da8f7a89e5a1308214dd158571) +- [Tests] on `node` `v5.10` [`271584f`](https://github.com/inspect-js/which-typed-array/commit/271584f3a8b10ef68a7d419ac0062b444e63d07c) + +## [v1.0.1](https://github.com/inspect-js/which-typed-array/compare/v1.0.0...v1.0.1) - 2016-03-19 + +### Commits + +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `is-callable` [`4a628c5`](https://github.com/inspect-js/which-typed-array/commit/4a628c520d8e080a9fa7e8218947d3b2ceedca72) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is-callable` [`8e09372`](https://github.com/inspect-js/which-typed-array/commit/8e09372ded877a191cbf777060483227d5071e84) +- [Tests] up to `node` `v5.6`, `v4.3` [`3a35bf9`](https://github.com/inspect-js/which-typed-array/commit/3a35bf9fb9c7f8e6ac1b579ed2754087351ad1a5) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`9410d5e`](https://github.com/inspect-js/which-typed-array/commit/9410d5e35db4b834827b31ea1723bbeebbcde5ba) +- [Fix] `Symbol.toStringTag` is on the super-[[Prototype]] of Float32Array, not the [[Prototype]]. [`7c40a3a`](https://github.com/inspect-js/which-typed-array/commit/7c40a3a05046bbbd188340fb19471ad913e4af05) +- [Tests] up to `node` `v5.9`, `v4.4` [`07878e7`](https://github.com/inspect-js/which-typed-array/commit/07878e7cd23d586ddb9e85a03f675e0a574db246) +- Use the object form of "author" in package.json [`65caa56`](https://github.com/inspect-js/which-typed-array/commit/65caa560d1c0c15c1080b25a9df55c7373c73f08) +- [Tests] use pretest/posttest for linting/security [`c170f7e`](https://github.com/inspect-js/which-typed-array/commit/c170f7ebcf07475d6420f2d2d2d08b1646280cd4) +- [Deps] update `is-typed-array` [`9ab324e`](https://github.com/inspect-js/which-typed-array/commit/9ab324e746a7552b2d9363777fc5c9f5c2e31ce7) +- [Deps] update `function-bind` [`a723142`](https://github.com/inspect-js/which-typed-array/commit/a723142c70a5b6a4f8f5feecc9705619590f4eeb) +- [Deps] update `is-typed-array` [`ed82ce4`](https://github.com/inspect-js/which-typed-array/commit/ed82ce4e8ecc657fc6e839d23ef6347497bc93be) +- [Tests] on `node` `v4.2` [`f581c20`](https://github.com/inspect-js/which-typed-array/commit/f581c2031990668894a8e5a08eaf01a2548e822c) + +## v1.0.0 - 2015-10-05 + +### Commits + +- Dotfiles / Makefile [`667f89a`](https://github.com/inspect-js/which-typed-array/commit/667f89a9046502594e2559dbf5568e062af3b770) +- Tests. [`a14d05e`](https://github.com/inspect-js/which-typed-array/commit/a14d05ef443d2ac678cb0567befc0abf8cf21709) +- package.json [`560b1aa`](https://github.com/inspect-js/which-typed-array/commit/560b1aa4f8bbc5d41d9cee96c93faf08c25be0e5) +- Read me [`a22096e`](https://github.com/inspect-js/which-typed-array/commit/a22096e05773f93b34e672d3f743ec6f1963bc24) +- Implementation [`0b1ae28`](https://github.com/inspect-js/which-typed-array/commit/0b1ae2848372f6256cf075d687e3722878e67aca) +- Initial commit [`4b32f0a`](https://github.com/inspect-js/which-typed-array/commit/4b32f0a9d32165d6ab91797d6971ea83cf4ce9da) diff --git a/node_modules/which-typed-array/LICENSE b/node_modules/which-typed-array/LICENSE new file mode 100644 index 000000000..b43df444e --- /dev/null +++ b/node_modules/which-typed-array/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/which-typed-array/README.md b/node_modules/which-typed-array/README.md new file mode 100644 index 000000000..6427427ae --- /dev/null +++ b/node_modules/which-typed-array/README.md @@ -0,0 +1,70 @@ +# which-typed-array [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag. + +## Example + +```js +var whichTypedArray = require('which-typed-array'); +var assert = require('assert'); + +assert.equal(false, whichTypedArray(undefined)); +assert.equal(false, whichTypedArray(null)); +assert.equal(false, whichTypedArray(false)); +assert.equal(false, whichTypedArray(true)); +assert.equal(false, whichTypedArray([])); +assert.equal(false, whichTypedArray({})); +assert.equal(false, whichTypedArray(/a/g)); +assert.equal(false, whichTypedArray(new RegExp('a', 'g'))); +assert.equal(false, whichTypedArray(new Date())); +assert.equal(false, whichTypedArray(42)); +assert.equal(false, whichTypedArray(NaN)); +assert.equal(false, whichTypedArray(Infinity)); +assert.equal(false, whichTypedArray(new Number(42))); +assert.equal(false, whichTypedArray('foo')); +assert.equal(false, whichTypedArray(Object('foo'))); +assert.equal(false, whichTypedArray(function () {})); +assert.equal(false, whichTypedArray(function* () {})); +assert.equal(false, whichTypedArray(x => x * x)); +assert.equal(false, whichTypedArray([])); + +assert.equal('Int8Array', whichTypedArray(new Int8Array())); +assert.equal('Uint8Array', whichTypedArray(new Uint8Array())); +assert.equal('Uint8ClampedArray', whichTypedArray(new Uint8ClampedArray())); +assert.equal('Int16Array', whichTypedArray(new Int16Array())); +assert.equal('Uint16Array', whichTypedArray(new Uint16Array())); +assert.equal('Int32Array', whichTypedArray(new Int32Array())); +assert.equal('Uint32Array', whichTypedArray(new Uint32Array())); +assert.equal('Float32Array', whichTypedArray(new Float32Array())); +assert.equal('Float64Array', whichTypedArray(new Float64Array())); +assert.equal('BigInt64Array', whichTypedArray(new BigInt64Array())); +assert.equal('BigUint64Array', whichTypedArray(new BigUint64Array())); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/which-typed-array +[npm-version-svg]: https://versionbadg.es/inspect-js/which-typed-array.svg +[deps-svg]: https://david-dm.org/inspect-js/which-typed-array.svg +[deps-url]: https://david-dm.org/inspect-js/which-typed-array +[dev-deps-svg]: https://david-dm.org/inspect-js/which-typed-array/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/which-typed-array#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/which-typed-array.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/which-typed-array.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/which-typed-array.svg +[downloads-url]: https://npm-stat.com/charts.html?package=which-typed-array +[codecov-image]: https://codecov.io/gh/inspect-js/which-typed-array/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/which-typed-array/ +[actions-image]: https://img.shields.io/github/check-runs/inspect-js/which-typed-array/main +[actions-url]: https://github.com/inspect-js/which-typed-array/actions diff --git a/node_modules/which-typed-array/index.d.ts b/node_modules/which-typed-array/index.d.ts new file mode 100644 index 000000000..a603e2efd --- /dev/null +++ b/node_modules/which-typed-array/index.d.ts @@ -0,0 +1,66 @@ +/** + * Determines the type of the given collection, or returns false. + * + * @param {unknown} value The potential collection + * @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null + */ +declare function whichTypedArray(value: Int8Array): 'Int8Array'; +declare function whichTypedArray(value: Uint8Array): 'Uint8Array'; +declare function whichTypedArray(value: Uint8ClampedArray): 'Uint8ClampedArray'; +declare function whichTypedArray(value: Int16Array): 'Int16Array'; +declare function whichTypedArray(value: Uint16Array): 'Uint16Array'; +declare function whichTypedArray(value: Int32Array): 'Int32Array'; +declare function whichTypedArray(value: Uint32Array): 'Uint32Array'; +declare function whichTypedArray(value: Float32Array): 'Float32Array'; +declare function whichTypedArray(value: Float64Array): 'Float64Array'; +declare function whichTypedArray(value: Float16Array): 'Float16Array'; +declare function whichTypedArray(value: BigInt64Array): 'BigInt64Array'; +declare function whichTypedArray(value: BigUint64Array): 'BigUint64Array'; +declare function whichTypedArray(value: whichTypedArray.TypedArray): whichTypedArray.TypedArrayName; +declare function whichTypedArray(value: unknown): false | null; + +declare namespace whichTypedArray { + export type TypedArrayName = + | 'Int8Array' + | 'Uint8Array' + | 'Uint8ClampedArray' + | 'Int16Array' + | 'Uint16Array' + | 'Int32Array' + | 'Uint32Array' + | 'Float32Array' + | 'Float64Array' + | 'Float16Array' + | 'BigInt64Array' + | 'BigUint64Array'; + + export type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | Float16Array + | BigInt64Array + | BigUint64Array; + + export type TypedArrayConstructor = + | Int8ArrayConstructor + | Uint8ArrayConstructor + | Uint8ClampedArrayConstructor + | Int16ArrayConstructor + | Uint16ArrayConstructor + | Int32ArrayConstructor + | Uint32ArrayConstructor + | Float32ArrayConstructor + | Float64ArrayConstructor + | Float16ArrayConstructor + | BigInt64ArrayConstructor + | BigUint64ArrayConstructor; +} + +export = whichTypedArray; diff --git a/node_modules/which-typed-array/index.js b/node_modules/which-typed-array/index.js new file mode 100644 index 000000000..62245844e --- /dev/null +++ b/node_modules/which-typed-array/index.js @@ -0,0 +1,122 @@ +'use strict'; + +var forEach = require('for-each'); +var availableTypedArrays = require('available-typed-arrays'); +var callBind = require('call-bind'); +var callBound = require('call-bound'); +var gOPD = require('gopd'); +var getProto = require('get-proto'); + +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = require('has-tostringtag/shams')(); + +var g = typeof globalThis === 'undefined' ? global : globalThis; +var typedArrays = availableTypedArrays(); + +var $slice = callBound('String.prototype.slice'); + +/** @type {(array: readonly T[], value: unknown) => number} */ +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; + +/** @typedef {import('./types').Getter} Getter */ +/** @type {import('./types').Cache} */ +var cache = { __proto__: null }; +if (hasToStringTag && gOPD && getProto) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr && getProto) { + var proto = getProto(arr); + // @ts-expect-error TS won't narrow inside a closure + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor && proto) { + var superProto = getProto(proto); + // @ts-expect-error TS won't narrow inside a closure + descriptor = gOPD(superProto, Symbol.toStringTag); + } + if (descriptor && descriptor.get) { + var bound = callBind(descriptor.get); + cache[ + /** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray) + ] = bound; + } + } + }); +} else { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + var fn = arr.slice || arr.set; + if (fn) { + var bound = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ ( + // @ts-expect-error TODO FIXME + callBind(fn) + ); + cache[ + /** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray) + ] = bound; + } + }); +} + +/** @type {(value: object) => false | import('.').TypedArrayName} */ +var tryTypedArrays = function tryAllTypedArrays(value) { + /** @type {ReturnType} */ var found = false; + forEach( + /** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */ (cache), + /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ + function (getter, typedArray) { + if (!found) { + try { + // @ts-expect-error a throw is fine here + if ('$' + getter(value) === typedArray) { + found = /** @type {import('.').TypedArrayName} */ ($slice(typedArray, 1)); + } + } catch (e) { /**/ } + } + } + ); + return found; +}; + +/** @type {(value: object) => false | import('.').TypedArrayName} */ +var trySlices = function tryAllSlices(value) { + /** @type {ReturnType} */ var found = false; + forEach( + /** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */(cache), + /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { + if (!found) { + try { + // @ts-expect-error a throw is fine here + getter(value); + found = /** @type {import('.').TypedArrayName} */ ($slice(name, 1)); + } catch (e) { /**/ } + } + } + ); + return found; +}; + +/** @type {import('.')} */ +module.exports = function whichTypedArray(value) { + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag) { + /** @type {string} */ + var tag = $slice($toString(value), 8, -1); + if ($indexOf(typedArrays, tag) > -1) { + return tag; + } + if (tag !== 'Object') { + return false; + } + // node < 0.6 hits here on real Typed Arrays + return trySlices(value); + } + if (!gOPD) { return null; } // unknown engine + return tryTypedArrays(value); +}; diff --git a/node_modules/which-typed-array/package.json b/node_modules/which-typed-array/package.json new file mode 100644 index 000000000..bd94200e8 --- /dev/null +++ b/node_modules/which-typed-array/package.json @@ -0,0 +1,130 @@ +{ + "name": "which-typed-array", + "version": "1.1.20", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.", + "license": "MIT", + "main": "index.js", + "types": "./index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent lint", + "test": "npm run tests-only && npm run test:harmony", + "tests-only": "nyc tape test", + "test:harmony": "nyc node --harmony --es-staging test", + "posttest": "npx npm@'>=10.2' audit --production", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && attw -P", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/inspect-js/which-typed-array.git" + }, + "keywords": [ + "array", + "TypedArray", + "typed array", + "which", + "typed", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + "ES6", + "toStringTag", + "Symbol.toStringTag", + "@@toStringTag" + ], + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.18.2", + "@ljharb/eslint-config": "^22.1.3", + "@ljharb/tsconfig": "^0.3.2", + "@types/call-bind": "^1.0.5", + "@types/for-each": "^0.3.3", + "@types/gopd": "^1.0.3", + "@types/is-callable": "^1.1.2", + "@types/make-arrow-function": "^1.2.2", + "@types/make-generator-function": "^2.0.3", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "eslint": "^8.57.1", + "in-publish": "^2.0.1", + "is-callable": "^1.2.7", + "make-arrow-function": "^1.2.0", + "make-generator-function": "^2.1.0", + "npmignore": "^0.3.5", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types.d.ts" + ] + } +} diff --git a/node_modules/which-typed-array/test/index.js b/node_modules/which-typed-array/test/index.js new file mode 100644 index 000000000..d79453ada --- /dev/null +++ b/node_modules/which-typed-array/test/index.js @@ -0,0 +1,105 @@ +'use strict'; + +var test = require('tape'); +var whichTypedArray = require('../'); +var isCallable = require('is-callable'); +var hasToStringTag = require('has-tostringtag/shams')(); +var generators = require('make-generator-function')(); +var arrows = require('make-arrow-function').list(); +var forEach = require('for-each'); + +var typedArrayNames = [ + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array', + 'BigInt64Array', + 'BigUint64Array' +]; + +test('not arrays', function (t) { + t.test('non-number/string primitives', function (st) { + // @ts-expect-error + st.equal(false, whichTypedArray(), 'undefined is not typed array'); + st.equal(false, whichTypedArray(null), 'null is not typed array'); + st.equal(false, whichTypedArray(false), 'false is not typed array'); + st.equal(false, whichTypedArray(true), 'true is not typed array'); + st.end(); + }); + + t.equal(false, whichTypedArray({}), 'object is not typed array'); + t.equal(false, whichTypedArray(/a/g), 'regex literal is not typed array'); + t.equal(false, whichTypedArray(new RegExp('a', 'g')), 'regex object is not typed array'); + t.equal(false, whichTypedArray(new Date()), 'new Date() is not typed array'); + + t.test('numbers', function (st) { + st.equal(false, whichTypedArray(42), 'number is not typed array'); + st.equal(false, whichTypedArray(Object(42)), 'number object is not typed array'); + st.equal(false, whichTypedArray(NaN), 'NaN is not typed array'); + st.equal(false, whichTypedArray(Infinity), 'Infinity is not typed array'); + st.end(); + }); + + t.test('strings', function (st) { + st.equal(false, whichTypedArray('foo'), 'string primitive is not typed array'); + st.equal(false, whichTypedArray(Object('foo')), 'string object is not typed array'); + st.end(); + }); + + t.end(); +}); + +test('Functions', function (t) { + t.equal(false, whichTypedArray(function () {}), 'function is not typed array'); + t.end(); +}); + +test('Generators', { skip: generators.length === 0 }, function (t) { + forEach(generators, function (genFn) { + t.equal(false, whichTypedArray(genFn), 'generator function ' + genFn + ' is not typed array'); + }); + t.end(); +}); + +test('Arrow functions', { skip: arrows.length === 0 }, function (t) { + forEach(arrows, function (arrowFn) { + t.equal(false, whichTypedArray(arrowFn), 'arrow function ' + arrowFn + ' is not typed array'); + }); + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + forEach(typedArrayNames, function (typedArray) { + // @ts-expect-error TODO: fix + if (typeof global[typedArray] === 'function') { + // @ts-expect-error TODO: fix + var fakeTypedArray = []; + // @ts-expect-error TODO: fix + fakeTypedArray[Symbol.toStringTag] = typedArray; + // @ts-expect-error TODO: fix + t.equal(false, whichTypedArray(fakeTypedArray), 'faked ' + typedArray + ' is not typed array'); + } else { + t.comment('# SKIP ' + typedArray + ' is not supported'); + } + }); + t.end(); +}); + +test('Typed Arrays', function (t) { + forEach(typedArrayNames, function (typedArray) { + // @ts-expect-error TODO: fix + /** @type {import('../').TypedArrayConstructor} */ var TypedArray = global[typedArray]; + if (isCallable(TypedArray)) { + var arr = new TypedArray(10); + t.equal(whichTypedArray(arr), typedArray, 'new ' + typedArray + '(10) is typed array of type ' + typedArray); + } else { + t.comment('# SKIP ' + typedArray + ' is not supported'); + } + }); + t.end(); +}); diff --git a/node_modules/which-typed-array/tsconfig.json b/node_modules/which-typed-array/tsconfig.json new file mode 100644 index 000000000..dcdc3b08a --- /dev/null +++ b/node_modules/which-typed-array/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ESNext", + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/word-wrap/LICENSE b/node_modules/word-wrap/LICENSE new file mode 100644 index 000000000..842218cf0 --- /dev/null +++ b/node_modules/word-wrap/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/word-wrap/README.md b/node_modules/word-wrap/README.md new file mode 100644 index 000000000..330595383 --- /dev/null +++ b/node_modules/word-wrap/README.md @@ -0,0 +1,201 @@ +# word-wrap [![NPM version](https://img.shields.io/npm/v/word-wrap.svg?style=flat)](https://www.npmjs.com/package/word-wrap) [![NPM monthly downloads](https://img.shields.io/npm/dm/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![NPM total downloads](https://img.shields.io/npm/dt/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/word-wrap.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/word-wrap) + +> Wrap words to a specified length. + +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 word-wrap +``` + +## Usage + +```js +var wrap = require('word-wrap'); + +wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'); +``` + +Results in: + +``` + Lorem ipsum dolor sit amet, consectetur adipiscing + elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. +``` + +## Options + +![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png) + +### options.width + +Type: `Number` + +Default: `50` + +The width of the text before wrapping to a new line. + +**Example:** + +```js +wrap(str, {width: 60}); +``` + +### options.indent + +Type: `String` + +Default: `` (two spaces) + +The string to use at the beginning of each line. + +**Example:** + +```js +wrap(str, {indent: ' '}); +``` + +### options.newline + +Type: `String` + +Default: `\n` + +The string to use at the end of each line. + +**Example:** + +```js +wrap(str, {newline: '\n\n'}); +``` + +### options.escape + +Type: `function` + +Default: `function(str){return str;}` + +An escape function to run on each line after splitting them. + +**Example:** + +```js +var xmlescape = require('xml-escape'); +wrap(str, { + escape: function(string){ + return xmlescape(string); + } +}); +``` + +### options.trim + +Type: `Boolean` + +Default: `false` + +Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line. + +**Example:** + +```js +wrap(str, {trim: true}); +``` + +### options.cut + +Type: `Boolean` + +Default: `false` + +Break a word between any two letters when the word is longer than the specified width. + +**Example:** + +```js +wrap(str, {cut: 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: + +* [common-words](https://www.npmjs.com/package/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words) | [homepage](https://github.com/jonschlinkert/common-words "Updated list (JSON) of the 100 most common words in the English language. Useful for excluding these words from arrays.") +* [shuffle-words](https://www.npmjs.com/package/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words) | [homepage](https://github.com/jonschlinkert/shuffle-words "Shuffle the words in a string and optionally the letters in each word using the Fisher-Yates algorithm. Useful for creating test fixtures, benchmarking samples, etc.") +* [unique-words](https://www.npmjs.com/package/unique-words): Returns an array of unique words, or the number of occurrences of each word in… [more](https://github.com/jonschlinkert/unique-words) | [homepage](https://github.com/jonschlinkert/unique-words "Returns an array of unique words, or the number of occurrences of each word in a string or list.") +* [wordcount](https://www.npmjs.com/package/wordcount): Count the words in a string. Support for english, CJK and Cyrillic. | [homepage](https://github.com/jonschlinkert/wordcount "Count the words in a string. Support for english, CJK and Cyrillic.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 47 | [jonschlinkert](https://github.com/jonschlinkert) | +| 7 | [OlafConijn](https://github.com/OlafConijn) | +| 3 | [doowb](https://github.com/doowb) | +| 2 | [aashutoshrathi](https://github.com/aashutoshrathi) | +| 2 | [lordvlad](https://github.com/lordvlad) | +| 2 | [hildjj](https://github.com/hildjj) | +| 1 | [danilosampaio](https://github.com/danilosampaio) | +| 1 | [2fd](https://github.com/2fd) | +| 1 | [leonard-thieu](https://github.com/leonard-thieu) | +| 1 | [mohd-akram](https://github.com/mohd-akram) | +| 1 | [toddself](https://github.com/toddself) | +| 1 | [wolfgang42](https://github.com/wolfgang42) | +| 1 | [zachhale](https://github.com/zachhale) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2023, [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 July 22, 2023._ \ No newline at end of file diff --git a/node_modules/word-wrap/index.d.ts b/node_modules/word-wrap/index.d.ts new file mode 100644 index 000000000..07e06f816 --- /dev/null +++ b/node_modules/word-wrap/index.d.ts @@ -0,0 +1,50 @@ +/** + * Wrap words to a specified length. + */ +export = wrap; + +declare function wrap(str: string, options?: wrap.IOptions): string; + +declare namespace wrap { + export interface IOptions { + + /** + * The width of the text before wrapping to a new line. + * @default ´50´ + */ + width?: number; + + /** + * The string to use at the beginning of each line. + * @default ´ ´ (two spaces) + */ + indent?: string; + + /** + * The string to use at the end of each line. + * @default ´\n´ + */ + newline?: string; + + /** + * An escape function to run on each line after splitting them. + * @default (str: string) => string; + */ + escape?: (str: string) => string; + + /** + * Trim trailing whitespace from the returned string. + * This option is included since .trim() would also strip + * the leading indentation from the first line. + * @default true + */ + trim?: boolean; + + /** + * Break a word between any two letters when the word is longer + * than the specified width. + * @default false + */ + cut?: boolean; + } +} diff --git a/node_modules/word-wrap/index.js b/node_modules/word-wrap/index.js new file mode 100644 index 000000000..08f1e41d7 --- /dev/null +++ b/node_modules/word-wrap/index.js @@ -0,0 +1,61 @@ +/*! + * word-wrap + * + * Copyright (c) 2014-2023, Jon Schlinkert. + * Released under the MIT License. + */ + +function trimEnd(str) { + let lastCharPos = str.length - 1; + let lastChar = str[lastCharPos]; + while(lastChar === ' ' || lastChar === '\t') { + lastChar = str[--lastCharPos]; + } + return str.substring(0, lastCharPos + 1); +} + +function trimTabAndSpaces(str) { + const lines = str.split('\n'); + const trimmedLines = lines.map((line) => trimEnd(line)); + return trimmedLines.join('\n'); +} + +module.exports = function(str, options) { + options = options || {}; + if (str == null) { + return str; + } + + var width = options.width || 50; + var indent = (typeof options.indent === 'string') + ? options.indent + : ' '; + + var newline = options.newline || '\n' + indent; + var escape = typeof options.escape === 'function' + ? options.escape + : identity; + + var regexString = '.{1,' + width + '}'; + if (options.cut !== true) { + regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)'; + } + + var re = new RegExp(regexString, 'g'); + var lines = str.match(re) || []; + var result = indent + lines.map(function(line) { + if (line.slice(-1) === '\n') { + line = line.slice(0, line.length - 1); + } + return escape(line); + }).join(newline); + + if (options.trim === true) { + result = trimTabAndSpaces(result); + } + return result; +}; + +function identity(str) { + return str; +} diff --git a/node_modules/word-wrap/package.json b/node_modules/word-wrap/package.json new file mode 100644 index 000000000..459246d54 --- /dev/null +++ b/node_modules/word-wrap/package.json @@ -0,0 +1,77 @@ +{ + "name": "word-wrap", + "description": "Wrap words to a specified length.", + "version": "1.2.5", + "homepage": "https://github.com/jonschlinkert/word-wrap", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Danilo Sampaio (localhost:8080)", + "Fede Ramirez (https://2fd.github.io)", + "Joe Hildebrand (https://twitter.com/hildjj)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Todd Kennedy (https://tck.io)", + "Waldemar Reusch (https://github.com/lordvlad)", + "Wolfgang Faust (http://www.linestarve.com)", + "Zach Hale (http://zachhale.com)" + ], + "repository": "jonschlinkert/word-wrap", + "bugs": { + "url": "https://github.com/jonschlinkert/word-wrap/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "index.d.ts" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "^3.2.0" + }, + "keywords": [ + "break", + "carriage", + "line", + "new-line", + "newline", + "return", + "soft", + "text", + "word", + "word-wrap", + "words", + "wrap" + ], + "typings": "index.d.ts", + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "common-words", + "shuffle-words", + "unique-words", + "wordcount" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + } +} diff --git a/node_modules/wrappy/LICENSE b/node_modules/wrappy/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/wrappy/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/wrappy/README.md b/node_modules/wrappy/README.md new file mode 100644 index 000000000..98eab2522 --- /dev/null +++ b/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/wrappy/package.json b/node_modules/wrappy/package.json new file mode 100644 index 000000000..130752046 --- /dev/null +++ b/node_modules/wrappy/package.json @@ -0,0 +1,29 @@ +{ + "name": "wrappy", + "version": "1.0.2", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "files": [ + "wrappy.js" + ], + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^2.3.1" + }, + "scripts": { + "test": "tap --coverage test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy" +} diff --git a/node_modules/wrappy/wrappy.js b/node_modules/wrappy/wrappy.js new file mode 100644 index 000000000..bb7e7d6fc --- /dev/null +++ b/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/write/LICENSE b/node_modules/write/LICENSE new file mode 100644 index 000000000..943e71d05 --- /dev/null +++ b/node_modules/write/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/write/README.md b/node_modules/write/README.md new file mode 100644 index 000000000..31c95974b --- /dev/null +++ b/node_modules/write/README.md @@ -0,0 +1,178 @@ +# write [![NPM version](https://img.shields.io/npm/v/write.svg?style=flat)](https://www.npmjs.com/package/write) [![NPM monthly downloads](https://img.shields.io/npm/dm/write.svg?style=flat)](https://npmjs.org/package/write) [![NPM total downloads](https://img.shields.io/npm/dt/write.svg?style=flat)](https://npmjs.org/package/write) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/write.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/write) + +> Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save write +``` + +## Usage + +```js +var writeFile = require('write'); +``` + +## API + +### [writeFile](index.js#L40) + +Asynchronously writes data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Data can be a string or a buffer. Returns a promise if a callback function is not passed. + +**Params** + +* `filepath` **{string|Buffer|integer}**: filepath or file descriptor. +* `data` **{string|Buffer|Uint8Array}**: String to write to disk. +* `options` **{object}**: Options to pass to [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) and/or [mkdirp](https://github.com/substack/node-mkdirp) +* `callback` **{Function}**: (optional) If no callback is provided, a promise is returned. + +**Example** + +```js +var writeFile = require('write'); +writeFile('foo.txt', 'This is content...', function(err) { + if (err) console.log(err); +}); + +// promise +writeFile('foo.txt', 'This is content...') + .then(function() { + // do stuff + }); +``` + +### [.promise](index.js#L82) + +The promise version of [writeFile](#writefile). Returns a promise. + +**Params** + +* `filepath` **{string|Buffer|integer}**: filepath or file descriptor. +* `val` **{string|Buffer|Uint8Array}**: String or buffer to write to disk. +* `options` **{object}**: Options to pass to [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) and/or [mkdirp](https://github.com/substack/node-mkdirp) +* `returns` **{Promise}** + +**Example** + +```js +var writeFile = require('write'); +writeFile.promise('foo.txt', 'This is content...') + .then(function() { + // do stuff + }); +``` + +### [.sync](index.js#L120) + +The synchronous version of [writeFile](#writefile). Returns undefined. + +**Params** + +* `filepath` **{string|Buffer|integer}**: filepath or file descriptor. +* `data` **{string|Buffer|Uint8Array}**: String or buffer to write to disk. +* `options` **{object}**: Options to pass to [fs.writeFileSync](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) and/or [mkdirp](https://github.com/substack/node-mkdirp) +* `returns` **{undefined}** + +**Example** + +```js +var writeFile = require('write'); +writeFile.sync('foo.txt', 'This is content...'); +``` + +### [.stream](index.js#L151) + +Uses `fs.createWriteStream` to write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Data can be a string or a buffer. Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. + +**Params** + +* `filepath` **{string|Buffer|integer}**: filepath or file descriptor. +* `options` **{object}**: Options to pass to [mkdirp](https://github.com/substack/node-mkdirp) and [fs.createWriteStream](https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options) +* `returns` **{Stream}**: Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)). + +**Example** + +```js +var fs = require('fs'); +var writeFile = require('write'); +fs.createReadStream('README.md') + .pipe(writeFile.stream('a/b/c/other-file.md')) + .on('close', function() { + // do stuff + }); +``` + +## Release history + +### v1.0.2 - 2017-07-11 + +* improved documentation + +### v1.0.0 - 2017-07-09 + +**Added** + +* [promise support](#promise) + +**Changed** + +* The main export will now return a promise if no callback is passed + +## About + +### Related projects + +* [delete](https://www.npmjs.com/package/delete): Delete files and folders and any intermediate directories if they exist (sync and async). | [homepage](https://github.com/jonschlinkert/delete "Delete files and folders and any intermediate directories if they exist (sync and async).") +* [read-data](https://www.npmjs.com/package/read-data): Read JSON or YAML files. | [homepage](https://github.com/jonschlinkert/read-data "Read JSON or YAML files.") +* [read-yaml](https://www.npmjs.com/package/read-yaml): Very thin wrapper around js-yaml for directly reading in YAML files. | [homepage](https://github.com/jonschlinkert/read-yaml "Very thin wrapper around js-yaml for directly reading in YAML files.") +* [write-data](https://www.npmjs.com/package/write-data): Write a YAML or JSON file to disk. Automatically detects the format to write based… [more](https://github.com/jonschlinkert/write-data) | [homepage](https://github.com/jonschlinkert/write-data "Write a YAML or JSON file to disk. Automatically detects the format to write based on extension. Or pass `ext` on the options.") +* [write-json](https://www.npmjs.com/package/write-json): Write a JSON file to disk, also creates intermediate directories in the destination path if… [more](https://github.com/jonschlinkert/write-json) | [homepage](https://github.com/jonschlinkert/write-json "Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.") +* [write-yaml](https://www.npmjs.com/package/write-yaml): Write YAML. Converts JSON to YAML writes it to the specified file. | [homepage](https://github.com/jonschlinkert/write-yaml "Write YAML. Converts JSON to YAML writes it to the specified file.") + +### 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) | +| 1 | [tunnckoCore](https://github.com/tunnckoCore) | + +### 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 11, 2017._ \ No newline at end of file diff --git a/node_modules/write/index.js b/node_modules/write/index.js new file mode 100644 index 000000000..b2b4b4380 --- /dev/null +++ b/node_modules/write/index.js @@ -0,0 +1,160 @@ +/*! + * write + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var mkdirp = require('mkdirp'); + +/** + * Asynchronously writes data to a file, replacing the file if it already + * exists and creating any intermediate directories if they don't already + * exist. Data can be a string or a buffer. Returns a promise if a callback + * function is not passed. + * + * ```js + * var writeFile = require('write'); + * writeFile('foo.txt', 'This is content...', function(err) { + * if (err) console.log(err); + * }); + * + * // promise + * writeFile('foo.txt', 'This is content...') + * .then(function() { + * // do stuff + * }); + * ``` + * @name writeFile + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {string|Buffer|Uint8Array} `data` String to write to disk. + * @param {object} `options` Options to pass to [fs.writeFile][fs]{#fs_fs_writefile_file_data_options_callback} and/or [mkdirp][] + * @param {Function} `callback` (optional) If no callback is provided, a promise is returned. + * @api public + */ + +function writeFile(filepath, data, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (typeof cb !== 'function') { + return writeFile.promise.apply(null, arguments); + } + + if (typeof filepath !== 'string') { + cb(new TypeError('expected filepath to be a string')); + return; + } + + mkdirp(path.dirname(filepath), options, function(err) { + if (err) { + cb(err); + return; + } + fs.writeFile(filepath, data, options, cb); + }); +}; + +/** + * The promise version of [writeFile](#writefile). Returns a promise. + * + * ```js + * var writeFile = require('write'); + * writeFile.promise('foo.txt', 'This is content...') + * .then(function() { + * // do stuff + * }); + * ``` + * @name .promise + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {string|Buffer|Uint8Array} `val` String or buffer to write to disk. + * @param {object} `options` Options to pass to [fs.writeFile][fs]{#fs_fs_writefile_file_data_options_callback} and/or [mkdirp][] + * @return {Promise} + * @api public + */ + +writeFile.promise = function(filepath, val, options) { + if (typeof filepath !== 'string') { + return Promise.reject(new TypeError('expected filepath to be a string')); + } + + return new Promise(function(resolve, reject) { + mkdirp(path.dirname(filepath), options, function(err) { + if (err) { + reject(err); + return; + } + + fs.writeFile(filepath, val, options, function(err) { + if (err) { + reject(err); + return; + } + resolve(val); + }); + }); + }); +}; + +/** + * The synchronous version of [writeFile](#writefile). Returns undefined. + * + * ```js + * var writeFile = require('write'); + * writeFile.sync('foo.txt', 'This is content...'); + * ``` + * @name .sync + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {string|Buffer|Uint8Array} `data` String or buffer to write to disk. + * @param {object} `options` Options to pass to [fs.writeFileSync][fs]{#fs_fs_writefilesync_file_data_options} and/or [mkdirp][] + * @return {undefined} + * @api public + */ + +writeFile.sync = function(filepath, data, options) { + if (typeof filepath !== 'string') { + throw new TypeError('expected filepath to be a string'); + } + mkdirp.sync(path.dirname(filepath), options); + fs.writeFileSync(filepath, data, options); +}; + +/** + * Uses `fs.createWriteStream` to write data to a file, replacing the + * file if it already exists and creating any intermediate directories + * if they don't already exist. Data can be a string or a buffer. Returns + * a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) + * object. + * + * ```js + * var fs = require('fs'); + * var writeFile = require('write'); + * fs.createReadStream('README.md') + * .pipe(writeFile.stream('a/b/c/other-file.md')) + * .on('close', function() { + * // do stuff + * }); + * ``` + * @name .stream + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {object} `options` Options to pass to [mkdirp][] and [fs.createWriteStream][fs]{#fs_fs_createwritestream_path_options} + * @return {Stream} Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)). + * @api public + */ + +writeFile.stream = function(filepath, options) { + mkdirp.sync(path.dirname(filepath), options); + return fs.createWriteStream(filepath, options); +}; + +/** + * Expose `writeFile` + */ + +module.exports = writeFile; diff --git a/node_modules/write/package.json b/node_modules/write/package.json new file mode 100644 index 000000000..632c7880b --- /dev/null +++ b/node_modules/write/package.json @@ -0,0 +1,74 @@ +{ + "name": "write", + "description": "Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.", + "version": "1.0.3", + "homepage": "https://github.com/jonschlinkert/write", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Charlike Mike Reagent (https://i.am.charlike.online)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "jonschlinkert/write", + "bugs": { + "url": "https://github.com/jonschlinkert/write/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "mkdirp": "^0.5.1" + }, + "devDependencies": { + "async-each": "^1.0.1", + "delete": "^1.1.0", + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" + }, + "keywords": [ + "file", + "filepath", + "files", + "filesystem", + "folder", + "fs", + "fs.writeFile", + "fs.writeFileSync", + "path", + "write" + ], + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "delete", + "read-data", + "read-yaml", + "write-data", + "write-json", + "write-yaml" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/node_modules/x-is-string/.npmignore b/node_modules/x-is-string/.npmignore new file mode 100644 index 000000000..8363b8e3d --- /dev/null +++ b/node_modules/x-is-string/.npmignore @@ -0,0 +1,16 @@ +.DS_Store +.monitor +.*.swp +.nodemonignore +releases +*.log +*.err +fleet.json +public/browserify +bin/*.json +.bin +build +compile +.lock-wscript +coverage +node_modules diff --git a/node_modules/x-is-string/.travis.yml b/node_modules/x-is-string/.travis.yml new file mode 100644 index 000000000..45734f2ef --- /dev/null +++ b/node_modules/x-is-string/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - 0.8 + - "0.10" +before_script: + - npm install + - npm install istanbul coveralls +script: npm run travis-test diff --git a/node_modules/x-is-string/LICENCE b/node_modules/x-is-string/LICENCE new file mode 100644 index 000000000..0d0834052 --- /dev/null +++ b/node_modules/x-is-string/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Matt-Esch. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/x-is-string/README.md b/node_modules/x-is-string/README.md new file mode 100644 index 000000000..99977d475 --- /dev/null +++ b/node_modules/x-is-string/README.md @@ -0,0 +1,46 @@ +# x-is-string + +Simple string test + +## Example + +```js +var isString = require("x-is-string") + +isString("hello") +// -> true + +isString("") +// -> true + +isString(new String("things")) +// -> true + +isString(1) +// -> false + +isString(true) +// -> false + +isString(new Date()) +// -> false + +isString({}) +// -> false + +isString(null) +// -> false + +isString(undefined) +// -> false +``` + +## Installation + +`npm install x-is-string` + +## Contributors + + - Matt-Esch + +## MIT Licenced \ No newline at end of file diff --git a/node_modules/x-is-string/index.js b/node_modules/x-is-string/index.js new file mode 100644 index 000000000..090130d4c --- /dev/null +++ b/node_modules/x-is-string/index.js @@ -0,0 +1,7 @@ +var toString = Object.prototype.toString + +module.exports = isString + +function isString(obj) { + return toString.call(obj) === "[object String]" +} diff --git a/node_modules/x-is-string/package.json b/node_modules/x-is-string/package.json new file mode 100644 index 000000000..ea267ce35 --- /dev/null +++ b/node_modules/x-is-string/package.json @@ -0,0 +1,55 @@ +{ + "name": "x-is-string", + "version": "0.1.0", + "description": "Simple string test", + "keywords": [], + "author": "Matt-Esch ", + "repository": "git://github.com/Matt-Esch/x-is-string.git", + "main": "index", + "homepage": "https://github.com/Matt-Esch/x-is-string", + "contributors": [ + { + "name": "Matt-Esch" + } + ], + "bugs": { + "url": "https://github.com/Matt-Esch/x-is-string/issues", + "email": "matt@mattesch.info" + }, + "dependencies": {}, + "devDependencies": { + "tape": "^2.12.2" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/Matt-Esch/x-is-string/raw/master/LICENSE" + } + ], + "scripts": { + "test": "node ./test/index.js", + "start": "node ./index.js", + "watch": "nodemon -w ./index.js index.js", + "travis-test": "istanbul cover ./test/index.js && ((cat coverage/lcov.info | coveralls) || exit 0)", + "cover": "istanbul cover --report none --print detail ./test/index.js", + "view-cover": "istanbul report html && google-chrome ./coverage/index.html", + "test-browser": "testem-browser ./test/browser/index.js", + "testem": "testem-both -b=./test/browser/index.js" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..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" + ] + } +} diff --git a/node_modules/x-is-string/test/index.js b/node_modules/x-is-string/test/index.js new file mode 100644 index 000000000..7caa5ab48 --- /dev/null +++ b/node_modules/x-is-string/test/index.js @@ -0,0 +1,51 @@ +var test = require("tape") + +var isString = require("../index") + +test("isString is a function", function (assert) { + assert.equal(typeof isString, "function") + assert.end() +}) + +test("string literal is truthy", function (assert) { + assert.equal(isString("hello"), true) + assert.end() +}) + +test("empty string is truthy", function (assert) { + assert.equal(isString(""), true) + assert.end() +}) + +test("string object is truthy", function (assert) { + assert.equal(isString(new String("hello")), true) + assert.end() +}) + +test("number is falsey", function (assert) { + assert.equal(isString(9), false) + assert.end() +}) + +test("boolean is falsey", function (assert) { + assert.equal(isString(true), false) + assert.end() +}) + +test("date is falsey", function (assert) { + assert.equal(isString(new Date()), false) + assert.end() +}) + +test("object is falsey", function (assert) { + assert.equal(isString({}), false) + assert.end() +}) +test("null is falsey", function (assert) { + assert.equal(isString(null), false) + assert.end() +}) +test("undefined is falsey", function (assert) { + assert.equal(isString(undefined), false) + assert.end() +}) diff --git a/node_modules/xml-escape/.npmignore b/node_modules/xml-escape/.npmignore new file mode 100644 index 000000000..a72b52ebe --- /dev/null +++ b/node_modules/xml-escape/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/node_modules/xml-escape/LICENSE b/node_modules/xml-escape/LICENSE new file mode 100644 index 000000000..bd261effa --- /dev/null +++ b/node_modules/xml-escape/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Michael Hernandez + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/xml-escape/README.md b/node_modules/xml-escape/README.md new file mode 100644 index 000000000..5faf9f91a --- /dev/null +++ b/node_modules/xml-escape/README.md @@ -0,0 +1,38 @@ +xml-escape +========== + +Escape XML in javascript (NodeJS) + +npm install xml-escape + +```javascript +// Warning escape is a reserved word, so maybe best to use xmlescape for var name +var xmlescape = require('xml-escape'); + +xmlescape('"hello" \'world\' & false < true > -1'); + +// output +// '"hello" 'world' & false < true > -1' + +// don't escape some characters +xmlescape('"hello" \'world\' & false < true > -1', '>"&') + +// output +// '"hello" 'world' & false < true > -1' +``` + + +There is also now an ignore function thanks to @jayflo + +```javascript +esc = require('./'); + +ignore = '"<&' +// note you should never ignore an & +output = esc('I am "<¬>" escaped', ignore) +console.log(output) + +//I am "<¬>" escaped +``` + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/miketheprogrammer/xml-escape/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/node_modules/xml-escape/index.js b/node_modules/xml-escape/index.js new file mode 100644 index 000000000..8c37325ea --- /dev/null +++ b/node_modules/xml-escape/index.js @@ -0,0 +1,22 @@ + + +var escape = module.exports = function escape(string, ignore) { + var pattern; + + if (string === null || string === undefined) return; + + ignore = (ignore || '').replace(/[^&"<>\']/g, ''); + pattern = '([&"<>\'])'.replace(new RegExp('[' + ignore + ']', 'g'), ''); + + return string.replace(new RegExp(pattern, 'g'), function(str, item) { + return escape.map[item]; + }) +} + +var map = escape.map = { + '>': '>' + , '<': '<' + , "'": ''' + , '"': '"' + , '&': '&' +} \ No newline at end of file diff --git a/node_modules/xml-escape/package.json b/node_modules/xml-escape/package.json new file mode 100644 index 000000000..65a5fb8d9 --- /dev/null +++ b/node_modules/xml-escape/package.json @@ -0,0 +1,30 @@ +{ + "name": "xml-escape", + "version": "1.1.0", + "description": "Escape XML ", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/miketheprogrammer/xml-escape.git" + }, + "keywords": [ + "Escape", + "XML", + "Unesacpe", + "encoding", + "xml-escape" + ], + "author": "Michael Hernandez - michael.hernandez1988@gmail.com", + "license": "MIT License", + "bugs": { + "url": "https://github.com/miketheprogrammer/xml-escape/issues" + }, + "homepage": "https://github.com/miketheprogrammer/xml-escape", + "dependencies": {}, + "devDependencies": { + "tape": "~2.4.2" + } +} diff --git a/node_modules/xml-escape/test.js b/node_modules/xml-escape/test.js new file mode 100644 index 000000000..21ad21896 --- /dev/null +++ b/node_modules/xml-escape/test.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var escape = require('./index'); +test("Characters should be escaped properly", function (t) { + t.plan(1); + + t.equals(escape('" \' < > &'), '" ' < > &'); +}) + +test("Module should respect ignore string", function (t) { + t.plan(3); + + t.equals(escape('" \' < > &', '"'), '" ' < > &'); + t.equals(escape('" \' < > &', '>&'), '" ' < > &'); + t.equals(escape('" \' < > &', '"\'<>&'), '" \' < > &'); +}) + +test("Module should not escape random characters", function (t) { + t.plan(1); + + t.equals(escape('<[whats up]>', '<]what'), '<[whats up]>'); +}) + +test("Module should not crash on null or undefined input", function (t) { + t.plan(3); + + t.equals((escape("")), ""); + t.doesNotThrow(function(){escape(null);}, TypeError); + t.doesNotThrow(function(){escape(undefined);}, TypeError); +}) diff --git a/node_modules/xtend/.jshintrc b/node_modules/xtend/.jshintrc new file mode 100644 index 000000000..77887b5f0 --- /dev/null +++ b/node_modules/xtend/.jshintrc @@ -0,0 +1,30 @@ +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/xtend/LICENSE b/node_modules/xtend/LICENSE new file mode 100644 index 000000000..0099f4f6c --- /dev/null +++ b/node_modules/xtend/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) +Copyright (c) 2012-2014 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/xtend/README.md b/node_modules/xtend/README.md new file mode 100644 index 000000000..4a2703cff --- /dev/null +++ b/node_modules/xtend/README.md @@ -0,0 +1,32 @@ +# xtend + +[![browser support][3]][4] + +[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: "c" +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licensed + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/xtend/immutable.js b/node_modules/xtend/immutable.js new file mode 100644 index 000000000..94889c9de --- /dev/null +++ b/node_modules/xtend/immutable.js @@ -0,0 +1,19 @@ +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/xtend/mutable.js b/node_modules/xtend/mutable.js new file mode 100644 index 000000000..72debede6 --- /dev/null +++ b/node_modules/xtend/mutable.js @@ -0,0 +1,17 @@ +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/xtend/package.json b/node_modules/xtend/package.json new file mode 100644 index 000000000..f7a39d10a --- /dev/null +++ b/node_modules/xtend/package.json @@ -0,0 +1,55 @@ +{ + "name": "xtend", + "version": "4.0.2", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": "Raynos ", + "repository": "git://github.com/Raynos/xtend.git", + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "license": "MIT", + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..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" + ] + }, + "engines": { + "node": ">=0.4" + } +} diff --git a/node_modules/xtend/test.js b/node_modules/xtend/test.js new file mode 100644 index 000000000..b895b42b3 --- /dev/null +++ b/node_modules/xtend/test.js @@ -0,0 +1,103 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) + +test("null prototype", function(assert) { + var a = { a: "foo" } + var b = Object.create(null) + b.b = "bar"; + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("null prototype mutable", function (assert) { + var a = { foo: "bar" } + var b = Object.create(null) + b.bar = "baz"; + + mutableExtend(a, b) + + assert.equal(a.bar, "baz") + assert.end() +}) + +test("prototype pollution", function (assert) { + var a = {} + var maliciousPayload = '{"__proto__":{"oops":"It works!"}}' + + assert.strictEqual(a.oops, undefined) + extend({}, maliciousPayload) + assert.strictEqual(a.oops, undefined) + assert.end() +}) + +test("prototype pollution mutable", function (assert) { + var a = {} + var maliciousPayload = '{"__proto__":{"oops":"It works!"}}' + + assert.strictEqual(a.oops, undefined) + mutableExtend({}, maliciousPayload) + assert.strictEqual(a.oops, undefined) + assert.end() +}) diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..0532ae210 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,7025 @@ +{ + "name": "owasptop10", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "owasptop10", + "version": "1.0.0", + "license": "CC-BY-SA-4.0", + "devDependencies": { + "markdownlint-cli": "^0.26.0", + "textlint": "^11.6.3", + "textlint-filter-rule-comments": "^1.2.2", + "textlint-filter-rule-whitelist": "^2.0.0", + "textlint-rule-terminology": "^2.1.4" + } + }, + "node_modules/@azu/format-text": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@azu/format-text/-/format-text-1.0.2.tgz", + "integrity": "sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==", + "dev": true + }, + "node_modules/@azu/style-format": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@azu/style-format/-/style-format-1.0.1.tgz", + "integrity": "sha512-AHcTojlNBdD/3/KxIKlg8sxIWHfOtQszLvOpagLTO+bjC3u7SAszu1lf//u7JJC50aUSH+BVWDD/KvaA6Gfn5g==", + "dev": true, + "dependencies": { + "@azu/format-text": "^1.0.1" + } + }, + "node_modules/@textlint/ast-node-types": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.4.3.tgz", + "integrity": "sha512-qi2jjgO6Tn3KNPGnm6B7p6QTEPvY95NFsIAaJuwbulur8iJUEenp1OnoUfiDaC/g2WPPEFkcfXpmnu8XEMFo2A==", + "dev": true + }, + "node_modules/@textlint/ast-tester": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@textlint/ast-tester/-/ast-tester-2.3.5.tgz", + "integrity": "sha512-sbw0Edx22/Fa9fwObpus5KyhCnGKhyP1tU7flA7kwTi9EqQq2KFztz1c/QQWpgqymbdSPWg7HpAvGf4ru4FDZg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/ast-traverse": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@textlint/ast-traverse/-/ast-traverse-2.3.5.tgz", + "integrity": "sha512-yo1gIoXDx2bNs1JjC9viRxJpErNsfPtzb585KcVwWxxWmu3tXlT2iz13iKdjj5FMYPJe/PORe7lYqymkSUZ7kg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/feature-flag": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/feature-flag/-/feature-flag-3.3.5.tgz", + "integrity": "sha512-S4JhbDQGu1Sutnvqs96nwxqwaErHrL49/QQDR8i/YNsINlurfKJbmktotb+w+qzeSibDibKzB8feOMVBXmO9Ww==", + "dev": true, + "dependencies": { + "map-like": "^2.0.0" + } + }, + "node_modules/@textlint/fixer-formatter": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/fixer-formatter/-/fixer-formatter-3.3.5.tgz", + "integrity": "sha512-FHfOQLvJV88vgAI9wwbAjtffo4ZtAW0bV8xkC3dY2DdVyo+7Tnhz0l2XPw2VFmyzpeHx9Slqw8nEv46YEs4JaQ==", + "dev": true, + "dependencies": { + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "debug": "^4.3.1", + "diff": "^4.0.2", + "is-file": "^1.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1" + } + }, + "node_modules/@textlint/get-config-base-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@textlint/get-config-base-dir/-/get-config-base-dir-2.0.0.tgz", + "integrity": "sha512-J3cG1pl2llYD4ZaZMe0qVgVaHT8RvT+/SW1FHQ8HRceNalMM9O0Y8iIgtl4GGOx4vMghoIPKFVLASw8P8bJ3ZA==", + "dev": true + }, + "node_modules/@textlint/kernel": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@textlint/kernel/-/kernel-3.4.5.tgz", + "integrity": "sha512-KGeOq4mbjPe3okDtPw7mbnTX/wP66ndmRKAoOz8gOKDIDRlH8nOG/av6k6xbVhdMk9+ZnomqU8jSSYwTZHzAnA==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-tester": "^2.3.5", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/source-code-fixer": "^3.4.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "map-like": "^2.0.0", + "structured-source": "^3.0.2" + } + }, + "node_modules/@textlint/linter-formatter": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-3.3.5.tgz", + "integrity": "sha512-ujQwgGGK4nVYRuNeW8zDyxax2Z8FTRips5f3VBhWpJaR7hlqdh1iNahul8iJ+1JbfXiHm+51a01myoqGGh1ENA==", + "dev": true, + "dependencies": { + "@azu/format-text": "^1.0.1", + "@azu/style-format": "^1.0.0", + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "concat-stream": "^1.6.2", + "debug": "^4.3.1", + "is-file": "^1.0.0", + "js-yaml": "^3.14.1", + "optionator": "^0.9.1", + "pluralize": "^2.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "table": "^3.8.3", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1", + "xml-escape": "^1.1.0" + }, + "bin": { + "textlint-formatter": "bin/cmd.js" + } + }, + "node_modules/@textlint/markdown-to-ast": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-6.3.5.tgz", + "integrity": "sha512-DjVEy61klC8OjQYP+iIukI95pjCM58jhpE046apqGWLo6JQSatfscJlcxmbRivfTQSVsa00RF2ciUFBmw3bobg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "debug": "^4.3.1", + "remark-frontmatter": "^1.3.3", + "remark-parse": "^5.0.0", + "structured-source": "^3.0.2", + "traverse": "^0.6.6", + "unified": "^6.2.0" + } + }, + "node_modules/@textlint/module-interop": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-1.2.5.tgz", + "integrity": "sha512-+yEluCSbj6oxk9ENFojVcSxURvXOg7AU3vBiVHPjPEShaqbzZZ6tcut6gbDcIYhEDUkegZGmGwyfOe+wNABhKw==", + "dev": true + }, + "node_modules/@textlint/regexp-string-matcher": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@textlint/regexp-string-matcher/-/regexp-string-matcher-1.1.1.tgz", + "integrity": "sha512-rrNUCKGKYBrZALotSF8D5A8xD05VHX6kxv0BP805Ig2M73Ha6LK+de31+ZocGm4CO+sikVFYyMCPPJhp7bCXcw==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0", + "execall": "^2.0.0", + "lodash.sortby": "^4.7.0", + "lodash.uniq": "^4.5.0", + "lodash.uniqwith": "^4.5.0", + "to-regex": "^3.0.2" + } + }, + "node_modules/@textlint/regexp-string-matcher/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@textlint/source-code-fixer": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@textlint/source-code-fixer/-/source-code-fixer-3.4.5.tgz", + "integrity": "sha512-YUcBg6zs7H5ycLwWdfv5LHWlBx7iBAQL6vHY2uPw8AMPYgzU6/f91NGBU/QR7/FVw0e7v9zMngcRN1hMOxpFCw==", + "dev": true, + "dependencies": { + "@textlint/types": "^1.5.5", + "debug": "^4.3.1" + } + }, + "node_modules/@textlint/text-to-ast": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/text-to-ast/-/text-to-ast-3.3.5.tgz", + "integrity": "sha512-+1+Kj7wuQHgc43RowVN/KWz3/aevk2RHARX8/p9Y+pE25HRJ36KZo1PLSYYx82NnWpvZTXB3QONWiAukdv6jBg==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/textlint-plugin-markdown": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/@textlint/textlint-plugin-markdown/-/textlint-plugin-markdown-5.3.5.tgz", + "integrity": "sha512-x1/DJa+6wsR4LwkL+JA5OdEoZ/PhxtkKb20IqHTsLwQIeDL4aNWT6GrAk0HKTOomzsyNrUBuvzYiCy/f75LtBw==", + "dev": true, + "dependencies": { + "@textlint/markdown-to-ast": "^6.3.5" + } + }, + "node_modules/@textlint/textlint-plugin-text": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@textlint/textlint-plugin-text/-/textlint-plugin-text-4.3.5.tgz", + "integrity": "sha512-ygjzswWrzlCiNNCy1+WF0oI8tNCk+1fS/nJEtG7DHuTVvE0OTn4MdWJXOD8sd+ZffXr+uFmEqMisHo06+RpQCg==", + "dev": true, + "dependencies": { + "@textlint/text-to-ast": "^3.3.5" + } + }, + "node_modules/@textlint/types": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@textlint/types/-/types-1.5.5.tgz", + "integrity": "sha512-80P6fcqgsG9bP6JgR6W/E/oIx+71pplaicYCvvB4vMIeGk0OnWls4Q21kCpDYmq/C/ABtZ/Gy/Ov/8ExQPeQ7A==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "node_modules/@textlint/utils": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@textlint/utils/-/utils-1.2.5.tgz", + "integrity": "sha512-2vgz4x3tKK+R9N0OlOovJClRCHubxZi86ki218cvRVpoU9pPrHwkwZud+rjItDl2xFBj7Gujww7c0W1wyytWVQ==", + "dev": true + }, + "node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "dev": true + }, + "node_modules/ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha512-I/bSHSNEcFFqXLf91nchoNB9D1Kie3QKcWdchYUaoIg1+1bdWDkdfdlvdIOJbi9U8xR0y+MWc5D+won9v95WlQ==", + "dev": true, + "dependencies": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "node_modules/ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha512-vuBv+fm2s6cqUyey2A7qYcvsik+GMDJsw8BARP2sDE76cqmaZVarsvHf7Vx6VJ0Xk8gLl+u3MoAPf6gKzJefeA==", + "dev": true, + "peerDependencies": { + "ajv": ">=4.10.0" + } + }, + "node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/bail": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/boundary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", + "integrity": "sha512-AaLhxHwYVh55iOTJncV3DE5o7RakEUSSj64XXEWRTiIhlp7aDI8qR0vY/k8Uw0Z234VjZi/iG/WxfrvqYPUCww==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/chalk/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/character-entities": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/clone-regexp": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", + "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", + "dev": true, + "dependencies": { + "is-regexp": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/collapse-white-space": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz", + "integrity": "sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "engines": [ + "node >= 0.8" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-equal": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.2.tgz", + "integrity": "sha512-5tdhKF6DbU7iIzrIOa1AOUt39ZRm13cmL1cGEh//aqR8x9+tNfbywRf0n5FD/18OKMdo7DNEtrX2t22ZAkI+eg==", + "dev": true, + "dependencies": { + "is-arguments": "^1.1.1", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.5.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/entities": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", + "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz", + "integrity": "sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execall": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/execall/-/execall-2.0.0.tgz", + "integrity": "sha512-0FU2hZ5Hh6iQnarpRtQurM/aAvp3RIbfvgLHrcqJYzhXyV2KFruhuChf9NC6waAhiUR7FFtlugkI4p7f2Fqlow==", + "dev": true, + "dependencies": { + "clone-regexp": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fault": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", + "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", + "dev": true, + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "dependencies": { + "flat-cache": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "dependencies": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-accessor-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz", + "integrity": "sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-alphabetical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", + "dev": true, + "dependencies": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-arguments": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz", + "integrity": "sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-descriptor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.3.tgz", + "integrity": "sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^1.0.1", + "is-data-descriptor": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-file/-/is-file-1.0.0.tgz", + "integrity": "sha512-ZGMuc+xA8mRnrXtmtf2l/EkIW2zaD2LSBWlaOVEF6yH4RTndHob65V4SwWWdtGKVthQfXPVKsXqw4TDUjbVxVQ==", + "dev": true + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-hexadecimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regexp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", + "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==", + "dev": true + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-whitespace-character": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", + "integrity": "sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-word-character": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.4.tgz", + "integrity": "sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "node_modules/json-stable-stringify": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz", + "integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "dev": true + }, + "node_modules/lodash.differencewith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.differencewith/-/lodash.differencewith-4.5.0.tgz", + "integrity": "sha512-/8JFjydAS+4bQuo3CpLMBv7WxGFyk7/etOAsrQUCu0a9QVDemxv0YQ0rFyeZvqlUD314SERfNlgnlqqHmaQ0Cg==", + "dev": true + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", + "dev": true + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, + "node_modules/lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha512-mmPrW0Fh2fxOzdBbFv4g1m6pR72haFLPJ2G5SJEELf1y+iaQrDG6cWCPjy54RHYbZAt7X+ls690Kw62AdWXBzQ==", + "dev": true, + "dependencies": { + "chalk": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-like": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-like/-/map-like-2.0.0.tgz", + "integrity": "sha512-CbgcN622YzXC+k9oUroBSPFVX4in/w66mab/zpvSfFeUezSGD8C13c2RetyM1eo1jkp3sKrzvmf2HFEp5QOdZA==", + "dev": true + }, + "node_modules/markdown-escapes": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz", + "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/markdown-it": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.0.2.tgz", + "integrity": "sha512-4Lkvjbv2kK+moL9TbeV+6/NHx+1Q+R/NIdUlFlkqkkzUcTod4uiyTJRiBidKR9qXSdkNFkgv+AELY8KN9vSgVA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "~2.0.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/markdownlint": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.22.0.tgz", + "integrity": "sha512-J4B+iMc12pOdp/wfYi03W2qfAfEyiZzq3qvQh/8vOMNU8vXYY6Jg440EY7dWTBCqROhb1i4nAn3BTByJ5kdx1w==", + "dev": true, + "dependencies": { + "markdown-it": "12.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/markdownlint-cli": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.26.0.tgz", + "integrity": "sha512-biLfeGNZG9nw0yJbtFBzRlew2/P5w7JSseKwolSox3zejs7dLpGvPgqbC+iqJnqqGWcWLtXaXh8bBEKWmfl10A==", + "dev": true, + "dependencies": { + "commander": "~6.2.1", + "deep-extend": "~0.6.0", + "get-stdin": "~8.0.0", + "glob": "~7.1.6", + "ignore": "~5.1.8", + "js-yaml": "~3.14.1", + "jsonc-parser": "~3.0.0", + "lodash.differencewith": "~4.5.0", + "lodash.flatten": "~4.4.0", + "markdownlint": "~0.22.0", + "markdownlint-rule-helpers": "~0.13.0", + "minimatch": "~3.0.4", + "minimist": "~1.2.5", + "rc": "~1.2.8" + }, + "bin": { + "markdownlint": "markdownlint.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/markdownlint-rule-helpers": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.13.0.tgz", + "integrity": "sha512-rRY0itbcHG4e+ntz0bbY3AIceSJMKS0TafEMgEtKVHRZ54/JUSy6/4ypCL618RlJvYRej+xMLxX5nkJqIeTZaQ==", + "dev": true + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "node_modules/mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", + "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/parse-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "dev": true, + "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" + } + }, + "node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "dev": true, + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-glob-pattern": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-to-glob-pattern/-/path-to-glob-pattern-1.0.2.tgz", + "integrity": "sha512-ryF65N5MBB9XOjE5mMOi+0bMrh1F0ORQmqDSSERvv5zD62Cfc5QC6rK1AR1xuDIG1I091CkNENblbteWy1bXgw==", + "dev": true + }, + "node_modules/path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pluralize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-2.0.0.tgz", + "integrity": "sha512-TqNZzQCD4S42De9IfnnBvILN7HAW7riLqsCyp8lgjXeysyPlX5HhqKAcJHHHb9XskE4/a+7VGC9zzx8Ls0jOAw==", + "dev": true + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc-config-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-3.0.0.tgz", + "integrity": "sha512-bwfUSB37TWkHfP+PPjb/x8BUjChFmmBK44JMfVnU7paisWqZl/o5k7ttCH+EQLnrbn2Aq8Fo1LAsyUiz+WF4CQ==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.1", + "require-from-string": "^2.0.2" + } + }, + "node_modules/read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", + "dev": true, + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "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" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "dependencies": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/remark-frontmatter": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.3.tgz", + "integrity": "sha512-fM5eZPBvu2pVNoq3ZPW22q+5Ativ1oLozq2qYt9I2oNyxiUd/tDl0iLLntEVAegpZIslPWg1brhcP1VsaSVUag==", + "dev": true, + "dependencies": { + "fault": "^1.0.1", + "xtend": "^4.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", + "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "dev": true, + "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" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha512-vuNYXC7gG7IeVNBC1xUllqCcZKRbJoSPOBhnTEcAIiKCsbuef6zO3F0Rve3isPMMoNoQRWjQwbAgAjHUHniyEA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg==", + "dev": true, + "dependencies": { + "ret": "~0.1.10" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha512-up04hB2hR92PgjpyU3y/eg91yIBILyjVY26NvvciY3EVVPjybkMszMpXQ9QAkcS3I5rtJBDLoTxxg+qvW8c7rw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.23", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz", + "integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==", + "dev": true + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/state-toggle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", + "integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "dev": true, + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/structured-source": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-3.0.2.tgz", + "integrity": "sha512-Ap7JHfKgmH40SUjumqyKTHYHNZ8GvGQskP34ks0ElHCDEig+bYGpmXVksxPSrgcY9rkJqhVMzfeg5GIpZelfpQ==", + "dev": true, + "dependencies": { + "boundary": "^1.0.1" + } + }, + "node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha512-RZuzIOtzFbprLCE0AXhkI0Xi42ZJLZhCC+qkwuMLf/Vjz3maWpA8gz1qMdbmNoI9cOROT2Am/DxeRyXenrL11g==", + "dev": true, + "dependencies": { + "ajv": "^4.7.0", + "ajv-keywords": "^1.0.0", + "chalk": "^1.1.1", + "lodash": "^4.0.0", + "slice-ansi": "0.0.4", + "string-width": "^2.0.0" + } + }, + "node_modules/table/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/textlint": { + "version": "11.9.1", + "resolved": "https://registry.npmjs.org/textlint/-/textlint-11.9.1.tgz", + "integrity": "sha512-7eC76od8ILhLl3O10h1rd0QxlVaQkR1nqTD7PrszrlGGe8mXS2VNaOXEiAm8PPUMQBdjB5n8/cpeZ+AbDJdNTw==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/fixer-formatter": "^3.3.5", + "@textlint/kernel": "^3.4.5", + "@textlint/linter-formatter": "^3.3.5", + "@textlint/module-interop": "^1.2.5", + "@textlint/textlint-plugin-markdown": "^5.3.5", + "@textlint/textlint-plugin-text": "^4.3.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "file-entry-cache": "^5.0.1", + "get-stdin": "^5.0.1", + "glob": "^7.1.7", + "is-file": "^1.0.0", + "log-symbols": "^1.0.2", + "map-like": "^2.0.0", + "md5": "^2.3.0", + "mkdirp": "^0.5.0", + "optionator": "^0.9.1", + "path-to-glob-pattern": "^1.0.2", + "rc-config-loader": "^3.0.0", + "read-pkg": "^1.1.0", + "read-pkg-up": "^3.0.0", + "structured-source": "^3.0.2", + "try-resolve": "^1.0.1", + "unique-concat": "^0.2.2" + }, + "bin": { + "textlint": "bin/textlint.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/textlint-filter-rule-comments": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/textlint-filter-rule-comments/-/textlint-filter-rule-comments-1.3.0.tgz", + "integrity": "sha512-kSk/XcZYKYe4sb44XhYAYPeMFtqKJIMtcju/jwyZxpkn8gRuRMZ4+rB0wJmGRrD0c8tx3hHDAH1JY9ccahMKcA==", + "dev": true + }, + "node_modules/textlint-filter-rule-whitelist": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/textlint-filter-rule-whitelist/-/textlint-filter-rule-whitelist-2.0.0.tgz", + "integrity": "sha512-6FBQJZWq2UO1UoX1Z/t3e9vRmQbOF1Z9xRsOUnEzAsd+dGiMrbByE+vaj9SSkLaFzXREIqtg5Widd7ZPF5GOIg==", + "deprecated": "Use textlint-filter-rule-allowlist instead of it: https://github.com/textlint/textlint-filter-rule-allowlist/pull/9", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.0.2", + "@textlint/get-config-base-dir": "^2.0.0", + "@textlint/regexp-string-matcher": "^1.0.2", + "rc-config-loader": "^2.0.1" + }, + "peerDependencies": { + "textlint": ">= 9.0.0" + } + }, + "node_modules/textlint-filter-rule-whitelist/node_modules/rc-config-loader": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-2.0.5.tgz", + "integrity": "sha512-T464K2MQlnNWOblUDIglpFhyN+zYJq7jSlL++/N0hUkcmIXeNFumwXFVdtf8qhUGohn4RYQ0wdi74R575I44PQ==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.0", + "object-assign": "^4.1.0", + "object-keys": "^1.0.12", + "path-exists": "^3.0.0", + "require-from-string": "^2.0.2" + } + }, + "node_modules/textlint-rule-helper": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/textlint-rule-helper/-/textlint-rule-helper-2.5.0.tgz", + "integrity": "sha512-QIbFPtyqLy0g5BJn8mryk9iHzGYicNaFIpLFPiEnb4RXxrEGeQ2W2aARQ9yEXLIAqo+OwK4ndWBAWkbgJEPzTQ==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^15.2.1", + "structured-source": "^4.0.0", + "unist-util-visit": "^2.0.3" + } + }, + "node_modules/textlint-rule-helper/node_modules/@textlint/ast-node-types": { + "version": "15.5.2", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-15.5.2.tgz", + "integrity": "sha512-fCaOxoup5LIyBEo7R1oYWE7V4bSX0KQeHh66twon9e9usaLE3ijgF8QjYsR6joCssdeCHVd0wHm7ppsEyTr6vg==", + "dev": true + }, + "node_modules/textlint-rule-helper/node_modules/boundary": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", + "integrity": "sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==", + "dev": true + }, + "node_modules/textlint-rule-helper/node_modules/structured-source": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-4.0.0.tgz", + "integrity": "sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==", + "dev": true, + "dependencies": { + "boundary": "^2.0.0" + } + }, + "node_modules/textlint-rule-terminology": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/textlint-rule-terminology/-/textlint-rule-terminology-2.1.6.tgz", + "integrity": "sha512-3OdV/0DE8RpIYcshz+5wFaDwNYIlqfsBA8TODgNd68T339rn+K69ak5hoXUBSSuTousbAbCFDPqTILG20os44A==", + "dev": true, + "dependencies": { + "lodash": "^4.17.15", + "strip-json-comments": "^3.0.1", + "textlint-rule-helper": "^2.1.1" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/textlint-rule-terminology/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/textlint/node_modules/get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "dependencies": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/traverse": { + "version": "0.6.11", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.11.tgz", + "integrity": "sha512-vxXDZg8/+p3gblxB6BhhG5yWVn1kGRlaL8O78UDXc3wRnPizB5g83dcvWV1jpDMIPnjZjOFuxlMmE82XJ4407w==", + "dev": true, + "dependencies": { + "gopd": "^1.2.0", + "typedarray.prototype.slice": "^1.0.5", + "which-typed-array": "^1.1.18" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==", + "deprecated": "Use String.prototype.trim() instead", + "dev": true + }, + "node_modules/trim-trailing-lines": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.4.tgz", + "integrity": "sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/try-resolve": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", + "integrity": "sha512-yHeaPjCBzVaXwWl5IMUapTaTC2rn/eBYg2fsG2L+CvJd+ttFbk0ylDnpTO3wVhosmE1tQEvcebbBeKLCwScQSQ==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "dev": true + }, + "node_modules/typedarray.prototype.slice": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typedarray.prototype.slice/-/typedarray.prototype.slice-1.0.5.tgz", + "integrity": "sha512-q7QNVDGTdl702bVFiI5eY4l/HkgCM6at9KhcFbgUAzezHFbOVy4+0O/lCjsABEQwbZPravVfBIiBVGo89yzHFg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "math-intrinsics": "^1.1.0", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-offset": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unherit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", + "integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==", + "dev": true, + "dependencies": { + "inherits": "^2.0.0", + "xtend": "^4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", + "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "dev": true, + "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" + } + }, + "node_modules/unique-concat": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/unique-concat/-/unique-concat-0.2.2.tgz", + "integrity": "sha512-nFT3frbsvTa9rrc71FJApPqXF8oIhVHbX3IWgObQi1mF7WrW48Ys70daL7o4evZUtmUf6Qn6WK0LbHhyO0hpXw==", + "dev": true + }, + "node_modules/unist-util-is": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz", + "integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove-position": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz", + "integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==", + "dev": true, + "dependencies": { + "unist-util-visit": "^1.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove-position/node_modules/unist-util-is": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", + "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "dev": true + }, + "node_modules/unist-util-remove-position/node_modules/unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "dependencies": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "node_modules/unist-util-remove-position/node_modules/unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "dev": true, + "dependencies": { + "unist-util-is": "^3.0.0" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", + "dev": true + }, + "node_modules/unist-util-visit": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vfile": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", + "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + }, + "node_modules/vfile-location": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz", + "integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", + "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "dev": true, + "dependencies": { + "unist-util-stringify-position": "^1.1.1" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", + "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "dependencies": { + "mkdirp": "^0.5.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==", + "dev": true + }, + "node_modules/xml-escape": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz", + "integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==", + "dev": true + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + } + }, + "dependencies": { + "@azu/format-text": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@azu/format-text/-/format-text-1.0.2.tgz", + "integrity": "sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==", + "dev": true + }, + "@azu/style-format": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@azu/style-format/-/style-format-1.0.1.tgz", + "integrity": "sha512-AHcTojlNBdD/3/KxIKlg8sxIWHfOtQszLvOpagLTO+bjC3u7SAszu1lf//u7JJC50aUSH+BVWDD/KvaA6Gfn5g==", + "dev": true, + "requires": { + "@azu/format-text": "^1.0.1" + } + }, + "@textlint/ast-node-types": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.4.3.tgz", + "integrity": "sha512-qi2jjgO6Tn3KNPGnm6B7p6QTEPvY95NFsIAaJuwbulur8iJUEenp1OnoUfiDaC/g2WPPEFkcfXpmnu8XEMFo2A==", + "dev": true + }, + "@textlint/ast-tester": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@textlint/ast-tester/-/ast-tester-2.3.5.tgz", + "integrity": "sha512-sbw0Edx22/Fa9fwObpus5KyhCnGKhyP1tU7flA7kwTi9EqQq2KFztz1c/QQWpgqymbdSPWg7HpAvGf4ru4FDZg==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "@textlint/ast-traverse": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@textlint/ast-traverse/-/ast-traverse-2.3.5.tgz", + "integrity": "sha512-yo1gIoXDx2bNs1JjC9viRxJpErNsfPtzb585KcVwWxxWmu3tXlT2iz13iKdjj5FMYPJe/PORe7lYqymkSUZ7kg==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "@textlint/feature-flag": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/feature-flag/-/feature-flag-3.3.5.tgz", + "integrity": "sha512-S4JhbDQGu1Sutnvqs96nwxqwaErHrL49/QQDR8i/YNsINlurfKJbmktotb+w+qzeSibDibKzB8feOMVBXmO9Ww==", + "dev": true, + "requires": { + "map-like": "^2.0.0" + } + }, + "@textlint/fixer-formatter": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/fixer-formatter/-/fixer-formatter-3.3.5.tgz", + "integrity": "sha512-FHfOQLvJV88vgAI9wwbAjtffo4ZtAW0bV8xkC3dY2DdVyo+7Tnhz0l2XPw2VFmyzpeHx9Slqw8nEv46YEs4JaQ==", + "dev": true, + "requires": { + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "debug": "^4.3.1", + "diff": "^4.0.2", + "is-file": "^1.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1" + } + }, + "@textlint/get-config-base-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@textlint/get-config-base-dir/-/get-config-base-dir-2.0.0.tgz", + "integrity": "sha512-J3cG1pl2llYD4ZaZMe0qVgVaHT8RvT+/SW1FHQ8HRceNalMM9O0Y8iIgtl4GGOx4vMghoIPKFVLASw8P8bJ3ZA==", + "dev": true + }, + "@textlint/kernel": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@textlint/kernel/-/kernel-3.4.5.tgz", + "integrity": "sha512-KGeOq4mbjPe3okDtPw7mbnTX/wP66ndmRKAoOz8gOKDIDRlH8nOG/av6k6xbVhdMk9+ZnomqU8jSSYwTZHzAnA==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-tester": "^2.3.5", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/source-code-fixer": "^3.4.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "map-like": "^2.0.0", + "structured-source": "^3.0.2" + } + }, + "@textlint/linter-formatter": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-3.3.5.tgz", + "integrity": "sha512-ujQwgGGK4nVYRuNeW8zDyxax2Z8FTRips5f3VBhWpJaR7hlqdh1iNahul8iJ+1JbfXiHm+51a01myoqGGh1ENA==", + "dev": true, + "requires": { + "@azu/format-text": "^1.0.1", + "@azu/style-format": "^1.0.0", + "@textlint/module-interop": "^1.2.5", + "@textlint/types": "^1.5.5", + "chalk": "^1.1.3", + "concat-stream": "^1.6.2", + "debug": "^4.3.1", + "is-file": "^1.0.0", + "js-yaml": "^3.14.1", + "optionator": "^0.9.1", + "pluralize": "^2.0.0", + "string-width": "^1.0.2", + "strip-ansi": "^6.0.0", + "table": "^3.8.3", + "text-table": "^0.2.0", + "try-resolve": "^1.0.1", + "xml-escape": "^1.1.0" + } + }, + "@textlint/markdown-to-ast": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-6.3.5.tgz", + "integrity": "sha512-DjVEy61klC8OjQYP+iIukI95pjCM58jhpE046apqGWLo6JQSatfscJlcxmbRivfTQSVsa00RF2ciUFBmw3bobg==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3", + "debug": "^4.3.1", + "remark-frontmatter": "^1.3.3", + "remark-parse": "^5.0.0", + "structured-source": "^3.0.2", + "traverse": "^0.6.6", + "unified": "^6.2.0" + } + }, + "@textlint/module-interop": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-1.2.5.tgz", + "integrity": "sha512-+yEluCSbj6oxk9ENFojVcSxURvXOg7AU3vBiVHPjPEShaqbzZZ6tcut6gbDcIYhEDUkegZGmGwyfOe+wNABhKw==", + "dev": true + }, + "@textlint/regexp-string-matcher": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@textlint/regexp-string-matcher/-/regexp-string-matcher-1.1.1.tgz", + "integrity": "sha512-rrNUCKGKYBrZALotSF8D5A8xD05VHX6kxv0BP805Ig2M73Ha6LK+de31+ZocGm4CO+sikVFYyMCPPJhp7bCXcw==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0", + "execall": "^2.0.0", + "lodash.sortby": "^4.7.0", + "lodash.uniq": "^4.5.0", + "lodash.uniqwith": "^4.5.0", + "to-regex": "^3.0.2" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, + "@textlint/source-code-fixer": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@textlint/source-code-fixer/-/source-code-fixer-3.4.5.tgz", + "integrity": "sha512-YUcBg6zs7H5ycLwWdfv5LHWlBx7iBAQL6vHY2uPw8AMPYgzU6/f91NGBU/QR7/FVw0e7v9zMngcRN1hMOxpFCw==", + "dev": true, + "requires": { + "@textlint/types": "^1.5.5", + "debug": "^4.3.1" + } + }, + "@textlint/text-to-ast": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@textlint/text-to-ast/-/text-to-ast-3.3.5.tgz", + "integrity": "sha512-+1+Kj7wuQHgc43RowVN/KWz3/aevk2RHARX8/p9Y+pE25HRJ36KZo1PLSYYx82NnWpvZTXB3QONWiAukdv6jBg==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "@textlint/textlint-plugin-markdown": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/@textlint/textlint-plugin-markdown/-/textlint-plugin-markdown-5.3.5.tgz", + "integrity": "sha512-x1/DJa+6wsR4LwkL+JA5OdEoZ/PhxtkKb20IqHTsLwQIeDL4aNWT6GrAk0HKTOomzsyNrUBuvzYiCy/f75LtBw==", + "dev": true, + "requires": { + "@textlint/markdown-to-ast": "^6.3.5" + } + }, + "@textlint/textlint-plugin-text": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@textlint/textlint-plugin-text/-/textlint-plugin-text-4.3.5.tgz", + "integrity": "sha512-ygjzswWrzlCiNNCy1+WF0oI8tNCk+1fS/nJEtG7DHuTVvE0OTn4MdWJXOD8sd+ZffXr+uFmEqMisHo06+RpQCg==", + "dev": true, + "requires": { + "@textlint/text-to-ast": "^3.3.5" + } + }, + "@textlint/types": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@textlint/types/-/types-1.5.5.tgz", + "integrity": "sha512-80P6fcqgsG9bP6JgR6W/E/oIx+71pplaicYCvvB4vMIeGk0OnWls4Q21kCpDYmq/C/ABtZ/Gy/Ov/8ExQPeQ7A==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3" + } + }, + "@textlint/utils": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@textlint/utils/-/utils-1.2.5.tgz", + "integrity": "sha512-2vgz4x3tKK+R9N0OlOovJClRCHubxZi86ki218cvRVpoU9pPrHwkwZud+rjItDl2xFBj7Gujww7c0W1wyytWVQ==", + "dev": true + }, + "@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "dev": true + }, + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha512-I/bSHSNEcFFqXLf91nchoNB9D1Kie3QKcWdchYUaoIg1+1bdWDkdfdlvdIOJbi9U8xR0y+MWc5D+won9v95WlQ==", + "dev": true, + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha512-vuBv+fm2s6cqUyey2A7qYcvsik+GMDJsw8BARP2sDE76cqmaZVarsvHf7Vx6VJ0Xk8gLl+u3MoAPf6gKzJefeA==", + "dev": true, + "requires": {} + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + } + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==", + "dev": true + }, + "async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true + }, + "available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "requires": { + "possible-typed-array-names": "^1.0.0" + } + }, + "bail": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "boundary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", + "integrity": "sha512-AaLhxHwYVh55iOTJncV3DE5o7RakEUSSj64XXEWRTiIhlp7aDI8qR0vY/k8Uw0Z234VjZi/iG/WxfrvqYPUCww==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + } + }, + "call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + } + }, + "call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "character-entities": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==", + "dev": true + }, + "character-entities-legacy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==", + "dev": true + }, + "character-reference-invalid": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==", + "dev": true + }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true + }, + "clone-regexp": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", + "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", + "dev": true, + "requires": { + "is-regexp": "^2.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true + }, + "collapse-white-space": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz", + "integrity": "sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==", + "dev": true + }, + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true + }, + "data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + } + }, + "data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + } + }, + "data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + } + }, + "debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "deep-equal": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.2.tgz", + "integrity": "sha512-5tdhKF6DbU7iIzrIOa1AOUt39ZRm13cmL1cGEh//aqR8x9+tNfbywRf0n5FD/18OKMdo7DNEtrX2t22ZAkI+eg==", + "dev": true, + "requires": { + "is-arguments": "^1.1.1", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.5.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "requires": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + } + }, + "define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "dev": true + }, + "dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + } + }, + "entities": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", + "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==", + "dev": true + }, + "error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz", + "integrity": "sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + } + }, + "es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true + }, + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true + }, + "es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0" + } + }, + "es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + } + }, + "es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "requires": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "execall": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/execall/-/execall-2.0.0.tgz", + "integrity": "sha512-0FU2hZ5Hh6iQnarpRtQurM/aAvp3RIbfvgLHrcqJYzhXyV2KFruhuChf9NC6waAhiUR7FFtlugkI4p7f2Fqlow==", + "dev": true, + "requires": { + "clone-regexp": "^2.1.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fault": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", + "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", + "dev": true, + "requires": { + "format": "^0.2.0" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, + "for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "requires": { + "is-callable": "^1.2.7" + } + }, + "format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + }, + "function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, + "generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true + }, + "get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + } + }, + "get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + } + }, + "get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true + }, + "get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + } + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "requires": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + } + }, + "gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true + }, + "has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "requires": { + "es-define-property": "^1.0.0" + } + }, + "has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.0" + } + }, + "has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.3" + } + }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz", + "integrity": "sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + }, + "is-alphabetical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==", + "dev": true + }, + "is-alphanumerical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", + "dev": true, + "requires": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + } + }, + "is-arguments": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + } + }, + "is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "requires": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + } + }, + "is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "requires": { + "has-bigints": "^1.0.2" + } + }, + "is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true + }, + "is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "requires": { + "hasown": "^2.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz", + "integrity": "sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + }, + "is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + } + }, + "is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + } + }, + "is-decimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==", + "dev": true + }, + "is-descriptor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.3.tgz", + "integrity": "sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.1", + "is-data-descriptor": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "is-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-file/-/is-file-1.0.0.tgz", + "integrity": "sha512-ZGMuc+xA8mRnrXtmtf2l/EkIW2zaD2LSBWlaOVEF6yH4RTndHob65V4SwWWdtGKVthQfXPVKsXqw4TDUjbVxVQ==", + "dev": true + }, + "is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "requires": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + } + }, + "is-hexadecimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", + "dev": true + }, + "is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true + }, + "is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true + }, + "is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + } + }, + "is-regexp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", + "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==", + "dev": true + }, + "is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true + }, + "is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + } + }, + "is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + } + }, + "is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "requires": { + "which-typed-array": "^1.1.16" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==", + "dev": true + }, + "is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true + }, + "is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + } + }, + "is-whitespace-character": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", + "integrity": "sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==", + "dev": true + }, + "is-word-character": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.4.tgz", + "integrity": "sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true + }, + "js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-stable-stringify": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz", + "integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, + "jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "requires": { + "uc.micro": "^1.0.1" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "dev": true + }, + "lodash.differencewith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.differencewith/-/lodash.differencewith-4.5.0.tgz", + "integrity": "sha512-/8JFjydAS+4bQuo3CpLMBv7WxGFyk7/etOAsrQUCu0a9QVDemxv0YQ0rFyeZvqlUD314SERfNlgnlqqHmaQ0Cg==", + "dev": true + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, + "lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==", + "dev": true + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha512-mmPrW0Fh2fxOzdBbFv4g1m6pR72haFLPJ2G5SJEELf1y+iaQrDG6cWCPjy54RHYbZAt7X+ls690Kw62AdWXBzQ==", + "dev": true, + "requires": { + "chalk": "^1.0.0" + } + }, + "map-like": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-like/-/map-like-2.0.0.tgz", + "integrity": "sha512-CbgcN622YzXC+k9oUroBSPFVX4in/w66mab/zpvSfFeUezSGD8C13c2RetyM1eo1jkp3sKrzvmf2HFEp5QOdZA==", + "dev": true + }, + "markdown-escapes": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz", + "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==", + "dev": true + }, + "markdown-it": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.0.2.tgz", + "integrity": "sha512-4Lkvjbv2kK+moL9TbeV+6/NHx+1Q+R/NIdUlFlkqkkzUcTod4uiyTJRiBidKR9qXSdkNFkgv+AELY8KN9vSgVA==", + "dev": true, + "requires": { + "argparse": "^2.0.1", + "entities": "~2.0.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + } + } + }, + "markdownlint": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.22.0.tgz", + "integrity": "sha512-J4B+iMc12pOdp/wfYi03W2qfAfEyiZzq3qvQh/8vOMNU8vXYY6Jg440EY7dWTBCqROhb1i4nAn3BTByJ5kdx1w==", + "dev": true, + "requires": { + "markdown-it": "12.0.2" + } + }, + "markdownlint-cli": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.26.0.tgz", + "integrity": "sha512-biLfeGNZG9nw0yJbtFBzRlew2/P5w7JSseKwolSox3zejs7dLpGvPgqbC+iqJnqqGWcWLtXaXh8bBEKWmfl10A==", + "dev": true, + "requires": { + "commander": "~6.2.1", + "deep-extend": "~0.6.0", + "get-stdin": "~8.0.0", + "glob": "~7.1.6", + "ignore": "~5.1.8", + "js-yaml": "~3.14.1", + "jsonc-parser": "~3.0.0", + "lodash.differencewith": "~4.5.0", + "lodash.flatten": "~4.4.0", + "markdownlint": "~0.22.0", + "markdownlint-rule-helpers": "~0.13.0", + "minimatch": "~3.0.4", + "minimist": "~1.2.5", + "rc": "~1.2.8" + } + }, + "markdownlint-rule-helpers": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.13.0.tgz", + "integrity": "sha512-rRY0itbcHG4e+ntz0bbY3AIceSJMKS0TafEMgEtKVHRZ54/JUSy6/4ypCL618RlJvYRej+xMLxX5nkJqIeTZaQ==", + "dev": true + }, + "math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true + }, + "md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true + }, + "minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true + }, + "object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true + }, + "object-is": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", + "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + } + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + } + }, + "own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true + }, + "parse-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "dev": true, + "requires": { + "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" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-to-glob-pattern": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-to-glob-pattern/-/path-to-glob-pattern-1.0.2.tgz", + "integrity": "sha512-ryF65N5MBB9XOjE5mMOi+0bMrh1F0ORQmqDSSERvv5zD62Cfc5QC6rK1AR1xuDIG1I091CkNENblbteWy1bXgw==", + "dev": true + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pluralize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-2.0.0.tgz", + "integrity": "sha512-TqNZzQCD4S42De9IfnnBvILN7HAW7riLqsCyp8lgjXeysyPlX5HhqKAcJHHHb9XskE4/a+7VGC9zzx8Ls0jOAw==", + "dev": true + }, + "possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "rc-config-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-3.0.0.tgz", + "integrity": "sha512-bwfUSB37TWkHfP+PPjb/x8BUjChFmmBK44JMfVnU7paisWqZl/o5k7ttCH+EQLnrbn2Aq8Fo1LAsyUiz+WF4CQ==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.1", + "require-from-string": "^2.0.2" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "dependencies": { + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + } + } + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "requires": { + "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" + } + }, + "reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + } + }, + "remark-frontmatter": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.3.tgz", + "integrity": "sha512-fM5eZPBvu2pVNoq3ZPW22q+5Ativ1oLozq2qYt9I2oNyxiUd/tDl0iLLntEVAegpZIslPWg1brhcP1VsaSVUag==", + "dev": true, + "requires": { + "fault": "^1.0.1", + "xtend": "^4.0.1" + } + }, + "remark-parse": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", + "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "dev": true, + "requires": { + "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" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha512-vuNYXC7gG7IeVNBC1xUllqCcZKRbJoSPOBhnTEcAIiKCsbuef6zO3F0Rve3isPMMoNoQRWjQwbAgAjHUHniyEA==", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "requires": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg==", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + } + }, + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true + }, + "set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + } + }, + "set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + } + }, + "set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + } + }, + "side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + } + }, + "side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + } + }, + "side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + } + }, + "side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + } + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha512-up04hB2hR92PgjpyU3y/eg91yIBILyjVY26NvvciY3EVVPjybkMszMpXQ9QAkcS3I5rtJBDLoTxxg+qvW8c7rw==", + "dev": true + }, + "spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.23", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz", + "integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "state-toggle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", + "integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==", + "dev": true + }, + "stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + } + }, + "string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + } + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true + }, + "structured-source": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-3.0.2.tgz", + "integrity": "sha512-Ap7JHfKgmH40SUjumqyKTHYHNZ8GvGQskP34ks0ElHCDEig+bYGpmXVksxPSrgcY9rkJqhVMzfeg5GIpZelfpQ==", + "dev": true, + "requires": { + "boundary": "^1.0.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha512-RZuzIOtzFbprLCE0AXhkI0Xi42ZJLZhCC+qkwuMLf/Vjz3maWpA8gz1qMdbmNoI9cOROT2Am/DxeRyXenrL11g==", + "dev": true, + "requires": { + "ajv": "^4.7.0", + "ajv-keywords": "^1.0.0", + "chalk": "^1.1.1", + "lodash": "^4.0.0", + "slice-ansi": "0.0.4", + "string-width": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "textlint": { + "version": "11.9.1", + "resolved": "https://registry.npmjs.org/textlint/-/textlint-11.9.1.tgz", + "integrity": "sha512-7eC76od8ILhLl3O10h1rd0QxlVaQkR1nqTD7PrszrlGGe8mXS2VNaOXEiAm8PPUMQBdjB5n8/cpeZ+AbDJdNTw==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.4.3", + "@textlint/ast-traverse": "^2.3.5", + "@textlint/feature-flag": "^3.3.5", + "@textlint/fixer-formatter": "^3.3.5", + "@textlint/kernel": "^3.4.5", + "@textlint/linter-formatter": "^3.3.5", + "@textlint/module-interop": "^1.2.5", + "@textlint/textlint-plugin-markdown": "^5.3.5", + "@textlint/textlint-plugin-text": "^4.3.5", + "@textlint/types": "^1.5.5", + "@textlint/utils": "^1.2.5", + "debug": "^4.3.1", + "deep-equal": "^1.1.1", + "file-entry-cache": "^5.0.1", + "get-stdin": "^5.0.1", + "glob": "^7.1.7", + "is-file": "^1.0.0", + "log-symbols": "^1.0.2", + "map-like": "^2.0.0", + "md5": "^2.3.0", + "mkdirp": "^0.5.0", + "optionator": "^0.9.1", + "path-to-glob-pattern": "^1.0.2", + "rc-config-loader": "^3.0.0", + "read-pkg": "^1.1.0", + "read-pkg-up": "^3.0.0", + "structured-source": "^3.0.2", + "try-resolve": "^1.0.1", + "unique-concat": "^0.2.2" + }, + "dependencies": { + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==", + "dev": true + } + } + }, + "textlint-filter-rule-comments": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/textlint-filter-rule-comments/-/textlint-filter-rule-comments-1.3.0.tgz", + "integrity": "sha512-kSk/XcZYKYe4sb44XhYAYPeMFtqKJIMtcju/jwyZxpkn8gRuRMZ4+rB0wJmGRrD0c8tx3hHDAH1JY9ccahMKcA==", + "dev": true + }, + "textlint-filter-rule-whitelist": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/textlint-filter-rule-whitelist/-/textlint-filter-rule-whitelist-2.0.0.tgz", + "integrity": "sha512-6FBQJZWq2UO1UoX1Z/t3e9vRmQbOF1Z9xRsOUnEzAsd+dGiMrbByE+vaj9SSkLaFzXREIqtg5Widd7ZPF5GOIg==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.0.2", + "@textlint/get-config-base-dir": "^2.0.0", + "@textlint/regexp-string-matcher": "^1.0.2", + "rc-config-loader": "^2.0.1" + }, + "dependencies": { + "rc-config-loader": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-2.0.5.tgz", + "integrity": "sha512-T464K2MQlnNWOblUDIglpFhyN+zYJq7jSlL++/N0hUkcmIXeNFumwXFVdtf8qhUGohn4RYQ0wdi74R575I44PQ==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.0", + "object-assign": "^4.1.0", + "object-keys": "^1.0.12", + "path-exists": "^3.0.0", + "require-from-string": "^2.0.2" + } + } + } + }, + "textlint-rule-helper": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/textlint-rule-helper/-/textlint-rule-helper-2.5.0.tgz", + "integrity": "sha512-QIbFPtyqLy0g5BJn8mryk9iHzGYicNaFIpLFPiEnb4RXxrEGeQ2W2aARQ9yEXLIAqo+OwK4ndWBAWkbgJEPzTQ==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^15.2.1", + "structured-source": "^4.0.0", + "unist-util-visit": "^2.0.3" + }, + "dependencies": { + "@textlint/ast-node-types": { + "version": "15.5.2", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-15.5.2.tgz", + "integrity": "sha512-fCaOxoup5LIyBEo7R1oYWE7V4bSX0KQeHh66twon9e9usaLE3ijgF8QjYsR6joCssdeCHVd0wHm7ppsEyTr6vg==", + "dev": true + }, + "boundary": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", + "integrity": "sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==", + "dev": true + }, + "structured-source": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-4.0.0.tgz", + "integrity": "sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==", + "dev": true, + "requires": { + "boundary": "^2.0.0" + } + } + } + }, + "textlint-rule-terminology": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/textlint-rule-terminology/-/textlint-rule-terminology-2.1.6.tgz", + "integrity": "sha512-3OdV/0DE8RpIYcshz+5wFaDwNYIlqfsBA8TODgNd68T339rn+K69ak5hoXUBSSuTousbAbCFDPqTILG20os44A==", + "dev": true, + "requires": { + "lodash": "^4.17.15", + "strip-json-comments": "^3.0.1", + "textlint-rule-helper": "^2.1.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "traverse": { + "version": "0.6.11", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.11.tgz", + "integrity": "sha512-vxXDZg8/+p3gblxB6BhhG5yWVn1kGRlaL8O78UDXc3wRnPizB5g83dcvWV1jpDMIPnjZjOFuxlMmE82XJ4407w==", + "dev": true, + "requires": { + "gopd": "^1.2.0", + "typedarray.prototype.slice": "^1.0.5", + "which-typed-array": "^1.1.18" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==", + "dev": true + }, + "trim-trailing-lines": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.4.tgz", + "integrity": "sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==", + "dev": true + }, + "trough": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "dev": true + }, + "try-resolve": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", + "integrity": "sha512-yHeaPjCBzVaXwWl5IMUapTaTC2rn/eBYg2fsG2L+CvJd+ttFbk0ylDnpTO3wVhosmE1tQEvcebbBeKLCwScQSQ==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + } + }, + "typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + } + }, + "typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + } + }, + "typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "dev": true + }, + "typedarray.prototype.slice": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typedarray.prototype.slice/-/typedarray.prototype.slice-1.0.5.tgz", + "integrity": "sha512-q7QNVDGTdl702bVFiI5eY4l/HkgCM6at9KhcFbgUAzezHFbOVy4+0O/lCjsABEQwbZPravVfBIiBVGo89yzHFg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "math-intrinsics": "^1.1.0", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-offset": "^1.0.4" + } + }, + "uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, + "unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + } + }, + "unherit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", + "integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==", + "dev": true, + "requires": { + "inherits": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "unified": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", + "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "dev": true, + "requires": { + "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" + } + }, + "unique-concat": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/unique-concat/-/unique-concat-0.2.2.tgz", + "integrity": "sha512-nFT3frbsvTa9rrc71FJApPqXF8oIhVHbX3IWgObQi1mF7WrW48Ys70daL7o4evZUtmUf6Qn6WK0LbHhyO0hpXw==", + "dev": true + }, + "unist-util-is": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz", + "integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==", + "dev": true + }, + "unist-util-remove-position": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz", + "integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==", + "dev": true, + "requires": { + "unist-util-visit": "^1.1.0" + }, + "dependencies": { + "unist-util-is": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", + "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "dev": true + }, + "unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "requires": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "dev": true, + "requires": { + "unist-util-is": "^3.0.0" + } + } + } + }, + "unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", + "dev": true + }, + "unist-util-visit": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + } + }, + "unist-util-visit-parents": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vfile": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", + "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", + "dev": true, + "requires": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + }, + "vfile-location": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz", + "integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA==", + "dev": true + }, + "vfile-message": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", + "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "dev": true, + "requires": { + "unist-util-stringify-position": "^1.1.1" + } + }, + "which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "requires": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + } + }, + "which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "requires": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + } + }, + "which-typed-array": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", + "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + } + }, + "word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, + "x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==", + "dev": true + }, + "xml-escape": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz", + "integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==", + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + } + } +}