From 1a22f3ab23af6b6f0d8f0911b9f58f5b17592570 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Sun, 26 Jul 2020 11:52:41 +0900 Subject: [PATCH] Update dev dependencies. --- package-lock.json | 948 +++------ package.json | 4 +- test/vendor/mocha.js | 4617 ++++++++++++++++++++++-------------------- 3 files changed, 2755 insertions(+), 2814 deletions(-) diff --git a/package-lock.json b/package-lock.json index e2bf08c..fecd5aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,27 +5,27 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", "dev": true, "requires": { - "@babel/highlight": "^7.8.3" + "@babel/highlight": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", "dev": true }, "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.9.0", + "@babel/helper-validator-identifier": "^7.10.4", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -50,9 +50,9 @@ "dev": true }, "acorn": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", - "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", + "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==", "dev": true }, "acorn-jsx": { @@ -62,9 +62,9 @@ "dev": true }, "ajv": { - "version": "6.12.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", - "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", + "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -74,28 +74,11 @@ } }, "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "dev": true }, - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - }, - "dependencies": { - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true - } - } - }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -130,6 +113,18 @@ "sprintf-js": "~1.0.2" } }, + "array.prototype.map": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", + "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "es-array-method-boxes-properly": "^1.0.0", + "is-string": "^1.0.4" + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -149,9 +144,9 @@ "dev": true }, "binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, "brace-expansion": { @@ -206,9 +201,9 @@ } }, "chalk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", - "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -257,12 +252,6 @@ } } }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -270,36 +259,21 @@ "dev": true }, "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", + "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.1", + "fsevents": "~2.1.2", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" + "readdirp": "~3.3.0" } }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -317,29 +291,6 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -366,16 +317,10 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "comment-parser": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.4.tgz", - "integrity": "sha512-Nnl77/mt6sj1BiYSVMeMWzvD0183F2MFOJyFRmZHimUVDYS9J40AvXpiFA7RpU5pQH+HkvYc0dnsHpwW2xmbyQ==", + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.5.tgz", + "integrity": "sha512-iH9YA35ccw94nx5244GVkpyC9eVTsL71jZz6iz5w6RIf79JLF2AsXHXq9p6Oaohyl3sx5qSMnGsWUDFIAfWL4w==", "dev": true }, "concat-map": { @@ -385,9 +330,9 @@ "dev": true }, "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -435,9 +380,9 @@ } }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "doctrine": { @@ -450,28 +395,58 @@ } }, "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, "es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "version": "1.17.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", + "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", + "is-callable": "^1.2.0", + "is-regex": "^1.1.0", "object-inspect": "^1.7.0", "object-keys": "^1.1.1", "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "dev": true + }, + "es-get-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", + "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", + "dev": true, + "requires": { + "es-abstract": "^1.17.4", + "has-symbols": "^1.0.1", + "is-arguments": "^1.0.4", + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-string": "^1.0.5", + "isarray": "^2.0.5" } }, "es-to-primitive": { @@ -492,9 +467,9 @@ "dev": true }, "eslint": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.0.0.tgz", - "integrity": "sha512-qY1cwdOxMONHJfGqw52UOpZDeqXy8xmD0u8CT6jIstil72jkhURC704W8CFyTPDPllz4z4lu0Ql1+07PG/XdIg==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.5.0.tgz", + "integrity": "sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -503,10 +478,11 @@ "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0", - "eslint-visitor-keys": "^1.1.0", - "espree": "^7.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.0", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^1.3.0", + "espree": "^7.2.0", "esquery": "^1.2.0", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", @@ -516,12 +492,11 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.14", + "lodash": "^4.17.19", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -536,9 +511,9 @@ } }, "eslint-config-blueimp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-blueimp/-/eslint-config-blueimp-2.0.0.tgz", - "integrity": "sha512-FoL6USm4l6rk+npoC/SMsvTmc89jH3D2sH5Hh0/y0fZwYRzn6SPZQ6R1DfLNTrJ5AfWA9y3J25t5bT/+PjtE9Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-blueimp/-/eslint-config-blueimp-2.1.0.tgz", + "integrity": "sha512-Ox/sCVx9gX4yPkk1JTqKLEyGOqrPVjJQvK7m1FCg2zAVgZbzCTw64s4tLW7Svn1yfwVqPeNPX+1LL0iAXjO66Q==", "dev": true }, "eslint-config-prettier": { @@ -551,41 +526,33 @@ } }, "eslint-plugin-jsdoc": { - "version": "25.4.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-25.4.0.tgz", - "integrity": "sha512-FQgEALA8nmxyBORBinKJ7kM2fMcF6pXRdLgPfj0H3q5lalVAcgNxmeuLXownAGiS9Z3jU/fD2VX1gykR77qvfw==", + "version": "30.0.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.0.3.tgz", + "integrity": "sha512-EviSu0Hgc9Bhz00WhA6829KYC9BaP6JWoycOTA1xFxjQ/2XguRlB3r6nGNA/jkmMDQp5dTQ22s1kAJIaC+dE8Q==", "dev": true, "requires": { - "comment-parser": "^0.7.4", + "comment-parser": "^0.7.5", "debug": "^4.1.1", - "jsdoctypeparser": "^6.1.0", + "jsdoctypeparser": "^8.0.0", "lodash": "^4.17.15", "regextras": "^0.7.1", - "semver": "^6.3.0", - "spdx-expression-parse": "^3.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } + "semver": "^7.3.2", + "spdx-expression-parse": "^3.0.1" } }, "eslint-plugin-prettier": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.3.tgz", - "integrity": "sha512-+HG5jmu/dN3ZV3T6eCD7a4BlAySdN7mLIbJYo0z1cFQuI+r2DiTJEFeF68ots93PsnrMxbzIZ2S/ieX+mkrBeQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", + "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0" } }, "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -593,29 +560,29 @@ } }, "eslint-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", - "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" } }, "eslint-visitor-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true }, "espree": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz", - "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.2.0.tgz", + "integrity": "sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g==", "dev": true, "requires": { - "acorn": "^7.1.1", + "acorn": "^7.3.1", "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^1.3.0" } }, "esprima": { @@ -662,21 +629,10 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-diff": { @@ -697,15 +653,6 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", @@ -725,12 +672,13 @@ } }, "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } }, "flat": { @@ -867,15 +815,6 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -914,78 +853,11 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "inquirer": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", - "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "cli-cursor": "^3.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.15", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.5.3", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true }, "is-binary-path": { "version": "2.1.0", @@ -1003,9 +875,9 @@ "dev": true }, "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", "dev": true }, "is-date-object": { @@ -1021,9 +893,9 @@ "dev": true }, "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "is-glob": { @@ -1035,6 +907,12 @@ "is-extglob": "^2.1.1" } }, + "is-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", + "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", + "dev": true + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -1042,14 +920,26 @@ "dev": true }, "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", + "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", "dev": true, "requires": { - "has": "^1.0.3" + "has-symbols": "^1.0.1" } }, + "is-set": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", + "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", + "dev": true + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", @@ -1059,12 +949,34 @@ "has-symbols": "^1.0.1" } }, + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "iterate-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", + "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", + "dev": true + }, + "iterate-value": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", + "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", + "dev": true, + "requires": { + "es-get-iterator": "^1.0.2", + "iterate-iterator": "^1.0.1" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1072,9 +984,9 @@ "dev": true }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -1082,9 +994,9 @@ } }, "jsdoctypeparser": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-6.1.0.tgz", - "integrity": "sha512-UCQBZ3xCUBv/PLfwKAJhp6jmGOSLFNKzrotXGNgbKhWvz27wPsCsVeP7gIcHPElQw2agBmynAitXqhxR58XAmA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-8.0.0.tgz", + "integrity": "sha512-eLCs6s4JqN8TjFJfgdiLHRvogLhOAJz+5RIA2FtoMe6ZDyuvghvppnlIToqAEnVbxRqLMrfnNXpW8FpmR6IMBw==", "dev": true }, "json-schema-traverse": { @@ -1110,19 +1022,18 @@ } }, "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "log-symbols": { @@ -1147,12 +1058,6 @@ } } }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1178,32 +1083,33 @@ } }, "mocha": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", - "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-vefaXfdYI8+Yo8nPZQQi0QO2o+5q9UIMX1jZ1XMmK3+4+CQjc7+B0hPdUeglXiTlr8IHMVRo63IhO9Mzt6fxOg==", "dev": true, "requires": { - "ansi-colors": "3.2.3", + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.0", + "chokidar": "3.3.1", "debug": "3.2.6", - "diff": "3.5.0", + "diff": "4.0.2", "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", + "find-up": "4.1.0", + "glob": "7.1.6", "growl": "1.10.5", "he": "1.2.0", "js-yaml": "3.13.1", "log-symbols": "3.0.0", "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", + "ms": "2.1.2", "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", + "promise.allsettled": "1.0.2", + "serialize-javascript": "3.0.0", + "strip-json-comments": "3.0.1", + "supports-color": "7.1.0", + "which": "2.0.2", "wide-align": "1.1.3", + "workerpool": "6.0.0", "yargs": "13.3.2", "yargs-parser": "13.1.2", "yargs-unparser": "1.6.0" @@ -1218,48 +1124,35 @@ "ms": "^2.1.1" } }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "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" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", "dev": true }, "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "isexe": "^2.0.0" + "has-flag": "^4.0.0" } } } @@ -1270,36 +1163,12 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -1307,9 +1176,9 @@ "dev": true }, "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", "dev": true }, "object-keys": { @@ -1330,16 +1199,6 @@ "object-keys": "^1.0.11" } }, - "object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1349,15 +1208,6 @@ "wrappy": "1" } }, - "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -1372,12 +1222,6 @@ "word-wrap": "^1.2.3" } }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -1388,12 +1232,12 @@ } }, "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "^2.2.0" } }, "p-try": { @@ -1412,9 +1256,9 @@ } }, "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, "path-is-absolute": { @@ -1468,6 +1312,19 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, + "promise.allsettled": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", + "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", + "dev": true, + "requires": { + "array.prototype.map": "^1.0.1", + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "iterate-value": "^1.0.0" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -1475,12 +1332,12 @@ "dev": true }, "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", + "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", "dev": true, "requires": { - "picomatch": "^2.0.4" + "picomatch": "^2.0.7" } }, "regexpp": { @@ -1513,16 +1370,6 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -1532,33 +1379,18 @@ "glob": "^7.1.3" } }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true - }, - "rxjs": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", - "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "semver": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true }, + "serialize-javascript": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz", + "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==", + "dev": true + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -1580,12 +1412,6 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, "slice-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", @@ -1595,14 +1421,6 @@ "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } } }, "spdx-exceptions": { @@ -1634,14 +1452,31 @@ "dev": true }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } } }, "string.prototype.trimend": { @@ -1654,28 +1489,6 @@ "es-abstract": "^1.17.5" } }, - "string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - } - }, - "string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" - } - }, "string.prototype.trimstart": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", @@ -1696,9 +1509,9 @@ } }, "strip-json-comments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", - "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", + "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 }, "supports-color": { @@ -1720,46 +1533,6 @@ "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } } }, "text-table": { @@ -1768,21 +1541,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1792,12 +1550,6 @@ "is-number": "^7.0.0" } }, - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", - "dev": true - }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -1820,13 +1572,10 @@ "dev": true }, "uglify-js": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.3.tgz", - "integrity": "sha512-r5ImcL6QyzQGVimQoov3aL2ZScywrOgBXGndbWrdehKoSvGe/RmiE5Jpw/v+GvxODt6l2tpBXwA7n+qZVlHBMA==", - "dev": true, - "requires": { - "commander": "~2.20.3" - } + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz", + "integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==", + "dev": true }, "uri-js": { "version": "4.2.2", @@ -1838,9 +1587,9 @@ } }, "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", "dev": true }, "which": { @@ -1873,12 +1622,6 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -1906,6 +1649,12 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "workerpool": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", + "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", + "dev": true + }, "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", @@ -1923,29 +1672,6 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -1996,43 +1722,39 @@ "yargs-parser": "^13.1.2" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" } }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "p-limit": "^2.0.0" } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true } } }, diff --git a/package.json b/package.json index efdcd31..65c15ee 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "eslint": "7", "eslint-config-blueimp": "2", "eslint-config-prettier": "6", - "eslint-plugin-jsdoc": "25", + "eslint-plugin-jsdoc": "30", "eslint-plugin-prettier": "3", - "mocha": "7", + "mocha": "8", "prettier": "2", "uglify-js": "3" }, diff --git a/test/vendor/mocha.js b/test/vendor/mocha.js index 5be2b9e..159b647 100644 --- a/test/vendor/mocha.js +++ b/test/vendor/mocha.js @@ -54,6 +54,17 @@ process.removeListener = function(e, fn) { } }; +/** + * Implements listenerCount for 'uncaughtException'. + */ + +process.listenerCount = function(name) { + if (name === 'uncaughtException') { + return uncaughtExceptionHandlers.length; + } + return 0; +}; + /** * Implements uncaughtException listener. */ @@ -193,8 +204,8 @@ global.mocha = mocha; module.exports = global; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/mocha":14,"_process":69,"browser-stdout":41}],2:[function(require,module,exports){ -(function (process,global){ +},{"./lib/mocha":14,"_process":67,"browser-stdout":41}],2:[function(require,module,exports){ +(function (global){ 'use strict'; /** @@ -208,6 +219,7 @@ module.exports = global; var Date = global.Date; var setTimeout = global.setTimeout; var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END; +var isBrowser = require('../utils').isBrowser; /** * Checks if browser notification support exists. @@ -222,7 +234,7 @@ var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END; exports.isCapable = function() { var hasNotificationSupport = 'Notification' in window; var hasPromiseSupport = typeof Promise === 'function'; - return process.browser && hasNotificationSupport && hasPromiseSupport; + return isBrowser() && hasNotificationSupport && hasPromiseSupport; }; /** @@ -364,8 +376,8 @@ function notPermitted(err) { console.error('notification error:', err.message); } -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../../package":90,"../runner":34,"_process":69}],3:[function(require,module,exports){ +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../../package":90,"../runner":34,"../utils":38}],3:[function(require,module,exports){ 'use strict'; /** @@ -551,21 +563,6 @@ Context.prototype.timeout = function(ms) { return this; }; -/** - * Set test timeout `enabled`. - * - * @private - * @param {boolean} enabled - * @return {Context} self - */ -Context.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this.runnable().enableTimeouts(); - } - this.runnable().enableTimeouts(enabled); - return this; -}; - /** * Set or get test slowness threshold `ms`. * @@ -608,12 +605,80 @@ Context.prototype.retries = function(n) { },{}],6:[function(require,module,exports){ 'use strict'; + +var format = require('util').format; + /** + * Factory functions to create throwable error objects * @module Errors */ + /** - * Factory functions to create throwable error objects + * When Mocha throw exceptions (or otherwise errors), it attempts to assign a + * `code` property to the `Error` object, for easier handling. These are the + * potential values of `code`. */ +var constants = { + /** + * An unrecoverable error. + */ + FATAL: 'ERR_MOCHA_FATAL', + + /** + * The type of an argument to a function call is invalid + */ + INVALID_ARG_TYPE: 'ERR_MOCHA_INVALID_ARG_TYPE', + + /** + * The value of an argument to a function call is invalid + */ + INVALID_ARG_VALUE: 'ERR_MOCHA_INVALID_ARG_VALUE', + + /** + * Something was thrown, but it wasn't an `Error` + */ + INVALID_EXCEPTION: 'ERR_MOCHA_INVALID_EXCEPTION', + + /** + * An interface (e.g., `Mocha.interfaces`) is unknown or invalid + */ + INVALID_INTERFACE: 'ERR_MOCHA_INVALID_INTERFACE', + + /** + * A reporter (.e.g, `Mocha.reporters`) is unknown or invalid + */ + INVALID_REPORTER: 'ERR_MOCHA_INVALID_REPORTER', + + /** + * `done()` was called twice in a `Test` or `Hook` callback + */ + MULTIPLE_DONE: 'ERR_MOCHA_MULTIPLE_DONE', + + /** + * No files matched the pattern provided by the user + */ + NO_FILES_MATCH_PATTERN: 'ERR_MOCHA_NO_FILES_MATCH_PATTERN', + + /** + * Known, but unsupported behavior of some kind + */ + UNSUPPORTED: 'ERR_MOCHA_UNSUPPORTED', + + /** + * Invalid state transition occuring in `Mocha` instance + */ + INSTANCE_ALREADY_RUNNING: 'ERR_MOCHA_INSTANCE_ALREADY_RUNNING', + + /** + * Invalid state transition occuring in `Mocha` instance + */ + INSTANCE_ALREADY_DISPOSED: 'ERR_MOCHA_INSTANCE_ALREADY_DISPOSED', + + /** + * Use of `only()` w/ `--forbid-only` results in this error. + */ + FORBIDDEN_EXCLUSIVITY: 'ERR_MOCHA_FORBIDDEN_EXCLUSIVITY' +}; /** * Creates an error object to be thrown when no files to be tested could be found using specified pattern. @@ -625,7 +690,7 @@ Context.prototype.retries = function(n) { */ function createNoFilesMatchPatternError(message, pattern) { var err = new Error(message); - err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN'; + err.code = constants.NO_FILES_MATCH_PATTERN; err.pattern = pattern; return err; } @@ -640,7 +705,7 @@ function createNoFilesMatchPatternError(message, pattern) { */ function createInvalidReporterError(message, reporter) { var err = new TypeError(message); - err.code = 'ERR_MOCHA_INVALID_REPORTER'; + err.code = constants.INVALID_REPORTER; err.reporter = reporter; return err; } @@ -655,7 +720,7 @@ function createInvalidReporterError(message, reporter) { */ function createInvalidInterfaceError(message, ui) { var err = new Error(message); - err.code = 'ERR_MOCHA_INVALID_INTERFACE'; + err.code = constants.INVALID_INTERFACE; err.interface = ui; return err; } @@ -669,7 +734,7 @@ function createInvalidInterfaceError(message, ui) { */ function createUnsupportedError(message) { var err = new Error(message); - err.code = 'ERR_MOCHA_UNSUPPORTED'; + err.code = constants.UNSUPPORTED; return err; } @@ -697,7 +762,7 @@ function createMissingArgumentError(message, argument, expected) { */ function createInvalidArgumentTypeError(message, argument, expected) { var err = new TypeError(message); - err.code = 'ERR_MOCHA_INVALID_ARG_TYPE'; + err.code = constants.INVALID_ARG_TYPE; err.argument = argument; err.expected = expected; err.actual = typeof argument; @@ -716,7 +781,7 @@ function createInvalidArgumentTypeError(message, argument, expected) { */ function createInvalidArgumentValueError(message, argument, value, reason) { var err = new TypeError(message); - err.code = 'ERR_MOCHA_INVALID_ARG_VALUE'; + err.code = constants.INVALID_ARG_VALUE; err.argument = argument; err.value = value; err.reason = typeof reason !== 'undefined' ? reason : 'is invalid'; @@ -732,12 +797,130 @@ function createInvalidArgumentValueError(message, argument, value, reason) { */ function createInvalidExceptionError(message, value) { var err = new Error(message); - err.code = 'ERR_MOCHA_INVALID_EXCEPTION'; + err.code = constants.INVALID_EXCEPTION; + err.valueType = typeof value; + err.value = value; + return err; +} + +/** + * Creates an error object to be thrown when an unrecoverable error occurs. + * + * @public + * @param {string} message - Error message to be displayed. + * @returns {Error} instance detailing the error condition + */ +function createFatalError(message, value) { + var err = new Error(message); + err.code = constants.FATAL; err.valueType = typeof value; err.value = value; return err; } +/** + * Dynamically creates a plugin-type-specific error based on plugin type + * @param {string} message - Error message + * @param {"reporter"|"interface"} pluginType - Plugin type. Future: expand as needed + * @param {string} [pluginId] - Name/path of plugin, if any + * @throws When `pluginType` is not known + * @public + * @returns {Error} + */ +function createInvalidPluginError(message, pluginType, pluginId) { + switch (pluginType) { + case 'reporter': + return createInvalidReporterError(message, pluginId); + case 'interface': + return createInvalidInterfaceError(message, pluginId); + default: + throw new Error('unknown pluginType "' + pluginType + '"'); + } +} + +/** + * Creates an error object to be thrown when a mocha object's `run` method is executed while it is already disposed. + * @param {string} message The error message to be displayed. + * @param {boolean} cleanReferencesAfterRun the value of `cleanReferencesAfterRun` + * @param {Mocha} instance the mocha instance that throw this error + */ +function createMochaInstanceAlreadyDisposedError( + message, + cleanReferencesAfterRun, + instance +) { + var err = new Error(message); + err.code = constants.INSTANCE_ALREADY_DISPOSED; + err.cleanReferencesAfterRun = cleanReferencesAfterRun; + err.instance = instance; + return err; +} + +/** + * Creates an error object to be thrown when a mocha object's `run` method is called while a test run is in progress. + * @param {string} message The error message to be displayed. + */ +function createMochaInstanceAlreadyRunningError(message, instance) { + var err = new Error(message); + err.code = constants.INSTANCE_ALREADY_RUNNING; + err.instance = instance; + return err; +} + +/* + * Creates an error object to be thrown when done() is called multiple times in a test + * + * @public + * @param {Runnable} runnable - Original runnable + * @param {Error} [originalErr] - Original error, if any + * @returns {Error} instance detailing the error condition + */ +function createMultipleDoneError(runnable, originalErr) { + var title; + try { + title = format('<%s>', runnable.fullTitle()); + if (runnable.parent.root) { + title += ' (of root suite)'; + } + } catch (ignored) { + title = format('<%s> (of unknown suite)', runnable.title); + } + var message = format( + 'done() called multiple times in %s %s', + runnable.type ? runnable.type : 'unknown runnable', + title + ); + if (runnable.file) { + message += format(' of file %s', runnable.file); + } + if (originalErr) { + message += format('; in addition, done() received error: %s', originalErr); + } + + var err = new Error(message); + err.code = constants.MULTIPLE_DONE; + err.valueType = typeof originalErr; + err.value = originalErr; + return err; +} + +/** + * Creates an error object to be thrown when `.only()` is used with + * `--forbid-only`. + * @public + * @param {Mocha} mocha - Mocha instance + * @returns {Error} Error with code {@link constants.FORBIDDEN_EXCLUSIVITY} + */ +function createForbiddenExclusivityError(mocha) { + var err = new Error( + mocha.isWorker + ? '`.only` is not supported in parallel mode' + : '`.only` forbidden by --forbid-only' + ); + err.code = constants.FORBIDDEN_EXCLUSIVITY; + return err; +} + module.exports = { createInvalidArgumentTypeError: createInvalidArgumentTypeError, createInvalidArgumentValueError: createInvalidArgumentValueError, @@ -746,10 +929,17 @@ module.exports = { createInvalidReporterError: createInvalidReporterError, createMissingArgumentError: createMissingArgumentError, createNoFilesMatchPatternError: createNoFilesMatchPatternError, - createUnsupportedError: createUnsupportedError + createUnsupportedError: createUnsupportedError, + createInvalidPluginError: createInvalidPluginError, + createMochaInstanceAlreadyDisposedError: createMochaInstanceAlreadyDisposedError, + createMochaInstanceAlreadyRunningError: createMochaInstanceAlreadyRunningError, + createFatalError: createFatalError, + createMultipleDoneError: createMultipleDoneError, + createForbiddenExclusivityError: createForbiddenExclusivityError, + constants: constants }; -},{}],7:[function(require,module,exports){ +},{"util":89}],7:[function(require,module,exports){ 'use strict'; var Runnable = require('./runnable'); @@ -779,6 +969,14 @@ function Hook(title, fn) { */ inherits(Hook, Runnable); +/** + * Resets the state for a next run. + */ +Hook.prototype.reset = function() { + Runnable.prototype.reset.call(this); + delete this._error; +}; + /** * Get or set the test `err`. * @@ -797,6 +995,30 @@ Hook.prototype.error = function(err) { this._error = err; }; +/** + * Returns an object suitable for IPC. + * Functions are represented by keys beginning with `$$`. + * @private + * @returns {Object} + */ +Hook.prototype.serialize = function serialize() { + return { + $$isPending: this.isPending(), + $$titlePath: this.titlePath(), + ctx: { + currentTest: { + title: this.ctx && this.ctx.currentTest && this.ctx.currentTest.title + } + }, + parent: { + root: this.parent.root, + title: this.parent.title + }, + title: this.title, + type: this.type + }; +}; + },{"./runnable":33,"./utils":38}],8:[function(require,module,exports){ 'use strict'; @@ -923,6 +1145,8 @@ module.exports.description = 'BDD or RSpec style [default]'; var Suite = require('../suite'); var errors = require('../errors'); var createMissingArgumentError = errors.createMissingArgumentError; +var createUnsupportedError = errors.createUnsupportedError; +var createForbiddenExclusivityError = errors.createForbiddenExclusivityError; /** * Functions common to more than one interface. @@ -1012,6 +1236,9 @@ module.exports = function(suites, context, mocha) { * @returns {Suite} */ only: function only(opts) { + if (mocha.options.forbidOnly) { + throw createForbiddenExclusivityError(mocha); + } opts.isOnly = true; return this.create(opts); }, @@ -1045,16 +1272,14 @@ module.exports = function(suites, context, mocha) { suite.file = opts.file; suites.unshift(suite); if (opts.isOnly) { - if (mocha.options.forbidOnly && shouldBeTested(suite)) { - throw new Error('`.only` forbidden'); - } - - suite.parent.appendOnlySuite(suite); + suite.markOnly(); } - if (suite.pending) { - if (mocha.options.forbidPending && shouldBeTested(suite)) { - throw new Error('Pending test forbidden'); - } + if ( + suite.pending && + mocha.options.forbidPending && + shouldBeTested(suite) + ) { + throw createUnsupportedError('Pending test forbidden'); } if (typeof opts.fn === 'function') { opts.fn.call(suite); @@ -1085,7 +1310,10 @@ module.exports = function(suites, context, mocha) { * @returns {*} */ only: function(mocha, test) { - test.parent.appendOnlyTest(test); + if (mocha.options.forbidOnly) { + throw createForbiddenExclusivityError(mocha); + } + test.markOnly(); return test; }, @@ -1391,7 +1619,7 @@ module.exports.description = 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"'; },{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){ -(function (process,global){ +(function (global){ 'use strict'; /*! @@ -1403,28 +1631,59 @@ module.exports.description = var escapeRe = require('escape-string-regexp'); var path = require('path'); var builtinReporters = require('./reporters'); -var growl = require('./growl'); +var growl = require('./nodejs/growl'); var utils = require('./utils'); var mocharc = require('./mocharc.json'); var errors = require('./errors'); var Suite = require('./suite'); -var esmUtils = utils.supportsEsModules() ? require('./esm-utils') : undefined; +var esmUtils = utils.supportsEsModules(true) + ? require('./esm-utils') + : undefined; var createStatsCollector = require('./stats-collector'); var createInvalidReporterError = errors.createInvalidReporterError; var createInvalidInterfaceError = errors.createInvalidInterfaceError; +var createMochaInstanceAlreadyDisposedError = + errors.createMochaInstanceAlreadyDisposedError; +var createMochaInstanceAlreadyRunningError = + errors.createMochaInstanceAlreadyRunningError; var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE; var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE; var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE; var sQuote = utils.sQuote; +var debug = require('debug')('mocha:mocha'); exports = module.exports = Mocha; +/** + * A Mocha instance is a finite state machine. + * These are the states it can be in. + */ +var mochaStates = utils.defineConstants({ + /** + * Initial state of the mocha instance + */ + INIT: 'init', + /** + * Mocha instance is running tests + */ + RUNNING: 'running', + /** + * Mocha instance is done running tests and references to test functions and hooks are cleaned. + * You can reset this state by unloading the test files. + */ + REFERENCES_CLEANED: 'referencesCleaned', + /** + * Mocha instance is disposed and can no longer be used. + */ + DISPOSED: 'disposed' +}); + /** * To require local UIs and reporters when running in node. */ -if (!process.browser) { - var cwd = process.cwd(); +if (!utils.isBrowser() && typeof module.paths !== 'undefined') { + var cwd = utils.cwd(); module.paths.push(cwd, path.join(cwd, 'node_modules')); } @@ -1432,11 +1691,6 @@ if (!process.browser) { * Expose internals. */ -/** - * @public - * @class utils - * @memberof Mocha - */ exports.utils = utils; exports.interfaces = require('./interfaces'); /** @@ -1484,6 +1738,11 @@ exports.Test = require('./test'); * @param {number} [options.slow] - Slow threshold value. * @param {number|string} [options.timeout] - Timeout threshold value. * @param {string} [options.ui] - Interface name. + * @param {boolean} [options.parallel] - Run jobs in parallel + * @param {number} [options.jobs] - Max number of worker processes for parallel runs + * @param {MochaRootHookObject} [options.rootHooks] - Hooks to bootstrap the root + * suite with + * @param {boolean} [options.isWorker] - Should be `true` if `Mocha` process is running in a worker process. */ function Mocha(options) { options = utils.assign({}, mocharc, options || {}); @@ -1491,6 +1750,8 @@ function Mocha(options) { this.options = options; // root suite this.suite = new exports.Suite('', new exports.Context(), true); + this._cleanReferencesAfterRun = true; + this._state = mochaStates.INIT; this.grep(options.grep) .fgrep(options.fgrep) @@ -1530,6 +1791,43 @@ function Mocha(options) { this[opt](); } }, this); + + if (options.rootHooks) { + this.rootHooks(options.rootHooks); + } + + /** + * The class which we'll instantiate in {@link Mocha#run}. Defaults to + * {@link Runner} in serial mode; changes in parallel mode. + * @memberof Mocha + * @private + */ + this._runnerClass = exports.Runner; + + /** + * Whether or not to call {@link Mocha#loadFiles} implicitly when calling + * {@link Mocha#run}. If this is `true`, then it's up to the consumer to call + * {@link Mocha#loadFiles} _or_ {@link Mocha#loadFilesAsync}. + * @private + * @memberof Mocha + */ + this._lazyLoadFiles = false; + + /** + * It's useful for a Mocha instance to know if it's running in a worker process. + * We could derive this via other means, but it's helpful to have a flag to refer to. + * @memberof Mocha + * @private + */ + this.isWorker = Boolean(options.isWorker); + + if ( + options.parallel && + (typeof options.jobs === 'undefined' || options.jobs > 1) + ) { + debug('attempting to enable parallel mode'); + this.parallelMode(true); + } } /** @@ -1580,52 +1878,52 @@ Mocha.prototype.addFile = function(file) { * // Use XUnit reporter and direct its output to file * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' }); */ -Mocha.prototype.reporter = function(reporter, reporterOptions) { - if (typeof reporter === 'function') { - this._reporter = reporter; +Mocha.prototype.reporter = function(reporterName, reporterOptions) { + if (typeof reporterName === 'function') { + this._reporter = reporterName; } else { - reporter = reporter || 'spec'; - var _reporter; + reporterName = reporterName || 'spec'; + var reporter; // Try to load a built-in reporter. - if (builtinReporters[reporter]) { - _reporter = builtinReporters[reporter]; + if (builtinReporters[reporterName]) { + reporter = builtinReporters[reporterName]; } // Try to load reporters from process.cwd() and node_modules - if (!_reporter) { + if (!reporter) { try { - _reporter = require(reporter); + reporter = require(reporterName); } catch (err) { if ( - err.code !== 'MODULE_NOT_FOUND' || - err.message.indexOf('Cannot find module') !== -1 + err.code === 'MODULE_NOT_FOUND' || + err.message.indexOf('Cannot find module') >= 0 ) { // Try to load reporters from a path (absolute or relative) try { - _reporter = require(path.resolve(process.cwd(), reporter)); + reporter = require(path.resolve(utils.cwd(), reporterName)); } catch (_err) { - _err.code !== 'MODULE_NOT_FOUND' || - _err.message.indexOf('Cannot find module') !== -1 - ? console.warn(sQuote(reporter) + ' reporter not found') - : console.warn( - sQuote(reporter) + + _err.code === 'MODULE_NOT_FOUND' || + _err.message.indexOf('Cannot find module') >= 0 + ? utils.warn(sQuote(reporterName) + ' reporter not found') + : utils.warn( + sQuote(reporterName) + ' reporter blew up with error:\n' + err.stack ); } } else { - console.warn( - sQuote(reporter) + ' reporter blew up with error:\n' + err.stack + utils.warn( + sQuote(reporterName) + ' reporter blew up with error:\n' + err.stack ); } } } - if (!_reporter) { + if (!reporter) { throw createInvalidReporterError( - 'invalid reporter ' + sQuote(reporter), - reporter + 'invalid reporter ' + sQuote(reporterName), + reporterName ); } - this._reporter = _reporter; + this._reporter = reporter; } this.options.reporterOption = reporterOptions; // alias option name is used in public reporters xunit/tap/progress @@ -1734,7 +2032,7 @@ Mocha.prototype.loadFiles = function(fn) { Mocha.prototype.loadFilesAsync = function() { var self = this; var suite = this.suite; - this.loadAsync = true; + this.lazyLoadFiles(true); if (!esmUtils) { return new Promise(function(resolve) { @@ -1782,7 +2080,18 @@ Mocha.unloadFile = function(file) { * @chainable */ Mocha.prototype.unloadFiles = function() { - this.files.forEach(Mocha.unloadFile); + if (this._state === mochaStates.DISPOSED) { + throw createMochaInstanceAlreadyDisposedError( + 'Mocha instance is already disposed, it cannot be used again.', + this._cleanReferencesAfterRun, + this + ); + } + + this.files.forEach(function(file) { + Mocha.unloadFile(file); + }); + this._state = mochaStates.INIT; return this; }; @@ -1869,37 +2178,51 @@ Mocha.prototype.invert = function() { }; /** - * Enables or disables ignoring global leaks. + * Enables or disables checking for global variables leaked while running tests. * - * @deprecated since v7.0.0 * @public - * @see {@link Mocha#checkLeaks} - * @param {boolean} [ignoreLeaks=false] - Whether to ignore global leaks. + * @see [CLI option](../#-check-leaks) + * @param {boolean} [checkLeaks=true] - Whether to check for global variable leaks. * @return {Mocha} this * @chainable */ -Mocha.prototype.ignoreLeaks = function(ignoreLeaks) { - utils.deprecate( - '"ignoreLeaks()" is DEPRECATED, please use "checkLeaks()" instead.' - ); - this.options.checkLeaks = !ignoreLeaks; +Mocha.prototype.checkLeaks = function(checkLeaks) { + this.options.checkLeaks = checkLeaks !== false; return this; }; /** - * Enables or disables checking for global variables leaked while running tests. - * + * Enables or disables whether or not to dispose after each test run. + * Disable this to ensure you can run the test suite multiple times. + * If disabled, be sure to dispose mocha when you're done to prevent memory leaks. * @public - * @see [CLI option](../#-check-leaks) - * @param {boolean} [checkLeaks=true] - Whether to check for global variable leaks. + * @see {@link Mocha#dispose} + * @param {boolean} cleanReferencesAfterRun * @return {Mocha} this * @chainable */ -Mocha.prototype.checkLeaks = function(checkLeaks) { - this.options.checkLeaks = checkLeaks !== false; +Mocha.prototype.cleanReferencesAfterRun = function(cleanReferencesAfterRun) { + this._cleanReferencesAfterRun = cleanReferencesAfterRun !== false; return this; }; +/** + * Manually dispose this mocha instance. Mark this instance as `disposed` and unable to run more tests. + * It also removes function references to tests functions and hooks, so variables trapped in closures can be cleaned by the garbage collector. + * @public + */ +Mocha.prototype.dispose = function() { + if (this._state === mochaStates.RUNNING) { + throw createMochaInstanceAlreadyRunningError( + 'Cannot dispose while the mocha instance is still running tests.' + ); + } + this.unloadFiles(); + this._previousRunner && this._previousRunner.dispose(); + this.suite.dispose(); + this._state = mochaStates.DISPOSED; +}; + /** * Displays full stack trace upon test failure. * @@ -1925,7 +2248,7 @@ Mocha.prototype.fullTrace = function(fullTrace) { Mocha.prototype.growl = function() { this.options.growl = this.isGrowlCapable(); if (!this.options.growl) { - var detail = process.browser + var detail = utils.isBrowser() ? 'notification support not available in this browser...' : 'notification support prerequisites not installed...'; console.error(detail + ' cannot enable!'); @@ -1983,24 +2306,6 @@ Mocha.prototype.global = function(global) { // for backwards compability, 'globals' is an alias of 'global' Mocha.prototype.globals = Mocha.prototype.global; -/** - * Enables or disables TTY color output by screen-oriented reporters. - * - * @deprecated since v7.0.0 - * @public - * @see {@link Mocha#color} - * @param {boolean} colors - Whether to enable color output. - * @return {Mocha} this - * @chainable - */ -Mocha.prototype.useColors = function(colors) { - utils.deprecate('"useColors()" is DEPRECATED, please use "color()" instead.'); - if (colors !== undefined) { - this.options.color = colors; - } - return this; -}; - /** * Enables or disables TTY color output by screen-oriented reporters. * @@ -2015,25 +2320,6 @@ Mocha.prototype.color = function(color) { return this; }; -/** - * Determines if reporter should use inline diffs (rather than +/-) - * in test failure output. - * - * @deprecated since v7.0.0 - * @public - * @see {@link Mocha#inlineDiffs} - * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs. - * @return {Mocha} this - * @chainable - */ -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - utils.deprecate( - '"useInlineDiffs()" is DEPRECATED, please use "inlineDiffs()" instead.' - ); - this.options.inlineDiffs = inlineDiffs !== undefined && inlineDiffs; - return this; -}; - /** * Enables or disables reporter to use inline diffs (rather than +/-) * in test failure output. @@ -2049,22 +2335,6 @@ Mocha.prototype.inlineDiffs = function(inlineDiffs) { return this; }; -/** - * Determines if reporter should include diffs in test failure output. - * - * @deprecated since v7.0.0 - * @public - * @see {@link Mocha#diff} - * @param {boolean} [hideDiff=false] - Whether to hide diffs. - * @return {Mocha} this - * @chainable - */ -Mocha.prototype.hideDiff = function(hideDiff) { - utils.deprecate('"hideDiff()" is DEPRECATED, please use "diff()" instead.'); - this.options.diff = !(hideDiff === true); - return this; -}; - /** * Enables or disables reporter to include diff in test failure output. * @@ -2090,7 +2360,6 @@ Mocha.prototype.diff = function(diff) { * @public * @see [CLI option](../#-timeout-ms-t-ms) * @see [Timeouts](../#timeouts) - * @see {@link Mocha#enableTimeouts} * @param {number|string} msecs - Timeout threshold value. * @return {Mocha} this * @chainable @@ -2149,22 +2418,6 @@ Mocha.prototype.slow = function(msecs) { return this; }; -/** - * Enables or disables timeouts. - * - * @public - * @see [CLI option](../#-timeout-ms-t-ms) - * @param {boolean} enableTimeouts - Whether to enable timeouts. - * @return {Mocha} this - * @chainable - */ -Mocha.prototype.enableTimeouts = function(enableTimeouts) { - this.suite.enableTimeouts( - arguments.length && enableTimeouts !== undefined ? enableTimeouts : true - ); - return this; -}; - /** * Forces all tests to either accept a `done` callback or return a promise. * @@ -2250,6 +2503,29 @@ Mocha.prototype.forbidPending = function(forbidPending) { return this; }; +/** + * Throws an error if mocha is in the wrong state to be able to transition to a "running" state. + * @private + */ +Mocha.prototype._guardRunningStateTransition = function() { + if (this._state === mochaStates.RUNNING) { + throw createMochaInstanceAlreadyRunningError( + 'Mocha instance is currently running tests, cannot start a next test run until this one is done', + this + ); + } + if ( + this._state === mochaStates.DISPOSED || + this._state === mochaStates.REFERENCES_CLEANED + ) { + throw createMochaInstanceAlreadyDisposedError( + 'Mocha instance is already disposed, cannot start a new test run. Please create a new mocha instance. Be sure to set disable `cleanReferencesAfterRun` when you want to reuse the same mocha instance for multiple test runs.', + this._cleanReferencesAfterRun, + this + ); + } +}; + /** * Mocha version as specified by "package.json". * @@ -2290,13 +2566,23 @@ Object.defineProperty(Mocha.prototype, 'version', { * mocha.run(failures => process.exitCode = failures ? 1 : 0); */ Mocha.prototype.run = function(fn) { - if (this.files.length && !this.loadAsync) { + this._guardRunningStateTransition(); + this._state = mochaStates.RUNNING; + if (this._previousRunner) { + this._previousRunner.dispose(); + this.suite.reset(); + } + if (this.files.length && !this._lazyLoadFiles) { this.loadFiles(); } + var self = this; var suite = this.suite; var options = this.options; options.files = this.files; - var runner = new exports.Runner(suite, options.delay); + var runner = new this._runnerClass(suite, { + delay: options.delay, + cleanReferencesAfterRun: this._cleanReferencesAfterRun + }); createStatsCollector(runner); var reporter = new this._reporter(runner, options); runner.checkLeaks = options.checkLeaks === true; @@ -2321,6 +2607,12 @@ Mocha.prototype.run = function(fn) { exports.reporters.Base.hideDiff = !options.diff; function done(failures) { + self._previousRunner = runner; + if (self._cleanReferencesAfterRun) { + self._state = mochaStates.REFERENCES_CLEANED; + } else { + self._state = mochaStates.INIT; + } fn = fn || utils.noop; if (reporter.done) { reporter.done(failures, fn); @@ -2329,15 +2621,116 @@ Mocha.prototype.run = function(fn) { } } - return runner.run(done); + return runner.run(done, {files: this.files, options: options}); }; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../package.json":90,"./context":5,"./errors":6,"./esm-utils":42,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":69,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){ +/** + * Assigns hooks to the root suite + * @param {MochaRootHookObject} [hooks] - Hooks to assign to root suite + * @chainable + */ +Mocha.prototype.rootHooks = function rootHooks(hooks) { + if (utils.type(hooks) === 'object') { + var beforeAll = [].concat(hooks.beforeAll || []); + var beforeEach = [].concat(hooks.beforeEach || []); + var afterAll = [].concat(hooks.afterAll || []); + var afterEach = [].concat(hooks.afterEach || []); + var rootSuite = this.suite; + beforeAll.forEach(function(hook) { + rootSuite.beforeAll(hook); + }); + beforeEach.forEach(function(hook) { + rootSuite.beforeEach(hook); + }); + afterAll.forEach(function(hook) { + rootSuite.afterAll(hook); + }); + afterEach.forEach(function(hook) { + rootSuite.afterEach(hook); + }); + } + return this; +}; + +/** + * Toggles parallel mode. + * + * Must be run before calling {@link Mocha#run}. Changes the `Runner` class to + * use; also enables lazy file loading if not already done so. + * @param {boolean} [enable] - If `true`, enable; otherwise disable. + * @throws If run in browser + * @throws If Mocha not in "INIT" state + * @returns {Mocha} + * @chainable + * @public + */ +Mocha.prototype.parallelMode = function parallelMode(enable) { + if (utils.isBrowser()) { + throw errors.createUnsupportedError( + 'parallel mode is only supported in Node.js' + ); + } + var parallel = enable === true; + if ( + parallel === this.options.parallel && + this._lazyLoadFiles && + this._runnerClass !== exports.Runner + ) { + return this; + } + if (this._state !== mochaStates.INIT) { + throw errors.createUnsupportedError( + 'cannot change parallel mode after having called run()' + ); + } + this.options.parallel = parallel; + + // swap Runner class + this._runnerClass = parallel + ? require('./nodejs/parallel-buffered-runner') + : exports.Runner; + + // lazyLoadFiles may have been set `true` otherwise (for ESM loading), + // so keep `true` if so. + return this.lazyLoadFiles(this._lazyLoadFiles || parallel); +}; + +/** + * Disables implicit call to {@link Mocha#loadFiles} in {@link Mocha#run}. This + * setting is used by watch mode, parallel mode, and for loading ESM files. + * @todo This should throw if we've already loaded files; such behavior + * necessitates adding a new state. + * @param {boolean} [enable] - If `true`, disable eager loading of files in + * {@link Mocha#run} + * @chainable + * @public + */ +Mocha.prototype.lazyLoadFiles = function lazyLoadFiles(enable) { + this._lazyLoadFiles = enable === true; + debug('set lazy load to %s', enable); + return this; +}; + +/** + * An alternative way to define root hooks that works with parallel runs. + * @typedef {Object} MochaRootHookObject + * @property {Function|Function[]} [beforeAll] - "Before all" hook(s) + * @property {Function|Function[]} [beforeEach] - "Before each" hook(s) + * @property {Function|Function[]} [afterAll] - "After all" hook(s) + * @property {Function|Function[]} [afterEach] - "After each" hook(s) + */ + +/** + * An function that returns a {@link MochaRootHookObject}, either sync or async. + * @callback MochaRootHookFunction + * @returns {MochaRootHookObject|Promise} + */ + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../package.json":90,"./context":5,"./errors":6,"./esm-utils":42,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./nodejs/growl":2,"./nodejs/parallel-buffered-runner":40,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"debug":45,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){ module.exports={ "diff": true, "extension": ["js", "cjs", "mjs"], - "opts": "./test/mocha.opts", "package": "./package.json", "reporter": "spec", "slow": 75, @@ -2374,7 +2767,7 @@ var tty = require('tty'); var diff = require('diff'); var milliseconds = require('ms'); var utils = require('../utils'); -var supportsColor = process.browser ? null : require('supports-color'); +var supportsColor = utils.isBrowser() ? null : require('supports-color'); var constants = require('../runner').constants; var EVENT_TEST_PASS = constants.EVENT_TEST_PASS; var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL; @@ -2401,7 +2794,7 @@ var consoleLog = console.log; */ exports.useColors = - !process.browser && + !utils.isBrowser() && (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined); /** @@ -2887,7 +3280,7 @@ Base.consoleLog = consoleLog; Base.abstract = true; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"_process":67,"diff":48,"ms":58,"supports-color":42,"tty":4}],18:[function(require,module,exports){ 'use strict'; /** * @module Doc @@ -2952,6 +3345,7 @@ function Doc(runner, options) { runner.on(EVENT_TEST_PASS, function(test) { Base.consoleLog('%s
%s
', indent(), utils.escape(test.title)); + Base.consoleLog('%s
%s
', indent(), utils.escape(test.file)); var code = utils.escape(utils.clean(test.body)); Base.consoleLog('%s
%s
', indent(), code); }); @@ -2962,6 +3356,11 @@ function Doc(runner, options) { indent(), utils.escape(test.title) ); + Base.consoleLog( + '%s
%s
', + indent(), + utils.escape(test.file) + ); var code = utils.escape(utils.clean(test.body)); Base.consoleLog( '%s
%s
', @@ -3063,7 +3462,7 @@ inherits(Dot, Base); Dot.description = 'dot matrix representation'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67}],20:[function(require,module,exports){ (function (global){ 'use strict'; @@ -3564,6 +3963,7 @@ function clean(test) { return { title: test.title, fullTitle: test.fullTitle(), + file: test.file, duration: test.duration, currentRetry: test.currentRetry() }; @@ -3572,7 +3972,7 @@ function clean(test) { JSONStream.description = 'newline delimited JSON events'; }).call(this,require('_process')) -},{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){ +},{"../runner":34,"./base":17,"_process":67}],23:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -3663,6 +4063,7 @@ function clean(test) { return { title: test.title, fullTitle: test.fullTitle(), + file: test.file, duration: test.duration, currentRetry: test.currentRetry(), err: cleanCycles(err) @@ -3711,7 +4112,7 @@ function errorJSON(err) { JSONReporter.description = 'single JSON object'; }).call(this,require('_process')) -},{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){ +},{"../runner":34,"./base":17,"_process":67}],24:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -3771,11 +4172,12 @@ function Landing(runner, options) { var self = this; var width = (Base.window.width * 0.75) | 0; - var total = runner.total; var stream = process.stdout; + var plane = color('plane', '✈'); var crashed = -1; var n = 0; + var total = 0; function runway() { var buf = Array(width).join('-'); @@ -3789,8 +4191,7 @@ function Landing(runner, options) { runner.on(EVENT_TEST_END, function(test) { // check if the plane crashed - var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed; - + var col = crashed === -1 ? ((width * ++n) / ++total) | 0 : crashed; // show the crash if (test.state === STATE_FAILED) { plane = color('plane crash', '✈'); @@ -3813,6 +4214,14 @@ function Landing(runner, options) { process.stdout.write('\n'); self.epilogue(); }); + + // if cursor is hidden when we ctrl-C, then it will remain hidden unless... + process.once('SIGINT', function() { + cursor.show(); + process.nextTick(function() { + process.kill(process.pid, 'SIGINT'); + }); + }); } /** @@ -3823,7 +4232,7 @@ inherits(Landing, Base); Landing.description = 'Unicode landing strip'; }).call(this,require('_process')) -},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){ +},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":67}],25:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -3905,7 +4314,7 @@ inherits(List, Base); List.description = 'like "spec" reporter but flat'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67}],26:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -4021,7 +4430,7 @@ function Markdown(runner, options) { Markdown.description = 'GitHub Flavored Markdown'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67}],27:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -4077,7 +4486,7 @@ inherits(Min, Base); Min.description = 'essentially just a summary'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67}],28:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -4357,7 +4766,7 @@ function write(string) { NyanCat.description = '"nyan cat"'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67}],29:[function(require,module,exports){ (function (process){ 'use strict'; /** @@ -4465,7 +4874,7 @@ inherits(Progress, Base); Progress.description = 'a progress bar'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67}],30:[function(require,module,exports){ 'use strict'; /** * @module Spec @@ -4620,9 +5029,7 @@ function TAP(runner, options) { this._producer = createProducer(tapVersion); runner.once(EVENT_RUN_BEGIN, function() { - var ntests = runner.grepTotal(runner.suite); self._producer.writeVersion(); - self._producer.writePlan(ntests); }); runner.on(EVENT_TEST_END, function() { @@ -4774,6 +5181,7 @@ TAPProducer.prototype.writeEpilogue = function(stats) { println('# pass ' + stats.passes); // :TBD: Why are we not showing pending results? println('# fail ' + stats.failures); + this.writePlan(stats.passes + stats.failures + stats.pending); }; /** @@ -4864,7 +5272,7 @@ inherits(TAP13Producer, TAPProducer); TAP.description = 'TAP-compatible output'; }).call(this,require('_process')) -},{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){ +},{"../runner":34,"../utils":38,"./base":17,"_process":67,"util":89}],32:[function(require,module,exports){ (function (process,global){ 'use strict'; /** @@ -4877,7 +5285,6 @@ TAP.description = 'TAP-compatible output'; var Base = require('./base'); var utils = require('../utils'); var fs = require('fs'); -var mkdirp = require('mkdirp'); var path = require('path'); var errors = require('../errors'); var createUnsupportedError = errors.createUnsupportedError; @@ -4930,7 +5337,9 @@ function XUnit(runner, options) { throw createUnsupportedError('file output not supported in browser'); } - mkdirp.sync(path.dirname(options.reporterOptions.output)); + fs.mkdirSync(path.dirname(options.reporterOptions.output), { + recursive: true + }); self.fileStream = fs.createWriteStream(options.reporterOptions.output); } @@ -5084,7 +5493,7 @@ function tag(name, attrs, close, content) { XUnit.description = 'XUnit-compatible XML output'; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){ +},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":67,"fs":42,"path":42}],33:[function(require,module,exports){ (function (global){ 'use strict'; @@ -5093,8 +5502,9 @@ var Pending = require('./pending'); var debug = require('debug')('mocha:runnable'); var milliseconds = require('ms'); var utils = require('./utils'); -var createInvalidExceptionError = require('./errors') - .createInvalidExceptionError; +var errors = require('./errors'); +var createInvalidExceptionError = errors.createInvalidExceptionError; +var createMultipleDoneError = errors.createMultipleDoneError; /** * Save timer references to avoid Sinon interfering (see GH-237). @@ -5123,11 +5533,8 @@ function Runnable(title, fn) { this.sync = !this.async; this._timeout = 2000; this._slow = 75; - this._enableTimeouts = true; - this.timedOut = false; this._retries = -1; - this._currentRetry = 0; - this.pending = false; + this.reset(); } /** @@ -5135,6 +5542,17 @@ function Runnable(title, fn) { */ utils.inherits(Runnable, EventEmitter); +/** + * Resets the state initially or for a next run. + */ +Runnable.prototype.reset = function() { + this.timedOut = false; + this._currentRetry = 0; + this.pending = false; + delete this.state; + delete this.err; +}; + /** * Get current timeout value in msecs. * @@ -5171,10 +5589,12 @@ Runnable.prototype.timeout = function(ms) { // see #1652 for reasoning if (ms === range[0] || ms === range[1]) { - this._enableTimeouts = false; + this._timeout = 0; + } else { + this._timeout = ms; } - debug('timeout %d', ms); - this._timeout = ms; + debug('timeout %d', this._timeout); + if (this.timer) { this.resetTimeout(); } @@ -5200,22 +5620,6 @@ Runnable.prototype.slow = function(ms) { return this; }; -/** - * Set and get whether timeout is `enabled`. - * - * @private - * @param {boolean} enabled - * @return {Runnable|boolean} enabled or Runnable instance. - */ -Runnable.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this._enableTimeouts; - } - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - /** * Halt and mark as pending. * @@ -5310,31 +5714,6 @@ Runnable.prototype.clearTimeout = function() { clearTimeout(this.timer); }; -/** - * Inspect the runnable void of private properties. - * - * @private - * @return {string} - */ -Runnable.prototype.inspect = function() { - return JSON.stringify( - this, - function(key, val) { - if (key[0] === '_') { - return; - } - if (key === 'parent') { - return '#'; - } - if (key === 'ctx') { - return '#'; - } - return val; - }, - 2 - ); -}; - /** * Reset the timeout. * @@ -5342,14 +5721,14 @@ Runnable.prototype.inspect = function() { */ Runnable.prototype.resetTimeout = function() { var self = this; - var ms = this.timeout() || 1e9; + var ms = this.timeout(); - if (!this._enableTimeouts) { + if (ms === 0) { return; } this.clearTimeout(); this.timer = setTimeout(function() { - if (!self._enableTimeouts) { + if (self.timeout() === 0) { return; } self.callback(self._timeoutError(ms)); @@ -5381,7 +5760,9 @@ Runnable.prototype.run = function(fn) { var start = new Date(); var ctx = this.ctx; var finished; - var emitted; + var errorWasHandled = false; + + if (this.isPending()) return fn(); // Sometimes the ctx exists, but it is not runnable if (ctx && ctx.runnable) { @@ -5390,17 +5771,11 @@ Runnable.prototype.run = function(fn) { // called multiple times function multiple(err) { - if (emitted) { + if (errorWasHandled) { return; } - emitted = true; - var msg = 'done() called multiple times'; - if (err && err.message) { - err.message += " (and Mocha's " + msg + ')'; - self.emit('error', err); - } else { - self.emit('error', new Error(msg)); - } + errorWasHandled = true; + self.emit('error', createMultipleDoneError(self, err)); } // finished @@ -5417,7 +5792,7 @@ Runnable.prototype.run = function(fn) { self.clearTimeout(); self.duration = new Date() - start; finished = true; - if (!err && self.duration > ms && self._enableTimeouts) { + if (!err && self.duration > ms && ms > 0) { err = self._timeoutError(ms); } fn(err); @@ -5451,7 +5826,7 @@ Runnable.prototype.run = function(fn) { callFnAsync(this.fn); } catch (err) { // handles async runnables which actually run synchronously - emitted = true; + errorWasHandled = true; if (err instanceof Pending) { return; // done() is already called in this.skip() } else if (this.allowUncaught) { @@ -5464,13 +5839,9 @@ Runnable.prototype.run = function(fn) { // sync or promise-returning try { - if (this.isPending()) { - done(); - } else { - callFn(this.fn); - } + callFn(this.fn); } catch (err) { - emitted = true; + errorWasHandled = true; if (err instanceof Pending) { return done(); } else if (this.allowUncaught) { @@ -5569,7 +5940,11 @@ var constants = utils.defineConstants( /** * Value of `state` prop when a `Runnable` has passed */ - STATE_PASSED: 'passed' + STATE_PASSED: 'passed', + /** + * Value of `state` prop when a `Runnable` has been skipped by user + */ + STATE_PENDING: 'pending' } ); @@ -5592,7 +5967,7 @@ Runnable.toValueOrError = function(value) { Runnable.constants = constants; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){ +},{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":58}],34:[function(require,module,exports){ (function (process,global){ 'use strict'; @@ -5614,8 +5989,8 @@ var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL; var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN; var STATE_FAILED = Runnable.constants.STATE_FAILED; var STATE_PASSED = Runnable.constants.STATE_PASSED; +var STATE_PENDING = Runnable.constants.STATE_PENDING; var dQuote = utils.dQuote; -var ngettext = utils.ngettext; var sQuote = utils.sQuote; var stackFilter = utils.stackTraceFilter(); var stringify = utils.stringify; @@ -5623,6 +5998,7 @@ var type = utils.type; var errors = require('./errors'); var createInvalidExceptionError = errors.createInvalidExceptionError; var createUnsupportedError = errors.createUnsupportedError; +var createFatalError = errors.createFatalError; /** * Non-enumerable globals. @@ -5705,7 +6081,19 @@ var constants = utils.defineConstants( /** * Emitted when {@link Test} execution has failed, but will retry */ - EVENT_TEST_RETRY: 'retry' + EVENT_TEST_RETRY: 'retry', + /** + * Initial state of Runner + */ + STATE_IDLE: 'idle', + /** + * State set to this value when the Runner has started running + */ + STATE_RUNNING: 'running', + /** + * State set to this value when the Runner has stopped + */ + STATE_STOPPED: 'stopped' } ); @@ -5717,21 +6105,32 @@ module.exports = Runner; * @extends external:EventEmitter * @public * @class - * @param {Suite} suite Root suite - * @param {boolean} [delay] Whether or not to delay execution of root suite - * until ready. - */ -function Runner(suite, delay) { + * @param {Suite} suite - Root suite + * @param {Object|boolean} [opts] - Options. If `boolean`, whether or not to delay execution of root suite until ready (for backwards compatibility). + * @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready. + * @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done. + */ +function Runner(suite, opts) { + if (opts === undefined) { + opts = {}; + } + if (typeof opts === 'boolean') { + this._delay = opts; + opts = {}; + } else { + this._delay = opts.delay; + } var self = this; this._globals = []; this._abort = false; - this._delay = delay; this.suite = suite; - this.started = false; + this._opts = opts; + this.state = constants.STATE_IDLE; this.total = suite.total(); this.failures = 0; + this._eventListeners = []; this.on(constants.EVENT_TEST_END, function(test) { - if (test.retriedTest() && test.parent) { + if (test.type === 'test' && test.retriedTest() && test.parent) { var idx = test.parent.tests && test.parent.tests.indexOf(test.retriedTest()); if (idx > -1) test.parent.tests[idx] = test; @@ -5744,6 +6143,8 @@ function Runner(suite, delay) { this._defaultGrep = /.*/; this.grep(this._defaultGrep); this.globals(this.globalProps()); + + this.uncaught = this._uncaught.bind(this); } /** @@ -5759,6 +6160,58 @@ Runner.immediately = global.setImmediate || process.nextTick; */ inherits(Runner, EventEmitter); +/** + * Replacement for `target.on(eventName, listener)` that does bookkeeping to remove them when this runner instance is disposed. + * @param {EventEmitter} target - The `EventEmitter` + * @param {string} eventName - The event name + * @param {string} fn - Listener function + * @private + */ +Runner.prototype._addEventListener = function(target, eventName, listener) { + target.on(eventName, listener); + this._eventListeners.push([target, eventName, listener]); +}; + +/** + * Replacement for `target.removeListener(eventName, listener)` that also updates the bookkeeping. + * @param {EventEmitter} target - The `EventEmitter` + * @param {string} eventName - The event anme + * @param {function} listener - Listener function + * @private + */ +Runner.prototype._removeEventListener = function(target, eventName, listener) { + var eventListenerIndex = -1; + for (var i = 0; i < this._eventListeners.length; i++) { + var eventListenerDescriptor = this._eventListeners[i]; + if ( + eventListenerDescriptor[0] === target && + eventListenerDescriptor[1] === eventName && + eventListenerDescriptor[2] === listener + ) { + eventListenerIndex = i; + break; + } + } + if (eventListenerIndex !== -1) { + var removedListener = this._eventListeners.splice(eventListenerIndex, 1)[0]; + removedListener[0].removeListener(removedListener[1], removedListener[2]); + } +}; + +/** + * Removes all event handlers set during a run on this instance. + * Remark: this does _not_ clean/dispose the tests or suites themselves. + */ +Runner.prototype.dispose = function() { + this.removeAllListeners(); + this._eventListeners.forEach(function(eventListenerDescriptor) { + eventListenerDescriptor[0].removeListener( + eventListenerDescriptor[1], + eventListenerDescriptor[2] + ); + }); +}; + /** * Run tests with full titles matching `re`. Updates runner.total * with number of tests matched. @@ -5770,7 +6223,7 @@ inherits(Runner, EventEmitter); * @return {Runner} Runner instance. */ Runner.prototype.grep = function(re, invert) { - debug('grep %s', re); + debug('grep(): setting to %s', re); this._grep = re; this._invert = invert; this.total = this.grepTotal(this.suite); @@ -5835,7 +6288,7 @@ Runner.prototype.globals = function(arr) { if (!arguments.length) { return this._globals; } - debug('globals %j', arr); + debug('globals(): setting to %O', arr); this._globals = this._globals.concat(arr); return this; }; @@ -5867,12 +6320,8 @@ Runner.prototype.checkGlobals = function(test) { this._globals = this._globals.concat(leaks); if (leaks.length) { - var format = ngettext( - leaks.length, - 'global leak detected: %s', - 'global leaks detected: %s' - ); - var error = new Error(util.format(format, leaks.map(sQuote).join(', '))); + var msg = 'global leak(s) detected: %s'; + var error = new Error(util.format(msg, leaks.map(sQuote).join(', '))); this.fail(test, error); } }; @@ -5881,15 +6330,27 @@ Runner.prototype.checkGlobals = function(test) { * Fail the given `test`. * * @private - * @param {Test} test + * @param {Runnable} test * @param {Error} err + * @param {boolean} [force=false] - Whether to fail a pending test. */ -Runner.prototype.fail = function(test, err) { - if (test.isPending()) { +Runner.prototype.fail = function(test, err, force) { + force = force === true; + if (test.isPending() && !force) { return; } + if (this.state === constants.STATE_STOPPED) { + if (err.code === errors.constants.MULTIPLE_DONE) { + throw err; + } + throw createFatalError( + 'Test failed after root suite execution completed!', + err + ); + } ++this.failures; + debug('total number of failures: %d', this.failures); test.state = STATE_FAILED; if (!isError(err)) { @@ -5977,12 +6438,12 @@ Runner.prototype.hook = function(name, fn) { self.emit(constants.EVENT_HOOK_BEGIN, hook); if (!hook.listeners('error').length) { - hook.on('error', function(err) { + self._addEventListener(hook, 'error', function(err) { self.failHook(hook, err); }); } - hook.run(function(err) { + hook.run(function cbHookRun(err) { var testError = hook.error(); if (testError) { self.fail(self.test, testError); @@ -6008,6 +6469,7 @@ Runner.prototype.hook = function(name, fn) { suite.suites.forEach(function(suite) { suite.pending = true; }); + hooks = []; } else { hook.pending = false; var errForbid = createUnsupportedError('`this.skip` forbidden'); @@ -6120,18 +6582,10 @@ Runner.prototype.runTest = function(fn) { return; } - var suite = this.parents().reverse()[0] || this.suite; - if (this.forbidOnly && suite.hasOnly()) { - fn(new Error('`.only` forbidden')); - return; - } if (this.asyncOnly) { test.asyncOnly = true; } - test.on('error', function(err) { - if (err instanceof Pending) { - return; - } + this._addEventListener(test, 'error', function(err) { self.fail(test, err); }); if (this.allowUncaught) { @@ -6230,10 +6684,9 @@ Runner.prototype.runTests = function(suite, fn) { // static skip, no hooks are executed if (test.isPending()) { if (self.forbidPending) { - test.isPending = alwaysFalse; - self.fail(test, new Error('Pending test forbidden')); - delete test.isPending; + self.fail(test, new Error('Pending test forbidden'), true); } else { + test.state = STATE_PENDING; self.emit(constants.EVENT_TEST_PENDING, test); } self.emit(constants.EVENT_TEST_END, test); @@ -6246,10 +6699,9 @@ Runner.prototype.runTests = function(suite, fn) { // conditional skip within beforeEach if (test.isPending()) { if (self.forbidPending) { - test.isPending = alwaysFalse; - self.fail(test, new Error('Pending test forbidden')); - delete test.isPending; + self.fail(test, new Error('Pending test forbidden'), true); } else { + test.state = STATE_PENDING; self.emit(constants.EVENT_TEST_PENDING, test); } self.emit(constants.EVENT_TEST_END, test); @@ -6270,10 +6722,9 @@ Runner.prototype.runTests = function(suite, fn) { // conditional skip within it if (test.pending) { if (self.forbidPending) { - test.isPending = alwaysFalse; - self.fail(test, new Error('Pending test forbidden')); - delete test.isPending; + self.fail(test, new Error('Pending test forbidden'), true); } else { + test.state = STATE_PENDING; self.emit(constants.EVENT_TEST_PENDING, test); } self.emit(constants.EVENT_TEST_END, test); @@ -6310,10 +6761,6 @@ Runner.prototype.runTests = function(suite, fn) { next(); }; -function alwaysFalse() { - return false; -} - /** * Run the given `suite` and invoke the callback `fn()` when complete. * @@ -6326,9 +6773,10 @@ Runner.prototype.runSuite = function(suite, fn) { var self = this; var total = this.grepTotal(suite); - debug('run suite %s', suite.fullTitle()); + debug('runSuite(): running %s', suite.fullTitle()); if (!total || (self.failures && suite._bail)) { + debug('runSuite(): bailing'); return fn(); } @@ -6394,22 +6842,49 @@ Runner.prototype.runSuite = function(suite, fn) { /** * Handle uncaught exceptions within runner. * - * @param {Error} err + * This function is bound to the instance as `Runner#uncaught` at instantiation + * time. It's intended to be listening on the `Process.uncaughtException` event. + * In order to not leak EE listeners, we need to ensure no more than a single + * `uncaughtException` listener exists per `Runner`. The only way to do + * this--because this function needs the context (and we don't have lambdas)--is + * to use `Function.prototype.bind`. We need strict equality to unregister and + * _only_ unregister the _one_ listener we set from the + * `Process.uncaughtException` event; would be poor form to just remove + * everything. See {@link Runner#run} for where the event listener is registered + * and unregistered. + * @param {Error} err - Some uncaught error * @private */ -Runner.prototype.uncaught = function(err) { +Runner.prototype._uncaught = function(err) { + // this is defensive to prevent future developers from mis-calling this function. + // it's more likely that it'd be called with the incorrect context--say, the global + // `process` object--than it would to be called with a context that is not a "subclass" + // of `Runner`. + if (!(this instanceof Runner)) { + throw createFatalError( + 'Runner#uncaught() called with invalid context', + this + ); + } if (err instanceof Pending) { + debug('uncaught(): caught a Pending'); return; } // browser does not exit script when throwing in global.onerror() - if (this.allowUncaught && !process.browser) { + if (this.allowUncaught && !utils.isBrowser()) { + debug('uncaught(): bubbling exception due to --allow-uncaught'); + throw err; + } + + if (this.state === constants.STATE_STOPPED) { + debug('uncaught(): throwing after run has completed!'); throw err; } if (err) { - debug('uncaught exception %O', err); + debug('uncaught(): got truthy exception %O', err); } else { - debug('uncaught undefined/falsy exception'); + debug('uncaught(): undefined/falsy exception'); err = createInvalidExceptionError( 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger', err @@ -6418,6 +6893,7 @@ Runner.prototype.uncaught = function(err) { if (!isError(err)) { err = thrown2Error(err); + debug('uncaught(): converted "error" %o to Error', err); } err.uncaught = true; @@ -6425,12 +6901,15 @@ Runner.prototype.uncaught = function(err) { if (!runnable) { runnable = new Runnable('Uncaught error outside test suite'); + debug('uncaught(): no current Runnable; created a phony one'); runnable.parent = this.suite; - if (this.started) { + if (this.state === constants.STATE_RUNNING) { + debug('uncaught(): failing gracefully'); this.fail(runnable, err); } else { // Can't recover from this failure + debug('uncaught(): test run has not yet started; unrecoverable'); this.emit(constants.EVENT_RUN_BEGIN); this.fail(runnable, err); this.emit(constants.EVENT_RUN_END); @@ -6442,98 +6921,94 @@ Runner.prototype.uncaught = function(err) { runnable.clearTimeout(); if (runnable.isFailed()) { + debug('uncaught(): Runnable has already failed'); // Ignore error if already failed return; } else if (runnable.isPending()) { + debug('uncaught(): pending Runnable wound up failing!'); // report 'pending test' retrospectively as failed - runnable.isPending = alwaysFalse; - this.fail(runnable, err); - delete runnable.isPending; + this.fail(runnable, err, true); return; } // we cannot recover gracefully if a Runnable has already passed // then fails asynchronously if (runnable.isPassed()) { + debug('uncaught(): Runnable has already passed; bailing gracefully'); this.fail(runnable, err); this.abort(); } else { - debug(runnable); + debug('uncaught(): forcing Runnable to complete with Error'); return runnable.callback(err); } }; -/** - * Handle uncaught exceptions after runner's end event. - * - * @param {Error} err - * @private - */ -Runner.prototype.uncaughtEnd = function uncaughtEnd(err) { - if (err instanceof Pending) return; - throw err; -}; - /** * Run the root suite and invoke `fn(failures)` * on completion. * * @public * @memberof Runner - * @param {Function} fn + * @param {Function} fn - Callback when finished + * @param {{files: string[], options: Options}} [opts] - For subclasses * @return {Runner} Runner instance. */ -Runner.prototype.run = function(fn) { +Runner.prototype.run = function(fn, opts) { var self = this; var rootSuite = this.suite; fn = fn || function() {}; - function uncaught(err) { - self.uncaught(err); - } - function start() { + debug('run(): starting'); // If there is an `only` filter if (rootSuite.hasOnly()) { rootSuite.filterOnly(); + debug('run(): filtered exclusive Runnables'); } - self.started = true; + self.state = constants.STATE_RUNNING; if (self._delay) { self.emit(constants.EVENT_DELAY_END); + debug('run(): "delay" ended'); } + debug('run(): emitting %s', constants.EVENT_RUN_BEGIN); self.emit(constants.EVENT_RUN_BEGIN); + debug('run(): emitted %s', constants.EVENT_RUN_BEGIN); self.runSuite(rootSuite, function() { - debug('finished running'); + debug( + 'run(): root suite completed; emitting %s', + constants.EVENT_RUN_END + ); self.emit(constants.EVENT_RUN_END); + debug('run(): emitted %s', constants.EVENT_RUN_END); }); } - debug(constants.EVENT_RUN_BEGIN); - // references cleanup to avoid memory leaks - this.on(constants.EVENT_SUITE_END, function(suite) { - suite.cleanReferences(); - }); + if (this._opts.cleanReferencesAfterRun) { + this.on(constants.EVENT_SUITE_END, function(suite) { + suite.cleanReferences(); + }); + } // callback this.on(constants.EVENT_RUN_END, function() { + self.state = constants.STATE_STOPPED; debug(constants.EVENT_RUN_END); - process.removeListener('uncaughtException', uncaught); - process.on('uncaughtException', self.uncaughtEnd); + debug('run(): emitted %s', constants.EVENT_RUN_END); fn(self.failures); }); - // uncaught exception - process.removeListener('uncaughtException', self.uncaughtEnd); - process.on('uncaughtException', uncaught); + self._removeEventListener(process, 'uncaughtException', self.uncaught); + self._addEventListener(process, 'uncaughtException', self.uncaught); if (this._delay) { // for reporters, I guess. // might be nice to debounce some dots while we wait. this.emit(constants.EVENT_DELAY_BEGIN, rootSuite); rootSuite.once(EVENT_ROOT_SUITE_RUN, start); + debug('run(): waiting for green light due to --delay'); } else { Runner.immediately(function() { start(); @@ -6551,7 +7026,7 @@ Runner.prototype.run = function(fn) { * @return {Runner} Runner instance. */ Runner.prototype.abort = function() { - debug('aborting'); + debug('abort(): aborting'); this._abort = true; return this; @@ -6635,7 +7110,7 @@ Runner.constants = constants; */ }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){ +},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":67,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){ (function (global){ 'use strict'; @@ -6786,20 +7261,19 @@ function Suite(title, parentContext, isRoot) { this.ctx = new Context(); this.suites = []; this.tests = []; + this.root = isRoot === true; this.pending = false; + this._retries = -1; this._beforeEach = []; this._beforeAll = []; this._afterEach = []; this._afterAll = []; - this.root = isRoot === true; this._timeout = 2000; - this._enableTimeouts = true; this._slow = 75; this._bail = false; - this._retries = -1; this._onlyTests = []; this._onlySuites = []; - this.delayed = false; + this.reset(); this.on('newListener', function(event) { if (deprecatedEvents[event]) { @@ -6817,6 +7291,22 @@ function Suite(title, parentContext, isRoot) { */ inherits(Suite, EventEmitter); +/** + * Resets the state initially or for a next run. + */ +Suite.prototype.reset = function() { + this.delayed = false; + function doReset(thingToReset) { + thingToReset.reset(); + } + this.suites.forEach(doReset); + this.tests.forEach(doReset); + this._beforeEach.forEach(doReset); + this._afterEach.forEach(doReset); + this._beforeAll.forEach(doReset); + this._afterAll.forEach(doReset); +}; + /** * Return a clone of this `Suite`. * @@ -6830,7 +7320,6 @@ Suite.prototype.clone = function() { suite.root = this.root; suite.timeout(this.timeout()); suite.retries(this.retries()); - suite.enableTimeouts(this.enableTimeouts()); suite.slow(this.slow()); suite.bail(this.bail()); return suite; @@ -6848,12 +7337,15 @@ Suite.prototype.timeout = function(ms) { if (!arguments.length) { return this._timeout; } - if (ms.toString() === '0') { - this._enableTimeouts = false; - } if (typeof ms === 'string') { ms = milliseconds(ms); } + + // Clamp to range + var INT_MAX = Math.pow(2, 31) - 1; + var range = [0, INT_MAX]; + ms = utils.clamp(ms, range); + debug('timeout %d', ms); this._timeout = parseInt(ms, 10); return this; @@ -6875,22 +7367,6 @@ Suite.prototype.retries = function(n) { return this; }; -/** - * Set or get timeout to `enabled`. - * - * @private - * @param {boolean} enabled - * @return {Suite|boolean} self or enabled - */ -Suite.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this._enableTimeouts; - } - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - /** * Set or get slow `ms` or short-hand such as "2s". * @@ -6947,7 +7423,6 @@ Suite.prototype._createHook = function(title, fn) { hook.parent = this; hook.timeout(this.timeout()); hook.retries(this.retries()); - hook.enableTimeouts(this.enableTimeouts()); hook.slow(this.slow()); hook.ctx = this.ctx; hook.file = this.file; @@ -7062,7 +7537,6 @@ Suite.prototype.addSuite = function(suite) { suite.root = false; suite.timeout(this.timeout()); suite.retries(this.retries()); - suite.enableTimeouts(this.enableTimeouts()); suite.slow(this.slow()); suite.bail(this.bail()); this.suites.push(suite); @@ -7081,7 +7555,6 @@ Suite.prototype.addTest = function(test) { test.parent = this; test.timeout(this.timeout()); test.retries(this.retries()); - test.enableTimeouts(this.enableTimeouts()); test.slow(this.slow()); test.ctx = this.ctx; this.tests.push(test); @@ -7218,6 +7691,15 @@ Suite.prototype.appendOnlySuite = function(suite) { this._onlySuites.push(suite); }; +/** + * Marks a suite to be `only`. + * + * @private + */ +Suite.prototype.markOnly = function() { + this.parent && this.parent.appendOnlySuite(this); +}; + /** * Adds a test to the list of tests marked `only`. * @@ -7236,6 +7718,16 @@ Suite.prototype.getHooks = function getHooks(name) { return this['_' + name]; }; +/** + * cleans all references from this suite and all child suites. + */ +Suite.prototype.dispose = function() { + this.suites.forEach(function(suite) { + suite.dispose(); + }); + this.cleanReferences(); +}; + /** * Cleans up the references to all the deferred functions * (before/after/beforeEach/afterEach) and tests of a Suite. @@ -7274,6 +7766,22 @@ Suite.prototype.cleanReferences = function cleanReferences() { } }; +/** + * Returns an object suitable for IPC. + * Functions are represented by keys beginning with `$$`. + * @private + * @returns {Object} + */ +Suite.prototype.serialize = function serialize() { + return { + _bail: this._bail, + $$fullTitle: this.fullTitle(), + $$isPending: this.isPending(), + root: this.root, + title: this.title + }; +}; + var constants = utils.defineConstants( /** * {@link Suite}-related constants. @@ -7366,7 +7874,7 @@ var deprecatedEvents = Object.keys(constants) Suite.constants = constants; -},{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){ +},{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":58}],37:[function(require,module,exports){ 'use strict'; var Runnable = require('./runnable'); var utils = require('./utils'); @@ -7395,9 +7903,9 @@ function Test(title, fn) { 'string' ); } - Runnable.call(this, title, fn); - this.pending = !fn; this.type = 'test'; + Runnable.call(this, title, fn); + this.reset(); } /** @@ -7405,6 +7913,15 @@ function Test(title, fn) { */ utils.inherits(Test, Runnable); +/** + * Resets the state initially or for a next run. + */ +Test.prototype.reset = function() { + Runnable.prototype.reset.call(this); + this.pending = !this.fn; + delete this.state; +}; + /** * Set or get retried test * @@ -7417,11 +7934,19 @@ Test.prototype.retriedTest = function(n) { this._retriedTest = n; }; +/** + * Add test to the list of tests marked `only`. + * + * @private + */ +Test.prototype.markOnly = function() { + this.parent.appendOnlyTest(this); +}; + Test.prototype.clone = function() { var test = new Test(this.title, this.fn); test.timeout(this.timeout()); test.slow(this.slow()); - test.enableTimeouts(this.enableTimeouts()); test.retries(this.retries()); test.currentRetry(this.currentRetry()); test.retriedTest(this.retriedTest() || this); @@ -7432,6 +7957,34 @@ Test.prototype.clone = function() { return test; }; +/** + * Returns an minimal object suitable for transmission over IPC. + * Functions are represented by keys beginning with `$$`. + * @private + * @returns {Object} + */ +Test.prototype.serialize = function serialize() { + return { + $$currentRetry: this._currentRetry, + $$fullTitle: this.fullTitle(), + $$isPending: this.pending, + $$retriedTest: this._retriedTest || null, + $$slow: this._slow, + $$titlePath: this.titlePath(), + body: this.body, + duration: this.duration, + err: this.err, + parent: { + $$fullTitle: this.parent.fullTitle() + }, + speed: this.speed, + state: this.state, + title: this.title, + type: this.type, + file: this.file + }; +}; + },{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){ (function (process,Buffer){ 'use strict'; @@ -7499,8 +8052,9 @@ exports.isString = function(obj) { exports.slug = function(str) { return str .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); + .replace(/\s+/g, '-') + .replace(/[^-\w]/g, '') + .replace(/-{2,}/g, '-'); }; /** @@ -7923,7 +8477,6 @@ function isHiddenOnUnix(pathname) { * **Make no assumption that the names will be sorted in any fashion.** * * @public - * @memberof Mocha.utils * @param {string} filepath - Base path to start searching from. * @param {string[]} [extensions=[]] - File extensions to look for. * @param {boolean} [recursive=false] - Whether to recurse into subdirectories. @@ -8073,7 +8626,7 @@ exports.stackTraceFilter = function() { var slash = path.sep; var cwd; if (is.node) { - cwd = process.cwd() + slash; + cwd = exports.cwd() + slash; } else { cwd = (typeof location === 'undefined' ? window.location @@ -8189,38 +8742,6 @@ exports.dQuote = function(str) { return '"' + str + '"'; }; -/** - * Provides simplistic message translation for dealing with plurality. - * - * @description - * Use this to create messages which need to be singular or plural. - * Some languages have several plural forms, so _complete_ message clauses - * are preferable to generating the message on the fly. - * - * @private - * @param {number} n - Non-negative integer - * @param {string} msg1 - Message to be used in English for `n = 1` - * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...` - * @returns {string} message corresponding to value of `n` - * @example - * var sprintf = require('util').format; - * var pkgs = ['one', 'two']; - * var msg = sprintf( - * ngettext( - * pkgs.length, - * 'cannot load package: %s', - * 'cannot load packages: %s' - * ), - * pkgs.map(sQuote).join(', ') - * ); - * console.log(msg); // => cannot load packages: 'one', 'two' - */ -exports.ngettext = function(n, msg1, msg2) { - if (typeof n === 'number' && n >= 0) { - return n === 1 ? msg1 : msg2; - } -}; - /** * It's a noop. * @public @@ -8276,22 +8797,46 @@ exports.defineConstants = function(obj) { * This function returns whether Node.JS has ES Module supports that is compatible with Mocha's needs, * which is version >=12.11. * + * @param {partialSupport} whether the full Node.js ESM support is available (>= 12) or just something that supports the runtime (>= 10) + * * @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha */ -exports.supportsEsModules = function() { - if (!process.browser && process.versions && process.versions.node) { +exports.supportsEsModules = function(partialSupport) { + if (!exports.isBrowser() && process.versions && process.versions.node) { var versionFields = process.versions.node.split('.'); var major = +versionFields[0]; var minor = +versionFields[1]; - if (major >= 13 || (major === 12 && minor >= 11)) { - return true; + if (!partialSupport) { + return major >= 13 || (major === 12 && minor >= 11); + } else { + return major >= 10; } } }; +/** + * Returns current working directory + * + * Wrapper around `process.cwd()` for isolation + * @private + */ +exports.cwd = function cwd() { + return process.cwd(); +}; + +/** + * Returns `true` if Mocha is running in a browser. + * Checks for `process.browser`. + * @returns {boolean} + * @private + */ +exports.isBrowser = function isBrowser() { + return Boolean(process.browser); +}; + }).call(this,require('_process'),require("buffer").Buffer) -},{"./errors":6,"_process":69,"buffer":43,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){ +},{"./errors":6,"_process":67,"buffer":43,"fs":42,"glob":42,"he":54,"object.assign":63,"path":42,"util":89}],39:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -8359,7 +8904,8 @@ function toByteArray (b64) { ? validLen - 4 : validLen - for (var i = 0; i < len; i += 4) { + var i + for (i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | @@ -8475,7 +9021,7 @@ BrowserStdout.prototype._write = function(chunks, encoding, cb) { } }).call(this,require('_process')) -},{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){ +},{"_process":67,"stream":83,"util":89}],42:[function(require,module,exports){ arguments[4][40][0].apply(exports,arguments) },{"dup":40}],43:[function(require,module,exports){ (function (Buffer){ @@ -10368,8 +10914,8 @@ function objectToString(o) { return Object.prototype.toString.call(o); } -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":57}],45:[function(require,module,exports){ +}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")}) +},{"../../insert-module-globals/node_modules/is-buffer/index.js":57}],45:[function(require,module,exports){ (function (process){ "use strict"; @@ -10553,7 +11099,7 @@ formatters.j = function (v) { }).call(this,require('_process')) -},{"./common":46,"_process":69}],46:[function(require,module,exports){ +},{"./common":46,"_process":67}],46:[function(require,module,exports){ "use strict"; /** @@ -10804,7 +11350,7 @@ function setup(env) { module.exports = setup; -},{"ms":60}],47:[function(require,module,exports){ +},{"ms":58}],47:[function(require,module,exports){ 'use strict'; var keys = require('object-keys'); @@ -10864,10 +11410,10 @@ defineProperties.supportsDescriptors = !!supportsDescriptors; module.exports = defineProperties; -},{"object-keys":62}],48:[function(require,module,exports){ +},{"object-keys":60}],48:[function(require,module,exports){ /*! - diff v3.5.0 + diff v4.0.1 Software License Agreement (BSD License) @@ -10902,1812 +11448,1555 @@ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISI OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @license */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(false) - define([], factory); - else if(typeof exports === 'object') - exports["JsDiff"] = factory(); - else - root["JsDiff"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + false ? define(['exports'], factory) : + (global = global || self, factory(global.Diff = {})); +}(this, function (exports) { 'use strict'; + + function Diff() {} + Diff.prototype = { + diff: function diff(oldString, newString) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var callback = options.callback; + + if (typeof options === 'function') { + callback = options; + options = {}; + } -/******/ // The require function -/******/ function __webpack_require__(moduleId) { + this.options = options; + var self = this; -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; + function done(value) { + if (callback) { + setTimeout(function () { + callback(undefined, value); + }, 0); + return true; + } else { + return value; + } + } // Allow subclasses to massage the input prior to running + + + oldString = this.castInput(oldString); + newString = this.castInput(newString); + oldString = this.removeEmpty(this.tokenize(oldString)); + newString = this.removeEmpty(this.tokenize(newString)); + var newLen = newString.length, + oldLen = oldString.length; + var editLength = 1; + var maxEditLength = newLen + oldLen; + var bestPath = [{ + newPos: -1, + components: [] + }]; // Seed editLength = 0, i.e. the content starts with the same values + + var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + + if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { + // Identity per the equality and tokenizer + return done([{ + value: this.join(newString), + count: newString.length + }]); + } // Main worker method. checks all permutations of a given edit length for acceptance. + + + function execEditLength() { + for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { + var basePath = void 0; + + var addPath = bestPath[diagonalPath - 1], + removePath = bestPath[diagonalPath + 1], + _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; + + if (addPath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath - 1] = undefined; + } + + var canAdd = addPath && addPath.newPos + 1 < newLen, + canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + if (!canAdd && !canRemove) { + // If this path is a terminal then prune + bestPath[diagonalPath] = undefined; + continue; + } // Select the diagonal that we want to branch from. We select the prior + // path whose position in the new string is the farthest from the origin + // and does not pass the bounds of the diff graph -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } + if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { + basePath = clonePath(removePath); + self.pushComponent(basePath.components, undefined, true); + } else { + basePath = addPath; // No need to clone, we've pulled it from the list + basePath.newPos++; + self.pushComponent(basePath.components, true, undefined); + } -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; + _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; + if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { + return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); + } else { + // Otherwise track this path as a potential candidate and continue. + bestPath[diagonalPath] = basePath; + } + } -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; + editLength++; + } // Performs the length of edit iteration. Is a bit fugly as this has to support the + // sync and async mode which is never fun. Loops over execEditLength until a value + // is produced. -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - /*istanbul ignore start*/'use strict'; + if (callback) { + (function exec() { + setTimeout(function () { + // This should not happen, but we want to be safe. - exports.__esModule = true; - exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined; + /* istanbul ignore next */ + if (editLength > maxEditLength) { + return callback(); + } - /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength) { + var ret = execEditLength(); - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); - - /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/; + if (ret) { + return ret; + } + } + } + }, + pushComponent: function pushComponent(components, added, removed) { + var last = components[components.length - 1]; + + if (last && last.added === added && last.removed === removed) { + // We need to clone here as the component clone operation is just + // as shallow array clone + components[components.length - 1] = { + count: last.count + 1, + added: added, + removed: removed + }; + } else { + components.push({ + count: 1, + added: added, + removed: removed + }); + } + }, + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { + var newLen = newString.length, + oldLen = oldString.length, + newPos = basePath.newPos, + oldPos = newPos - diagonalPath, + commonCount = 0; + + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { + newPos++; + oldPos++; + commonCount++; + } - var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; + if (commonCount) { + basePath.components.push({ + count: commonCount + }); + } - var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/; + basePath.newPos = newPos; + return oldPos; + }, + equals: function equals(left, right) { + if (this.options.comparator) { + return this.options.comparator(left, right); + } else { + return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + } + }, + removeEmpty: function removeEmpty(array) { + var ret = []; - var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } - var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/; + return ret; + }, + castInput: function castInput(value) { + return value; + }, + tokenize: function tokenize(value) { + return value.split(''); + }, + join: function join(chars) { + return chars.join(''); + } + }; - var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/; - - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - /* See LICENSE file for terms of use */ - - /* - * Text diff implementation. - * - * This library supports the following APIS: - * JsDiff.diffChars: Character by character diff - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace - * JsDiff.diffLines: Line based diff - * - * JsDiff.diffCss: Diff targeted at CSS content - * - * These methods are based on the implementation proposed in - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 - */ - exports. /*istanbul ignore end*/Diff = _base2['default']; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays; - /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches; - /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge; - /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP; - /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML; - /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize; - - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports['default'] = /*istanbul ignore end*/Diff; - function Diff() {} - - Diff.prototype = { - /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) { - /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var callback = options.callback; - if (typeof options === 'function') { - callback = options; - options = {}; - } - this.options = options; - - var self = this; - - function done(value) { - if (callback) { - setTimeout(function () { - callback(undefined, value); - }, 0); - return true; - } else { - return value; - } - } - - // Allow subclasses to massage the input prior to running - oldString = this.castInput(oldString); - newString = this.castInput(newString); - - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - - var newLen = newString.length, - oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - var bestPath = [{ newPos: -1, components: [] }]; - - // Seed editLength = 0, i.e. the content starts with the same values - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - // Identity per the equality and tokenizer - return done([{ value: this.join(newString), count: newString.length }]); - } - - // Main worker method. checks all permutations of a given edit length for acceptance. - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath - 1] = undefined; - } - - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - if (!canAdd && !canRemove) { - // If this path is a terminal then prune - bestPath[diagonalPath] = undefined; - continue; - } - - // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); - } else { - basePath = addPath; // No need to clone, we've pulled it from the list - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); - } - - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - - // If we have hit the end of both strings, then we are done - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); - } else { - // Otherwise track this path as a potential candidate and continue. - bestPath[diagonalPath] = basePath; - } - } - - editLength++; - } - - // Performs the length of edit iteration. Is a bit fugly as this has to support the - // sync and async mode which is never fun. Loops over execEditLength until a value - // is produced. - if (callback) { - (function exec() { - setTimeout(function () { - // This should not happen, but we want to be safe. - /* istanbul ignore next */ - if (editLength > maxEditLength) { - return callback(); - } - - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - if (ret) { - return ret; - } - } - } - }, - /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { count: last.count + 1, added: added, removed: removed }; - } else { - components.push({ count: 1, added: added, removed: removed }); - } - }, - /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, - commonCount = 0; - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - - if (commonCount) { - basePath.components.push({ count: commonCount }); - } - - basePath.newPos = newPos; - return oldPos; - }, - /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - }, - /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) { - return value; - }, - /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) { - return value.split(''); - }, - /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) { - return chars.join(''); - } - }; + function buildValues(diff, components, newString, oldString, useLongestToken) { + var componentPos = 0, + componentLen = components.length, + newPos = 0, + oldPos = 0; + + for (; componentPos < componentLen; componentPos++) { + var component = components[componentPos]; + + if (!component.removed) { + if (!component.added && useLongestToken) { + var value = newString.slice(newPos, newPos + component.count); + value = value.map(function (value, i) { + var oldValue = oldString[oldPos + i]; + return oldValue.length > value.length ? oldValue : value; + }); + component.value = diff.join(value); + } else { + component.value = diff.join(newString.slice(newPos, newPos + component.count)); + } - function buildValues(diff, components, newString, oldString, useLongestToken) { - var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function (value, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value.length ? oldValue : value; - }); - - component.value = diff.join(value); - } else { - component.value = diff.join(newString.slice(newPos, newPos + component.count)); - } - newPos += component.count; - - // Common case - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; - - // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } - - // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - var lastComponent = components[componentLen - 1]; - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; - components.pop(); - } - - return components; - } + newPos += component.count; // Common case - function clonePath(path) { - return { newPos: path.newPos, components: path.components.slice(0) }; - } + if (!component.added) { + oldPos += component.count; + } + } else { + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); + oldPos += component.count; // Reverse add and remove so removes are output first to match common convention + // The diffing algorithm is tied to add then remove output and this is the simplest + // route to get the desired output with minimal overhead. + + if (componentPos && components[componentPos - 1].added) { + var tmp = components[componentPos - 1]; + components[componentPos - 1] = components[componentPos]; + components[componentPos] = tmp; + } + } + } // Special case handle for when one terminal is ignored (i.e. whitespace). + // For this case we merge the terminal into the prior string and drop the change. + // This is only available for string mode. + var lastComponent = components[componentLen - 1]; -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { + if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { + components[componentLen - 2].value += lastComponent.value; + components.pop(); + } - /*istanbul ignore start*/'use strict'; + return components; + } - exports.__esModule = true; - exports.characterDiff = undefined; - exports. /*istanbul ignore end*/diffChars = diffChars; + function clonePath(path) { + return { + newPos: path.newPos, + components: path.components.slice(0) + }; + } - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + var characterDiff = new Diff(); + function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); + } - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + return defaults; + } - /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); - } + // + // Ranges and exceptions: + // Latin-1 Supplement, 0080–00FF + // - U+00D7 × Multiplication sign + // - U+00F7 ÷ Division sign + // Latin Extended-A, 0100–017F + // Latin Extended-B, 0180–024F + // IPA Extensions, 0250–02AF + // Spacing Modifier Letters, 02B0–02FF + // - U+02C7 ˇ ˇ Caron + // - U+02D8 ˘ ˘ Breve + // - U+02D9 ˙ ˙ Dot Above + // - U+02DA ˚ ˚ Ring Above + // - U+02DB ˛ ˛ Ogonek + // - U+02DC ˜ ˜ Small Tilde + // - U+02DD ˝ ˝ Double Acute Accent + // Latin Extended Additional, 1E00–1EFF + + var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; + var reWhitespace = /\S/; + var wordDiff = new Diff(); + + wordDiff.equals = function (left, right) { + if (this.options.ignoreCase) { + left = left.toLowerCase(); + right = right.toLowerCase(); + } + + return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); + }; + wordDiff.tokenize = function (value) { + var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. + for (var i = 0; i < tokens.length - 1; i++) { + // If we have an empty string in the next field and we have only word chars before and after, merge + if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { + tokens[i] += tokens[i + 2]; + tokens.splice(i + 1, 2); + i--; + } + } -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { + return tokens; + }; - /*istanbul ignore start*/'use strict'; + function diffWords(oldStr, newStr, options) { + options = generateOptions(options, { + ignoreWhitespace: true + }); + return wordDiff.diff(oldStr, newStr, options); + } + function diffWordsWithSpace(oldStr, newStr, options) { + return wordDiff.diff(oldStr, newStr, options); + } - exports.__esModule = true; - exports.wordDiff = undefined; - exports. /*istanbul ignore end*/diffWords = diffWords; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace; + var lineDiff = new Diff(); - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + lineDiff.tokenize = function (value) { + var retLines = [], + linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + if (!linesAndNewlines[linesAndNewlines.length - 1]) { + linesAndNewlines.pop(); + } // Merge the content and line separators into single tokens - /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/; - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + for (var i = 0; i < linesAndNewlines.length; i++) { + var line = linesAndNewlines[i]; - /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode - // - // Ranges and exceptions: - // Latin-1 Supplement, 0080–00FF - // - U+00D7 × Multiplication sign - // - U+00F7 ÷ Division sign - // Latin Extended-A, 0100–017F - // Latin Extended-B, 0180–024F - // IPA Extensions, 0250–02AF - // Spacing Modifier Letters, 02B0–02FF - // - U+02C7 ˇ ˇ Caron - // - U+02D8 ˘ ˘ Breve - // - U+02D9 ˙ ˙ Dot Above - // - U+02DA ˚ ˚ Ring Above - // - U+02DB ˛ ˛ Ogonek - // - U+02DC ˜ ˜ Small Tilde - // - U+02DD ˝ ˝ Double Acute Accent - // Latin Extended Additional, 1E00–1EFF - var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; + if (i % 2 && !this.options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + if (this.options.ignoreWhitespace) { + line = line.trim(); + } - var reWhitespace = /\S/; + retLines.push(line); + } + } - var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); - }; - wordDiff.tokenize = function (value) { - var tokens = value.split(/(\s+|\b)/); - - // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - - return tokens; - }; + return retLines; + }; - function diffWords(oldStr, newStr, options) { - options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true }); - return wordDiff.diff(oldStr, newStr, options); - } + function diffLines(oldStr, newStr, callback) { + return lineDiff.diff(oldStr, newStr, callback); + } + function diffTrimmedLines(oldStr, newStr, callback) { + var options = generateOptions(callback, { + ignoreWhitespace: true + }); + return lineDiff.diff(oldStr, newStr, options); + } - function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); - } + var sentenceDiff = new Diff(); + sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); + }; + function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); + } -/***/ }), -/* 4 */ -/***/ (function(module, exports) { + var cssDiff = new Diff(); - /*istanbul ignore start*/'use strict'; + cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); + }; - exports.__esModule = true; - exports. /*istanbul ignore end*/generateOptions = generateOptions; - function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } - } - } - return defaults; - } + function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); + } + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + return _typeof(obj); + } -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + } - /*istanbul ignore start*/'use strict'; + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - exports.__esModule = true; - exports.lineDiff = undefined; - exports. /*istanbul ignore end*/diffLines = diffLines; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines; + return arr2; + } + } - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + } - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); + } - /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/; + var objectPrototypeToString = Object.prototype.toString; + var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a + // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + jsonDiff.useLongestToken = true; + jsonDiff.tokenize = lineDiff.tokenize; - /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - lineDiff.tokenize = function (value) { - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); + jsonDiff.castInput = function (value) { + var _this$options = this.options, + undefinedReplacement = _this$options.undefinedReplacement, + _this$options$stringi = _this$options.stringifyReplacer, + stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _this$options$stringi; + return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); + }; - // Ignore the final empty token that occurs if the string ends with a new line - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } + jsonDiff.equals = function (left, right) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); + }; - // Merge the content and line separators into single tokens - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; + function diffJson(oldObj, newObj, options) { + return jsonDiff.diff(oldObj, newObj, options); + } // This function handles the presence of circular references by bailing out when encountering an + // object that is already on the "stack" of items being processed. Accepts an optional replacer - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); - } - } + function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; - return retLines; - }; + if (replacer) { + obj = replacer(key, obj); + } - function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); - } - function diffTrimmedLines(oldStr, newStr, callback) { - var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true }); - return lineDiff.diff(oldStr, newStr, options); - } + var i; + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } + var canonicalizedObj; -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { + if ('[object Array]' === objectPrototypeToString.call(obj)) { + stack.push(obj); + canonicalizedObj = new Array(obj.length); + replacementStack.push(canonicalizedObj); - /*istanbul ignore start*/'use strict'; + for (i = 0; i < obj.length; i += 1) { + canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); + } - exports.__esModule = true; - exports.sentenceDiff = undefined; - exports. /*istanbul ignore end*/diffSentences = diffSentences; + stack.pop(); + replacementStack.pop(); + return canonicalizedObj; + } - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + if (_typeof(obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var sortedKeys = [], + _key; - /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - sentenceDiff.tokenize = function (value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); - }; + for (_key in obj) { + /* istanbul ignore else */ + if (obj.hasOwnProperty(_key)) { + sortedKeys.push(_key); + } + } - function diffSentences(oldStr, newStr, callback) { - return sentenceDiff.diff(oldStr, newStr, callback); - } + sortedKeys.sort(); + + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } + + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } + + return canonicalizedObj; + } + + var arrayDiff = new Diff(); + + arrayDiff.tokenize = function (value) { + return value.slice(); + }; + + arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; + }; + + function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); + } + + function parsePatch(uniDiff) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), + delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], + list = [], + i = 0; + + function parseIndex() { + var index = {}; + list.push(index); // Parse diff metadata + + while (i < diffstr.length) { + var line = diffstr[i]; // File header found, end parsing diff metadata + + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } // Diff index + + + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); + + if (header) { + index.index = header[1]; + } + + i++; + } // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + + + parseFileHeader(index); + parseFileHeader(index); // Parse hunks + + index.hunks = []; + + while (i < diffstr.length) { + var _line = diffstr[i]; + + if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { + break; + } else if (/^@@/.test(_line)) { + index.hunks.push(parseHunk()); + } else if (_line && options.strict) { + // Ignore unexpected content unless in strict mode + throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); + } else { + i++; + } + } + } // Parses the --- and +++ headers, if none are found, no lines + // are consumed. + + + function parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); + + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); + + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } + + index[keyPrefix + 'FileName'] = fileName; + index[keyPrefix + 'Header'] = (data[1] || '').trim(); + i++; + } + } // Parses a hunk + // This assumes that we are at the start of a hunk. + + + function parseHunk() { + var chunkHeaderIndex = i, + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + var hunk = { + oldStart: +chunkHeader[1], + oldLines: +chunkHeader[2] || 1, + newStart: +chunkHeader[3], + newLines: +chunkHeader[4] || 1, + lines: [], + linedelimiters: [] + }; + var addCount = 0, + removeCount = 0; + + for (; i < diffstr.length; i++) { + // Lines starting with '---' could be mistaken for the "remove line" operation + // But they could be the header for the next file. Therefore prune such cases out. + if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { + break; + } + + var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; + + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + hunk.linedelimiters.push(delimiters[i] || '\n'); + + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + break; + } + } // Handle the empty block count case + + + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } + + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } // Perform optional sanity checking + + + if (options.strict) { + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + } + + return hunk; + } + + while (i < diffstr.length) { + parseIndex(); + } + + return list; + } + + // Iterator that traverses in the range of [min, max], stepping + // by distance from a given start position. I.e. for [0, 4], with + // start of 2, this will iterate 2, 3, 1, 4, 0. + function distanceIterator (start, minLine, maxLine) { + var wantForward = true, + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; + return function iterator() { + if (wantForward && !forwardExhausted) { + if (backwardExhausted) { + localOffset++; + } else { + wantForward = false; + } // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) + + + if (start + localOffset <= maxLine) { + return localOffset; + } + + forwardExhausted = true; + } + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } // Check if trying to fit before text beginning, and if not, check it fits + // before offset location -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { + if (minLine <= start - localOffset) { + return -localOffset++; + } + + backwardExhausted = true; + return iterator(); + } // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined + + }; + } + + function applyPatch(source, uniDiff) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } + + uniDiff = uniDiff[0]; + } // Apply the diff to the input + + + var lines = source.split(/\r\n|[\n\v\f\r\x85]/), + delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + errorCount = 0, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0, + offset = 0, + removeEOFNL, + addEOFNL; + /** + * Checks if the hunk exactly fits on the provided location + */ + + + function hunkFits(hunk, toPos) { + for (var j = 0; j < hunk.lines.length; j++) { + var line = hunk.lines[j], + operation = line.length > 0 ? line[0] : ' ', + content = line.length > 0 ? line.substr(1) : line; + + if (operation === ' ' || operation === '-') { + // Context sanity check + if (!compareLine(toPos + 1, lines[toPos], operation, content)) { + errorCount++; + + if (errorCount > fuzzFactor) { + return false; + } + } + + toPos++; + } + } + + return true; + } // Search best fit offsets for each hunk based on the previous ones + + + for (var i = 0; i < hunks.length; i++) { + var hunk = hunks[i], + maxLine = lines.length - hunk.oldLines, + localOffset = 0, + toPos = offset + hunk.oldStart - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + + for (; localOffset !== undefined; localOffset = iterator()) { + if (hunkFits(hunk, toPos + localOffset)) { + hunk.offset = offset += localOffset; + break; + } + } + + if (localOffset === undefined) { + return false; + } // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text - /*istanbul ignore start*/'use strict'; - exports.__esModule = true; - exports.cssDiff = undefined; - exports. /*istanbul ignore end*/diffCss = diffCss; + minLine = hunk.offset + hunk.oldStart + hunk.oldLines; + } // Apply patch hunks - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + var diffOffset = 0; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + for (var _i = 0; _i < hunks.length; _i++) { + var _hunk = hunks[_i], + _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - cssDiff.tokenize = function (value) { - return value.split(/([{}:;,]|\s+)/); - }; + diffOffset += _hunk.newLines - _hunk.oldLines; - function diffCss(oldStr, newStr, callback) { - return cssDiff.diff(oldStr, newStr, callback); - } + if (_toPos < 0) { + // Creating a new file + _toPos = 0; + } + for (var j = 0; j < _hunk.lines.length; j++) { + var line = _hunk.lines[j], + operation = line.length > 0 ? line[0] : ' ', + content = line.length > 0 ? line.substr(1) : line, + delimiter = _hunk.linedelimiters[j]; + + if (operation === ' ') { + _toPos++; + } else if (operation === '-') { + lines.splice(_toPos, 1); + delimiters.splice(_toPos, 1); + /* istanbul ignore else */ + } else if (operation === '+') { + lines.splice(_toPos, 0, content); + delimiters.splice(_toPos, 0, delimiter); + _toPos++; + } else if (operation === '\\') { + var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; + + if (previousOperation === '+') { + removeEOFNL = true; + } else if (previousOperation === '-') { + addEOFNL = true; + } + } + } + } // Handle EOFNL insertion/removal -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { + if (removeEOFNL) { + while (!lines[lines.length - 1]) { + lines.pop(); + delimiters.pop(); + } + } else if (addEOFNL) { + lines.push(''); + delimiters.push('\n'); + } - /*istanbul ignore start*/'use strict'; + for (var _k = 0; _k < lines.length - 1; _k++) { + lines[_k] = lines[_k] + delimiters[_k]; + } - exports.__esModule = true; - exports.jsonDiff = undefined; + return lines.join(''); + } // Wrapper that supports multiple file patches via callbacks. - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + function applyPatches(uniDiff, options) { + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } - exports. /*istanbul ignore end*/diffJson = diffJson; - /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize; + var currentIndex = 0; - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + function processIndex() { + var index = uniDiff[currentIndex++]; - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + if (!index) { + return options.complete(); + } - /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; + options.loadFile(index, function (err, data) { + if (err) { + return options.complete(err); + } - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var updatedContent = applyPatch(data, index, options); + options.patched(index, updatedContent, function (err) { + if (err) { + return options.complete(err); + } - /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString; + processIndex(); + }); + }); + } - var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a - // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - jsonDiff.useLongestToken = true; + processIndex(); + } - jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize; - jsonDiff.castInput = function (value) { - /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options, - undefinedReplacement = _options.undefinedReplacement, - _options$stringifyRep = _options.stringifyReplacer, - stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{ - return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v - ); - } : _options$stringifyRep; + function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + if (!options) { + options = {}; + } + if (typeof options.context === 'undefined') { + options.context = 4; + } - return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); - }; - jsonDiff.equals = function (left, right) { - return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')) - ); - }; + var diff = diffLines(oldStr, newStr, options); + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier - function diffJson(oldObj, newObj, options) { - return jsonDiff.diff(oldObj, newObj, options); - } + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } - // This function handles the presence of circular references by bailing out when encountering an - // object that is already on the "stack" of items being processed. Accepts an optional replacer - function canonicalize(obj, stack, replacementStack, replacer, key) { - stack = stack || []; - replacementStack = replacementStack || []; - - if (replacer) { - obj = replacer(key, obj); - } - - var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); - } - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - - if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - var sortedKeys = [], - _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - for (_key in obj) { - /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); - } - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - return canonicalizedObj; - } + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + var _loop = function _loop(i) { + var current = diff[i], + lines = current.lines || current.value.replace(/\n$/, '').split('\n'); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; - /*istanbul ignore start*/'use strict'; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } // Output our changes - exports.__esModule = true; - exports.arrayDiff = undefined; - exports. /*istanbul ignore end*/diffArrays = diffArrays; - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); // Track the updated file position - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + + // end the range and output + var contextSize = Math.min(lines.length, options.context); + + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + + var hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + + if (i >= diff.length - 2 && lines.length <= options.context) { + // EOF is inside this hunk + var oldEOFNewline = /\n$/.test(oldStr); + var newEOFNewline = /\n$/.test(newStr); + var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; + + if (!oldEOFNewline && noNlBeforeAdds) { + // special case: old has no eol and no trailing context; no-nl can end up before adds + curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); + } + + if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { + curRange.push('\\ No newline at end of file'); + } + } - /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - arrayDiff.tokenize = function (value) { - return value.slice(); - }; - arrayDiff.join = arrayDiff.removeEmpty = function (value) { - return value; - }; + hunks.push(hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } - function diffArrays(oldArr, newArr, callback) { - return arrayDiff.diff(oldArr, newArr, callback); - } + oldLine += lines.length; + newLine += lines.length; + } + }; + for (var i = 0; i < diff.length; i++) { + _loop(i); + } + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; + } + function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + var ret = []; -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports. /*istanbul ignore end*/applyPatch = applyPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches; - - var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/; - - /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - /*istanbul ignore end*/function applyPatch(source, uniDiff) { - /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (typeof uniDiff === 'string') { - uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff); - } - - if (Array.isArray(uniDiff)) { - if (uniDiff.length > 1) { - throw new Error('applyPatch only works with a single input.'); - } - - uniDiff = uniDiff[0]; - } - - // Apply the diff to the input - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{ - return (/*istanbul ignore end*/line === patchContent - ); - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/, - addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - - /** - * Checks if the hunk exactly fits on the provided location - */ - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; - - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; - - if (errorCount > fuzzFactor) { - return false; - } - } - toPos++; - } - } - - return true; - } - - // Search best fit offsets for each hunk based on the previous ones - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - - var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine); - - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; - break; - } - } - - if (localOffset === undefined) { - return false; - } - - // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } - - // Apply patch hunks - var diffOffset = 0; - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - diffOffset += _hunk.newLines - _hunk.oldLines; - - if (_toPos < 0) { - // Creating a new file - _toPos = 0; - } - - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; - - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } - } - } - - // Handle EOFNL insertion/removal - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); - } - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; - } - return lines.join(''); - } + if (oldFileName == newFileName) { + ret.push('Index: ' + oldFileName); + } - // Wrapper that supports multiple file patches via callbacks. - function applyPatches(uniDiff, options) { - if (typeof uniDiff === 'string') { - uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff); - } - - var currentIndex = 0; - function processIndex() { - var index = uniDiff[currentIndex++]; - if (!index) { - return options.complete(); - } - - options.loadFile(index, function (err, data) { - if (err) { - return options.complete(err); - } - - var updatedContent = applyPatch(data, index, options); - options.patched(index, updatedContent, function (err) { - if (err) { - return options.complete(err); - } - - processIndex(); - }); - }); - } - processIndex(); - } + ret.push('==================================================================='); + ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); + ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + for (var i = 0; i < diff.hunks.length; i++) { + var hunk = diff.hunks[i]; + ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); + ret.push.apply(ret, hunk.lines); + } + return ret.join('\n') + '\n'; + } + function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { + return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); + } -/***/ }), -/* 11 */ -/***/ (function(module, exports) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports. /*istanbul ignore end*/parsePatch = parsePatch; - function parsePatch(uniDiff) { - /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; - - function parseIndex() { - var index = {}; - list.push(index); - - // Parse diff metadata - while (i < diffstr.length) { - var line = diffstr[i]; - - // File header found, end parsing diff metadata - if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { - break; - } - - // Diff index - var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - if (header) { - index.index = header[1]; - } - - i++; - } - - // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - parseFileHeader(index); - parseFileHeader(index); - - // Parse hunks - index.hunks = []; - - while (i < diffstr.length) { - var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { - break; - } else if (/^@@/.test(_line)) { - index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode - throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); - } else { - i++; - } - } - } - - // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - function parseFileHeader(index) { - var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - if (fileHeader) { - var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; - var data = fileHeader[2].split('\t', 2); - var fileName = data[0].replace(/\\\\/g, '\\'); - if (/^".*"$/.test(fileName)) { - fileName = fileName.substr(1, fileName.length - 2); - } - index[keyPrefix + 'FileName'] = fileName; - index[keyPrefix + 'Header'] = (data[1] || '').trim(); - - i++; - } - } - - // Parses a hunk - // This assumes that we are at the start of a hunk. - function parseHunk() { - var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); - - var hunk = { - oldStart: +chunkHeader[1], - oldLines: +chunkHeader[2] || 1, - newStart: +chunkHeader[3], - newLines: +chunkHeader[4] || 1, - lines: [], - linedelimiters: [] - }; - - var addCount = 0, - removeCount = 0; - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { - hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - - if (operation === '+') { - addCount++; - } else if (operation === '-') { - removeCount++; - } else if (operation === ' ') { - addCount++; - removeCount++; - } - } else { - break; - } - } - - // Handle the empty block count case - if (!addCount && hunk.newLines === 1) { - hunk.newLines = 0; - } - if (!removeCount && hunk.oldLines === 1) { - hunk.oldLines = 0; - } - - // Perform optional sanity checking - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - } - - return hunk; - } - - while (i < diffstr.length) { - parseIndex(); - } - - return list; - } + function arrayEqual(a, b) { + if (a.length !== b.length) { + return false; + } + return arrayStartsWith(a, b); + } + function arrayStartsWith(array, start) { + if (start.length > array.length) { + return false; + } + for (var i = 0; i < start.length; i++) { + if (start[i] !== array[i]) { + return false; + } + } -/***/ }), -/* 12 */ -/***/ (function(module, exports) { + return true; + } - /*istanbul ignore start*/"use strict"; + function calcLineCount(hunk) { + var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; - exports.__esModule = true; + if (oldLines !== undefined) { + hunk.oldLines = oldLines; + } else { + delete hunk.oldLines; + } - exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) { - var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; + if (newLines !== undefined) { + hunk.newLines = newLines; + } else { + delete hunk.newLines; + } + } + function merge(mine, theirs, base) { + mine = loadPatch(mine, base); + theirs = loadPatch(theirs, base); + var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. + // Leaving sanity checks on this to the API consumer that may know more about the + // meaning in their own context. + + if (mine.index || theirs.index) { + ret.index = mine.index || theirs.index; + } + + if (mine.newFileName || theirs.newFileName) { + if (!fileNameChanged(mine)) { + // No header or no change in ours, use theirs (and ours if theirs does not exist) + ret.oldFileName = theirs.oldFileName || mine.oldFileName; + ret.newFileName = theirs.newFileName || mine.newFileName; + ret.oldHeader = theirs.oldHeader || mine.oldHeader; + ret.newHeader = theirs.newHeader || mine.newHeader; + } else if (!fileNameChanged(theirs)) { + // No header or no change in theirs, use ours + ret.oldFileName = mine.oldFileName; + ret.newFileName = mine.newFileName; + ret.oldHeader = mine.oldHeader; + ret.newHeader = mine.newHeader; + } else { + // Both changed... figure it out + ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); + ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); + ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); + ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); + } + } - return function iterator() { - if (wantForward && !forwardExhausted) { - if (backwardExhausted) { - localOffset++; - } else { - wantForward = false; - } + ret.hunks = []; + var mineIndex = 0, + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; - // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - if (start + localOffset <= maxLine) { - return localOffset; - } + while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { + var mineCurrent = mine.hunks[mineIndex] || { + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; - forwardExhausted = true; - } + if (hunkBefore(mineCurrent, theirsCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); + mineIndex++; + theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; + } else if (hunkBefore(theirsCurrent, mineCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); + theirsIndex++; + mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; + } else { + // Overlap, merge as best we can + var mergedHunk = { + oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), + oldLines: 0, + newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), + newLines: 0, + lines: [] + }; + mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); + theirsIndex++; + mineIndex++; + ret.hunks.push(mergedHunk); + } + } - if (!backwardExhausted) { - if (!forwardExhausted) { - wantForward = true; - } + return ret; + } - // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - if (minLine <= start - localOffset) { - return -localOffset++; - } + function loadPatch(param, base) { + if (typeof param === 'string') { + if (/^@@/m.test(param) || /^Index:/m.test(param)) { + return parsePatch(param)[0]; + } - backwardExhausted = true; - return iterator(); - } + if (!base) { + throw new Error('Must provide a base reference or pass in a patch'); + } - // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined - }; - }; + return structuredPatch(undefined, undefined, base, param); + } + return param; + } + function fileNameChanged(patch) { + return patch.newFileName && patch.newFileName !== patch.oldFileName; + } -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { + function selectField(index, mine, theirs) { + if (mine === theirs) { + return mine; + } else { + index.conflict = true; + return { + mine: mine, + theirs: theirs + }; + } + } - /*istanbul ignore start*/'use strict'; + function hunkBefore(test, check) { + return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; + } - exports.__esModule = true; - exports. /*istanbul ignore end*/calcLineCount = calcLineCount; - /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge; + function cloneHunk(hunk, offset) { + return { + oldStart: hunk.oldStart, + oldLines: hunk.oldLines, + newStart: hunk.newStart + offset, + newLines: hunk.newLines, + lines: hunk.lines + }; + } - var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/; + function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { + // This will generally result in a conflicted hunk, but there are cases where the context + // is the only overlap where we can successfully merge the content here. + var mine = { + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; // Handle any leading content + + insertLeading(hunk, mine, their); + insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. + + while (mine.index < mine.lines.length && their.index < their.lines.length) { + var mineCurrent = mine.lines[mine.index], + theirCurrent = their.lines[their.index]; + + if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { + // Both modified ... + mutualChange(hunk, mine, their); + } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { + var _hunk$lines; + + // Mine inserted + (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); + } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { + var _hunk$lines2; + + // Theirs inserted + (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); + } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { + // Mine removed or edited + removal(hunk, mine, their); + } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { + // Their removed or edited + removal(hunk, their, mine, true); + } else if (mineCurrent === theirCurrent) { + // Context identity + hunk.lines.push(mineCurrent); + mine.index++; + their.index++; + } else { + // Context mismatch + conflict(hunk, collectChange(mine), collectChange(their)); + } + } // Now push anything that may be remaining - var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; - var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/; + insertTrailing(hunk, mine); + insertTrailing(hunk, their); + calcLineCount(hunk); + } - /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + function mutualChange(hunk, mine, their) { + var myChanges = collectChange(mine), + theirChanges = collectChange(their); - /*istanbul ignore end*/function calcLineCount(hunk) { - /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; + if (allRemoves(myChanges) && allRemoves(theirChanges)) { + // Special case for remove changes that are supersets of one another + if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { + var _hunk$lines3; - if (oldLines !== undefined) { - hunk.oldLines = oldLines; - } else { - delete hunk.oldLines; - } + (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - if (newLines !== undefined) { - hunk.newLines = newLines; - } else { - delete hunk.newLines; - } - } + return; + } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { + var _hunk$lines4; - function merge(mine, theirs, base) { - mine = loadPatch(mine, base); - theirs = loadPatch(theirs, base); - - var ret = {}; - - // For index we just let it pass through as it doesn't have any necessary meaning. - // Leaving sanity checks on this to the API consumer that may know more about the - // meaning in their own context. - if (mine.index || theirs.index) { - ret.index = mine.index || theirs.index; - } - - if (mine.newFileName || theirs.newFileName) { - if (!fileNameChanged(mine)) { - // No header or no change in ours, use theirs (and ours if theirs does not exist) - ret.oldFileName = theirs.oldFileName || mine.oldFileName; - ret.newFileName = theirs.newFileName || mine.newFileName; - ret.oldHeader = theirs.oldHeader || mine.oldHeader; - ret.newHeader = theirs.newHeader || mine.newHeader; - } else if (!fileNameChanged(theirs)) { - // No header or no change in theirs, use ours - ret.oldFileName = mine.oldFileName; - ret.newFileName = mine.newFileName; - ret.oldHeader = mine.oldHeader; - ret.newHeader = mine.newHeader; - } else { - // Both changed... figure it out - ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); - ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); - ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); - ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); - } - } - - ret.hunks = []; - - var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - - while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { - var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity }, - theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity }; - - if (hunkBefore(mineCurrent, theirsCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); - mineIndex++; - theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; - } else if (hunkBefore(theirsCurrent, mineCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); - theirsIndex++; - mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; - } else { - // Overlap, merge as best we can - var mergedHunk = { - oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), - oldLines: 0, - newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), - newLines: 0, - lines: [] - }; - mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); - theirsIndex++; - mineIndex++; - - ret.hunks.push(mergedHunk); - } - } - - return ret; - } + (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - function loadPatch(param, base) { - if (typeof param === 'string') { - if (/^@@/m.test(param) || /^Index:/m.test(param)) { - return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0] - ); - } - - if (!base) { - throw new Error('Must provide a base reference or pass in a patch'); - } - return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param) - ); - } - - return param; - } + return; + } + } else if (arrayEqual(myChanges, theirChanges)) { + var _hunk$lines5; - function fileNameChanged(patch) { - return patch.newFileName && patch.newFileName !== patch.oldFileName; - } + (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - function selectField(index, mine, theirs) { - if (mine === theirs) { - return mine; - } else { - index.conflict = true; - return { mine: mine, theirs: theirs }; - } - } + return; + } - function hunkBefore(test, check) { - return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; - } + conflict(hunk, myChanges, theirChanges); + } - function cloneHunk(hunk, offset) { - return { - oldStart: hunk.oldStart, oldLines: hunk.oldLines, - newStart: hunk.newStart + offset, newLines: hunk.newLines, - lines: hunk.lines - }; - } + function removal(hunk, mine, their, swap) { + var myChanges = collectChange(mine), + theirChanges = collectContext(their, myChanges); - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { - // This will generally result in a conflicted hunk, but there are cases where the context - // is the only overlap where we can successfully merge the content here. - var mine = { offset: mineOffset, lines: mineLines, index: 0 }, - their = { offset: theirOffset, lines: theirLines, index: 0 }; - - // Handle any leading content - insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); - - // Now in the overlap content. Scan through and select the best changes from each. - while (mine.index < mine.lines.length && their.index < their.lines.length) { - var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - - if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { - // Both modified ... - mutualChange(hunk, mine, their); - } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { - /*istanbul ignore start*/var _hunk$lines; - - /*istanbul ignore end*/ // Mine inserted - /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine))); - } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { - /*istanbul ignore start*/var _hunk$lines2; - - /*istanbul ignore end*/ // Theirs inserted - /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their))); - } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { - // Mine removed or edited - removal(hunk, mine, their); - } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { - // Their removed or edited - removal(hunk, their, mine, true); - } else if (mineCurrent === theirCurrent) { - // Context identity - hunk.lines.push(mineCurrent); - mine.index++; - their.index++; - } else { - // Context mismatch - conflict(hunk, collectChange(mine), collectChange(their)); - } - } - - // Now push anything that may be remaining - insertTrailing(hunk, mine); - insertTrailing(hunk, their); - - calcLineCount(hunk); - } + if (theirChanges.merged) { + var _hunk$lines6; - function mutualChange(hunk, mine, their) { - var myChanges = collectChange(mine), - theirChanges = collectChange(their); + (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); + } else { + conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); + } + } - if (allRemoves(myChanges) && allRemoves(theirChanges)) { - // Special case for remove changes that are supersets of one another - if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { - /*istanbul ignore start*/var _hunk$lines3; + function conflict(hunk, mine, their) { + hunk.conflict = true; + hunk.lines.push({ + conflict: true, + mine: mine, + theirs: their + }); + } - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges)); - return; - } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { - /*istanbul ignore start*/var _hunk$lines4; + function insertLeading(hunk, insert, their) { + while (insert.offset < their.offset && insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + insert.offset++; + } + } - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges)); - return; - } - } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) { - /*istanbul ignore start*/var _hunk$lines5; + function insertTrailing(hunk, insert) { + while (insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + } + } - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges)); - return; - } + function collectChange(state) { + var ret = [], + operation = state.lines[state.index][0]; - conflict(hunk, myChanges, theirChanges); - } + while (state.index < state.lines.length) { + var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. - function removal(hunk, mine, their, swap) { - var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - if (theirChanges.merged) { - /*istanbul ignore start*/var _hunk$lines6; + if (operation === '-' && line[0] === '+') { + operation = '+'; + } - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged)); - } else { - conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); - } - } + if (operation === line[0]) { + ret.push(line); + state.index++; + } else { + break; + } + } - function conflict(hunk, mine, their) { - hunk.conflict = true; - hunk.lines.push({ - conflict: true, - mine: mine, - theirs: their - }); - } + return ret; + } - function insertLeading(hunk, insert, their) { - while (insert.offset < their.offset && insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - insert.offset++; - } - } - function insertTrailing(hunk, insert) { - while (insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - } - } + function collectContext(state, matchChanges) { + var changes = [], + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; - function collectChange(state) { - var ret = [], - operation = state.lines[state.index][0]; - while (state.index < state.lines.length) { - var line = state.lines[state.index]; - - // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. - if (operation === '-' && line[0] === '+') { - operation = '+'; - } - - if (operation === line[0]) { - ret.push(line); - state.index++; - } else { - break; - } - } - - return ret; - } - function collectContext(state, matchChanges) { - var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - while (matchIndex < matchChanges.length && state.index < state.lines.length) { - var change = state.lines[state.index], - match = matchChanges[matchIndex]; - - // Once we've hit our add, then we are done - if (match[0] === '+') { - break; - } - - contextChanges = contextChanges || change[0] !== ' '; - - merged.push(match); - matchIndex++; - - // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this - if (change[0] === '+') { - conflicted = true; - - while (change[0] === '+') { - changes.push(change); - change = state.lines[++state.index]; - } - } - - if (match.substr(1) === change.substr(1)) { - changes.push(change); - state.index++; - } else { - conflicted = true; - } - } - - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { - conflicted = true; - } - - if (conflicted) { - return changes; - } - - while (matchIndex < matchChanges.length) { - merged.push(matchChanges[matchIndex++]); - } - - return { - merged: merged, - changes: changes - }; - } + while (matchIndex < matchChanges.length && state.index < state.lines.length) { + var change = state.lines[state.index], + match = matchChanges[matchIndex]; // Once we've hit our add, then we are done - function allRemoves(changes) { - return changes.reduce(function (prev, change) { - return prev && change[0] === '-'; - }, true); - } - function skipRemoveSuperset(state, removeChanges, delta) { - for (var i = 0; i < delta; i++) { - var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - if (state.lines[state.index + i] !== ' ' + changeContent) { - return false; - } - } - - state.index += delta; - return true; - } + if (match[0] === '+') { + break; + } - function calcOldNewLineCount(lines) { - var oldLines = 0; - var newLines = 0; - - lines.forEach(function (line) { - if (typeof line !== 'string') { - var myCount = calcOldNewLineCount(line.mine); - var theirCount = calcOldNewLineCount(line.theirs); - - if (oldLines !== undefined) { - if (myCount.oldLines === theirCount.oldLines) { - oldLines += myCount.oldLines; - } else { - oldLines = undefined; - } - } - - if (newLines !== undefined) { - if (myCount.newLines === theirCount.newLines) { - newLines += myCount.newLines; - } else { - newLines = undefined; - } - } - } else { - if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { - newLines++; - } - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { - oldLines++; - } - } - }); - - return { oldLines: oldLines, newLines: newLines }; - } + contextChanges = contextChanges || change[0] !== ' '; + merged.push(match); + matchIndex++; // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this + if (change[0] === '+') { + conflicted = true; + while (change[0] === '+') { + changes.push(change); + change = state.lines[++state.index]; + } + } -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports. /*istanbul ignore end*/structuredPatch = structuredPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch; - - var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; - - /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - if (typeof options.context === 'undefined') { - options.context = 4; - } - - var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options); - diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); - } - - var hunks = []; - var oldRangeStart = 0, - newRangeStart = 0, - curRange = [], - oldLine = 1, - newLine = 1; - - /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - /*istanbul ignore start*/var _curRange; - - /*istanbul ignore end*/ // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } - - // Output our changes - /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); - - // Track the updated file position - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - /*istanbul ignore start*/var _curRange2; - - /*istanbul ignore end*/ // Overlapping - /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines))); - } else { - /*istanbul ignore start*/var _curRange3; - - /*istanbul ignore end*/ // end the range and output - var contextSize = Math.min(lines.length, options.context); - /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - if (lines.length == 0 && !oldEOFNewline) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } else if (!oldEOFNewline || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } - hunks.push(hunk); - - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - oldLine += lines.length; - newLine += lines.length; - } - }; - - for (var i = 0; i < diff.length; i++) { - /*istanbul ignore start*/_loop( /*istanbul ignore end*/i); - } - - return { - oldFileName: oldFileName, newFileName: newFileName, - oldHeader: oldHeader, newHeader: newHeader, - hunks: hunks - }; - } + if (match.substr(1) === change.substr(1)) { + changes.push(change); + state.index++; + } else { + conflicted = true; + } + } - function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { + conflicted = true; + } - var ret = []; - if (oldFileName == newFileName) { - ret.push('Index: ' + oldFileName); - } - ret.push('==================================================================='); - ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); - ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + if (conflicted) { + return changes; + } - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); - ret.push.apply(ret, hunk.lines); - } + while (matchIndex < matchChanges.length) { + merged.push(matchChanges[matchIndex++]); + } - return ret.join('\n') + '\n'; - } + return { + merged: merged, + changes: changes + }; + } - function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); - } + function allRemoves(changes) { + return changes.reduce(function (prev, change) { + return prev && change[0] === '-'; + }, true); + } + function skipRemoveSuperset(state, removeChanges, delta) { + for (var i = 0; i < delta; i++) { + var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); + if (state.lines[state.index + i] !== ' ' + changeContent) { + return false; + } + } -/***/ }), -/* 15 */ -/***/ (function(module, exports) { + state.index += delta; + return true; + } - /*istanbul ignore start*/"use strict"; + function calcOldNewLineCount(lines) { + var oldLines = 0; + var newLines = 0; + lines.forEach(function (line) { + if (typeof line !== 'string') { + var myCount = calcOldNewLineCount(line.mine); + var theirCount = calcOldNewLineCount(line.theirs); - exports.__esModule = true; - exports. /*istanbul ignore end*/arrayEqual = arrayEqual; - /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith; - function arrayEqual(a, b) { - if (a.length !== b.length) { - return false; - } + if (oldLines !== undefined) { + if (myCount.oldLines === theirCount.oldLines) { + oldLines += myCount.oldLines; + } else { + oldLines = undefined; + } + } - return arrayStartsWith(a, b); - } + if (newLines !== undefined) { + if (myCount.newLines === theirCount.newLines) { + newLines += myCount.newLines; + } else { + newLines = undefined; + } + } + } else { + if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { + newLines++; + } - function arrayStartsWith(array, start) { - if (start.length > array.length) { - return false; - } + if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { + oldLines++; + } + } + }); + return { + oldLines: oldLines, + newLines: newLines + }; + } - for (var i = 0; i < start.length; i++) { - if (start[i] !== array[i]) { - return false; - } - } + // See: http://code.google.com/p/google-diff-match-patch/wiki/API + function convertChangesToDMP(changes) { + var ret = [], + change, + operation; - return true; - } + for (var i = 0; i < changes.length; i++) { + change = changes[i]; + if (change.added) { + operation = 1; + } else if (change.removed) { + operation = -1; + } else { + operation = 0; + } + ret.push([operation, change.value]); + } -/***/ }), -/* 16 */ -/***/ (function(module, exports) { - - /*istanbul ignore start*/"use strict"; - - exports.__esModule = true; - exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP; - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - function convertChangesToDMP(changes) { - var ret = [], - change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/, - operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - for (var i = 0; i < changes.length; i++) { - change = changes[i]; - if (change.added) { - operation = 1; - } else if (change.removed) { - operation = -1; - } else { - operation = 0; - } - - ret.push([operation, change.value]); - } - return ret; - } + return ret; + } + function convertChangesToXML(changes) { + var ret = []; + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; -/***/ }), -/* 17 */ -/***/ (function(module, exports) { + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } - /*istanbul ignore start*/'use strict'; + ret.push(escapeHTML(change.value)); - exports.__esModule = true; - exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML; - function convertChangesToXML(changes) { - var ret = []; - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } - ret.push(escapeHTML(change.value)); + return ret.join(''); + } - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - return ret.join(''); - } + function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + return n; + } - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); + /* See LICENSE file for terms of use */ - return n; - } + exports.Diff = Diff; + exports.diffChars = diffChars; + exports.diffWords = diffWords; + exports.diffWordsWithSpace = diffWordsWithSpace; + exports.diffLines = diffLines; + exports.diffTrimmedLines = diffTrimmedLines; + exports.diffSentences = diffSentences; + exports.diffCss = diffCss; + exports.diffJson = diffJson; + exports.diffArrays = diffArrays; + exports.structuredPatch = structuredPatch; + exports.createTwoFilesPatch = createTwoFilesPatch; + exports.createPatch = createPatch; + exports.applyPatch = applyPatch; + exports.applyPatches = applyPatches; + exports.parsePatch = parsePatch; + exports.merge = merge; + exports.convertChangesToDMP = convertChangesToDMP; + exports.convertChangesToXML = convertChangesToXML; + exports.canonicalize = canonicalize; + Object.defineProperty(exports, '__esModule', { value: true }); +})); -/***/ }) -/******/ ]) -}); -; },{}],49:[function(require,module,exports){ 'use strict'; @@ -13310,7 +13599,7 @@ module.exports = Function.prototype.bind || implementation; },{"./implementation":51}],53:[function(require,module,exports){ 'use strict'; -/* eslint complexity: [2, 17], max-statements: [2, 33] */ +/* 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; } @@ -13788,24 +14077,28 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } } } @@ -13833,115 +14126,6 @@ function isSlowBuffer (obj) { } },{}],58:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -},{}],59:[function(require,module,exports){ -(function (process){ -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 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || 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': - mkdirP(path.dirname(p), opts, function (er, made) { - 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 & (~process.umask()); - } - 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) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; - -}).call(this,require('_process')) -},{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){ /** * Helpers. */ @@ -13972,7 +14156,7 @@ module.exports = function(val, options) { var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); - } else if (type === 'number' && isNaN(val) === false) { + } else if (type === 'number' && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( @@ -13994,7 +14178,7 @@ function parse(str) { if (str.length > 100) { return; } - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + 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) { @@ -14105,7 +14289,7 @@ function plural(ms, msAbs, n, name) { return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); } -},{}],61:[function(require,module,exports){ +},{}],59:[function(require,module,exports){ 'use strict'; var keysShim; @@ -14139,6 +14323,8 @@ if (!Object.keys) { $frames: true, $innerHeight: true, $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, $outerHeight: true, $outerWidth: true, $pageXOffset: true, @@ -14227,7 +14413,7 @@ if (!Object.keys) { } module.exports = keysShim; -},{"./isArguments":63}],62:[function(require,module,exports){ +},{"./isArguments":61}],60:[function(require,module,exports){ 'use strict'; var slice = Array.prototype.slice; @@ -14261,7 +14447,7 @@ keysShim.shim = function shimObjectKeys() { module.exports = keysShim; -},{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){ +},{"./implementation":59,"./isArguments":61}],61:[function(require,module,exports){ 'use strict'; var toStr = Object.prototype.toString; @@ -14280,7 +14466,7 @@ module.exports = function isArguments(value) { return isArgs; }; -},{}],64:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ 'use strict'; // modified from https://github.com/es-shims/es6-shim @@ -14323,7 +14509,7 @@ module.exports = function assign(target, source1) { return objTarget; }; -},{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){ +},{"function-bind":52,"has-symbols/shams":53,"object-keys":60}],63:[function(require,module,exports){ 'use strict'; var defineProperties = require('define-properties'); @@ -14342,7 +14528,7 @@ defineProperties(polyfill, { module.exports = polyfill; -},{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){ +},{"./implementation":62,"./polyfill":64,"./shim":65,"define-properties":47}],64:[function(require,module,exports){ 'use strict'; var implementation = require('./implementation'); @@ -14395,7 +14581,7 @@ module.exports = function getPolyfill() { return Object.assign; }; -},{"./implementation":64}],67:[function(require,module,exports){ +},{"./implementation":62}],65:[function(require,module,exports){ 'use strict'; var define = require('define-properties'); @@ -14411,11 +14597,12 @@ module.exports = function shimAssign() { return polyfill; }; -},{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){ +},{"./polyfill":64,"define-properties":47}],66:[function(require,module,exports){ (function (process){ 'use strict'; -if (!process.version || +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 }; @@ -14459,7 +14646,7 @@ function nextTick(fn, arg1, arg2, arg3) { }).call(this,require('_process')) -},{"_process":69}],69:[function(require,module,exports){ +},{"_process":67}],67:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -14645,10 +14832,10 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],70:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ module.exports = require('./lib/_stream_duplex.js'); -},{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":69}],69:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -14694,7 +14881,7 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ @@ -14780,7 +14967,7 @@ Duplex.prototype._destroy = function (err, cb) { pna.nextTick(cb, err); }; -},{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){ +},{"./_stream_readable":71,"./_stream_writable":73,"core-util-is":44,"inherits":56,"process-nextick-args":66}],70:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -14813,7 +15000,7 @@ module.exports = PassThrough; var Transform = require('./_stream_transform'); /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ @@ -14828,7 +15015,7 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){ +},{"./_stream_transform":72,"core-util-is":44,"inherits":56}],71:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14896,7 +15083,7 @@ function _isUint8Array(obj) { /**/ /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ @@ -15850,7 +16037,7 @@ function indexOf(xs, x) { return -1; } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":71,"./internal/streams/BufferList":76,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":68,"safe-buffer":83,"string_decoder/":85,"util":40}],74:[function(require,module,exports){ +},{"./_stream_duplex":69,"./internal/streams/BufferList":74,"./internal/streams/destroy":75,"./internal/streams/stream":76,"_process":67,"core-util-is":44,"events":50,"inherits":56,"isarray":77,"process-nextick-args":66,"safe-buffer":82,"string_decoder/":84,"util":40}],72:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -15921,7 +16108,7 @@ module.exports = Transform; var Duplex = require('./_stream_duplex'); /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ @@ -16065,7 +16252,7 @@ function done(stream, er, data) { return stream.push(null); } -},{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){ +},{"./_stream_duplex":69,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){ (function (process,global,setImmediate){ // Copyright Joyent, Inc. and other Node contributors. // @@ -16133,7 +16320,7 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ @@ -16755,7 +16942,7 @@ Writable.prototype._destroy = function (err, cb) { cb(err); }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) -},{"./_stream_duplex":71,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"inherits":56,"process-nextick-args":68,"safe-buffer":83,"timers":86,"util-deprecate":87}],76:[function(require,module,exports){ +},{"./_stream_duplex":69,"./internal/streams/destroy":75,"./internal/streams/stream":76,"_process":67,"core-util-is":44,"inherits":56,"process-nextick-args":66,"safe-buffer":82,"timers":85,"util-deprecate":86}],74:[function(require,module,exports){ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -16835,7 +17022,7 @@ if (util && util.inspect && util.inspect.custom) { return this.constructor.name + ' ' + obj; }; } -},{"safe-buffer":83,"util":40}],77:[function(require,module,exports){ +},{"safe-buffer":82,"util":40}],75:[function(require,module,exports){ 'use strict'; /**/ @@ -16910,13 +17097,20 @@ module.exports = { destroy: destroy, undestroy: undestroy }; -},{"process-nextick-args":68}],78:[function(require,module,exports){ +},{"process-nextick-args":66}],76:[function(require,module,exports){ module.exports = require('events').EventEmitter; -},{"events":50}],79:[function(require,module,exports){ +},{"events":50}],77:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +},{}],78:[function(require,module,exports){ module.exports = require('./readable').PassThrough -},{"./readable":80}],80:[function(require,module,exports){ +},{"./readable":79}],79:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; @@ -16925,13 +17119,13 @@ exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); -},{"./lib/_stream_duplex.js":71,"./lib/_stream_passthrough.js":72,"./lib/_stream_readable.js":73,"./lib/_stream_transform.js":74,"./lib/_stream_writable.js":75}],81:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":69,"./lib/_stream_passthrough.js":70,"./lib/_stream_readable.js":71,"./lib/_stream_transform.js":72,"./lib/_stream_writable.js":73}],80:[function(require,module,exports){ module.exports = require('./readable').Transform -},{"./readable":80}],82:[function(require,module,exports){ +},{"./readable":79}],81:[function(require,module,exports){ module.exports = require('./lib/_stream_writable.js'); -},{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){ +},{"./lib/_stream_writable.js":73}],82:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer @@ -16995,7 +17189,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":43}],84:[function(require,module,exports){ +},{"buffer":43}],83:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -17124,7 +17318,7 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"events":50,"inherits":56,"readable-stream/duplex.js":70,"readable-stream/passthrough.js":79,"readable-stream/readable.js":80,"readable-stream/transform.js":81,"readable-stream/writable.js":82}],85:[function(require,module,exports){ +},{"events":50,"inherits":56,"readable-stream/duplex.js":68,"readable-stream/passthrough.js":78,"readable-stream/readable.js":79,"readable-stream/transform.js":80,"readable-stream/writable.js":81}],84:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -17421,7 +17615,7 @@ function simpleWrite(buf) { function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } -},{"safe-buffer":83}],86:[function(require,module,exports){ +},{"safe-buffer":82}],85:[function(require,module,exports){ (function (setImmediate,clearImmediate){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; @@ -17500,7 +17694,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : delete immediateIds[id]; }; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){ +},{"process/browser.js":67,"timers":85}],86:[function(require,module,exports){ (function (global){ /** @@ -17571,6 +17765,31 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],87:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + },{}],88:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' @@ -18168,10 +18387,10 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){ +},{"./support/isBuffer":88,"_process":67,"inherits":87}],90:[function(require,module,exports){ module.exports={ "name": "mocha", - "version": "7.1.1", + "version": "8.0.1", "homepage": "https://mochajs.org/", "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png" }