diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index b87171c3d..10da24768 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -59,12 +59,15 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.10.4" + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/core": { @@ -201,10 +204,13 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz", - "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==", - "dev": true + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/helper-replace-supers": { "version": "7.12.1", @@ -237,10 +243,13 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "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 + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/helpers": { "version": "7.12.1", @@ -254,14 +263,17 @@ } }, "node_modules/@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.10.4", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/highlight/node_modules/ansi-styles": { @@ -484,15 +496,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.5.tgz", - "integrity": "sha512-59KHWHXxVA9K4HNF4sbHCf+eJeFe0Te/ZFGqBT4OjXhrwvA04sGfaEGsVTdsjoszq0YTP49RC9UKe5g8uN2RwQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/plugin-syntax-typescript": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz", @@ -508,15 +511,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/template": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", @@ -613,42 +607,43 @@ } }, "node_modules/@jest/console": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.5.1.tgz", - "integrity": "sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-28.0.1.tgz", + "integrity": "sha512-c05/4ZS+1d/TM4svDxrsh+vbYUPC08C0zG/DWJgdv2rtkDgYHRfLtt9bSaWpSISE+NtqdRbnzbUtJeBXjTKyhQ==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-message-util": "^28.0.1", + "jest-util": "^28.0.1", "slash": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/console/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/console/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -660,19 +655,13 @@ "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/@jest/console/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/@jest/console/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -680,19 +669,7 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/@jest/console/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/core": { @@ -1399,91 +1376,127 @@ } }, "node_modules/@jest/environment": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", - "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-28.0.1.tgz", + "integrity": "sha512-PuN3TBNFSUKNgEgFgJxb15/GOyhXc46wbyCobUcf8ijUgteEmVXD4FfUZpe5QXg/bpmydufzx/02BRlUfkM44Q==", "dev": true, "dependencies": { - "@jest/fake-timers": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/fake-timers": "^28.0.1", + "@jest/types": "^28.0.1", "@types/node": "*", - "jest-mock": "^27.5.1" + "jest-mock": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/environment/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/environment/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, + "node_modules/@jest/expect": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-28.0.1.tgz", + "integrity": "sha512-qRAiC7/gJ/1z2O+TnGCVUTJ/HkqXhDCSm4R7ydfY/rOMryvFzccpALmHdI8joovGRQvkHStM/wwHRHRQTc8+zQ==", + "dev": true, + "dependencies": { + "expect": "^28.0.1", + "jest-snapshot": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-28.0.1.tgz", + "integrity": "sha512-ctuvt7SeoVlG3P2eemtq3/TF5a7ncnpC18Ctv1BjCfBjkjVKtAkDblw6qhx24tZlYdhm0lrihwK80pkzmkUctw==", + "dev": true, + "dependencies": { + "jest-get-type": "^28.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/@jest/expect-utils/node_modules/jest-get-type": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.0.tgz", + "integrity": "sha512-754LtawzW+Qk4o5rC+eDqfcQ9dV8z9uvbaVenmK8pju11PBGfuMDvQwRxoPews0LCaumNmYHjcAwmkYINTlhIA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, "node_modules/@jest/fake-timers": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", - "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-28.0.1.tgz", + "integrity": "sha512-w7JleyVymoVWMvsnRRpM/ySM+K6qq+cLwK33VbFAghKTHp14oBiOio1Hh1egUyFdNybmKZxQvBBwB0M/48LgGQ==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "@sinonjs/fake-timers": "^8.0.1", + "@jest/types": "^28.0.1", + "@sinonjs/fake-timers": "^9.1.1", "@types/node": "*", - "jest-message-util": "^27.5.1", - "jest-mock": "^27.5.1", - "jest-util": "^27.5.1" + "jest-message-util": "^28.0.1", + "jest-mock": "^28.0.1", + "jest-util": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/fake-timers/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", - "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", + "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", "dev": true, "dependencies": { "@sinonjs/commons": "^1.7.0" } }, "node_modules/@jest/fake-timers/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -1495,19 +1508,13 @@ "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/@jest/fake-timers/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/@jest/fake-timers/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -1515,55 +1522,44 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/@jest/fake-timers/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/globals": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", - "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-28.0.1.tgz", + "integrity": "sha512-KBWuQ1PQjm8IKUObSSQAGlGguJZHKaVCHWY99FSGwjyf58hT9yCYH2wFfLhWocy4Y5otK2gZbsCwWVX6WXft2Q==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/types": "^27.5.1", - "expect": "^27.5.1" + "@jest/environment": "^28.0.1", + "@jest/expect": "^28.0.1", + "@jest/types": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/globals/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/globals/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -1815,186 +1811,147 @@ "node": ">= 10" } }, + "node_modules/@jest/schemas": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.0.0.tgz", + "integrity": "sha512-Pap9Jvwr8KYFvDgkya/p0FCVya+jZkWt57lHpwBylfjgmwi/gtXfhyAO/Cw+jKuMafHcXY0beNf2XV2pkcu9vA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.23.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, "node_modules/@jest/source-map": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.5.1.tgz", - "integrity": "sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-28.0.0.tgz", + "integrity": "sha512-yeD/Y94j6UJPiaZTG5Sdww7pbHvEc7RlTucoVAdXaBaSuNcyrAkLlJonAb/xX/efCugDOEbFJdATsSnDEh45Nw==", "dev": true, "dependencies": { + "@jridgewell/trace-mapping": "^0.3.7", "callsites": "^3.0.0", - "graceful-fs": "^4.2.9", - "source-map": "^0.6.0" + "graceful-fs": "^4.2.9" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/@jest/source-map/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/@jest/test-result": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.5.1.tgz", - "integrity": "sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-28.0.1.tgz", + "integrity": "sha512-8LhoEbdIkkYK+PZx6JhfRvI1Jw7tfB77OEJUQwp0diBvXJpjPKeFFWfsbpm7djdXuKoKvXKNzSGgjXDOFbxuhg==", "dev": true, "dependencies": { - "@jest/console": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/console": "^28.0.1", + "@jest/types": "^28.0.1", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/test-result/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/test-result/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@jest/transform": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.5.1.tgz", - "integrity": "sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-28.0.1.tgz", + "integrity": "sha512-45fxjycts6CTPMeusSICYhMkMgFAs1opvgEBYcMmukucJw/AgVEMsGFqheWyDzlU6GJ+h9cpft/zkTGPJtzRGQ==", "dev": true, "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^27.5.1", + "@babel/core": "^7.11.6", + "@jest/types": "^28.0.1", + "@jridgewell/trace-mapping": "^0.3.7", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-haste-map": "^28.0.1", + "jest-regex-util": "^28.0.0", + "jest-util": "^28.0.1", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" + "write-file-atomic": "^4.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/transform/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/transform/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, - "node_modules/@jest/transform/node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/transform/node_modules/ci-info": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/@jest/transform/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, - "node_modules/@jest/transform/node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/transform/node_modules/istanbul-lib-instrument": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.1.0.tgz", - "integrity": "sha512-czwUz525rkOFDJxfKK6mYfIs9zBKILyrZQxjz3ABhjQXhbhFsSbo1HW/BFcsDnfJYJWA6thRR5/TUY2qs5W99Q==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/transform/node_modules/jest-regex-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", - "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-28.0.0.tgz", + "integrity": "sha512-VqrjkteNiucN3ctI/AtBzO7iitfk5YGArPwU2cJ3WyT5Z6kGFHw/HQp0fSTkOUHdwVdJkFzbI5nh0yC82f9Kfg==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/@jest/transform/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -2002,50 +1959,20 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/@jest/transform/node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "node_modules/@jest/transform/node_modules/write-file-atomic": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", + "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/@jest/transform/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/@jest/transform/node_modules/pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", - "dev": true, "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/transform/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" + "node": "^12.13.0 || ^14.15.0 || >=16" } }, "node_modules/@jest/types": { @@ -2064,6 +1991,37 @@ "node": ">= 10.14.2" } }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", + "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", + "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.4.tgz", + "integrity": "sha512-0/WqSvpVbCBAV1yPeko7eAczKbs78dNVAaX14quVlwOb2wxfKuXCx91h4NrEfkYK9zEnyVSW4JVI/trP3iS+Qg==", + "dev": true + }, "node_modules/@sinonjs/commons": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", @@ -2486,21 +2444,46 @@ "integrity": "sha1-STVfu+qzhEm8ppahqsxGml7p/Uc=" }, "node_modules/babel-plugin-istanbul": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz", - "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-instrument": "^5.0.4", "test-exclude": "^6.0.0" }, "engines": { "node": ">=8" } }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz", + "integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/babel-preset-current-node-syntax": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", @@ -3374,54 +3357,160 @@ "dev": true }, "node_modules/expect": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", - "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-28.0.1.tgz", + "integrity": "sha512-sJjuHVbveEUczNITHKgHUepbEyj+UzjACMNuEln5tZI6b9L/y8jTXAN8VnOCnMoK7vuQPSttO/5HlKB+G3Enpw==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "jest-get-type": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1" + "@jest/expect-utils": "^28.0.1", + "jest-get-type": "^28.0.0", + "jest-matcher-utils": "^28.0.1", + "jest-message-util": "^28.0.1", + "jest-util": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/expect/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/expect/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, - "node_modules/expect/node_modules/jest-get-type": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", - "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", - "dev": true, + "node_modules/expect/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": ">=8" + } + }, + "node_modules/expect/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/expect/node_modules/ci-info": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", + "dev": true + }, + "node_modules/expect/node_modules/diff-sequences": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.0.0.tgz", + "integrity": "sha512-GTIQPn2pPa1DMoEH70P9yQgYLcGW8bjPR5EOL2JO9/7DQHX+9tTFJee3UmlGWuyUvIqMgpXXssrckLubiEUZTg==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, + "node_modules/expect/node_modules/jest-diff": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.0.1.tgz", + "integrity": "sha512-XtUUND9AlP6y+O5gnxm54rcFxs65isB1NahScgBU+NqiUYdKK9qXMXAotkTJHui6GUdjApXq0zvSXB6zQh9CNg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.0.0", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/jest-get-type": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.0.tgz", + "integrity": "sha512-754LtawzW+Qk4o5rC+eDqfcQ9dV8z9uvbaVenmK8pju11PBGfuMDvQwRxoPews0LCaumNmYHjcAwmkYINTlhIA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/jest-matcher-utils": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.0.1.tgz", + "integrity": "sha512-AE1oD7mFC/rcdKYa3Nebd+zo9HOUq+x5l3ol9EHgVanxffPcDxuQELvDGDUG6jq4w/x8IDmvPHjZ42ZD5iGwCg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.0.1", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/jest-util": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", + "dev": true, + "dependencies": { + "@jest/types": "^28.0.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/pretty-format": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.0.1.tgz", + "integrity": "sha512-utVSIy0ImophYyJALfiWULOeMnfoxLZEzii/92VcSzN7OX5U1r7erAMqfDJyuv31ugw4Rp5tOYUMndsZV1w8DQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/react-is": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", + "integrity": "sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==", + "dev": true + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -3746,9 +3835,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, "node_modules/growly": { @@ -4258,9 +4347,9 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "node_modules/istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", "dev": true, "engines": { "node": ">=8" @@ -4485,88 +4574,143 @@ } }, "node_modules/jest-circus": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.5.1.tgz", - "integrity": "sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-28.0.1.tgz", + "integrity": "sha512-33Ulac556FQcgQkDEXVVDag4PGQd+lWP9bxsuVg4q+b4x1cMiWNMCUjN5Dv1q/n90PvGzWxqXuN5X3gF93msew==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/environment": "^28.0.1", + "@jest/expect": "^28.0.1", + "@jest/test-result": "^28.0.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", - "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-runtime": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", - "pretty-format": "^27.5.1", + "jest-each": "^28.0.1", + "jest-matcher-utils": "^28.0.1", + "jest-message-util": "^28.0.1", + "jest-runtime": "^28.0.1", + "jest-snapshot": "^28.0.1", + "jest-util": "^28.0.1", + "pretty-format": "^28.0.1", "slash": "^3.0.0", "stack-utils": "^2.0.3", "throat": "^6.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-circus/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-circus/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, + "node_modules/jest-circus/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-circus/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/jest-circus/node_modules/ci-info": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/jest-circus/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "node_modules/jest-circus/node_modules/diff-sequences": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.0.0.tgz", + "integrity": "sha512-GTIQPn2pPa1DMoEH70P9yQgYLcGW8bjPR5EOL2JO9/7DQHX+9tTFJee3UmlGWuyUvIqMgpXXssrckLubiEUZTg==", "dev": true, "engines": { - "node": ">=8" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/jest-circus/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true + "node_modules/jest-circus/node_modules/jest-diff": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.0.1.tgz", + "integrity": "sha512-XtUUND9AlP6y+O5gnxm54rcFxs65isB1NahScgBU+NqiUYdKK9qXMXAotkTJHui6GUdjApXq0zvSXB6zQh9CNg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.0.0", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/jest-get-type": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.0.tgz", + "integrity": "sha512-754LtawzW+Qk4o5rC+eDqfcQ9dV8z9uvbaVenmK8pju11PBGfuMDvQwRxoPews0LCaumNmYHjcAwmkYINTlhIA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/jest-matcher-utils": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.0.1.tgz", + "integrity": "sha512-AE1oD7mFC/rcdKYa3Nebd+zo9HOUq+x5l3ol9EHgVanxffPcDxuQELvDGDUG6jq4w/x8IDmvPHjZ42ZD5iGwCg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.0.1", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } }, "node_modules/jest-circus/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -4574,33 +4718,30 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-circus/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/jest-circus/node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "node_modules/jest-circus/node_modules/pretty-format": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.0.1.tgz", + "integrity": "sha512-utVSIy0ImophYyJALfiWULOeMnfoxLZEzii/92VcSzN7OX5U1r7erAMqfDJyuv31ugw4Rp5tOYUMndsZV1w8DQ==", "dev": true, "dependencies": { - "escape-string-regexp": "^2.0.0" + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, + "node_modules/jest-circus/node_modules/react-is": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", + "integrity": "sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==", + "dev": true + }, "node_modules/jest-circus/node_modules/throat": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/throat/-/throat-6.0.1.tgz", @@ -4644,74 +4785,90 @@ } }, "node_modules/jest-each": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.5.1.tgz", - "integrity": "sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-28.0.1.tgz", + "integrity": "sha512-C7ftacESgAPcs2CydQYJKBFi0T0jkuxZWds2f901coi0SJ4M9ONhFHR2WmfJpHiPWGhAl3N9E8qn8QCZhCk9fA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "chalk": "^4.0.0", - "jest-get-type": "^27.5.1", - "jest-util": "^27.5.1", - "pretty-format": "^27.5.1" + "jest-get-type": "^28.0.0", + "jest-util": "^28.0.1", + "pretty-format": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-each/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-each/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, + "node_modules/jest-each/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-each/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/jest-each/node_modules/ci-info": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/jest-each/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/jest-each/node_modules/jest-get-type": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", - "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.0.tgz", + "integrity": "sha512-754LtawzW+Qk4o5rC+eDqfcQ9dV8z9uvbaVenmK8pju11PBGfuMDvQwRxoPews0LCaumNmYHjcAwmkYINTlhIA==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-each/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -4719,21 +4876,30 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/jest-each/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "node_modules/jest-each/node_modules/pretty-format": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.0.1.tgz", + "integrity": "sha512-utVSIy0ImophYyJALfiWULOeMnfoxLZEzii/92VcSzN7OX5U1r7erAMqfDJyuv31ugw4Rp5tOYUMndsZV1w8DQ==", "dev": true, - "engines": { - "node": ">=8.6" + "dependencies": { + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, + "node_modules/jest-each/node_modules/react-is": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", + "integrity": "sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==", + "dev": true + }, "node_modules/jest-get-type": { "version": "26.3.0", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", @@ -4744,51 +4910,51 @@ } }, "node_modules/jest-haste-map": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.5.1.tgz", - "integrity": "sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-28.0.1.tgz", + "integrity": "sha512-qjpK9NDBiwlSHbKS0rDUDOTTDSHT4tNnJbUewfMsSiWFAOAqgcBDG3o5f1N9Srx5Hz14QsdnDuK9oy6oyQqJ9g==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "@types/graceful-fs": "^4.1.2", + "@jest/types": "^28.0.1", + "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-regex-util": "^27.5.1", - "jest-serializer": "^27.5.1", - "jest-util": "^27.5.1", - "jest-worker": "^27.5.1", + "jest-regex-util": "^28.0.0", + "jest-util": "^28.0.1", + "jest-worker": "^28.0.1", "micromatch": "^4.0.4", "walker": "^1.0.7" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "optionalDependencies": { "fsevents": "^2.3.2" } }, "node_modules/jest-haste-map/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-haste-map/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -4800,28 +4966,22 @@ "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/jest-haste-map/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/jest-haste-map/node_modules/jest-regex-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", - "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-28.0.0.tgz", + "integrity": "sha512-VqrjkteNiucN3ctI/AtBzO7iitfk5YGArPwU2cJ3WyT5Z6kGFHw/HQp0fSTkOUHdwVdJkFzbI5nh0yC82f9Kfg==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-haste-map/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -4829,32 +4989,7 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-haste-map/node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", - "dev": true, - "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/jest-haste-map/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-matcher-utils": { @@ -4872,242 +5007,137 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/jest-matcher-utils/node_modules/jest-get-type": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", - "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", - "dev": true, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-message-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", - "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^27.5.1", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^27.5.1", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-message-util/node_modules/@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/jest-message-util/node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/jest-message-util/node_modules/@babel/highlight": { - "version": "7.16.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", - "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/jest-message-util/node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-message-util/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^16.0.0", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-message-util/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", - "dev": true, - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "node_modules/jest-message-util/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "node_modules/jest-matcher-utils/node_modules/jest-get-type": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", "dev": true, "engines": { - "node": ">=4" + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/jest-message-util/node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "node_modules/jest-message-util": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-28.0.1.tgz", + "integrity": "sha512-Eb+s5Ow4MxcQb4gcIVWVdnLxCnaPrl6DZjOVe7MjKHhexmJlkVTdwvdC//YrAsJKWMU8eG2rdaGbgBk2zG2MLA==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "@babel/code-frame": "^7.12.13", + "@jest/types": "^28.0.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^28.0.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" }, "engines": { - "node": ">=8.6" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/jest-message-util/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "node_modules/jest-message-util/node_modules/@jest/types": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, - "engines": { - "node": ">=8.6" + "dependencies": { + "@jest/schemas": "^28.0.0", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/jest-message-util/node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "node_modules/jest-message-util/node_modules/@types/yargs": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" + "@types/yargs-parser": "*" } }, - "node_modules/jest-message-util/node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "node_modules/jest-message-util/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" } }, - "node_modules/jest-message-util/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/jest-message-util/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-message-util/node_modules/pretty-format": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.0.1.tgz", + "integrity": "sha512-utVSIy0ImophYyJALfiWULOeMnfoxLZEzii/92VcSzN7OX5U1r7erAMqfDJyuv31ugw4Rp5tOYUMndsZV1w8DQ==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": ">=4" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, + "node_modules/jest-message-util/node_modules/react-is": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", + "integrity": "sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==", + "dev": true + }, "node_modules/jest-mock": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", - "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-28.0.1.tgz", + "integrity": "sha512-pEi1eywUvu7Ko8T5QX6l4X4694cd9NqzyeFFnH7QYDEm4INKxNbgBKLnaNmp025SlH9WHHDkHTeY4zRHPicMHw==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-mock/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-mock/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -5140,24 +5170,23 @@ } }, "node_modules/jest-resolve": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz", - "integrity": "sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-28.0.1.tgz", + "integrity": "sha512-nQahkVO8flCRsXtlq3JZb+pElJ+9s2L9TQ0xs6x1DLXgZ3FvB3XRfQGnsqtxyMKEAbbEfypGQv1rUVpIrWfssg==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", + "jest-haste-map": "^28.0.1", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^27.5.1", - "jest-validate": "^27.5.1", + "jest-util": "^28.0.1", + "jest-validate": "^28.0.1", "resolve": "^1.20.0", "resolve.exports": "^1.1.0", "slash": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-resolve-dependencies": { @@ -5408,25 +5437,26 @@ } }, "node_modules/jest-resolve/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-resolve/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -5438,12 +5468,6 @@ "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/jest-resolve/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/jest-resolve/node_modules/is-core-module": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", @@ -5457,12 +5481,12 @@ } }, "node_modules/jest-resolve/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -5470,19 +5494,7 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-resolve/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-resolve/node_modules/resolve": { @@ -5503,58 +5515,59 @@ } }, "node_modules/jest-runtime": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.5.1.tgz", - "integrity": "sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A==", - "dev": true, - "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/fake-timers": "^27.5.1", - "@jest/globals": "^27.5.1", - "@jest/source-map": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-28.0.1.tgz", + "integrity": "sha512-bC22PNBaMK/tX6rMIUf7Usn9V1DallrRyA5QzTqRjz0E2E1UZMUZzKWzhbV6opCI1QSgr5srn0qNUl0MpgWm1g==", + "dev": true, + "dependencies": { + "@jest/environment": "^28.0.1", + "@jest/fake-timers": "^28.0.1", + "@jest/globals": "^28.0.1", + "@jest/source-map": "^28.0.0", + "@jest/test-result": "^28.0.1", + "@jest/transform": "^28.0.1", + "@jest/types": "^28.0.1", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "execa": "^5.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-mock": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-resolve": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", + "jest-haste-map": "^28.0.1", + "jest-message-util": "^28.0.1", + "jest-mock": "^28.0.1", + "jest-regex-util": "^28.0.0", + "jest-resolve": "^28.0.1", + "jest-snapshot": "^28.0.1", + "jest-util": "^28.0.1", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-runtime/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-runtime/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -5621,12 +5634,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jest-runtime/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/jest-runtime/node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -5649,21 +5656,21 @@ } }, "node_modules/jest-runtime/node_modules/jest-regex-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", - "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-28.0.0.tgz", + "integrity": "sha512-VqrjkteNiucN3ctI/AtBzO7iitfk5YGArPwU2cJ3WyT5Z6kGFHw/HQp0fSTkOUHdwVdJkFzbI5nh0yC82f9Kfg==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-runtime/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -5671,7 +5678,7 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-runtime/node_modules/npm-run-path": { @@ -5695,18 +5702,6 @@ "node": ">=8" } }, - "node_modules/jest-runtime/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/jest-runtime/node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5728,111 +5723,148 @@ "node": ">=8" } }, - "node_modules/jest-serializer": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.5.1.tgz", - "integrity": "sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==", - "dev": true, - "dependencies": { - "@types/node": "*", - "graceful-fs": "^4.2.9" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-serializer/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, "node_modules/jest-snapshot": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.5.1.tgz", - "integrity": "sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-28.0.1.tgz", + "integrity": "sha512-xaNY3ZZtOBYIpYSAqLpClZJs66wWVpKgsQiFvu8xxjjQBRmwYwu2CAmdaiL5wmd9KxrGX+viLm2vI964hIiIcw==", "dev": true, "dependencies": { - "@babel/core": "^7.7.2", + "@babel/core": "^7.11.6", "@babel/generator": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", "@babel/traverse": "^7.7.2", - "@babel/types": "^7.0.0", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", - "@types/babel__traverse": "^7.0.4", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^28.0.1", + "@jest/transform": "^28.0.1", + "@jest/types": "^28.0.1", + "@types/babel__traverse": "^7.0.6", "@types/prettier": "^2.1.5", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^27.5.1", + "expect": "^28.0.1", "graceful-fs": "^4.2.9", - "jest-diff": "^27.5.1", - "jest-get-type": "^27.5.1", - "jest-haste-map": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-diff": "^28.0.1", + "jest-get-type": "^28.0.0", + "jest-haste-map": "^28.0.1", + "jest-matcher-utils": "^28.0.1", + "jest-message-util": "^28.0.1", + "jest-util": "^28.0.1", "natural-compare": "^1.4.0", - "pretty-format": "^27.5.1", - "semver": "^7.3.2" + "pretty-format": "^28.0.1", + "semver": "^7.3.5" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-snapshot/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-snapshot/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, + "node_modules/jest-snapshot/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-snapshot/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/jest-snapshot/node_modules/ci-info": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, - "node_modules/jest-snapshot/node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true + "node_modules/jest-snapshot/node_modules/diff-sequences": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.0.0.tgz", + "integrity": "sha512-GTIQPn2pPa1DMoEH70P9yQgYLcGW8bjPR5EOL2JO9/7DQHX+9tTFJee3UmlGWuyUvIqMgpXXssrckLubiEUZTg==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/jest-diff": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.0.1.tgz", + "integrity": "sha512-XtUUND9AlP6y+O5gnxm54rcFxs65isB1NahScgBU+NqiUYdKK9qXMXAotkTJHui6GUdjApXq0zvSXB6zQh9CNg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.0.0", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } }, "node_modules/jest-snapshot/node_modules/jest-get-type": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", - "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.0.tgz", + "integrity": "sha512-754LtawzW+Qk4o5rC+eDqfcQ9dV8z9uvbaVenmK8pju11PBGfuMDvQwRxoPews0LCaumNmYHjcAwmkYINTlhIA==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/jest-matcher-utils": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.0.1.tgz", + "integrity": "sha512-AE1oD7mFC/rcdKYa3Nebd+zo9HOUq+x5l3ol9EHgVanxffPcDxuQELvDGDUG6jq4w/x8IDmvPHjZ42ZD5iGwCg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.0.1", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-snapshot/node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.0.1.tgz", + "integrity": "sha512-gFpqWx9XqBmJRYqSnQ2FbpxWpvAU3TIGFQcfBrwnMVvwbB1ZHhhoQgS+oD0Ek61l9XkLsoWW20woaNlCRf4eMA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -5840,21 +5872,30 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, - "node_modules/jest-snapshot/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "node_modules/jest-snapshot/node_modules/pretty-format": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.0.1.tgz", + "integrity": "sha512-utVSIy0ImophYyJALfiWULOeMnfoxLZEzii/92VcSzN7OX5U1r7erAMqfDJyuv31ugw4Rp5tOYUMndsZV1w8DQ==", "dev": true, - "engines": { - "node": ">=8.6" + "dependencies": { + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, + "node_modules/jest-snapshot/node_modules/react-is": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", + "integrity": "sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==", + "dev": true + }, "node_modules/jest-util": { "version": "26.6.0", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-26.6.0.tgz", @@ -5873,47 +5914,69 @@ } }, "node_modules/jest-validate": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz", - "integrity": "sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-28.0.1.tgz", + "integrity": "sha512-1mWGDluyjCSGc5u/gw0JKo6SlVfALiho5bLTfqmStOsdy3k69k7/dp18dq49WctHwQ9C+i4SkqpbQG7l63nxiw==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^27.5.1", + "jest-get-type": "^28.0.0", "leven": "^3.1.0", - "pretty-format": "^27.5.1" + "pretty-format": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-validate/node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.0.1.tgz", + "integrity": "sha512-Z48DBfQDtTZZAImaa1m8O1SCP9gx355FhuA6xuS8e7V5gQbj4l2hk/+EELN4UU/O9i5gjQuc94N/gC61/Qxfxw==", "dev": true, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-validate/node_modules/@types/yargs": { - "version": "16.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", - "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", + "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, + "node_modules/jest-validate/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-validate/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/jest-validate/node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -5927,14 +5990,35 @@ } }, "node_modules/jest-validate/node_modules/jest-get-type": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", - "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.0.tgz", + "integrity": "sha512-754LtawzW+Qk4o5rC+eDqfcQ9dV8z9uvbaVenmK8pju11PBGfuMDvQwRxoPews0LCaumNmYHjcAwmkYINTlhIA==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + } + }, + "node_modules/jest-validate/node_modules/pretty-format": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.0.1.tgz", + "integrity": "sha512-utVSIy0ImophYyJALfiWULOeMnfoxLZEzii/92VcSzN7OX5U1r7erAMqfDJyuv31ugw4Rp5tOYUMndsZV1w8DQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, + "node_modules/jest-validate/node_modules/react-is": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", + "integrity": "sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==", + "dev": true + }, "node_modules/jest-watcher": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-26.6.2.tgz", @@ -6063,9 +6147,9 @@ } }, "node_modules/jest-worker": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", - "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-28.0.1.tgz", + "integrity": "sha512-Z3j1jfZwtt2ruKwU391a4/kKdYEId7Vy9+6Jeeq5Xl0glJDnOAvO5ixNmgMokMmbpet41jc4MpUx71ciyeTB/A==", "dev": true, "dependencies": { "@types/node": "*", @@ -6073,7 +6157,7 @@ "supports-color": "^8.0.0" }, "engines": { - "node": ">= 10.13.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" } }, "node_modules/jest-worker/node_modules/supports-color": { @@ -7100,16 +7184,16 @@ "dev": true }, "node_modules/micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=8" + "node": ">=8.6" } }, "node_modules/mime-db": { @@ -7261,15 +7345,6 @@ "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", "dev": true }, - "node_modules/node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/node-notifier": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.2.tgz", @@ -7597,9 +7672,9 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "node_modules/picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" @@ -7609,13 +7684,10 @@ } }, "node_modules/pirates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", - "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", "dev": true, - "dependencies": { - "node-modules-regexp": "^1.0.0" - }, "engines": { "node": ">= 6" } @@ -8311,9 +8383,9 @@ "optional": true }, "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "node_modules/sisteransi": { @@ -8601,9 +8673,9 @@ } }, "node_modules/stack-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.2.tgz", - "integrity": "sha512-0H7QK2ECz3fyZMzQ8rH0j2ykpfbnd20BFtfg/SqVC2+sCTtcw0aDTGB7dk+de4U4uUeuz6nOtJcrkFFLG1B0Rg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", + "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", "dev": true, "dependencies": { "escape-string-regexp": "^2.0.0" diff --git a/node_modules/@babel/code-frame/README.md b/node_modules/@babel/code-frame/README.md index 185f93d24..08cacb047 100644 --- a/node_modules/@babel/code-frame/README.md +++ b/node_modules/@babel/code-frame/README.md @@ -2,7 +2,7 @@ > Generate errors that contain a code frame that point to source locations. -See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information. +See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information. ## Install diff --git a/node_modules/@babel/code-frame/lib/index.js b/node_modules/@babel/code-frame/lib/index.js index 28d86f7bc..cba3f8379 100644 --- a/node_modules/@babel/code-frame/lib/index.js +++ b/node_modules/@babel/code-frame/lib/index.js @@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", { exports.codeFrameColumns = codeFrameColumns; exports.default = _default; -var _highlight = _interopRequireWildcard(require("@babel/highlight")); - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _highlight = require("@babel/highlight"); let deprecationWarningShown = false; @@ -105,10 +101,10 @@ function codeFrameColumns(rawLines, loc, opts = {}) { const hasColumns = loc.start && typeof loc.start.column === "number"; const numberMaxWidth = String(end).length; const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines; - let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => { + let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => { const number = start + 1 + index; const paddedNumber = ` ${number}`.slice(-numberMaxWidth); - const gutter = ` ${paddedNumber} | `; + const gutter = ` ${paddedNumber} |`; const hasMarker = markerLines[number]; const lastMarkerLine = !markerLines[number + 1]; @@ -118,16 +114,16 @@ function codeFrameColumns(rawLines, loc, opts = {}) { if (Array.isArray(hasMarker)) { const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " "); const numberOfMarkers = hasMarker[1] || 1; - markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); + markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); if (lastMarkerLine && opts.message) { markerLine += " " + maybeHighlight(defs.message, opts.message); } } - return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); + return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join(""); } else { - return ` ${maybeHighlight(defs.gutter, gutter)}${line}`; + return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`; } }).join("\n"); diff --git a/node_modules/@babel/code-frame/package.json b/node_modules/@babel/code-frame/package.json index d2e0ccffd..ee1b3820a 100644 --- a/node_modules/@babel/code-frame/package.json +++ b/node_modules/@babel/code-frame/package.json @@ -1,9 +1,10 @@ { "name": "@babel/code-frame", - "version": "7.10.4", + "version": "7.16.7", "description": "Generate errors that contain a code frame that point to source locations.", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", + "author": "The Babel Team (https://babel.dev/team)", + "homepage": "https://babel.dev/docs/en/next/babel-code-frame", + "bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen", "license": "MIT", "publishConfig": { "access": "public" @@ -13,13 +14,16 @@ "url": "https://github.com/babel/babel.git", "directory": "packages/babel-code-frame" }, - "main": "lib/index.js", + "main": "./lib/index.js", "dependencies": { - "@babel/highlight": "^7.10.4" + "@babel/highlight": "^7.16.7" }, "devDependencies": { + "@types/chalk": "^2.0.0", "chalk": "^2.0.0", "strip-ansi": "^4.0.0" }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + "engines": { + "node": ">=6.9.0" + } +} \ No newline at end of file diff --git a/node_modules/@babel/helper-plugin-utils/README.md b/node_modules/@babel/helper-plugin-utils/README.md index 4e6303e08..c17852d3a 100644 --- a/node_modules/@babel/helper-plugin-utils/README.md +++ b/node_modules/@babel/helper-plugin-utils/README.md @@ -2,18 +2,18 @@ > General utilities for plugins to use -See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/next/babel-helper-plugin-utils.html) for more information. +See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/babel-helper-plugin-utils) for more information. ## Install Using npm: ```sh -npm install --save-dev @babel/helper-plugin-utils +npm install --save @babel/helper-plugin-utils ``` or using yarn: ```sh -yarn add @babel/helper-plugin-utils --dev +yarn add @babel/helper-plugin-utils ``` diff --git a/node_modules/@babel/helper-plugin-utils/lib/index.js b/node_modules/@babel/helper-plugin-utils/lib/index.js index adb0656fa..0ba1be022 100644 --- a/node_modules/@babel/helper-plugin-utils/lib/index.js +++ b/node_modules/@babel/helper-plugin-utils/lib/index.js @@ -7,19 +7,32 @@ exports.declare = declare; function declare(builder) { return (api, options, dirname) => { - if (!api.assertVersion) { - api = Object.assign(copyApiObject(api), { - assertVersion(range) { - throwVersionError(range, api.version); - } + var _clonedApi2; - }); + let clonedApi; + + for (const name of Object.keys(apiPolyfills)) { + var _clonedApi; + + if (api[name]) continue; + clonedApi = (_clonedApi = clonedApi) != null ? _clonedApi : copyApiObject(api); + clonedApi[name] = apiPolyfills[name](clonedApi); } - return builder(api, options || {}, dirname); + return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname); }; } +const apiPolyfills = { + assertVersion: api => range => { + throwVersionError(range, api.version); + }, + targets: () => () => { + return {}; + }, + assumption: () => () => {} +}; + function copyApiObject(api) { let proto = null; diff --git a/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/helper-plugin-utils/package.json index 282d93f71..740d52ac3 100644 --- a/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/helper-plugin-utils/package.json @@ -1,9 +1,9 @@ { "name": "@babel/helper-plugin-utils", - "version": "7.10.4", + "version": "7.16.7", "description": "General utilities for plugins to use", - "author": "Logan Smyth ", - "homepage": "https://babeljs.io/", + "author": "The Babel Team (https://babel.dev/team)", + "homepage": "https://babel.dev/docs/en/next/babel-helper-plugin-utils", "license": "MIT", "publishConfig": { "access": "public" @@ -13,6 +13,8 @@ "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-plugin-utils" }, - "main": "lib/index.js", - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + "main": "./lib/index.js", + "engines": { + "node": ">=6.9.0" + } +} \ No newline at end of file diff --git a/node_modules/@babel/helper-validator-identifier/README.md b/node_modules/@babel/helper-validator-identifier/README.md index ab2dad173..4f704c428 100644 --- a/node_modules/@babel/helper-validator-identifier/README.md +++ b/node_modules/@babel/helper-validator-identifier/README.md @@ -2,18 +2,18 @@ > Validate identifier/keywords name -See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information. +See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/babel-helper-validator-identifier) for more information. ## Install Using npm: ```sh -npm install --save-dev @babel/helper-validator-identifier +npm install --save @babel/helper-validator-identifier ``` or using yarn: ```sh -yarn add @babel/helper-validator-identifier --dev +yarn add @babel/helper-validator-identifier ``` diff --git a/node_modules/@babel/helper-validator-identifier/lib/identifier.js b/node_modules/@babel/helper-validator-identifier/lib/identifier.js index 51ec76370..cbade222d 100644 --- a/node_modules/@babel/helper-validator-identifier/lib/identifier.js +++ b/node_modules/@babel/helper-validator-identifier/lib/identifier.js @@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.isIdentifierStart = isIdentifierStart; exports.isIdentifierChar = isIdentifierChar; exports.isIdentifierName = isIdentifierName; -let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; -let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; +exports.isIdentifierStart = isIdentifierStart; +let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; +let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; -const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; -const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; +const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; +const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; function isInAstralSet(code, set) { let pos = 0x10000; @@ -58,16 +58,23 @@ function isIdentifierChar(code) { function isIdentifierName(name) { let isFirst = true; - for (let _i = 0, _Array$from = Array.from(name); _i < _Array$from.length; _i++) { - const char = _Array$from[_i]; - const cp = char.codePointAt(0); + for (let i = 0; i < name.length; i++) { + let cp = name.charCodeAt(i); + + if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) { + const trail = name.charCodeAt(++i); + + if ((trail & 0xfc00) === 0xdc00) { + cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); + } + } if (isFirst) { + isFirst = false; + if (!isIdentifierStart(cp)) { return false; } - - isFirst = false; } else if (!isIdentifierChar(cp)) { return false; } diff --git a/node_modules/@babel/helper-validator-identifier/lib/index.js b/node_modules/@babel/helper-validator-identifier/lib/index.js index 7b623c90a..ca9decf9c 100644 --- a/node_modules/@babel/helper-validator-identifier/lib/index.js +++ b/node_modules/@babel/helper-validator-identifier/lib/index.js @@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "isIdentifierName", { +Object.defineProperty(exports, "isIdentifierChar", { enumerable: true, get: function () { - return _identifier.isIdentifierName; + return _identifier.isIdentifierChar; } }); -Object.defineProperty(exports, "isIdentifierChar", { +Object.defineProperty(exports, "isIdentifierName", { enumerable: true, get: function () { - return _identifier.isIdentifierChar; + return _identifier.isIdentifierName; } }); Object.defineProperty(exports, "isIdentifierStart", { @@ -21,6 +21,12 @@ Object.defineProperty(exports, "isIdentifierStart", { return _identifier.isIdentifierStart; } }); +Object.defineProperty(exports, "isKeyword", { + enumerable: true, + get: function () { + return _keyword.isKeyword; + } +}); Object.defineProperty(exports, "isReservedWord", { enumerable: true, get: function () { @@ -45,12 +51,6 @@ Object.defineProperty(exports, "isStrictReservedWord", { return _keyword.isStrictReservedWord; } }); -Object.defineProperty(exports, "isKeyword", { - enumerable: true, - get: function () { - return _keyword.isKeyword; - } -}); var _identifier = require("./identifier"); diff --git a/node_modules/@babel/helper-validator-identifier/lib/keyword.js b/node_modules/@babel/helper-validator-identifier/lib/keyword.js index 110cee400..0939e9a0e 100644 --- a/node_modules/@babel/helper-validator-identifier/lib/keyword.js +++ b/node_modules/@babel/helper-validator-identifier/lib/keyword.js @@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.isKeyword = isKeyword; exports.isReservedWord = isReservedWord; -exports.isStrictReservedWord = isStrictReservedWord; exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord; exports.isStrictBindReservedWord = isStrictBindReservedWord; -exports.isKeyword = isKeyword; +exports.isStrictReservedWord = isStrictReservedWord; const reservedWords = { keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], diff --git a/node_modules/@babel/helper-validator-identifier/package.json b/node_modules/@babel/helper-validator-identifier/package.json index 79112981b..972fdf11d 100644 --- a/node_modules/@babel/helper-validator-identifier/package.json +++ b/node_modules/@babel/helper-validator-identifier/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-validator-identifier", - "version": "7.10.4", + "version": "7.16.7", "description": "Validate identifier/keywords name", "repository": { "type": "git", @@ -12,10 +12,16 @@ "access": "public" }, "main": "./lib/index.js", - "exports": "./lib/index.js", + "exports": { + ".": "./lib/index.js", + "./package.json": "./package.json" + }, "devDependencies": { - "charcodes": "^0.2.0", - "unicode-13.0.0": "^0.8.0" + "@unicode/unicode-14.0.0": "^1.2.1", + "charcodes": "^0.2.0" + }, + "engines": { + "node": ">=6.9.0" }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + "author": "The Babel Team (https://babel.dev/team)" +} \ No newline at end of file diff --git a/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js b/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js index 70b371508..f644d77df 100644 --- a/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js +++ b/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js @@ -2,16 +2,16 @@ // Always use the latest available version of Unicode! // https://tc39.github.io/ecma262/#sec-conformance -const version = "13.0.0"; +const version = "14.0.0"; -const start = require("unicode-" + +const start = require("@unicode/unicode-" + version + "/Binary_Property/ID_Start/code-points.js").filter(function (ch) { return ch > 0x7f; }); let last = -1; const cont = [0x200c, 0x200d].concat( - require("unicode-" + + require("@unicode/unicode-" + version + "/Binary_Property/ID_Continue/code-points.js").filter(function (ch) { return ch > 0x7f && search(start, ch, last + 1) == -1; diff --git a/node_modules/@babel/highlight/README.md b/node_modules/@babel/highlight/README.md index 72dae6094..f8887ad2c 100644 --- a/node_modules/@babel/highlight/README.md +++ b/node_modules/@babel/highlight/README.md @@ -2,7 +2,7 @@ > Syntax highlight JavaScript strings for output in terminals. -See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information. +See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information. ## Install diff --git a/node_modules/@babel/highlight/lib/index.js b/node_modules/@babel/highlight/lib/index.js index b0d1be7f5..856dfd9fb 100644 --- a/node_modules/@babel/highlight/lib/index.js +++ b/node_modules/@babel/highlight/lib/index.js @@ -3,27 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.shouldHighlight = shouldHighlight; -exports.getChalk = getChalk; exports.default = highlight; +exports.getChalk = getChalk; +exports.shouldHighlight = shouldHighlight; -var _jsTokens = _interopRequireWildcard(require("js-tokens")); +var _jsTokens = require("js-tokens"); var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); -var _chalk = _interopRequireDefault(require("chalk")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } +var _chalk = require("chalk"); -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); function getDefs(chalk) { return { keyword: chalk.cyan, capitalized: chalk.yellow, - jsx_tag: chalk.yellow, + jsxIdentifier: chalk.yellow, punctuator: chalk.yellow, number: chalk.magenta, string: chalk.green, @@ -34,70 +30,83 @@ function getDefs(chalk) { } const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; -const JSX_TAG = /^[a-z][\w-]*$/i; const BRACKET = /^[()[\]{}]$/; - -function getTokenType(match) { - const [offset, text] = match.slice(-2); - const token = (0, _jsTokens.matchToToken)(match); - - if (token.type === "name") { - if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isReservedWord)(token.value)) { - return "keyword"; +let tokenize; +{ + const JSX_TAG = /^[a-z][\w-]*$/i; + + const getTokenType = function (token, offset, text) { + if (token.type === "name") { + if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) { + return "keyword"; + } + + if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == " colorize(str)).join("\n"); + highlighted += value.split(NEWLINE).map(str => colorize(str)).join("\n"); } else { - return args[0]; + highlighted += value; } - }); + } + + return highlighted; } function shouldHighlight(options) { - return _chalk.default.supportsColor || options.forceColor; + return !!_chalk.supportsColor || options.forceColor; } function getChalk(options) { - let chalk = _chalk.default; - - if (options.forceColor) { - chalk = new _chalk.default.constructor({ - enabled: true, - level: 1 - }); - } - - return chalk; + return options.forceColor ? new _chalk.constructor({ + enabled: true, + level: 1 + }) : _chalk; } function highlight(code, options = {}) { - if (shouldHighlight(options)) { + if (code !== "" && shouldHighlight(options)) { const chalk = getChalk(options); const defs = getDefs(chalk); return highlightTokens(defs, code); diff --git a/node_modules/@babel/highlight/package.json b/node_modules/@babel/highlight/package.json index 9ff510e69..80a43353e 100644 --- a/node_modules/@babel/highlight/package.json +++ b/node_modules/@babel/highlight/package.json @@ -1,9 +1,9 @@ { "name": "@babel/highlight", - "version": "7.10.4", + "version": "7.17.9", "description": "Syntax highlight JavaScript strings for output in terminals.", - "author": "suchipi ", - "homepage": "https://babeljs.io/", + "author": "The Babel Team (https://babel.dev/team)", + "homepage": "https://babel.dev/docs/en/next/babel-highlight", "license": "MIT", "publishConfig": { "access": "public" @@ -13,14 +13,17 @@ "url": "https://github.com/babel/babel.git", "directory": "packages/babel-highlight" }, - "main": "lib/index.js", + "main": "./lib/index.js", "dependencies": { - "@babel/helper-validator-identifier": "^7.10.4", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, "devDependencies": { + "@types/chalk": "^2.0.0", "strip-ansi": "^4.0.0" }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + "engines": { + "node": ">=6.9.0" + } +} \ No newline at end of file diff --git a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/LICENSE b/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/LICENSE deleted file mode 100644 index f31575ec7..000000000 --- a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/README.md b/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/README.md deleted file mode 100644 index c17852d3a..000000000 --- a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/helper-plugin-utils - -> General utilities for plugins to use - -See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/babel-helper-plugin-utils) for more information. - -## Install - -Using npm: - -```sh -npm install --save @babel/helper-plugin-utils -``` - -or using yarn: - -```sh -yarn add @babel/helper-plugin-utils -``` diff --git a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/lib/index.js b/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/lib/index.js deleted file mode 100644 index 0ba1be022..000000000 --- a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/lib/index.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.declare = declare; - -function declare(builder) { - return (api, options, dirname) => { - var _clonedApi2; - - let clonedApi; - - for (const name of Object.keys(apiPolyfills)) { - var _clonedApi; - - if (api[name]) continue; - clonedApi = (_clonedApi = clonedApi) != null ? _clonedApi : copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - - return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname); - }; -} - -const apiPolyfills = { - assertVersion: api => range => { - throwVersionError(range, api.version); - }, - targets: () => () => { - return {}; - }, - assumption: () => () => {} -}; - -function copyApiObject(api) { - let proto = null; - - if (typeof api.version === "string" && /^7\./.test(api.version)) { - proto = Object.getPrototypeOf(api); - - if (proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types"))) { - proto = null; - } - } - - return Object.assign({}, proto, api); -} - -function has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -function throwVersionError(range, version) { - if (typeof range === "number") { - if (!Number.isInteger(range)) { - throw new Error("Expected string or integer value."); - } - - range = `^${range}.0.0-0`; - } - - if (typeof range !== "string") { - throw new Error("Expected string or integer value."); - } - - const limit = Error.stackTraceLimit; - - if (typeof limit === "number" && limit < 25) { - Error.stackTraceLimit = 25; - } - - let err; - - if (version.slice(0, 2) === "7.") { - err = new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`); - } else { - err = new Error(`Requires Babel "${range}", but was loaded with "${version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); - } - - if (typeof limit === "number") { - Error.stackTraceLimit = limit; - } - - throw Object.assign(err, { - code: "BABEL_VERSION_UNSUPPORTED", - version, - range - }); -} \ No newline at end of file diff --git a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/package.json deleted file mode 100644 index ccfe2d567..000000000 --- a/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@babel/helper-plugin-utils", - "version": "7.16.5", - "description": "General utilities for plugins to use", - "author": "The Babel Team (https://babel.dev/team)", - "homepage": "https://babel.dev/docs/en/next/babel-helper-plugin-utils", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-helper-plugin-utils" - }, - "main": "./lib/index.js", - "engines": { - "node": ">=6.9.0" - } -} \ No newline at end of file diff --git a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/LICENSE b/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/LICENSE deleted file mode 100644 index f31575ec7..000000000 --- a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/README.md b/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/README.md deleted file mode 100644 index c17852d3a..000000000 --- a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/helper-plugin-utils - -> General utilities for plugins to use - -See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/babel-helper-plugin-utils) for more information. - -## Install - -Using npm: - -```sh -npm install --save @babel/helper-plugin-utils -``` - -or using yarn: - -```sh -yarn add @babel/helper-plugin-utils -``` diff --git a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/lib/index.js b/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/lib/index.js deleted file mode 100644 index 0ba1be022..000000000 --- a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/lib/index.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.declare = declare; - -function declare(builder) { - return (api, options, dirname) => { - var _clonedApi2; - - let clonedApi; - - for (const name of Object.keys(apiPolyfills)) { - var _clonedApi; - - if (api[name]) continue; - clonedApi = (_clonedApi = clonedApi) != null ? _clonedApi : copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - - return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname); - }; -} - -const apiPolyfills = { - assertVersion: api => range => { - throwVersionError(range, api.version); - }, - targets: () => () => { - return {}; - }, - assumption: () => () => {} -}; - -function copyApiObject(api) { - let proto = null; - - if (typeof api.version === "string" && /^7\./.test(api.version)) { - proto = Object.getPrototypeOf(api); - - if (proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types"))) { - proto = null; - } - } - - return Object.assign({}, proto, api); -} - -function has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -function throwVersionError(range, version) { - if (typeof range === "number") { - if (!Number.isInteger(range)) { - throw new Error("Expected string or integer value."); - } - - range = `^${range}.0.0-0`; - } - - if (typeof range !== "string") { - throw new Error("Expected string or integer value."); - } - - const limit = Error.stackTraceLimit; - - if (typeof limit === "number" && limit < 25) { - Error.stackTraceLimit = 25; - } - - let err; - - if (version.slice(0, 2) === "7.") { - err = new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`); - } else { - err = new Error(`Requires Babel "${range}", but was loaded with "${version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); - } - - if (typeof limit === "number") { - Error.stackTraceLimit = limit; - } - - throw Object.assign(err, { - code: "BABEL_VERSION_UNSUPPORTED", - version, - range - }); -} \ No newline at end of file diff --git a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/package.json deleted file mode 100644 index 740d52ac3..000000000 --- a/node_modules/@babel/plugin-syntax-typescript/node_modules/@babel/helper-plugin-utils/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@babel/helper-plugin-utils", - "version": "7.16.7", - "description": "General utilities for plugins to use", - "author": "The Babel Team (https://babel.dev/team)", - "homepage": "https://babel.dev/docs/en/next/babel-helper-plugin-utils", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-helper-plugin-utils" - }, - "main": "./lib/index.js", - "engines": { - "node": ">=6.9.0" - } -} \ No newline at end of file diff --git a/node_modules/@jest/console/build/BufferedConsole.d.ts b/node_modules/@jest/console/build/BufferedConsole.d.ts deleted file mode 100644 index 9cc019e69..000000000 --- a/node_modules/@jest/console/build/BufferedConsole.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import { Console } from 'console'; -import { InspectOptions } from 'util'; -import type { ConsoleBuffer, LogMessage, LogType } from './types'; -export default class BufferedConsole extends Console { - private _buffer; - private _counters; - private _timers; - private _groupDepth; - Console: typeof Console; - constructor(); - static write(buffer: ConsoleBuffer, type: LogType, message: LogMessage, level?: number | null): ConsoleBuffer; - private _log; - assert(value: unknown, message?: string | Error): void; - count(label?: string): void; - countReset(label?: string): void; - debug(firstArg: unknown, ...rest: Array): void; - dir(firstArg: unknown, options?: InspectOptions): void; - dirxml(firstArg: unknown, ...rest: Array): void; - error(firstArg: unknown, ...rest: Array): void; - group(title?: string, ...rest: Array): void; - groupCollapsed(title?: string, ...rest: Array): void; - groupEnd(): void; - info(firstArg: unknown, ...rest: Array): void; - log(firstArg: unknown, ...rest: Array): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: Array): void; - warn(firstArg: unknown, ...rest: Array): void; - getBuffer(): ConsoleBuffer | undefined; -} diff --git a/node_modules/@jest/console/build/BufferedConsole.js b/node_modules/@jest/console/build/BufferedConsole.js index defe65941..8be85ae91 100644 --- a/node_modules/@jest/console/build/BufferedConsole.js +++ b/node_modules/@jest/console/build/BufferedConsole.js @@ -59,21 +59,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {default: obj}; } -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} - +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ class BufferedConsole extends _console().Console { + _buffer = []; + _counters = {}; + _timers = {}; + _groupDepth = 0; + Console = _console().Console; + constructor() { super({ write: message => { @@ -81,16 +79,6 @@ class BufferedConsole extends _console().Console { return true; } }); - - _defineProperty(this, '_buffer', []); - - _defineProperty(this, '_counters', {}); - - _defineProperty(this, '_timers', {}); - - _defineProperty(this, '_groupDepth', 0); - - _defineProperty(this, 'Console', _console().Console); } static write(buffer, type, message, level) { diff --git a/node_modules/@jest/console/build/CustomConsole.d.ts b/node_modules/@jest/console/build/CustomConsole.d.ts deleted file mode 100644 index ebffa5dff..000000000 --- a/node_modules/@jest/console/build/CustomConsole.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import { Console } from 'console'; -import { InspectOptions } from 'util'; -import type { LogMessage, LogType } from './types'; -declare type Formatter = (type: LogType, message: LogMessage) => string; -export default class CustomConsole extends Console { - private _stdout; - private _stderr; - private _formatBuffer; - private _counters; - private _timers; - private _groupDepth; - Console: typeof Console; - constructor(stdout: NodeJS.WriteStream, stderr: NodeJS.WriteStream, formatBuffer?: Formatter); - private _log; - private _logError; - assert(value: unknown, message?: string | Error): asserts value; - count(label?: string): void; - countReset(label?: string): void; - debug(firstArg: unknown, ...args: Array): void; - dir(firstArg: unknown, options?: InspectOptions): void; - dirxml(firstArg: unknown, ...args: Array): void; - error(firstArg: unknown, ...args: Array): void; - group(title?: string, ...args: Array): void; - groupCollapsed(title?: string, ...args: Array): void; - groupEnd(): void; - info(firstArg: unknown, ...args: Array): void; - log(firstArg: unknown, ...args: Array): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: Array): void; - warn(firstArg: unknown, ...args: Array): void; - getBuffer(): undefined; -} -export {}; diff --git a/node_modules/@jest/console/build/CustomConsole.js b/node_modules/@jest/console/build/CustomConsole.js index 25ab7bede..646443964 100644 --- a/node_modules/@jest/console/build/CustomConsole.js +++ b/node_modules/@jest/console/build/CustomConsole.js @@ -59,38 +59,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {default: obj}; } -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} - +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ class CustomConsole extends _console().Console { + _stdout; + _stderr; + _formatBuffer; + _counters = {}; + _timers = {}; + _groupDepth = 0; + Console = _console().Console; + constructor(stdout, stderr, formatBuffer = (_type, message) => message) { super(stdout, stderr); - - _defineProperty(this, '_stdout', void 0); - - _defineProperty(this, '_stderr', void 0); - - _defineProperty(this, '_formatBuffer', void 0); - - _defineProperty(this, '_counters', {}); - - _defineProperty(this, '_timers', {}); - - _defineProperty(this, '_groupDepth', 0); - - _defineProperty(this, 'Console', _console().Console); - this._stdout = stdout; this._stderr = stderr; this._formatBuffer = formatBuffer; diff --git a/node_modules/@jest/console/build/NullConsole.d.ts b/node_modules/@jest/console/build/NullConsole.d.ts deleted file mode 100644 index d39fc1c22..000000000 --- a/node_modules/@jest/console/build/NullConsole.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import CustomConsole from './CustomConsole'; -export default class NullConsole extends CustomConsole { - assert(): void; - debug(): void; - dir(): void; - error(): void; - info(): void; - log(): void; - time(): void; - timeEnd(): void; - timeLog(): void; - trace(): void; - warn(): void; - group(): void; - groupCollapsed(): void; - groupEnd(): void; -} diff --git a/node_modules/@jest/console/build/getConsoleOutput.d.ts b/node_modules/@jest/console/build/getConsoleOutput.d.ts deleted file mode 100644 index a47550df9..000000000 --- a/node_modules/@jest/console/build/getConsoleOutput.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -import { StackTraceConfig } from 'jest-message-util'; -import type { ConsoleBuffer } from './types'; -export default function getConsoleOutput(buffer: ConsoleBuffer, config: StackTraceConfig, globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/console/build/getConsoleOutput.js b/node_modules/@jest/console/build/getConsoleOutput.js index 18eb3549b..e398fdb70 100644 --- a/node_modules/@jest/console/build/getConsoleOutput.js +++ b/node_modules/@jest/console/build/getConsoleOutput.js @@ -36,14 +36,14 @@ function _interopRequireDefault(obj) { * LICENSE file in the root directory of this source tree. */ function getConsoleOutput(buffer, config, globalConfig) { - const TITLE_INDENT = globalConfig.verbose ? ' ' : ' '; - const CONSOLE_INDENT = TITLE_INDENT + ' '; + const TITLE_INDENT = globalConfig.verbose ? ' '.repeat(2) : ' '.repeat(4); + const CONSOLE_INDENT = TITLE_INDENT + ' '.repeat(2); const logEntries = buffer.reduce((output, {type, message, origin}) => { message = message .split(/\n/) .map(line => CONSOLE_INDENT + line) .join('\n'); - let typeMessage = 'console.' + type; + let typeMessage = `console.${type}`; let noStackTrace = true; let noCodeFrame = true; @@ -86,16 +86,11 @@ function getConsoleOutput(buffer, config, globalConfig) { config, options ); - return ( - output + - TITLE_INDENT + - _chalk().default.dim(typeMessage) + - '\n' + - message.trimRight() + - '\n' + - _chalk().default.dim(formattedStackTrace.trimRight()) + - '\n\n' - ); + return `${ + output + TITLE_INDENT + _chalk().default.dim(typeMessage) + }\n${message.trimRight()}\n${_chalk().default.dim( + formattedStackTrace.trimRight() + )}\n\n`; }, ''); - return logEntries.trimRight() + '\n'; + return `${logEntries.trimRight()}\n`; } diff --git a/node_modules/@jest/console/build/index.d.ts b/node_modules/@jest/console/build/index.d.ts index e5e568c05..4a49457ab 100644 --- a/node_modules/@jest/console/build/index.d.ts +++ b/node_modules/@jest/console/build/index.d.ts @@ -4,8 +4,127 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as BufferedConsole } from './BufferedConsole'; -export { default as CustomConsole } from './CustomConsole'; -export { default as NullConsole } from './NullConsole'; -export { default as getConsoleOutput } from './getConsoleOutput'; -export type { ConsoleBuffer, LogMessage, LogType, LogEntry } from './types'; +/// + +import type {Config} from '@jest/types'; +import {Console as Console_2} from 'console'; +import {InspectOptions} from 'util'; +import {StackTraceConfig} from 'jest-message-util'; + +export declare class BufferedConsole extends Console_2 { + private _buffer; + private _counters; + private _timers; + private _groupDepth; + Console: typeof Console_2; + constructor(); + static write( + buffer: ConsoleBuffer, + type: LogType, + message: LogMessage, + level?: number | null, + ): ConsoleBuffer; + private _log; + assert(value: unknown, message?: string | Error): void; + count(label?: string): void; + countReset(label?: string): void; + debug(firstArg: unknown, ...rest: Array): void; + dir(firstArg: unknown, options?: InspectOptions): void; + dirxml(firstArg: unknown, ...rest: Array): void; + error(firstArg: unknown, ...rest: Array): void; + group(title?: string, ...rest: Array): void; + groupCollapsed(title?: string, ...rest: Array): void; + groupEnd(): void; + info(firstArg: unknown, ...rest: Array): void; + log(firstArg: unknown, ...rest: Array): void; + time(label?: string): void; + timeEnd(label?: string): void; + timeLog(label?: string, ...data: Array): void; + warn(firstArg: unknown, ...rest: Array): void; + getBuffer(): ConsoleBuffer | undefined; +} + +export declare type ConsoleBuffer = Array; + +export declare class CustomConsole extends Console_2 { + private _stdout; + private _stderr; + private _formatBuffer; + private _counters; + private _timers; + private _groupDepth; + Console: typeof Console_2; + constructor( + stdout: NodeJS.WriteStream, + stderr: NodeJS.WriteStream, + formatBuffer?: Formatter, + ); + private _log; + private _logError; + assert(value: unknown, message?: string | Error): asserts value; + count(label?: string): void; + countReset(label?: string): void; + debug(firstArg: unknown, ...args: Array): void; + dir(firstArg: unknown, options?: InspectOptions): void; + dirxml(firstArg: unknown, ...args: Array): void; + error(firstArg: unknown, ...args: Array): void; + group(title?: string, ...args: Array): void; + groupCollapsed(title?: string, ...args: Array): void; + groupEnd(): void; + info(firstArg: unknown, ...args: Array): void; + log(firstArg: unknown, ...args: Array): void; + time(label?: string): void; + timeEnd(label?: string): void; + timeLog(label?: string, ...data: Array): void; + warn(firstArg: unknown, ...args: Array): void; + getBuffer(): undefined; +} + +declare type Formatter = (type: LogType, message: LogMessage) => string; + +export declare function getConsoleOutput( + buffer: ConsoleBuffer, + config: StackTraceConfig, + globalConfig: Config.GlobalConfig, +): string; + +export declare type LogEntry = { + message: LogMessage; + origin: string; + type: LogType; +}; + +export declare type LogMessage = string; + +export declare type LogType = + | 'assert' + | 'count' + | 'debug' + | 'dir' + | 'dirxml' + | 'error' + | 'group' + | 'groupCollapsed' + | 'info' + | 'log' + | 'time' + | 'warn'; + +export declare class NullConsole extends CustomConsole { + assert(): void; + debug(): void; + dir(): void; + error(): void; + info(): void; + log(): void; + time(): void; + timeEnd(): void; + timeLog(): void; + trace(): void; + warn(): void; + group(): void; + groupCollapsed(): void; + groupEnd(): void; +} + +export {}; diff --git a/node_modules/@jest/console/build/types.d.ts b/node_modules/@jest/console/build/types.d.ts deleted file mode 100644 index 8490c6764..000000000 --- a/node_modules/@jest/console/build/types.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type LogMessage = string; -export declare type LogEntry = { - message: LogMessage; - origin: string; - type: LogType; -}; -export declare type LogCounters = { - [label: string]: number; -}; -export declare type LogTimers = { - [label: string]: Date; -}; -export declare type LogType = 'assert' | 'count' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'info' | 'log' | 'time' | 'warn'; -export declare type ConsoleBuffer = Array; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/@jest/console/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/@jest/console/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/@jest/console/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/@jest/console/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/@jest/console/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/@jest/console/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/@jest/console/node_modules/@jest/types/package.json b/node_modules/@jest/console/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/@jest/console/node_modules/@jest/types/package.json +++ b/node_modules/@jest/console/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/console/node_modules/@types/yargs/README.md b/node_modules/@jest/console/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/@jest/console/node_modules/@types/yargs/README.md +++ b/node_modules/@jest/console/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/@jest/console/node_modules/@types/yargs/helpers.d.mts b/node_modules/@jest/console/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/@jest/console/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/@jest/console/node_modules/@types/yargs/index.d.mts b/node_modules/@jest/console/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/@jest/console/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/@jest/console/node_modules/@types/yargs/index.d.ts b/node_modules/@jest/console/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/@jest/console/node_modules/@types/yargs/index.d.ts +++ b/node_modules/@jest/console/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/@jest/console/node_modules/@types/yargs/package.json b/node_modules/@jest/console/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/@jest/console/node_modules/@types/yargs/package.json +++ b/node_modules/@jest/console/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/@jest/console/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/@jest/console/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/@jest/console/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/@jest/console/node_modules/graceful-fs/LICENSE b/node_modules/@jest/console/node_modules/graceful-fs/LICENSE deleted file mode 100644 index 9d2c80369..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@jest/console/node_modules/graceful-fs/README.md b/node_modules/@jest/console/node_modules/graceful-fs/README.md deleted file mode 100644 index 82d6e4daf..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# graceful-fs - -graceful-fs functions as a drop-in replacement for the fs module, -making various improvements. - -The improvements are meant to normalize behavior across different -platforms and environments, and to make filesystem access more -resilient to errors. - -## Improvements over [fs module](https://nodejs.org/api/fs.html) - -* Queues up `open` and `readdir` calls, and retries them once - something closes if there is an EMFILE error from too many file - descriptors. -* fixes `lchmod` for Node versions prior to 0.6.2. -* implements `fs.lutimes` if possible. Otherwise it becomes a noop. -* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or - `lchown` if the user isn't root. -* makes `lchmod` and `lchown` become noops, if not available. -* retries reading a file if `read` results in EAGAIN error. - -On Windows, it retries renaming a file for up to one second if `EACCESS` -or `EPERM` error occurs, likely because antivirus software has locked -the directory. - -## USAGE - -```javascript -// use just like fs -var fs = require('graceful-fs') - -// now go and do stuff with it... -fs.readFile('some-file-or-whatever', (err, data) => { - // Do stuff here. -}) -``` - -## Sync methods - -This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync -methods. If you use sync methods which open file descriptors then you are -responsible for dealing with any errors. - -This is a known limitation, not a bug. - -## Global Patching - -If you want to patch the global fs module (or any other fs-like -module) you can do this: - -```javascript -// Make sure to read the caveat below. -var realFs = require('fs') -var gracefulFs = require('graceful-fs') -gracefulFs.gracefulify(realFs) -``` - -This should only ever be done at the top-level application layer, in -order to delay on EMFILE errors from any fs-using dependencies. You -should **not** do this in a library, because it can cause unexpected -delays in other parts of the program. - -## Changes - -This module is fairly stable at this point, and used by a lot of -things. That being said, because it implements a subtle behavior -change in a core part of the node API, even modest changes can be -extremely breaking, and the versioning is thus biased towards -bumping the major when in doubt. - -The main change between major versions has been switching between -providing a fully-patched `fs` module vs monkey-patching the node core -builtin, and the approach by which a non-monkey-patched `fs` was -created. - -The goal is to trade `EMFILE` errors for slower fs operations. So, if -you try to open a zillion files, rather than crashing, `open` -operations will be queued up and wait for something else to `close`. - -There are advantages to each approach. Monkey-patching the fs means -that no `EMFILE` errors can possibly occur anywhere in your -application, because everything is using the same core `fs` module, -which is patched. However, it can also obviously cause undesirable -side-effects, especially if the module is loaded multiple times. - -Implementing a separate-but-identical patched `fs` module is more -surgical (and doesn't run the risk of patching multiple times), but -also imposes the challenge of keeping in sync with the core module. - -The current approach loads the `fs` module, and then creates a -lookalike object that has all the same methods, except a few that are -patched. It is safe to use in all versions of Node from 0.8 through -7.0. - -### v4 - -* Do not monkey-patch the fs module. This module may now be used as a - drop-in dep, and users can opt into monkey-patching the fs builtin - if their app requires it. - -### v3 - -* Monkey-patch fs, because the eval approach no longer works on recent - node. -* fixed possible type-error throw if rename fails on windows -* verify that we *never* get EMFILE errors -* Ignore ENOSYS from chmod/chown -* clarify that graceful-fs must be used as a drop-in - -### v2.1.0 - -* Use eval rather than monkey-patching fs. -* readdir: Always sort the results -* win32: requeue a file if error has an OK status - -### v2.0 - -* A return to monkey patching -* wrap process.cwd - -### v1.1 - -* wrap readFile -* Wrap fs.writeFile. -* readdir protection -* Don't clobber the fs builtin -* Handle fs.read EAGAIN errors by trying again -* Expose the curOpen counter -* No-op lchown/lchmod if not implemented -* fs.rename patch only for win32 -* Patch fs.rename to handle AV software on Windows -* Close #4 Chown should not fail on einval or eperm if non-root -* Fix isaacs/fstream#1 Only wrap fs one time -* Fix #3 Start at 1024 max files, then back off on EMFILE -* lutimes that doens't blow up on Linux -* A full on-rewrite using a queue instead of just swallowing the EMFILE error -* Wrap Read/Write streams as well - -### 1.0 - -* Update engines for node 0.6 -* Be lstat-graceful on Windows -* first diff --git a/node_modules/@jest/console/node_modules/graceful-fs/clone.js b/node_modules/@jest/console/node_modules/graceful-fs/clone.js deleted file mode 100644 index dff3cc8c5..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} diff --git a/node_modules/@jest/console/node_modules/graceful-fs/graceful-fs.js b/node_modules/@jest/console/node_modules/graceful-fs/graceful-fs.js deleted file mode 100644 index 947cd94bb..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/graceful-fs.js +++ /dev/null @@ -1,429 +0,0 @@ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - require('assert').equal(fs[gracefulQueue].length, 0) - }) - } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) - - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readdir(path, options, cb) - - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() - - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} - -// keep track of the timeout between retry() calls -var retryTimer - -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} - -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined - - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} diff --git a/node_modules/@jest/console/node_modules/graceful-fs/legacy-streams.js b/node_modules/@jest/console/node_modules/graceful-fs/legacy-streams.js deleted file mode 100644 index d617b50fc..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/legacy-streams.js +++ /dev/null @@ -1,118 +0,0 @@ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} diff --git a/node_modules/@jest/console/node_modules/graceful-fs/package.json b/node_modules/@jest/console/node_modules/graceful-fs/package.json deleted file mode 100644 index e1cb58473..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "graceful-fs", - "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-graceful-fs" - }, - "main": "graceful-fs.js", - "directories": { - "test": "test" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "nyc --silent node test.js | tap -c -", - "posttest": "nyc report" - }, - "keywords": [ - "fs", - "module", - "reading", - "retry", - "retries", - "queue", - "error", - "errors", - "handling", - "EMFILE", - "EAGAIN", - "EINVAL", - "EPERM", - "EACCESS" - ], - "license": "ISC", - "devDependencies": { - "import-fresh": "^2.0.0", - "mkdirp": "^0.5.0", - "rimraf": "^2.2.8", - "tap": "^12.7.0" - }, - "files": [ - "fs.js", - "graceful-fs.js", - "legacy-streams.js", - "polyfills.js", - "clone.js" - ] -} diff --git a/node_modules/@jest/console/node_modules/graceful-fs/polyfills.js b/node_modules/@jest/console/node_modules/graceful-fs/polyfills.js deleted file mode 100644 index 26804ef0a..000000000 --- a/node_modules/@jest/console/node_modules/graceful-fs/polyfills.js +++ /dev/null @@ -1,348 +0,0 @@ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} diff --git a/node_modules/@jest/console/node_modules/jest-util/build/ErrorWithStack.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/ErrorWithStack.d.ts deleted file mode 100644 index 30a8dd313..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/ErrorWithStack.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default class ErrorWithStack extends Error { - constructor(message: string | undefined, callsite: (...args: Array) => unknown, stackLimit?: number); -} diff --git a/node_modules/@jest/console/node_modules/jest-util/build/clearLine.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/clearLine.d.ts deleted file mode 100644 index cf56b982c..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/clearLine.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function clearLine(stream: NodeJS.WriteStream): void; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.d.ts deleted file mode 100644 index 4d406660b..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function convertDescriptorToString(descriptor: T): T | string; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.js b/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.js index 4b776af57..a2b7066cf 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.js +++ b/node_modules/@jest/console/node_modules/jest-util/build/convertDescriptorToString.js @@ -11,31 +11,24 @@ exports.default = convertDescriptorToString; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - -/* eslint-disable local/ban-types-eventually */ -// See: https://github.com/facebook/jest/pull/5154 function convertDescriptorToString(descriptor) { - if ( - typeof descriptor === 'string' || - typeof descriptor === 'number' || - descriptor === undefined - ) { - return descriptor; - } + switch (typeof descriptor) { + case 'function': + if (descriptor.name) { + return descriptor.name; + } - if (typeof descriptor !== 'function') { - throw new Error('describe expects a class, function, number, or string.'); - } + break; - if (descriptor.name !== undefined) { - return descriptor.name; - } // Fallback for old browsers, pardon Flow + case 'number': + case 'undefined': + return `${descriptor}`; + + case 'string': + return descriptor; + } - const stringified = descriptor.toString(); - const typeDescriptorMatch = stringified.match(/class|function/); - const indexOfNameSpace = // @ts-expect-error: typeDescriptorMatch exists - typeDescriptorMatch.index + typeDescriptorMatch[0].length; - const indexOfNameAfterSpace = stringified.search(/\(|\{/); - const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace); - return name.trim(); + throw new Error( + `Invalid first argument, ${descriptor}. It must be a named class, named function, number, or string.` + ); } diff --git a/node_modules/@jest/console/node_modules/jest-util/build/createDirectory.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/createDirectory.d.ts deleted file mode 100644 index 7e3e01625..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/createDirectory.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function createDirectory(path: Config.Path): void; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.d.ts deleted file mode 100644 index 29e0db5f4..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function createProcessObject(): NodeJS.Process; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.js b/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.js index afc48948c..ec35a42ad 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.js +++ b/node_modules/@jest/console/node_modules/jest-util/build/createProcessObject.js @@ -30,7 +30,7 @@ function createProcessEnv() { function deletePropertyWin32(_target, key) { for (const name in real) { - if (real.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(real, name)) { if (typeof key === 'string') { if (name.toLowerCase() === key.toLowerCase()) { delete real[name]; @@ -71,7 +71,7 @@ function createProcessEnv() { get: isWin32 ? getPropertyWin32 : getProperty, set(_target, key, value) { - const strValue = '' + value; + const strValue = `${value}`; if (typeof key === 'string') { lookup[key.toLowerCase()] = strValue; @@ -98,9 +98,7 @@ function createProcessObject() { } catch (e) { // Make sure it's actually set instead of potentially ignoring errors if (newProcess[Symbol.toStringTag] !== 'process') { - e.message = - 'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' + - e.message; + e.message = `Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n${e.message}`; throw e; } } // Sequentially execute all constructors over the object. diff --git a/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.d.ts deleted file mode 100644 index f8bd716c5..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type DeepCyclicCopyOptions = { - blacklist?: Set; - keepPrototype?: boolean; -}; -export default function deepCyclicCopy(value: T, options?: DeepCyclicCopyOptions, cycles?: WeakMap): T; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.js b/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.js index e76e34bf2..7a81dbc1e 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.js +++ b/node_modules/@jest/console/node_modules/jest-util/build/deepCyclicCopy.js @@ -21,7 +21,7 @@ function deepCyclicCopy( }, cycles = new WeakMap() ) { - if (typeof value !== 'object' || value === null) { + if (typeof value !== 'object' || value === null || Buffer.isBuffer(value)) { return value; } else if (cycles.has(value)) { return cycles.get(value); diff --git a/node_modules/@jest/console/node_modules/jest-util/build/formatTime.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/formatTime.d.ts deleted file mode 100644 index fc4cd8d75..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/formatTime.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function formatTime(time: number, prefixPower?: number, padLeftLength?: number): string; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/globsToMatcher.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/globsToMatcher.d.ts deleted file mode 100644 index 021ff9e28..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/globsToMatcher.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -declare type Matcher = (str: Config.Path) => boolean; -/** - * Converts a list of globs into a function that matches a path against the - * globs. - * - * Every time picomatch is called, it will parse the glob strings and turn - * them into regexp instances. Instead of calling picomatch repeatedly with - * the same globs, we can use this function which will build the picomatch - * matchers ahead of time and then have an optimized path for determining - * whether an individual path matches. - * - * This function is intended to match the behavior of `micromatch()`. - * - * @example - * const isMatch = globsToMatcher(['*.js', '!*.test.js']); - * isMatch('pizza.js'); // true - * isMatch('pizza.test.js'); // false - */ -export default function globsToMatcher(globs: Array): Matcher; -export {}; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/index.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/index.d.ts index 118162ebe..3b55159b4 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/index.d.ts +++ b/node_modules/@jest/console/node_modules/jest-util/build/index.d.ts @@ -4,22 +4,122 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as clearLine } from './clearLine'; -export { default as createDirectory } from './createDirectory'; -export { default as ErrorWithStack } from './ErrorWithStack'; -export { default as installCommonGlobals } from './installCommonGlobals'; -export { default as interopRequireDefault } from './interopRequireDefault'; -export { default as isInteractive } from './isInteractive'; -export { default as isPromise } from './isPromise'; -export { default as setGlobal } from './setGlobal'; -export { default as deepCyclicCopy } from './deepCyclicCopy'; -export { default as convertDescriptorToString } from './convertDescriptorToString'; -export * as specialChars from './specialChars'; -export { default as replacePathSepForGlob } from './replacePathSepForGlob'; -export { default as testPathPatternToRegExp } from './testPathPatternToRegExp'; -export { default as globsToMatcher } from './globsToMatcher'; -export * as preRunMessage from './preRunMessage'; -export { default as pluralize } from './pluralize'; -export { default as formatTime } from './formatTime'; -export { default as tryRealpath } from './tryRealpath'; -export { default as requireOrImportModule } from './requireOrImportModule'; +/// + +import type {Config} from '@jest/types'; +import type {Global} from '@jest/types'; + +declare const ARROW = ' \u203A '; + +declare const CLEAR: string; + +export declare function clearLine(stream: NodeJS.WriteStream): void; + +export declare function convertDescriptorToString( + descriptor: Global.BlockNameLike | undefined, +): string; + +export declare function createDirectory(path: string): void; + +export declare function deepCyclicCopy( + value: T, + options?: DeepCyclicCopyOptions, + cycles?: WeakMap, +): T; + +declare type DeepCyclicCopyOptions = { + blacklist?: Set; + keepPrototype?: boolean; +}; + +export declare class ErrorWithStack extends Error { + constructor( + message: string | undefined, + callsite: (...args: Array) => unknown, + stackLimit?: number, + ); +} + +export declare function formatTime( + time: number, + prefixPower?: number, + padLeftLength?: number, +): string; + +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ +export declare function globsToMatcher(globs: Array): Matcher; + +declare const ICONS: { + failed: string; + pending: string; + success: string; + todo: string; +}; + +export declare function installCommonGlobals( + globalObject: typeof globalThis, + globals: Config.ConfigGlobals, +): typeof globalThis & Config.ConfigGlobals; + +export declare function interopRequireDefault(obj: any): any; + +export declare const isInteractive: boolean; + +export declare const isPromise: ( + candidate: unknown, +) => candidate is Promise; + +declare type Matcher = (str: string) => boolean; + +export declare function pluralize(word: string, count: number): string; + +declare namespace preRunMessage { + export {print_2 as print, remove}; +} +export {preRunMessage}; + +declare const print_2: (stream: NodeJS.WriteStream) => void; + +declare const remove: (stream: NodeJS.WriteStream) => void; + +export declare function replacePathSepForGlob(path: string): string; + +export declare function requireOrImportModule( + filePath: string, + applyInteropRequireDefault?: boolean, +): Promise; + +export declare function setGlobal( + globalToMutate: typeof globalThis | Global.Global, + key: string, + value: unknown, +): void; + +declare namespace specialChars { + export {ARROW, ICONS, CLEAR}; +} +export {specialChars}; + +export declare function testPathPatternToRegExp( + testPathPattern: Config.GlobalConfig['testPathPattern'], +): RegExp; + +export declare function tryRealpath(path: string): string; + +export {}; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/index.js b/node_modules/@jest/console/node_modules/jest-util/build/index.js index 64b076e90..f23c93aba 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/index.js +++ b/node_modules/@jest/console/node_modules/jest-util/build/index.js @@ -108,6 +108,14 @@ Object.defineProperty(exports, 'tryRealpath', { } }); +var preRunMessage = _interopRequireWildcard(require('./preRunMessage')); + +exports.preRunMessage = preRunMessage; + +var specialChars = _interopRequireWildcard(require('./specialChars')); + +exports.specialChars = specialChars; + var _clearLine = _interopRequireDefault2(require('./clearLine')); var _createDirectory = _interopRequireDefault2(require('./createDirectory')); @@ -134,10 +142,6 @@ var _convertDescriptorToString = _interopRequireDefault2( require('./convertDescriptorToString') ); -var _specialChars = _interopRequireWildcard(require('./specialChars')); - -exports.specialChars = _specialChars; - var _replacePathSepForGlob = _interopRequireDefault2( require('./replacePathSepForGlob') ); @@ -148,10 +152,6 @@ var _testPathPatternToRegExp = _interopRequireDefault2( var _globsToMatcher = _interopRequireDefault2(require('./globsToMatcher')); -var _preRunMessage = _interopRequireWildcard(require('./preRunMessage')); - -exports.preRunMessage = _preRunMessage; - var _pluralize = _interopRequireDefault2(require('./pluralize')); var _formatTime = _interopRequireDefault2(require('./formatTime')); @@ -162,6 +162,10 @@ var _requireOrImportModule = _interopRequireDefault2( require('./requireOrImportModule') ); +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== 'function') return null; var cacheBabelInterop = new WeakMap(); @@ -203,7 +207,3 @@ function _interopRequireWildcard(obj, nodeInterop) { } return newObj; } - -function _interopRequireDefault2(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.d.ts deleted file mode 100644 index c93689efa..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function installCommonGlobals(globalObject: typeof globalThis, globals: Config.ConfigGlobals): typeof globalThis & Config.ConfigGlobals; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.js b/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.js index 509ceee1a..6435f75d2 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.js +++ b/node_modules/@jest/console/node_modules/jest-util/build/installCommonGlobals.js @@ -73,7 +73,7 @@ function _interopRequireWildcard(obj, nodeInterop) { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -const DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE')); +const DTRACE = Object.keys(globalThis).filter(key => key.startsWith('DTRACE')); function installCommonGlobals(globalObject, globals) { globalObject.process = (0, _createProcessObject.default)(); @@ -116,7 +116,7 @@ function installCommonGlobals(globalObject, globals) { // @ts-expect-error: no index globalObject[dtrace] = function (...args) { // @ts-expect-error: no index - return global[dtrace].apply(this, args); + return globalThis[dtrace].apply(this, args); }; }); return Object.assign(globalObject, (0, _deepCyclicCopy.default)(globals)); diff --git a/node_modules/@jest/console/node_modules/jest-util/build/interopRequireDefault.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/interopRequireDefault.d.ts deleted file mode 100644 index 91b66e4fc..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/interopRequireDefault.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function interopRequireDefault(obj: any): any; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/isInteractive.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/isInteractive.d.ts deleted file mode 100644 index 57ddbf0a7..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/isInteractive.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const _default: boolean; -export default _default; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/isPromise.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/isPromise.d.ts deleted file mode 100644 index ea8589b90..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/isPromise.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const isPromise: (candidate: unknown) => candidate is Promise; -export default isPromise; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/isPromise.js b/node_modules/@jest/console/node_modules/jest-util/build/isPromise.js index 7158df850..5a7202064 100644 --- a/node_modules/@jest/console/node_modules/jest-util/build/isPromise.js +++ b/node_modules/@jest/console/node_modules/jest-util/build/isPromise.js @@ -11,8 +11,8 @@ exports.default = void 0; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// capture global.Promise before it may potentially be overwritten -const Promise = global.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 +// capture globalThis.Promise before it may potentially be overwritten +const Promise = globalThis.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 const isPromise = candidate => Promise.resolve(candidate) === candidate; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/pluralize.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/pluralize.d.ts deleted file mode 100644 index 9be305792..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/pluralize.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function pluralize(word: string, count: number): string; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/preRunMessage.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/preRunMessage.d.ts deleted file mode 100644 index 55acad973..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/preRunMessage.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export declare const print: (stream: NodeJS.WriteStream) => void; -export declare const remove: (stream: NodeJS.WriteStream) => void; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/replacePathSepForGlob.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/replacePathSepForGlob.d.ts deleted file mode 100644 index 7f47d18bf..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/replacePathSepForGlob.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function replacePathSepForGlob(path: Config.Path): Config.Glob; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/requireOrImportModule.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/requireOrImportModule.d.ts deleted file mode 100644 index b27bd9477..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/requireOrImportModule.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function requireOrImportModule(filePath: Config.Path, applyInteropRequireDefault?: boolean): Promise; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/setGlobal.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/setGlobal.d.ts deleted file mode 100644 index 94e0e7642..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/setGlobal.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function setGlobal(globalToMutate: typeof globalThis, key: string, value: unknown): void; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/specialChars.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/specialChars.d.ts deleted file mode 100644 index 1a50d4954..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/specialChars.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare const ARROW = " \u203A "; -export declare const ICONS: { - failed: string; - pending: string; - success: string; - todo: string; -}; -export declare const CLEAR: string; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/testPathPatternToRegExp.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/testPathPatternToRegExp.d.ts deleted file mode 100644 index 115aadfaa..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/testPathPatternToRegExp.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function testPathPatternToRegExp(testPathPattern: Config.GlobalConfig['testPathPattern']): RegExp; diff --git a/node_modules/@jest/console/node_modules/jest-util/build/tryRealpath.d.ts b/node_modules/@jest/console/node_modules/jest-util/build/tryRealpath.d.ts deleted file mode 100644 index cccdfa0e5..000000000 --- a/node_modules/@jest/console/node_modules/jest-util/build/tryRealpath.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function tryRealpath(path: Config.Path): Config.Path; diff --git a/node_modules/@jest/console/node_modules/jest-util/package.json b/node_modules/@jest/console/node_modules/jest-util/package.json index f1b9788a3..1bd8f7d17 100644 --- a/node_modules/@jest/console/node_modules/jest-util/package.json +++ b/node_modules/@jest/console/node_modules/jest-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-util", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,7 +17,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -25,15 +25,14 @@ "picomatch": "^2.2.3" }, "devDependencies": { - "@types/graceful-fs": "^4.1.2", - "@types/micromatch": "^4.0.1", + "@types/graceful-fs": "^4.1.3", "@types/picomatch": "^2.2.2" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/console/node_modules/picomatch/CHANGELOG.md b/node_modules/@jest/console/node_modules/picomatch/CHANGELOG.md deleted file mode 100644 index 8ccc6c1ba..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ -# Release history - -**All notable changes to this project will be documented in this file.** - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## 2.3.1 (2022-01-02) - -### Fixed - -* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). - -### Changed - -* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). - -## 2.3.0 (2021-05-21) - -### Fixed - -* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) - -## 2.2.3 (2021-04-10) - -### Fixed - -* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). -* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). - -## 2.2.2 (2020-03-21) - -### Fixed - -* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). - -## 2.2.1 (2020-01-04) - -* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. - -## 2.2.0 (2020-01-04) - -* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) -* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. - -## 2.1.0 (2019-10-31) - -* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) -* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) -* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) -* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) -* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) -* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) -* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) -* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) -* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) -* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) -* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) -* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) -* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) -* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) -* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) -* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) -* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) -* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) -* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) -* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) -* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) -* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) - -## 2.0.7 (2019-05-14) - -* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) -* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) -* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) -* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) - -## 2.0.4 (2019-04-10) - -### Fixed - -- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. -- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. - -## 2.0.0 (2019-04-10) - -### Added - -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - -### Breaking changes - -- The unixify option was renamed to `windows` -- caching and all related options and methods have been removed - -## 1.0.0 (2018-11-05) - -- adds `.onMatch` option -- improvements to `.scan` method -- numerous improvements and optimizations for matching and parsing -- better windows path handling - -## 0.1.0 - 2017-04-13 - -First release. - - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/@jest/console/node_modules/picomatch/LICENSE b/node_modules/@jest/console/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca25..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@jest/console/node_modules/picomatch/README.md b/node_modules/@jest/console/node_modules/picomatch/README.md deleted file mode 100644 index b0526e28a..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/README.md +++ /dev/null @@ -1,708 +0,0 @@ -

Picomatch

- -

- -version - - -test status - - -coverage status - - -downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.makeRe](#makere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L32) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.test](lib/picomatch.js#L117) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L161) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L183) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L199) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L231) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L245) - -Compile a regular expression from the `state` object returned by the -[parse()](#parse) method. - -**Params** - -* `state` **{Object}** -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. -* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. -* `returns` **{RegExp}** - -### [.makeRe](lib/picomatch.js#L286) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. -* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L321) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | - -picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[] - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -``` -# .makeRe star - picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) - minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) - -# .makeRe star; dot=true - picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) - minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) - -# .makeRe globstar - picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) - minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) - -# .makeRe globstars - picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) - minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) - -# .makeRe with leading star - picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) - minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) - -# .makeRe - basic braces - picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) - minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/node_modules/@jest/console/node_modules/picomatch/index.js b/node_modules/@jest/console/node_modules/picomatch/index.js deleted file mode 100644 index d2f2bc59d..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/node_modules/@jest/console/node_modules/picomatch/lib/constants.js b/node_modules/@jest/console/node_modules/picomatch/lib/constants.js deleted file mode 100644 index a62ef3879..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; - -const path = require('path'); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/node_modules/@jest/console/node_modules/picomatch/lib/parse.js b/node_modules/@jest/console/node_modules/picomatch/lib/parse.js deleted file mode 100644 index 58269d018..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1091 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. - // In this case, we need to parse the string and use it in the output of the original pattern. - // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. - // - // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. - const expression = parse(rest, { ...options, fastpaths: false }).output; - - output = token.close = `)${expression})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/node_modules/@jest/console/node_modules/picomatch/lib/picomatch.js b/node_modules/@jest/console/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index 782d80943..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,342 +0,0 @@ -'use strict'; - -const path = require('path'); -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse(input, options); - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/node_modules/@jest/console/node_modules/picomatch/lib/scan.js b/node_modules/@jest/console/node_modules/picomatch/lib/scan.js deleted file mode 100644 index e59cd7a13..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/node_modules/@jest/console/node_modules/picomatch/lib/utils.js b/node_modules/@jest/console/node_modules/picomatch/lib/utils.js deleted file mode 100644 index c3ca766a7..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const path = require('path'); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; diff --git a/node_modules/@jest/console/node_modules/picomatch/package.json b/node_modules/@jest/console/node_modules/picomatch/package.json deleted file mode 100644 index 3db22d408..000000000 --- a/node_modules/@jest/console/node_modules/picomatch/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "2.3.1", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^6.8.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/node_modules/@jest/console/package.json b/node_modules/@jest/console/package.json index 221ca1e0f..f84995af7 100644 --- a/node_modules/@jest/console/package.json +++ b/node_modules/@jest/console/package.json @@ -1,6 +1,6 @@ { "name": "@jest/console", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,22 +17,21 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-message-util": "^28.0.1", + "jest-util": "^28.0.1", "slash": "^3.0.0" }, "devDependencies": { - "@jest/test-utils": "^27.5.1", - "@types/node": "*" + "@jest/test-utils": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/environment/build/index.d.ts b/node_modules/@jest/environment/build/index.d.ts index fe18ff0da..28c4291a0 100644 --- a/node_modules/@jest/environment/build/index.d.ts +++ b/node_modules/@jest/environment/build/index.d.ts @@ -5,263 +5,340 @@ * LICENSE file in the root directory of this source tree. */ /// -import type { Context } from 'vm'; -import type { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers'; -import type { Circus, Config, Global } from '@jest/types'; -import type { fn as JestMockFn, mocked as JestMockMocked, spyOn as JestMockSpyOn, ModuleMocker } from 'jest-mock'; + +import type {Circus} from '@jest/types'; +import type {Config} from '@jest/types'; +import type {Context} from 'vm'; +import type {Global} from '@jest/types'; +import type {LegacyFakeTimers} from '@jest/fake-timers'; +import type {ModernFakeTimers} from '@jest/fake-timers'; +import type {ModuleMocker} from 'jest-mock'; + export declare type EnvironmentContext = { - console: Console; - docblockPragmas: Record>; - testPath: Config.Path; + console: Console; + docblockPragmas: Record>; + testPath: string; }; -export declare type ModuleWrapper = (this: Module['exports'], module: Module, exports: Module['exports'], require: Module['require'], __dirname: string, __filename: Module['filename'], jest?: Jest, ...extraGlobals: Array) => unknown; -export declare class JestEnvironment { - constructor(config: Config.ProjectConfig, context?: EnvironmentContext); - global: Global.Global; - fakeTimers: LegacyFakeTimers | null; - fakeTimersModern: ModernFakeTimers | null; - moduleMocker: ModuleMocker | null; - getVmContext(): Context | null; - setup(): Promise; - teardown(): Promise; - handleTestEvent?: Circus.EventHandler; - exportConditions?: () => Array; -} -export declare type Module = NodeModule; -export interface Jest { - /** - * Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run. - * Optionally, you can provide steps, so it will run steps amount of next timeouts/intervals. - */ - advanceTimersToNextTimer(steps?: number): void; - /** - * Disables automatic mocking in the module loader. - */ - autoMockOff(): Jest; - /** - * Enables automatic mocking in the module loader. - */ - autoMockOn(): Jest; - /** - * Clears the mock.calls and mock.instances properties of all mocks. - * Equivalent to calling .mockClear() on every mocked function. - */ - clearAllMocks(): Jest; - /** - * Removes any pending timers from the timer system. If any timers have been - * scheduled, they will be cleared and will never have the opportunity to - * execute in the future. - */ - clearAllTimers(): void; - /** - * Indicates that the module system should never return a mocked version - * of the specified module, including all of the specified module's - * dependencies. - */ - deepUnmock(moduleName: string): Jest; - /** - * Disables automatic mocking in the module loader. - * - * After this method is called, all `require()`s will return the real - * versions of each module (rather than a mocked version). - */ - disableAutomock(): Jest; - /** - * When using `babel-jest`, calls to mock will automatically be hoisted to - * the top of the code block. Use this method if you want to explicitly avoid - * this behavior. - */ - doMock(moduleName: string, moduleFactory?: () => unknown, options?: { - virtual?: boolean; - }): Jest; - /** - * Indicates that the module system should never return a mocked version - * of the specified module from require() (e.g. that it should always return - * the real module). - */ - dontMock(moduleName: string): Jest; - /** - * Enables automatic mocking in the module loader. - */ - enableAutomock(): Jest; - /** - * Creates a mock function. Optionally takes a mock implementation. - */ - fn: typeof JestMockFn; - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - * - * This is useful when you want to create a manual mock that extends the - * automatic mock's behavior. - * - * @deprecated Use `jest.createMockFromModule()` instead - */ - genMockFromModule(moduleName: string): unknown; - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - * - * This is useful when you want to create a manual mock that extends the - * automatic mock's behavior. - */ - createMockFromModule(moduleName: string): unknown; - /** - * Determines if the given function is a mocked function. - */ - isMockFunction(fn: (...args: Array) => unknown): fn is ReturnType; - /** - * Mocks a module with an auto-mocked version when it is being required. - */ - mock(moduleName: string, moduleFactory?: () => unknown, options?: { - virtual?: boolean; - }): Jest; - /** - * Mocks a module with the provided module factory when it is being imported. - */ - unstable_mockModule(moduleName: string, moduleFactory: () => Promise | T, options?: { - virtual?: boolean; - }): Jest; - /** + +export declare interface Jest { + /** + * Advances all timers by `msToRun` milliseconds. All pending "macro-tasks" + * that have been queued via `setTimeout()` or `setInterval()`, and would be + * executed within this time frame will be executed. + */ + advanceTimersByTime(msToRun: number): void; + /** + * Advances all timers by the needed milliseconds so that only the next + * timeouts/intervals will run. Optionally, you can provide steps, so it will + * run steps amount of next timeouts/intervals. + */ + advanceTimersToNextTimer(steps?: number): void; + /** + * Disables automatic mocking in the module loader. + */ + autoMockOff(): Jest; + /** + * Enables automatic mocking in the module loader. + */ + autoMockOn(): Jest; + /** + * Clears the `mock.calls`, `mock.instances`, `mock.contexts` and `mock.results` properties of + * all mocks. Equivalent to calling `.mockClear()` on every mocked function. + */ + clearAllMocks(): Jest; + /** + * Removes any pending timers from the timer system. If any timers have been + * scheduled, they will be cleared and will never have the opportunity to + * execute in the future. + */ + clearAllTimers(): void; + /** + * Given the name of a module, use the automatic mocking system to generate a + * mocked version of the module for you. + * + * This is useful when you want to create a manual mock that extends the + * automatic mock's behavior. + */ + createMockFromModule(moduleName: string): unknown; + /** + * Indicates that the module system should never return a mocked version of + * the specified module and its dependencies. + */ + deepUnmock(moduleName: string): Jest; + /** + * Disables automatic mocking in the module loader. + * + * After this method is called, all `require()`s will return the real + * versions of each module (rather than a mocked version). + */ + disableAutomock(): Jest; + /** + * When using `babel-jest`, calls to `jest.mock()` will automatically be hoisted + * to the top of the code block. Use this method if you want to explicitly + * avoid this behavior. + */ + doMock( + moduleName: string, + moduleFactory?: () => unknown, + options?: { + virtual?: boolean; + }, + ): Jest; + /** + * When using `babel-jest`, calls to `jest.unmock()` will automatically be hoisted + * to the top of the code block. Use this method if you want to explicitly + * avoid this behavior. + */ + dontMock(moduleName: string): Jest; + /** + * Enables automatic mocking in the module loader. + */ + enableAutomock(): Jest; + /** + * Creates a mock function. Optionally takes a mock implementation. + */ + fn: ModuleMocker['fn']; + /** + * Given the name of a module, use the automatic mocking system to generate a + * mocked version of the module for you. + * + * This is useful when you want to create a manual mock that extends the + * automatic mock's behavior. + * + * @deprecated Use `jest.createMockFromModule()` instead + */ + genMockFromModule(moduleName: string): unknown; + /** + * When mocking time, `Date.now()` will also be mocked. If you for some reason + * need access to the real current time, you can invoke this function. + * + * @remarks + * Not available when using legacy fake timers implementation. + */ + getRealSystemTime(): number; + /** + * Returns the number of fake timers still left to run. + */ + getTimerCount(): number; + /** + * Determines if the given function is a mocked function. + */ + isMockFunction: ModuleMocker['isMockFunction']; + /** + * `jest.isolateModules()` goes a step further than `jest.resetModules()` and + * creates a sandbox registry for the modules that are loaded inside the callback + * function. This is useful to isolate specific modules for every test so that + * local module state doesn't conflict between tests. + */ + isolateModules(fn: () => void): Jest; + /** + * Mocks a module with an auto-mocked version when it is being required. + */ + mock( + moduleName: string, + moduleFactory?: () => unknown, + options?: { + virtual?: boolean; + }, + ): Jest; + /** + * Mocks a module with the provided module factory when it is being imported. + */ + unstable_mockModule( + moduleName: string, + moduleFactory: () => Promise | T, + options?: { + virtual?: boolean; + }, + ): Jest; + /** * Returns the actual module instead of a mock, bypassing all checks on * whether the module should receive a mock implementation or not. * * @example + ```js + jest.mock('../myModule', () => { + // Require the original module to not be mocked... + const originalModule = jest.requireActual('../myModule'); + + return { + __esModule: true, // Use it when dealing with esModules + ...originalModule, + getRandom: jest.fn().mockReturnValue(10), + }; + }); + + const getRandom = require('../myModule').getRandom; + + getRandom(); // Always returns 10 ``` - jest.mock('../myModule', () => { - // Require the original module to not be mocked... - const originalModule = jest.requireActual(moduleName); - return { - __esModule: true, // Use it when dealing with esModules - ...originalModule, - getRandom: jest.fn().mockReturnValue(10), - }; - }); - - const getRandom = require('../myModule').getRandom; - - getRandom(); // Always returns 10 - ``` - */ - requireActual: (moduleName: string) => unknown; - /** - * Returns a mock module instead of the actual module, bypassing all checks - * on whether the module should be required normally or not. - */ - requireMock: (moduleName: string) => unknown; - /** - * Resets the state of all mocks. - * Equivalent to calling .mockReset() on every mocked function. - */ - resetAllMocks(): Jest; - /** - * Resets the module registry - the cache of all required modules. This is - * useful to isolate modules where local state might conflict between tests. - */ - resetModules(): Jest; - /** - * Restores all mocks back to their original value. Equivalent to calling - * `.mockRestore` on every mocked function. - * - * Beware that jest.restoreAllMocks() only works when the mock was created with - * jest.spyOn; other mocks will require you to manually restore them. */ - restoreAllMocks(): Jest; - mocked: typeof JestMockMocked; - /** - * Runs failed tests n-times until they pass or until the max number of - * retries is exhausted. This only works with `jest-circus`! - */ - retryTimes(numRetries: number): Jest; - /** - * Exhausts tasks queued by setImmediate(). - * - * > Note: This function is not available when using Lolex as fake timers implementation - */ - runAllImmediates(): void; - /** - * Exhausts the micro-task queue (usually interfaced in node via - * process.nextTick). - */ - runAllTicks(): void; - /** - * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() - * and setInterval()). - */ - runAllTimers(): void; - /** - * Executes only the macro-tasks that are currently pending (i.e., only the - * tasks that have been queued by setTimeout() or setInterval() up to this - * point). If any of the currently pending macro-tasks schedule new - * macro-tasks, those new tasks will not be executed by this call. - */ - runOnlyPendingTimers(): void; - /** - * Advances all timers by msToRun milliseconds. All pending "macro-tasks" - * that have been queued via setTimeout() or setInterval(), and would be - * executed within this timeframe will be executed. - */ - advanceTimersByTime(msToRun: number): void; - /** - * Returns the number of fake timers still left to run. - */ - getTimerCount(): number; - /** - * Explicitly supplies the mock object that the module system should return - * for the specified module. - * - * Note It is recommended to use `jest.mock()` instead. The `jest.mock` - * API's second argument is a module factory instead of the expected - * exported module object. - */ - setMock(moduleName: string, moduleExports: unknown): Jest; - /** - * Set the default timeout interval for tests and before/after hooks in - * milliseconds. - * - * Note: The default timeout interval is 5 seconds if this method is not - * called. - */ - setTimeout(timeout: number): Jest; - /** - * Creates a mock function similar to `jest.fn` but also tracks calls to - * `object[methodName]`. - * - * Note: By default, jest.spyOn also calls the spied method. This is - * different behavior from most other test libraries. - */ - spyOn: typeof JestMockSpyOn; - /** - * Indicates that the module system should never return a mocked version of - * the specified module from require() (e.g. that it should always return the - * real module). - */ - unmock(moduleName: string): Jest; - /** - * Instructs Jest to use fake versions of the standard timer functions. - */ - useFakeTimers(implementation?: 'modern' | 'legacy'): Jest; - /** - * Instructs Jest to use the real versions of the standard timer functions. - */ - useRealTimers(): Jest; - /** - * `jest.isolateModules(fn)` goes a step further than `jest.resetModules()` - * and creates a sandbox registry for the modules that are loaded inside - * the callback function. This is useful to isolate specific modules for - * every test so that local module state doesn't conflict between tests. - */ - isolateModules(fn: () => void): Jest; - /** - * When mocking time, `Date.now()` will also be mocked. If you for some reason need access to the real current time, you can invoke this function. - * - * > Note: This function is only available when using Lolex as fake timers implementation - */ - getRealSystemTime(): number; - /** - * Set the current system time used by fake timers. Simulates a user changing the system clock while your program is running. It affects the current time but it does not in itself cause e.g. timers to fire; they will fire exactly as they would have done without the call to `jest.setSystemTime()`. - * - * > Note: This function is only available when using Lolex as fake timers implementation - */ - setSystemTime(now?: number | Date): void; + requireActual: (moduleName: string) => unknown; + /** + * Returns a mock module instead of the actual module, bypassing all checks + * on whether the module should be required normally or not. + */ + requireMock: (moduleName: string) => unknown; + /** + * Resets the state of all mocks. Equivalent to calling `.mockReset()` on + * every mocked function. + */ + resetAllMocks(): Jest; + /** + * Resets the module registry - the cache of all required modules. This is + * useful to isolate modules where local state might conflict between tests. + */ + resetModules(): Jest; + /** + * Restores all mocks back to their original value. Equivalent to calling + * `.mockRestore()` on every mocked function. + * + * Beware that `jest.restoreAllMocks()` only works when the mock was created + * with `jest.spyOn()`; other mocks will require you to manually restore them. + */ + restoreAllMocks(): Jest; + /** + * Wraps an object or a module with mock type definitions. + */ + mocked: ModuleMocker['mocked']; + /** + * Runs failed tests n-times until they pass or until the max number of + * retries is exhausted. + * + * If `logErrorsBeforeRetry` is enabled, Jest will log the error(s) that caused + * the test to fail to the console, providing visibility on why a retry occurred. + * retries is exhausted. + * + * @remarks + * Only available with `jest-circus` runner. + */ + retryTimes( + numRetries: number, + options?: { + logErrorsBeforeRetry?: boolean; + }, + ): Jest; + /** + * Exhausts tasks queued by `setImmediate()`. + * + * @remarks + * Only available when using legacy fake timers implementation. + */ + runAllImmediates(): void; + /** + * Exhausts the micro-task queue (usually interfaced in node via + * `process.nextTick()`). + */ + runAllTicks(): void; + /** + * Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()` + * and `setInterval()`). + */ + runAllTimers(): void; + /** + * Executes only the macro-tasks that are currently pending (i.e., only the + * tasks that have been queued by `setTimeout()` or `setInterval()` up to this + * point). If any of the currently pending macro-tasks schedule new + * macro-tasks, those new tasks will not be executed by this call. + */ + runOnlyPendingTimers(): void; + /** + * Explicitly supplies the mock object that the module system should return + * for the specified module. + * + * @remarks + * It is recommended to use `jest.mock()` instead. The `jest.mock()` API's second + * argument is a module factory instead of the expected exported module object. + */ + setMock(moduleName: string, moduleExports: unknown): Jest; + /** + * Set the current system time used by fake timers. Simulates a user changing + * the system clock while your program is running. It affects the current time, + * but it does not in itself cause e.g. timers to fire; they will fire exactly + * as they would have done without the call to `jest.setSystemTime()`. + * + * @remarks + * Not available when using legacy fake timers implementation. + */ + setSystemTime(now?: number | Date): void; + /** + * Set the default timeout interval for tests and before/after hooks in + * milliseconds. + * + * @remarks + * The default timeout interval is 5 seconds if this method is not called. + */ + setTimeout(timeout: number): Jest; + /** + * Creates a mock function similar to `jest.fn()` but also tracks calls to + * `object[methodName]`. + * + * Optional third argument of `accessType` can be either 'get' or 'set', which + * proves to be useful when you want to spy on a getter or a setter, respectively. + * + * @remarks + * By default, `jest.spyOn()` also calls the spied method. This is different + * behavior from most other test libraries. + */ + spyOn: ModuleMocker['spyOn']; + /** + * Indicates that the module system should never return a mocked version of + * the specified module from `require()` (e.g. that it should always return the + * real module). + */ + unmock(moduleName: string): Jest; + /** + * Instructs Jest to use fake versions of the global date, performance, + * time and timer APIs. Fake timers implementation is backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @remarks + * Calling `jest.useFakeTimers()` once again in the same test file would reinstall + * fake timers using the provided options. + */ + useFakeTimers( + fakeTimersConfig?: Config.FakeTimersConfig | Config.LegacyFakeTimersConfig, + ): Jest; + /** + * Instructs Jest to restore the original implementations of the global date, + * performance, time and timer APIs. + */ + useRealTimers(): Jest; +} + +export declare class JestEnvironment { + constructor(config: JestEnvironmentConfig, context: EnvironmentContext); + global: Global.Global; + fakeTimers: LegacyFakeTimers | null; + fakeTimersModern: ModernFakeTimers | null; + moduleMocker: ModuleMocker | null; + getVmContext(): Context | null; + setup(): Promise; + teardown(): Promise; + handleTestEvent?: Circus.EventHandler; + exportConditions?: () => Array; } + +export declare interface JestEnvironmentConfig { + projectConfig: Config.ProjectConfig; + globalConfig: Config.GlobalConfig; +} + +export declare interface JestImportMeta extends ImportMeta { + jest: Jest; +} + +export declare type Module = NodeModule; + +export declare type ModuleWrapper = ( + this: Module['exports'], + module: Module, + exports: Module['exports'], + require: Module['require'], + __dirname: string, + __filename: Module['filename'], + jest?: Jest, + ...sandboxInjectedGlobals: Array +) => unknown; + +export {}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/@jest/environment/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/package.json b/node_modules/@jest/environment/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/@jest/environment/node_modules/@jest/types/package.json +++ b/node_modules/@jest/environment/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/environment/node_modules/@types/yargs/README.md b/node_modules/@jest/environment/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/@jest/environment/node_modules/@types/yargs/README.md +++ b/node_modules/@jest/environment/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/@jest/environment/node_modules/@types/yargs/helpers.d.mts b/node_modules/@jest/environment/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/@jest/environment/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/@jest/environment/node_modules/@types/yargs/index.d.mts b/node_modules/@jest/environment/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/@jest/environment/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/@jest/environment/node_modules/@types/yargs/index.d.ts b/node_modules/@jest/environment/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/@jest/environment/node_modules/@types/yargs/index.d.ts +++ b/node_modules/@jest/environment/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/@jest/environment/node_modules/@types/yargs/package.json b/node_modules/@jest/environment/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/@jest/environment/node_modules/@types/yargs/package.json +++ b/node_modules/@jest/environment/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/@jest/environment/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/@jest/environment/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/@jest/environment/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/@jest/environment/package.json b/node_modules/@jest/environment/package.json index 96ef04d2e..d1dff5616 100644 --- a/node_modules/@jest/environment/package.json +++ b/node_modules/@jest/environment/package.json @@ -1,6 +1,6 @@ { "name": "@jest/environment", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,16 +17,16 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/fake-timers": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/fake-timers": "^28.0.1", + "@jest/types": "^28.0.1", "@types/node": "*", - "jest-mock": "^27.5.1" + "jest-mock": "^28.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/jest-serializer/LICENSE b/node_modules/@jest/expect-utils/LICENSE similarity index 100% rename from node_modules/jest-serializer/LICENSE rename to node_modules/@jest/expect-utils/LICENSE diff --git a/node_modules/@jest/expect-utils/README.md b/node_modules/@jest/expect-utils/README.md new file mode 100644 index 000000000..12ae8b2f0 --- /dev/null +++ b/node_modules/@jest/expect-utils/README.md @@ -0,0 +1,5 @@ +# `@jest/expect-utils` + +This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/). + +You probably don't want to use this package directly. E.g. if you're writing [custom matcher](https://jestjs.io/docs/expect#expectextendmatchers), you should use the injected [`this.equals`](https://jestjs.io/docs/expect#thisequalsa-b). diff --git a/node_modules/@jest/expect-utils/build/index.d.ts b/node_modules/@jest/expect-utils/build/index.d.ts new file mode 100644 index 000000000..2f7baf578 --- /dev/null +++ b/node_modules/@jest/expect-utils/build/index.d.ts @@ -0,0 +1,93 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare const arrayBufferEquality: ( + a: unknown, + b: unknown, +) => boolean | undefined; + +export declare function emptyObject(obj: unknown): boolean; + +export declare const equals: EqualsFunction; + +export declare type EqualsFunction = ( + a: unknown, + b: unknown, + customTesters?: Array, + strictCheck?: boolean, +) => boolean; + +export declare const getObjectSubset: ( + object: any, + subset: any, + seenReferences?: WeakMap, +) => any; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +declare type GetPath = { + hasEndProp?: boolean; + endPropIsDefined?: boolean; + lastTraversedObject: unknown; + traversedPath: Array; + value?: unknown; +}; + +export declare const getPath: ( + object: Record, + propertyPath: string | Array, +) => GetPath; + +export declare function isA(typeName: string, value: unknown): boolean; + +export declare const isError: (value: unknown) => value is Error; + +export declare const isOneline: ( + expected: unknown, + received: unknown, +) => boolean; + +export declare const iterableEquality: ( + a: any, + b: any, + aStack?: Array, + bStack?: Array, +) => boolean | undefined; + +export declare const partition: ( + items: T[], + predicate: (arg: T) => boolean, +) => [T[], T[]]; + +export declare const pathAsArray: (propertyPath: string) => Array; + +export declare const sparseArrayEquality: ( + a: unknown, + b: unknown, +) => boolean | undefined; + +export declare const subsetEquality: ( + object: unknown, + subset: unknown, +) => boolean | undefined; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export declare type Tester = (a: any, b: any) => boolean | undefined; + +export declare const typeEquality: (a: any, b: any) => boolean | undefined; + +export {}; diff --git a/node_modules/@jest/expect-utils/build/index.js b/node_modules/@jest/expect-utils/build/index.js new file mode 100644 index 000000000..65cf41090 --- /dev/null +++ b/node_modules/@jest/expect-utils/build/index.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +var _exportNames = { + equals: true, + isA: true +}; +Object.defineProperty(exports, 'equals', { + enumerable: true, + get: function () { + return _jasmineUtils.equals; + } +}); +Object.defineProperty(exports, 'isA', { + enumerable: true, + get: function () { + return _jasmineUtils.isA; + } +}); + +var _jasmineUtils = require('./jasmineUtils'); + +var _utils = require('./utils'); + +Object.keys(_utils).forEach(function (key) { + if (key === 'default' || key === '__esModule') return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _utils[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _utils[key]; + } + }); +}); diff --git a/node_modules/expect/build/jasmineUtils.js b/node_modules/@jest/expect-utils/build/jasmineUtils.js similarity index 80% rename from node_modules/expect/build/jasmineUtils.js rename to node_modules/@jest/expect-utils/build/jasmineUtils.js index 447c40e8a..a7a1e05fc 100644 --- a/node_modules/expect/build/jasmineUtils.js +++ b/node_modules/@jest/expect-utils/build/jasmineUtils.js @@ -3,13 +3,10 @@ Object.defineProperty(exports, '__esModule', { value: true }); -exports.equals = equals; -exports.fnNameFor = fnNameFor; -exports.hasProperty = hasProperty; +exports.equals = void 0; exports.isA = isA; exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed; exports.isImmutableUnorderedSet = isImmutableUnorderedSet; -exports.isUndefined = isUndefined; /* Copyright (c) 2008-2016 Pivotal Labs @@ -37,12 +34,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* eslint-disable */ // Extracted out of jasmine 2.5.2 -function equals(a, b, customTesters, strictCheck) { +const equals = (a, b, customTesters, strictCheck) => { customTesters = customTesters || []; - return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey); -} + return eq(a, b, [], [], customTesters, strictCheck); +}; -const functionToString = Function.prototype.toString; +exports.equals = equals; function isAsymmetric(obj) { return !!obj && isA('Function', obj.asymmetricMatch); @@ -66,7 +63,7 @@ function asymmetricMatch(a, b) { } // Equality function lovingly adapted from isEqual in // [Underscore](http://underscorejs.org) -function eq(a, b, aStack, bStack, customTesters, hasKey) { +function eq(a, b, aStack, bStack, customTesters, strictCheck) { var result = true; var asymmetricResult = asymmetricMatch(a, b); @@ -152,24 +149,49 @@ function eq(a, b, aStack, bStack, customTesters, hasKey) { bStack.push(b); // Recursively compare objects and arrays. // Compare array lengths to determine if a deep comparison is necessary. - if (className == '[object Array]' && a.length !== b.length) { + if (strictCheck && className == '[object Array]' && a.length !== b.length) { return false; } // Deep compare objects. var aKeys = keys(a, hasKey), key; - var size = aKeys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. + var bKeys = keys(b, hasKey); // Add keys corresponding to asymmetric matchers if they miss in non strict check mode - if (keys(b, hasKey).length !== size) { + if (!strictCheck) { + for (var index = 0; index !== bKeys.length; ++index) { + key = bKeys[index]; + + if ((isAsymmetric(b[key]) || b[key] === undefined) && !hasKey(a, key)) { + aKeys.push(key); + } + } + + for (var index = 0; index !== aKeys.length; ++index) { + key = aKeys[index]; + + if ((isAsymmetric(a[key]) || a[key] === undefined) && !hasKey(b, key)) { + bKeys.push(key); + } + } + } // Ensure that both objects contain the same number of properties before comparing deep equality. + + var size = aKeys.length; + + if (bKeys.length !== size) { return false; } while (size--) { key = aKeys[size]; // Deep compare each member - result = - hasKey(b, key) && - eq(a[key], b[key], aStack, bStack, customTesters, hasKey); + if (strictCheck) + result = + hasKey(b, key) && + eq(a[key], b[key], aStack, bStack, customTesters, strictCheck); + else + result = + (hasKey(b, key) || isAsymmetric(a[key]) || a[key] === undefined) && + eq(a[key], b[key], aStack, bStack, customTesters, strictCheck); if (!result) { return false; @@ -197,10 +219,6 @@ function keys(obj, hasKey) { ); } -function hasDefinedKey(obj, key) { - return hasKey(obj, key) && obj[key] !== undefined; -} - function hasKey(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } @@ -217,45 +235,6 @@ function isDomNode(obj) { typeof obj.nodeName === 'string' && typeof obj.isEqualNode === 'function' ); -} - -function fnNameFor(func) { - if (func.name) { - return func.name; - } - - const matches = functionToString - .call(func) - .match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/); - return matches ? matches[1] : ''; -} - -function isUndefined(obj) { - return obj === void 0; -} - -function getPrototype(obj) { - if (Object.getPrototypeOf) { - return Object.getPrototypeOf(obj); - } - - if (obj.constructor.prototype == obj) { - return null; - } - - return obj.constructor.prototype; -} - -function hasProperty(obj, property) { - if (!obj) { - return false; - } - - if (Object.prototype.hasOwnProperty.call(obj, property)) { - return true; - } - - return hasProperty(getPrototype(obj), property); } // SENTINEL constants are from https://github.com/facebook/immutable-js const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; diff --git a/node_modules/jest-runtime/build/types.js b/node_modules/@jest/expect-utils/build/types.js similarity index 100% rename from node_modules/jest-runtime/build/types.js rename to node_modules/@jest/expect-utils/build/types.js diff --git a/node_modules/@jest/expect-utils/build/utils.js b/node_modules/@jest/expect-utils/build/utils.js new file mode 100644 index 000000000..d87a46fb7 --- /dev/null +++ b/node_modules/@jest/expect-utils/build/utils.js @@ -0,0 +1,451 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.arrayBufferEquality = void 0; +exports.emptyObject = emptyObject; +exports.typeEquality = + exports.subsetEquality = + exports.sparseArrayEquality = + exports.pathAsArray = + exports.partition = + exports.iterableEquality = + exports.isOneline = + exports.isError = + exports.getPath = + exports.getObjectSubset = + void 0; + +var _jestGetType = require('jest-get-type'); + +var _jasmineUtils = require('./jasmineUtils'); + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; + +/** + * Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`. + */ +const hasPropertyInObject = (object, key) => { + const shouldTerminate = + !object || typeof object !== 'object' || object === Object.prototype; + + if (shouldTerminate) { + return false; + } + + return ( + Object.prototype.hasOwnProperty.call(object, key) || + hasPropertyInObject(Object.getPrototypeOf(object), key) + ); +}; + +const getPath = (object, propertyPath) => { + if (!Array.isArray(propertyPath)) { + propertyPath = pathAsArray(propertyPath); + } + + if (propertyPath.length) { + const lastProp = propertyPath.length === 1; + const prop = propertyPath[0]; + const newObject = object[prop]; + + if (!lastProp && (newObject === null || newObject === undefined)) { + // This is not the last prop in the chain. If we keep recursing it will + // hit a `can't access property X of undefined | null`. At this point we + // know that the chain has broken and we can return right away. + return { + hasEndProp: false, + lastTraversedObject: object, + traversedPath: [] + }; + } + + const result = getPath(newObject, propertyPath.slice(1)); + + if (result.lastTraversedObject === null) { + result.lastTraversedObject = object; + } + + result.traversedPath.unshift(prop); + + if (lastProp) { + // Does object have the property with an undefined value? + // Although primitive values support bracket notation (above) + // they would throw TypeError for in operator (below). + result.endPropIsDefined = + !(0, _jestGetType.isPrimitive)(object) && prop in object; + result.hasEndProp = newObject !== undefined || result.endPropIsDefined; + + if (!result.hasEndProp) { + result.traversedPath.shift(); + } + } + + return result; + } + + return { + lastTraversedObject: null, + traversedPath: [], + value: object + }; +}; // Strip properties from object that are not present in the subset. Useful for +// printing the diff for toMatchObject() without adding unrelated noise. + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + +exports.getPath = getPath; + +const getObjectSubset = (object, subset, seenReferences = new WeakMap()) => { + /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ + if (Array.isArray(object)) { + if (Array.isArray(subset) && subset.length === object.length) { + // The map method returns correct subclass of subset. + return subset.map((sub, i) => getObjectSubset(object[i], sub)); + } + } else if (object instanceof Date) { + return object; + } else if (isObject(object) && isObject(subset)) { + if ( + (0, _jasmineUtils.equals)(object, subset, [ + iterableEquality, + subsetEquality + ]) + ) { + // Avoid unnecessary copy which might return Object instead of subclass. + return subset; + } + + const trimmed = {}; + seenReferences.set(object, trimmed); + Object.keys(object) + .filter(key => hasPropertyInObject(subset, key)) + .forEach(key => { + trimmed[key] = seenReferences.has(object[key]) + ? seenReferences.get(object[key]) + : getObjectSubset(object[key], subset[key], seenReferences); + }); + + if (Object.keys(trimmed).length > 0) { + return trimmed; + } + } + + return object; +}; + +exports.getObjectSubset = getObjectSubset; +const IteratorSymbol = Symbol.iterator; + +const hasIterator = object => !!(object != null && object[IteratorSymbol]); +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + +const iterableEquality = ( + a, + b, + /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ + aStack = [], + bStack = [] +) => { + if ( + typeof a !== 'object' || + typeof b !== 'object' || + Array.isArray(a) || + Array.isArray(b) || + !hasIterator(a) || + !hasIterator(b) + ) { + return undefined; + } + + if (a.constructor !== b.constructor) { + return false; + } + + let length = aStack.length; + + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + // circular references at same depth are equal + // circular reference is not equal to non-circular one + if (aStack[length] === a) { + return bStack[length] === b; + } + } + + aStack.push(a); + bStack.push(b); + + const iterableEqualityWithStack = (a, b) => + iterableEquality(a, b, [...aStack], [...bStack]); + + if (a.size !== undefined) { + if (a.size !== b.size) { + return false; + } else if ( + (0, _jasmineUtils.isA)('Set', a) || + (0, _jasmineUtils.isImmutableUnorderedSet)(a) + ) { + let allFound = true; + + for (const aValue of a) { + if (!b.has(aValue)) { + let has = false; + + for (const bValue of b) { + const isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [ + iterableEqualityWithStack + ]); + + if (isEqual === true) { + has = true; + } + } + + if (has === false) { + allFound = false; + break; + } + } + } // Remove the first value from the stack of traversed values. + + aStack.pop(); + bStack.pop(); + return allFound; + } else if ( + (0, _jasmineUtils.isA)('Map', a) || + (0, _jasmineUtils.isImmutableUnorderedKeyed)(a) + ) { + let allFound = true; + + for (const aEntry of a) { + if ( + !b.has(aEntry[0]) || + !(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [ + iterableEqualityWithStack + ]) + ) { + let has = false; + + for (const bEntry of b) { + const matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], [ + iterableEqualityWithStack + ]); + let matchedValue = false; + + if (matchedKey === true) { + matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], [ + iterableEqualityWithStack + ]); + } + + if (matchedValue === true) { + has = true; + } + } + + if (has === false) { + allFound = false; + break; + } + } + } // Remove the first value from the stack of traversed values. + + aStack.pop(); + bStack.pop(); + return allFound; + } + } + + const bIterator = b[IteratorSymbol](); + + for (const aValue of a) { + const nextB = bIterator.next(); + + if ( + nextB.done || + !(0, _jasmineUtils.equals)(aValue, nextB.value, [ + iterableEqualityWithStack + ]) + ) { + return false; + } + } + + if (!bIterator.next().done) { + return false; + } + + const aEntries = Object.entries(a); + const bEntries = Object.entries(b); + + if (!(0, _jasmineUtils.equals)(aEntries, bEntries)) { + return false; + } // Remove the first value from the stack of traversed values. + + aStack.pop(); + bStack.pop(); + return true; +}; + +exports.iterableEquality = iterableEquality; + +const isObject = a => a !== null && typeof a === 'object'; + +const isObjectWithKeys = a => + isObject(a) && + !(a instanceof Error) && + !(a instanceof Array) && + !(a instanceof Date); + +const subsetEquality = (object, subset) => { + // subsetEquality needs to keep track of the references + // it has already visited to avoid infinite loops in case + // there are circular references in the subset passed to it. + const subsetEqualityWithContext = + (seenReferences = new WeakMap()) => + (object, subset) => { + if (!isObjectWithKeys(subset)) { + return undefined; + } + + return Object.keys(subset).every(key => { + if (isObjectWithKeys(subset[key])) { + if (seenReferences.has(subset[key])) { + return (0, _jasmineUtils.equals)(object[key], subset[key], [ + iterableEquality + ]); + } + + seenReferences.set(subset[key], true); + } + + const result = + object != null && + hasPropertyInObject(object, key) && + (0, _jasmineUtils.equals)(object[key], subset[key], [ + iterableEquality, + subsetEqualityWithContext(seenReferences) + ]); // The main goal of using seenReference is to avoid circular node on tree. + // It will only happen within a parent and its child, not a node and nodes next to it (same level) + // We should keep the reference for a parent and its child only + // Thus we should delete the reference immediately so that it doesn't interfere + // other nodes within the same level on tree. + + seenReferences.delete(subset[key]); + return result; + }); + }; + + return subsetEqualityWithContext()(object, subset); +}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + +exports.subsetEquality = subsetEquality; + +const typeEquality = (a, b) => { + if (a == null || b == null || a.constructor === b.constructor) { + return undefined; + } + + return false; +}; + +exports.typeEquality = typeEquality; + +const arrayBufferEquality = (a, b) => { + if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) { + return undefined; + } + + const dataViewA = new DataView(a); + const dataViewB = new DataView(b); // Buffers are not equal when they do not have the same byte length + + if (dataViewA.byteLength !== dataViewB.byteLength) { + return false; + } // Check if every byte value is equal to each other + + for (let i = 0; i < dataViewA.byteLength; i++) { + if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) { + return false; + } + } + + return true; +}; + +exports.arrayBufferEquality = arrayBufferEquality; + +const sparseArrayEquality = (a, b) => { + if (!Array.isArray(a) || !Array.isArray(b)) { + return undefined; + } // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"] + + const aKeys = Object.keys(a); + const bKeys = Object.keys(b); + return ( + (0, _jasmineUtils.equals)(a, b, [iterableEquality, typeEquality], true) && + (0, _jasmineUtils.equals)(aKeys, bKeys) + ); +}; + +exports.sparseArrayEquality = sparseArrayEquality; + +const partition = (items, predicate) => { + const result = [[], []]; + items.forEach(item => result[predicate(item) ? 0 : 1].push(item)); + return result; +}; + +exports.partition = partition; + +const pathAsArray = propertyPath => { + const properties = []; + + if (propertyPath === '') { + properties.push(''); + return properties; + } // will match everything that's not a dot or a bracket, and "" for consecutive dots. + + const pattern = RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g'); // Because the regex won't match a dot in the beginning of the path, if present. + + if (propertyPath[0] === '.') { + properties.push(''); + } + + propertyPath.replace(pattern, match => { + properties.push(match); + return match; + }); + return properties; +}; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693 + +exports.pathAsArray = pathAsArray; + +const isError = value => { + switch (Object.prototype.toString.call(value)) { + case '[object Error]': + case '[object Exception]': + case '[object DOMException]': + return true; + + default: + return value instanceof Error; + } +}; + +exports.isError = isError; + +function emptyObject(obj) { + return obj && typeof obj === 'object' ? !Object.keys(obj).length : false; +} + +const MULTILINE_REGEXP = /[\r\n]/; + +const isOneline = (expected, received) => + typeof expected === 'string' && + typeof received === 'string' && + (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received)); + +exports.isOneline = isOneline; diff --git a/node_modules/@jest/expect-utils/node_modules/jest-get-type/LICENSE b/node_modules/@jest/expect-utils/node_modules/jest-get-type/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/expect-utils/node_modules/jest-get-type/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/expect-utils/node_modules/jest-get-type/build/index.d.ts b/node_modules/@jest/expect-utils/node_modules/jest-get-type/build/index.d.ts new file mode 100644 index 000000000..096d2d1ea --- /dev/null +++ b/node_modules/@jest/expect-utils/node_modules/jest-get-type/build/index.d.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare function getType(value: unknown): ValueType; + +export declare const isPrimitive: (value: unknown) => boolean; + +declare type ValueType = + | 'array' + | 'bigint' + | 'boolean' + | 'function' + | 'null' + | 'number' + | 'object' + | 'regexp' + | 'map' + | 'set' + | 'date' + | 'string' + | 'symbol' + | 'undefined'; + +export {}; diff --git a/node_modules/@jest/expect-utils/node_modules/jest-get-type/build/index.js b/node_modules/@jest/expect-utils/node_modules/jest-get-type/build/index.js new file mode 100644 index 000000000..d2bc99595 --- /dev/null +++ b/node_modules/@jest/expect-utils/node_modules/jest-get-type/build/index.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.getType = getType; +exports.isPrimitive = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// get the type of a value with handling the edge cases like `typeof []` +// and `typeof null` +function getType(value) { + if (value === undefined) { + return 'undefined'; + } else if (value === null) { + return 'null'; + } else if (Array.isArray(value)) { + return 'array'; + } else if (typeof value === 'boolean') { + return 'boolean'; + } else if (typeof value === 'function') { + return 'function'; + } else if (typeof value === 'number') { + return 'number'; + } else if (typeof value === 'string') { + return 'string'; + } else if (typeof value === 'bigint') { + return 'bigint'; + } else if (typeof value === 'object') { + if (value != null) { + if (value.constructor === RegExp) { + return 'regexp'; + } else if (value.constructor === Map) { + return 'map'; + } else if (value.constructor === Set) { + return 'set'; + } else if (value.constructor === Date) { + return 'date'; + } + } + + return 'object'; + } else if (typeof value === 'symbol') { + return 'symbol'; + } + + throw new Error(`value of unknown type: ${value}`); +} + +const isPrimitive = value => Object(value) !== value; + +exports.isPrimitive = isPrimitive; diff --git a/node_modules/@jest/expect-utils/node_modules/jest-get-type/package.json b/node_modules/@jest/expect-utils/node_modules/jest-get-type/package.json new file mode 100644 index 000000000..b56e68df1 --- /dev/null +++ b/node_modules/@jest/expect-utils/node_modules/jest-get-type/package.json @@ -0,0 +1,27 @@ +{ + "name": "jest-get-type", + "description": "A utility function to get the type of a value", + "version": "28.0.0", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-get-type" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" +} diff --git a/node_modules/@jest/expect-utils/package.json b/node_modules/@jest/expect-utils/package.json new file mode 100644 index 000000000..9e644e11e --- /dev/null +++ b/node_modules/@jest/expect-utils/package.json @@ -0,0 +1,32 @@ +{ + "name": "@jest/expect-utils", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/expect-utils" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "jest-get-type": "^28.0.0" + }, + "devDependencies": { + "jest-matcher-utils": "^28.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/@jest/expect/LICENSE b/node_modules/@jest/expect/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/expect/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/expect/README.md b/node_modules/@jest/expect/README.md new file mode 100644 index 000000000..81cf1b41a --- /dev/null +++ b/node_modules/@jest/expect/README.md @@ -0,0 +1,5 @@ +# @jest/expect + +This package extends `expect` library with `jest-snapshot` matchers. It exports `jestExpect` object, which can be used as standalone replacement of `expect`. + +The `jestExpect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect). diff --git a/node_modules/@jest/expect/build/index.d.ts b/node_modules/@jest/expect/build/index.d.ts new file mode 100644 index 000000000..19cda9deb --- /dev/null +++ b/node_modules/@jest/expect/build/index.d.ts @@ -0,0 +1,62 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type {addSerializer} from 'jest-snapshot'; +import {AsymmetricMatchers} from 'expect'; +import type {BaseExpect} from 'expect'; +import {MatcherFunction} from 'expect'; +import {MatcherFunctionWithState} from 'expect'; +import {Matchers} from 'expect'; +import {MatcherState} from 'expect'; +import type {SnapshotMatchers} from 'jest-snapshot'; + +export {AsymmetricMatchers}; + +declare type Inverse = { + /** + * Inverse next matcher. If you know how to test something, `.not` lets you test its opposite. + */ + not: Matchers; +}; + +export declare type JestExpect = { + (actual: T): JestMatchers & + Inverse> & + PromiseMatchers; + addSnapshotSerializer: typeof addSerializer; +} & BaseExpect & + AsymmetricMatchers & + Inverse>; + +export declare const jestExpect: JestExpect; + +declare type JestMatchers, T> = Matchers & + SnapshotMatchers; + +export {MatcherFunction}; + +export {MatcherFunctionWithState}; + +export {Matchers}; + +export {MatcherState}; + +declare type PromiseMatchers = { + /** + * Unwraps the reason of a rejected promise so any other matcher can be chained. + * If the promise is fulfilled the assertion fails. + */ + rejects: JestMatchers, T> & + Inverse, T>>; + /** + * Unwraps the value of a fulfilled promise so any other matcher can be chained. + * If the promise is rejected the assertion fails. + */ + resolves: JestMatchers, T> & + Inverse, T>>; +}; + +export {}; diff --git a/node_modules/@jest/expect/build/index.js b/node_modules/@jest/expect/build/index.js new file mode 100644 index 000000000..21330035e --- /dev/null +++ b/node_modules/@jest/expect/build/index.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.jestExpect = void 0; + +function _expect() { + const data = require('expect'); + + _expect = function () { + return data; + }; + + return data; +} + +function _jestSnapshot() { + const data = require('jest-snapshot'); + + _jestSnapshot = function () { + return data; + }; + + return data; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function createJestExpect() { + _expect().expect.extend({ + toMatchInlineSnapshot: _jestSnapshot().toMatchInlineSnapshot, + toMatchSnapshot: _jestSnapshot().toMatchSnapshot, + toThrowErrorMatchingInlineSnapshot: + _jestSnapshot().toThrowErrorMatchingInlineSnapshot, + toThrowErrorMatchingSnapshot: _jestSnapshot().toThrowErrorMatchingSnapshot + }); + + _expect().expect.addSnapshotSerializer = _jestSnapshot().addSerializer; + return _expect().expect; +} + +const jestExpect = createJestExpect(); +exports.jestExpect = jestExpect; diff --git a/node_modules/@jest/expect/build/types.js b/node_modules/@jest/expect/build/types.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/expect/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/expect/package.json b/node_modules/@jest/expect/package.json new file mode 100644 index 000000000..25abc0b8a --- /dev/null +++ b/node_modules/@jest/expect/package.json @@ -0,0 +1,34 @@ +{ + "name": "@jest/expect", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-expect" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "expect": "^28.0.1", + "jest-snapshot": "^28.0.1" + }, + "devDependencies": { + "@tsd/typescript": "~4.6.2", + "tsd-lite": "^0.5.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/@jest/fake-timers/build/index.d.ts b/node_modules/@jest/fake-timers/build/index.d.ts index 5a6e64ca7..790895496 100644 --- a/node_modules/@jest/fake-timers/build/index.d.ts +++ b/node_modules/@jest/fake-timers/build/index.d.ts @@ -4,5 +4,100 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as LegacyFakeTimers } from './legacyFakeTimers'; -export { default as ModernFakeTimers } from './modernFakeTimers'; +import type {Config} from '@jest/types'; +import type {ModuleMocker} from 'jest-mock'; +import {StackTraceConfig} from 'jest-message-util'; + +declare type Callback = (...args: Array) => void; + +export declare class LegacyFakeTimers { + private _cancelledTicks; + private _config; + private _disposed?; + private _fakeTimerAPIs; + private _global; + private _immediates; + private _maxLoops; + private _moduleMocker; + private _now; + private _ticks; + private _timerAPIs; + private _timers; + private _uuidCounter; + private _timerConfig; + constructor({ + global, + moduleMocker, + timerConfig, + config, + maxLoops, + }: { + global: typeof globalThis; + moduleMocker: ModuleMocker; + timerConfig: TimerConfig; + config: StackTraceConfig; + maxLoops?: number; + }); + clearAllTimers(): void; + dispose(): void; + reset(): void; + runAllTicks(): void; + runAllImmediates(): void; + private _runImmediate; + runAllTimers(): void; + runOnlyPendingTimers(): void; + advanceTimersToNextTimer(steps?: number): void; + advanceTimersByTime(msToRun: number): void; + runWithRealTimers(cb: Callback): void; + useRealTimers(): void; + useFakeTimers(): void; + getTimerCount(): number; + private _checkFakeTimers; + private _createMocks; + private _fakeClearTimer; + private _fakeClearImmediate; + private _fakeNextTick; + private _fakeRequestAnimationFrame; + private _fakeSetImmediate; + private _fakeSetInterval; + private _fakeSetTimeout; + private _getNextTimerHandle; + private _runTimerHandle; +} + +export declare class ModernFakeTimers { + private _clock; + private _config; + private _fakingTime; + private _global; + private _fakeTimers; + constructor({ + global, + config, + }: { + global: typeof globalThis; + config: Config.ProjectConfig; + }); + clearAllTimers(): void; + dispose(): void; + runAllTimers(): void; + runOnlyPendingTimers(): void; + advanceTimersToNextTimer(steps?: number): void; + advanceTimersByTime(msToRun: number): void; + runAllTicks(): void; + useRealTimers(): void; + useFakeTimers(fakeTimersConfig?: Config.FakeTimersConfig): void; + reset(): void; + setSystemTime(now?: number | Date): void; + getRealSystemTime(): number; + getTimerCount(): number; + private _checkFakeTimers; + private _toSinonFakeTimersConfig; +} + +declare type TimerConfig = { + idToRef: (id: number) => Ref; + refToId: (ref: Ref) => number | void; +}; + +export {}; diff --git a/node_modules/@jest/fake-timers/build/legacyFakeTimers.d.ts b/node_modules/@jest/fake-timers/build/legacyFakeTimers.d.ts deleted file mode 100644 index 059d02911..000000000 --- a/node_modules/@jest/fake-timers/build/legacyFakeTimers.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import { StackTraceConfig } from 'jest-message-util'; -import type { ModuleMocker } from 'jest-mock'; -declare type Callback = (...args: Array) => void; -declare type TimerConfig = { - idToRef: (id: number) => Ref; - refToId: (ref: Ref) => number | void; -}; -declare type GlobalThis = typeof globalThis; -interface FakeTimersGlobal extends GlobalThis { - cancelAnimationFrame: (handle: number) => void; - requestAnimationFrame: (callback: (time: number) => void) => number; -} -export default class FakeTimers { - private _cancelledTicks; - private _config; - private _disposed?; - private _fakeTimerAPIs; - private _global; - private _immediates; - private _maxLoops; - private _moduleMocker; - private _now; - private _ticks; - private _timerAPIs; - private _timers; - private _uuidCounter; - private _timerConfig; - constructor({ global, moduleMocker, timerConfig, config, maxLoops, }: { - global: FakeTimersGlobal; - moduleMocker: ModuleMocker; - timerConfig: TimerConfig; - config: StackTraceConfig; - maxLoops?: number; - }); - clearAllTimers(): void; - dispose(): void; - reset(): void; - runAllTicks(): void; - runAllImmediates(): void; - private _runImmediate; - runAllTimers(): void; - runOnlyPendingTimers(): void; - advanceTimersToNextTimer(steps?: number): void; - advanceTimersByTime(msToRun: number): void; - runWithRealTimers(cb: Callback): void; - useRealTimers(): void; - useFakeTimers(): void; - getTimerCount(): number; - private _checkFakeTimers; - private _createMocks; - private _fakeClearTimer; - private _fakeClearImmediate; - private _fakeNextTick; - private _fakeRequestAnimationFrame; - private _fakeSetImmediate; - private _fakeSetInterval; - private _fakeSetTimeout; - private _getNextTimerHandle; - private _runTimerHandle; -} -export {}; diff --git a/node_modules/@jest/fake-timers/build/legacyFakeTimers.js b/node_modules/@jest/fake-timers/build/legacyFakeTimers.js index 2abaf4e58..ae2f260a9 100644 --- a/node_modules/@jest/fake-timers/build/legacyFakeTimers.js +++ b/node_modules/@jest/fake-timers/build/legacyFakeTimers.js @@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { exports.default = void 0; function _util() { - const data = _interopRequireDefault(require('util')); + const data = require('util'); _util = function () { return data; @@ -35,56 +35,33 @@ function _jestUtil() { return data; } -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/* eslint-disable local/prefer-spread-eventually */ const MS_IN_A_YEAR = 31536000000; class FakeTimers { - constructor({global, moduleMocker, timerConfig, config, maxLoops}) { - _defineProperty(this, '_cancelledTicks', void 0); - - _defineProperty(this, '_config', void 0); - - _defineProperty(this, '_disposed', void 0); - - _defineProperty(this, '_fakeTimerAPIs', void 0); - - _defineProperty(this, '_global', void 0); - - _defineProperty(this, '_immediates', void 0); - - _defineProperty(this, '_maxLoops', void 0); - - _defineProperty(this, '_moduleMocker', void 0); - - _defineProperty(this, '_now', void 0); - - _defineProperty(this, '_ticks', void 0); - - _defineProperty(this, '_timerAPIs', void 0); - - _defineProperty(this, '_timers', void 0); - - _defineProperty(this, '_uuidCounter', void 0); - - _defineProperty(this, '_timerConfig', void 0); + _cancelledTicks; + _config; + _disposed; + _fakeTimerAPIs; + _global; + _immediates; + _maxLoops; + _moduleMocker; + _now; + _ticks; + _timerAPIs; + _timers; + _uuidCounter; + _timerConfig; + constructor({global, moduleMocker, timerConfig, config, maxLoops}) { this._global = global; this._timerConfig = timerConfig; this._config = config; @@ -138,7 +115,9 @@ class FakeTimers { break; } - if (!this._cancelledTicks.hasOwnProperty(tick.uuid)) { + if ( + !Object.prototype.hasOwnProperty.call(this._cancelledTicks, tick.uuid) + ) { // Callback may throw, so update the map prior calling. this._cancelledTicks[tick.uuid] = true; tick.callback(); @@ -147,9 +126,7 @@ class FakeTimers { if (i === this._maxLoops) { throw new Error( - 'Ran ' + - this._maxLoops + - ' ticks, and there are still more! ' + + `Ran ${this._maxLoops} ticks, and there are still more! ` + "Assuming we've hit an infinite recursion and bailing out..." ); } @@ -172,9 +149,7 @@ class FakeTimers { if (i === this._maxLoops) { throw new Error( - 'Ran ' + - this._maxLoops + - ' immediates, and there are still more! Assuming ' + + `Ran ${this._maxLoops} immediates, and there are still more! Assuming ` + "we've hit an infinite recursion and bailing out..." ); } @@ -219,9 +194,7 @@ class FakeTimers { if (i === this._maxLoops) { throw new Error( - 'Ran ' + - this._maxLoops + - ' timers, and there are still more! ' + + `Ran ${this._maxLoops} timers, and there are still more! ` + "Assuming we've hit an infinite recursion and bailing out..." ); } @@ -297,9 +270,7 @@ class FakeTimers { if (i === this._maxLoops) { throw new Error( - 'Ran ' + - this._maxLoops + - ' timers, and there are still more! ' + + `Ran ${this._maxLoops} timers, and there are still more! ` + "Assuming we've hit an infinite recursion and bailing out..." ); } @@ -466,6 +437,7 @@ class FakeTimers { _checkFakeTimers() { var _this$_fakeTimerAPIs; + // @ts-expect-error: condition always returns 'true' if ( this._global.setTimeout !== ((_this$_fakeTimerAPIs = this._fakeTimerAPIs) === null || @@ -474,37 +446,29 @@ class FakeTimers { : _this$_fakeTimerAPIs.setTimeout) ) { this._global.console.warn( - 'A function to advance timers was called but the timers API is not ' + - 'mocked with fake timers. Call `jest.useFakeTimers()` in this ' + - 'test or enable fake timers globally by setting ' + - '`"timers": "fake"` in ' + - 'the configuration file. This warning is likely a result of a ' + - 'default configuration change in Jest 15.\n\n' + - 'Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15\n' + - 'Stack Trace:\n' + - (0, _jestMessageUtil().formatStackTrace)( + 'A function to advance timers was called but the timers APIs are not mocked ' + + 'with fake timers. Call `jest.useFakeTimers({legacyFakeTimers: true})` ' + + 'in this test file or enable fake timers for all tests by setting ' + + "{'enableGlobally': true, 'legacyFakeTimers': true} in " + + `Jest configuration file.\nStack Trace:\n${(0, + _jestMessageUtil().formatStackTrace)( new Error().stack, this._config, { noStackTrace: false } - ) + )}` ); } } _createMocks() { - const fn = ( - impl // @ts-expect-error TODO: figure out better typings here - ) => this._moduleMocker.fn().mockImplementation(impl); + const fn = implementation => this._moduleMocker.fn(implementation); - const promisifiableFakeSetTimeout = fn(this._fakeSetTimeout.bind(this)); // @ts-expect-error TODO: figure out better typings here + const promisifiableFakeSetTimeout = fn(this._fakeSetTimeout.bind(this)); // @ts-expect-error: no index - promisifiableFakeSetTimeout[_util().default.promisify.custom] = ( - delay, - arg - ) => - new Promise(resolve => promisifiableFakeSetTimeout(resolve, delay, arg)); // TODO: add better typings; these are mocks, but typed as regular timers + promisifiableFakeSetTimeout[_util().promisify.custom] = (delay, arg) => + new Promise(resolve => promisifiableFakeSetTimeout(resolve, delay, arg)); this._fakeTimerAPIs = { cancelAnimationFrame: fn(this._fakeClearTimer.bind(this)), @@ -512,13 +476,9 @@ class FakeTimers { clearInterval: fn(this._fakeClearTimer.bind(this)), clearTimeout: fn(this._fakeClearTimer.bind(this)), nextTick: fn(this._fakeNextTick.bind(this)), - // @ts-expect-error TODO: figure out better typings here requestAnimationFrame: fn(this._fakeRequestAnimationFrame.bind(this)), - // @ts-expect-error TODO: figure out better typings here setImmediate: fn(this._fakeSetImmediate.bind(this)), - // @ts-expect-error TODO: figure out better typings here setInterval: fn(this._fakeSetInterval.bind(this)), - // @ts-expect-error TODO: figure out better typings here setTimeout: promisifiableFakeSetTimeout }; } @@ -552,7 +512,7 @@ class FakeTimers { const cancelledTicks = this._cancelledTicks; this._timerAPIs.nextTick(() => { - if (!cancelledTicks.hasOwnProperty(uuid)) { + if (!Object.prototype.hasOwnProperty.call(cancelledTicks, uuid)) { // Callback may throw, so update the map prior calling. cancelledTicks[uuid] = true; callback.apply(null, args); @@ -665,7 +625,7 @@ class FakeTimers { break; default: - throw new Error('Unexpected timer type: ' + timer.type); + throw new Error(`Unexpected timer type: ${timer.type}`); } } } diff --git a/node_modules/@jest/fake-timers/build/modernFakeTimers.d.ts b/node_modules/@jest/fake-timers/build/modernFakeTimers.d.ts deleted file mode 100644 index b7cefc4ee..000000000 --- a/node_modules/@jest/fake-timers/build/modernFakeTimers.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import { StackTraceConfig } from 'jest-message-util'; -export default class FakeTimers { - private _clock; - private _config; - private _fakingTime; - private _global; - private _fakeTimers; - private _maxLoops; - constructor({ global, config, maxLoops, }: { - global: typeof globalThis; - config: StackTraceConfig; - maxLoops?: number; - }); - clearAllTimers(): void; - dispose(): void; - runAllTimers(): void; - runOnlyPendingTimers(): void; - advanceTimersToNextTimer(steps?: number): void; - advanceTimersByTime(msToRun: number): void; - runAllTicks(): void; - useRealTimers(): void; - useFakeTimers(): void; - reset(): void; - setSystemTime(now?: number | Date): void; - getRealSystemTime(): number; - getTimerCount(): number; - private _checkFakeTimers; -} diff --git a/node_modules/@jest/fake-timers/build/modernFakeTimers.js b/node_modules/@jest/fake-timers/build/modernFakeTimers.js index 9e1963ed2..0542de91c 100644 --- a/node_modules/@jest/fake-timers/build/modernFakeTimers.js +++ b/node_modules/@jest/fake-timers/build/modernFakeTimers.js @@ -25,37 +25,22 @@ function _jestMessageUtil() { return data; } -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} - +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ class FakeTimers { - constructor({global, config, maxLoops}) { - _defineProperty(this, '_clock', void 0); - - _defineProperty(this, '_config', void 0); - - _defineProperty(this, '_fakingTime', void 0); - - _defineProperty(this, '_global', void 0); - - _defineProperty(this, '_fakeTimers', void 0); - - _defineProperty(this, '_maxLoops', void 0); + _clock; + _config; + _fakingTime; + _global; + _fakeTimers; + constructor({global, config}) { this._global = global; this._config = config; - this._maxLoops = maxLoops || 100000; this._fakingTime = false; this._fakeTimers = (0, _fakeTimers().withGlobal)(global); } @@ -117,16 +102,15 @@ class FakeTimers { } } - useFakeTimers() { - if (!this._fakingTime) { - const toFake = Object.keys(this._fakeTimers.timers); - this._clock = this._fakeTimers.install({ - loopLimit: this._maxLoops, - now: Date.now(), - toFake - }); - this._fakingTime = true; + useFakeTimers(fakeTimersConfig) { + if (this._fakingTime) { + this._clock.uninstall(); } + + this._clock = this._fakeTimers.install( + this._toSinonFakeTimersConfig(fakeTimersConfig) + ); + this._fakingTime = true; } reset() { @@ -160,22 +144,51 @@ class FakeTimers { _checkFakeTimers() { if (!this._fakingTime) { this._global.console.warn( - 'A function to advance timers was called but the timers API is not ' + - 'mocked with fake timers. Call `jest.useFakeTimers()` in this test or ' + - 'enable fake timers globally by setting `"timers": "fake"` in the ' + - 'configuration file\nStack Trace:\n' + - (0, _jestMessageUtil().formatStackTrace)( + 'A function to advance timers was called but the timers APIs are not replaced ' + + 'with fake timers. Call `jest.useFakeTimers()` in this test file or enable ' + + "fake timers for all tests by setting 'fakeTimers': {'enableGlobally': true} " + + `in Jest configuration file.\nStack Trace:\n${(0, + _jestMessageUtil().formatStackTrace)( new Error().stack, this._config, { noStackTrace: false } - ) + )}` ); } return this._fakingTime; } + + _toSinonFakeTimersConfig(fakeTimersConfig = {}) { + var _fakeTimersConfig$doN, _fakeTimersConfig$now; + + fakeTimersConfig = {...this._config.fakeTimers, ...fakeTimersConfig}; + const advanceTimeDelta = + typeof fakeTimersConfig.advanceTimers === 'number' + ? fakeTimersConfig.advanceTimers + : undefined; + const toFake = new Set(Object.keys(this._fakeTimers.timers)); + (_fakeTimersConfig$doN = fakeTimersConfig.doNotFake) === null || + _fakeTimersConfig$doN === void 0 + ? void 0 + : _fakeTimersConfig$doN.forEach(nameOfFakeableAPI => { + toFake.delete(nameOfFakeableAPI); + }); + return { + advanceTimeDelta, + loopLimit: fakeTimersConfig.timerLimit || 100_000, + now: + (_fakeTimersConfig$now = fakeTimersConfig.now) !== null && + _fakeTimersConfig$now !== void 0 + ? _fakeTimersConfig$now + : Date.now(), + shouldAdvanceTime: Boolean(fakeTimersConfig.advanceTimers), + shouldClearNativeTimers: true, + toFake: Array.from(toFake) + }; + } } exports.default = FakeTimers; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json b/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json +++ b/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/CHANGELOG.md b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/CHANGELOG.md index 3e1c17ac9..ecf4d9942 100644 --- a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/CHANGELOG.md +++ b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/CHANGELOG.md @@ -1,4 +1,32 @@ +9.1.2 / 2022-04-13 +================== + + * Prohibit faking of faked timers (#426) + +9.1.1 / 2022-03-05 +================== + + * fix(timer.refresh): should just change `callAt` (#425) + +9.1.0 / 2022-02-03 +================== + + * add hasRef (#419) + +9.0.0 / 2022-01-28 +================== + + * Breaking: remove Node 10 from running tests + * chore(ci): do not hard code node versions (#417) + * chore: test on node 17 (#416) + * fix global performance node 16 (#412) + * Bump node-fetch from 2.6.1 to 2.6.7 (#414) + * Bump cached-path-relative from 1.0.2 to 1.1.0 (#413) + * Clarify async usage (#411) + * Faking performance when not present should throw an error (and minor changes) - fix for #374 (#400) + * Add performance to config.toFake + 8.1.0 / 2021-11-03 ================== diff --git a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/README.md b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/README.md index a96a65de4..22f40d913 100644 --- a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/README.md +++ b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/README.md @@ -1,7 +1,6 @@ # `@sinonjs/fake-timers` -[![CircleCI](https://circleci.com/gh/sinonjs/fake-timers.svg?style=svg)](https://circleci.com/gh/sinonjs/fake-timers) -[![codecov](https://codecov.io/gh/sinonjs/fake-timers/branch/master/graph/badge.svg)](https://codecov.io/gh/sinonjs/fake-timers) +[![codecov](https://codecov.io/gh/sinonjs/fake-timers/branch/main/graph/badge.svg)](https://codecov.io/gh/sinonjs/fake-timers) Contributor Covenant JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`, and `cancelIdleCallback`, along with a clock instance that controls the flow of time. FakeTimers also provides a `Date` implementation that gets its time from the clock. @@ -55,8 +54,7 @@ clock.tick(15); Upon executing the last line, an interesting fact about the [Poblano](https://en.wikipedia.org/wiki/Poblano) will be printed synchronously to -the screen. If you want to simulate asynchronous behavior, you have to use your -imagination when calling the various functions. +the screen. If you want to simulate asynchronous behavior, please see the `async` function variants (eg `clock.tick(time)` vs `await clock.tickAsync(time)`). The `next`, `runAll`, `runToFrame`, and `runToLast` methods are available to advance the clock. See the API Reference for more details. @@ -150,14 +148,14 @@ The `loopLimit` argument sets the maximum number of timers that will be run when Installs FakeTimers using the specified config (otherwise with epoch `0` on the global scope). The following configuration options are available -| Parameter | Type | Default | Description | -| -------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `config.now` | Number/Date | 0 | installs FakeTimers with the specified unix epoch | -| `config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime"] | an array with explicit function names to hijack. _When not set, FakeTimers will automatically fake all methods **except** `nextTick`_ e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick` | -| `config.loopLimit` | Number | 1000 | the maximum number of timers that will be run when calling runAll() | -| `config.shouldAdvanceTime` | Boolean | false | tells FakeTimers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by 20ms for every 20ms change in the real system time) | -| `config.advanceTimeDelta` | Number | 20 | relevant only when using with `shouldAdvanceTime: true`. increment mocked time by `advanceTimeDelta` ms every `advanceTimeDelta` ms change in the real system time. | -| `config.shouldClearNativeTimers` | Boolean | false | tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. | +| Parameter | Type | Default | Description | +| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config.now` | Number/Date | 0 | installs FakeTimers with the specified unix epoch | +| `config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime", "performance"] | an array with explicit function names (or objects, in the case of "performance") to hijack. _When not set, FakeTimers will automatically fake all methods **except** `nextTick`_ e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick` | +| `config.loopLimit` | Number | 1000 | the maximum number of timers that will be run when calling runAll() | +| `config.shouldAdvanceTime` | Boolean | false | tells FakeTimers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by 20ms for every 20ms change in the real system time) | +| `config.advanceTimeDelta` | Number | 20 | relevant only when using with `shouldAdvanceTime: true`. increment mocked time by `advanceTimeDelta` ms every `advanceTimeDelta` ms change in the real system time. | +| `config.shouldClearNativeTimers` | Boolean | false | tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. | ### `var id = clock.setTimeout(callback, timeout)` diff --git a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/package.json b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/package.json index 453d6dee1..b857ff9cb 100644 --- a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/package.json +++ b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/package.json @@ -1,7 +1,7 @@ { "name": "@sinonjs/fake-timers", "description": "Fake JavaScript timers", - "version": "8.1.0", + "version": "9.1.2", "homepage": "https://github.com/sinonjs/fake-timers", "author": "Christian Johansen", "repository": { @@ -42,7 +42,7 @@ "husky": "4.2.1", "jsdom": "16.5.2", "lint-staged": "10.0.7", - "mocha": "8.3.2", + "mocha": "9.2.0", "mochify": "7.0.0", "nyc": "14.1.1", "prettier": "2.2.1" diff --git a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js index e1a0a1e8b..a8f69fc57 100644 --- a/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js +++ b/node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js @@ -157,6 +157,10 @@ function withGlobal(_global) { const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/); + const hasPerformanceConstructorPrototype = + _global.performance && + _global.performance.constructor && + _global.performance.constructor.prototype; const queueMicrotaskPresent = _global.hasOwnProperty("queueMicrotask"); const requestAnimationFramePresent = _global.requestAnimationFrame && @@ -421,6 +425,7 @@ function withGlobal(_global) { target.parse = source.parse; target.UTC = source.UTC; target.prototype.toUTCString = source.prototype.toUTCString; + target.isFake = true; return target; } @@ -581,16 +586,27 @@ function withGlobal(_global) { if (addTimerReturnsObject) { const res = { + refed: true, ref: function () { + this.refed = true; return res; }, unref: function () { + this.refed = false; return res; }, + hasRef: function () { + return this.refed; + }, refresh: function () { - clearTimeout(timer.id); - const args = [timer.func, timer.delay].concat(timer.args); - return setTimeout.apply(null, args); + timer.callAt = + clock.now + + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0)); + + // it _might_ have been removed, but if not the assignment is perfectly fine + clock.timers[timer.id] = timer; + + return res; }, [Symbol.toPrimitive]: function () { return timer.id; @@ -738,6 +754,7 @@ function withGlobal(_global) { /** * Gets clear handler name for a given timer type + * * @param {string} ttype */ function getClearHandler(ttype) { @@ -749,6 +766,7 @@ function withGlobal(_global) { /** * Gets schedule handler name for a given timer type + * * @param {string} ttype */ function getScheduleHandler(ttype) { @@ -1584,20 +1602,6 @@ function withGlobal(_global) { if (performancePresent) { clock.performance = Object.create(null); - - if (hasPerformancePrototype) { - const proto = _global.Performance.prototype; - - Object.getOwnPropertyNames(proto).forEach(function (name) { - if (name.indexOf("getEntries") === 0) { - // match expected return type for getEntries functions - clock.performance[name] = NOOP_ARRAY; - } else { - clock.performance[name] = NOOP; - } - }); - } - clock.performance.now = function FakeTimersNow() { const hrt = hrtime(); const millis = hrt[0] * 1000 + hrt[1] / 1e6; @@ -1632,6 +1636,14 @@ function withGlobal(_global) { ); } + if (_global.Date.isFake === true) { + // Timers are already faked; this is a problem. + // Make the user reset timers before continuing. + throw new TypeError( + "Can't install fake timers twice on the same global object." + ); + } + // eslint-disable-next-line no-param-reassign config = typeof config !== "undefined" ? config : {}; config.shouldAdvanceTime = config.shouldAdvanceTime || false; @@ -1675,6 +1687,32 @@ function withGlobal(_global) { clock.attachedInterval = intervalId; } + if (clock.methods.includes("performance")) { + const proto = (() => { + if (hasPerformancePrototype) { + return _global.Performance.prototype; + } + if (hasPerformanceConstructorPrototype) { + return _global.performance.constructor.prototype; + } + })(); + if (proto) { + Object.getOwnPropertyNames(proto).forEach(function (name) { + if (name !== "now") { + clock.performance[name] = + name.indexOf("getEntries") === 0 + ? NOOP_ARRAY + : NOOP; + } + }); + } else if ((config.toFake || []).includes("performance")) { + // user explicitly tried to fake performance when not present + throw new ReferenceError( + "non-existent performance object cannot be faked" + ); + } + } + for (i = 0, l = clock.methods.length; i < l; i++) { const nameOfMethodToReplace = clock.methods[i]; if (nameOfMethodToReplace === "hrtime") { diff --git a/node_modules/@jest/fake-timers/node_modules/@types/yargs/README.md b/node_modules/@jest/fake-timers/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/@jest/fake-timers/node_modules/@types/yargs/README.md +++ b/node_modules/@jest/fake-timers/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/@jest/fake-timers/node_modules/@types/yargs/helpers.d.mts b/node_modules/@jest/fake-timers/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/@jest/fake-timers/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.mts b/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.ts b/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.ts +++ b/node_modules/@jest/fake-timers/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/@jest/fake-timers/node_modules/@types/yargs/package.json b/node_modules/@jest/fake-timers/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/@jest/fake-timers/node_modules/@types/yargs/package.json +++ b/node_modules/@jest/fake-timers/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/@jest/fake-timers/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/@jest/fake-timers/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/@jest/fake-timers/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/LICENSE b/node_modules/@jest/fake-timers/node_modules/graceful-fs/LICENSE deleted file mode 100644 index 9d2c80369..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/README.md b/node_modules/@jest/fake-timers/node_modules/graceful-fs/README.md deleted file mode 100644 index 82d6e4daf..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# graceful-fs - -graceful-fs functions as a drop-in replacement for the fs module, -making various improvements. - -The improvements are meant to normalize behavior across different -platforms and environments, and to make filesystem access more -resilient to errors. - -## Improvements over [fs module](https://nodejs.org/api/fs.html) - -* Queues up `open` and `readdir` calls, and retries them once - something closes if there is an EMFILE error from too many file - descriptors. -* fixes `lchmod` for Node versions prior to 0.6.2. -* implements `fs.lutimes` if possible. Otherwise it becomes a noop. -* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or - `lchown` if the user isn't root. -* makes `lchmod` and `lchown` become noops, if not available. -* retries reading a file if `read` results in EAGAIN error. - -On Windows, it retries renaming a file for up to one second if `EACCESS` -or `EPERM` error occurs, likely because antivirus software has locked -the directory. - -## USAGE - -```javascript -// use just like fs -var fs = require('graceful-fs') - -// now go and do stuff with it... -fs.readFile('some-file-or-whatever', (err, data) => { - // Do stuff here. -}) -``` - -## Sync methods - -This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync -methods. If you use sync methods which open file descriptors then you are -responsible for dealing with any errors. - -This is a known limitation, not a bug. - -## Global Patching - -If you want to patch the global fs module (or any other fs-like -module) you can do this: - -```javascript -// Make sure to read the caveat below. -var realFs = require('fs') -var gracefulFs = require('graceful-fs') -gracefulFs.gracefulify(realFs) -``` - -This should only ever be done at the top-level application layer, in -order to delay on EMFILE errors from any fs-using dependencies. You -should **not** do this in a library, because it can cause unexpected -delays in other parts of the program. - -## Changes - -This module is fairly stable at this point, and used by a lot of -things. That being said, because it implements a subtle behavior -change in a core part of the node API, even modest changes can be -extremely breaking, and the versioning is thus biased towards -bumping the major when in doubt. - -The main change between major versions has been switching between -providing a fully-patched `fs` module vs monkey-patching the node core -builtin, and the approach by which a non-monkey-patched `fs` was -created. - -The goal is to trade `EMFILE` errors for slower fs operations. So, if -you try to open a zillion files, rather than crashing, `open` -operations will be queued up and wait for something else to `close`. - -There are advantages to each approach. Monkey-patching the fs means -that no `EMFILE` errors can possibly occur anywhere in your -application, because everything is using the same core `fs` module, -which is patched. However, it can also obviously cause undesirable -side-effects, especially if the module is loaded multiple times. - -Implementing a separate-but-identical patched `fs` module is more -surgical (and doesn't run the risk of patching multiple times), but -also imposes the challenge of keeping in sync with the core module. - -The current approach loads the `fs` module, and then creates a -lookalike object that has all the same methods, except a few that are -patched. It is safe to use in all versions of Node from 0.8 through -7.0. - -### v4 - -* Do not monkey-patch the fs module. This module may now be used as a - drop-in dep, and users can opt into monkey-patching the fs builtin - if their app requires it. - -### v3 - -* Monkey-patch fs, because the eval approach no longer works on recent - node. -* fixed possible type-error throw if rename fails on windows -* verify that we *never* get EMFILE errors -* Ignore ENOSYS from chmod/chown -* clarify that graceful-fs must be used as a drop-in - -### v2.1.0 - -* Use eval rather than monkey-patching fs. -* readdir: Always sort the results -* win32: requeue a file if error has an OK status - -### v2.0 - -* A return to monkey patching -* wrap process.cwd - -### v1.1 - -* wrap readFile -* Wrap fs.writeFile. -* readdir protection -* Don't clobber the fs builtin -* Handle fs.read EAGAIN errors by trying again -* Expose the curOpen counter -* No-op lchown/lchmod if not implemented -* fs.rename patch only for win32 -* Patch fs.rename to handle AV software on Windows -* Close #4 Chown should not fail on einval or eperm if non-root -* Fix isaacs/fstream#1 Only wrap fs one time -* Fix #3 Start at 1024 max files, then back off on EMFILE -* lutimes that doens't blow up on Linux -* A full on-rewrite using a queue instead of just swallowing the EMFILE error -* Wrap Read/Write streams as well - -### 1.0 - -* Update engines for node 0.6 -* Be lstat-graceful on Windows -* first diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/clone.js b/node_modules/@jest/fake-timers/node_modules/graceful-fs/clone.js deleted file mode 100644 index dff3cc8c5..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/graceful-fs.js b/node_modules/@jest/fake-timers/node_modules/graceful-fs/graceful-fs.js deleted file mode 100644 index 947cd94bb..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/graceful-fs.js +++ /dev/null @@ -1,429 +0,0 @@ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - require('assert').equal(fs[gracefulQueue].length, 0) - }) - } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) - - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readdir(path, options, cb) - - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() - - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} - -// keep track of the timeout between retry() calls -var retryTimer - -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} - -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined - - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/legacy-streams.js b/node_modules/@jest/fake-timers/node_modules/graceful-fs/legacy-streams.js deleted file mode 100644 index d617b50fc..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/legacy-streams.js +++ /dev/null @@ -1,118 +0,0 @@ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/package.json b/node_modules/@jest/fake-timers/node_modules/graceful-fs/package.json deleted file mode 100644 index e1cb58473..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "graceful-fs", - "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-graceful-fs" - }, - "main": "graceful-fs.js", - "directories": { - "test": "test" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "nyc --silent node test.js | tap -c -", - "posttest": "nyc report" - }, - "keywords": [ - "fs", - "module", - "reading", - "retry", - "retries", - "queue", - "error", - "errors", - "handling", - "EMFILE", - "EAGAIN", - "EINVAL", - "EPERM", - "EACCESS" - ], - "license": "ISC", - "devDependencies": { - "import-fresh": "^2.0.0", - "mkdirp": "^0.5.0", - "rimraf": "^2.2.8", - "tap": "^12.7.0" - }, - "files": [ - "fs.js", - "graceful-fs.js", - "legacy-streams.js", - "polyfills.js", - "clone.js" - ] -} diff --git a/node_modules/@jest/fake-timers/node_modules/graceful-fs/polyfills.js b/node_modules/@jest/fake-timers/node_modules/graceful-fs/polyfills.js deleted file mode 100644 index 26804ef0a..000000000 --- a/node_modules/@jest/fake-timers/node_modules/graceful-fs/polyfills.js +++ /dev/null @@ -1,348 +0,0 @@ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/ErrorWithStack.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/ErrorWithStack.d.ts deleted file mode 100644 index 30a8dd313..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/ErrorWithStack.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default class ErrorWithStack extends Error { - constructor(message: string | undefined, callsite: (...args: Array) => unknown, stackLimit?: number); -} diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/clearLine.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/clearLine.d.ts deleted file mode 100644 index cf56b982c..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/clearLine.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function clearLine(stream: NodeJS.WriteStream): void; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.d.ts deleted file mode 100644 index 4d406660b..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function convertDescriptorToString(descriptor: T): T | string; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.js b/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.js index 4b776af57..a2b7066cf 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.js +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/convertDescriptorToString.js @@ -11,31 +11,24 @@ exports.default = convertDescriptorToString; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - -/* eslint-disable local/ban-types-eventually */ -// See: https://github.com/facebook/jest/pull/5154 function convertDescriptorToString(descriptor) { - if ( - typeof descriptor === 'string' || - typeof descriptor === 'number' || - descriptor === undefined - ) { - return descriptor; - } + switch (typeof descriptor) { + case 'function': + if (descriptor.name) { + return descriptor.name; + } - if (typeof descriptor !== 'function') { - throw new Error('describe expects a class, function, number, or string.'); - } + break; - if (descriptor.name !== undefined) { - return descriptor.name; - } // Fallback for old browsers, pardon Flow + case 'number': + case 'undefined': + return `${descriptor}`; + + case 'string': + return descriptor; + } - const stringified = descriptor.toString(); - const typeDescriptorMatch = stringified.match(/class|function/); - const indexOfNameSpace = // @ts-expect-error: typeDescriptorMatch exists - typeDescriptorMatch.index + typeDescriptorMatch[0].length; - const indexOfNameAfterSpace = stringified.search(/\(|\{/); - const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace); - return name.trim(); + throw new Error( + `Invalid first argument, ${descriptor}. It must be a named class, named function, number, or string.` + ); } diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/createDirectory.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/createDirectory.d.ts deleted file mode 100644 index 7e3e01625..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/createDirectory.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function createDirectory(path: Config.Path): void; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.d.ts deleted file mode 100644 index 29e0db5f4..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function createProcessObject(): NodeJS.Process; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.js b/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.js index afc48948c..ec35a42ad 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.js +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/createProcessObject.js @@ -30,7 +30,7 @@ function createProcessEnv() { function deletePropertyWin32(_target, key) { for (const name in real) { - if (real.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(real, name)) { if (typeof key === 'string') { if (name.toLowerCase() === key.toLowerCase()) { delete real[name]; @@ -71,7 +71,7 @@ function createProcessEnv() { get: isWin32 ? getPropertyWin32 : getProperty, set(_target, key, value) { - const strValue = '' + value; + const strValue = `${value}`; if (typeof key === 'string') { lookup[key.toLowerCase()] = strValue; @@ -98,9 +98,7 @@ function createProcessObject() { } catch (e) { // Make sure it's actually set instead of potentially ignoring errors if (newProcess[Symbol.toStringTag] !== 'process') { - e.message = - 'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' + - e.message; + e.message = `Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n${e.message}`; throw e; } } // Sequentially execute all constructors over the object. diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.d.ts deleted file mode 100644 index f8bd716c5..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type DeepCyclicCopyOptions = { - blacklist?: Set; - keepPrototype?: boolean; -}; -export default function deepCyclicCopy(value: T, options?: DeepCyclicCopyOptions, cycles?: WeakMap): T; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.js b/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.js index e76e34bf2..7a81dbc1e 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.js +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/deepCyclicCopy.js @@ -21,7 +21,7 @@ function deepCyclicCopy( }, cycles = new WeakMap() ) { - if (typeof value !== 'object' || value === null) { + if (typeof value !== 'object' || value === null || Buffer.isBuffer(value)) { return value; } else if (cycles.has(value)) { return cycles.get(value); diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/formatTime.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/formatTime.d.ts deleted file mode 100644 index fc4cd8d75..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/formatTime.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function formatTime(time: number, prefixPower?: number, padLeftLength?: number): string; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/globsToMatcher.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/globsToMatcher.d.ts deleted file mode 100644 index 021ff9e28..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/globsToMatcher.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -declare type Matcher = (str: Config.Path) => boolean; -/** - * Converts a list of globs into a function that matches a path against the - * globs. - * - * Every time picomatch is called, it will parse the glob strings and turn - * them into regexp instances. Instead of calling picomatch repeatedly with - * the same globs, we can use this function which will build the picomatch - * matchers ahead of time and then have an optimized path for determining - * whether an individual path matches. - * - * This function is intended to match the behavior of `micromatch()`. - * - * @example - * const isMatch = globsToMatcher(['*.js', '!*.test.js']); - * isMatch('pizza.js'); // true - * isMatch('pizza.test.js'); // false - */ -export default function globsToMatcher(globs: Array): Matcher; -export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.d.ts index 118162ebe..3b55159b4 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.d.ts +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.d.ts @@ -4,22 +4,122 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as clearLine } from './clearLine'; -export { default as createDirectory } from './createDirectory'; -export { default as ErrorWithStack } from './ErrorWithStack'; -export { default as installCommonGlobals } from './installCommonGlobals'; -export { default as interopRequireDefault } from './interopRequireDefault'; -export { default as isInteractive } from './isInteractive'; -export { default as isPromise } from './isPromise'; -export { default as setGlobal } from './setGlobal'; -export { default as deepCyclicCopy } from './deepCyclicCopy'; -export { default as convertDescriptorToString } from './convertDescriptorToString'; -export * as specialChars from './specialChars'; -export { default as replacePathSepForGlob } from './replacePathSepForGlob'; -export { default as testPathPatternToRegExp } from './testPathPatternToRegExp'; -export { default as globsToMatcher } from './globsToMatcher'; -export * as preRunMessage from './preRunMessage'; -export { default as pluralize } from './pluralize'; -export { default as formatTime } from './formatTime'; -export { default as tryRealpath } from './tryRealpath'; -export { default as requireOrImportModule } from './requireOrImportModule'; +/// + +import type {Config} from '@jest/types'; +import type {Global} from '@jest/types'; + +declare const ARROW = ' \u203A '; + +declare const CLEAR: string; + +export declare function clearLine(stream: NodeJS.WriteStream): void; + +export declare function convertDescriptorToString( + descriptor: Global.BlockNameLike | undefined, +): string; + +export declare function createDirectory(path: string): void; + +export declare function deepCyclicCopy( + value: T, + options?: DeepCyclicCopyOptions, + cycles?: WeakMap, +): T; + +declare type DeepCyclicCopyOptions = { + blacklist?: Set; + keepPrototype?: boolean; +}; + +export declare class ErrorWithStack extends Error { + constructor( + message: string | undefined, + callsite: (...args: Array) => unknown, + stackLimit?: number, + ); +} + +export declare function formatTime( + time: number, + prefixPower?: number, + padLeftLength?: number, +): string; + +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ +export declare function globsToMatcher(globs: Array): Matcher; + +declare const ICONS: { + failed: string; + pending: string; + success: string; + todo: string; +}; + +export declare function installCommonGlobals( + globalObject: typeof globalThis, + globals: Config.ConfigGlobals, +): typeof globalThis & Config.ConfigGlobals; + +export declare function interopRequireDefault(obj: any): any; + +export declare const isInteractive: boolean; + +export declare const isPromise: ( + candidate: unknown, +) => candidate is Promise; + +declare type Matcher = (str: string) => boolean; + +export declare function pluralize(word: string, count: number): string; + +declare namespace preRunMessage { + export {print_2 as print, remove}; +} +export {preRunMessage}; + +declare const print_2: (stream: NodeJS.WriteStream) => void; + +declare const remove: (stream: NodeJS.WriteStream) => void; + +export declare function replacePathSepForGlob(path: string): string; + +export declare function requireOrImportModule( + filePath: string, + applyInteropRequireDefault?: boolean, +): Promise; + +export declare function setGlobal( + globalToMutate: typeof globalThis | Global.Global, + key: string, + value: unknown, +): void; + +declare namespace specialChars { + export {ARROW, ICONS, CLEAR}; +} +export {specialChars}; + +export declare function testPathPatternToRegExp( + testPathPattern: Config.GlobalConfig['testPathPattern'], +): RegExp; + +export declare function tryRealpath(path: string): string; + +export {}; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.js b/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.js index 64b076e90..f23c93aba 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.js +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/index.js @@ -108,6 +108,14 @@ Object.defineProperty(exports, 'tryRealpath', { } }); +var preRunMessage = _interopRequireWildcard(require('./preRunMessage')); + +exports.preRunMessage = preRunMessage; + +var specialChars = _interopRequireWildcard(require('./specialChars')); + +exports.specialChars = specialChars; + var _clearLine = _interopRequireDefault2(require('./clearLine')); var _createDirectory = _interopRequireDefault2(require('./createDirectory')); @@ -134,10 +142,6 @@ var _convertDescriptorToString = _interopRequireDefault2( require('./convertDescriptorToString') ); -var _specialChars = _interopRequireWildcard(require('./specialChars')); - -exports.specialChars = _specialChars; - var _replacePathSepForGlob = _interopRequireDefault2( require('./replacePathSepForGlob') ); @@ -148,10 +152,6 @@ var _testPathPatternToRegExp = _interopRequireDefault2( var _globsToMatcher = _interopRequireDefault2(require('./globsToMatcher')); -var _preRunMessage = _interopRequireWildcard(require('./preRunMessage')); - -exports.preRunMessage = _preRunMessage; - var _pluralize = _interopRequireDefault2(require('./pluralize')); var _formatTime = _interopRequireDefault2(require('./formatTime')); @@ -162,6 +162,10 @@ var _requireOrImportModule = _interopRequireDefault2( require('./requireOrImportModule') ); +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== 'function') return null; var cacheBabelInterop = new WeakMap(); @@ -203,7 +207,3 @@ function _interopRequireWildcard(obj, nodeInterop) { } return newObj; } - -function _interopRequireDefault2(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.d.ts deleted file mode 100644 index c93689efa..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function installCommonGlobals(globalObject: typeof globalThis, globals: Config.ConfigGlobals): typeof globalThis & Config.ConfigGlobals; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.js b/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.js index 509ceee1a..6435f75d2 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.js +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/installCommonGlobals.js @@ -73,7 +73,7 @@ function _interopRequireWildcard(obj, nodeInterop) { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -const DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE')); +const DTRACE = Object.keys(globalThis).filter(key => key.startsWith('DTRACE')); function installCommonGlobals(globalObject, globals) { globalObject.process = (0, _createProcessObject.default)(); @@ -116,7 +116,7 @@ function installCommonGlobals(globalObject, globals) { // @ts-expect-error: no index globalObject[dtrace] = function (...args) { // @ts-expect-error: no index - return global[dtrace].apply(this, args); + return globalThis[dtrace].apply(this, args); }; }); return Object.assign(globalObject, (0, _deepCyclicCopy.default)(globals)); diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/interopRequireDefault.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/interopRequireDefault.d.ts deleted file mode 100644 index 91b66e4fc..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/interopRequireDefault.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function interopRequireDefault(obj: any): any; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/isInteractive.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/isInteractive.d.ts deleted file mode 100644 index 57ddbf0a7..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/isInteractive.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const _default: boolean; -export default _default; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.d.ts deleted file mode 100644 index ea8589b90..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const isPromise: (candidate: unknown) => candidate is Promise; -export default isPromise; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.js b/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.js index 7158df850..5a7202064 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.js +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/build/isPromise.js @@ -11,8 +11,8 @@ exports.default = void 0; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// capture global.Promise before it may potentially be overwritten -const Promise = global.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 +// capture globalThis.Promise before it may potentially be overwritten +const Promise = globalThis.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 const isPromise = candidate => Promise.resolve(candidate) === candidate; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/pluralize.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/pluralize.d.ts deleted file mode 100644 index 9be305792..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/pluralize.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function pluralize(word: string, count: number): string; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/preRunMessage.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/preRunMessage.d.ts deleted file mode 100644 index 55acad973..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/preRunMessage.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export declare const print: (stream: NodeJS.WriteStream) => void; -export declare const remove: (stream: NodeJS.WriteStream) => void; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/replacePathSepForGlob.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/replacePathSepForGlob.d.ts deleted file mode 100644 index 7f47d18bf..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/replacePathSepForGlob.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function replacePathSepForGlob(path: Config.Path): Config.Glob; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/requireOrImportModule.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/requireOrImportModule.d.ts deleted file mode 100644 index b27bd9477..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/requireOrImportModule.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function requireOrImportModule(filePath: Config.Path, applyInteropRequireDefault?: boolean): Promise; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/setGlobal.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/setGlobal.d.ts deleted file mode 100644 index 94e0e7642..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/setGlobal.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function setGlobal(globalToMutate: typeof globalThis, key: string, value: unknown): void; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/specialChars.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/specialChars.d.ts deleted file mode 100644 index 1a50d4954..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/specialChars.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare const ARROW = " \u203A "; -export declare const ICONS: { - failed: string; - pending: string; - success: string; - todo: string; -}; -export declare const CLEAR: string; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/testPathPatternToRegExp.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/testPathPatternToRegExp.d.ts deleted file mode 100644 index 115aadfaa..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/testPathPatternToRegExp.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function testPathPatternToRegExp(testPathPattern: Config.GlobalConfig['testPathPattern']): RegExp; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/build/tryRealpath.d.ts b/node_modules/@jest/fake-timers/node_modules/jest-util/build/tryRealpath.d.ts deleted file mode 100644 index cccdfa0e5..000000000 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/build/tryRealpath.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function tryRealpath(path: Config.Path): Config.Path; diff --git a/node_modules/@jest/fake-timers/node_modules/jest-util/package.json b/node_modules/@jest/fake-timers/node_modules/jest-util/package.json index f1b9788a3..1bd8f7d17 100644 --- a/node_modules/@jest/fake-timers/node_modules/jest-util/package.json +++ b/node_modules/@jest/fake-timers/node_modules/jest-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-util", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,7 +17,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -25,15 +25,14 @@ "picomatch": "^2.2.3" }, "devDependencies": { - "@types/graceful-fs": "^4.1.2", - "@types/micromatch": "^4.0.1", + "@types/graceful-fs": "^4.1.3", "@types/picomatch": "^2.2.2" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/CHANGELOG.md b/node_modules/@jest/fake-timers/node_modules/picomatch/CHANGELOG.md deleted file mode 100644 index 8ccc6c1ba..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ -# Release history - -**All notable changes to this project will be documented in this file.** - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## 2.3.1 (2022-01-02) - -### Fixed - -* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). - -### Changed - -* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). - -## 2.3.0 (2021-05-21) - -### Fixed - -* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) - -## 2.2.3 (2021-04-10) - -### Fixed - -* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). -* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). - -## 2.2.2 (2020-03-21) - -### Fixed - -* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). - -## 2.2.1 (2020-01-04) - -* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. - -## 2.2.0 (2020-01-04) - -* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) -* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. - -## 2.1.0 (2019-10-31) - -* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) -* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) -* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) -* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) -* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) -* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) -* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) -* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) -* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) -* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) -* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) -* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) -* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) -* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) -* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) -* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) -* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) -* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) -* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) -* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) -* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) -* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) - -## 2.0.7 (2019-05-14) - -* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) -* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) -* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) -* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) - -## 2.0.4 (2019-04-10) - -### Fixed - -- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. -- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. - -## 2.0.0 (2019-04-10) - -### Added - -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - -### Breaking changes - -- The unixify option was renamed to `windows` -- caching and all related options and methods have been removed - -## 1.0.0 (2018-11-05) - -- adds `.onMatch` option -- improvements to `.scan` method -- numerous improvements and optimizations for matching and parsing -- better windows path handling - -## 0.1.0 - 2017-04-13 - -First release. - - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/LICENSE b/node_modules/@jest/fake-timers/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca25..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/README.md b/node_modules/@jest/fake-timers/node_modules/picomatch/README.md deleted file mode 100644 index b0526e28a..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/README.md +++ /dev/null @@ -1,708 +0,0 @@ -

Picomatch

- -

- -version - - -test status - - -coverage status - - -downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.makeRe](#makere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L32) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.test](lib/picomatch.js#L117) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L161) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L183) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L199) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L231) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L245) - -Compile a regular expression from the `state` object returned by the -[parse()](#parse) method. - -**Params** - -* `state` **{Object}** -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. -* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. -* `returns` **{RegExp}** - -### [.makeRe](lib/picomatch.js#L286) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. -* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L321) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | - -picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[] - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -``` -# .makeRe star - picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) - minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) - -# .makeRe star; dot=true - picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) - minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) - -# .makeRe globstar - picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) - minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) - -# .makeRe globstars - picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) - minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) - -# .makeRe with leading star - picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) - minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) - -# .makeRe - basic braces - picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) - minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/index.js b/node_modules/@jest/fake-timers/node_modules/picomatch/index.js deleted file mode 100644 index d2f2bc59d..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/constants.js b/node_modules/@jest/fake-timers/node_modules/picomatch/lib/constants.js deleted file mode 100644 index a62ef3879..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; - -const path = require('path'); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/parse.js b/node_modules/@jest/fake-timers/node_modules/picomatch/lib/parse.js deleted file mode 100644 index 58269d018..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1091 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. - // In this case, we need to parse the string and use it in the output of the original pattern. - // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. - // - // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. - const expression = parse(rest, { ...options, fastpaths: false }).output; - - output = token.close = `)${expression})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/picomatch.js b/node_modules/@jest/fake-timers/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index 782d80943..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,342 +0,0 @@ -'use strict'; - -const path = require('path'); -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse(input, options); - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/scan.js b/node_modules/@jest/fake-timers/node_modules/picomatch/lib/scan.js deleted file mode 100644 index e59cd7a13..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/utils.js b/node_modules/@jest/fake-timers/node_modules/picomatch/lib/utils.js deleted file mode 100644 index c3ca766a7..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const path = require('path'); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; diff --git a/node_modules/@jest/fake-timers/node_modules/picomatch/package.json b/node_modules/@jest/fake-timers/node_modules/picomatch/package.json deleted file mode 100644 index 3db22d408..000000000 --- a/node_modules/@jest/fake-timers/node_modules/picomatch/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "2.3.1", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^6.8.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/node_modules/@jest/fake-timers/package.json b/node_modules/@jest/fake-timers/package.json index 861e2ced9..dfb025def 100644 --- a/node_modules/@jest/fake-timers/package.json +++ b/node_modules/@jest/fake-timers/package.json @@ -1,6 +1,6 @@ { "name": "@jest/fake-timers", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,21 +17,22 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/types": "^27.5.1", - "@sinonjs/fake-timers": "^8.0.1", + "@jest/types": "^28.0.1", + "@sinonjs/fake-timers": "^9.1.1", "@types/node": "*", - "jest-message-util": "^27.5.1", - "jest-mock": "^27.5.1", - "jest-util": "^27.5.1" + "jest-message-util": "^28.0.1", + "jest-mock": "^28.0.1", + "jest-util": "^28.0.1" }, "devDependencies": { - "@types/sinonjs__fake-timers": "^8.1.1" + "@jest/test-utils": "^28.0.1", + "@types/sinonjs__fake-timers": "^8.1.2" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/globals/build/index.d.ts b/node_modules/@jest/globals/build/index.d.ts index 1cc83b8a4..076b7a03f 100644 --- a/node_modules/@jest/globals/build/index.d.ts +++ b/node_modules/@jest/globals/build/index.d.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ import type { Jest } from '@jest/environment'; +import type { JestExpect } from '@jest/expect'; import type { Global } from '@jest/types'; -import importedExpect = require('expect'); export declare const jest: Jest; -export declare const expect: typeof importedExpect; +export declare const expect: JestExpect; export declare const it: Global.GlobalAdditions['it']; export declare const test: Global.GlobalAdditions['test']; export declare const fit: Global.GlobalAdditions['fit']; diff --git a/node_modules/@jest/globals/build/index.js b/node_modules/@jest/globals/build/index.js index 06f90c10c..b9684dd39 100644 --- a/node_modules/@jest/globals/build/index.js +++ b/node_modules/@jest/globals/build/index.js @@ -1,19 +1,5 @@ 'use strict'; -function _expect() { - const data = _interopRequireDefault(require('expect')); - - _expect = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/@jest/globals/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/@jest/globals/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/package.json b/node_modules/@jest/globals/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/@jest/globals/node_modules/@jest/types/package.json +++ b/node_modules/@jest/globals/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/globals/node_modules/@types/yargs/README.md b/node_modules/@jest/globals/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/@jest/globals/node_modules/@types/yargs/README.md +++ b/node_modules/@jest/globals/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/@jest/globals/node_modules/@types/yargs/helpers.d.mts b/node_modules/@jest/globals/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/@jest/globals/node_modules/@types/yargs/index.d.mts b/node_modules/@jest/globals/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/@jest/globals/node_modules/@types/yargs/index.d.ts b/node_modules/@jest/globals/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/@jest/globals/node_modules/@types/yargs/index.d.ts +++ b/node_modules/@jest/globals/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/@jest/globals/node_modules/@types/yargs/package.json b/node_modules/@jest/globals/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/@jest/globals/node_modules/@types/yargs/package.json +++ b/node_modules/@jest/globals/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/@jest/globals/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/@jest/globals/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/@jest/globals/package.json b/node_modules/@jest/globals/package.json index 9cadc9bfb..3b7cdfada 100644 --- a/node_modules/@jest/globals/package.json +++ b/node_modules/@jest/globals/package.json @@ -1,13 +1,13 @@ { "name": "@jest/globals", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-globals" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,12 +20,12 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/types": "^27.5.1", - "expect": "^27.5.1" + "@jest/environment": "^28.0.1", + "@jest/expect": "^28.0.1", + "@jest/types": "^28.0.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/schemas/LICENSE b/node_modules/@jest/schemas/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/schemas/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/schemas/README.md b/node_modules/@jest/schemas/README.md new file mode 100644 index 000000000..b2a1d1229 --- /dev/null +++ b/node_modules/@jest/schemas/README.md @@ -0,0 +1,3 @@ +# `@jest/schemas` + +Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration. diff --git a/node_modules/@jest/schemas/build/index.d.ts b/node_modules/@jest/schemas/build/index.d.ts new file mode 100644 index 000000000..199ff1f93 --- /dev/null +++ b/node_modules/@jest/schemas/build/index.d.ts @@ -0,0 +1,69 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import {Static} from '@sinclair/typebox'; +import {StaticPartial} from '@sinclair/typebox'; +import {TBoolean} from '@sinclair/typebox'; +import {TNumber} from '@sinclair/typebox'; +import {TObject} from '@sinclair/typebox'; +import {TReadonly} from '@sinclair/typebox'; +import {TString} from '@sinclair/typebox'; + +declare const RawSnapshotFormat: TObject< + StaticPartial<{ + callToJSON: TReadonly; + escapeRegex: TReadonly; + escapeString: TReadonly; + highlight: TReadonly; + indent: TReadonly; + maxDepth: TReadonly; + maxWidth: TReadonly; + min: TReadonly; + printBasicPrototype: TReadonly; + printFunctionName: TReadonly; + theme: TReadonly< + TObject< + StaticPartial<{ + comment: TReadonly; + content: TReadonly; + prop: TReadonly; + tag: TReadonly; + value: TReadonly; + }> + > + >; + }> +>; + +export declare const SnapshotFormat: TObject< + StaticPartial<{ + callToJSON: TReadonly; + escapeRegex: TReadonly; + escapeString: TReadonly; + highlight: TReadonly; + indent: TReadonly; + maxDepth: TReadonly; + maxWidth: TReadonly; + min: TReadonly; + printBasicPrototype: TReadonly; + printFunctionName: TReadonly; + theme: TReadonly< + TObject< + StaticPartial<{ + comment: TReadonly; + content: TReadonly; + prop: TReadonly; + tag: TReadonly; + value: TReadonly; + }> + > + >; + }> +>; + +export declare type SnapshotFormat = Static; + +export {}; diff --git a/node_modules/@jest/schemas/build/index.js b/node_modules/@jest/schemas/build/index.js new file mode 100644 index 000000000..5e66568b2 --- /dev/null +++ b/node_modules/@jest/schemas/build/index.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.SnapshotFormat = void 0; + +function _typebox() { + const data = require('@sinclair/typebox'); + + _typebox = function () { + return data; + }; + + return data; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const RawSnapshotFormat = _typebox().Type.Partial( + _typebox().Type.Object({ + callToJSON: _typebox().Type.Readonly(_typebox().Type.Boolean()), + escapeRegex: _typebox().Type.Readonly(_typebox().Type.Boolean()), + escapeString: _typebox().Type.Readonly(_typebox().Type.Boolean()), + highlight: _typebox().Type.Readonly(_typebox().Type.Boolean()), + indent: _typebox().Type.Readonly( + _typebox().Type.Number({ + minimum: 0 + }) + ), + maxDepth: _typebox().Type.Readonly( + _typebox().Type.Number({ + minimum: 0 + }) + ), + maxWidth: _typebox().Type.Readonly( + _typebox().Type.Number({ + minimum: 0 + }) + ), + min: _typebox().Type.Readonly(_typebox().Type.Boolean()), + printBasicPrototype: _typebox().Type.Readonly(_typebox().Type.Boolean()), + printFunctionName: _typebox().Type.Readonly(_typebox().Type.Boolean()), + theme: _typebox().Type.Readonly( + _typebox().Type.Partial( + _typebox().Type.Object({ + comment: _typebox().Type.Readonly(_typebox().Type.String()), + content: _typebox().Type.Readonly(_typebox().Type.String()), + prop: _typebox().Type.Readonly(_typebox().Type.String()), + tag: _typebox().Type.Readonly(_typebox().Type.String()), + value: _typebox().Type.Readonly(_typebox().Type.String()) + }) + ) + ) + }) +); + +const SnapshotFormat = _typebox().Type.Strict(RawSnapshotFormat); + +exports.SnapshotFormat = SnapshotFormat; diff --git a/node_modules/@jest/schemas/package.json b/node_modules/@jest/schemas/package.json new file mode 100644 index 000000000..2a11da6d6 --- /dev/null +++ b/node_modules/@jest/schemas/package.json @@ -0,0 +1,29 @@ +{ + "name": "@jest/schemas", + "version": "28.0.0", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-schemas" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "@sinclair/typebox": "^0.23.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" +} diff --git a/node_modules/@jest/source-map/build/getCallsite.d.ts b/node_modules/@jest/source-map/build/getCallsite.d.ts deleted file mode 100644 index c09ab3d65..000000000 --- a/node_modules/@jest/source-map/build/getCallsite.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import callsites = require('callsites'); -import type { SourceMapRegistry } from './types'; -export default function getCallsite(level: number, sourceMaps?: SourceMapRegistry | null): callsites.CallSite; diff --git a/node_modules/@jest/source-map/build/getCallsite.js b/node_modules/@jest/source-map/build/getCallsite.js index 35c6102c8..bea38b5a2 100644 --- a/node_modules/@jest/source-map/build/getCallsite.js +++ b/node_modules/@jest/source-map/build/getCallsite.js @@ -5,30 +5,30 @@ Object.defineProperty(exports, '__esModule', { }); exports.default = getCallsite; -function _callsites() { - const data = _interopRequireDefault(require('callsites')); +function _traceMapping() { + const data = require('@jridgewell/trace-mapping'); - _callsites = function () { + _traceMapping = function () { return data; }; return data; } -function _gracefulFs() { - const data = require('graceful-fs'); +function _callsites() { + const data = _interopRequireDefault(require('callsites')); - _gracefulFs = function () { + _callsites = function () { return data; }; return data; } -function _sourceMap() { - const data = require('source-map'); +function _gracefulFs() { + const data = require('graceful-fs'); - _sourceMap = function () { + _gracefulFs = function () { return data; }; @@ -46,14 +46,14 @@ function _interopRequireDefault(obj) { * LICENSE file in the root directory of this source tree. */ // Copied from https://github.com/rexxars/sourcemap-decorate-callsites/blob/5b9735a156964973a75dc62fd2c7f0c1975458e8/lib/index.js#L113-L158 -const addSourceMapConsumer = (callsite, consumer) => { +const addSourceMapConsumer = (callsite, tracer) => { const getLineNumber = callsite.getLineNumber; const getColumnNumber = callsite.getColumnNumber; let position = null; function getPosition() { if (!position) { - position = consumer.originalPositionFor({ + position = (0, _traceMapping().originalPositionFor)(tracer, { column: getColumnNumber.call(callsite) || -1, line: getLineNumber.call(callsite) || -1 }); @@ -93,12 +93,8 @@ function getCallsite(level, sourceMaps) { const sourceMap = (0, _gracefulFs().readFileSync)( sourceMapFileName, 'utf8' - ); // @ts-expect-error: Not allowed to pass string - - addSourceMapConsumer( - stack, - new (_sourceMap().SourceMapConsumer)(sourceMap) ); + addSourceMapConsumer(stack, new (_traceMapping().TraceMap)(sourceMap)); } catch { // ignore } diff --git a/node_modules/@jest/source-map/build/index.d.ts b/node_modules/@jest/source-map/build/index.d.ts index a6ffae945..cd442162f 100644 --- a/node_modules/@jest/source-map/build/index.d.ts +++ b/node_modules/@jest/source-map/build/index.d.ts @@ -4,5 +4,13 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as getCallsite } from './getCallsite'; -export type { SourceMapRegistry } from './types'; +import callsites = require('callsites'); + +export declare function getCallsite( + level: number, + sourceMaps?: SourceMapRegistry | null, +): callsites.CallSite; + +export declare type SourceMapRegistry = Map; + +export {}; diff --git a/node_modules/@jest/source-map/build/types.d.ts b/node_modules/@jest/source-map/build/types.d.ts deleted file mode 100644 index 3910875a0..000000000 --- a/node_modules/@jest/source-map/build/types.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type SourceMapRegistry = Map; diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/LICENSE b/node_modules/@jest/source-map/node_modules/graceful-fs/LICENSE deleted file mode 100644 index 9d2c80369..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/README.md b/node_modules/@jest/source-map/node_modules/graceful-fs/README.md deleted file mode 100644 index 82d6e4daf..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# graceful-fs - -graceful-fs functions as a drop-in replacement for the fs module, -making various improvements. - -The improvements are meant to normalize behavior across different -platforms and environments, and to make filesystem access more -resilient to errors. - -## Improvements over [fs module](https://nodejs.org/api/fs.html) - -* Queues up `open` and `readdir` calls, and retries them once - something closes if there is an EMFILE error from too many file - descriptors. -* fixes `lchmod` for Node versions prior to 0.6.2. -* implements `fs.lutimes` if possible. Otherwise it becomes a noop. -* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or - `lchown` if the user isn't root. -* makes `lchmod` and `lchown` become noops, if not available. -* retries reading a file if `read` results in EAGAIN error. - -On Windows, it retries renaming a file for up to one second if `EACCESS` -or `EPERM` error occurs, likely because antivirus software has locked -the directory. - -## USAGE - -```javascript -// use just like fs -var fs = require('graceful-fs') - -// now go and do stuff with it... -fs.readFile('some-file-or-whatever', (err, data) => { - // Do stuff here. -}) -``` - -## Sync methods - -This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync -methods. If you use sync methods which open file descriptors then you are -responsible for dealing with any errors. - -This is a known limitation, not a bug. - -## Global Patching - -If you want to patch the global fs module (or any other fs-like -module) you can do this: - -```javascript -// Make sure to read the caveat below. -var realFs = require('fs') -var gracefulFs = require('graceful-fs') -gracefulFs.gracefulify(realFs) -``` - -This should only ever be done at the top-level application layer, in -order to delay on EMFILE errors from any fs-using dependencies. You -should **not** do this in a library, because it can cause unexpected -delays in other parts of the program. - -## Changes - -This module is fairly stable at this point, and used by a lot of -things. That being said, because it implements a subtle behavior -change in a core part of the node API, even modest changes can be -extremely breaking, and the versioning is thus biased towards -bumping the major when in doubt. - -The main change between major versions has been switching between -providing a fully-patched `fs` module vs monkey-patching the node core -builtin, and the approach by which a non-monkey-patched `fs` was -created. - -The goal is to trade `EMFILE` errors for slower fs operations. So, if -you try to open a zillion files, rather than crashing, `open` -operations will be queued up and wait for something else to `close`. - -There are advantages to each approach. Monkey-patching the fs means -that no `EMFILE` errors can possibly occur anywhere in your -application, because everything is using the same core `fs` module, -which is patched. However, it can also obviously cause undesirable -side-effects, especially if the module is loaded multiple times. - -Implementing a separate-but-identical patched `fs` module is more -surgical (and doesn't run the risk of patching multiple times), but -also imposes the challenge of keeping in sync with the core module. - -The current approach loads the `fs` module, and then creates a -lookalike object that has all the same methods, except a few that are -patched. It is safe to use in all versions of Node from 0.8 through -7.0. - -### v4 - -* Do not monkey-patch the fs module. This module may now be used as a - drop-in dep, and users can opt into monkey-patching the fs builtin - if their app requires it. - -### v3 - -* Monkey-patch fs, because the eval approach no longer works on recent - node. -* fixed possible type-error throw if rename fails on windows -* verify that we *never* get EMFILE errors -* Ignore ENOSYS from chmod/chown -* clarify that graceful-fs must be used as a drop-in - -### v2.1.0 - -* Use eval rather than monkey-patching fs. -* readdir: Always sort the results -* win32: requeue a file if error has an OK status - -### v2.0 - -* A return to monkey patching -* wrap process.cwd - -### v1.1 - -* wrap readFile -* Wrap fs.writeFile. -* readdir protection -* Don't clobber the fs builtin -* Handle fs.read EAGAIN errors by trying again -* Expose the curOpen counter -* No-op lchown/lchmod if not implemented -* fs.rename patch only for win32 -* Patch fs.rename to handle AV software on Windows -* Close #4 Chown should not fail on einval or eperm if non-root -* Fix isaacs/fstream#1 Only wrap fs one time -* Fix #3 Start at 1024 max files, then back off on EMFILE -* lutimes that doens't blow up on Linux -* A full on-rewrite using a queue instead of just swallowing the EMFILE error -* Wrap Read/Write streams as well - -### 1.0 - -* Update engines for node 0.6 -* Be lstat-graceful on Windows -* first diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/clone.js b/node_modules/@jest/source-map/node_modules/graceful-fs/clone.js deleted file mode 100644 index dff3cc8c5..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/graceful-fs.js b/node_modules/@jest/source-map/node_modules/graceful-fs/graceful-fs.js deleted file mode 100644 index 947cd94bb..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/graceful-fs.js +++ /dev/null @@ -1,429 +0,0 @@ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - require('assert').equal(fs[gracefulQueue].length, 0) - }) - } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) - - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readdir(path, options, cb) - - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() - - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} - -// keep track of the timeout between retry() calls -var retryTimer - -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} - -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined - - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/legacy-streams.js b/node_modules/@jest/source-map/node_modules/graceful-fs/legacy-streams.js deleted file mode 100644 index d617b50fc..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/legacy-streams.js +++ /dev/null @@ -1,118 +0,0 @@ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/package.json b/node_modules/@jest/source-map/node_modules/graceful-fs/package.json deleted file mode 100644 index e1cb58473..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "graceful-fs", - "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-graceful-fs" - }, - "main": "graceful-fs.js", - "directories": { - "test": "test" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "nyc --silent node test.js | tap -c -", - "posttest": "nyc report" - }, - "keywords": [ - "fs", - "module", - "reading", - "retry", - "retries", - "queue", - "error", - "errors", - "handling", - "EMFILE", - "EAGAIN", - "EINVAL", - "EPERM", - "EACCESS" - ], - "license": "ISC", - "devDependencies": { - "import-fresh": "^2.0.0", - "mkdirp": "^0.5.0", - "rimraf": "^2.2.8", - "tap": "^12.7.0" - }, - "files": [ - "fs.js", - "graceful-fs.js", - "legacy-streams.js", - "polyfills.js", - "clone.js" - ] -} diff --git a/node_modules/@jest/source-map/node_modules/graceful-fs/polyfills.js b/node_modules/@jest/source-map/node_modules/graceful-fs/polyfills.js deleted file mode 100644 index 26804ef0a..000000000 --- a/node_modules/@jest/source-map/node_modules/graceful-fs/polyfills.js +++ /dev/null @@ -1,348 +0,0 @@ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} diff --git a/node_modules/@jest/source-map/package.json b/node_modules/@jest/source-map/package.json index 9ade03c32..179dcac88 100644 --- a/node_modules/@jest/source-map/package.json +++ b/node_modules/@jest/source-map/package.json @@ -1,6 +1,6 @@ { "name": "@jest/source-map", - "version": "27.5.1", + "version": "28.0.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,18 +17,18 @@ "./package.json": "./package.json" }, "dependencies": { + "@jridgewell/trace-mapping": "^0.3.7", "callsites": "^3.0.0", - "graceful-fs": "^4.2.9", - "source-map": "^0.6.0" + "graceful-fs": "^4.2.9" }, "devDependencies": { - "@types/graceful-fs": "^4.1.2" + "@types/graceful-fs": "^4.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" } diff --git a/node_modules/@jest/test-result/build/formatTestResults.d.ts b/node_modules/@jest/test-result/build/formatTestResults.d.ts deleted file mode 100644 index 6a3bf03a4..000000000 --- a/node_modules/@jest/test-result/build/formatTestResults.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { AggregatedResult, CodeCoverageFormatter, CodeCoverageReporter, FormattedTestResults } from './types'; -export default function formatTestResults(results: AggregatedResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter): FormattedTestResults; diff --git a/node_modules/@jest/test-result/build/formatTestResults.js b/node_modules/@jest/test-result/build/formatTestResults.js index 3de0cdfa3..da0ce559d 100644 --- a/node_modules/@jest/test-result/build/formatTestResults.js +++ b/node_modules/@jest/test-result/build/formatTestResults.js @@ -48,6 +48,7 @@ const formatTestResult = (testResult, codeCoverageFormatter, reporter) => { function formatTestAssertion(assertion) { const result = { ancestorTitles: assertion.ancestorTitles, + duration: assertion.duration, failureMessages: null, fullName: assertion.fullName, location: assertion.location, diff --git a/node_modules/@jest/test-result/build/helpers.d.ts b/node_modules/@jest/test-result/build/helpers.d.ts deleted file mode 100644 index 480c7ab3e..000000000 --- a/node_modules/@jest/test-result/build/helpers.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -import type { AggregatedResult, SerializableError, TestResult } from './types'; -export declare const makeEmptyAggregatedTestResult: () => AggregatedResult; -export declare const buildFailureTestResult: (testPath: Config.Path, err: SerializableError) => TestResult; -export declare const addResult: (aggregatedResults: AggregatedResult, testResult: TestResult) => void; -export declare const createEmptyTestResult: () => TestResult; diff --git a/node_modules/@jest/test-result/build/index.d.ts b/node_modules/@jest/test-result/build/index.d.ts index d46d37b42..9c11f44e4 100644 --- a/node_modules/@jest/test-result/build/index.d.ts +++ b/node_modules/@jest/test-result/build/index.d.ts @@ -4,6 +4,230 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as formatTestResults } from './formatTestResults'; -export { addResult, buildFailureTestResult, createEmptyTestResult, makeEmptyAggregatedTestResult, } from './helpers'; -export type { AggregatedResult, AssertionLocation, AssertionResult, FailedAssertion, FormattedTestResults, Milliseconds, RuntimeTransformResult, SerializableError, SnapshotSummary, Status, Suite, Test, TestEvents, TestFileEvent, TestResult, TestResultsProcessor, TestCaseResult, V8CoverageResult, } from './types'; +import type {Config} from '@jest/types'; +import type {ConsoleBuffer} from '@jest/console'; +import type {CoverageMap} from 'istanbul-lib-coverage'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {FS} from 'jest-haste-map'; +import type {ModuleMap} from 'jest-haste-map'; +import type Resolver from 'jest-resolve'; +import type {TestResult as TestResult_2} from '@jest/types'; +import type {TransformTypes} from '@jest/types'; +import type {V8Coverage} from 'collect-v8-coverage'; + +export declare const addResult: ( + aggregatedResults: AggregatedResult, + testResult: TestResult, +) => void; + +export declare type AggregatedResult = AggregatedResultWithoutCoverage & { + coverageMap?: CoverageMap | null; +}; + +declare type AggregatedResultWithoutCoverage = { + numFailedTests: number; + numFailedTestSuites: number; + numPassedTests: number; + numPassedTestSuites: number; + numPendingTests: number; + numTodoTests: number; + numPendingTestSuites: number; + numRuntimeErrorTestSuites: number; + numTotalTests: number; + numTotalTestSuites: number; + openHandles: Array; + snapshot: SnapshotSummary; + startTime: number; + success: boolean; + testResults: Array; + wasInterrupted: boolean; +}; + +export declare type AssertionLocation = { + fullName: string; + path: string; +}; + +export declare type AssertionResult = TestResult_2.AssertionResult; + +export declare const buildFailureTestResult: ( + testPath: string, + err: SerializableError, +) => TestResult; + +declare type Bytes = number; + +declare type CodeCoverageFormatter = ( + coverage: CoverageMapData | null | undefined, + reporter: CodeCoverageReporter, +) => Record | null | undefined; + +declare type CodeCoverageReporter = unknown; + +export declare const createEmptyTestResult: () => TestResult; + +export declare type FailedAssertion = { + matcherName?: string; + message?: string; + actual?: unknown; + pass?: boolean; + passed?: boolean; + expected?: unknown; + isNot?: boolean; + stack?: string; + error?: unknown; +}; + +declare type FormattedAssertionResult = Pick< + AssertionResult, + 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title' | 'duration' +> & { + failureMessages: AssertionResult['failureMessages'] | null; +}; + +declare type FormattedTestResult = { + message: string; + name: string; + summary: string; + status: 'failed' | 'passed'; + startTime: number; + endTime: number; + coverage: unknown; + assertionResults: Array; +}; + +export declare type FormattedTestResults = { + coverageMap?: CoverageMap | null | undefined; + numFailedTests: number; + numFailedTestSuites: number; + numPassedTests: number; + numPassedTestSuites: number; + numPendingTests: number; + numPendingTestSuites: number; + numRuntimeErrorTestSuites: number; + numTotalTests: number; + numTotalTestSuites: number; + snapshot: SnapshotSummary; + startTime: number; + success: boolean; + testResults: Array; + wasInterrupted: boolean; +}; + +export declare function formatTestResults( + results: AggregatedResult, + codeCoverageFormatter?: CodeCoverageFormatter, + reporter?: CodeCoverageReporter, +): FormattedTestResults; + +export declare const makeEmptyAggregatedTestResult: () => AggregatedResult; + +export declare type Milliseconds = TestResult_2.Milliseconds; + +export declare interface RuntimeTransformResult + extends TransformTypes.TransformResult { + wrapperLength: number; +} + +export declare type SerializableError = TestResult_2.SerializableError; + +export declare type SnapshotSummary = { + added: number; + didUpdate: boolean; + failure: boolean; + filesAdded: number; + filesRemoved: number; + filesRemovedList: Array; + filesUnmatched: number; + filesUpdated: number; + matched: number; + total: number; + unchecked: number; + uncheckedKeysByFile: Array; + unmatched: number; + updated: number; +}; + +export declare type Status = AssertionResult['status']; + +export declare type Suite = { + title: string; + suites: Array; + tests: Array; +}; + +export declare type Test = { + context: TestContext; + duration?: number; + path: string; +}; + +export declare type TestCaseResult = AssertionResult; + +export declare type TestContext = { + config: Config.ProjectConfig; + hasteFS: FS; + moduleMap: ModuleMap; + resolver: Resolver; +}; + +export declare type TestEvents = { + 'test-file-start': [Test]; + 'test-file-success': [Test, TestResult]; + 'test-file-failure': [Test, SerializableError]; + 'test-case-result': [string, AssertionResult]; +}; + +export declare type TestFileEvent< + T extends keyof TestEvents = keyof TestEvents, +> = (eventName: T, args: TestEvents[T]) => unknown; + +export declare type TestResult = { + console?: ConsoleBuffer; + coverage?: CoverageMapData; + displayName?: Config.DisplayName; + failureMessage?: string | null; + leaks: boolean; + memoryUsage?: Bytes; + numFailingTests: number; + numPassingTests: number; + numPendingTests: number; + numTodoTests: number; + openHandles: Array; + perfStats: { + end: Milliseconds; + runtime: Milliseconds; + slow: boolean; + start: Milliseconds; + }; + skipped: boolean; + snapshot: { + added: number; + fileDeleted: boolean; + matched: number; + unchecked: number; + uncheckedKeys: Array; + unmatched: number; + updated: number; + }; + testExecError?: SerializableError; + testFilePath: string; + testResults: Array; + v8Coverage?: V8CoverageResult; +}; + +export declare type TestResultsProcessor = ( + results: AggregatedResult, +) => AggregatedResult; + +declare type UncheckedSnapshot = { + filePath: string; + keys: Array; +}; + +export declare type V8CoverageResult = Array<{ + codeTransformResult: RuntimeTransformResult | undefined; + result: V8Coverage[number]; +}>; + +export {}; diff --git a/node_modules/@jest/test-result/build/types.d.ts b/node_modules/@jest/test-result/build/types.d.ts deleted file mode 100644 index c06f477eb..000000000 --- a/node_modules/@jest/test-result/build/types.d.ts +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { V8Coverage } from 'collect-v8-coverage'; -import type { CoverageMap, CoverageMapData } from 'istanbul-lib-coverage'; -import type { ConsoleBuffer } from '@jest/console'; -import type { Config, TestResult, TransformTypes } from '@jest/types'; -import type { FS as HasteFS, ModuleMap } from 'jest-haste-map'; -import type Resolver from 'jest-resolve'; -export interface RuntimeTransformResult extends TransformTypes.TransformResult { - wrapperLength: number; -} -export declare type V8CoverageResult = Array<{ - codeTransformResult: RuntimeTransformResult | undefined; - result: V8Coverage[number]; -}>; -export declare type SerializableError = TestResult.SerializableError; -export declare type FailedAssertion = { - matcherName?: string; - message?: string; - actual?: unknown; - pass?: boolean; - passed?: boolean; - expected?: unknown; - isNot?: boolean; - stack?: string; - error?: unknown; -}; -export declare type AssertionLocation = { - fullName: string; - path: string; -}; -export declare type Status = AssertionResult['status']; -export declare type Bytes = number; -export declare type Milliseconds = TestResult.Milliseconds; -export declare type AssertionResult = TestResult.AssertionResult; -export declare type FormattedAssertionResult = Pick & { - failureMessages: AssertionResult['failureMessages'] | null; -}; -export declare type AggregatedResultWithoutCoverage = { - numFailedTests: number; - numFailedTestSuites: number; - numPassedTests: number; - numPassedTestSuites: number; - numPendingTests: number; - numTodoTests: number; - numPendingTestSuites: number; - numRuntimeErrorTestSuites: number; - numTotalTests: number; - numTotalTestSuites: number; - openHandles: Array; - snapshot: SnapshotSummary; - startTime: number; - success: boolean; - testResults: Array; - wasInterrupted: boolean; -}; -export declare type AggregatedResult = AggregatedResultWithoutCoverage & { - coverageMap?: CoverageMap | null; -}; -export declare type TestResultsProcessor = (results: AggregatedResult) => AggregatedResult; -export declare type Suite = { - title: string; - suites: Array; - tests: Array; -}; -export declare type TestCaseResult = AssertionResult; -export declare type TestResult = { - console?: ConsoleBuffer; - coverage?: CoverageMapData; - displayName?: Config.DisplayName; - failureMessage?: string | null; - leaks: boolean; - memoryUsage?: Bytes; - numFailingTests: number; - numPassingTests: number; - numPendingTests: number; - numTodoTests: number; - openHandles: Array; - perfStats: { - end: Milliseconds; - runtime: Milliseconds; - slow: boolean; - start: Milliseconds; - }; - skipped: boolean; - snapshot: { - added: number; - fileDeleted: boolean; - matched: number; - unchecked: number; - uncheckedKeys: Array; - unmatched: number; - updated: number; - }; - testExecError?: SerializableError; - testFilePath: Config.Path; - testResults: Array; - v8Coverage?: V8CoverageResult; -}; -export declare type FormattedTestResult = { - message: string; - name: string; - summary: string; - status: 'failed' | 'passed'; - startTime: number; - endTime: number; - coverage: unknown; - assertionResults: Array; -}; -export declare type FormattedTestResults = { - coverageMap?: CoverageMap | null | undefined; - numFailedTests: number; - numFailedTestSuites: number; - numPassedTests: number; - numPassedTestSuites: number; - numPendingTests: number; - numPendingTestSuites: number; - numRuntimeErrorTestSuites: number; - numTotalTests: number; - numTotalTestSuites: number; - snapshot: SnapshotSummary; - startTime: number; - success: boolean; - testResults: Array; - wasInterrupted: boolean; -}; -export declare type CodeCoverageReporter = unknown; -export declare type CodeCoverageFormatter = (coverage: CoverageMapData | null | undefined, reporter: CodeCoverageReporter) => Record | null | undefined; -export declare type UncheckedSnapshot = { - filePath: string; - keys: Array; -}; -export declare type SnapshotSummary = { - added: number; - didUpdate: boolean; - failure: boolean; - filesAdded: number; - filesRemoved: number; - filesRemovedList: Array; - filesUnmatched: number; - filesUpdated: number; - matched: number; - total: number; - unchecked: number; - uncheckedKeysByFile: Array; - unmatched: number; - updated: number; -}; -export declare type Test = { - context: Context; - duration?: number; - path: Config.Path; -}; -declare type Context = { - config: Config.ProjectConfig; - hasteFS: HasteFS; - moduleMap: ModuleMap; - resolver: Resolver; -}; -export declare type TestEvents = { - 'test-file-start': [Test]; - 'test-file-success': [Test, TestResult]; - 'test-file-failure': [Test, SerializableError]; - 'test-case-result': [Config.Path, AssertionResult]; -}; -export declare type TestFileEvent = (eventName: T, args: TestEvents[T]) => unknown; -export {}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/test-result/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/@jest/test-result/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/test-result/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/@jest/test-result/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/test-result/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/@jest/test-result/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/test-result/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/@jest/test-result/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/test-result/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/@jest/test-result/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/test-result/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/@jest/test-result/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/@jest/test-result/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/@jest/test-result/node_modules/@jest/types/package.json b/node_modules/@jest/test-result/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/@jest/test-result/node_modules/@jest/types/package.json +++ b/node_modules/@jest/test-result/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/test-result/node_modules/@types/yargs/README.md b/node_modules/@jest/test-result/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/@jest/test-result/node_modules/@types/yargs/README.md +++ b/node_modules/@jest/test-result/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/@jest/test-result/node_modules/@types/yargs/helpers.d.mts b/node_modules/@jest/test-result/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/@jest/test-result/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.mts b/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.ts b/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.ts +++ b/node_modules/@jest/test-result/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/@jest/test-result/node_modules/@types/yargs/package.json b/node_modules/@jest/test-result/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/@jest/test-result/node_modules/@types/yargs/package.json +++ b/node_modules/@jest/test-result/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/@jest/test-result/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/@jest/test-result/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/@jest/test-result/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/@jest/test-result/package.json b/node_modules/@jest/test-result/package.json index bf36bbfe5..b2ddd19de 100644 --- a/node_modules/@jest/test-result/package.json +++ b/node_modules/@jest/test-result/package.json @@ -1,6 +1,6 @@ { "name": "@jest/test-result", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,16 +17,16 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/console": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/console": "^28.0.1", + "@jest/types": "^28.0.1", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/transform/build/ScriptTransformer.d.ts b/node_modules/@jest/transform/build/ScriptTransformer.d.ts deleted file mode 100644 index a36c7c72d..000000000 --- a/node_modules/@jest/transform/build/ScriptTransformer.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -import type { Options, ReducedTransformOptions, RequireAndTranspileModuleOptions, StringMap, TransformResult } from './types'; -declare class ScriptTransformer { - private readonly _config; - private readonly _cacheFS; - private readonly _cache; - private readonly _transformCache; - private _transformsAreLoaded; - constructor(_config: Config.ProjectConfig, _cacheFS: StringMap); - private _buildCacheKeyFromFileInfo; - private _getCacheKey; - private _getCacheKeyAsync; - private _createFolderFromCacheKey; - private _getFileCachePath; - private _getFileCachePathAsync; - private _getTransformPath; - loadTransformers(): Promise; - private _getTransformer; - private _instrumentFile; - private _buildTransformResult; - transformSource(filepath: Config.Path, content: string, options: ReducedTransformOptions): TransformResult; - transformSourceAsync(filepath: Config.Path, content: string, options: ReducedTransformOptions): Promise; - private _transformAndBuildScriptAsync; - private _transformAndBuildScript; - transformAsync(filename: Config.Path, options: Options, fileSource?: string): Promise; - transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult; - transformJson(filename: Config.Path, options: Options, fileSource: string): string; - requireAndTranspileModule(moduleName: string, callback?: (module: ModuleType) => void | Promise, options?: RequireAndTranspileModuleOptions): Promise; - shouldTransform(filename: Config.Path): boolean; -} -export declare function createTranspilingRequire(config: Config.ProjectConfig): Promise<((resolverPath: string, applyInteropRequireDefault?: boolean) => Promise)>; -export declare type TransformerType = ScriptTransformer; -export declare function createScriptTransformer(config: Config.ProjectConfig, cacheFS?: StringMap): Promise; -export {}; diff --git a/node_modules/@jest/transform/build/ScriptTransformer.js b/node_modules/@jest/transform/build/ScriptTransformer.js index edc7f2cb7..cf00d4937 100644 --- a/node_modules/@jest/transform/build/ScriptTransformer.js +++ b/node_modules/@jest/transform/build/ScriptTransformer.js @@ -180,20 +180,13 @@ function _interopRequireWildcard(obj, nodeInterop) { return newObj; } -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} - +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// @ts-expect-error: should just be `require.resolve`, but the tests mess that up // Use `require` to avoid TS rootDir const {version: VERSION} = require('../package.json'); @@ -210,16 +203,18 @@ async function waitForPromiseWithCleanup(promise, cleanup) { } finally { cleanup(); } +} // type predicate + +function isTransformerFactory(t) { + return typeof t.createTransformer === 'function'; } class ScriptTransformer { - constructor(_config, _cacheFS) { - _defineProperty(this, '_cache', void 0); - - _defineProperty(this, '_transformCache', new Map()); - - _defineProperty(this, '_transformsAreLoaded', false); + _cache; + _transformCache = new Map(); + _transformsAreLoaded = false; + constructor(_config, _cacheFS) { this._config = _config; this._cacheFS = _cacheFS; const configString = (0, _fastJsonStableStringify().default)(this._config); @@ -245,19 +240,21 @@ class ScriptTransformer { transformerCacheKey ) { if (transformerCacheKey) { - return (0, _crypto().createHash)('md5') + return (0, _crypto().createHash)('sha256') .update(transformerCacheKey) .update(CACHE_VERSION) - .digest('hex'); + .digest('hex') + .substring(0, 32); } - return (0, _crypto().createHash)('md5') + return (0, _crypto().createHash)('sha256') .update(fileData) .update(transformOptions.configString) .update(transformOptions.instrument ? 'instrument' : '') .update(filename) .update(CACHE_VERSION) - .digest('hex'); + .digest('hex') + .substring(0, 32); } _getCacheKey(fileData, filename, options) { @@ -332,7 +329,7 @@ class ScriptTransformer { const baseCacheDir = HasteMapClass.getCacheFilePath( this._config.cacheDirectory, - 'jest-transform-cache-' + this._config.name, + `jest-transform-cache-${this._config.id}`, VERSION ); // Create sub folders based on the cacheKey to avoid creating one // directory with many files. @@ -342,7 +339,7 @@ class ScriptTransformer { .basename(filename, path().extname(filename)) .replace(/\W/g, ''); const cachePath = (0, _slash().default)( - path().join(cacheDir, cacheFilenamePrefix + '_' + cacheKey) + path().join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`) ); (0, _jestUtil().createDirectory)(cacheDir); return cachePath; @@ -391,7 +388,7 @@ class ScriptTransformer { ); } - if (typeof transformer.createTransformer === 'function') { + if (isTransformerFactory(transformer)) { transformer = transformer.createTransformer(transformerConfig); } @@ -501,9 +498,7 @@ class ScriptTransformer { }; if (transformer && shouldCallTransform) { - if (typeof processed === 'string') { - transformed.code = processed; - } else if (processed != null && typeof processed.code === 'string') { + if (processed != null && typeof processed.code === 'string') { transformed = processed; } else { throw new Error( @@ -594,7 +589,7 @@ class ScriptTransformer { const cacheFilePath = this._getFileCachePath(filename, content, options); - const sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache) + const sourceMapPath = `${cacheFilePath}.map`; // Ignore cache if `config.cache` is set (--no-cache) const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; @@ -646,7 +641,7 @@ class ScriptTransformer { content, options ); - const sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache) + const sourceMapPath = `${cacheFilePath}.map`; // Ignore cache if `config.cache` is set (--no-cache) const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; @@ -875,7 +870,10 @@ class ScriptTransformer { } }, { - exts: this._config.moduleFileExtensions.map(ext => `.${ext}`), + // Exclude `mjs` extension when addHook because pirates don't support hijack es module + exts: this._config.moduleFileExtensions + .filter(ext => ext !== 'mjs') + .map(ext => `.${ext}`), ignoreNodeModules: false, matcher: filename => { if (transforming) { @@ -967,8 +965,11 @@ const stripShebang = content => { */ function writeCodeCacheFile(cachePath, code) { - const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); - writeCacheFile(cachePath, checksum + '\n' + code); + const checksum = (0, _crypto().createHash)('sha256') + .update(code) + .digest('hex') + .substring(0, 32); + writeCacheFile(cachePath, `${checksum}\n${code}`); } /** * Read counterpart of `writeCodeCacheFile`. We verify that the content of the @@ -985,7 +986,10 @@ function readCodeCacheFile(cachePath) { } const code = content.substring(33); - const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); + const checksum = (0, _crypto().createHash)('sha256') + .update(code) + .digest('hex') + .substring(0, 32); if (checksum === content.substring(0, 32)) { return code; @@ -1011,11 +1015,7 @@ const writeCacheFile = (cachePath, fileData) => { return; } - e.message = - 'jest: failed to cache transform results in: ' + - cachePath + - '\nFailure message: ' + - e.message; + e.message = `jest: failed to cache transform results in: ${cachePath}\nFailure message: ${e.message}`; removeFile(cachePath); throw e; } @@ -1042,11 +1042,7 @@ const readCacheFile = cachePath => { try { fileData = fs().readFileSync(cachePath, 'utf8'); } catch (e) { - e.message = - 'jest: failed to read cache file: ' + - cachePath + - '\nFailure message: ' + - e.message; + e.message = `jest: failed to read cache file: ${cachePath}\nFailure message: ${e.message}`; removeFile(cachePath); throw e; } @@ -1062,7 +1058,7 @@ const readCacheFile = cachePath => { const getScriptCacheKey = (filename, instrument) => { const mtime = fs().statSync(filename).mtime; - return filename + '_' + mtime.getTime() + (instrument ? '_instrumented' : ''); + return `${filename}_${mtime.getTime()}${instrument ? '_instrumented' : ''}`; }; const calcIgnorePatternRegExp = config => { diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts deleted file mode 100644 index 7847dc7e9..000000000 --- a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -interface ErrorWithCodeFrame extends Error { - codeFrame?: string; -} -export default function handlePotentialSyntaxError(e: ErrorWithCodeFrame): ErrorWithCodeFrame; -export declare function enhanceUnexpectedTokenMessage(e: Error): Error; -export {}; diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js index d2235f56b..ebafcdd9f 100644 --- a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js +++ b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js @@ -30,7 +30,7 @@ const DOT = ' \u2022 '; function handlePotentialSyntaxError(e) { if (e.codeFrame) { - e.stack = e.message + '\n' + e.codeFrame; + e.stack = `${e.message}\n${e.codeFrame}`; } if ( @@ -45,8 +45,9 @@ function handlePotentialSyntaxError(e) { } function enhanceUnexpectedTokenMessage(e) { - e.stack = - `${_chalk().default.bold.red('Jest encountered an unexpected token')} + e.stack = `${_chalk().default.bold.red( + 'Jest encountered an unexpected token' + )} Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. @@ -56,20 +57,20 @@ By default "node_modules" folder is ignored by transformers. Here's what you can do: ${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline( - 'https://jestjs.io/docs/ecmascript-modules' - )} for how to enable it. + 'https://jestjs.io/docs/ecmascript-modules' + )} for how to enable it. ${DOT}If you are trying to use TypeScript, see ${_chalk().default.underline( - 'https://jestjs.io/docs/getting-started#using-typescript' - )} + 'https://jestjs.io/docs/getting-started#using-typescript' + )} ${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold( - '"transformIgnorePatterns"' - )} in your config. + '"transformIgnorePatterns"' + )} in your config. ${DOT}If you need a custom transformation specify a ${_chalk().default.bold( - '"transform"' - )} option in your config. + '"transform"' + )} option in your config. ${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold( - '"moduleNameMapper"' - )} config option. + '"moduleNameMapper"' + )} config option. You'll find more details and examples of these config options in the docs: ${_chalk().default.cyan('https://jestjs.io/docs/configuration')} @@ -78,6 +79,6 @@ ${_chalk().default.cyan('https://jestjs.io/docs/code-transformation')} ${_chalk().default.bold.red('Details:')} -` + e.stack; +${e.stack}`; return e; } diff --git a/node_modules/@jest/transform/build/index.d.ts b/node_modules/@jest/transform/build/index.d.ts index 09a5081c1..a539b331b 100644 --- a/node_modules/@jest/transform/build/index.d.ts +++ b/node_modules/@jest/transform/build/index.d.ts @@ -4,8 +4,228 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { createScriptTransformer, createTranspilingRequire, } from './ScriptTransformer'; -export type { TransformerType as ScriptTransformer } from './ScriptTransformer'; -export { default as shouldInstrument } from './shouldInstrument'; -export type { CallerTransformOptions, Transformer, SyncTransformer, AsyncTransformer, ShouldInstrumentOptions, Options as TransformationOptions, TransformOptions, TransformResult, TransformedSource, } from './types'; -export { default as handlePotentialSyntaxError } from './enhanceUnexpectedTokenMessage'; +import type {Config} from '@jest/types'; +import type {EncodedSourceMap} from '@jridgewell/trace-mapping'; +import type {TransformTypes} from '@jest/types'; + +export declare interface AsyncTransformer { + /** + * Indicates if the transformer is capable of instrumenting the code for code coverage. + * + * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. + * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. + */ + canInstrument?: boolean; + getCacheKey?: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => string; + getCacheKeyAsync?: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => Promise; + process?: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => TransformedSource; + processAsync: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => Promise; +} + +export declare interface CallerTransformOptions { + supportsDynamicImport: boolean; + supportsExportNamespaceFrom: boolean; + supportsStaticESM: boolean; + supportsTopLevelAwait: boolean; +} + +export declare function createScriptTransformer( + config: Config.ProjectConfig, + cacheFS?: StringMap, +): Promise; + +export declare function createTranspilingRequire( + config: Config.ProjectConfig, +): Promise< + ( + resolverPath: string, + applyInteropRequireDefault?: boolean, + ) => Promise +>; + +declare interface ErrorWithCodeFrame extends Error { + codeFrame?: string; +} + +declare interface FixedRawSourceMap extends Omit { + version: number; +} + +export declare function handlePotentialSyntaxError( + e: ErrorWithCodeFrame, +): ErrorWithCodeFrame; + +declare interface ReducedTransformOptions extends CallerTransformOptions { + instrument: boolean; +} + +declare interface RequireAndTranspileModuleOptions + extends ReducedTransformOptions { + applyInteropRequireDefault: boolean; +} + +export declare type ScriptTransformer = ScriptTransformer_2; + +declare class ScriptTransformer_2 { + private readonly _config; + private readonly _cacheFS; + private readonly _cache; + private readonly _transformCache; + private _transformsAreLoaded; + constructor(_config: Config.ProjectConfig, _cacheFS: StringMap); + private _buildCacheKeyFromFileInfo; + private _getCacheKey; + private _getCacheKeyAsync; + private _createFolderFromCacheKey; + private _getFileCachePath; + private _getFileCachePathAsync; + private _getTransformPath; + loadTransformers(): Promise; + private _getTransformer; + private _instrumentFile; + private _buildTransformResult; + transformSource( + filepath: string, + content: string, + options: ReducedTransformOptions, + ): TransformResult; + transformSourceAsync( + filepath: string, + content: string, + options: ReducedTransformOptions, + ): Promise; + private _transformAndBuildScriptAsync; + private _transformAndBuildScript; + transformAsync( + filename: string, + options: TransformationOptions, + fileSource?: string, + ): Promise; + transform( + filename: string, + options: TransformationOptions, + fileSource?: string, + ): TransformResult; + transformJson( + filename: string, + options: TransformationOptions, + fileSource: string, + ): string; + requireAndTranspileModule( + moduleName: string, + callback?: (module: ModuleType) => void | Promise, + options?: RequireAndTranspileModuleOptions, + ): Promise; + shouldTransform(filename: string): boolean; +} + +export declare function shouldInstrument( + filename: string, + options: ShouldInstrumentOptions, + config: Config.ProjectConfig, +): boolean; + +export declare interface ShouldInstrumentOptions + extends Pick< + Config.GlobalConfig, + | 'collectCoverage' + | 'collectCoverageFrom' + | 'collectCoverageOnlyFrom' + | 'coverageProvider' + > { + changedFiles?: Set; + sourcesRelatedToTestsInChangedFiles?: Set; +} + +declare type StringMap = Map; + +export declare interface SyncTransformer { + /** + * Indicates if the transformer is capable of instrumenting the code for code coverage. + * + * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. + * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. + */ + canInstrument?: boolean; + getCacheKey?: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => string; + getCacheKeyAsync?: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => Promise; + process: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => TransformedSource; + processAsync?: ( + sourceText: string, + sourcePath: string, + options: TransformOptions, + ) => Promise; +} + +export declare interface TransformationOptions + extends ShouldInstrumentOptions, + CallerTransformOptions { + isInternalModule?: boolean; +} + +export declare type TransformedSource = { + code: string; + map?: FixedRawSourceMap | string | null; +}; + +/** + * We have both sync (`process`) and async (`processAsync`) code transformation, which both can be provided. + * `require` will always use `process`, and `import` will use `processAsync` if it exists, otherwise fall back to `process`. + * Meaning, if you use `import` exclusively you do not need `process`, but in most cases supplying both makes sense: + * Jest transpiles on demand rather than ahead of time, so the sync one needs to exist. + * + * For more info on the sync vs async model, see https://jestjs.io/docs/code-transformation#writing-custom-transformers + */ +declare type Transformer_2 = + | SyncTransformer + | AsyncTransformer; +export {Transformer_2 as Transformer}; + +export declare type TransformerCreator< + X extends Transformer_2, + TransformerConfig = unknown, +> = (transformerConfig?: TransformerConfig) => X; + +export declare interface TransformOptions + extends ReducedTransformOptions { + /** Cached file system which is used by `jest-runtime` to improve performance. */ + cacheFS: StringMap; + /** Jest configuration of currently running project. */ + config: Config.ProjectConfig; + /** Stringified version of the `config` - useful in cache busting. */ + configString: string; + /** Transformer configuration passed through `transform` option by the user. */ + transformerConfig: TransformerConfig; +} + +export declare type TransformResult = TransformTypes.TransformResult; + +export {}; diff --git a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.d.ts b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.d.ts deleted file mode 100644 index 88c8f8532..000000000 --- a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare const makeInvalidReturnValueError: () => string; -export declare const makeInvalidSourceMapWarning: (filename: string, transformPath: string) => string; -export declare const makeInvalidSyncTransformerError: (transformPath: string) => string; -export declare const makeInvalidTransformerError: (transformPath: string) => string; diff --git a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js index a88290d89..94c0a0c41 100644 --- a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js +++ b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js @@ -49,10 +49,10 @@ const DOCUMENTATION_NOTE = ` ${_chalk().default.bold( const makeInvalidReturnValueError = () => _chalk().default.red( [ - _chalk().default.bold(BULLET + 'Invalid return value:'), - " Code transformer's `process` function must return a string or an object", - ' with `code` key containing a string. If `processAsync` function is implemented,', - ' it must return a Promise resolving to one of these values.', + _chalk().default.bold(`${BULLET}Invalid return value:`), + " Code transformer's `process` method must return an object containing `code` key ", + ' with processed string. If `processAsync` method is implemented it must return ', + ' a Promise resolving to an object containing `code` key with processed string.', '' ].join('\n') + DOCUMENTATION_NOTE ); @@ -62,7 +62,7 @@ exports.makeInvalidReturnValueError = makeInvalidReturnValueError; const makeInvalidSourceMapWarning = (filename, transformPath) => _chalk().default.yellow( [ - _chalk().default.bold(BULLET + 'Invalid source map:'), + _chalk().default.bold(`${BULLET}Invalid source map:`), ` The source map for "${(0, _slash().default)( filename )}" returned by "${(0, _slash().default)(transformPath)}" is invalid.`, @@ -75,7 +75,7 @@ exports.makeInvalidSourceMapWarning = makeInvalidSourceMapWarning; const makeInvalidSyncTransformerError = transformPath => _chalk().default.red( [ - _chalk().default.bold(BULLET + 'Invalid synchronous transformer module:'), + _chalk().default.bold(`${BULLET}Invalid synchronous transformer module:`), ` "${(0, _slash().default)( transformPath )}" specified in the "transform" object of Jest configuration`, @@ -89,7 +89,7 @@ exports.makeInvalidSyncTransformerError = makeInvalidSyncTransformerError; const makeInvalidTransformerError = transformPath => _chalk().default.red( [ - _chalk().default.bold(BULLET + 'Invalid transformer module:'), + _chalk().default.bold(`${BULLET}Invalid transformer module:`), ` "${(0, _slash().default)( transformPath )}" specified in the "transform" object of Jest configuration`, diff --git a/node_modules/@jest/transform/build/shouldInstrument.d.ts b/node_modules/@jest/transform/build/shouldInstrument.d.ts deleted file mode 100644 index 2b7b617bc..000000000 --- a/node_modules/@jest/transform/build/shouldInstrument.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -import type { ShouldInstrumentOptions } from './types'; -export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean; diff --git a/node_modules/@jest/transform/build/shouldInstrument.js b/node_modules/@jest/transform/build/shouldInstrument.js index 292af31bc..01bc0e7dd 100644 --- a/node_modules/@jest/transform/build/shouldInstrument.js +++ b/node_modules/@jest/transform/build/shouldInstrument.js @@ -99,7 +99,7 @@ function _interopRequireWildcard(obj, nodeInterop) { */ const MOCKS_PATTERN = new RegExp( (0, _jestRegexUtil().escapePathForRegex)( - path().sep + '__mocks__' + path().sep + `${path().sep}__mocks__${path().sep}` ) ); const cachedRegexes = new Map(); diff --git a/node_modules/@jest/transform/build/types.d.ts b/node_modules/@jest/transform/build/types.d.ts deleted file mode 100644 index 038bf9d23..000000000 --- a/node_modules/@jest/transform/build/types.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { RawSourceMap } from 'source-map'; -import type { Config, TransformTypes } from '@jest/types'; -export interface ShouldInstrumentOptions extends Pick { - changedFiles?: Set; - sourcesRelatedToTestsInChangedFiles?: Set; -} -export interface Options extends ShouldInstrumentOptions, CallerTransformOptions { - isInternalModule?: boolean; -} -interface FixedRawSourceMap extends Omit { - version: number; -} -export declare type TransformedSource = { - code: string; - map?: FixedRawSourceMap | string | null; -} | string; -export declare type TransformResult = TransformTypes.TransformResult; -export interface CallerTransformOptions { - supportsDynamicImport: boolean; - supportsExportNamespaceFrom: boolean; - supportsStaticESM: boolean; - supportsTopLevelAwait: boolean; -} -export interface ReducedTransformOptions extends CallerTransformOptions { - instrument: boolean; -} -export interface RequireAndTranspileModuleOptions extends ReducedTransformOptions { - applyInteropRequireDefault: boolean; -} -export declare type StringMap = Map; -export interface TransformOptions extends ReducedTransformOptions { - /** a cached file system which is used in jest-runtime - useful to improve performance */ - cacheFS: StringMap; - config: Config.ProjectConfig; - /** A stringified version of the configuration - useful in cache busting */ - configString: string; - /** the options passed through Jest's config by the user */ - transformerConfig: OptionType; -} -export interface SyncTransformer { - /** - * Indicates if the transformer is capable of instrumenting the code for code coverage. - * - * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. - * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. - */ - canInstrument?: boolean; - createTransformer?: (options?: OptionType) => SyncTransformer; - getCacheKey?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => string; - getCacheKeyAsync?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => Promise; - process: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => TransformedSource; - processAsync?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => Promise; -} -export interface AsyncTransformer { - /** - * Indicates if the transformer is capable of instrumenting the code for code coverage. - * - * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. - * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. - */ - canInstrument?: boolean; - createTransformer?: (options?: OptionType) => AsyncTransformer; - getCacheKey?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => string; - getCacheKeyAsync?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => Promise; - process?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => TransformedSource; - processAsync: (sourceText: string, sourcePath: Config.Path, options: TransformOptions) => Promise; -} -export declare type Transformer = SyncTransformer | AsyncTransformer; -export {}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/transform/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/@jest/transform/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/transform/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/@jest/transform/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/transform/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/@jest/transform/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/transform/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/@jest/transform/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/transform/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/@jest/transform/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/transform/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/@jest/transform/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/@jest/transform/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/@jest/transform/node_modules/@jest/types/package.json b/node_modules/@jest/transform/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/@jest/transform/node_modules/@jest/types/package.json +++ b/node_modules/@jest/transform/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/transform/node_modules/@types/yargs/README.md b/node_modules/@jest/transform/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/@jest/transform/node_modules/@types/yargs/README.md +++ b/node_modules/@jest/transform/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/@jest/transform/node_modules/@types/yargs/helpers.d.mts b/node_modules/@jest/transform/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/@jest/transform/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/@jest/transform/node_modules/@types/yargs/index.d.mts b/node_modules/@jest/transform/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/@jest/transform/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/@jest/transform/node_modules/@types/yargs/index.d.ts b/node_modules/@jest/transform/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/@jest/transform/node_modules/@types/yargs/index.d.ts +++ b/node_modules/@jest/transform/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/@jest/transform/node_modules/@types/yargs/package.json b/node_modules/@jest/transform/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/@jest/transform/node_modules/@types/yargs/package.json +++ b/node_modules/@jest/transform/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/@jest/transform/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/@jest/transform/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/@jest/transform/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/CHANGELOG.md b/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/CHANGELOG.md deleted file mode 100644 index aa57d4f1a..000000000 --- a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/CHANGELOG.md +++ /dev/null @@ -1,320 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [6.1.1](https://www.github.com/istanbuljs/babel-plugin-istanbul/compare/v6.1.0...v6.1.1) (2021-10-16) - - -### Bug Fixes - -* **build:** first automated publication ([9a1b893](https://www.github.com/istanbuljs/babel-plugin-istanbul/commit/9a1b89342565d1127a011e31262520b057120531)) - -## [6.1.0](https://www.github.com/istanbuljs/babel-plugin-istanbul/compare/v6.0.0...v6.1.0) (2021-10-16) - - -### Features - -* **instrumenter:** instrumenter with fixes for branchMap instrumentation ([#265](https://www.github.com/istanbuljs/babel-plugin-istanbul/issues/265)) ([1e9ec62](https://www.github.com/istanbuljs/babel-plugin-istanbul/commit/1e9ec62b50c9d2224e7bb0ccb071fd10b80e018f)) - -## [6.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.2.0...v6.0.0) (2019-12-20) - - -### ⚠ BREAKING CHANGES - -* Drop node.js 6 (#226) - -### Features - -* Add support for instrumenter options ([#227](https://github.com/istanbuljs/babel-plugin-istanbul/issues/227)) ([fe08f5b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/fe08f5b8282136c7ed9375fa32148586bd6a7e28)), closes [#208](https://github.com/istanbuljs/babel-plugin-istanbul/issues/208) [#212](https://github.com/istanbuljs/babel-plugin-istanbul/issues/212) -* Drop node.js 6 ([#226](https://github.com/istanbuljs/babel-plugin-istanbul/issues/226)) ([93db21a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/93db21aa2bbdbb06fb784f52c24a7847fad6be92)), closes [#209](https://github.com/istanbuljs/babel-plugin-istanbul/issues/209) - -## [5.2.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.4...v5.2.0) (2019-07-18) - - -### Bug Fixes - -* Print explicit error if use with babel 6 is attempted ([#207](https://github.com/istanbuljs/babel-plugin-istanbul/issues/207)) ([a12cf16](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a12cf16)) - - -### Features - -* Support turning off node_modules default exclude via flag ([#172](https://github.com/istanbuljs/babel-plugin-istanbul/issues/172)) ([a314f06](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a314f06)) - - - -## [5.1.4](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.3...v5.1.4) (2019-04-25) - - - -## [5.1.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.2...v5.1.3) (2019-04-23) - - -### Bug Fixes - -* Revert [#192](https://github.com/istanbuljs/babel-plugin-istanbul/issues/192) ([201a933](https://github.com/istanbuljs/babel-plugin-istanbul/commit/201a933)) due to regression detailed at [#201](https://github.com/istanbuljs/babel-plugin-istanbul/issues/201) - - - -## [5.1.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.1...v5.1.2) (2019-04-10) - - -### Bug Fixes - -* Ensure correct scope references after traversal ([#192](https://github.com/istanbuljs/babel-plugin-istanbul/issues/192)) ([201a933](https://github.com/istanbuljs/babel-plugin-istanbul/commit/201a933)) - - - - -## [5.1.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.0...v5.1.1) (2019-01-11) - - -### Bug Fixes - -* respect changes of cwd in options ([#171](https://github.com/istanbuljs/babel-plugin-istanbul/issues/171)) ([adec723](https://github.com/istanbuljs/babel-plugin-istanbul/commit/adec723)) - - - - -# [5.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.0.1...v5.1.0) (2018-09-07) - - -### Features - -* Bump dependencies. ([b509649](https://github.com/istanbuljs/babel-plugin-istanbul/commit/b509649)) - - - - -## [5.0.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.0.0...v5.0.1) (2018-07-24) - - - - -# [5.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.6...v5.0.0) (2018-06-27) - - -### Features - -* upgrade to babel 7 and newest istanbul libraries ([#158](https://github.com/istanbuljs/babel-plugin-istanbul/issues/158)) ([a9e1564](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a9e1564)) - - -### BREAKING CHANGES - -* Drop node 4 support, upgrade to babel 7, stop shipping @babel/plugin-syntax-object-rest-spread - - - - -## 4.1.6 (2018-03-09) - -* chore: explicit update of istanbul dependencies (#149) ([77b6eb7](https://github.com/istanbuljs/babel-plugin-istanbul/commit/77b6eb7)), closes [#149](https://github.com/istanbuljs/babel-plugin-istanbul/issues/149) -* chore(package): update coveralls to version 3.0.0 (#133) ([7045a03](https://github.com/istanbuljs/babel-plugin-istanbul/commit/7045a03)), closes [#133](https://github.com/istanbuljs/babel-plugin-istanbul/issues/133) -* chore(package): update mocha to version 4.0.0 (#134) ([38176ba](https://github.com/istanbuljs/babel-plugin-istanbul/commit/38176ba)), closes [#134](https://github.com/istanbuljs/babel-plugin-istanbul/issues/134) -* fix: babel-preset-es2015 => babel-preset-env (#138) ([18fe954](https://github.com/istanbuljs/babel-plugin-istanbul/commit/18fe954)), closes [#138](https://github.com/istanbuljs/babel-plugin-istanbul/issues/138) -* fix: include object-spread-syntax plugin (#141) ([428a952](https://github.com/istanbuljs/babel-plugin-istanbul/commit/428a952)), closes [#141](https://github.com/istanbuljs/babel-plugin-istanbul/issues/141) - - - - -## [4.1.5](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.2...v4.1.5) (2017-08-23) - - - - -## [4.1.4](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.3...v4.1.4) (2017-05-27) - - - - -## [4.1.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.1...v4.1.3) (2017-04-29) - - - - -## [4.1.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.1...v4.1.2) (2017-03-27) - - - - -## [4.1.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.0...v4.1.1) (2017-03-22) - - -### Bug Fixes - -* explicit upgrade to patched version of istanbul-lib-instrument ([db8ecbe](https://github.com/istanbuljs/babel-plugin-istanbul/commit/db8ecbe)) - - - - -# [4.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.0.0...v4.1.0) (2017-03-21) - - -### Features - -* add includeUntested option to expose coverage of all instrumented files ([#80](https://github.com/istanbuljs/babel-plugin-istanbul/issues/80)) ([b078bbd](https://github.com/istanbuljs/babel-plugin-istanbul/commit/b078bbd)) - - - - -# [4.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.1.2...v4.0.0) (2017-02-07) - - -### Bug Fixes - -* load configuration from process.env.NYC_CONFIG if present ([#93](https://github.com/istanbuljs/babel-plugin-istanbul/issues/93)) ([e902924](https://github.com/istanbuljs/babel-plugin-istanbul/commit/e902924)) - - -### Features - -* drop Node 0.10 and 0.12 support, upgrade dependencies to reflect this ([#88](https://github.com/istanbuljs/babel-plugin-istanbul/issues/88)) ([594c03a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/594c03a)) -* we can now use the language feature Object.assign ([#92](https://github.com/istanbuljs/babel-plugin-istanbul/issues/92)) ([f77db2a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/f77db2a)) - - -### BREAKING CHANGES - -* I've updated dependencies and dropped Node 0.10 and Node 0.12 support. - - - - -## [3.1.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.1.1...v3.1.2) (2017-01-04) - - -### Bug Fixes - -* address regression related to export const foo = () => {} ([#79](https://github.com/istanbuljs/babel-plugin-istanbul/issues/79)) ([f870a8f](https://github.com/istanbuljs/babel-plugin-istanbul/commit/f870a8f)) - - - - -## [3.1.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.1.0...v3.1.1) (2017-01-02) - - - - -# [3.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.0.0...v3.1.0) (2016-12-27) - - -### Bug Fixes - -* upgrade a bunch of core dependencies ([#77](https://github.com/istanbuljs/babel-plugin-istanbul/issues/77)) ([e764330](https://github.com/istanbuljs/babel-plugin-istanbul/commit/e764330)) - - -### Features - -* accept source map input for the visitor ([#75](https://github.com/istanbuljs/babel-plugin-istanbul/issues/75)) ([437e90b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/437e90b)) - - - - -# [3.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.3...v3.0.0) (2016-11-14) - - -### Chores - -* **package:** update test-exclude to version 3.0.0 ([#68](https://github.com/istanbuljs/babel-plugin-istanbul/issues/68)) ([0396385](https://github.com/istanbuljs/babel-plugin-istanbul/commit/0396385)) - - -### BREAKING CHANGES - -* package: test-exclude now adds `**/node_modules/**` as exclude rule by default. - - - - -## [2.0.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.2...v2.0.3) (2016-10-17) - - -### Bug Fixes - -* force istanbul-lib-instrument with variable hoisting fix ([#64](https://github.com/istanbuljs/babel-plugin-istanbul/issues/64)) ([209a0cf](https://github.com/istanbuljs/babel-plugin-istanbul/commit/209a0cf)) -* switch deprecated lodash.assign for object-assign ([#58](https://github.com/istanbuljs/babel-plugin-istanbul/issues/58)) ([6e051fc](https://github.com/istanbuljs/babel-plugin-istanbul/commit/6e051fc)) - - - - -## [2.0.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.1...v2.0.2) (2016-09-08) - - -### Bug Fixes - -* take realpath of cwd, whether or not set in env ([#37](https://github.com/istanbuljs/babel-plugin-istanbul/issues/37)) ([6274d83](https://github.com/istanbuljs/babel-plugin-istanbul/commit/6274d83)) - - - - -## [2.0.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.0...v2.0.1) (2016-09-02) - - -### Bug Fixes - -* update istanbul-lib-instrument ([573e0d4](https://github.com/istanbuljs/babel-plugin-istanbul/commit/573e0d4)) - - - - -# [2.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.1.0...v2.0.0) (2016-08-14) - - -### Chores - -* upgrade to version of test-exclude with new exclude rules ([#35](https://github.com/istanbuljs/babel-plugin-istanbul/issues/35)) ([220ce2b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/220ce2b)) - - -### BREAKING CHANGES - -* see https://github.com/istanbuljs/test-exclude/blob/master/CHANGELOG.md#breaking-changes - - - - -# [1.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.3...v1.1.0) (2016-07-21) - - -### Bug Fixes - -* upgrade to istanbul-lib-instrument with faster babel-generator ([#18](https://github.com/istanbuljs/babel-plugin-istanbul/issues/18)) ([d33263c](https://github.com/istanbuljs/babel-plugin-istanbul/commit/d33263c)) - - -### Features - -* allow exclude/include options to be passed as Babel plugin config ([#16](https://github.com/istanbuljs/babel-plugin-istanbul/issues/16)) ([cf68421](https://github.com/istanbuljs/babel-plugin-istanbul/commit/cf68421)) - - - - -## [1.0.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.2...v1.0.3) (2016-07-09) - - -### Bug Fixes - -* keep using NYC_CWD if available ([#10](https://github.com/istanbuljs/babel-plugin-istanbul/issues/10)) ([db0352b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/db0352b)) - - - - -## [1.0.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.1...v1.0.2) (2016-07-03) - - -### Bug Fixes - -* take realpath of process.cwd(), fixes [#7](https://github.com/istanbuljs/babel-plugin-istanbul/issues/7) ([#8](https://github.com/istanbuljs/babel-plugin-istanbul/issues/8)) ([e8d3785](https://github.com/istanbuljs/babel-plugin-istanbul/commit/e8d3785)), closes [#7](https://github.com/istanbuljs/babel-plugin-istanbul/issues/7) [#8](https://github.com/istanbuljs/babel-plugin-istanbul/issues/8) - - - - -## [1.0.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.0...v1.0.1) (2016-06-30) - - -### Bug Fixes - -* upgrade to version of istanbul-lib-instrument that fixes some out of bounds issues ([#6](https://github.com/istanbuljs/babel-plugin-istanbul/issues/6)) ([a949065](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a949065)), closes [#6](https://github.com/istanbuljs/babel-plugin-istanbul/issues/6) - - - -# 1.0.0 (2016-06-26) - - -### Features - -* port functionality from __coverage__, get ready for first release ([#2](https://github.com/istanbuljs/babel-plugin-istanbul/issues/2)) ([2a8ee44](https://github.com/istanbuljs/babel-plugin-istanbul/commit/2a8ee44)) diff --git a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/LICENSE b/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/LICENSE deleted file mode 100644 index 22f21ab99..000000000 --- a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2016, Istanbul Code Coverage -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of babel-plugin-istanbul nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/README.md b/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/README.md deleted file mode 100644 index a027e9b78..000000000 --- a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# babel-plugin-istanbul - -[![Coverage Status](https://coveralls.io/repos/github/istanbuljs/babel-plugin-istanbul/badge.svg?branch=master)](https://coveralls.io/github/istanbuljs/babel-plugin-istanbul?branch=master) -[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) -[![community slack](http://devtoolscommunity.herokuapp.com/badge.svg)](http://devtoolscommunity.herokuapp.com) - -_Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_. - -A Babel plugin that instruments your code with Istanbul coverage. -It can instantly be used with [karma-coverage](https://github.com/karma-runner/karma-coverage) and mocha on Node.js (through [nyc](https://github.com/bcoe/nyc)). - -__Note:__ This plugin does not generate any report or save any data to any file; -it only adds instrumenting code to your JavaScript source code. -To integrate with testing tools, please see the [Integrations](#integrations) section. - -## Usage - -Install it: - -``` -npm install --save-dev babel-plugin-istanbul -``` - -Add it to `.babelrc` in test mode: - -```js -{ - "env": { - "test": { - "plugins": [ "istanbul" ] - } - } -} -``` - -Optionally, use [cross-env](https://www.npmjs.com/package/cross-env) to set -`NODE_ENV=test`: - -```json -{ - "scripts": { - "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.js" - } -} -``` - -## Integrations - -### karma - -It _just works_ with Karma. First, make sure that the code is already transpiled by Babel (either using `karma-babel-preprocessor`, `karma-webpack`, or `karma-browserify`). Then, simply set up [karma-coverage](https://github.com/karma-runner/karma-coverage) according to the docs, but __don’t add the `coverage` preprocessor.__ This plugin has already instrumented your code, and Karma should pick it up automatically. - -It has been tested with [bemusic/bemuse](https://codecov.io/github/bemusic/bemuse) project, which contains ~2400 statements. - -### mocha on node.js (through nyc) - -Configure Mocha to transpile JavaScript code using Babel, then you can run your tests with [`nyc`](https://github.com/bcoe/nyc), which will collect all the coverage report. - -babel-plugin-istanbul respects the `include`/`exclude` configuration options from nyc, -but you also need to __configure NYC not to instrument your code__ by adding these settings in your `package.json`: - -```js - "nyc": { - "sourceMap": false, - "instrument": false - }, -``` - -## Ignoring files - -You don't want to cover your test files as this will skew your coverage results. You can configure this by providing plugin options matching nyc's [`exclude`/`include` rules](https://github.com/bcoe/nyc#excluding-files): - -```json -{ - "env": { - "test": { - "plugins": [ - ["istanbul", { - "exclude": [ - "**/*.spec.js" - ] - }] - ] - } - } -} -``` - -If you don't provide options in your Babel config, the plugin will look for `exclude`/`include` config under an `"nyc"` key in `package.json`. - -You can also use [istanbul's ignore hints](https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes) to specify specific lines of code to skip instrumenting. - -## Source Maps - -By default, this plugin will pick up inline source maps and attach them to the instrumented code such that code coverage can be remapped back to the original source, even for multi-step build processes. This can be memory intensive. Set `useInlineSourceMaps` to prevent this behavior. - -```json -{ - "env": { - "test": { - "plugins": [ - ["istanbul", { - "useInlineSourceMaps": false - }] - ] - } - } -} -``` - -If you're instrumenting code programatically, you can pass a source map explicitly. -```js -import babelPluginIstanbul from 'babel-plugin-istanbul'; - -function instrument(sourceCode, sourceMap, fileName) { - return babel.transform(sourceCode, { - filename, - plugins: [ - [babelPluginIstanbul, { - inputSourceMap: sourceMap - }] - ] - }) -} -``` - -## Credit where credit is due - -The approach used in `babel-plugin-istanbul` was inspired by [Thai Pangsakulyanont](https://github.com/dtinth)'s original library [`babel-plugin-__coverage__`](https://github.com/dtinth/babel-plugin-__coverage__). - -## `babel-plugin-istanbul` for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of `babel-plugin-istanbul` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-babel-plugin-istanbul?utm_source=npm-babel-plugin-istanbul&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/lib/index.js b/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/lib/index.js deleted file mode 100644 index 8cf743330..000000000 --- a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/lib/index.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _path = _interopRequireDefault(require("path")); - -var _fs = require("fs"); - -var _child_process = require("child_process"); - -var _helperPluginUtils = require("@babel/helper-plugin-utils"); - -var _istanbulLibInstrument = require("istanbul-lib-instrument"); - -var _testExclude = _interopRequireDefault(require("test-exclude")); - -var _schema = _interopRequireDefault(require("@istanbuljs/schema")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getRealpath(n) { - try { - return (0, _fs.realpathSync)(n) || - /* istanbul ignore next */ - n; - } catch (e) { - /* istanbul ignore next */ - return n; - } -} - -const memoize = new Map(); -/* istanbul ignore next */ - -const memosep = _path.default.sep === '/' ? ':' : ';'; - -function loadNycConfig(cwd, opts) { - let memokey = cwd; - const args = [_path.default.resolve(__dirname, 'load-nyc-config-sync.js'), cwd]; - - if ('nycrcPath' in opts) { - args.push(opts.nycrcPath); - memokey += memosep + opts.nycrcPath; - } - /* execFileSync is expensive, avoid it if possible! */ - - - if (memoize.has(memokey)) { - return memoize.get(memokey); - } - - const result = JSON.parse((0, _child_process.execFileSync)(process.execPath, args)); - const error = result['load-nyc-config-sync-error']; - - if (error) { - throw new Error(error); - } - - const config = { ..._schema.default.defaults.babelPluginIstanbul, - cwd, - ...result - }; - memoize.set(memokey, config); - return config; -} - -function findConfig(opts) { - const cwd = getRealpath(opts.cwd || process.env.NYC_CWD || - /* istanbul ignore next */ - process.cwd()); - const keys = Object.keys(opts); - const ignored = Object.keys(opts).filter(s => s === 'nycrcPath' || s === 'cwd'); - - if (keys.length > ignored.length) { - // explicitly configuring options in babel - // takes precedence. - return { ..._schema.default.defaults.babelPluginIstanbul, - cwd, - ...opts - }; - } - - if (ignored.length === 0 && process.env.NYC_CONFIG) { - // defaults were already applied by nyc - return JSON.parse(process.env.NYC_CONFIG); - } - - return loadNycConfig(cwd, opts); -} - -function makeShouldSkip() { - let exclude; - return function shouldSkip(file, nycConfig) { - if (!exclude || exclude.cwd !== nycConfig.cwd) { - exclude = new _testExclude.default({ - cwd: nycConfig.cwd, - include: nycConfig.include, - exclude: nycConfig.exclude, - extension: nycConfig.extension, - // Make sure this is true unless explicitly set to `false`. `undefined` is still `true`. - excludeNodeModules: nycConfig.excludeNodeModules !== false - }); - } - - return !exclude.shouldInstrument(file); - }; -} - -var _default = (0, _helperPluginUtils.declare)(api => { - api.assertVersion(7); - const shouldSkip = makeShouldSkip(); - const t = api.types; - return { - visitor: { - Program: { - enter(path) { - this.__dv__ = null; - this.nycConfig = findConfig(this.opts); - const realPath = getRealpath(this.file.opts.filename); - - if (shouldSkip(realPath, this.nycConfig)) { - return; - } - - let { - inputSourceMap - } = this.opts; - - if (this.opts.useInlineSourceMaps !== false) { - if (!inputSourceMap && this.file.inputMap) { - inputSourceMap = this.file.inputMap.sourcemap; - } - } - - const visitorOptions = {}; - Object.entries(_schema.default.defaults.instrumentVisitor).forEach(([name, defaultValue]) => { - if (name in this.nycConfig) { - visitorOptions[name] = this.nycConfig[name]; - } else { - visitorOptions[name] = _schema.default.defaults.instrumentVisitor[name]; - } - }); - this.__dv__ = (0, _istanbulLibInstrument.programVisitor)(t, realPath, { ...visitorOptions, - inputSourceMap - }); - - this.__dv__.enter(path); - }, - - exit(path) { - if (!this.__dv__) { - return; - } - - const result = this.__dv__.exit(path); - - if (this.opts.onCover) { - this.opts.onCover(getRealpath(this.file.opts.filename), result.fileCoverage); - } - } - - } - } - }; -}); - -exports.default = _default; \ No newline at end of file diff --git a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js b/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js deleted file mode 100644 index 790679384..000000000 --- a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -const { - loadNycConfig -} = require('@istanbuljs/load-nyc-config'); - -async function main() { - const [cwd, nycrcPath] = process.argv.slice(2); - console.log(JSON.stringify(await loadNycConfig({ - cwd, - nycrcPath - }))); -} - -main().catch(error => { - console.log(JSON.stringify({ - 'load-nyc-config-sync-error': error.message - })); -}); \ No newline at end of file diff --git a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/package.json b/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/package.json deleted file mode 100644 index 2b5851392..000000000 --- a/node_modules/@jest/transform/node_modules/babel-plugin-istanbul/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "babel-plugin-istanbul", - "version": "6.1.1", - "author": "Thai Pangsakulyanont @dtinth", - "license": "BSD-3-Clause", - "description": "A babel plugin that adds istanbul instrumentation to ES6 code", - "main": "lib/index.js", - "files": [ - "lib" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "devDependencies": { - "@babel/cli": "^7.7.5", - "@babel/core": "^7.7.5", - "@babel/plugin-transform-modules-commonjs": "^7.7.5", - "@babel/register": "^7.7.4", - "chai": "^4.2.0", - "coveralls": "^3.0.9", - "cross-env": "^6.0.3", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "pmock": "^0.2.3", - "standard": "^14.3.1" - }, - "scripts": { - "coverage": "nyc report --reporter=text-lcov | coveralls", - "release": "babel src --out-dir lib", - "pretest": "standard && npm run release", - "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha --timeout 5000 test/*.js", - "prepublish": "npm test && npm run release" - }, - "standard": { - "ignore": [ - "fixtures/*.js" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/istanbuljs/babel-plugin-istanbul.git" - }, - "keywords": [ - "istanbul", - "babel", - "plugin", - "instrumentation" - ], - "nyc": { - "include": [ - "src/*.js", - "fixtures/should-cover.js" - ], - "require": [ - "@babel/register" - ], - "sourceMap": false, - "instrument": false - }, - "bugs": { - "url": "https://github.com/istanbuljs/babel-plugin-istanbul/issues" - }, - "homepage": "https://github.com/istanbuljs/babel-plugin-istanbul#readme", - "engines": { - "node": ">=8" - } -} diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/LICENSE b/node_modules/@jest/transform/node_modules/graceful-fs/LICENSE deleted file mode 100644 index 9d2c80369..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/README.md b/node_modules/@jest/transform/node_modules/graceful-fs/README.md deleted file mode 100644 index 82d6e4daf..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# graceful-fs - -graceful-fs functions as a drop-in replacement for the fs module, -making various improvements. - -The improvements are meant to normalize behavior across different -platforms and environments, and to make filesystem access more -resilient to errors. - -## Improvements over [fs module](https://nodejs.org/api/fs.html) - -* Queues up `open` and `readdir` calls, and retries them once - something closes if there is an EMFILE error from too many file - descriptors. -* fixes `lchmod` for Node versions prior to 0.6.2. -* implements `fs.lutimes` if possible. Otherwise it becomes a noop. -* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or - `lchown` if the user isn't root. -* makes `lchmod` and `lchown` become noops, if not available. -* retries reading a file if `read` results in EAGAIN error. - -On Windows, it retries renaming a file for up to one second if `EACCESS` -or `EPERM` error occurs, likely because antivirus software has locked -the directory. - -## USAGE - -```javascript -// use just like fs -var fs = require('graceful-fs') - -// now go and do stuff with it... -fs.readFile('some-file-or-whatever', (err, data) => { - // Do stuff here. -}) -``` - -## Sync methods - -This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync -methods. If you use sync methods which open file descriptors then you are -responsible for dealing with any errors. - -This is a known limitation, not a bug. - -## Global Patching - -If you want to patch the global fs module (or any other fs-like -module) you can do this: - -```javascript -// Make sure to read the caveat below. -var realFs = require('fs') -var gracefulFs = require('graceful-fs') -gracefulFs.gracefulify(realFs) -``` - -This should only ever be done at the top-level application layer, in -order to delay on EMFILE errors from any fs-using dependencies. You -should **not** do this in a library, because it can cause unexpected -delays in other parts of the program. - -## Changes - -This module is fairly stable at this point, and used by a lot of -things. That being said, because it implements a subtle behavior -change in a core part of the node API, even modest changes can be -extremely breaking, and the versioning is thus biased towards -bumping the major when in doubt. - -The main change between major versions has been switching between -providing a fully-patched `fs` module vs monkey-patching the node core -builtin, and the approach by which a non-monkey-patched `fs` was -created. - -The goal is to trade `EMFILE` errors for slower fs operations. So, if -you try to open a zillion files, rather than crashing, `open` -operations will be queued up and wait for something else to `close`. - -There are advantages to each approach. Monkey-patching the fs means -that no `EMFILE` errors can possibly occur anywhere in your -application, because everything is using the same core `fs` module, -which is patched. However, it can also obviously cause undesirable -side-effects, especially if the module is loaded multiple times. - -Implementing a separate-but-identical patched `fs` module is more -surgical (and doesn't run the risk of patching multiple times), but -also imposes the challenge of keeping in sync with the core module. - -The current approach loads the `fs` module, and then creates a -lookalike object that has all the same methods, except a few that are -patched. It is safe to use in all versions of Node from 0.8 through -7.0. - -### v4 - -* Do not monkey-patch the fs module. This module may now be used as a - drop-in dep, and users can opt into monkey-patching the fs builtin - if their app requires it. - -### v3 - -* Monkey-patch fs, because the eval approach no longer works on recent - node. -* fixed possible type-error throw if rename fails on windows -* verify that we *never* get EMFILE errors -* Ignore ENOSYS from chmod/chown -* clarify that graceful-fs must be used as a drop-in - -### v2.1.0 - -* Use eval rather than monkey-patching fs. -* readdir: Always sort the results -* win32: requeue a file if error has an OK status - -### v2.0 - -* A return to monkey patching -* wrap process.cwd - -### v1.1 - -* wrap readFile -* Wrap fs.writeFile. -* readdir protection -* Don't clobber the fs builtin -* Handle fs.read EAGAIN errors by trying again -* Expose the curOpen counter -* No-op lchown/lchmod if not implemented -* fs.rename patch only for win32 -* Patch fs.rename to handle AV software on Windows -* Close #4 Chown should not fail on einval or eperm if non-root -* Fix isaacs/fstream#1 Only wrap fs one time -* Fix #3 Start at 1024 max files, then back off on EMFILE -* lutimes that doens't blow up on Linux -* A full on-rewrite using a queue instead of just swallowing the EMFILE error -* Wrap Read/Write streams as well - -### 1.0 - -* Update engines for node 0.6 -* Be lstat-graceful on Windows -* first diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/clone.js b/node_modules/@jest/transform/node_modules/graceful-fs/clone.js deleted file mode 100644 index dff3cc8c5..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/graceful-fs.js b/node_modules/@jest/transform/node_modules/graceful-fs/graceful-fs.js deleted file mode 100644 index 947cd94bb..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/graceful-fs.js +++ /dev/null @@ -1,429 +0,0 @@ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - require('assert').equal(fs[gracefulQueue].length, 0) - }) - } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) - - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readdir(path, options, cb) - - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() - - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} - -// keep track of the timeout between retry() calls -var retryTimer - -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} - -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined - - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/legacy-streams.js b/node_modules/@jest/transform/node_modules/graceful-fs/legacy-streams.js deleted file mode 100644 index d617b50fc..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/legacy-streams.js +++ /dev/null @@ -1,118 +0,0 @@ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/package.json b/node_modules/@jest/transform/node_modules/graceful-fs/package.json deleted file mode 100644 index e1cb58473..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "graceful-fs", - "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-graceful-fs" - }, - "main": "graceful-fs.js", - "directories": { - "test": "test" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "nyc --silent node test.js | tap -c -", - "posttest": "nyc report" - }, - "keywords": [ - "fs", - "module", - "reading", - "retry", - "retries", - "queue", - "error", - "errors", - "handling", - "EMFILE", - "EAGAIN", - "EINVAL", - "EPERM", - "EACCESS" - ], - "license": "ISC", - "devDependencies": { - "import-fresh": "^2.0.0", - "mkdirp": "^0.5.0", - "rimraf": "^2.2.8", - "tap": "^12.7.0" - }, - "files": [ - "fs.js", - "graceful-fs.js", - "legacy-streams.js", - "polyfills.js", - "clone.js" - ] -} diff --git a/node_modules/@jest/transform/node_modules/graceful-fs/polyfills.js b/node_modules/@jest/transform/node_modules/graceful-fs/polyfills.js deleted file mode 100644 index 26804ef0a..000000000 --- a/node_modules/@jest/transform/node_modules/graceful-fs/polyfills.js +++ /dev/null @@ -1,348 +0,0 @@ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/CHANGELOG.md b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/CHANGELOG.md deleted file mode 100644 index 172546b20..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/CHANGELOG.md +++ /dev/null @@ -1,193 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.2...istanbul-lib-coverage@3.0.0) (2019-12-20) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.1...istanbul-lib-coverage@3.0.0-alpha.2) (2019-12-07) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.0...istanbul-lib-coverage@3.0.0-alpha.1) (2019-10-06) - - -### Bug Fixes - -* Drop unneeded coverage data from `nyc --all` ([#456](https://github.com/istanbuljs/istanbuljs/issues/456)) ([f6bb0b4](https://github.com/istanbuljs/istanbuljs/commit/f6bb0b4)), closes [#123](https://github.com/istanbuljs/istanbuljs/issues/123) [#224](https://github.com/istanbuljs/istanbuljs/issues/224) [#260](https://github.com/istanbuljs/istanbuljs/issues/260) [#322](https://github.com/istanbuljs/istanbuljs/issues/322) [#413](https://github.com/istanbuljs/istanbuljs/issues/413) - - - - - -# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.5...istanbul-lib-coverage@3.0.0-alpha.0) (2019-06-19) - - -### Features - -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Node.js 8 is now required - - - - - -## [3.2.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.1.0...istanbul-lib-coverage-v3.2.0) (2021-10-17) - - -### Features - -* allow FileCoverage to be initialized with logical tracking ([#644](https://www.github.com/istanbuljs/istanbuljs/issues/644)) ([4cb5af1](https://www.github.com/istanbuljs/istanbuljs/commit/4cb5af1daaf33c3e9a5f3ee44f6bb7f958e5ba04)) - -## [3.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.2...istanbul-lib-coverage-v3.1.0) (2021-10-17) - - -### Features - -* support tracking Logic Truthiness as additional metric in coverage API ([#639](https://www.github.com/istanbuljs/istanbuljs/issues/639)) ([0967c80](https://www.github.com/istanbuljs/istanbuljs/commit/0967c80b905c3c17675ff2185b2325784e8dc0a2)) - -### [3.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.1...istanbul-lib-coverage-v3.0.2) (2021-10-11) - - -### Bug Fixes - -* handle merging '0' indexed coverage with '1' indexed coverage ([5dac2bc](https://www.github.com/istanbuljs/istanbuljs/commit/5dac2bcf28d6f27dbb720be72c2b692153418ab5)), closes [#632](https://www.github.com/istanbuljs/istanbuljs/issues/632) - -### [3.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.0...istanbul-lib-coverage-v3.0.1) (2021-09-23) - - -### Bug Fixes - -* merge branch/statement/functionMap's together when merging two coverage reports ([#617](https://www.github.com/istanbuljs/istanbuljs/issues/617)) ([ff1b5e9](https://www.github.com/istanbuljs/istanbuljs/commit/ff1b5e915201e4ff8f737010509bab98d8238118)) - -## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.4...istanbul-lib-coverage@2.0.5) (2019-04-24) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -## [2.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.3...istanbul-lib-coverage@2.0.4) (2019-03-12) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.2...istanbul-lib-coverage@2.0.3) (2019-01-26) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - - -## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.1...istanbul-lib-coverage@2.0.2) (2018-12-25) - - - - -**Note:** Version bump only for package istanbul-lib-coverage - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.0...istanbul-lib-coverage@2.0.1) (2018-07-07) - - - - -**Note:** Version bump only for package istanbul-lib-coverage - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.2.0...istanbul-lib-coverage@2.0.0) (2018-06-06) - - -### Bug Fixes - -* use null prototype for map objects ([#177](https://github.com/istanbuljs/istanbuljs/issues/177)) ([9a5a30c](https://github.com/istanbuljs/istanbuljs/commit/9a5a30c)) - - -### BREAKING CHANGES - -* a null prototype is now used in several places rather than the default `{}` assignment. - - - - - -# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.2...istanbul-lib-coverage@1.2.0) (2018-03-04) - - -### Features - -* add skip-empty option for html & text reports ([#140](https://github.com/istanbuljs/istanbuljs/issues/140)) ([d2a4262](https://github.com/istanbuljs/istanbuljs/commit/d2a4262)) - - - - - -## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.1...istanbul-lib-coverage@1.1.2) (2018-02-13) - - - - -**Note:** Version bump only for package istanbul-lib-coverage - - -## [1.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.0...istanbul-lib-coverage@1.1.1) (2017-05-27) - - - - - -# [1.1.0](https://github.com/istanbuljs/istanbul-lib-coverage/compare/istanbul-lib-coverage@1.0.2...istanbul-lib-coverage@1.1.0) (2017-04-29) - - -### Bug Fixes - -* getBranchCoverageByLine() was looking for line coverage using wrong object structure ([bf36658](https://github.com/istanbuljs/istanbul-lib-coverage/commit/bf36658)) - - -### Features - -* add possibility to filter coverage maps when running reports post-hoc ([#24](https://github.com/istanbuljs/istanbuljs/issues/24)) ([e1c99d6](https://github.com/istanbuljs/istanbul-lib-coverage/commit/e1c99d6)) - - - - - -## [1.0.2](https://github.com/istanbuljs/istanbul-lib-coverage/compare/istanbul-lib-coverage@1.0.1...istanbul-lib-coverage@1.0.2) (2017-03-27) - - -## [1.0.1](https://github.com/istanbuljs/istanbul-lib-coverage/compare/v1.0.0...v1.0.1) (2017-01-18) - - -### Bug Fixes - -* handle edge-case surrounding merging two file coverage reports ([22e154c](https://github.com/istanbuljs/istanbul-lib-coverage/commit/22e154c)) - - - - -# [1.0.0](https://github.com/istanbuljs/istanbul-lib-coverage/compare/v1.0.0-alpha.3...v1.0.0) (2016-08-12) - - -### Bug Fixes - -* guard against missing statement ([76aad99](https://github.com/istanbuljs/istanbul-lib-coverage/commit/76aad99)) diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/README.md b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/README.md deleted file mode 100644 index 2c24a56c9..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/README.md +++ /dev/null @@ -1,29 +0,0 @@ -## istanbul-lib-coverage - -[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-lib-coverage.svg)](https://greenkeeper.io/) -[![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-coverage.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-coverage) - -An API that provides a read-only view of coverage information with the ability -to merge and summarize coverage info. - -Supersedes `object-utils` and `collector` from the v0 istanbul API. - -See the docs for the full API. - -```js -var libCoverage = require('istanbul-lib-coverage'); -var map = libCoverage.createCoverageMap(globalCoverageVar); -var summary = libCoverage.createCoverageSummary(); - -// merge another coverage map into the one we created -map.merge(otherCoverageMap); - -// inspect and summarize all file coverage objects in the map -map.files().forEach(function(f) { - var fc = map.fileCoverageFor(f), - s = fc.toSummary(); - summary.merge(s); -}); - -console.log('Global summary', summary); -``` diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/index.js b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/index.js deleted file mode 100644 index bdc5a1820..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/index.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -/** - * istanbul-lib-coverage exports an API that allows you to create and manipulate - * file coverage, coverage maps (a set of file coverage objects) and summary - * coverage objects. File coverage for the same file can be merged as can - * entire coverage maps. - * - * @module Exports - */ -const { FileCoverage } = require('./lib/file-coverage'); -const { CoverageMap } = require('./lib/coverage-map'); -const { CoverageSummary } = require('./lib/coverage-summary'); - -module.exports = { - /** - * creates a coverage summary object - * @param {Object} obj an argument with the same semantics - * as the one passed to the `CoverageSummary` constructor - * @returns {CoverageSummary} - */ - createCoverageSummary(obj) { - if (obj && obj instanceof CoverageSummary) { - return obj; - } - return new CoverageSummary(obj); - }, - /** - * creates a CoverageMap object - * @param {Object} obj optional - an argument with the same semantics - * as the one passed to the CoverageMap constructor. - * @returns {CoverageMap} - */ - createCoverageMap(obj) { - if (obj && obj instanceof CoverageMap) { - return obj; - } - return new CoverageMap(obj); - }, - /** - * creates a FileCoverage object - * @param {Object} obj optional - an argument with the same semantics - * as the one passed to the FileCoverage constructor. - * @returns {FileCoverage} - */ - createFileCoverage(obj) { - if (obj && obj instanceof FileCoverage) { - return obj; - } - return new FileCoverage(obj); - } -}; - -/** classes exported for reuse */ -module.exports.classes = { - /** - * the file coverage constructor - */ - FileCoverage -}; diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/coverage-map.js b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/coverage-map.js deleted file mode 100644 index 0a1ebd0a9..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/coverage-map.js +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const { FileCoverage } = require('./file-coverage'); -const { CoverageSummary } = require('./coverage-summary'); - -function maybeConstruct(obj, klass) { - if (obj instanceof klass) { - return obj; - } - - return new klass(obj); -} - -function loadMap(source) { - const data = Object.create(null); - if (!source) { - return data; - } - - Object.entries(source).forEach(([k, cov]) => { - data[k] = maybeConstruct(cov, FileCoverage); - }); - - return data; -} - -/** CoverageMap is a map of `FileCoverage` objects keyed by file paths. */ -class CoverageMap { - /** - * @constructor - * @param {Object} [obj=undefined] obj A coverage map from which to initialize this - * map's contents. This can be the raw global coverage object. - */ - constructor(obj) { - if (obj instanceof CoverageMap) { - this.data = obj.data; - } else { - this.data = loadMap(obj); - } - } - - /** - * merges a second coverage map into this one - * @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged - * correctly for the same files and additional file coverage keys are created - * as needed. - */ - merge(obj) { - const other = maybeConstruct(obj, CoverageMap); - Object.values(other.data).forEach(fc => { - this.addFileCoverage(fc); - }); - } - - /** - * filter the coveragemap based on the callback provided - * @param {Function (filename)} callback - Returns true if the path - * should be included in the coveragemap. False if it should be - * removed. - */ - filter(callback) { - Object.keys(this.data).forEach(k => { - if (!callback(k)) { - delete this.data[k]; - } - }); - } - - /** - * returns a JSON-serializable POJO for this coverage map - * @returns {Object} - */ - toJSON() { - return this.data; - } - - /** - * returns an array for file paths for which this map has coverage - * @returns {Array{string}} - array of files - */ - files() { - return Object.keys(this.data); - } - - /** - * returns the file coverage for the specified file. - * @param {String} file - * @returns {FileCoverage} - */ - fileCoverageFor(file) { - const fc = this.data[file]; - if (!fc) { - throw new Error(`No file coverage available for: ${file}`); - } - return fc; - } - - /** - * adds a file coverage object to this map. If the path for the object, - * already exists in the map, it is merged with the existing coverage - * otherwise a new key is added to the map. - * @param {FileCoverage} fc the file coverage to add - */ - addFileCoverage(fc) { - const cov = new FileCoverage(fc); - const { path } = cov; - if (this.data[path]) { - this.data[path].merge(cov); - } else { - this.data[path] = cov; - } - } - - /** - * returns the coverage summary for all the file coverage objects in this map. - * @returns {CoverageSummary} - */ - getCoverageSummary() { - const ret = new CoverageSummary(); - Object.values(this.data).forEach(fc => { - ret.merge(fc.toSummary()); - }); - - return ret; - } -} - -module.exports = { - CoverageMap -}; diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/coverage-summary.js b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/coverage-summary.js deleted file mode 100644 index 9b769c66a..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/coverage-summary.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const percent = require('./percent'); -const dataProperties = require('./data-properties'); - -function blankSummary() { - const empty = () => ({ - total: 0, - covered: 0, - skipped: 0, - pct: 'Unknown' - }); - - return { - lines: empty(), - statements: empty(), - functions: empty(), - branches: empty(), - branchesTrue: empty() - }; -} - -// asserts that a data object "looks like" a summary coverage object -function assertValidSummary(obj) { - const valid = - obj && obj.lines && obj.statements && obj.functions && obj.branches; - if (!valid) { - throw new Error( - 'Invalid summary coverage object, missing keys, found:' + - Object.keys(obj).join(',') - ); - } -} - -/** - * CoverageSummary provides a summary of code coverage . It exposes 4 properties, - * `lines`, `statements`, `branches`, and `functions`. Each of these properties - * is an object that has 4 keys `total`, `covered`, `skipped` and `pct`. - * `pct` is a percentage number (0-100). - */ -class CoverageSummary { - /** - * @constructor - * @param {Object|CoverageSummary} [obj=undefined] an optional data object or - * another coverage summary to initialize this object with. - */ - constructor(obj) { - if (!obj) { - this.data = blankSummary(); - } else if (obj instanceof CoverageSummary) { - this.data = obj.data; - } else { - this.data = obj; - } - assertValidSummary(this.data); - } - - /** - * merges a second summary coverage object into this one - * @param {CoverageSummary} obj - another coverage summary object - */ - merge(obj) { - const keys = [ - 'lines', - 'statements', - 'branches', - 'functions', - 'branchesTrue' - ]; - keys.forEach(key => { - if (obj[key]) { - this[key].total += obj[key].total; - this[key].covered += obj[key].covered; - this[key].skipped += obj[key].skipped; - this[key].pct = percent(this[key].covered, this[key].total); - } - }); - - return this; - } - - /** - * returns a POJO that is JSON serializable. May be used to get the raw - * summary object. - */ - toJSON() { - return this.data; - } - - /** - * return true if summary has no lines of code - */ - isEmpty() { - return this.lines.total === 0; - } -} - -dataProperties(CoverageSummary, [ - 'lines', - 'statements', - 'functions', - 'branches', - 'branchesTrue' -]); - -module.exports = { - CoverageSummary -}; diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/data-properties.js b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/data-properties.js deleted file mode 100644 index 3a12d40e9..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/data-properties.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -module.exports = function dataProperties(klass, properties) { - properties.forEach(p => { - Object.defineProperty(klass.prototype, p, { - enumerable: true, - get() { - return this.data[p]; - } - }); - }); -}; diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/file-coverage.js b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/file-coverage.js deleted file mode 100644 index 80a36ab55..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/file-coverage.js +++ /dev/null @@ -1,345 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const percent = require('./percent'); -const dataProperties = require('./data-properties'); -const { CoverageSummary } = require('./coverage-summary'); - -// returns a data object that represents empty coverage -function emptyCoverage(filePath, reportLogic) { - const cov = { - path: filePath, - statementMap: {}, - fnMap: {}, - branchMap: {}, - s: {}, - f: {}, - b: {} - }; - if (reportLogic) cov.bT = {}; - return cov; -} - -// asserts that a data object "looks like" a coverage object -function assertValidObject(obj) { - const valid = - obj && - obj.path && - obj.statementMap && - obj.fnMap && - obj.branchMap && - obj.s && - obj.f && - obj.b; - if (!valid) { - throw new Error( - 'Invalid file coverage object, missing keys, found:' + - Object.keys(obj).join(',') - ); - } -} - -const keyFromLoc = ({ start, end }) => - `${start.line}|${start.column}|${end.line}|${end.column}`; - -const mergeProp = (aHits, aMap, bHits, bMap, itemKey = keyFromLoc) => { - const aItems = {}; - for (const [key, itemHits] of Object.entries(aHits)) { - const item = aMap[key]; - aItems[itemKey(item)] = [itemHits, item]; - } - for (const [key, bItemHits] of Object.entries(bHits)) { - const bItem = bMap[key]; - const k = itemKey(bItem); - - if (aItems[k]) { - const aPair = aItems[k]; - if (bItemHits.forEach) { - // should this throw an exception if aPair[0] is not an array? - bItemHits.forEach((hits, h) => { - if (aPair[0][h] !== undefined) aPair[0][h] += hits; - else aPair[0][h] = hits; - }); - } else { - aPair[0] += bItemHits; - } - } else { - aItems[k] = [bItemHits, bItem]; - } - } - const hits = {}; - const map = {}; - - Object.values(aItems).forEach(([itemHits, item], i) => { - hits[i] = itemHits; - map[i] = item; - }); - - return [hits, map]; -}; - -/** - * provides a read-only view of coverage for a single file. - * The deep structure of this object is documented elsewhere. It has the following - * properties: - * - * * `path` - the file path for which coverage is being tracked - * * `statementMap` - map of statement locations keyed by statement index - * * `fnMap` - map of function metadata keyed by function index - * * `branchMap` - map of branch metadata keyed by branch index - * * `s` - hit counts for statements - * * `f` - hit count for functions - * * `b` - hit count for branches - */ -class FileCoverage { - /** - * @constructor - * @param {Object|FileCoverage|String} pathOrObj is a string that initializes - * and empty coverage object with the specified file path or a data object that - * has all the required properties for a file coverage object. - */ - constructor(pathOrObj, reportLogic = false) { - if (!pathOrObj) { - throw new Error( - 'Coverage must be initialized with a path or an object' - ); - } - if (typeof pathOrObj === 'string') { - this.data = emptyCoverage(pathOrObj, reportLogic); - } else if (pathOrObj instanceof FileCoverage) { - this.data = pathOrObj.data; - } else if (typeof pathOrObj === 'object') { - this.data = pathOrObj; - } else { - throw new Error('Invalid argument to coverage constructor'); - } - assertValidObject(this.data); - } - - /** - * returns computed line coverage from statement coverage. - * This is a map of hits keyed by line number in the source. - */ - getLineCoverage() { - const statementMap = this.data.statementMap; - const statements = this.data.s; - const lineMap = Object.create(null); - - Object.entries(statements).forEach(([st, count]) => { - /* istanbul ignore if: is this even possible? */ - if (!statementMap[st]) { - return; - } - const { line } = statementMap[st].start; - const prevVal = lineMap[line]; - if (prevVal === undefined || prevVal < count) { - lineMap[line] = count; - } - }); - return lineMap; - } - - /** - * returns an array of uncovered line numbers. - * @returns {Array} an array of line numbers for which no hits have been - * collected. - */ - getUncoveredLines() { - const lc = this.getLineCoverage(); - const ret = []; - Object.entries(lc).forEach(([l, hits]) => { - if (hits === 0) { - ret.push(l); - } - }); - return ret; - } - - /** - * returns a map of branch coverage by source line number. - * @returns {Object} an object keyed by line number. Each object - * has a `covered`, `total` and `coverage` (percentage) property. - */ - getBranchCoverageByLine() { - const branchMap = this.branchMap; - const branches = this.b; - const ret = {}; - Object.entries(branchMap).forEach(([k, map]) => { - const line = map.line || map.loc.start.line; - const branchData = branches[k]; - ret[line] = ret[line] || []; - ret[line].push(...branchData); - }); - Object.entries(ret).forEach(([k, dataArray]) => { - const covered = dataArray.filter(item => item > 0); - const coverage = (covered.length / dataArray.length) * 100; - ret[k] = { - covered: covered.length, - total: dataArray.length, - coverage - }; - }); - return ret; - } - - /** - * return a JSON-serializable POJO for this file coverage object - */ - toJSON() { - return this.data; - } - - /** - * merges a second coverage object into this one, updating hit counts - * @param {FileCoverage} other - the coverage object to be merged into this one. - * Note that the other object should have the same structure as this one (same file). - */ - merge(other) { - if (other.all === true) { - return; - } - - if (this.all === true) { - this.data = other.data; - return; - } - - let [hits, map] = mergeProp( - this.s, - this.statementMap, - other.s, - other.statementMap - ); - this.data.s = hits; - this.data.statementMap = map; - - const keyFromLocProp = x => keyFromLoc(x.loc); - const keyFromLocationsProp = x => keyFromLoc(x.locations[0]); - - [hits, map] = mergeProp( - this.f, - this.fnMap, - other.f, - other.fnMap, - keyFromLocProp - ); - this.data.f = hits; - this.data.fnMap = map; - - [hits, map] = mergeProp( - this.b, - this.branchMap, - other.b, - other.branchMap, - keyFromLocationsProp - ); - this.data.b = hits; - this.data.branchMap = map; - - // Tracking additional information about branch truthiness - // can be optionally enabled: - if (this.bT && other.bT) { - [hits, map] = mergeProp( - this.bT, - this.branchMap, - other.bT, - other.branchMap, - keyFromLocationsProp - ); - this.data.bT = hits; - } - } - - computeSimpleTotals(property) { - let stats = this[property]; - - if (typeof stats === 'function') { - stats = stats.call(this); - } - - const ret = { - total: Object.keys(stats).length, - covered: Object.values(stats).filter(v => !!v).length, - skipped: 0 - }; - ret.pct = percent(ret.covered, ret.total); - return ret; - } - - computeBranchTotals(property) { - const stats = this[property]; - const ret = { total: 0, covered: 0, skipped: 0 }; - - Object.values(stats).forEach(branches => { - ret.covered += branches.filter(hits => hits > 0).length; - ret.total += branches.length; - }); - ret.pct = percent(ret.covered, ret.total); - return ret; - } - - /** - * resets hit counts for all statements, functions and branches - * in this coverage object resulting in zero coverage. - */ - resetHits() { - const statements = this.s; - const functions = this.f; - const branches = this.b; - const branchesTrue = this.bT; - Object.keys(statements).forEach(s => { - statements[s] = 0; - }); - Object.keys(functions).forEach(f => { - functions[f] = 0; - }); - Object.keys(branches).forEach(b => { - branches[b].fill(0); - }); - // Tracking additional information about branch truthiness - // can be optionally enabled: - if (branchesTrue) { - Object.keys(branchesTrue).forEach(bT => { - branchesTrue[bT].fill(0); - }); - } - } - - /** - * returns a CoverageSummary for this file coverage object - * @returns {CoverageSummary} - */ - toSummary() { - const ret = {}; - ret.lines = this.computeSimpleTotals('getLineCoverage'); - ret.functions = this.computeSimpleTotals('f', 'fnMap'); - ret.statements = this.computeSimpleTotals('s', 'statementMap'); - ret.branches = this.computeBranchTotals('b'); - // Tracking additional information about branch truthiness - // can be optionally enabled: - if (this['bt']) { - ret.branchesTrue = this.computeBranchTotals('bT'); - } - return new CoverageSummary(ret); - } -} - -// expose coverage data attributes -dataProperties(FileCoverage, [ - 'path', - 'statementMap', - 'fnMap', - 'branchMap', - 's', - 'f', - 'b', - 'bT', - 'all' -]); - -module.exports = { - FileCoverage -}; diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/percent.js b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/percent.js deleted file mode 100644 index c7b7aafa4..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/lib/percent.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -module.exports = function percent(covered, total) { - let tmp; - if (total > 0) { - tmp = (1000 * 100 * covered) / total; - return Math.floor(tmp / 10) / 100; - } else { - return 100.0; - } -}; diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/package.json b/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/package.json deleted file mode 100644 index 628584f1a..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "istanbul-lib-coverage", - "version": "3.2.0", - "description": "Data library for istanbul coverage objects", - "author": "Krishnan Anantheswaran ", - "main": "index.js", - "files": [ - "lib", - "index.js" - ], - "scripts": { - "test": "nyc mocha" - }, - "devDependencies": { - "chai": "^4.2.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0-beta.2" - }, - "karmaDeps": { - "browserify-istanbul": "^0.2.1", - "karma": "^0.13.10", - "karma-browserify": "^4.2.1", - "karma-chrome-launcher": "^0.2.0", - "karma-coverage": "^0.4.2", - "karma-mocha": "^0.2.0", - "karma-phantomjs-launcher": "^0.2.0", - "phantomjs": "^1.9.17" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", - "directory": "packages/istanbul-lib-coverage" - }, - "keywords": [ - "istanbul", - "coverage", - "data" - ], - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/istanbuljs/istanbuljs/issues" - }, - "homepage": "https://istanbul.js.org/", - "engines": { - "node": ">=8" - } -} diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/CHANGELOG.md b/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/CHANGELOG.md deleted file mode 100644 index 3bbf41cff..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/CHANGELOG.md +++ /dev/null @@ -1,617 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [5.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.4...istanbul-lib-instrument-v5.1.0) (2021-10-27) - - -### Features - -* option to evaluate logical truthiness, for applications such as fuzzing ([#629](https://www.github.com/istanbuljs/istanbuljs/issues/629)) ([a743b84](https://www.github.com/istanbuljs/istanbuljs/commit/a743b8442e977f0c77ffa282eed7ac84ca200d1f)) - -### [5.0.4](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.3...istanbul-lib-instrument-v5.0.4) (2021-10-16) - - -### Bug Fixes - -* **magic-value:** make incrementing magic value a manual step ([#641](https://www.github.com/istanbuljs/istanbuljs/issues/641)) ([823010b](https://www.github.com/istanbuljs/istanbuljs/commit/823010b821cf81bd91377d75fc83f0875925db66)) - -### [5.0.3](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.2...istanbul-lib-instrument-v5.0.3) (2021-10-06) - - -### Bug Fixes - -* coverage.branchMap else location. ([#633](https://www.github.com/istanbuljs/istanbuljs/issues/633)) ([eb4b4ec](https://www.github.com/istanbuljs/istanbuljs/commit/eb4b4ec8f4b858655a66b0033fcc662f44ef4cc9)) - -### [5.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.1...istanbul-lib-instrument-v5.0.2) (2021-09-13) - - -### Bug Fixes - -* **build:** verfiy automated publication ([b232690](https://www.github.com/istanbuljs/istanbuljs/commit/b232690193f4b524332046c96dd1cdc6e881c6c7)) - -### [5.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.0...istanbul-lib-instrument-v5.0.1) (2021-09-13) - - -### Bug Fixes - -* **build:** verfiy automated publication ([74c96bd](https://www.github.com/istanbuljs/istanbuljs/commit/74c96bdc4224a06e2e1166ebd9adf8faf28438b1)) - -## [5.0.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v4.0.3...istanbul-lib-instrument-v5.0.0) (2021-09-13) - - -### ⚠ BREAKING CHANGES - -* istanbul-lib-instrument no longer uses babel - -### Code Refactoring - -* istanbul-lib-instrument no longer uses babel ([8d3badb](https://www.github.com/istanbuljs/istanbuljs/commit/8d3badb8f6c9a4bed9af8e19c3ac6459ebd7267b)) - -## [4.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.2...istanbul-lib-instrument@4.0.3) (2020-05-09) - - -### Bug Fixes - -* Prevent readInitialCoverage from reading babel config ([#562](https://github.com/istanbuljs/istanbuljs/issues/562)) ([49b4745](https://github.com/istanbuljs/istanbuljs/commit/49b474525c15e703642916011bd86f663aca0c3d)) - - - - - -## [4.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.1...istanbul-lib-instrument@4.0.2) (2020-05-06) - - -### Bug Fixes - -* Add ts-ignore to reassignment of generated function ([#557](https://github.com/istanbuljs/istanbuljs/issues/557)) ([817efb0](https://github.com/istanbuljs/istanbuljs/commit/817efb04fc161efae426b2231a0221606b09f559)) -* Use @babel/core for all babel imports. ([#555](https://github.com/istanbuljs/istanbuljs/issues/555)) ([a99a13e](https://github.com/istanbuljs/istanbuljs/commit/a99a13ee6931fc124a2a723c3f511cdbcb0aa81d)) - - - - - -## [4.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0...istanbul-lib-instrument@4.0.1) (2020-02-03) - - -### Bug Fixes - -* Always call coverage initialization function ([#524](https://github.com/istanbuljs/istanbuljs/issues/524)) ([c6536c1](https://github.com/istanbuljs/istanbuljs/commit/c6536c14bf0663ca7e0493dd40ea132b05352594)) - - - - - -# [4.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.3...istanbul-lib-instrument@4.0.0) (2019-12-20) - -**Note:** Version bump only for package istanbul-lib-instrument - - - - - -# [4.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.2...istanbul-lib-instrument@4.0.0-alpha.3) (2019-12-07) - -**Note:** Version bump only for package istanbul-lib-instrument - - - - - -# [4.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.1...istanbul-lib-instrument@4.0.0-alpha.2) (2019-11-01) - - -### Bug Fixes - -* Produce properly merged source-maps when inputSourceMap is provided ([#487](https://github.com/istanbuljs/istanbuljs/issues/487)) ([8f8c88e](https://github.com/istanbuljs/istanbuljs/commit/8f8c88e3a2add4c08729e41e356aa7981dc69d4d)) - - - - - -# [4.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.0...istanbul-lib-instrument@4.0.0-alpha.1) (2019-10-06) - - -### Bug Fixes - -* Eliminate babel hoisting of the coverage variable ([#481](https://github.com/istanbuljs/istanbuljs/issues/481)) ([8dfbcba](https://github.com/istanbuljs/istanbuljs/commit/8dfbcba)), closes [#92](https://github.com/istanbuljs/istanbuljs/issues/92) -* Honor ignore hints in chained if statements ([#469](https://github.com/istanbuljs/istanbuljs/issues/469)) ([a629770](https://github.com/istanbuljs/istanbuljs/commit/a629770)), closes [#468](https://github.com/istanbuljs/istanbuljs/issues/468) -* Populate lastFileCoverage for already instrumented files ([#470](https://github.com/istanbuljs/istanbuljs/issues/470)) ([ea6d779](https://github.com/istanbuljs/istanbuljs/commit/ea6d779)), closes [istanbuljs/nyc#594](https://github.com/istanbuljs/nyc/issues/594) - - -### Features - -* Use @istanbuljs/schema to pull defaults ([#485](https://github.com/istanbuljs/istanbuljs/issues/485)) ([87e27f3](https://github.com/istanbuljs/istanbuljs/commit/87e27f3)), closes [#460](https://github.com/istanbuljs/istanbuljs/issues/460) - - -### BREAKING CHANGES - -* The defaults for `autoWrap`, `preserveComments`, -`esModules` and `produceSourceMap` are now true. This applies only to -the stand-alone instrumenter, the visitor does not use these options. -* The `flow` and `jsx` parser plugins are no longer -enabled by default. This applies only to the stand-alone instrumenter, -the visitor does not use this option. -* The `plugins` option of the stand-alone instrumenter -has been renamed to `parserPlugins` to match nyc. - - - - - -# [4.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.3.0...istanbul-lib-instrument@4.0.0-alpha.0) (2019-06-19) - - -### Features - -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Node.js 8 is now required - - - - - -# [3.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.2.0...istanbul-lib-instrument@3.3.0) (2019-04-24) - - -### Features - -* Enable classProperties and classPrivateProperties parsers and coverage. ([#379](https://github.com/istanbuljs/istanbuljs/issues/379)) ([c09dc38](https://github.com/istanbuljs/istanbuljs/commit/c09dc38)) - - - - - -# [3.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.2...istanbul-lib-instrument@3.2.0) (2019-04-09) - - -### Features - -* Add bigInt and importMeta to default parser plugins. ([#356](https://github.com/istanbuljs/istanbuljs/issues/356)) ([fb4d6ed](https://github.com/istanbuljs/istanbuljs/commit/fb4d6ed)), closes [#338](https://github.com/istanbuljs/istanbuljs/issues/338) - - - - - -## [3.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.1...istanbul-lib-instrument@3.1.2) (2019-04-03) - - -### Bug Fixes - -* Be more friendly to ts-node. ([#352](https://github.com/istanbuljs/istanbuljs/issues/352)) ([40d15f5](https://github.com/istanbuljs/istanbuljs/commit/40d15f5)), closes [#336](https://github.com/istanbuljs/istanbuljs/issues/336) - - - - - -## [3.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.0...istanbul-lib-instrument@3.1.1) (2019-03-12) - - -### Bug Fixes - -* Honor istanbul ignore next hints placed before export statement. ([#298](https://github.com/istanbuljs/istanbuljs/issues/298)) ([f24795d](https://github.com/istanbuljs/istanbuljs/commit/f24795d)), closes [#297](https://github.com/istanbuljs/istanbuljs/issues/297) - - - - - -# [3.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.1...istanbul-lib-instrument@3.1.0) (2019-01-26) - - -### Features - -* dont skip for loop initialization instrumentation ([#188](https://github.com/istanbuljs/istanbuljs/issues/188)) ([2e0258e](https://github.com/istanbuljs/istanbuljs/commit/2e0258e)) -* New options coverageGlobalScope and coverageGlobalScopeFunc. ([#200](https://github.com/istanbuljs/istanbuljs/issues/200)) ([25509c7](https://github.com/istanbuljs/istanbuljs/commit/25509c7)), closes [#199](https://github.com/istanbuljs/istanbuljs/issues/199) - - - - - - -## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.0...istanbul-lib-instrument@3.0.1) (2018-12-25) - - - - -**Note:** Version bump only for package istanbul-lib-instrument - - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.2...istanbul-lib-instrument@3.0.0) (2018-09-06) - - -### Chores - -* Update test for babel 7. ([#218](https://github.com/istanbuljs/istanbuljs/issues/218)) ([9cf4d43](https://github.com/istanbuljs/istanbuljs/commit/9cf4d43)), closes [#205](https://github.com/istanbuljs/istanbuljs/issues/205) - - -### Features - -* Add option plugins ([#205](https://github.com/istanbuljs/istanbuljs/issues/205)) ([312f81f](https://github.com/istanbuljs/istanbuljs/commit/312f81f)) -* Update babel to 7.0.0. ([#215](https://github.com/istanbuljs/istanbuljs/issues/215)) ([8a96613](https://github.com/istanbuljs/istanbuljs/commit/8a96613)) - - -### BREAKING CHANGES - -* was added which requires an option for the `decorators` -plugin. Add it to get tests working again, commit updated api.md. - - - - - -## [2.3.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.1...istanbul-lib-instrument@2.3.2) (2018-07-24) - - - - -**Note:** Version bump only for package istanbul-lib-instrument - - -## [2.3.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.0...istanbul-lib-instrument@2.3.1) (2018-07-07) - - -### Bug Fixes - -* Don't ignore src/visitor.js for self test. ([#194](https://github.com/istanbuljs/istanbuljs/issues/194)) ([71b815d](https://github.com/istanbuljs/istanbuljs/commit/71b815d)) - - - - - -# [2.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.1...istanbul-lib-instrument@2.3.0) (2018-06-27) - - -### Features - -* update pinned babel version to latest release. ([#189](https://github.com/istanbuljs/istanbuljs/issues/189)) ([ac8ec07](https://github.com/istanbuljs/istanbuljs/commit/ac8ec07)) - - - - - -## [2.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.0...istanbul-lib-instrument@2.2.1) (2018-06-26) - - -### Bug Fixes - -* Instrument ObjectMethod's. ([#182](https://github.com/istanbuljs/istanbuljs/issues/182)) ([126f09d](https://github.com/istanbuljs/istanbuljs/commit/126f09d)) -* update default args test guard to work on supported versions. ([#185](https://github.com/istanbuljs/istanbuljs/issues/185)) ([955511a](https://github.com/istanbuljs/istanbuljs/commit/955511a)) - - - - - -# [2.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.2.0) (2018-06-06) - - -### Features - -* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f)) - - - - - -# [2.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.1.0) (2018-05-31) - - -### Features - -* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f)) - - - - - -## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.1...istanbul-lib-instrument@2.0.2) (2018-05-31) - - - - -**Note:** Version bump only for package istanbul-lib-instrument - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.0...istanbul-lib-instrument@2.0.1) (2018-05-31) - - -### Bug Fixes - -* should import [@babel](https://github.com/babel)/template ([85a0d1a](https://github.com/istanbuljs/istanbuljs/commit/85a0d1a)) - - - - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.1...istanbul-lib-instrument@2.0.0) (2018-05-31) - - -### Bug Fixes - -* parenthesize superClass on non-idetifier case ([#158](https://github.com/istanbuljs/istanbuljs/issues/158)) ([6202c88](https://github.com/istanbuljs/istanbuljs/commit/6202c88)) - - -### Chores - -* upgrade babel in instrumenter ([#174](https://github.com/istanbuljs/istanbuljs/issues/174)) ([ce23e91](https://github.com/istanbuljs/istanbuljs/commit/ce23e91)) - - -### BREAKING CHANGES - -* babel@7 drops Node@4 support - - - - - -## [1.10.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.0...istanbul-lib-instrument@1.10.1) (2018-03-09) - - -### Bug Fixes - -* default value for ignorelassMethods ([#151](https://github.com/istanbuljs/istanbuljs/issues/151)) ([5dd88e8](https://github.com/istanbuljs/istanbuljs/commit/5dd88e8)) - - - - - -# [1.10.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.2...istanbul-lib-instrument@1.10.0) (2018-03-04) - - -### Features - -* allows an array of ignored method names to be provided ([#127](https://github.com/istanbuljs/istanbuljs/issues/127)) ([67918e2](https://github.com/istanbuljs/istanbuljs/commit/67918e2)) - - - - - -## [1.9.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.1...istanbul-lib-instrument@1.9.2) (2018-02-13) - - -### Bug Fixes - -* compatibility with babel 7 ([#135](https://github.com/istanbuljs/istanbuljs/issues/135)) ([6cac849](https://github.com/istanbuljs/istanbuljs/commit/6cac849)) -* handle instrumentation when a function is called Function ([#131](https://github.com/istanbuljs/istanbuljs/issues/131)) ([b12a07e](https://github.com/istanbuljs/istanbuljs/commit/b12a07e)) -* proper passing of the preserveComments option to babel ([#122](https://github.com/istanbuljs/istanbuljs/issues/122)) ([470bb0e](https://github.com/istanbuljs/istanbuljs/commit/470bb0e)) -* update instrument, account for lack of arrow expression ([#119](https://github.com/istanbuljs/istanbuljs/issues/119)) ([#125](https://github.com/istanbuljs/istanbuljs/issues/125)) ([0968206](https://github.com/istanbuljs/istanbuljs/commit/0968206)) - - - - - -## [1.9.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.0...istanbul-lib-instrument@1.9.1) (2017-10-22) - - -### Bug Fixes - -* address issue with class instrumentation ([#111](https://github.com/istanbuljs/istanbuljs/issues/111)) ([cbd1c14](https://github.com/istanbuljs/istanbuljs/commit/cbd1c14)) - - - - - -# [1.9.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.8.0...istanbul-lib-instrument@1.9.0) (2017-10-21) - - -### Bug Fixes - -* support conditional expression for superClass ([#106](https://github.com/istanbuljs/istanbuljs/issues/106)) ([aae256f](https://github.com/istanbuljs/istanbuljs/commit/aae256f)) - - -### Features - -* add support for ignoring entire files ([#108](https://github.com/istanbuljs/istanbuljs/issues/108)) ([f12da65](https://github.com/istanbuljs/istanbuljs/commit/f12da65)) - - - - - -# [1.8.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.5...istanbul-lib-instrument@1.8.0) (2017-09-05) - - -### Features - -* add support for object-spread syntax ([#82](https://github.com/istanbuljs/istanbuljs/issues/82)) ([28d5566](https://github.com/istanbuljs/istanbuljs/commit/28d5566)) - - - - - -## [1.7.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.4...istanbul-lib-instrument@1.7.5) (2017-08-23) - - -### Bug Fixes - -* name of function is now preserved or named exports ([#79](https://github.com/istanbuljs/istanbuljs/issues/79)) ([2ce8974](https://github.com/istanbuljs/istanbuljs/commit/2ce8974)) - - - - - -## [1.7.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.3...istanbul-lib-instrument@1.7.4) (2017-07-16) - - -### Bug Fixes - -* update increment operator to appropriate expression type ([#74](https://github.com/istanbuljs/istanbuljs/issues/74)) ([dc69e66](https://github.com/istanbuljs/istanbuljs/commit/dc69e66)) - - - - - -## [1.7.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.2...istanbul-lib-instrument@1.7.3) (2017-06-25) - - - - - -## [1.7.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.1...istanbul-lib-instrument@1.7.2) (2017-05-27) - - -### Bug Fixes - -* hoist statement counter for class variables, so that name is preserved ([#60](https://github.com/istanbuljs/istanbuljs/issues/60)) ([120d221](https://github.com/istanbuljs/istanbuljs/commit/120d221)) - - - - - -## [1.7.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.7.0...istanbul-lib-instrument@1.7.1) (2017-04-29) - - -### Bug Fixes - -* don't instrument a file if it has already been instrumented ([#38](https://github.com/istanbuljs/istanbuljs/issues/38)) ([9c38e4e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9c38e4e)) - - - - - -# [1.7.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.2...istanbul-lib-instrument@1.7.0) (2017-03-27) - - -### Features - -* use extended babylon support; adding features such as jsx ([#22](https://github.com/istanbuljs/istanbuljs/issues/22)) ([11c2438](https://github.com/istanbuljs/istanbul-lib-instrument/commit/11c2438)) - - -## [1.6.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.1...istanbul-lib-instrument@1.6.2) (2017-03-22) - - -### Bug Fixes - -* loc is sometimes not defined, so loc.start fails see [#99](https://github.com/istanbuljs/istanbuljs/issues/99) ([#18](https://github.com/istanbuljs/istanbuljs/issues/18)) ([df85ba6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/df85ba6)) - - -## [1.6.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.0...istanbul-lib-instrument@1.6.1) (2017-03-21) - - -# [1.6.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.4.2...istanbul-lib-instrument@1.6.0) (2017-03-21) - - -### Features - -* adds line number property back to coverage.json ([b03b927](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b03b927)) - - -## [1.4.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.1...v1.4.2) (2017-01-04) - - -### Bug Fixes - -* only hoist counter for a smaller subset of function declarations ([9f8931e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9f8931e)) - - - - -## [1.4.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.0...v1.4.1) (2017-01-04) - - -### Bug Fixes - -* address regression discussed in https://github.com/istanbuljs/babel-plugin-istanbul/issues/78 ([#40](https://github.com/istanbuljs/istanbul-lib-instrument/issues/40)) ([7f458a3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7f458a3)) - - - - -# [1.4.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.1...v1.4.0) (2017-01-02) - - -### Features - -* preserve inferred function names ([#38](https://github.com/istanbuljs/istanbul-lib-instrument/issues/38)) ([312666e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/312666e)) - - - - -## [1.3.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.0...v1.3.1) (2016-12-27) - - -### Bug Fixes - -* function declaration assignment now retains function name ([#33](https://github.com/istanbuljs/istanbul-lib-instrument/issues/33)) ([2d781da](https://github.com/istanbuljs/istanbul-lib-instrument/commit/2d781da)) - - - - -# [1.3.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.2.0...v1.3.0) (2016-11-10) - - -### Features - -* allow an input source-map to be passed to instrumentSync() ([#23](https://github.com/istanbuljs/istanbul-lib-instrument/issues/23)) ([b08e4f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b08e4f5)) - - - - -# [1.2.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.4...v1.2.0) (2016-10-25) - - -### Features - -* implement function to extract empty coverage data from an instrumented file ([#28](https://github.com/istanbuljs/istanbul-lib-instrument/issues/28)) ([06d0ef6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/06d0ef6)) - - - - -## [1.1.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.3...v1.1.4) (2016-10-17) - - -### Bug Fixes - -* hoist coverage variable to very top of file ([#26](https://github.com/istanbuljs/istanbul-lib-instrument/issues/26)) ([0225e8c](https://github.com/istanbuljs/istanbul-lib-instrument/commit/0225e8c)) - - - - -## [1.1.3](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.2...v1.1.3) (2016-09-13) - - -### Performance Improvements - -* simplify coverage variable naming https://github.com/istanbuljs/istanbul-lib-instrument/pull/24 ([7252aae](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7252aae)) - - - - -## [1.1.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.1...v1.1.2) (2016-09-08) - - -### Performance Improvements - -* use zero-based numeric indices for much faster instrumented code ([#22](https://github.com/istanbuljs/istanbul-lib-instrument/issues/22)) ([5b401f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/5b401f5)) - - - - -## [1.1.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0...v1.1.1) (2016-08-30) - - -### Bug Fixes - -* upgrade istanbul-lib-coverage ([eb9b1f6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/eb9b1f6)) - - - - -# [1.1.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0-alpha.4...v1.1.0) (2016-08-11) - - -### Bug Fixes - -* guard against invalid loc ([#16](https://github.com/istanbuljs/istanbul-lib-instrument/issues/16)) ([23ebfc3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/23ebfc3)) - - - - -# [1.1.0-alpha.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.0.0-alpha.5...v1.1.0-alpha.4) (2016-07-20) - - -### Bug Fixes - -* require more performant babel-generator ([#15](https://github.com/istanbuljs/istanbul-lib-instrument/issues/15)) ([21b2563](https://github.com/istanbuljs/istanbul-lib-instrument/commit/21b2563)) diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/LICENSE b/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/LICENSE deleted file mode 100644 index d55d2916e..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2012-2015 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/package.json b/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/package.json deleted file mode 100644 index cf344c139..000000000 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "istanbul-lib-instrument", - "version": "5.1.0", - "description": "Core istanbul API for JS code coverage", - "author": "Krishnan Anantheswaran ", - "main": "src/index.js", - "files": [ - "src" - ], - "scripts": { - "test": "nyc mocha" - }, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "devDependencies": { - "@babel/cli": "^7.7.5", - "chai": "^4.2.0", - "clone": "^2.1.2", - "debug": "^4.1.1", - "documentation": "^12.1.4", - "js-yaml": "^3.13.1", - "mocha": "^6.2.3", - "nopt": "^4.0.1", - "nyc": "^15.1.0" - }, - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/istanbuljs/istanbuljs/issues" - }, - "homepage": "https://istanbul.js.org/", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", - "directory": "packages/istanbul-lib-instrument" - }, - "keywords": [ - "coverage", - "istanbul", - "js", - "instrumentation" - ], - "engines": { - "node": ">=8" - } -} diff --git a/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.d.ts b/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.d.ts index a15e9d4a1..018afa6e6 100644 --- a/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.d.ts +++ b/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.d.ts @@ -1,3 +1,9 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * @@ -6,5 +12,9 @@ * */ export declare const escapePathForRegex: (dir: string) => string; + export declare const escapeStrForRegex: (string: string) => string; + export declare const replacePathSepForRegex: (string: string) => string; + +export {}; diff --git a/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.js b/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.js index de70a0833..114b73bf6 100644 --- a/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.js +++ b/node_modules/@jest/transform/node_modules/jest-regex-util/build/index.js @@ -38,7 +38,7 @@ const replacePathSepForRegex = string => { if (_path.sep === '\\') { return string.replace( /(\/|(.)?\\(?![[\]{}()*+?.^$|\\]))/g, - (_match, _, p2) => (p2 && p2 !== '\\' ? p2 + '\\\\' : '\\\\') + (_match, _, p2) => (p2 && p2 !== '\\' ? `${p2}\\\\` : '\\\\') ); } diff --git a/node_modules/@jest/transform/node_modules/jest-regex-util/package.json b/node_modules/@jest/transform/node_modules/jest-regex-util/package.json index b19b990ef..df39618ad 100644 --- a/node_modules/@jest/transform/node_modules/jest-regex-util/package.json +++ b/node_modules/@jest/transform/node_modules/jest-regex-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-regex-util", - "version": "27.5.1", + "version": "28.0.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,7 +10,7 @@ "@types/node": "*" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -25,5 +25,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" } diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/ErrorWithStack.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/ErrorWithStack.d.ts deleted file mode 100644 index 30a8dd313..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/ErrorWithStack.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default class ErrorWithStack extends Error { - constructor(message: string | undefined, callsite: (...args: Array) => unknown, stackLimit?: number); -} diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/clearLine.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/clearLine.d.ts deleted file mode 100644 index cf56b982c..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/clearLine.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function clearLine(stream: NodeJS.WriteStream): void; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.d.ts deleted file mode 100644 index 4d406660b..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function convertDescriptorToString(descriptor: T): T | string; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.js b/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.js index 4b776af57..a2b7066cf 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.js +++ b/node_modules/@jest/transform/node_modules/jest-util/build/convertDescriptorToString.js @@ -11,31 +11,24 @@ exports.default = convertDescriptorToString; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - -/* eslint-disable local/ban-types-eventually */ -// See: https://github.com/facebook/jest/pull/5154 function convertDescriptorToString(descriptor) { - if ( - typeof descriptor === 'string' || - typeof descriptor === 'number' || - descriptor === undefined - ) { - return descriptor; - } + switch (typeof descriptor) { + case 'function': + if (descriptor.name) { + return descriptor.name; + } - if (typeof descriptor !== 'function') { - throw new Error('describe expects a class, function, number, or string.'); - } + break; - if (descriptor.name !== undefined) { - return descriptor.name; - } // Fallback for old browsers, pardon Flow + case 'number': + case 'undefined': + return `${descriptor}`; + + case 'string': + return descriptor; + } - const stringified = descriptor.toString(); - const typeDescriptorMatch = stringified.match(/class|function/); - const indexOfNameSpace = // @ts-expect-error: typeDescriptorMatch exists - typeDescriptorMatch.index + typeDescriptorMatch[0].length; - const indexOfNameAfterSpace = stringified.search(/\(|\{/); - const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace); - return name.trim(); + throw new Error( + `Invalid first argument, ${descriptor}. It must be a named class, named function, number, or string.` + ); } diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/createDirectory.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/createDirectory.d.ts deleted file mode 100644 index 7e3e01625..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/createDirectory.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function createDirectory(path: Config.Path): void; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.d.ts deleted file mode 100644 index 29e0db5f4..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function createProcessObject(): NodeJS.Process; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.js b/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.js index afc48948c..ec35a42ad 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.js +++ b/node_modules/@jest/transform/node_modules/jest-util/build/createProcessObject.js @@ -30,7 +30,7 @@ function createProcessEnv() { function deletePropertyWin32(_target, key) { for (const name in real) { - if (real.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(real, name)) { if (typeof key === 'string') { if (name.toLowerCase() === key.toLowerCase()) { delete real[name]; @@ -71,7 +71,7 @@ function createProcessEnv() { get: isWin32 ? getPropertyWin32 : getProperty, set(_target, key, value) { - const strValue = '' + value; + const strValue = `${value}`; if (typeof key === 'string') { lookup[key.toLowerCase()] = strValue; @@ -98,9 +98,7 @@ function createProcessObject() { } catch (e) { // Make sure it's actually set instead of potentially ignoring errors if (newProcess[Symbol.toStringTag] !== 'process') { - e.message = - 'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' + - e.message; + e.message = `Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n${e.message}`; throw e; } } // Sequentially execute all constructors over the object. diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.d.ts deleted file mode 100644 index f8bd716c5..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type DeepCyclicCopyOptions = { - blacklist?: Set; - keepPrototype?: boolean; -}; -export default function deepCyclicCopy(value: T, options?: DeepCyclicCopyOptions, cycles?: WeakMap): T; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.js b/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.js index e76e34bf2..7a81dbc1e 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.js +++ b/node_modules/@jest/transform/node_modules/jest-util/build/deepCyclicCopy.js @@ -21,7 +21,7 @@ function deepCyclicCopy( }, cycles = new WeakMap() ) { - if (typeof value !== 'object' || value === null) { + if (typeof value !== 'object' || value === null || Buffer.isBuffer(value)) { return value; } else if (cycles.has(value)) { return cycles.get(value); diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/formatTime.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/formatTime.d.ts deleted file mode 100644 index fc4cd8d75..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/formatTime.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function formatTime(time: number, prefixPower?: number, padLeftLength?: number): string; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/globsToMatcher.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/globsToMatcher.d.ts deleted file mode 100644 index 021ff9e28..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/globsToMatcher.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -declare type Matcher = (str: Config.Path) => boolean; -/** - * Converts a list of globs into a function that matches a path against the - * globs. - * - * Every time picomatch is called, it will parse the glob strings and turn - * them into regexp instances. Instead of calling picomatch repeatedly with - * the same globs, we can use this function which will build the picomatch - * matchers ahead of time and then have an optimized path for determining - * whether an individual path matches. - * - * This function is intended to match the behavior of `micromatch()`. - * - * @example - * const isMatch = globsToMatcher(['*.js', '!*.test.js']); - * isMatch('pizza.js'); // true - * isMatch('pizza.test.js'); // false - */ -export default function globsToMatcher(globs: Array): Matcher; -export {}; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/index.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/index.d.ts index 118162ebe..3b55159b4 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/index.d.ts +++ b/node_modules/@jest/transform/node_modules/jest-util/build/index.d.ts @@ -4,22 +4,122 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as clearLine } from './clearLine'; -export { default as createDirectory } from './createDirectory'; -export { default as ErrorWithStack } from './ErrorWithStack'; -export { default as installCommonGlobals } from './installCommonGlobals'; -export { default as interopRequireDefault } from './interopRequireDefault'; -export { default as isInteractive } from './isInteractive'; -export { default as isPromise } from './isPromise'; -export { default as setGlobal } from './setGlobal'; -export { default as deepCyclicCopy } from './deepCyclicCopy'; -export { default as convertDescriptorToString } from './convertDescriptorToString'; -export * as specialChars from './specialChars'; -export { default as replacePathSepForGlob } from './replacePathSepForGlob'; -export { default as testPathPatternToRegExp } from './testPathPatternToRegExp'; -export { default as globsToMatcher } from './globsToMatcher'; -export * as preRunMessage from './preRunMessage'; -export { default as pluralize } from './pluralize'; -export { default as formatTime } from './formatTime'; -export { default as tryRealpath } from './tryRealpath'; -export { default as requireOrImportModule } from './requireOrImportModule'; +/// + +import type {Config} from '@jest/types'; +import type {Global} from '@jest/types'; + +declare const ARROW = ' \u203A '; + +declare const CLEAR: string; + +export declare function clearLine(stream: NodeJS.WriteStream): void; + +export declare function convertDescriptorToString( + descriptor: Global.BlockNameLike | undefined, +): string; + +export declare function createDirectory(path: string): void; + +export declare function deepCyclicCopy( + value: T, + options?: DeepCyclicCopyOptions, + cycles?: WeakMap, +): T; + +declare type DeepCyclicCopyOptions = { + blacklist?: Set; + keepPrototype?: boolean; +}; + +export declare class ErrorWithStack extends Error { + constructor( + message: string | undefined, + callsite: (...args: Array) => unknown, + stackLimit?: number, + ); +} + +export declare function formatTime( + time: number, + prefixPower?: number, + padLeftLength?: number, +): string; + +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ +export declare function globsToMatcher(globs: Array): Matcher; + +declare const ICONS: { + failed: string; + pending: string; + success: string; + todo: string; +}; + +export declare function installCommonGlobals( + globalObject: typeof globalThis, + globals: Config.ConfigGlobals, +): typeof globalThis & Config.ConfigGlobals; + +export declare function interopRequireDefault(obj: any): any; + +export declare const isInteractive: boolean; + +export declare const isPromise: ( + candidate: unknown, +) => candidate is Promise; + +declare type Matcher = (str: string) => boolean; + +export declare function pluralize(word: string, count: number): string; + +declare namespace preRunMessage { + export {print_2 as print, remove}; +} +export {preRunMessage}; + +declare const print_2: (stream: NodeJS.WriteStream) => void; + +declare const remove: (stream: NodeJS.WriteStream) => void; + +export declare function replacePathSepForGlob(path: string): string; + +export declare function requireOrImportModule( + filePath: string, + applyInteropRequireDefault?: boolean, +): Promise; + +export declare function setGlobal( + globalToMutate: typeof globalThis | Global.Global, + key: string, + value: unknown, +): void; + +declare namespace specialChars { + export {ARROW, ICONS, CLEAR}; +} +export {specialChars}; + +export declare function testPathPatternToRegExp( + testPathPattern: Config.GlobalConfig['testPathPattern'], +): RegExp; + +export declare function tryRealpath(path: string): string; + +export {}; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/index.js b/node_modules/@jest/transform/node_modules/jest-util/build/index.js index 64b076e90..f23c93aba 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/index.js +++ b/node_modules/@jest/transform/node_modules/jest-util/build/index.js @@ -108,6 +108,14 @@ Object.defineProperty(exports, 'tryRealpath', { } }); +var preRunMessage = _interopRequireWildcard(require('./preRunMessage')); + +exports.preRunMessage = preRunMessage; + +var specialChars = _interopRequireWildcard(require('./specialChars')); + +exports.specialChars = specialChars; + var _clearLine = _interopRequireDefault2(require('./clearLine')); var _createDirectory = _interopRequireDefault2(require('./createDirectory')); @@ -134,10 +142,6 @@ var _convertDescriptorToString = _interopRequireDefault2( require('./convertDescriptorToString') ); -var _specialChars = _interopRequireWildcard(require('./specialChars')); - -exports.specialChars = _specialChars; - var _replacePathSepForGlob = _interopRequireDefault2( require('./replacePathSepForGlob') ); @@ -148,10 +152,6 @@ var _testPathPatternToRegExp = _interopRequireDefault2( var _globsToMatcher = _interopRequireDefault2(require('./globsToMatcher')); -var _preRunMessage = _interopRequireWildcard(require('./preRunMessage')); - -exports.preRunMessage = _preRunMessage; - var _pluralize = _interopRequireDefault2(require('./pluralize')); var _formatTime = _interopRequireDefault2(require('./formatTime')); @@ -162,6 +162,10 @@ var _requireOrImportModule = _interopRequireDefault2( require('./requireOrImportModule') ); +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== 'function') return null; var cacheBabelInterop = new WeakMap(); @@ -203,7 +207,3 @@ function _interopRequireWildcard(obj, nodeInterop) { } return newObj; } - -function _interopRequireDefault2(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.d.ts deleted file mode 100644 index c93689efa..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function installCommonGlobals(globalObject: typeof globalThis, globals: Config.ConfigGlobals): typeof globalThis & Config.ConfigGlobals; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.js b/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.js index 509ceee1a..6435f75d2 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.js +++ b/node_modules/@jest/transform/node_modules/jest-util/build/installCommonGlobals.js @@ -73,7 +73,7 @@ function _interopRequireWildcard(obj, nodeInterop) { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -const DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE')); +const DTRACE = Object.keys(globalThis).filter(key => key.startsWith('DTRACE')); function installCommonGlobals(globalObject, globals) { globalObject.process = (0, _createProcessObject.default)(); @@ -116,7 +116,7 @@ function installCommonGlobals(globalObject, globals) { // @ts-expect-error: no index globalObject[dtrace] = function (...args) { // @ts-expect-error: no index - return global[dtrace].apply(this, args); + return globalThis[dtrace].apply(this, args); }; }); return Object.assign(globalObject, (0, _deepCyclicCopy.default)(globals)); diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/interopRequireDefault.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/interopRequireDefault.d.ts deleted file mode 100644 index 91b66e4fc..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/interopRequireDefault.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function interopRequireDefault(obj: any): any; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/isInteractive.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/isInteractive.d.ts deleted file mode 100644 index 57ddbf0a7..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/isInteractive.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const _default: boolean; -export default _default; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.d.ts deleted file mode 100644 index ea8589b90..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const isPromise: (candidate: unknown) => candidate is Promise; -export default isPromise; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.js b/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.js index 7158df850..5a7202064 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.js +++ b/node_modules/@jest/transform/node_modules/jest-util/build/isPromise.js @@ -11,8 +11,8 @@ exports.default = void 0; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// capture global.Promise before it may potentially be overwritten -const Promise = global.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 +// capture globalThis.Promise before it may potentially be overwritten +const Promise = globalThis.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 const isPromise = candidate => Promise.resolve(candidate) === candidate; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/pluralize.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/pluralize.d.ts deleted file mode 100644 index 9be305792..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/pluralize.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function pluralize(word: string, count: number): string; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/preRunMessage.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/preRunMessage.d.ts deleted file mode 100644 index 55acad973..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/preRunMessage.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export declare const print: (stream: NodeJS.WriteStream) => void; -export declare const remove: (stream: NodeJS.WriteStream) => void; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/replacePathSepForGlob.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/replacePathSepForGlob.d.ts deleted file mode 100644 index 7f47d18bf..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/replacePathSepForGlob.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function replacePathSepForGlob(path: Config.Path): Config.Glob; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/requireOrImportModule.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/requireOrImportModule.d.ts deleted file mode 100644 index b27bd9477..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/requireOrImportModule.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function requireOrImportModule(filePath: Config.Path, applyInteropRequireDefault?: boolean): Promise; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/setGlobal.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/setGlobal.d.ts deleted file mode 100644 index 94e0e7642..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/setGlobal.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function setGlobal(globalToMutate: typeof globalThis, key: string, value: unknown): void; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/specialChars.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/specialChars.d.ts deleted file mode 100644 index 1a50d4954..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/specialChars.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare const ARROW = " \u203A "; -export declare const ICONS: { - failed: string; - pending: string; - success: string; - todo: string; -}; -export declare const CLEAR: string; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/testPathPatternToRegExp.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/testPathPatternToRegExp.d.ts deleted file mode 100644 index 115aadfaa..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/testPathPatternToRegExp.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function testPathPatternToRegExp(testPathPattern: Config.GlobalConfig['testPathPattern']): RegExp; diff --git a/node_modules/@jest/transform/node_modules/jest-util/build/tryRealpath.d.ts b/node_modules/@jest/transform/node_modules/jest-util/build/tryRealpath.d.ts deleted file mode 100644 index cccdfa0e5..000000000 --- a/node_modules/@jest/transform/node_modules/jest-util/build/tryRealpath.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function tryRealpath(path: Config.Path): Config.Path; diff --git a/node_modules/@jest/transform/node_modules/jest-util/package.json b/node_modules/@jest/transform/node_modules/jest-util/package.json index f1b9788a3..1bd8f7d17 100644 --- a/node_modules/@jest/transform/node_modules/jest-util/package.json +++ b/node_modules/@jest/transform/node_modules/jest-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-util", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,7 +17,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -25,15 +25,14 @@ "picomatch": "^2.2.3" }, "devDependencies": { - "@types/graceful-fs": "^4.1.2", - "@types/micromatch": "^4.0.1", + "@types/graceful-fs": "^4.1.3", "@types/picomatch": "^2.2.2" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jest/transform/node_modules/micromatch/CHANGELOG.md b/node_modules/@jest/transform/node_modules/micromatch/CHANGELOG.md deleted file mode 100644 index fc6d456ad..000000000 --- a/node_modules/@jest/transform/node_modules/micromatch/CHANGELOG.md +++ /dev/null @@ -1,109 +0,0 @@ -# Release history - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## [4.0.0] - 2019-03-20 - -### Added - -- Adds support for `options.onMatch`. See the readme for details -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - - -### Breaking changes - -- Require Node.js >= 8.6 -- Removed support for passing an array of brace patterns to `micromatch.braces()`. -- To strictly enforce closing brackets (for `{`, `[`, and `(`), you must now use `strictBrackets=true` instead of `strictErrors`. -- `cache` - caching and all related options and methods have been removed -- `options.unixify` was renamed to `options.windows` -- `options.nodupes` Was removed. Duplicates are always removed by default. You can override this with custom behavior by using the `onMatch`, `onResult` and `onIgnore` functions. -- `options.snapdragon` was removed, as snapdragon is no longer used. -- `options.sourcemap` was removed, as snapdragon is no longer used, which provided sourcemap support. - -## [3.0.0] - 2017-04-11 - -Complete overhaul, with 36,000+ new unit tests validated against actual output generated by Bash and minimatch. More specifically, 35,000+ of the tests: - - - micromatch results are directly compared to bash results - - in rare cases, when micromatch and bash disagree, micromatch's results are compared to minimatch's results - - micromatch is much more accurate than minimatch, so there were cases where I had to make assumptions. I'll try to document these. - -This refactor introduces a parser and compiler that are supersets of more granular parsers and compilers from other sub-modules. Each of these sub-modules has a singular responsibility and focuses on a certain type of matching that aligns with a specific part of the Bash "expansion" API. - -These sub-modules work like plugins to seamlessly create the micromatch parser/compiler, so that strings are parsed in one pass, an [AST is created](https://gist.github.com/jonschlinkert/099c8914f56529f75bc757cc9e5e8e2a), then a new string is generated by the compiler. - -Here are those sub-modules with links to related prs on those modules if you want to see how they contribute to this code: - -[nanomatch](https://github.com/jonschlinkert/nanomatch) (new library) - glob expansion (`*`, `**`, `?` and `[...]`)) -[braces](https://github.com/jonschlinkert/braces/pull/10) - brace expansion (`{1..10}`, `{a,b,c}`, etc) -[extglob](https://github.com/jonschlinkert/extglob/pull/5) - extended globs (`!(a|b)`, `@(!(foo|bar))`, etc) -[expand-brackets](https://github.com/jonschlinkert/expand-brackets/pull/5) - POSIX character classes `[[:alpha:][:digit:]]` - -**Added** - - - source map support (optionally created when using parse or compile - I have no idea what the use case is yet, but they come for free) (note that source maps are not generated for brace expansion at present, since the braces compiler uses a different strategy. I'll update if/when this changes). - - parser is exposed, so that implementors can customize or override specific micromatch parsers if necessary - - compiler is exposed, so that implementors can customize or override specific micromatch compilers if necessary - -**Fixed** - - - more accurate matching (passes 100% of Bash 4.3 of the brace expansion and extglob unit tests, as well as all Bash glob tests that are relevant to node.js usage, all minimatch tests, all brace-expansion tests, and also passes a couple of tests that bash fails) - - even safer - micromatch has always generated optimized patterns so it's not subject to DoS exploits like minimatch (completely different than the regex DoS issue, minimatch and multimatch are still openly exposed to being used for DoS attacks), but more safeguards were built into this refactor - -**Changed** - - - the public API of this library did not change in this version and should be safe to upgrade without changing implentor code. However, we have released this as a major version for the following reasons: - - out of an abundance of caution due to the large amount of code changed in this release - - we have improved parser accuracy to such a degree that some implementors using invalid globs have noted change in behavior. If this is the case for you, please check that you are using a valid glob expression before logging a bug with this library - -## [1.0.1] - 2016-12-12 - -**Added** - -- Support for windows path edge cases where backslashes are used in brackets or other unusual combinations. - -## [1.0.0] - 2016-12-12 - -Stable release. - -## [0.1.0] - 2016-10-08 - -First release. - - -[Unreleased]: https://github.com/jonschlinkert/micromatch/compare/0.1.0...HEAD -[0.2.0]: https://github.com/jonschlinkert/micromatch/compare/0.1.0...0.2.0 - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/@jest/transform/node_modules/micromatch/LICENSE b/node_modules/@jest/transform/node_modules/micromatch/LICENSE deleted file mode 100755 index 9af4a67d2..000000000 --- a/node_modules/@jest/transform/node_modules/micromatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@jest/transform/node_modules/micromatch/README.md b/node_modules/@jest/transform/node_modules/micromatch/README.md deleted file mode 100644 index c69252976..000000000 --- a/node_modules/@jest/transform/node_modules/micromatch/README.md +++ /dev/null @@ -1,1008 +0,0 @@ -# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Linux Build Status](https://img.shields.io/travis/micromatch/micromatch.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/micromatch) - -> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Table of Contents - -
-Details - -- [Install](#install) -- [Quickstart](#quickstart) -- [Why use micromatch?](#why-use-micromatch) - * [Matching features](#matching-features) -- [Switching to micromatch](#switching-to-micromatch) - * [From minimatch](#from-minimatch) - * [From multimatch](#from-multimatch) -- [API](#api) -- [Options](#options) -- [Options Examples](#options-examples) - * [options.basename](#optionsbasename) - * [options.bash](#optionsbash) - * [options.expandRange](#optionsexpandrange) - * [options.format](#optionsformat) - * [options.ignore](#optionsignore) - * [options.matchBase](#optionsmatchbase) - * [options.noextglob](#optionsnoextglob) - * [options.nonegate](#optionsnonegate) - * [options.noglobstar](#optionsnoglobstar) - * [options.nonull](#optionsnonull) - * [options.nullglob](#optionsnullglob) - * [options.onIgnore](#optionsonignore) - * [options.onMatch](#optionsonmatch) - * [options.onResult](#optionsonresult) - * [options.posixSlashes](#optionsposixslashes) - * [options.unescape](#optionsunescape) -- [Extended globbing](#extended-globbing) - * [Extglobs](#extglobs) - * [Braces](#braces) - * [Regex character classes](#regex-character-classes) - * [Regex groups](#regex-groups) - * [POSIX bracket expressions](#posix-bracket-expressions) -- [Notes](#notes) - * [Bash 4.3 parity](#bash-43-parity) - * [Backslashes](#backslashes) -- [Benchmarks](#benchmarks) - * [Running benchmarks](#running-benchmarks) - * [Latest results](#latest-results) -- [Contributing](#contributing) -- [About](#about) - -
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save micromatch -``` - -## Quickstart - -```js -const micromatch = require('micromatch'); -// micromatch(list, patterns[, options]); -``` - -The [main export](#micromatch) takes a list of strings and one or more glob patterns: - -```js -console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['f*', 'b*'])) //=> ['foo', 'bar', 'baz'] -console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['*', '!b*'])) //=> ['foo', 'qux'] -``` - -Use [.isMatch()](#ismatch) to for boolean matching: - -```js -console.log(micromatch.isMatch('foo', 'f*')) //=> true -console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true -``` - -[Switching](#switching-to-micromatch) from minimatch and multimatch is easy! - -
- -## Why use micromatch? - -> micromatch is a [replacement](#switching-to-micromatch) for minimatch and multimatch - -* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) -* More complete support for the Bash 4.3 specification than minimatch and multimatch. Micromatch passes _all of the spec tests_ from bash, including some that bash still fails. -* **Fast & Performant** - Loads in about 5ms and performs [fast matches](#benchmarks). -* **Glob matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories -* **[Advanced globbing](#extended-globbing)** - Supports [extglobs](#extglobs), [braces](#braces-1), and [POSIX brackets](#posix-bracket-expressions), and support for escaping special characters with `\` or quotes. -* **Accurate** - Covers more scenarios [than minimatch](https://github.com/yarnpkg/yarn/pull/3339) -* **Well tested** - More than 5,000 [test assertions](./test) -* **Windows support** - More reliable windows support than minimatch and multimatch. -* **[Safe](https://github.com/micromatch/braces#braces-is-safe)** - Micromatch is not subject to DoS with brace patterns like minimatch and multimatch. - -### Matching features - -* Support for multiple glob patterns (no need for wrappers like multimatch) -* Wildcards (`**`, `*.js`) -* Negation (`'!a/*.js'`, `'*!(b).js']`) -* [extglobs](#extglobs) (`+(x|y)`, `!(a|b)`) -* [POSIX character classes](#posix-bracket-expressions) (`[[:alpha:][:digit:]]`) -* [brace expansion](https://github.com/micromatch/braces) (`foo/{1..5}.md`, `bar/{a,b,c}.js`) -* regex character classes (`foo-[1-5].js`) -* regex logical "or" (`foo/(abc|xyz).js`) - -You can mix and match these features to create whatever patterns you need! - -## Switching to micromatch - -_(There is one notable difference between micromatch and minimatch in regards to how backslashes are handled. See [the notes about backslashes](#backslashes) for more information.)_ - -### From minimatch - -Use [micromatch.isMatch()](#ismatch) instead of `minimatch()`: - -```js -console.log(micromatch.isMatch('foo', 'b*')); //=> false -``` - -Use [micromatch.match()](#match) instead of `minimatch.match()`: - -```js -console.log(micromatch.match(['foo', 'bar'], 'b*')); //=> 'bar' -``` - -### From multimatch - -Same signature: - -```js -console.log(micromatch(['foo', 'bar', 'baz'], ['f*', '*z'])); //=> ['foo', 'baz'] -``` - -## API - -**Params** - -* `list` **{String|Array}**: List of strings to match. -* `patterns` **{String|Array}**: One or more glob patterns to use for matching. -* `options` **{Object}**: See available [options](#options) -* `returns` **{Array}**: Returns an array of matches - -**Example** - -```js -const mm = require('micromatch'); -// mm(list, patterns[, options]); - -console.log(mm(['a.js', 'a.txt'], ['*.js'])); -//=> [ 'a.js' ] -``` - -### [.matcher](index.js#L104) - -Returns a matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match. - -**Params** - -* `pattern` **{String}**: Glob pattern -* `options` **{Object}** -* `returns` **{Function}**: Returns a matcher function. - -**Example** - -```js -const mm = require('micromatch'); -// mm.matcher(pattern[, options]); - -const isMatch = mm.matcher('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.isMatch](index.js#L123) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* `str` **{String}**: The string to test. -* `patterns` **{String|Array}**: One or more glob patterns to use for matching. -* `[options]` **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const mm = require('micromatch'); -// mm.isMatch(string, patterns[, options]); - -console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(mm.isMatch('a.a', 'b.*')); //=> false -``` - -### [.not](index.js#L148) - -Returns a list of strings that _**do not match any**_ of the given `patterns`. - -**Params** - -* `list` **{Array}**: Array of strings to match. -* `patterns` **{String|Array}**: One or more glob pattern to use for matching. -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns. - -**Example** - -```js -const mm = require('micromatch'); -// mm.not(list, patterns[, options]); - -console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); -//=> ['b.b', 'c.c'] -``` - -### [.contains](index.js#L188) - -Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. - -**Params** - -* `str` **{String}**: The string to match. -* `patterns` **{String|Array}**: Glob pattern to use for matching. -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Boolean}**: Returns true if any of the patterns matches any part of `str`. - -**Example** - -```js -var mm = require('micromatch'); -// mm.contains(string, pattern[, options]); - -console.log(mm.contains('aa/bb/cc', '*b')); -//=> true -console.log(mm.contains('aa/bb/cc', '*d')); -//=> false -``` - -### [.matchKeys](index.js#L230) - -Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. - -**Params** - -* `object` **{Object}**: The object with keys to filter. -* `patterns` **{String|Array}**: One or more glob patterns to use for matching. -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Object}**: Returns an object with only keys that match the given patterns. - -**Example** - -```js -const mm = require('micromatch'); -// mm.matchKeys(object, patterns[, options]); - -const obj = { aa: 'a', ab: 'b', ac: 'c' }; -console.log(mm.matchKeys(obj, '*b')); -//=> { ab: 'b' } -``` - -### [.some](index.js#L259) - -Returns true if some of the strings in the given `list` match any of the given glob `patterns`. - -**Params** - -* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found. -* `patterns` **{String|Array}**: One or more glob patterns to use for matching. -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Boolean}**: Returns true if any `patterns` matches any of the strings in `list` - -**Example** - -```js -const mm = require('micromatch'); -// mm.some(list, patterns[, options]); - -console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); -// true -console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); -// false -``` - -### [.every](index.js#L295) - -Returns true if every string in the given `list` matches any of the given glob `patterns`. - -**Params** - -* `list` **{String|Array}**: The string or array of strings to test. -* `patterns` **{String|Array}**: One or more glob patterns to use for matching. -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Boolean}**: Returns true if all `patterns` matches all of the strings in `list` - -**Example** - -```js -const mm = require('micromatch'); -// mm.every(list, patterns[, options]); - -console.log(mm.every('foo.js', ['foo.js'])); -// true -console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); -// true -console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); -// false -console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); -// false -``` - -### [.all](index.js#L334) - -Returns true if **all** of the given `patterns` match the specified string. - -**Params** - -* `str` **{String|Array}**: The string to test. -* `patterns` **{String|Array}**: One or more glob patterns to use for matching. -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const mm = require('micromatch'); -// mm.all(string, patterns[, options]); - -console.log(mm.all('foo.js', ['foo.js'])); -// true - -console.log(mm.all('foo.js', ['*.js', '!foo.js'])); -// false - -console.log(mm.all('foo.js', ['*.js', 'foo.js'])); -// true - -console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); -// true -``` - -### [.capture](index.js#L361) - -Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match. - -**Params** - -* `glob` **{String}**: Glob pattern to use for matching. -* `input` **{String}**: String to match -* `options` **{Object}**: See available [options](#options) for changing how matches are performed -* `returns` **{Array|null}**: Returns an array of captures if the input matches the glob pattern, otherwise `null`. - -**Example** - -```js -const mm = require('micromatch'); -// mm.capture(pattern, string[, options]); - -console.log(mm.capture('test/*.js', 'test/foo.js')); -//=> ['foo'] -console.log(mm.capture('test/*.js', 'foo/bar.css')); -//=> null -``` - -### [.makeRe](index.js#L387) - -Create a regular expression from the given glob `pattern`. - -**Params** - -* `pattern` **{String}**: A glob pattern to convert to regex. -* `options` **{Object}** -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const mm = require('micromatch'); -// mm.makeRe(pattern[, options]); - -console.log(mm.makeRe('*.js')); -//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ -``` - -### [.scan](index.js#L403) - -Scan a glob pattern to separate the pattern into segments. Used by the [split](#split) method. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const mm = require('micromatch'); -const state = mm.scan(pattern[, options]); -``` - -### [.parse](index.js#L419) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `glob` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as regex source string. - -**Example** - -```js -const mm = require('micromatch'); -const state = mm(pattern[, options]); -``` - -### [.braces](index.js#L446) - -Process the given brace `pattern`. - -**Params** - -* `pattern` **{String}**: String with brace pattern to process. -* `options` **{Object}**: Any [options](#options) to change how expansion is performed. See the [braces](https://github.com/micromatch/braces) library for all available options. -* `returns` **{Array}** - -**Example** - -```js -const { braces } = require('micromatch'); -console.log(braces('foo/{a,b,c}/bar')); -//=> [ 'foo/(a|b|c)/bar' ] - -console.log(braces('foo/{a,b,c}/bar', { expand: true })); -//=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] -``` - -## Options - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Match dotfiles. Otherwise dotfiles are ignored unless a `.` is explicitly defined in the pattern. | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. This option is overridden by the `expandBrace` option. | -| `failglob` | `boolean` | `false` | Similar to the `failglob` behavior in Bash, throws an error when no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `boolean` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `lookbehinds` | `boolean` | `true` | Support regex positive and negative lookbehinds. Note that you must be using Node 8.1.10 or higher to enable regex lookbehinds. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Perform case-insensitive matching. Equivalent to the regex `i` flag. Note that this option is ignored when the `flags` option is defined. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with [extglobs](#extglobs) (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support [POSIX character classes](#posix-bracket-expressions) ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `string` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove preceding backslashes from escaped glob characters before creating the regular expression to perform matches. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatitibility. | - -## Options Examples - -### options.basename - -Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`. - -**Type**: `Boolean` - -**Default**: `false` - -**Example** - -```js -micromatch(['a/b.js', 'a/c.md'], '*.js'); -//=> [] - -micromatch(['a/b.js', 'a/c.md'], '*.js', { basename: true }); -//=> ['a/b.js'] -``` - -### options.bash - -Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression. Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**. Instead, the star is treated the same as any other star. - -**Type**: `Boolean` - -**Default**: `true` - -**Example** - -```js -const files = ['abc', 'ajz']; -console.log(micromatch(files, '[a-c]*')); -//=> ['abc', 'ajz'] - -console.log(micromatch(files, '[a-c]*', { bash: false })); -``` - -### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a numeric folder name between `01` and `25`, with leading zeros. - -```js -const fill = require('fill-range'); -const regex = micromatch.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex) -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')) //=> true -``` - -### options.ignore - -String or array of glob patterns to match files to ignore. - -**Type**: `String|Array` - -**Default**: `undefined` - -```js -const isMatch = micromatch.matcher('*', { ignore: 'f*' }); -console.log(isMatch('foo')) //=> false -console.log(isMatch('bar')) //=> true -console.log(isMatch('baz')) //=> true -``` - -### options.matchBase - -Alias for [options.basename](#options-basename). - -### options.noextglob - -Disable extglob support, so that [extglobs](#extglobs) are regarded as literal characters. - -**Type**: `Boolean` - -**Default**: `undefined` - -**Examples** - -```js -console.log(micromatch(['a/z', 'a/b', 'a/!(z)'], 'a/!(z)')); -//=> ['a/b', 'a/!(z)'] - -console.log(micromatch(['a/z', 'a/b', 'a/!(z)'], 'a/!(z)', { noextglob: true })); -//=> ['a/!(z)'] (matches only as literal characters) -``` - -### options.nonegate - -Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match. - -**Type**: `Boolean` - -**Default**: `undefined` - -### options.noglobstar - -Disable matching with globstars (`**`). - -**Type**: `Boolean` - -**Default**: `undefined` - -```js -micromatch(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**'); -//=> ['a/b', 'a/b/c', 'a/b/c/d'] - -micromatch(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**', {noglobstar: true}); -//=> ['a/b'] -``` - -### options.nonull - -Alias for [options.nullglob](#options-nullglob). - -### options.nullglob - -If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`. - -**Type**: `Boolean` - -**Default**: `undefined` - -### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); - // { glob: '*', regex: /^(?:(?!\.)(?=.)[^\/]*?\/?)$/, input: 'foo', output: 'foo' } -}; - -const isMatch = micromatch.matcher('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ input, output }); - // { input: 'some\\path', output: 'some/path' } - // { input: 'some\\path', output: 'some/path' } - // { input: 'some\\path', output: 'some/path' } -}; - -const isMatch = micromatch.matcher('**', { onMatch, posixSlashes: true }); -isMatch('some\\path'); -isMatch('some\\path'); -isMatch('some\\path'); -``` - -### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = micromatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -### options.posixSlashes - -Convert path separators on returned files to posix/unix-style forward slashes. Aliased as `unixify` for backwards compatibility. - -**Type**: `Boolean` - -**Default**: `true` on windows, `false` everywhere else. - -**Example** - -```js -console.log(micromatch.match(['a\\b\\c'], 'a/**')); -//=> ['a/b/c'] - -console.log(micromatch.match(['a\\b\\c'], { posixSlashes: false })); -//=> ['a\\b\\c'] -``` - -### options.unescape - -Remove backslashes from escaped glob characters before creating the regular expression to perform matches. - -**Type**: `Boolean` - -**Default**: `undefined` - -**Example** - -In this example we want to match a literal `*`: - -```js -console.log(micromatch.match(['abc', 'a\\*c'], 'a\\*c')); -//=> ['a\\*c'] - -console.log(micromatch.match(['abc', 'a\\*c'], 'a\\*c', { unescape: true })); -//=> ['a*c'] -``` - -
-
- -## Extended globbing - -Micromatch supports the following extended globbing features. - -### Extglobs - -Extended globbing, as described by the bash man page: - -| **pattern** | **regex equivalent** | **description** | -| --- | --- | --- | -| `?(pattern)` | `(pattern)?` | Matches zero or one occurrence of the given patterns | -| `*(pattern)` | `(pattern)*` | Matches zero or more occurrences of the given patterns | -| `+(pattern)` | `(pattern)+` | Matches one or more occurrences of the given patterns | -| `@(pattern)` | `(pattern)` * | Matches one of the given patterns | -| `!(pattern)` | N/A (equivalent regex is much more complicated) | Matches anything except one of the given patterns | - -* Note that `@` isn't a regex character. - -### Braces - -Brace patterns can be used to match specific ranges or sets of characters. - -**Example** - -The pattern `{f,b}*/{1..3}/{b,q}*` would match any of following strings: - -``` -foo/1/bar -foo/2/bar -foo/3/bar -baz/1/qux -baz/2/qux -baz/3/qux -``` - -Visit [braces](https://github.com/micromatch/braces) to see the full range of features and options related to brace expansion, or to create brace matching or expansion related issues. - -### Regex character classes - -Given the list: `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: - -* `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']` -* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` -* `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']` - -Learn about [regex character classes](http://www.regular-expressions.info/charclass.html). - -### Regex groups - -Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: - -* `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']` -* `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']` -* `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']` - -As with regex, parens can be nested, so patterns like `((a|b)|c)/b` will work. Although brace expansion might be friendlier to use, depending on preference. - -### POSIX bracket expressions - -POSIX brackets are intended to be more user-friendly than regex character classes. This of course is in the eye of the beholder. - -**Example** - -```js -console.log(micromatch.isMatch('a1', '[[:alpha:][:digit:]]')) //=> true -console.log(micromatch.isMatch('a1', '[[:alpha:][:alpha:]]')) //=> false -``` - -*** - -## Notes - -### Bash 4.3 parity - -Whenever possible matching behavior is based on behavior Bash 4.3, which is mostly consistent with minimatch. - -However, it's suprising how many edge cases and rabbit holes there are with glob matching, and since there is no real glob specification, and micromatch is more accurate than both Bash and minimatch, there are cases where best-guesses were made for behavior. In a few cases where Bash had no answers, we used wildmatch (used by git) as a fallback. - -### Backslashes - -There is an important, notable difference between minimatch and micromatch _in regards to how backslashes are handled_ in glob patterns. - -* Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows, which is consistent with bash behavior. _More importantly, unescaping globs can result in unsafe regular expressions_. -* Minimatch converts all backslashes to forward slashes, which means you can't use backslashes to escape any characters in your glob patterns. - -We made this decision for micromatch for a couple of reasons: - -* Consistency with bash conventions. -* Glob patterns are not filepaths. They are a type of [regular language](https://en.wikipedia.org/wiki/Regular_language) that is converted to a JavaScript regular expression. Thus, when forward slashes are defined in a glob pattern, the resulting regular expression will match windows or POSIX path separators just fine. - -**A note about joining paths to globs** - -Note that when you pass something like `path.join('foo', '*')` to micromatch, you are creating a filepath and expecting it to still work as a glob pattern. This causes problems on windows, since the `path.sep` is `\\`. - -In other words, since `\\` is reserved as an escape character in globs, on windows `path.join('foo', '*')` would result in `foo\\*`, which tells micromatch to match `*` as a literal character. This is the same behavior as bash. - -To solve this, you might be inspired to do something like `'foo\\*'.replace(/\\/g, '/')`, but this causes another, potentially much more serious, problem. - -## Benchmarks - -### Running benchmarks - -Install dependencies for running benchmarks: - -```sh -$ cd bench && npm install -``` - -Run the benchmarks: - -```sh -$ npm run bench -``` - -### Latest results - -As of April 10, 2021 (longer bars are better): - -```sh -# .makeRe star - micromatch x 2,232,802 ops/sec ±2.34% (89 runs sampled)) - minimatch x 781,018 ops/sec ±6.74% (92 runs sampled)) - -# .makeRe star; dot=true - micromatch x 1,863,453 ops/sec ±0.74% (93 runs sampled) - minimatch x 723,105 ops/sec ±0.75% (93 runs sampled) - -# .makeRe globstar - micromatch x 1,624,179 ops/sec ±2.22% (91 runs sampled) - minimatch x 1,117,230 ops/sec ±2.78% (86 runs sampled)) - -# .makeRe globstars - micromatch x 1,658,642 ops/sec ±0.86% (92 runs sampled) - minimatch x 741,224 ops/sec ±1.24% (89 runs sampled)) - -# .makeRe with leading star - micromatch x 1,525,014 ops/sec ±1.63% (90 runs sampled) - minimatch x 561,074 ops/sec ±3.07% (89 runs sampled) - -# .makeRe - braces - micromatch x 172,478 ops/sec ±2.37% (78 runs sampled) - minimatch x 96,087 ops/sec ±2.34% (88 runs sampled))) - -# .makeRe braces - range (expanded) - micromatch x 26,973 ops/sec ±0.84% (89 runs sampled) - minimatch x 3,023 ops/sec ±0.99% (90 runs sampled)) - -# .makeRe braces - range (compiled) - micromatch x 152,892 ops/sec ±1.67% (83 runs sampled) - minimatch x 992 ops/sec ±3.50% (89 runs sampled)d)) - -# .makeRe braces - nested ranges (expanded) - micromatch x 15,816 ops/sec ±13.05% (80 runs sampled) - minimatch x 2,953 ops/sec ±1.64% (91 runs sampled) - -# .makeRe braces - nested ranges (compiled) - micromatch x 110,881 ops/sec ±1.85% (82 runs sampled) - minimatch x 1,008 ops/sec ±1.51% (91 runs sampled) - -# .makeRe braces - set (compiled) - micromatch x 134,930 ops/sec ±3.54% (63 runs sampled)) - minimatch x 43,242 ops/sec ±0.60% (93 runs sampled) - -# .makeRe braces - nested sets (compiled) - micromatch x 94,455 ops/sec ±1.74% (69 runs sampled)) - minimatch x 27,720 ops/sec ±1.84% (93 runs sampled)) -``` - -## Contributing - -All contributions are welcome! Please read [the contributing guide](.github/contributing.md) to get started. - -**Bug reports** - -Please create an issue if you encounter a bug or matching behavior that doesn't seem correct. If you find a matching-related issue, please: - -* [research existing issues first](../../issues) (open and closed) -* visit the [GNU Bash documentation](https://www.gnu.org/software/bash/manual/) to see how Bash deals with the pattern -* visit the [minimatch](https://github.com/isaacs/minimatch) documentation to cross-check expected behavior in node.js -* if all else fails, since there is no real specification for globs we will probably need to discuss expected behavior and decide how to resolve it. which means any detail you can provide to help with this discussion would be greatly appreciated. - -**Platform issues** - -It's important to us that micromatch work consistently on all platforms. If you encounter any platform-specific matching or path related issues, please let us know (pull requests are also greatly appreciated). - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -You might also be interested in these projects: - -* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.") -* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/micromatch/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") -* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/micromatch/extglob) | [homepage](https://github.com/micromatch/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.") -* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") -* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 508 | [jonschlinkert](https://github.com/jonschlinkert) | -| 12 | [es128](https://github.com/es128) | -| 8 | [doowb](https://github.com/doowb) | -| 6 | [paulmillr](https://github.com/paulmillr) | -| 5 | [mrmlnc](https://github.com/mrmlnc) | -| 4 | [danez](https://github.com/danez) | -| 3 | [DrPizza](https://github.com/DrPizza) | -| 2 | [TrySound](https://github.com/TrySound) | -| 2 | [mceIdo](https://github.com/mceIdo) | -| 2 | [Glazy](https://github.com/Glazy) | -| 2 | [MartinKolarik](https://github.com/MartinKolarik) | -| 2 | [Tvrqvoise](https://github.com/Tvrqvoise) | -| 1 | [amilajack](https://github.com/amilajack) | -| 1 | [Cslove](https://github.com/Cslove) | -| 1 | [devongovett](https://github.com/devongovett) | -| 1 | [DianeLooney](https://github.com/DianeLooney) | -| 1 | [UltCombo](https://github.com/UltCombo) | -| 1 | [frangio](https://github.com/frangio) | -| 1 | [juszczykjakub](https://github.com/juszczykjakub) | -| 1 | [muescha](https://github.com/muescha) | -| 1 | [sebdeckers](https://github.com/sebdeckers) | -| 1 | [tomByrer](https://github.com/tomByrer) | -| 1 | [fidian](https://github.com/fidian) | -| 1 | [simlu](https://github.com/simlu) | -| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | -| 1 | [yvele](https://github.com/yvele) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2021, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 10, 2021._ \ No newline at end of file diff --git a/node_modules/@jest/transform/node_modules/micromatch/index.js b/node_modules/@jest/transform/node_modules/micromatch/index.js deleted file mode 100644 index 7ac922bc0..000000000 --- a/node_modules/@jest/transform/node_modules/micromatch/index.js +++ /dev/null @@ -1,467 +0,0 @@ -'use strict'; - -const util = require('util'); -const braces = require('braces'); -const picomatch = require('picomatch'); -const utils = require('picomatch/lib/utils'); -const isEmptyString = val => val === '' || val === './'; - -/** - * Returns an array of strings that match one or more glob patterns. - * - * ```js - * const mm = require('micromatch'); - * // mm(list, patterns[, options]); - * - * console.log(mm(['a.js', 'a.txt'], ['*.js'])); - * //=> [ 'a.js' ] - * ``` - * @param {String|Array} `list` List of strings to match. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) - * @return {Array} Returns an array of matches - * @summary false - * @api public - */ - -const micromatch = (list, patterns, options) => { - patterns = [].concat(patterns); - list = [].concat(list); - - let omit = new Set(); - let keep = new Set(); - let items = new Set(); - let negatives = 0; - - let onResult = state => { - items.add(state.output); - if (options && options.onResult) { - options.onResult(state); - } - }; - - for (let i = 0; i < patterns.length; i++) { - let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); - let negated = isMatch.state.negated || isMatch.state.negatedExtglob; - if (negated) negatives++; - - for (let item of list) { - let matched = isMatch(item, true); - - let match = negated ? !matched.isMatch : matched.isMatch; - if (!match) continue; - - if (negated) { - omit.add(matched.output); - } else { - omit.delete(matched.output); - keep.add(matched.output); - } - } - } - - let result = negatives === patterns.length ? [...items] : [...keep]; - let matches = result.filter(item => !omit.has(item)); - - if (options && matches.length === 0) { - if (options.failglob === true) { - throw new Error(`No matches found for "${patterns.join(', ')}"`); - } - - if (options.nonull === true || options.nullglob === true) { - return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; - } - } - - return matches; -}; - -/** - * Backwards compatibility - */ - -micromatch.match = micromatch; - -/** - * Returns a matcher function from the given glob `pattern` and `options`. - * The returned function takes a string to match as its only argument and returns - * true if the string is a match. - * - * ```js - * const mm = require('micromatch'); - * // mm.matcher(pattern[, options]); - * - * const isMatch = mm.matcher('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @param {String} `pattern` Glob pattern - * @param {Object} `options` - * @return {Function} Returns a matcher function. - * @api public - */ - -micromatch.matcher = (pattern, options) => picomatch(pattern, options); - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const mm = require('micromatch'); - * // mm.isMatch(string, patterns[, options]); - * - * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(mm.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String} `str` The string to test. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `[options]` See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Backwards compatibility - */ - -micromatch.any = micromatch.isMatch; - -/** - * Returns a list of strings that _**do not match any**_ of the given `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.not(list, patterns[, options]); - * - * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); - * //=> ['b.b', 'c.c'] - * ``` - * @param {Array} `list` Array of strings to match. - * @param {String|Array} `patterns` One or more glob pattern to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Array} Returns an array of strings that **do not match** the given patterns. - * @api public - */ - -micromatch.not = (list, patterns, options = {}) => { - patterns = [].concat(patterns).map(String); - let result = new Set(); - let items = []; - - let onResult = state => { - if (options.onResult) options.onResult(state); - items.push(state.output); - }; - - let matches = micromatch(list, patterns, { ...options, onResult }); - - for (let item of items) { - if (!matches.includes(item)) { - result.add(item); - } - } - return [...result]; -}; - -/** - * Returns true if the given `string` contains the given pattern. Similar - * to [.isMatch](#isMatch) but the pattern can match any part of the string. - * - * ```js - * var mm = require('micromatch'); - * // mm.contains(string, pattern[, options]); - * - * console.log(mm.contains('aa/bb/cc', '*b')); - * //=> true - * console.log(mm.contains('aa/bb/cc', '*d')); - * //=> false - * ``` - * @param {String} `str` The string to match. - * @param {String|Array} `patterns` Glob pattern to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if any of the patterns matches any part of `str`. - * @api public - */ - -micromatch.contains = (str, pattern, options) => { - if (typeof str !== 'string') { - throw new TypeError(`Expected a string: "${util.inspect(str)}"`); - } - - if (Array.isArray(pattern)) { - return pattern.some(p => micromatch.contains(str, p, options)); - } - - if (typeof pattern === 'string') { - if (isEmptyString(str) || isEmptyString(pattern)) { - return false; - } - - if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) { - return true; - } - } - - return micromatch.isMatch(str, pattern, { ...options, contains: true }); -}; - -/** - * Filter the keys of the given object with the given `glob` pattern - * and `options`. Does not attempt to match nested keys. If you need this feature, - * use [glob-object][] instead. - * - * ```js - * const mm = require('micromatch'); - * // mm.matchKeys(object, patterns[, options]); - * - * const obj = { aa: 'a', ab: 'b', ac: 'c' }; - * console.log(mm.matchKeys(obj, '*b')); - * //=> { ab: 'b' } - * ``` - * @param {Object} `object` The object with keys to filter. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Object} Returns an object with only keys that match the given patterns. - * @api public - */ - -micromatch.matchKeys = (obj, patterns, options) => { - if (!utils.isObject(obj)) { - throw new TypeError('Expected the first argument to be an object'); - } - let keys = micromatch(Object.keys(obj), patterns, options); - let res = {}; - for (let key of keys) res[key] = obj[key]; - return res; -}; - -/** - * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.some(list, patterns[, options]); - * - * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); - * // true - * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); - * // false - * ``` - * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list` - * @api public - */ - -micromatch.some = (list, patterns, options) => { - let items = [].concat(list); - - for (let pattern of [].concat(patterns)) { - let isMatch = picomatch(String(pattern), options); - if (items.some(item => isMatch(item))) { - return true; - } - } - return false; -}; - -/** - * Returns true if every string in the given `list` matches - * any of the given glob `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.every(list, patterns[, options]); - * - * console.log(mm.every('foo.js', ['foo.js'])); - * // true - * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); - * // true - * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); - * // false - * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); - * // false - * ``` - * @param {String|Array} `list` The string or array of strings to test. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list` - * @api public - */ - -micromatch.every = (list, patterns, options) => { - let items = [].concat(list); - - for (let pattern of [].concat(patterns)) { - let isMatch = picomatch(String(pattern), options); - if (!items.every(item => isMatch(item))) { - return false; - } - } - return true; -}; - -/** - * Returns true if **all** of the given `patterns` match - * the specified string. - * - * ```js - * const mm = require('micromatch'); - * // mm.all(string, patterns[, options]); - * - * console.log(mm.all('foo.js', ['foo.js'])); - * // true - * - * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); - * // false - * - * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); - * // true - * - * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); - * // true - * ``` - * @param {String|Array} `str` The string to test. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -micromatch.all = (str, patterns, options) => { - if (typeof str !== 'string') { - throw new TypeError(`Expected a string: "${util.inspect(str)}"`); - } - - return [].concat(patterns).every(p => picomatch(p, options)(str)); -}; - -/** - * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. - * - * ```js - * const mm = require('micromatch'); - * // mm.capture(pattern, string[, options]); - * - * console.log(mm.capture('test/*.js', 'test/foo.js')); - * //=> ['foo'] - * console.log(mm.capture('test/*.js', 'foo/bar.css')); - * //=> null - * ``` - * @param {String} `glob` Glob pattern to use for matching. - * @param {String} `input` String to match - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`. - * @api public - */ - -micromatch.capture = (glob, input, options) => { - let posix = utils.isWindows(options); - let regex = picomatch.makeRe(String(glob), { ...options, capture: true }); - let match = regex.exec(posix ? utils.toPosixSlashes(input) : input); - - if (match) { - return match.slice(1).map(v => v === void 0 ? '' : v); - } -}; - -/** - * Create a regular expression from the given glob `pattern`. - * - * ```js - * const mm = require('micromatch'); - * // mm.makeRe(pattern[, options]); - * - * console.log(mm.makeRe('*.js')); - * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ - * ``` - * @param {String} `pattern` A glob pattern to convert to regex. - * @param {Object} `options` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -micromatch.makeRe = (...args) => picomatch.makeRe(...args); - -/** - * Scan a glob pattern to separate the pattern into segments. Used - * by the [split](#split) method. - * - * ```js - * const mm = require('micromatch'); - * const state = mm.scan(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -micromatch.scan = (...args) => picomatch.scan(...args); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const mm = require('micromatch'); - * const state = mm(pattern[, options]); - * ``` - * @param {String} `glob` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as regex source string. - * @api public - */ - -micromatch.parse = (patterns, options) => { - let res = []; - for (let pattern of [].concat(patterns || [])) { - for (let str of braces(String(pattern), options)) { - res.push(picomatch.parse(str, options)); - } - } - return res; -}; - -/** - * Process the given brace `pattern`. - * - * ```js - * const { braces } = require('micromatch'); - * console.log(braces('foo/{a,b,c}/bar')); - * //=> [ 'foo/(a|b|c)/bar' ] - * - * console.log(braces('foo/{a,b,c}/bar', { expand: true })); - * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] - * ``` - * @param {String} `pattern` String with brace pattern to process. - * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. - * @return {Array} - * @api public - */ - -micromatch.braces = (pattern, options) => { - if (typeof pattern !== 'string') throw new TypeError('Expected a string'); - if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) { - return [pattern]; - } - return braces(pattern, options); -}; - -/** - * Expand braces - */ - -micromatch.braceExpand = (pattern, options) => { - if (typeof pattern !== 'string') throw new TypeError('Expected a string'); - return micromatch.braces(pattern, { ...options, expand: true }); -}; - -/** - * Expose micromatch - */ - -module.exports = micromatch; diff --git a/node_modules/@jest/transform/node_modules/micromatch/package.json b/node_modules/@jest/transform/node_modules/micromatch/package.json deleted file mode 100644 index 18520c606..000000000 --- a/node_modules/@jest/transform/node_modules/micromatch/package.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "name": "micromatch", - "description": "Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.", - "version": "4.0.4", - "homepage": "https://github.com/micromatch/micromatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "(https://github.com/DianeLooney)", - "Amila Welihinda (amilajack.com)", - "Bogdan Chadkin (https://github.com/TrySound)", - "Brian Woodward (https://twitter.com/doowb)", - "Devon Govett (http://badassjs.com)", - "Elan Shanker (https://github.com/es128)", - "Fabrício Matté (https://ultcombo.js.org)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Martin Kolárik (https://kolarik.sk)", - "Olsten Larck (https://i.am.charlike.online)", - "Paul Miller (paulmillr.com)", - "Tom Byrer (https://github.com/tomByrer)", - "Tyler Akins (http://rumkin.com)", - "Peter Bright (https://github.com/drpizza)", - "Kuba Juszczyk (https://github.com/ku8ar)" - ], - "repository": "micromatch/micromatch", - "bugs": { - "url": "https://github.com/micromatch/micromatch/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - }, - "devDependencies": { - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "minimatch": "^3.0.4", - "mocha": "^7.2.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "bash", - "bracket", - "character-class", - "expand", - "expansion", - "expression", - "extglob", - "extglobs", - "file", - "files", - "filter", - "find", - "glob", - "globbing", - "globs", - "globstar", - "lookahead", - "lookaround", - "lookbehind", - "match", - "matcher", - "matches", - "matching", - "micromatch", - "minimatch", - "multimatch", - "negate", - "negation", - "path", - "pattern", - "patterns", - "posix", - "regex", - "regexp", - "regular", - "shell", - "star", - "wildcard" - ], - "verb": { - "toc": "collapsible", - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "nanomatch" - ] - }, - "reflinks": [ - "extglob", - "fill-range", - "glob-object", - "minimatch", - "multimatch" - ] - } -} diff --git a/node_modules/@jest/transform/node_modules/picomatch/CHANGELOG.md b/node_modules/@jest/transform/node_modules/picomatch/CHANGELOG.md deleted file mode 100644 index 8ccc6c1ba..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ -# Release history - -**All notable changes to this project will be documented in this file.** - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## 2.3.1 (2022-01-02) - -### Fixed - -* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). - -### Changed - -* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). - -## 2.3.0 (2021-05-21) - -### Fixed - -* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) - -## 2.2.3 (2021-04-10) - -### Fixed - -* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). -* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). - -## 2.2.2 (2020-03-21) - -### Fixed - -* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). - -## 2.2.1 (2020-01-04) - -* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. - -## 2.2.0 (2020-01-04) - -* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) -* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. - -## 2.1.0 (2019-10-31) - -* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) -* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) -* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) -* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) -* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) -* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) -* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) -* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) -* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) -* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) -* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) -* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) -* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) -* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) -* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) -* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) -* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) -* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) -* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) -* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) -* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) -* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) - -## 2.0.7 (2019-05-14) - -* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) -* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) -* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) -* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) - -## 2.0.4 (2019-04-10) - -### Fixed - -- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. -- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. - -## 2.0.0 (2019-04-10) - -### Added - -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - -### Breaking changes - -- The unixify option was renamed to `windows` -- caching and all related options and methods have been removed - -## 1.0.0 (2018-11-05) - -- adds `.onMatch` option -- improvements to `.scan` method -- numerous improvements and optimizations for matching and parsing -- better windows path handling - -## 0.1.0 - 2017-04-13 - -First release. - - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/@jest/transform/node_modules/picomatch/LICENSE b/node_modules/@jest/transform/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca25..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@jest/transform/node_modules/picomatch/README.md b/node_modules/@jest/transform/node_modules/picomatch/README.md deleted file mode 100644 index b0526e28a..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/README.md +++ /dev/null @@ -1,708 +0,0 @@ -

Picomatch

- -

- -version - - -test status - - -coverage status - - -downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.makeRe](#makere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L32) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.test](lib/picomatch.js#L117) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L161) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L183) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L199) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L231) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L245) - -Compile a regular expression from the `state` object returned by the -[parse()](#parse) method. - -**Params** - -* `state` **{Object}** -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. -* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. -* `returns` **{RegExp}** - -### [.makeRe](lib/picomatch.js#L286) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. -* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L321) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | - -picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[] - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -``` -# .makeRe star - picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) - minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) - -# .makeRe star; dot=true - picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) - minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) - -# .makeRe globstar - picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) - minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) - -# .makeRe globstars - picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) - minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) - -# .makeRe with leading star - picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) - minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) - -# .makeRe - basic braces - picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) - minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/node_modules/@jest/transform/node_modules/picomatch/index.js b/node_modules/@jest/transform/node_modules/picomatch/index.js deleted file mode 100644 index d2f2bc59d..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/node_modules/@jest/transform/node_modules/picomatch/lib/constants.js b/node_modules/@jest/transform/node_modules/picomatch/lib/constants.js deleted file mode 100644 index a62ef3879..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; - -const path = require('path'); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/node_modules/@jest/transform/node_modules/picomatch/lib/parse.js b/node_modules/@jest/transform/node_modules/picomatch/lib/parse.js deleted file mode 100644 index 58269d018..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1091 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. - // In this case, we need to parse the string and use it in the output of the original pattern. - // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. - // - // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. - const expression = parse(rest, { ...options, fastpaths: false }).output; - - output = token.close = `)${expression})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/node_modules/@jest/transform/node_modules/picomatch/lib/picomatch.js b/node_modules/@jest/transform/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index 782d80943..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,342 +0,0 @@ -'use strict'; - -const path = require('path'); -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse(input, options); - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/node_modules/@jest/transform/node_modules/picomatch/lib/scan.js b/node_modules/@jest/transform/node_modules/picomatch/lib/scan.js deleted file mode 100644 index e59cd7a13..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/node_modules/@jest/transform/node_modules/picomatch/lib/utils.js b/node_modules/@jest/transform/node_modules/picomatch/lib/utils.js deleted file mode 100644 index c3ca766a7..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const path = require('path'); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; diff --git a/node_modules/@jest/transform/node_modules/picomatch/package.json b/node_modules/@jest/transform/node_modules/picomatch/package.json deleted file mode 100644 index 3db22d408..000000000 --- a/node_modules/@jest/transform/node_modules/picomatch/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "2.3.1", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^6.8.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/node_modules/@jest/transform/node_modules/pirates/LICENSE b/node_modules/@jest/transform/node_modules/pirates/LICENSE deleted file mode 100644 index acc7a0e08..000000000 --- a/node_modules/@jest/transform/node_modules/pirates/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016-2018 Ari Porad - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/transform/node_modules/pirates/README.md b/node_modules/@jest/transform/node_modules/pirates/README.md deleted file mode 100644 index f61065ef1..000000000 --- a/node_modules/@jest/transform/node_modules/pirates/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Pirates [![Coverage][codecov-badge]][codecov-link] - -### Properly hijack require - -[codecov-badge]: https://img.shields.io/codecov/c/github/danez/pirates/master.svg?style=flat "codecov" -[codecov-link]: https://codecov.io/gh/danez/pirates "codecov" - -## Why? - -Two reasons: -1. Babel and istanbul were breaking each other. -2. Everyone seemed to re-invent the wheel on this, and everyone wanted a solution that was DRY, simple, easy to use, -and made everything Just Work™, while allowing multiple require hooks, in a fashion similar to calling `super`. - -For some context, see [the Babel issue thread][] which started this all, then [the nyc issue thread][], where -discussion was moved (as we began to discuss just using the code nyc had developed), and finally to [#1][issue-1] -where discussion was finally moved. - -[the Babel issue thread]: https://github.com/babel/babel/pull/3062 "Babel Issue Thread" -[the nyc issue thread]: https://github.com/bcoe/nyc/issues/70 "NYC Issue Thread" -[issue-1]: https://github.com/danez/pirates/issues/1 "Issue #1" - -## Installation - - npm install --save pirates - -## Usage - -Using pirates is really easy: -```javascript -// my-module/register.js -const addHook = require('pirates').addHook; -// Or if you use ES modules -// import { addHook } from 'pirates'; - -function matcher(filename) { - // Here, you can inspect the filename to determine if it should be hooked or - // not. Just return a truthy/falsey. Files in node_modules are automatically ignored, - // unless otherwise specified in options (see below). - - // TODO: Implement your logic here - return true; -} - -const revert = addHook( - (code, filename) => code.replace('@@foo', 'console.log(\'foo\');'), - { exts: ['.js'], matcher } -); - -// And later, if you want to un-hook require, you can just do: -revert(); -``` - -## API - -### pirates.addHook(hook, [opts={ [matcher: true], [exts: ['.js']], [ignoreNodeModules: true] }]); -Add a require hook. `hook` must be a function that takes `(code, filename)`, and returns the modified code. `opts` is -an optional options object. Available options are: `matcher`, which is a function that accepts a filename, and -returns a truthy value if the file should be hooked (defaults to a function that always returns true), falsey if -otherwise; `exts`, which is an array of extensions to hook, they should begin with `.` (defaults to `['.js']`); -`ignoreNodeModules`, if true, any file in a `node_modules` folder wont be hooked (the matcher also wont be called), -if false, then the matcher will be called for any files in `node_modules` (defaults to true). - - -## Projects that use Pirates - -See the [wiki page](https://github.com/danez/pirates/wiki/Projects-using-Pirates). If you add Pirates to your project, -(And you should! It works best if everyone uses it. Then we can have a happy world full of happy require hooks!), please -add yourself to the wiki. diff --git a/node_modules/@jest/transform/node_modules/pirates/index.d.ts b/node_modules/@jest/transform/node_modules/pirates/index.d.ts deleted file mode 100644 index b2d8ce669..000000000 --- a/node_modules/@jest/transform/node_modules/pirates/index.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* (c) 2015 Ari Porad (@ariporad) . License: ariporad.mit-license.org */ - -/** - * The hook. Accepts the code of the module and the filename. - */ -declare type Hook = (code: string, filename: string) => string; - -/** - * A matcher function, will be called with path to a file. - * - * Should return truthy if the file should be hooked, falsy otherwise. - */ -declare type Matcher = (path: string) => boolean; - -/** - * Reverts the hook when called. - */ -declare type RevertFunction = () => void; -interface Options { - /** - * The extensions to hook. Should start with '.' (ex. ['.js']). - * - * Takes precedence over `exts`, `extension` and `ext`. - * - * @alias exts - * @alias extension - * @alias ext - * @default ['.js'] - */ - extensions?: ReadonlyArray | string; - - /** - * The extensions to hook. Should start with '.' (ex. ['.js']). - * - * Takes precedence over `extension` and `ext`. - * - * @alias extension - * @alias ext - * @default ['.js'] - */ - exts?: ReadonlyArray | string; - - /** - * The extensions to hook. Should start with '.' (ex. ['.js']). - * - * Takes precedence over `ext`. - * - * @alias ext - * @default ['.js'] - */ - extension?: ReadonlyArray | string; - - /** - * The extensions to hook. Should start with '.' (ex. ['.js']). - * - * @default ['.js'] - */ - ext?: ReadonlyArray | string; - - /** - * A matcher function, will be called with path to a file. - * - * Should return truthy if the file should be hooked, falsy otherwise. - */ - matcher?: Matcher | null; - - /** - * Auto-ignore node_modules. Independent of any matcher. - * - * @default true - */ - ignoreNodeModules?: boolean; -} - -/** - * Add a require hook. - * - * @param hook The hook. Accepts the code of the module and the filename. Required. - * @returns The `revert` function. Reverts the hook when called. - */ -export declare function addHook(hook: Hook, opts?: Options): RevertFunction; -export {}; diff --git a/node_modules/@jest/transform/node_modules/pirates/lib/index.js b/node_modules/@jest/transform/node_modules/pirates/lib/index.js deleted file mode 100644 index 714497b7c..000000000 --- a/node_modules/@jest/transform/node_modules/pirates/lib/index.js +++ /dev/null @@ -1,159 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addHook = addHook; - -var _module = _interopRequireDefault(require("module")); - -var _path = _interopRequireDefault(require("path")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* (c) 2015 Ari Porad (@ariporad) . License: ariporad.mit-license.org */ -const nodeModulesRegex = /^(?:.*[\\/])?node_modules(?:[\\/].*)?$/; // Guard against poorly mocked module constructors. - -const Module = module.constructor.length > 1 ? module.constructor : _module.default; -const HOOK_RETURNED_NOTHING_ERROR_MESSAGE = '[Pirates] A hook returned a non-string, or nothing at all! This is a' + ' violation of intergalactic law!\n' + '--------------------\n' + 'If you have no idea what this means or what Pirates is, let me explain: ' + 'Pirates is a module that makes is easy to implement require hooks. One of' + " the require hooks you're using uses it. One of these require hooks" + " didn't return anything from it's handler, so we don't know what to" + ' do. You might want to debug this.'; -/** - * @param {string} filename The filename to check. - * @param {string[]} exts The extensions to hook. Should start with '.' (ex. ['.js']). - * @param {Matcher|null} matcher A matcher function, will be called with path to a file. Should return truthy if the file should be hooked, falsy otherwise. - * @param {boolean} ignoreNodeModules Auto-ignore node_modules. Independent of any matcher. - */ - -function shouldCompile(filename, exts, matcher, ignoreNodeModules) { - if (typeof filename !== 'string') { - return false; - } - - if (exts.indexOf(_path.default.extname(filename)) === -1) { - return false; - } - - const resolvedFilename = _path.default.resolve(filename); - - if (ignoreNodeModules && nodeModulesRegex.test(resolvedFilename)) { - return false; - } - - if (matcher && typeof matcher === 'function') { - return !!matcher(resolvedFilename); - } - - return true; -} -/** - * @callback Hook The hook. Accepts the code of the module and the filename. - * @param {string} code - * @param {string} filename - * @returns {string} - */ - -/** - * @callback Matcher A matcher function, will be called with path to a file. - * - * Should return truthy if the file should be hooked, falsy otherwise. - * @param {string} path - * @returns {boolean} - */ - -/** - * @callback RevertFunction Reverts the hook when called. - * @returns {void} - */ - -/** - * @typedef {object} Options - * @property {Matcher|null} [matcher=null] A matcher function, will be called with path to a file. - * - * Should return truthy if the file should be hooked, falsy otherwise. - * - * @property {string[]} [extensions=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). - * @property {string[]} [exts=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). - * - * @property {string[]} [extension=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). - * @property {string[]} [ext=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). - * - * @property {boolean} [ignoreNodeModules=true] Auto-ignore node_modules. Independent of any matcher. - */ - -/** - * Add a require hook. - * - * @param {Hook} hook The hook. Accepts the code of the module and the filename. Required. - * @param {Options} [opts] Options - * @returns {RevertFunction} The `revert` function. Reverts the hook when called. - */ - - -function addHook(hook, opts = {}) { - let reverted = false; - const loaders = []; - const oldLoaders = []; - let exts; // We need to do this to fix #15. Basically, if you use a non-standard extension (ie. .jsx), then - // We modify the .js loader, then use the modified .js loader for as the base for .jsx. - // This prevents that. - - const originalJSLoader = Module._extensions['.js']; - const matcher = opts.matcher || null; - const ignoreNodeModules = opts.ignoreNodeModules !== false; - exts = opts.extensions || opts.exts || opts.extension || opts.ext || ['.js']; - - if (!Array.isArray(exts)) { - exts = [exts]; - } - - exts.forEach(ext => { - if (typeof ext !== 'string') { - throw new TypeError(`Invalid Extension: ${ext}`); - } - - const oldLoader = Module._extensions[ext] || originalJSLoader; - oldLoaders[ext] = Module._extensions[ext]; - - loaders[ext] = Module._extensions[ext] = function newLoader(mod, filename) { - let compile; - - if (!reverted) { - if (shouldCompile(filename, exts, matcher, ignoreNodeModules)) { - compile = mod._compile; - - mod._compile = function _compile(code) { - // reset the compile immediately as otherwise we end up having the - // compile function being changed even though this loader might be reverted - // Not reverting it here leads to long useless compile chains when doing - // addHook -> revert -> addHook -> revert -> ... - // The compile function is also anyway created new when the loader is called a second time. - mod._compile = compile; - const newCode = hook(code, filename); - - if (typeof newCode !== 'string') { - throw new Error(HOOK_RETURNED_NOTHING_ERROR_MESSAGE); - } - - return mod._compile(newCode, filename); - }; - } - } - - oldLoader(mod, filename); - }; - }); - return function revert() { - if (reverted) return; - reverted = true; - exts.forEach(ext => { - // if the current loader for the extension is our loader then unregister it and set the oldLoader again - // if not we can not do anything as we cannot remove a loader from within the loader-chain - if (Module._extensions[ext] === loaders[ext]) { - if (!oldLoaders[ext]) { - delete Module._extensions[ext]; - } else { - Module._extensions[ext] = oldLoaders[ext]; - } - } - }); - }; -} \ No newline at end of file diff --git a/node_modules/@jest/transform/node_modules/pirates/package.json b/node_modules/@jest/transform/node_modules/pirates/package.json deleted file mode 100644 index 47bd38460..000000000 --- a/node_modules/@jest/transform/node_modules/pirates/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "pirates", - "description": "Properly hijack require", - "main": "lib/index.js", - "types": "index.d.ts", - "scripts": { - "clean": "rimraf lib", - "build": "babel src -d lib", - "test": "cross-env BABEL_ENV=test yarn run build && nyc ava", - "lint": "eslint --report-unused-disable-directives .", - "prepublishOnly": "yarn run build" - }, - "files": [ - "lib", - "index.d.ts" - ], - "repository": { - "type": "git", - "url": "https://github.com/danez/pirates.git" - }, - "engines": { - "node": ">= 6" - }, - "author": { - "name": "Ari Porad", - "email": "ari@ariporad.com", - "url": "http://ariporad.com" - }, - "devDependencies": { - "@babel/cli": "7.16.7", - "@babel/core": "7.16.7", - "@babel/preset-env": "7.16.7", - "ava": "1.4.1", - "babel-core": "7.0.0-bridge.0", - "babel-eslint": "10.1.0", - "babel-plugin-istanbul": "5.2.0", - "cross-env": "5.2.1", - "decache": "4.6.1", - "eslint": "5.16.0", - "eslint-config-prettier": "4.3.0", - "eslint-plugin-import": "2.25.4", - "eslint-plugin-prettier": "3.4.1", - "mock-require": "3.0.3", - "nyc": "13.3.0", - "prettier": "1.19.1", - "rewire": "4.0.1", - "rimraf": "3.0.2" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/danez/pirates/issues" - }, - "homepage": "https://github.com/danez/pirates#readme", - "ava": { - "files": [ - "test/*.js" - ], - "sources": [ - "lib/**/*.js" - ] - }, - "nyc": { - "include": [ - "src/*.js" - ], - "reporter": [ - "json", - "text" - ], - "sourceMap": false, - "instrument": false - }, - "version": "4.0.5" -} diff --git a/node_modules/@jest/transform/node_modules/write-file-atomic/LICENSE.md b/node_modules/@jest/transform/node_modules/write-file-atomic/LICENSE.md new file mode 100644 index 000000000..95e65a770 --- /dev/null +++ b/node_modules/@jest/transform/node_modules/write-file-atomic/LICENSE.md @@ -0,0 +1,6 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/@jest/transform/node_modules/write-file-atomic/README.md b/node_modules/@jest/transform/node_modules/write-file-atomic/README.md new file mode 100644 index 000000000..2d9ef6024 --- /dev/null +++ b/node_modules/@jest/transform/node_modules/write-file-atomic/README.md @@ -0,0 +1,91 @@ +write-file-atomic +----------------- + +This is an extension for node's `fs.writeFile` that makes its operation +atomic and allows you set ownership (uid/gid of the file). + +### `writeFileAtomic(filename, data, [options], [callback])` + +#### Description: + +Atomically and asynchronously writes data to a file, replacing the file if it already +exists. data can be a string or a buffer. + +#### Options: +* filename **String** +* data **String** | **Buffer** +* options **Object** | **String** + * chown **Object** default, uid & gid of existing file, if any + * uid **Number** + * gid **Number** + * encoding **String** | **Null** default = 'utf8' + * fsync **Boolean** default = true + * mode **Number** default, from existing file, if any + * tmpfileCreated **Function** called when the tmpfile is created +* callback **Function** + +#### Usage: + +```js +var writeFileAtomic = require('write-file-atomic') +writeFileAtomic(filename, data, [options], [callback]) +``` + +The file is initially named `filename + "." + murmurhex(__filename, process.pid, ++invocations)`. +Note that `require('worker_threads').threadId` is used in addition to `process.pid` if running inside of a worker thread. +If writeFile completes successfully then, if passed the **chown** option it will change +the ownership of the file. Finally it renames the file back to the filename you specified. If +it encounters errors at any of these steps it will attempt to unlink the temporary file and then +pass the error back to the caller. +If multiple writes are concurrently issued to the same file, the write operations are put into a queue and serialized in the order they were called, using Promises. Writes to different files are still executed in parallel. + +If provided, the **chown** option requires both **uid** and **gid** properties or else +you'll get an error. If **chown** is not specified it will default to using +the owner of the previous file. To prevent chown from being ran you can +also pass `false`, in which case the file will be created with the current user's credentials. + +If **mode** is not specified, it will default to using the permissions from +an existing file, if any. Expicitly setting this to `false` remove this default, resulting +in a file created with the system default permissions. + +If options is a String, it's assumed to be the **encoding** option. The **encoding** option is ignored if **data** is a buffer. It defaults to 'utf8'. + +If the **fsync** option is **false**, writeFile will skip the final fsync call. + +If the **tmpfileCreated** option is specified it will be called with the name of the tmpfile when created. + +Example: + +```javascript +writeFileAtomic('message.txt', 'Hello Node', {chown:{uid:100,gid:50}}, function (err) { + if (err) throw err; + console.log('It\'s saved!'); +}); +``` + +This function also supports async/await: + +```javascript +(async () => { + try { + await writeFileAtomic('message.txt', 'Hello Node', {chown:{uid:100,gid:50}}); + console.log('It\'s saved!'); + } catch (err) { + console.error(err); + process.exit(1); + } +})(); +``` + +### `writeFileAtomicSync(filename, data, [options])` + +#### Description: + +The synchronous version of **writeFileAtomic**. + +#### Usage: +```js +var writeFileAtomicSync = require('write-file-atomic').sync +writeFileAtomicSync(filename, data, [options]) +``` + diff --git a/node_modules/@jest/transform/node_modules/write-file-atomic/lib/index.js b/node_modules/@jest/transform/node_modules/write-file-atomic/lib/index.js new file mode 100644 index 000000000..118666d2c --- /dev/null +++ b/node_modules/@jest/transform/node_modules/write-file-atomic/lib/index.js @@ -0,0 +1,260 @@ +'use strict' +module.exports = writeFile +module.exports.sync = writeFileSync +module.exports._getTmpname = getTmpname // for testing +module.exports._cleanupOnExit = cleanupOnExit + +const fs = require('fs') +const MurmurHash3 = require('imurmurhash') +const onExit = require('signal-exit') +const path = require('path') +const { promisify } = require('util') +const activeFiles = {} + +// if we run inside of a worker_thread, `process.pid` is not unique +/* istanbul ignore next */ +const threadId = (function getId () { + try { + const workerThreads = require('worker_threads') + + /// if we are in main thread, this is set to `0` + return workerThreads.threadId + } catch (e) { + // worker_threads are not available, fallback to 0 + return 0 + } +})() + +let invocations = 0 +function getTmpname (filename) { + return filename + '.' + + MurmurHash3(__filename) + .hash(String(process.pid)) + .hash(String(threadId)) + .hash(String(++invocations)) + .result() +} + +function cleanupOnExit (tmpfile) { + return () => { + try { + fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) + } catch (_) {} + } +} + +function serializeActiveFile (absoluteName) { + return new Promise(resolve => { + // make a queue if it doesn't already exist + if (!activeFiles[absoluteName]) { + activeFiles[absoluteName] = [] + } + + activeFiles[absoluteName].push(resolve) // add this job to the queue + if (activeFiles[absoluteName].length === 1) { + resolve() + } // kick off the first one + }) +} + +// https://github.com/isaacs/node-graceful-fs/blob/master/polyfills.js#L315-L342 +function isChownErrOk (err) { + if (err.code === 'ENOSYS') { + return true + } + + const nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (err.code === 'EINVAL' || err.code === 'EPERM') { + return true + } + } + + return false +} + +async function writeFileAsync (filename, data, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + let fd + let tmpfile + /* istanbul ignore next -- The closure only gets called when onExit triggers */ + const removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile)) + const absoluteName = path.resolve(filename) + + try { + await serializeActiveFile(absoluteName) + const truename = await promisify(fs.realpath)(filename).catch(() => filename) + tmpfile = getTmpname(truename) + + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + const stats = await promisify(fs.stat)(truename).catch(() => {}) + if (stats) { + if (options.mode == null) { + options.mode = stats.mode + } + + if (options.chown == null && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } + } + + fd = await promisify(fs.open)(tmpfile, 'w', options.mode) + if (options.tmpfileCreated) { + await options.tmpfileCreated(tmpfile) + } + if (ArrayBuffer.isView(data)) { + await promisify(fs.write)(fd, data, 0, data.length, 0) + } else if (data != null) { + await promisify(fs.write)(fd, String(data), 0, String(options.encoding || 'utf8')) + } + + if (options.fsync !== false) { + await promisify(fs.fsync)(fd) + } + + await promisify(fs.close)(fd) + fd = null + + if (options.chown) { + await promisify(fs.chown)(tmpfile, options.chown.uid, options.chown.gid).catch(err => { + if (!isChownErrOk(err)) { + throw err + } + }) + } + + if (options.mode) { + await promisify(fs.chmod)(tmpfile, options.mode).catch(err => { + if (!isChownErrOk(err)) { + throw err + } + }) + } + + await promisify(fs.rename)(tmpfile, truename) + } finally { + if (fd) { + await promisify(fs.close)(fd).catch( + /* istanbul ignore next */ + () => {} + ) + } + removeOnExitHandler() + await promisify(fs.unlink)(tmpfile).catch(() => {}) + activeFiles[absoluteName].shift() // remove the element added by serializeSameFile + if (activeFiles[absoluteName].length > 0) { + activeFiles[absoluteName][0]() // start next job if one is pending + } else { + delete activeFiles[absoluteName] + } + } +} + +function writeFile (filename, data, options, callback) { + if (options instanceof Function) { + callback = options + options = {} + } + + const promise = writeFileAsync(filename, data, options) + if (callback) { + promise.then(callback, callback) + } + + return promise +} + +function writeFileSync (filename, data, options) { + if (typeof options === 'string') { + options = { encoding: options } + } else if (!options) { + options = {} + } + try { + filename = fs.realpathSync(filename) + } catch (ex) { + // it's ok, it'll happen on a not yet existing file + } + const tmpfile = getTmpname(filename) + + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + try { + const stats = fs.statSync(filename) + options = Object.assign({}, options) + if (!options.mode) { + options.mode = stats.mode + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } catch (ex) { + // ignore stat errors + } + } + + let fd + const cleanup = cleanupOnExit(tmpfile) + const removeOnExitHandler = onExit(cleanup) + + let threw = true + try { + fd = fs.openSync(tmpfile, 'w', options.mode || 0o666) + if (options.tmpfileCreated) { + options.tmpfileCreated(tmpfile) + } + if (ArrayBuffer.isView(data)) { + fs.writeSync(fd, data, 0, data.length, 0) + } else if (data != null) { + fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) + } + if (options.fsync !== false) { + fs.fsyncSync(fd) + } + + fs.closeSync(fd) + fd = null + + if (options.chown) { + try { + fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) + } catch (err) { + if (!isChownErrOk(err)) { + throw err + } + } + } + + if (options.mode) { + try { + fs.chmodSync(tmpfile, options.mode) + } catch (err) { + if (!isChownErrOk(err)) { + throw err + } + } + } + + fs.renameSync(tmpfile, filename) + threw = false + } finally { + if (fd) { + try { + fs.closeSync(fd) + } catch (ex) { + // ignore close errors at this stage, error may have closed fd already. + } + } + removeOnExitHandler() + if (threw) { + cleanup() + } + } +} diff --git a/node_modules/@jest/transform/node_modules/write-file-atomic/package.json b/node_modules/@jest/transform/node_modules/write-file-atomic/package.json new file mode 100644 index 000000000..7219f90b9 --- /dev/null +++ b/node_modules/@jest/transform/node_modules/write-file-atomic/package.json @@ -0,0 +1,53 @@ +{ + "name": "write-file-atomic", + "version": "4.0.1", + "description": "Write files in an atomic fashion w/configurable ownership", + "main": "./lib/index.js", + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "lintfix": "npm run lint -- --fix", + "snap": "tap", + "template-copy": "npm-template-copy --force" + }, + "repository": { + "type": "git", + "url": "git://github.com/npm/write-file-atomic.git" + }, + "keywords": [ + "writeFile", + "atomic" + ], + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/write-file-atomic/issues" + }, + "homepage": "https://github.com/npm/write-file-atomic", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "devDependencies": { + "@npmcli/template-oss": "^2.7.1", + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2", + "tap": "^15.1.6" + }, + "files": [ + "bin", + "lib" + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "windowsCI": false, + "version": "2.7.1" + } +} diff --git a/node_modules/@jest/transform/package.json b/node_modules/@jest/transform/package.json index 961021eae..7df64516c 100644 --- a/node_modules/@jest/transform/package.json +++ b/node_modules/@jest/transform/package.json @@ -1,6 +1,6 @@ { "name": "@jest/transform", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,37 +17,37 @@ "./package.json": "./package.json" }, "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^27.5.1", + "@babel/core": "^7.11.6", + "@jest/types": "^28.0.1", + "@jridgewell/trace-mapping": "^0.3.7", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-haste-map": "^28.0.1", + "jest-regex-util": "^28.0.0", + "jest-util": "^28.0.1", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" + "write-file-atomic": "^4.0.1" }, "devDependencies": { - "@jest/test-utils": "^27.5.1", - "@types/babel__core": "^7.1.0", + "@jest/test-utils": "^28.0.1", + "@types/babel__core": "^7.1.14", "@types/convert-source-map": "^1.5.1", "@types/fast-json-stable-stringify": "^2.0.0", - "@types/graceful-fs": "^4.1.2", + "@types/graceful-fs": "^4.1.3", "@types/micromatch": "^4.0.1", - "@types/write-file-atomic": "^3.0.0", + "@types/write-file-atomic": "^4.0.0", "dedent": "^0.7.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/@jridgewell/resolve-uri/LICENSE b/node_modules/@jridgewell/resolve-uri/LICENSE new file mode 100644 index 000000000..0a81b2ade --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/LICENSE @@ -0,0 +1,19 @@ +Copyright 2019 Justin Ridgewell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/README.md b/node_modules/@jridgewell/resolve-uri/README.md new file mode 100644 index 000000000..2fe70df77 --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/README.md @@ -0,0 +1,40 @@ +# @jridgewell/resolve-uri + +> Resolve a URI relative to an optional base URI + +Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths. + +## Installation + +```sh +npm install @jridgewell/resolve-uri +``` + +## Usage + +```typescript +function resolve(input: string, base?: string): string; +``` + +```js +import resolve from '@jridgewell/resolve-uri'; + +resolve('foo', 'https://example.com'); // => 'https://example.com/foo' +``` + +| Input | Base | Resolution | Explanation | +|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------| +| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only | +| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol | +| `//example.com` | _rest_ | `//example.com/` | Input is normalized only | +| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin | +| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative | +| `/example` | _rest_ | `/example` | Input is normalized only | +| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base | +| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file | +| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory | +| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file | +| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory | +| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file | +| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory | +| `example` | `base/file` | `base/example` | Input is joined with the base without its file | diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs new file mode 100644 index 000000000..d551aad64 --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs @@ -0,0 +1,197 @@ +// Matches the scheme of a URL, eg "http://" +const schemeRegex = /^[\w+.-]+:\/\//; +/** + * Matches the parts of a URL: + * 1. Scheme, including ":", guaranteed. + * 2. User/password, including "@", optional. + * 3. Host, guaranteed. + * 4. Port, including ":", optional. + * 5. Path, including "/", optional. + */ +const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?/; +/** + * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start + * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). + * + * 1. Host, optional. + * 2. Path, which may inclue "/", guaranteed. + */ +const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/]*)?)?(\/?.*)/i; +function isAbsoluteUrl(input) { + return schemeRegex.test(input); +} +function isSchemeRelativeUrl(input) { + return input.startsWith('//'); +} +function isAbsolutePath(input) { + return input.startsWith('/'); +} +function isFileUrl(input) { + return input.startsWith('file:'); +} +function parseAbsoluteUrl(input) { + const match = urlRegex.exec(input); + return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/'); +} +function parseFileUrl(input) { + const match = fileRegex.exec(input); + const path = match[2]; + return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path); +} +function makeUrl(scheme, user, host, port, path) { + return { + scheme, + user, + host, + port, + path, + relativePath: false, + }; +} +function parseUrl(input) { + if (isSchemeRelativeUrl(input)) { + const url = parseAbsoluteUrl('http:' + input); + url.scheme = ''; + return url; + } + if (isAbsolutePath(input)) { + const url = parseAbsoluteUrl('http://foo.com' + input); + url.scheme = ''; + url.host = ''; + return url; + } + if (isFileUrl(input)) + return parseFileUrl(input); + if (isAbsoluteUrl(input)) + return parseAbsoluteUrl(input); + const url = parseAbsoluteUrl('http://foo.com/' + input); + url.scheme = ''; + url.host = ''; + url.relativePath = true; + return url; +} +function stripPathFilename(path) { + // If a path ends with a parent directory "..", then it's a relative path with excess parent + // paths. It's not a file, so we can't strip it. + if (path.endsWith('/..')) + return path; + const index = path.lastIndexOf('/'); + return path.slice(0, index + 1); +} +function mergePaths(url, base) { + // If we're not a relative path, then we're an absolute path, and it doesn't matter what base is. + if (!url.relativePath) + return; + normalizePath(base); + // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative + // path). + if (url.path === '/') { + url.path = base.path; + } + else { + // Resolution happens relative to the base path's directory, not the file. + url.path = stripPathFilename(base.path) + url.path; + } + // If the base path is absolute, then our path is now absolute too. + url.relativePath = base.relativePath; +} +/** + * The path can have empty directories "//", unneeded parents "foo/..", or current directory + * "foo/.". We need to normalize to a standard representation. + */ +function normalizePath(url) { + const { relativePath } = url; + const pieces = url.path.split('/'); + // We need to preserve the first piece always, so that we output a leading slash. The item at + // pieces[0] is an empty string. + let pointer = 1; + // Positive is the number of real directories we've output, used for popping a parent directory. + // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". + let positive = 0; + // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will + // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a + // real directory, we won't need to append, unless the other conditions happen again. + let addTrailingSlash = false; + for (let i = 1; i < pieces.length; i++) { + const piece = pieces[i]; + // An empty directory, could be a trailing slash, or just a double "//" in the path. + if (!piece) { + addTrailingSlash = true; + continue; + } + // If we encounter a real directory, then we don't need to append anymore. + addTrailingSlash = false; + // A current directory, which we can always drop. + if (piece === '.') + continue; + // A parent directory, we need to see if there are any real directories we can pop. Else, we + // have an excess of parents, and we'll need to keep the "..". + if (piece === '..') { + if (positive) { + addTrailingSlash = true; + positive--; + pointer--; + } + else if (relativePath) { + // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute + // URL, protocol relative URL, or an absolute path, we don't need to keep excess. + pieces[pointer++] = piece; + } + continue; + } + // We've encountered a real directory. Move it to the next insertion pointer, which accounts for + // any popped or dropped directories. + pieces[pointer++] = piece; + positive++; + } + let path = ''; + for (let i = 1; i < pointer; i++) { + path += '/' + pieces[i]; + } + if (!path || (addTrailingSlash && !path.endsWith('/..'))) { + path += '/'; + } + url.path = path; +} +/** + * Attempts to resolve `input` URL/path relative to `base`. + */ +function resolve(input, base) { + if (!input && !base) + return ''; + const url = parseUrl(input); + // If we have a base, and the input isn't already an absolute URL, then we need to merge. + if (base && !url.scheme) { + const baseUrl = parseUrl(base); + url.scheme = baseUrl.scheme; + // If there's no host, then we were just a path. + if (!url.host) { + // The host, user, and port are joined, you can't copy one without the others. + url.user = baseUrl.user; + url.host = baseUrl.host; + url.port = baseUrl.port; + } + mergePaths(url, baseUrl); + } + normalizePath(url); + // If the input (and base, if there was one) are both relative, then we need to output a relative. + if (url.relativePath) { + // The first char is always a "/". + const path = url.path.slice(1); + if (!path) + return '.'; + // If base started with a leading ".", or there is no base and input started with a ".", then we + // need to ensure that the relative path starts with a ".". We don't know if relative starts + // with a "..", though, so check before prepending. + const keepRelative = (base || input).startsWith('.'); + return !keepRelative || path.startsWith('.') ? path : './' + path; + } + // If there's no host (and no scheme/user/port), then we need to output an absolute path. + if (!url.scheme && !url.host) + return url.path; + // We're outputting either an absolute URL, or a protocol relative one. + return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`; +} + +export { resolve as default }; +//# sourceMappingURL=resolve-uri.mjs.map diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map new file mode 100644 index 000000000..6c4c074fd --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve-uri.mjs","sources":["../../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may inclue \"/\", guaranteed.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/]*)?)?(\\/?.*)/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n relativePath: boolean;\n};\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/');\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path);\n}\n\nfunction makeUrl(scheme: string, user: string, host: string, port: string, path: string): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n relativePath: false,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.relativePath = true;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n // If we're not a relative path, then we're an absolute path, and it doesn't matter what base is.\n if (!url.relativePath) return;\n\n normalizePath(base);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n\n // If the base path is absolute, then our path is now absolute too.\n url.relativePath = base.relativePath;\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url) {\n const { relativePath } = url;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (relativePath) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n\n // If we have a base, and the input isn't already an absolute URL, then we need to merge.\n if (base && !url.scheme) {\n const baseUrl = parseUrl(base);\n url.scheme = baseUrl.scheme;\n // If there's no host, then we were just a path.\n if (!url.host) {\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n }\n mergePaths(url, baseUrl);\n }\n\n normalizePath(url);\n\n // If the input (and base, if there was one) are both relative, then we need to output a relative.\n if (url.relativePath) {\n // The first char is always a \"/\".\n const path = url.path.slice(1);\n if (!path) return '.';\n\n // If base started with a leading \".\", or there is no base and input started with a \".\", then we\n // need to ensure that the relative path starts with a \".\". We don't know if relative starts\n // with a \"..\", though, so check before prepending.\n const keepRelative = (base || input).startsWith('.');\n return !keepRelative || path.startsWith('.') ? path : './' + path;\n }\n // If there's no host (and no scheme/user/port), then we need to output an absolute path.\n if (!url.scheme && !url.host) return url.path;\n // We're outputting either an absolute URL, or a protocol relative one.\n return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`;\n}\n"],"names":[],"mappings":"AAAA;AACA,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC;;;;;;;;AAQA,MAAM,QAAQ,GAAG,0DAA0D,CAAC;AAE5E;;;;;;;AAOA,MAAM,SAAS,GAAG,2CAA2C,CAAC;AAW9D,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC;IACpC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;AACtF,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC;IACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;AAC5F,CAAC;AAED,SAAS,OAAO,CAAC,MAAc,EAAE,IAAY,EAAE,IAAY,EAAE,IAAY,EAAE,IAAY;IACrF,OAAO;QACL,MAAM;QACN,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,GAAG,GAAG,gBAAgB,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;QAC9C,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;QACzB,MAAM,GAAG,GAAG,gBAAgB,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;QACvD,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;QAChB,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAEjD,IAAI,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEzD,MAAM,GAAG,GAAG,gBAAgB,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;IACxD,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IAChB,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;IACd,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC;IACxB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;;;IAGrC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAS;;IAErC,IAAI,CAAC,GAAG,CAAC,YAAY;QAAE,OAAO;IAE9B,aAAa,CAAC,IAAI,CAAC,CAAC;;;IAIpB,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE;QACpB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;KACtB;SAAM;;QAEL,GAAG,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;KACpD;;IAGD,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AACvC,CAAC;AAED;;;;AAIA,SAAS,aAAa,CAAC,GAAQ;IAC7B,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC;IAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;;;IAInC,IAAI,OAAO,GAAG,CAAC,CAAC;;;IAIhB,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;IAKjB,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;;QAGxB,IAAI,CAAC,KAAK,EAAE;YACV,gBAAgB,GAAG,IAAI,CAAC;YACxB,SAAS;SACV;;QAGD,gBAAgB,GAAG,KAAK,CAAC;;QAGzB,IAAI,KAAK,KAAK,GAAG;YAAE,SAAS;;;QAI5B,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,IAAI,QAAQ,EAAE;gBACZ,gBAAgB,GAAG,IAAI,CAAC;gBACxB,QAAQ,EAAE,CAAC;gBACX,OAAO,EAAE,CAAC;aACX;iBAAM,IAAI,YAAY,EAAE;;;gBAGvB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC;aAC3B;YACD,SAAS;SACV;;;QAID,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC;QAC1B,QAAQ,EAAE,CAAC;KACZ;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;QAChC,IAAI,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;KACzB;IACD,IAAI,CAAC,IAAI,KAAK,gBAAgB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;QACxD,IAAI,IAAI,GAAG,CAAC;KACb;IACD,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;AAClB,CAAC;AAED;;;SAGwB,OAAO,CAAC,KAAa,EAAE,IAAwB;IACrE,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;;IAG5B,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;QACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;QAE5B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;;YAEb,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACxB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACxB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;SACzB;QACD,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KAC1B;IAED,aAAa,CAAC,GAAG,CAAC,CAAC;;IAGnB,IAAI,GAAG,CAAC,YAAY,EAAE;;QAEpB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAO,GAAG,CAAC;;;;QAKtB,MAAM,YAAY,GAAG,CAAC,IAAI,IAAI,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;QACrD,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;KACnE;;IAED,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC;;IAE9C,OAAO,GAAG,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;AACvE;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js new file mode 100644 index 000000000..9b132d96c --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js @@ -0,0 +1,205 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory()); +})(this, (function () { 'use strict'; + + // Matches the scheme of a URL, eg "http://" + const schemeRegex = /^[\w+.-]+:\/\//; + /** + * Matches the parts of a URL: + * 1. Scheme, including ":", guaranteed. + * 2. User/password, including "@", optional. + * 3. Host, guaranteed. + * 4. Port, including ":", optional. + * 5. Path, including "/", optional. + */ + const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?/; + /** + * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start + * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). + * + * 1. Host, optional. + * 2. Path, which may inclue "/", guaranteed. + */ + const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/]*)?)?(\/?.*)/i; + function isAbsoluteUrl(input) { + return schemeRegex.test(input); + } + function isSchemeRelativeUrl(input) { + return input.startsWith('//'); + } + function isAbsolutePath(input) { + return input.startsWith('/'); + } + function isFileUrl(input) { + return input.startsWith('file:'); + } + function parseAbsoluteUrl(input) { + const match = urlRegex.exec(input); + return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/'); + } + function parseFileUrl(input) { + const match = fileRegex.exec(input); + const path = match[2]; + return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path); + } + function makeUrl(scheme, user, host, port, path) { + return { + scheme, + user, + host, + port, + path, + relativePath: false, + }; + } + function parseUrl(input) { + if (isSchemeRelativeUrl(input)) { + const url = parseAbsoluteUrl('http:' + input); + url.scheme = ''; + return url; + } + if (isAbsolutePath(input)) { + const url = parseAbsoluteUrl('http://foo.com' + input); + url.scheme = ''; + url.host = ''; + return url; + } + if (isFileUrl(input)) + return parseFileUrl(input); + if (isAbsoluteUrl(input)) + return parseAbsoluteUrl(input); + const url = parseAbsoluteUrl('http://foo.com/' + input); + url.scheme = ''; + url.host = ''; + url.relativePath = true; + return url; + } + function stripPathFilename(path) { + // If a path ends with a parent directory "..", then it's a relative path with excess parent + // paths. It's not a file, so we can't strip it. + if (path.endsWith('/..')) + return path; + const index = path.lastIndexOf('/'); + return path.slice(0, index + 1); + } + function mergePaths(url, base) { + // If we're not a relative path, then we're an absolute path, and it doesn't matter what base is. + if (!url.relativePath) + return; + normalizePath(base); + // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative + // path). + if (url.path === '/') { + url.path = base.path; + } + else { + // Resolution happens relative to the base path's directory, not the file. + url.path = stripPathFilename(base.path) + url.path; + } + // If the base path is absolute, then our path is now absolute too. + url.relativePath = base.relativePath; + } + /** + * The path can have empty directories "//", unneeded parents "foo/..", or current directory + * "foo/.". We need to normalize to a standard representation. + */ + function normalizePath(url) { + const { relativePath } = url; + const pieces = url.path.split('/'); + // We need to preserve the first piece always, so that we output a leading slash. The item at + // pieces[0] is an empty string. + let pointer = 1; + // Positive is the number of real directories we've output, used for popping a parent directory. + // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". + let positive = 0; + // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will + // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a + // real directory, we won't need to append, unless the other conditions happen again. + let addTrailingSlash = false; + for (let i = 1; i < pieces.length; i++) { + const piece = pieces[i]; + // An empty directory, could be a trailing slash, or just a double "//" in the path. + if (!piece) { + addTrailingSlash = true; + continue; + } + // If we encounter a real directory, then we don't need to append anymore. + addTrailingSlash = false; + // A current directory, which we can always drop. + if (piece === '.') + continue; + // A parent directory, we need to see if there are any real directories we can pop. Else, we + // have an excess of parents, and we'll need to keep the "..". + if (piece === '..') { + if (positive) { + addTrailingSlash = true; + positive--; + pointer--; + } + else if (relativePath) { + // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute + // URL, protocol relative URL, or an absolute path, we don't need to keep excess. + pieces[pointer++] = piece; + } + continue; + } + // We've encountered a real directory. Move it to the next insertion pointer, which accounts for + // any popped or dropped directories. + pieces[pointer++] = piece; + positive++; + } + let path = ''; + for (let i = 1; i < pointer; i++) { + path += '/' + pieces[i]; + } + if (!path || (addTrailingSlash && !path.endsWith('/..'))) { + path += '/'; + } + url.path = path; + } + /** + * Attempts to resolve `input` URL/path relative to `base`. + */ + function resolve(input, base) { + if (!input && !base) + return ''; + const url = parseUrl(input); + // If we have a base, and the input isn't already an absolute URL, then we need to merge. + if (base && !url.scheme) { + const baseUrl = parseUrl(base); + url.scheme = baseUrl.scheme; + // If there's no host, then we were just a path. + if (!url.host) { + // The host, user, and port are joined, you can't copy one without the others. + url.user = baseUrl.user; + url.host = baseUrl.host; + url.port = baseUrl.port; + } + mergePaths(url, baseUrl); + } + normalizePath(url); + // If the input (and base, if there was one) are both relative, then we need to output a relative. + if (url.relativePath) { + // The first char is always a "/". + const path = url.path.slice(1); + if (!path) + return '.'; + // If base started with a leading ".", or there is no base and input started with a ".", then we + // need to ensure that the relative path starts with a ".". We don't know if relative starts + // with a "..", though, so check before prepending. + const keepRelative = (base || input).startsWith('.'); + return !keepRelative || path.startsWith('.') ? path : './' + path; + } + // If there's no host (and no scheme/user/port), then we need to output an absolute path. + if (!url.scheme && !url.host) + return url.path; + // We're outputting either an absolute URL, or a protocol relative one. + return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`; + } + + return resolve; + +})); +//# sourceMappingURL=resolve-uri.umd.js.map diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map new file mode 100644 index 000000000..91144bf9e --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve-uri.umd.js","sources":["../../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may inclue \"/\", guaranteed.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/]*)?)?(\\/?.*)/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n relativePath: boolean;\n};\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/');\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path);\n}\n\nfunction makeUrl(scheme: string, user: string, host: string, port: string, path: string): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n relativePath: false,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.relativePath = true;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n // If we're not a relative path, then we're an absolute path, and it doesn't matter what base is.\n if (!url.relativePath) return;\n\n normalizePath(base);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n\n // If the base path is absolute, then our path is now absolute too.\n url.relativePath = base.relativePath;\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url) {\n const { relativePath } = url;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (relativePath) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n\n // If we have a base, and the input isn't already an absolute URL, then we need to merge.\n if (base && !url.scheme) {\n const baseUrl = parseUrl(base);\n url.scheme = baseUrl.scheme;\n // If there's no host, then we were just a path.\n if (!url.host) {\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n }\n mergePaths(url, baseUrl);\n }\n\n normalizePath(url);\n\n // If the input (and base, if there was one) are both relative, then we need to output a relative.\n if (url.relativePath) {\n // The first char is always a \"/\".\n const path = url.path.slice(1);\n if (!path) return '.';\n\n // If base started with a leading \".\", or there is no base and input started with a \".\", then we\n // need to ensure that the relative path starts with a \".\". We don't know if relative starts\n // with a \"..\", though, so check before prepending.\n const keepRelative = (base || input).startsWith('.');\n return !keepRelative || path.startsWith('.') ? path : './' + path;\n }\n // If there's no host (and no scheme/user/port), then we need to output an absolute path.\n if (!url.scheme && !url.host) return url.path;\n // We're outputting either an absolute URL, or a protocol relative one.\n return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`;\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA,MAAM,WAAW,GAAG,gBAAgB,CAAC;IAErC;;;;;;;;IAQA,MAAM,QAAQ,GAAG,0DAA0D,CAAC;IAE5E;;;;;;;IAOA,MAAM,SAAS,GAAG,2CAA2C,CAAC;IAW9D,SAAS,aAAa,CAAC,KAAa;QAClC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,mBAAmB,CAAC,KAAa;QACxC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,SAAS,cAAc,CAAC,KAAa;QACnC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS,SAAS,CAAC,KAAa;QAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,SAAS,gBAAgB,CAAC,KAAa;QACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC;QACpC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IACtF,CAAC;IAED,SAAS,YAAY,CAAC,KAAa;QACjC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;IAC5F,CAAC;IAED,SAAS,OAAO,CAAC,MAAc,EAAE,IAAY,EAAE,IAAY,EAAE,IAAY,EAAE,IAAY;QACrF,OAAO;YACL,MAAM;YACN,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,YAAY,EAAE,KAAK;SACpB,CAAC;IACJ,CAAC;IAED,SAAS,QAAQ,CAAC,KAAa;QAC7B,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE;YAC9B,MAAM,GAAG,GAAG,gBAAgB,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;YAC9C,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;YAChB,OAAO,GAAG,CAAC;SACZ;QAED,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;YACzB,MAAM,GAAG,GAAG,gBAAgB,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;YACvD,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;YAChB,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;YACd,OAAO,GAAG,CAAC;SACZ;QAED,IAAI,SAAS,CAAC,KAAK,CAAC;YAAE,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;QAEjD,IAAI,aAAa,CAAC,KAAK,CAAC;YAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAEzD,MAAM,GAAG,GAAG,gBAAgB,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;QACxD,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;QAChB,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;QACd,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,SAAS,iBAAiB,CAAC,IAAY;;;QAGrC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAS;;QAErC,IAAI,CAAC,GAAG,CAAC,YAAY;YAAE,OAAO;QAE9B,aAAa,CAAC,IAAI,CAAC,CAAC;;;QAIpB,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE;YACpB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;SACtB;aAAM;;YAEL,GAAG,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;SACpD;;QAGD,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACvC,CAAC;IAED;;;;IAIA,SAAS,aAAa,CAAC,GAAQ;QAC7B,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;;;QAInC,IAAI,OAAO,GAAG,CAAC,CAAC;;;QAIhB,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;QAKjB,IAAI,gBAAgB,GAAG,KAAK,CAAC;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;;YAGxB,IAAI,CAAC,KAAK,EAAE;gBACV,gBAAgB,GAAG,IAAI,CAAC;gBACxB,SAAS;aACV;;YAGD,gBAAgB,GAAG,KAAK,CAAC;;YAGzB,IAAI,KAAK,KAAK,GAAG;gBAAE,SAAS;;;YAI5B,IAAI,KAAK,KAAK,IAAI,EAAE;gBAClB,IAAI,QAAQ,EAAE;oBACZ,gBAAgB,GAAG,IAAI,CAAC;oBACxB,QAAQ,EAAE,CAAC;oBACX,OAAO,EAAE,CAAC;iBACX;qBAAM,IAAI,YAAY,EAAE;;;oBAGvB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC;iBAC3B;gBACD,SAAS;aACV;;;YAID,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC;YAC1B,QAAQ,EAAE,CAAC;SACZ;QAED,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;YAChC,IAAI,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;SACzB;QACD,IAAI,CAAC,IAAI,KAAK,gBAAgB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;YACxD,IAAI,IAAI,GAAG,CAAC;SACb;QACD,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;aAGwB,OAAO,CAAC,KAAa,EAAE,IAAwB;QACrE,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QAE/B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;;QAG5B,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC/B,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;YAE5B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;;gBAEb,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACxB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACxB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;aACzB;YACD,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;SAC1B;QAED,aAAa,CAAC,GAAG,CAAC,CAAC;;QAGnB,IAAI,GAAG,CAAC,YAAY,EAAE;;YAEpB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,IAAI;gBAAE,OAAO,GAAG,CAAC;;;;YAKtB,MAAM,YAAY,GAAG,CAAC,IAAI,IAAI,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;YACrD,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;SACnE;;QAED,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI;YAAE,OAAO,GAAG,CAAC,IAAI,CAAC;;QAE9C,OAAO,GAAG,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACvE;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts b/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts new file mode 100644 index 000000000..b7f0b3b2d --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts @@ -0,0 +1,4 @@ +/** + * Attempts to resolve `input` URL/path relative to `base`. + */ +export default function resolve(input: string, base: string | undefined): string; diff --git a/node_modules/@jridgewell/resolve-uri/package.json b/node_modules/@jridgewell/resolve-uri/package.json new file mode 100644 index 000000000..7c39f82fd --- /dev/null +++ b/node_modules/@jridgewell/resolve-uri/package.json @@ -0,0 +1,64 @@ +{ + "name": "@jridgewell/resolve-uri", + "version": "3.0.6", + "description": "Resolve a URI relative to an optional base URI", + "keywords": [ + "resolve", + "uri", + "url", + "path" + ], + "author": "Justin Ridgewell ", + "license": "MIT", + "repository": "https://github.com/jridgewell/resolve-uri", + "main": "dist/resolve-uri.umd.js", + "module": "dist/resolve-uri.mjs", + "typings": "dist/types/resolve-uri.d.ts", + "exports": { + ".": { + "browser": "./dist/resolve-uri.umd.js", + "require": "./dist/resolve-uri.umd.js", + "import": "./dist/resolve-uri.mjs" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=6.0.0" + }, + "scripts": { + "prebuild": "rm -rf dist", + "build": "run-s -n build:*", + "build:rollup": "rollup -c rollup.config.js", + "build:ts": "tsc --project tsconfig.build.json", + "lint": "run-s -n lint:*", + "lint:prettier": "npm run test:lint:prettier -- --write", + "lint:ts": "npm run test:lint:ts -- --fix", + "pretest": "run-s build:rollup", + "test": "run-s -n test:lint test:only", + "test:debug": "mocha --inspect-brk", + "test:lint": "run-s -n test:lint:*", + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", + "test:lint:ts": "eslint '{src,test}/**/*.ts'", + "test:only": "mocha", + "test:coverage": "c8 mocha", + "test:watch": "mocha --watch", + "prepublishOnly": "npm run preversion", + "preversion": "run-s test build" + }, + "devDependencies": { + "@rollup/plugin-typescript": "8.3.0", + "@typescript-eslint/eslint-plugin": "5.10.0", + "@typescript-eslint/parser": "5.10.0", + "c8": "7.11.0", + "eslint": "8.7.0", + "eslint-config-prettier": "8.3.0", + "mocha": "9.2.0", + "npm-run-all": "4.1.5", + "prettier": "2.5.1", + "rollup": "2.66.0", + "typescript": "4.5.5" + } +} diff --git a/node_modules/@jridgewell/sourcemap-codec/LICENSE b/node_modules/@jridgewell/sourcemap-codec/LICENSE new file mode 100644 index 000000000..a331065a4 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2015 Rich Harris + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/@jridgewell/sourcemap-codec/README.md b/node_modules/@jridgewell/sourcemap-codec/README.md new file mode 100644 index 000000000..e4373aa92 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/README.md @@ -0,0 +1,63 @@ +# sourcemap-codec + +Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). + + +## Why? + +Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. + +This package makes the process slightly easier. + + +## Installation + +```bash +npm install sourcemap-codec +``` + + +## Usage + +```js +import { encode, decode } from 'sourcemap-codec'; + +var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); + +assert.deepEqual( decoded, [ + // the first line (of the generated code) has no mappings, + // as shown by the starting semi-colon (which separates lines) + [], + + // the second line contains four (comma-separated) segments + [ + // segments are encoded as you'd expect: + // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] + + // i.e. the first segment begins at column 2, and maps back to the second column + // of the second line (both zero-based) of the 0th source, and uses the 0th + // name in the `map.names` array + [ 2, 0, 2, 2, 0 ], + + // the remaining segments are 4-length rather than 5-length, + // because they don't map a name + [ 4, 0, 2, 4 ], + [ 6, 0, 2, 5 ], + [ 7, 0, 2, 7 ] + ], + + // the final line contains two segments + [ + [ 2, 1, 10, 19 ], + [ 12, 1, 11, 20 ] + ] +]); + +var encoded = encode( decoded ); +assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); +``` + + +# License + +MIT diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs new file mode 100644 index 000000000..4e92c1e65 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs @@ -0,0 +1,164 @@ +const comma = ','.charCodeAt(0); +const semicolon = ';'.charCodeAt(0); +const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +const intToChar = new Uint8Array(64); // 64 possible chars. +const charToInteger = new Uint8Array(128); // z is 122 in ASCII +for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + charToInteger[c] = i; + intToChar[i] = c; +} +// Provide a fallback for older environments. +const td = typeof TextDecoder !== 'undefined' + ? new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; +function decode(mappings) { + const state = new Int32Array(5); + const decoded = []; + let line = []; + let sorted = true; + let lastCol = 0; + for (let i = 0; i < mappings.length;) { + const c = mappings.charCodeAt(i); + if (c === comma) { + i++; + } + else if (c === semicolon) { + state[0] = lastCol = 0; + if (!sorted) + sort(line); + sorted = true; + decoded.push(line); + line = []; + i++; + } + else { + i = decodeInteger(mappings, i, state, 0); // generatedCodeColumn + const col = state[0]; + if (col < lastCol) + sorted = false; + lastCol = col; + if (!hasMoreSegments(mappings, i)) { + line.push([col]); + continue; + } + i = decodeInteger(mappings, i, state, 1); // sourceFileIndex + i = decodeInteger(mappings, i, state, 2); // sourceCodeLine + i = decodeInteger(mappings, i, state, 3); // sourceCodeColumn + if (!hasMoreSegments(mappings, i)) { + line.push([col, state[1], state[2], state[3]]); + continue; + } + i = decodeInteger(mappings, i, state, 4); // nameIndex + line.push([col, state[1], state[2], state[3], state[4]]); + } + } + if (!sorted) + sort(line); + decoded.push(line); + return decoded; +} +function decodeInteger(mappings, pos, state, j) { + let value = 0; + let shift = 0; + let integer = 0; + do { + const c = mappings.charCodeAt(pos++); + integer = charToInteger[c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + const shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + state[j] += value; + return pos; +} +function hasMoreSegments(mappings, i) { + if (i >= mappings.length) + return false; + const c = mappings.charCodeAt(i); + if (c === comma || c === semicolon) + return false; + return true; +} +function sort(line) { + line.sort(sortComparator); +} +function sortComparator(a, b) { + return a[0] - b[0]; +} +function encode(decoded) { + const state = new Int32Array(5); + let buf = new Uint8Array(1024); + let pos = 0; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) { + buf = reserve(buf, pos, 1); + buf[pos++] = semicolon; + } + if (line.length === 0) + continue; + state[0] = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + // We can push up to 5 ints, each int can take at most 7 chars, and we + // may push a comma. + buf = reserve(buf, pos, 36); + if (j > 0) + buf[pos++] = comma; + pos = encodeInteger(buf, pos, state, segment, 0); // generatedCodeColumn + if (segment.length === 1) + continue; + pos = encodeInteger(buf, pos, state, segment, 1); // sourceFileIndex + pos = encodeInteger(buf, pos, state, segment, 2); // sourceCodeLine + pos = encodeInteger(buf, pos, state, segment, 3); // sourceCodeColumn + if (segment.length === 4) + continue; + pos = encodeInteger(buf, pos, state, segment, 4); // nameIndex + } + } + return td.decode(buf.subarray(0, pos)); +} +function reserve(buf, pos, count) { + if (buf.length > pos + count) + return buf; + const swap = new Uint8Array(buf.length * 2); + swap.set(buf); + return swap; +} +function encodeInteger(buf, pos, state, segment, j) { + const next = segment[j]; + let num = next - state[j]; + state[j] = next; + num = num < 0 ? (-num << 1) | 1 : num << 1; + do { + let clamped = num & 0b011111; + num >>>= 5; + if (num > 0) + clamped |= 0b100000; + buf[pos++] = intToChar[clamped]; + } while (num > 0); + return pos; +} + +export { decode, encode }; +//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map new file mode 100644 index 000000000..f3f6e2d40 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"sourcemap-codec.mjs","sources":["../../src/sourcemap-codec.ts"],"sourcesContent":[null],"names":[],"mappings":"AAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACrC,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAClB;AAED;AACA,MAAM,EAAE,GACN,OAAO,WAAW,KAAK,WAAW;MAC9B,IAAI,WAAW,EAAE;MACjB,OAAO,MAAM,KAAK,WAAW;UAC7B;YACE,MAAM,CAAC,GAAe;gBACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;gBACpE,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;aACvB;SACF;UACD;YACE,MAAM,CAAC,GAAe;gBACpB,IAAI,GAAG,GAAG,EAAE,CAAC;gBACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACnC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpC;gBACD,OAAO,GAAG,CAAC;aACZ;SACF,CAAC;SAEQ,MAAM,CAAC,QAAgB;IACrC,MAAM,KAAK,GAA6C,IAAI,UAAU,CAAC,CAAC,CAAQ,CAAC;IACjF,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,IAAI,IAAI,GAAkB,EAAE,CAAC;IAC7B,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAI;QACrC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,CAAC,KAAK,KAAK,EAAE;YACf,CAAC,EAAE,CAAC;SACL;aAAM,IAAI,CAAC,KAAK,SAAS,EAAE;YAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;YACvB,IAAI,CAAC,MAAM;gBAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,MAAM,GAAG,IAAI,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,IAAI,GAAG,EAAE,CAAC;YACV,CAAC,EAAE,CAAC;SACL;aAAM;YACL,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACzC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,GAAG,GAAG,OAAO;gBAAE,MAAM,GAAG,KAAK,CAAC;YAClC,OAAO,GAAG,GAAG,CAAC;YAEd,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACjB,SAAS;aACV;YAED,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACzC,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACzC,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAEzC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,SAAS;aACV;YAED,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1D;KACF;IAED,IAAI,CAAC,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB,EAAE,GAAW,EAAE,KAAuB,EAAE,CAAS;IACtF,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,GAAG;QACD,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC3B,KAAK,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,KAAK,CAAC;QACjC,KAAK,IAAI,CAAC,CAAC;KACZ,QAAQ,OAAO,GAAG,EAAE,EAAE;IAEvB,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,CAAC;IAEb,IAAI,YAAY,EAAE;QAChB,KAAK,GAAG,CAAC,UAAU,GAAG,CAAC,KAAK,CAAC;KAC9B;IAED,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;IAClB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB,EAAE,CAAS;IAClD,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEvC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACjD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,IAAI,CAAC,IAAwB;IACpC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,cAAc,CAAC,CAAmB,EAAE,CAAmB;IAC9D,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;SAEe,MAAM,CAAC,OAA0B;IAC/C,MAAM,KAAK,GAA6C,IAAI,UAAU,CAAC,CAAC,CAAQ,CAAC;IACjF,IAAI,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,GAAG,GAAG,CAAC,CAAC;IAEZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,EAAE;YACT,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;YAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;SACxB;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEhC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;;;YAGxB,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC;gBAAE,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;YAE9B,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YACnC,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YACjD,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YACjD,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YACnC,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;SAClD;KACF;IAED,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,OAAO,CAAC,GAAe,EAAE,GAAW,EAAE,KAAa;IAC1D,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK;QAAE,OAAO,GAAG,CAAC;IAEzC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CACpB,GAAe,EACf,GAAW,EACX,KAAuB,EACvB,OAAyB,EACzB,CAAS;IAET,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEhB,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAC3C,GAAG;QACD,IAAI,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAC;QAC7B,GAAG,MAAM,CAAC,CAAC;QACX,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC;QACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;KACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;IAElB,OAAO,GAAG,CAAC;AACb;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js new file mode 100644 index 000000000..b5aa0c43c --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js @@ -0,0 +1,175 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {})); +})(this, (function (exports) { 'use strict'; + + const comma = ','.charCodeAt(0); + const semicolon = ';'.charCodeAt(0); + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + const intToChar = new Uint8Array(64); // 64 possible chars. + const charToInteger = new Uint8Array(128); // z is 122 in ASCII + for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + charToInteger[c] = i; + intToChar[i] = c; + } + // Provide a fallback for older environments. + const td = typeof TextDecoder !== 'undefined' + ? new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; + function decode(mappings) { + const state = new Int32Array(5); + const decoded = []; + let line = []; + let sorted = true; + let lastCol = 0; + for (let i = 0; i < mappings.length;) { + const c = mappings.charCodeAt(i); + if (c === comma) { + i++; + } + else if (c === semicolon) { + state[0] = lastCol = 0; + if (!sorted) + sort(line); + sorted = true; + decoded.push(line); + line = []; + i++; + } + else { + i = decodeInteger(mappings, i, state, 0); // generatedCodeColumn + const col = state[0]; + if (col < lastCol) + sorted = false; + lastCol = col; + if (!hasMoreSegments(mappings, i)) { + line.push([col]); + continue; + } + i = decodeInteger(mappings, i, state, 1); // sourceFileIndex + i = decodeInteger(mappings, i, state, 2); // sourceCodeLine + i = decodeInteger(mappings, i, state, 3); // sourceCodeColumn + if (!hasMoreSegments(mappings, i)) { + line.push([col, state[1], state[2], state[3]]); + continue; + } + i = decodeInteger(mappings, i, state, 4); // nameIndex + line.push([col, state[1], state[2], state[3], state[4]]); + } + } + if (!sorted) + sort(line); + decoded.push(line); + return decoded; + } + function decodeInteger(mappings, pos, state, j) { + let value = 0; + let shift = 0; + let integer = 0; + do { + const c = mappings.charCodeAt(pos++); + integer = charToInteger[c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + const shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + state[j] += value; + return pos; + } + function hasMoreSegments(mappings, i) { + if (i >= mappings.length) + return false; + const c = mappings.charCodeAt(i); + if (c === comma || c === semicolon) + return false; + return true; + } + function sort(line) { + line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[0] - b[0]; + } + function encode(decoded) { + const state = new Int32Array(5); + let buf = new Uint8Array(1024); + let pos = 0; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) { + buf = reserve(buf, pos, 1); + buf[pos++] = semicolon; + } + if (line.length === 0) + continue; + state[0] = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + // We can push up to 5 ints, each int can take at most 7 chars, and we + // may push a comma. + buf = reserve(buf, pos, 36); + if (j > 0) + buf[pos++] = comma; + pos = encodeInteger(buf, pos, state, segment, 0); // generatedCodeColumn + if (segment.length === 1) + continue; + pos = encodeInteger(buf, pos, state, segment, 1); // sourceFileIndex + pos = encodeInteger(buf, pos, state, segment, 2); // sourceCodeLine + pos = encodeInteger(buf, pos, state, segment, 3); // sourceCodeColumn + if (segment.length === 4) + continue; + pos = encodeInteger(buf, pos, state, segment, 4); // nameIndex + } + } + return td.decode(buf.subarray(0, pos)); + } + function reserve(buf, pos, count) { + if (buf.length > pos + count) + return buf; + const swap = new Uint8Array(buf.length * 2); + swap.set(buf); + return swap; + } + function encodeInteger(buf, pos, state, segment, j) { + const next = segment[j]; + let num = next - state[j]; + state[j] = next; + num = num < 0 ? (-num << 1) | 1 : num << 1; + do { + let clamped = num & 0b011111; + num >>>= 5; + if (num > 0) + clamped |= 0b100000; + buf[pos++] = intToChar[clamped]; + } while (num > 0); + return pos; + } + + exports.decode = decode; + exports.encode = encode; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map new file mode 100644 index 000000000..fce7c4b84 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sourcemap-codec.umd.js","sources":["../../src/sourcemap-codec.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;IAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,kEAAkE,CAAC;IACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAClB;IAED;IACA,MAAM,EAAE,GACN,OAAO,WAAW,KAAK,WAAW;UAC9B,IAAI,WAAW,EAAE;UACjB,OAAO,MAAM,KAAK,WAAW;cAC7B;gBACE,MAAM,CAAC,GAAe;oBACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;oBACpE,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;iBACvB;aACF;cACD;gBACE,MAAM,CAAC,GAAe;oBACpB,IAAI,GAAG,GAAG,EAAE,CAAC;oBACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACnC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;qBACpC;oBACD,OAAO,GAAG,CAAC;iBACZ;aACF,CAAC;aAEQ,MAAM,CAAC,QAAgB;QACrC,MAAM,KAAK,GAA6C,IAAI,UAAU,CAAC,CAAC,CAAQ,CAAC;QACjF,MAAM,OAAO,GAAsB,EAAE,CAAC;QACtC,IAAI,IAAI,GAAkB,EAAE,CAAC;QAC7B,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,OAAO,GAAG,CAAC,CAAC;QAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAI;YACrC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAEjC,IAAI,CAAC,KAAK,KAAK,EAAE;gBACf,CAAC,EAAE,CAAC;aACL;iBAAM,IAAI,CAAC,KAAK,SAAS,EAAE;gBAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;gBACvB,IAAI,CAAC,MAAM;oBAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACxB,MAAM,GAAG,IAAI,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnB,IAAI,GAAG,EAAE,CAAC;gBACV,CAAC,EAAE,CAAC;aACL;iBAAM;gBACL,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACzC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACrB,IAAI,GAAG,GAAG,OAAO;oBAAE,MAAM,GAAG,KAAK,CAAC;gBAClC,OAAO,GAAG,GAAG,CAAC;gBAEd,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE;oBACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBACjB,SAAS;iBACV;gBAED,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACzC,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACzC,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBAEzC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE;oBACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC/C,SAAS;iBACV;gBAED,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACzC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC1D;SACF;QAED,IAAI,CAAC,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEnB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS,aAAa,CAAC,QAAgB,EAAE,GAAW,EAAE,KAAuB,EAAE,CAAS;QACtF,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,OAAO,GAAG,CAAC,CAAC;QAEhB,GAAG;YACD,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;YACrC,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC3B,KAAK,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,KAAK,CAAC;YACjC,KAAK,IAAI,CAAC,CAAC;SACZ,QAAQ,OAAO,GAAG,EAAE,EAAE;QAEvB,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,CAAC;QAC/B,KAAK,MAAM,CAAC,CAAC;QAEb,IAAI,YAAY,EAAE;YAChB,KAAK,GAAG,CAAC,UAAU,GAAG,CAAC,KAAK,CAAC;SAC9B;QAED,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAClB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,SAAS,eAAe,CAAC,QAAgB,EAAE,CAAS;QAClD,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAEvC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,IAAI,CAAC,IAAwB;QACpC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5B,CAAC;IAED,SAAS,cAAc,CAAC,CAAmB,EAAE,CAAmB;QAC9D,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;aAEe,MAAM,CAAC,OAA0B;QAC/C,MAAM,KAAK,GAA6C,IAAI,UAAU,CAAC,CAAC,CAAQ,CAAC;QACjF,IAAI,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,GAAG,GAAG,CAAC,CAAC;QAEZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;aACxB;YACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAEhC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;;;gBAGxB,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC5B,IAAI,CAAC,GAAG,CAAC;oBAAE,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;gBAE9B,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;gBAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBACnC,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;gBACjD,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;gBACjD,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;gBAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBACnC,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;aAClD;SACF;QAED,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,OAAO,CAAC,GAAe,EAAE,GAAW,EAAE,KAAa;QAC1D,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK;YAAE,OAAO,GAAG,CAAC;QAEzC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,aAAa,CACpB,GAAe,EACf,GAAW,EACX,KAAuB,EACvB,OAAyB,EACzB,CAAS;QAET,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QAEhB,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC3C,GAAG;YACD,IAAI,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC7B,GAAG,MAAM,CAAC,CAAC;YACX,IAAI,GAAG,GAAG,CAAC;gBAAE,OAAO,IAAI,QAAQ,CAAC;YACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;SACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;QAElB,OAAO,GAAG,CAAC;IACb;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts b/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts new file mode 100644 index 000000000..6ac3c1d52 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts @@ -0,0 +1,5 @@ +export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; +export declare type SourceMapLine = SourceMapSegment[]; +export declare type SourceMapMappings = SourceMapLine[]; +export declare function decode(mappings: string): SourceMapMappings; +export declare function encode(decoded: SourceMapMappings): string; diff --git a/node_modules/@jridgewell/sourcemap-codec/package.json b/node_modules/@jridgewell/sourcemap-codec/package.json new file mode 100644 index 000000000..0dc07c910 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/package.json @@ -0,0 +1,69 @@ +{ + "name": "@jridgewell/sourcemap-codec", + "version": "1.4.11", + "description": "Encode/decode sourcemap mappings", + "keywords": [ + "sourcemap", + "vlq" + ], + "main": "dist/sourcemap-codec.umd.js", + "module": "dist/sourcemap-codec.mjs", + "typings": "dist/types/sourcemap-codec.d.ts", + "files": [ + "dist" + ], + "exports": { + ".": { + "browser": "./dist/sourcemap-codec.umd.js", + "import": "./dist/sourcemap-codec.mjs", + "require": "./dist/sourcemap-codec.umd.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "benchmark": "run-s build:rollup benchmark:only", + "benchmark:only": "node benchmark/index.js", + "build": "run-s -n build:*", + "build:rollup": "rollup -c rollup.config.js", + "build:ts": "tsc --project tsconfig.build.json", + "lint": "run-s -n lint:*", + "lint:prettier": "npm run test:lint:prettier -- --write", + "lint:ts": "npm run test:lint:ts -- --fix", + "prebuild": "rm -rf dist", + "prepublishOnly": "npm run preversion", + "preversion": "run-s test build", + "pretest": "run-s build:rollup", + "test": "run-s -n test:lint test:only", + "test:debug": "mocha --inspect-brk", + "test:lint": "run-s -n test:lint:*", + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", + "test:lint:ts": "eslint '{src,test}/**/*.ts'", + "test:only": "mocha", + "test:coverage": "c8 mocha", + "test:watch": "mocha --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/jridgewell/sourcemap-codec.git" + }, + "author": "Rich Harris", + "license": "MIT", + "devDependencies": { + "@rollup/plugin-typescript": "8.3.0", + "@types/node": "17.0.15", + "@typescript-eslint/eslint-plugin": "5.10.0", + "@typescript-eslint/parser": "5.10.0", + "benchmark": "2.1.4", + "c8": "7.11.0", + "eslint": "8.7.0", + "eslint-config-prettier": "8.3.0", + "mocha": "9.2.0", + "npm-run-all": "4.1.5", + "prettier": "2.5.1", + "rollup": "2.64.0", + "source-map": "0.6.1", + "source-map-js": "1.0.2", + "sourcemap-codec": "1.4.8", + "typescript": "4.5.4" + } +} diff --git a/node_modules/@jridgewell/trace-mapping/LICENSE b/node_modules/@jridgewell/trace-mapping/LICENSE new file mode 100644 index 000000000..37bb488f0 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/LICENSE @@ -0,0 +1,19 @@ +Copyright 2022 Justin Ridgewell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jridgewell/trace-mapping/README.md b/node_modules/@jridgewell/trace-mapping/README.md new file mode 100644 index 000000000..8286cee0d --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/README.md @@ -0,0 +1,193 @@ +# @jridgewell/trace-mapping + +> Trace the original position through a source map + +`trace-mapping` allows you to take the line and column of an output file and trace it to the +original location in the source file through a source map. + +You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This +provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM. + +## Installation + +```sh +npm install @jridgewell/trace-mapping +``` + +## Usage + +```typescript +import { TraceMap, originalPositionFor, generatedPositionFor } from '@jridgewell/trace-mapping'; + +const tracer = new TraceMap({ + version: 3, + sources: ['input.js'], + names: ['foo'], + mappings: 'KAyCIA', +}); + +// Lines start at line 1, columns at column 0. +const traced = originalPositionFor(tracer, { line: 1, column: 5 }); +assert.deepEqual(traced, { + source: 'input.js', + line: 42, + column: 4, + name: 'foo', +}); + +const generated = generatedPositionFor(tracer, { + source: 'input.js', + line: 42, + column: 4, +}); +assert.deepEqual(generated, { + line: 1, + column: 5, +}); +``` + +We also provide a lower level API to get the actual segment that matches our line and column. Unlike +`originalPositionFor`, `traceSegment` uses a 0-base for `line`: + +```typescript +import { traceSegment } from '@jridgewell/trace-mapping'; + +// line is 0-base. +const traced = traceSegment(tracer, /* line */ 0, /* column */ 5); + +// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] +// Again, line is 0-base and so is sourceLine +assert.deepEqual(traced, [5, 0, 41, 4, 0]); +``` + +### SectionedSourceMaps + +The sourcemap spec defines a special `sections` field that's designed to handle concatenation of +output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool +produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap` +helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a +`TraceMap` instance: + +```typescript +import { AnyMap } from '@jridgewell/trace-mapping'; +const fooOutput = 'foo'; +const barOutput = 'bar'; +const output = [fooOutput, barOutput].join('\n'); + +const sectioned = new AnyMap({ + version: 3, + sections: [ + { + // 0-base line and column + offset: { line: 0, column: 0 }, + // fooOutput's sourcemap + map: { + version: 3, + sources: ['foo.js'], + names: ['foo'], + mappings: 'AAAAA', + }, + }, + { + // barOutput's sourcemap will not affect the first line, only the second + offset: { line: 1, column: 0 }, + map: { + version: 3, + sources: ['bar.js'], + names: ['bar'], + mappings: 'AAAAA', + }, + }, + ], +}); + +const traced = originalPositionFor(sectioned, { + line: 2, + column: 0, +}); + +assert.deepEqual(traced, { + source: 'bar.js', + line: 1, + column: 0, + name: 'bar', +}); +``` + +## Benchmarks + +``` +node v18.0.0 + +amp.js.map +trace-mapping: decoded JSON input x 183 ops/sec ±0.41% (87 runs sampled) +trace-mapping: encoded JSON input x 384 ops/sec ±0.89% (89 runs sampled) +trace-mapping: decoded Object input x 3,085 ops/sec ±0.24% (100 runs sampled) +trace-mapping: encoded Object input x 452 ops/sec ±0.80% (84 runs sampled) +source-map-js: encoded Object input x 88.82 ops/sec ±0.45% (77 runs sampled) +source-map-0.6.1: encoded Object input x 38.39 ops/sec ±1.88% (52 runs sampled) +Fastest is trace-mapping: decoded Object input + +trace-mapping: decoded originalPositionFor x 4,025,347 ops/sec ±0.15% (97 runs sampled) +trace-mapping: encoded originalPositionFor x 3,333,136 ops/sec ±1.26% (90 runs sampled) +source-map-js: encoded originalPositionFor x 824,978 ops/sec ±1.06% (94 runs sampled) +source-map-0.6.1: encoded originalPositionFor x 741,300 ops/sec ±0.93% (92 runs sampled) +source-map-0.8.0: encoded originalPositionFor x 2,587,603 ops/sec ±0.75% (97 runs sampled) +Fastest is trace-mapping: decoded originalPositionFor + +*** + +babel.min.js.map +trace-mapping: decoded JSON input x 17.43 ops/sec ±8.81% (33 runs sampled) +trace-mapping: encoded JSON input x 34.18 ops/sec ±4.67% (50 runs sampled) +trace-mapping: decoded Object input x 1,010 ops/sec ±0.41% (98 runs sampled) +trace-mapping: encoded Object input x 39.45 ops/sec ±4.01% (52 runs sampled) +source-map-js: encoded Object input x 6.57 ops/sec ±3.04% (21 runs sampled) +source-map-0.6.1: encoded Object input x 4.23 ops/sec ±2.93% (15 runs sampled) +Fastest is trace-mapping: decoded Object input + +trace-mapping: decoded originalPositionFor x 7,576,265 ops/sec ±0.74% (96 runs sampled) +trace-mapping: encoded originalPositionFor x 5,019,743 ops/sec ±0.74% (94 runs sampled) +source-map-js: encoded originalPositionFor x 3,396,137 ops/sec ±42.32% (95 runs sampled) +source-map-0.6.1: encoded originalPositionFor x 3,753,176 ops/sec ±0.72% (95 runs sampled) +source-map-0.8.0: encoded originalPositionFor x 6,423,633 ops/sec ±0.74% (95 runs sampled) +Fastest is trace-mapping: decoded originalPositionFor + +*** + +preact.js.map +trace-mapping: decoded JSON input x 3,499 ops/sec ±0.18% (98 runs sampled) +trace-mapping: encoded JSON input x 6,078 ops/sec ±0.25% (99 runs sampled) +trace-mapping: decoded Object input x 254,788 ops/sec ±0.13% (100 runs sampled) +trace-mapping: encoded Object input x 14,063 ops/sec ±0.27% (94 runs sampled) +source-map-js: encoded Object input x 2,465 ops/sec ±0.25% (98 runs sampled) +source-map-0.6.1: encoded Object input x 1,174 ops/sec ±1.90% (95 runs sampled) +Fastest is trace-mapping: decoded Object input + +trace-mapping: decoded originalPositionFor x 7,720,171 ops/sec ±0.14% (97 runs sampled) +trace-mapping: encoded originalPositionFor x 6,864,485 ops/sec ±0.16% (101 runs sampled) +source-map-js: encoded originalPositionFor x 2,387,219 ops/sec ±0.28% (98 runs sampled) +source-map-0.6.1: encoded originalPositionFor x 1,565,339 ops/sec ±0.32% (101 runs sampled) +source-map-0.8.0: encoded originalPositionFor x 3,819,732 ops/sec ±0.38% (98 runs sampled) +Fastest is trace-mapping: decoded originalPositionFor + +*** + +react.js.map +trace-mapping: decoded JSON input x 1,719 ops/sec ±0.19% (99 runs sampled) +trace-mapping: encoded JSON input x 4,284 ops/sec ±0.51% (99 runs sampled) +trace-mapping: decoded Object input x 94,668 ops/sec ±0.08% (99 runs sampled) +trace-mapping: encoded Object input x 5,287 ops/sec ±0.24% (99 runs sampled) +source-map-js: encoded Object input x 814 ops/sec ±0.20% (98 runs sampled) +source-map-0.6.1: encoded Object input x 429 ops/sec ±0.24% (94 runs sampled) +Fastest is trace-mapping: decoded Object input + +trace-mapping: decoded originalPositionFor x 28,927,989 ops/sec ±0.61% (94 runs sampled) +trace-mapping: encoded originalPositionFor x 27,394,475 ops/sec ±0.55% (97 runs sampled) +source-map-js: encoded originalPositionFor x 16,856,730 ops/sec ±0.45% (96 runs sampled) +source-map-0.6.1: encoded originalPositionFor x 12,258,950 ops/sec ±0.41% (97 runs sampled) +source-map-0.8.0: encoded originalPositionFor x 22,272,990 ops/sec ±0.58% (95 runs sampled) +Fastest is trace-mapping: decoded originalPositionFor +``` + +[source-map]: https://www.npmjs.com/package/source-map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs new file mode 100644 index 000000000..8fce400cd --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs @@ -0,0 +1,514 @@ +import { encode, decode } from '@jridgewell/sourcemap-codec'; +import resolveUri from '@jridgewell/resolve-uri'; + +function resolve(input, base) { + // The base is always treated as a directory, if it's not empty. + // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 + // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 + if (base && !base.endsWith('/')) + base += '/'; + return resolveUri(input, base); +} + +/** + * Removes everything after the last "/", but leaves the slash. + */ +function stripFilename(path) { + if (!path) + return ''; + const index = path.lastIndexOf('/'); + return path.slice(0, index + 1); +} + +const COLUMN = 0; +const SOURCES_INDEX = 1; +const SOURCE_LINE = 2; +const SOURCE_COLUMN = 3; +const NAMES_INDEX = 4; +const REV_GENERATED_LINE = 1; +const REV_GENERATED_COLUMN = 2; + +function maybeSort(mappings, owned) { + const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); + if (unsortedIndex === mappings.length) + return mappings; + // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If + // not, we do not want to modify the consumer's input array. + if (!owned) + mappings = mappings.slice(); + for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { + mappings[i] = sortSegments(mappings[i], owned); + } + return mappings; +} +function nextUnsortedSegmentLine(mappings, start) { + for (let i = start; i < mappings.length; i++) { + if (!isSorted(mappings[i])) + return i; + } + return mappings.length; +} +function isSorted(line) { + for (let j = 1; j < line.length; j++) { + if (line[j][COLUMN] < line[j - 1][COLUMN]) { + return false; + } + } + return true; +} +function sortSegments(line, owned) { + if (!owned) + line = line.slice(); + return line.sort(sortComparator); +} +function sortComparator(a, b) { + return a[COLUMN] - b[COLUMN]; +} + +let found = false; +/** + * A binary search implementation that returns the index if a match is found. + * If no match is found, then the left-index (the index associated with the item that comes just + * before the desired index) is returned. To maintain proper sort order, a splice would happen at + * the next index: + * + * ```js + * const array = [1, 3]; + * const needle = 2; + * const index = binarySearch(array, needle, (item, needle) => item - needle); + * + * assert.equal(index, 0); + * array.splice(index + 1, 0, needle); + * assert.deepEqual(array, [1, 2, 3]); + * ``` + */ +function binarySearch(haystack, needle, low, high) { + while (low <= high) { + const mid = low + ((high - low) >> 1); + const cmp = haystack[mid][COLUMN] - needle; + if (cmp === 0) { + found = true; + return mid; + } + if (cmp < 0) { + low = mid + 1; + } + else { + high = mid - 1; + } + } + found = false; + return low - 1; +} +function upperBound(haystack, needle, index) { + for (let i = index + 1; i < haystack.length; i++, index++) { + if (haystack[i][COLUMN] !== needle) + break; + } + return index; +} +function lowerBound(haystack, needle, index) { + for (let i = index - 1; i >= 0; i--, index--) { + if (haystack[i][COLUMN] !== needle) + break; + } + return index; +} +function memoizedState() { + return { + lastKey: -1, + lastNeedle: -1, + lastIndex: -1, + }; +} +/** + * This overly complicated beast is just to record the last tested line/column and the resulting + * index, allowing us to skip a few tests if mappings are monotonically increasing. + */ +function memoizedBinarySearch(haystack, needle, state, key) { + const { lastKey, lastNeedle, lastIndex } = state; + let low = 0; + let high = haystack.length - 1; + if (key === lastKey) { + if (needle === lastNeedle) { + found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; + return lastIndex; + } + if (needle >= lastNeedle) { + // lastIndex may be -1 if the previous needle was not found. + low = lastIndex === -1 ? 0 : lastIndex; + } + else { + high = lastIndex; + } + } + state.lastKey = key; + state.lastNeedle = needle; + return (state.lastIndex = binarySearch(haystack, needle, low, high)); +} + +// Rebuilds the original source files, with mappings that are ordered by source line/column instead +// of generated line/column. +function buildBySources(decoded, memos) { + const sources = memos.map(buildNullArray); + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + if (seg.length === 1) + continue; + const sourceIndex = seg[SOURCES_INDEX]; + const sourceLine = seg[SOURCE_LINE]; + const sourceColumn = seg[SOURCE_COLUMN]; + const originalSource = sources[sourceIndex]; + const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); + const memo = memos[sourceIndex]; + // The binary search either found a match, or it found the left-index just before where the + // segment should go. Either way, we want to insert after that. And there may be multiple + // generated segments associated with an original location, so there may need to move several + // indexes before we find where we need to insert. + const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); + insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); + } + } + return sources; +} +function insert(array, index, value) { + for (let i = array.length; i > index; i--) { + array[i] = array[i - 1]; + } + array[index] = value; +} +// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like +// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. +// Numeric properties on objects are magically sorted in ascending order by the engine regardless of +// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending +// order when iterating with for-in. +function buildNullArray() { + return { __proto__: null }; +} + +const AnyMap = function (map, mapUrl) { + const parsed = typeof map === 'string' ? JSON.parse(map) : map; + if (!('sections' in parsed)) + return new TraceMap(parsed, mapUrl); + const mappings = []; + const sources = []; + const sourcesContent = []; + const names = []; + const { sections } = parsed; + let i = 0; + for (; i < sections.length - 1; i++) { + const no = sections[i + 1].offset; + addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column); + } + if (sections.length > 0) { + addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity); + } + const joined = { + version: 3, + file: parsed.file, + names, + sources, + sourcesContent, + mappings, + }; + return presortedDecodedMap(joined); +}; +function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) { + const map = AnyMap(section.map, mapUrl); + const { line: lineOffset, column: columnOffset } = section.offset; + const sourcesOffset = sources.length; + const namesOffset = names.length; + const decoded = decodedMappings(map); + const { resolvedSources } = map; + append(sources, resolvedSources); + append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length)); + append(names, map.names); + // If this section jumps forwards several lines, we need to add lines to the output mappings catch up. + for (let i = mappings.length; i <= lineOffset; i++) + mappings.push([]); + // We can only add so many lines before we step into the range that the next section's map + // controls. When we get to the last line, then we'll start checking the segments to see if + // they've crossed into the column range. + const stopI = stopLine - lineOffset; + const len = Math.min(decoded.length, stopI + 1); + for (let i = 0; i < len; i++) { + const line = decoded[i]; + // On the 0th loop, the line will already exist due to a previous section, or the line catch up + // loop above. + const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []); + // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the + // map can be multiple lines), it doesn't. + const cOffset = i === 0 ? columnOffset : 0; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const column = cOffset + seg[COLUMN]; + // If this segment steps into the column range that the next section's map controls, we need + // to stop early. + if (i === stopI && column >= stopColumn) + break; + if (seg.length === 1) { + out.push([column]); + continue; + } + const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; + const sourceLine = seg[SOURCE_LINE]; + const sourceColumn = seg[SOURCE_COLUMN]; + if (seg.length === 4) { + out.push([column, sourcesIndex, sourceLine, sourceColumn]); + continue; + } + out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); + } + } +} +function append(arr, other) { + for (let i = 0; i < other.length; i++) + arr.push(other[i]); +} +// Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of +// equal length to the sources. This is because the sources and sourcesContent are paired arrays, +// where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined +// sourcemap would desynchronize the sources/contents. +function fillSourcesContent(len) { + const sourcesContent = []; + for (let i = 0; i < len; i++) + sourcesContent[i] = null; + return sourcesContent; +} + +const INVALID_ORIGINAL_MAPPING = Object.freeze({ + source: null, + line: null, + column: null, + name: null, +}); +const INVALID_GENERATED_MAPPING = Object.freeze({ + line: null, + column: null, +}); +const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; +const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; +const LEAST_UPPER_BOUND = -1; +const GREATEST_LOWER_BOUND = 1; +/** + * Returns the encoded (VLQ string) form of the SourceMap's mappings field. + */ +let encodedMappings; +/** + * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. + */ +let decodedMappings; +/** + * A low-level API to find the segment associated with a generated line/column (think, from a + * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. + */ +let traceSegment; +/** + * A higher-level API to find the source/line/column associated with a generated line/column + * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in + * `source-map` library. + */ +let originalPositionFor; +/** + * Finds the source/line/column directly after the mapping returned by originalPositionFor, provided + * the found mapping is from the same source and line as the originalPositionFor mapping. + * + * Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1` + * using the same needle that would return `id` when calling `originalPositionFor`. + */ +let generatedPositionFor; +/** + * Iterates each mapping in generated position order. + */ +let eachMapping; +/** + * A helper that skips sorting of the input map's mappings array, which can be expensive for larger + * maps. + */ +let presortedDecodedMap; +/** + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ +let decodedMap; +/** + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ +let encodedMap; +class TraceMap { + constructor(map, mapUrl) { + this._decodedMemo = memoizedState(); + this._bySources = undefined; + this._bySourceMemos = undefined; + const isString = typeof map === 'string'; + if (!isString && map.constructor === TraceMap) + return map; + const parsed = (isString ? JSON.parse(map) : map); + const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; + this.version = version; + this.file = file; + this.names = names; + this.sourceRoot = sourceRoot; + this.sources = sources; + this.sourcesContent = sourcesContent; + if (sourceRoot || mapUrl) { + const from = resolve(sourceRoot || '', stripFilename(mapUrl)); + this.resolvedSources = sources.map((s) => resolve(s || '', from)); + } + else { + this.resolvedSources = sources.map((s) => s || ''); + } + const { mappings } = parsed; + if (typeof mappings === 'string') { + this._encoded = mappings; + this._decoded = undefined; + } + else { + this._encoded = undefined; + this._decoded = maybeSort(mappings, isString); + } + } +} +(() => { + encodedMappings = (map) => { + var _a; + return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode(map._decoded))); + }; + decodedMappings = (map) => { + return (map._decoded || (map._decoded = decode(map._encoded))); + }; + traceSegment = (map, line, column) => { + const decoded = decodedMappings(map); + // It's common for parent source maps to have pointers to lines that have no + // mapping (like a "//# sourceMappingURL=") at the end of the child file. + if (line >= decoded.length) + return null; + return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND); + }; + originalPositionFor = (map, { line, column, bias }) => { + line--; + if (line < 0) + throw new Error(LINE_GTR_ZERO); + if (column < 0) + throw new Error(COL_GTR_EQ_ZERO); + const decoded = decodedMappings(map); + // It's common for parent source maps to have pointers to lines that have no + // mapping (like a "//# sourceMappingURL=") at the end of the child file. + if (line >= decoded.length) + return INVALID_ORIGINAL_MAPPING; + const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); + if (segment == null) + return INVALID_ORIGINAL_MAPPING; + if (segment.length == 1) + return INVALID_ORIGINAL_MAPPING; + const { names, resolvedSources } = map; + return { + source: resolvedSources[segment[SOURCES_INDEX]], + line: segment[SOURCE_LINE] + 1, + column: segment[SOURCE_COLUMN], + name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null, + }; + }; + generatedPositionFor = (map, { source, line, column, bias }) => { + line--; + if (line < 0) + throw new Error(LINE_GTR_ZERO); + if (column < 0) + throw new Error(COL_GTR_EQ_ZERO); + const { sources, resolvedSources } = map; + let sourceIndex = sources.indexOf(source); + if (sourceIndex === -1) + sourceIndex = resolvedSources.indexOf(source); + if (sourceIndex === -1) + return INVALID_GENERATED_MAPPING; + const generated = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); + const memos = map._bySourceMemos; + const segments = generated[sourceIndex][line]; + if (segments == null) + return INVALID_GENERATED_MAPPING; + const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND); + if (segment == null) + return INVALID_GENERATED_MAPPING; + return { + line: segment[REV_GENERATED_LINE] + 1, + column: segment[REV_GENERATED_COLUMN], + }; + }; + eachMapping = (map, cb) => { + const decoded = decodedMappings(map); + const { names, resolvedSources } = map; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const generatedLine = i + 1; + const generatedColumn = seg[0]; + let source = null; + let originalLine = null; + let originalColumn = null; + let name = null; + if (seg.length !== 1) { + source = resolvedSources[seg[1]]; + originalLine = seg[2] + 1; + originalColumn = seg[3]; + } + if (seg.length === 5) + name = names[seg[4]]; + cb({ + generatedLine, + generatedColumn, + source, + originalLine, + originalColumn, + name, + }); + } + } + }; + presortedDecodedMap = (map, mapUrl) => { + const clone = Object.assign({}, map); + clone.mappings = []; + const tracer = new TraceMap(clone, mapUrl); + tracer._decoded = map.mappings; + return tracer; + }; + decodedMap = (map) => { + return { + version: 3, + file: map.file, + names: map.names, + sourceRoot: map.sourceRoot, + sources: map.sources, + sourcesContent: map.sourcesContent, + mappings: decodedMappings(map), + }; + }; + encodedMap = (map) => { + return { + version: 3, + file: map.file, + names: map.names, + sourceRoot: map.sourceRoot, + sources: map.sources, + sourcesContent: map.sourcesContent, + mappings: encodedMappings(map), + }; + }; +})(); +function traceSegmentInternal(segments, memo, line, column, bias) { + let index = memoizedBinarySearch(segments, column, memo, line); + if (found) { + index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); + } + else if (bias === LEAST_UPPER_BOUND) + index++; + if (index === -1 || index === segments.length) + return null; + return segments[index]; +} + +export { AnyMap, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap, decodedMap, decodedMappings, eachMapping, encodedMap, encodedMappings, generatedPositionFor, originalPositionFor, presortedDecodedMap, traceSegment }; +//# sourceMappingURL=trace-mapping.mjs.map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map new file mode 100644 index 000000000..fec776904 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"trace-mapping.mjs","sources":["../../src/resolve.ts","../../src/strip-filename.ts","../../src/sourcemap-segment.ts","../../src/sort.ts","../../src/binary-search.ts","../../src/by-source.ts","../../src/any-map.ts","../../src/trace-mapping.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["bsFound"],"mappings":";;;SAEwB,OAAO,CAAC,KAAa,EAAE,IAAwB;;;;IAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,IAAI,IAAI,GAAG,CAAC;IAE7C,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC;;ACTA;;;SAGwB,aAAa,CAAC,IAA+B;IACnE,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AAClC;;ACQO,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,oBAAoB,GAAG,CAAC;;SClBb,SAAS,CAC/B,QAA8B,EAC9B,KAAc;IAEd,MAAM,aAAa,GAAG,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3D,IAAI,aAAa,KAAK,QAAQ,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;;;IAIvD,IAAI,CAAC,KAAK;QAAE,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;IAExC,KAAK,IAAI,CAAC,GAAG,aAAa,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,uBAAuB,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;QAC7F,QAAQ,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;KAChD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,uBAAuB,CAAC,QAA8B,EAAE,KAAa;IAC5E,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC5C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;KACtC;IACD,OAAO,QAAQ,CAAC,MAAM,CAAC;AACzB,CAAC;AAED,SAAS,QAAQ,CAAC,IAAwB;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;YACzC,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,IAAwB,EAAE,KAAc;IAC5D,IAAI,CAAC,KAAK;QAAE,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,cAAc,CAAC,CAAmB,EAAE,CAAmB;IAC9D,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/B;;ACnCO,IAAI,KAAK,GAAG,KAAK,CAAC;AAEzB;;;;;;;;;;;;;;;;SAgBgB,YAAY,CAC1B,QAA+C,EAC/C,MAAc,EACd,GAAW,EACX,IAAY;IAEZ,OAAO,GAAG,IAAI,IAAI,EAAE;QAClB,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;QACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;QAE3C,IAAI,GAAG,KAAK,CAAC,EAAE;YACb,KAAK,GAAG,IAAI,CAAC;YACb,OAAO,GAAG,CAAC;SACZ;QAED,IAAI,GAAG,GAAG,CAAC,EAAE;YACX,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;SACf;aAAM;YACL,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;SAChB;KACF;IAED,KAAK,GAAG,KAAK,CAAC;IACd,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;SAEe,UAAU,CACxB,QAA+C,EAC/C,MAAc,EACd,KAAa;IAEb,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QACzD,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM;YAAE,MAAM;KAC3C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;SAEe,UAAU,CACxB,QAA+C,EAC/C,MAAc,EACd,KAAa;IAEb,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QAC5C,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM;YAAE,MAAM;KAC3C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;SAEe,aAAa;IAC3B,OAAO;QACL,OAAO,EAAE,CAAC,CAAC;QACX,UAAU,EAAE,CAAC,CAAC;QACd,SAAS,EAAE,CAAC,CAAC;KACd,CAAC;AACJ,CAAC;AAED;;;;SAIgB,oBAAoB,CAClC,QAA+C,EAC/C,MAAc,EACd,KAAgB,EAChB,GAAW;IAEX,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAEjD,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,OAAO,EAAE;QACnB,IAAI,MAAM,KAAK,UAAU,EAAE;YACzB,KAAK,GAAG,SAAS,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;YACnE,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,MAAM,IAAI,UAAU,EAAE;;YAExB,GAAG,GAAG,SAAS,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;SACxC;aAAM;YACL,IAAI,GAAG,SAAS,CAAC;SAClB;KACF;IACD,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;IACpB,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;IAE1B,QAAQ,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;AACvE;;ACvGA;AACA;SACwB,cAAc,CACpC,OAAsC,EACtC,KAAkB;IAElB,MAAM,OAAO,GAAa,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAE/B,MAAM,WAAW,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;YACpC,MAAM,YAAY,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;YACxC,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;YAC5C,MAAM,YAAY,IAAI,cAAc,CAAC,UAAU,MAAzB,cAAc,CAAC,UAAU,IAAM,EAAE,EAAC,CAAC;YACzD,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;;;;;YAMhC,MAAM,KAAK,GAAG,UAAU,CACtB,YAAY,EACZ,YAAY,EACZ,oBAAoB,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC,CACnE,CAAC;YAEF,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpF;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,MAAM,CAAI,KAAU,EAAE,KAAa,EAAE,KAAQ;IACpD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QACzC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACzB;IACD,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AACvB,CAAC;AAED;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc;IACrB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAO,CAAC;AAClC;;MC9Ca,MAAM,GAAW,UAAU,GAAG,EAAE,MAAM;IACjD,MAAM,MAAM,GACV,OAAO,GAAG,KAAK,QAAQ,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAA8C,GAAG,GAAG,CAAC;IAEhG,IAAI,EAAE,UAAU,IAAI,MAAM,CAAC;QAAE,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjE,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAsB,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE5B,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;QAClC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;KAC/F;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;KAC/F;IAED,MAAM,MAAM,GAAqB;QAC/B,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK;QACL,OAAO;QACP,cAAc;QACd,QAAQ;KACT,CAAC;IAEF,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACrC,EAAY;AAEZ,SAAS,UAAU,CACjB,OAAgB,EAChB,MAAiC,EACjC,QAA8B,EAC9B,OAAiB,EACjB,cAAiC,EACjC,KAAe,EACf,QAAgB,EAChB,UAAkB;IAElB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAElE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IACrC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;IACjC,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;IAChC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,kBAAkB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACzF,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;;IAGzB,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;;;IAKtE,MAAM,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;;;QAGxB,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;;;QAG7E,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,YAAY,GAAG,CAAC,CAAC;QAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,MAAM,MAAM,GAAG,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;;;YAIrC,IAAI,CAAC,KAAK,KAAK,IAAI,MAAM,IAAI,UAAU;gBAAE,MAAM;YAE/C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpB,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACnB,SAAS;aACV;YAED,MAAM,YAAY,GAAG,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;YACxD,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;YACpC,MAAM,YAAY,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;YACxC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpB,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;gBAC3D,SAAS;aACV;YAED,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;SAC5F;KACF;AACH,CAAC;AAED,SAAS,MAAM,CAAI,GAAQ,EAAE,KAAU;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,GAAW;IACrC,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE;QAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACvD,OAAO,cAAc,CAAC;AACxB;;ACxEA,MAAM,wBAAwB,GAA2B,MAAM,CAAC,MAAM,CAAC;IACrE,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAA4B,MAAM,CAAC,MAAM,CAAC;IACvE,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,uDAAuD,CAAC;AAC9E,MAAM,eAAe,GAAG,yEAAyE,CAAC;MAErF,iBAAiB,GAAG,CAAC,EAAE;MACvB,oBAAoB,GAAG,EAAE;AAEtC;;;IAGW,gBAAiE;AAE5E;;;IAGW,gBAA2E;AAEtF;;;;IAIW,aAI4B;AAEvC;;;;;IAKW,oBAGmC;AAE9C;;;;;;;IAOW,qBAGqC;AAEhD;;;IAGW,YAAyE;AAEpF;;;;IAIW,oBAA0E;AAErF;;;;IAIW,WAE2E;AAEtF;;;;IAIW,WAAgD;MAI9C,QAAQ;IAiBnB,YAAY,GAAmB,EAAE,MAAsB;QAL/C,iBAAY,GAAG,aAAa,EAAE,CAAC;QAE/B,eAAU,GAAyB,SAAS,CAAC;QAC7C,mBAAc,GAA4B,SAAS,CAAC;QAG1D,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC;QAEzC,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,WAAW,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAC;QAE1D,MAAM,MAAM,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAA+C,CAAC;QAEhG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;QAC7E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QAErC,IAAI,UAAU,IAAI,MAAM,EAAE;YACxB,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YAC9D,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;SACnE;aAAM;YACL,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;SACpD;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;SAC3B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;YAC1B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;SAC/C;KACF;CA+JF;AA7JC;IACE,eAAe,GAAG,CAAC,GAAG;;QACpB,cAAQ,GAAG,CAAC,QAAQ,oCAAZ,GAAG,CAAC,QAAQ,GAAK,MAAM,CAAC,GAAG,CAAC,QAAS,CAAC,GAAE;KACjD,CAAC;IAEF,eAAe,GAAG,CAAC,GAAG;QACpB,QAAQ,GAAG,CAAC,QAAQ,KAAZ,GAAG,CAAC,QAAQ,GAAK,MAAM,CAAC,GAAG,CAAC,QAAS,CAAC,GAAE;KACjD,CAAC;IAEF,YAAY,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM;QAC/B,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;;;QAIrC,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAExC,OAAO,oBAAoB,CACzB,OAAO,CAAC,IAAI,CAAC,EACb,GAAG,CAAC,YAAY,EAChB,IAAI,EACJ,MAAM,EACN,oBAAoB,CACrB,CAAC;KACH,CAAC;IAEF,mBAAmB,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QAChD,IAAI,EAAE,CAAC;QACP,IAAI,IAAI,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QAC7C,IAAI,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;;;QAIrC,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM;YAAE,OAAO,wBAAwB,CAAC;QAE5D,MAAM,OAAO,GAAG,oBAAoB,CAClC,OAAO,CAAC,IAAI,CAAC,EACb,GAAG,CAAC,YAAY,EAChB,IAAI,EACJ,MAAM,EACN,IAAI,IAAI,oBAAoB,CAC7B,CAAC;QAEF,IAAI,OAAO,IAAI,IAAI;YAAE,OAAO,wBAAwB,CAAC;QACrD,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,wBAAwB,CAAC;QAEzD,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;QACvC,OAAO;YACL,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAC/C,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC;YAC9B,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC;YAC9B,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI;SAChE,CAAC;KACH,CAAC;IAEF,oBAAoB,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QACzD,IAAI,EAAE,CAAC;QACP,IAAI,IAAI,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QAC7C,IAAI,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QAEjD,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;QACzC,IAAI,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,WAAW,KAAK,CAAC,CAAC;YAAE,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACtE,IAAI,WAAW,KAAK,CAAC,CAAC;YAAE,OAAO,yBAAyB,CAAC;QAEzD,MAAM,SAAS,IAAI,GAAG,CAAC,UAAU,KAAd,GAAG,CAAC,UAAU,GAAK,cAAc,CAClD,eAAe,CAAC,GAAG,CAAC,GACnB,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EACjD,EAAC,CAAC;QACH,MAAM,KAAK,GAAG,GAAG,CAAC,cAAe,CAAC;QAElC,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,yBAAyB,CAAC;QAEvD,MAAM,OAAO,GAAG,oBAAoB,CAClC,QAAQ,EACR,KAAK,CAAC,WAAW,CAAC,EAClB,IAAI,EACJ,MAAM,EACN,IAAI,IAAI,oBAAoB,CAC7B,CAAC;QAEF,IAAI,OAAO,IAAI,IAAI;YAAE,OAAO,yBAAyB,CAAC;QACtD,OAAO;YACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC;YACrC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC;SACtC,CAAC;KACH,CAAC;IAEF,WAAW,GAAG,CAAC,GAAG,EAAE,EAAE;QACpB,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;QAEvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEpB,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC5B,MAAM,eAAe,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC/B,IAAI,MAAM,GAAG,IAAI,CAAC;gBAClB,IAAI,YAAY,GAAG,IAAI,CAAC;gBACxB,IAAI,cAAc,GAAG,IAAI,CAAC;gBAC1B,IAAI,IAAI,GAAG,IAAI,CAAC;gBAChB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;oBACpB,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oBACjC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;oBAC1B,cAAc,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;iBACzB;gBACD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;oBAAE,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE3C,EAAE,CAAC;oBACD,aAAa;oBACb,eAAe;oBACf,MAAM;oBACN,YAAY;oBACZ,cAAc;oBACd,IAAI;iBACU,CAAC,CAAC;aACnB;SACF;KACF,CAAC;IAEF,mBAAmB,GAAG,CAAC,GAAG,EAAE,MAAM;QAChC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACrC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC3C,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAC/B,OAAO,MAAM,CAAC;KACf,CAAC;IAEF,UAAU,GAAG,CAAC,GAAG;QACf,OAAO;YACL,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC;SAC/B,CAAC;KACH,CAAC;IAEF,UAAU,GAAG,CAAC,GAAG;QACf,OAAO;YACL,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC;SAC/B,CAAC;KACH,CAAC;AACJ,CAAC,GAAA,CAAA;AAiBH,SAAS,oBAAoB,CAC3B,QAA+C,EAC/C,IAAe,EACf,IAAY,EACZ,MAAc,EACd,IAA4D;IAE5D,IAAI,KAAK,GAAG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/D,IAAIA,KAAO,EAAE;QACX,KAAK,GAAG,CAAC,IAAI,KAAK,iBAAiB,GAAG,UAAU,GAAG,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;KACzF;SAAM,IAAI,IAAI,KAAK,iBAAiB;QAAE,KAAK,EAAE,CAAC;IAE/C,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,QAAQ,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC3D,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzB;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js new file mode 100644 index 000000000..8b755bd19 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js @@ -0,0 +1,528 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/sourcemap-codec'), require('@jridgewell/resolve-uri')) : + typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/sourcemap-codec', '@jridgewell/resolve-uri'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI)); +})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict'; + + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri); + + function resolve(input, base) { + // The base is always treated as a directory, if it's not empty. + // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 + // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 + if (base && !base.endsWith('/')) + base += '/'; + return resolveUri__default["default"](input, base); + } + + /** + * Removes everything after the last "/", but leaves the slash. + */ + function stripFilename(path) { + if (!path) + return ''; + const index = path.lastIndexOf('/'); + return path.slice(0, index + 1); + } + + const COLUMN = 0; + const SOURCES_INDEX = 1; + const SOURCE_LINE = 2; + const SOURCE_COLUMN = 3; + const NAMES_INDEX = 4; + const REV_GENERATED_LINE = 1; + const REV_GENERATED_COLUMN = 2; + + function maybeSort(mappings, owned) { + const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); + if (unsortedIndex === mappings.length) + return mappings; + // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If + // not, we do not want to modify the consumer's input array. + if (!owned) + mappings = mappings.slice(); + for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { + mappings[i] = sortSegments(mappings[i], owned); + } + return mappings; + } + function nextUnsortedSegmentLine(mappings, start) { + for (let i = start; i < mappings.length; i++) { + if (!isSorted(mappings[i])) + return i; + } + return mappings.length; + } + function isSorted(line) { + for (let j = 1; j < line.length; j++) { + if (line[j][COLUMN] < line[j - 1][COLUMN]) { + return false; + } + } + return true; + } + function sortSegments(line, owned) { + if (!owned) + line = line.slice(); + return line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[COLUMN] - b[COLUMN]; + } + + let found = false; + /** + * A binary search implementation that returns the index if a match is found. + * If no match is found, then the left-index (the index associated with the item that comes just + * before the desired index) is returned. To maintain proper sort order, a splice would happen at + * the next index: + * + * ```js + * const array = [1, 3]; + * const needle = 2; + * const index = binarySearch(array, needle, (item, needle) => item - needle); + * + * assert.equal(index, 0); + * array.splice(index + 1, 0, needle); + * assert.deepEqual(array, [1, 2, 3]); + * ``` + */ + function binarySearch(haystack, needle, low, high) { + while (low <= high) { + const mid = low + ((high - low) >> 1); + const cmp = haystack[mid][COLUMN] - needle; + if (cmp === 0) { + found = true; + return mid; + } + if (cmp < 0) { + low = mid + 1; + } + else { + high = mid - 1; + } + } + found = false; + return low - 1; + } + function upperBound(haystack, needle, index) { + for (let i = index + 1; i < haystack.length; i++, index++) { + if (haystack[i][COLUMN] !== needle) + break; + } + return index; + } + function lowerBound(haystack, needle, index) { + for (let i = index - 1; i >= 0; i--, index--) { + if (haystack[i][COLUMN] !== needle) + break; + } + return index; + } + function memoizedState() { + return { + lastKey: -1, + lastNeedle: -1, + lastIndex: -1, + }; + } + /** + * This overly complicated beast is just to record the last tested line/column and the resulting + * index, allowing us to skip a few tests if mappings are monotonically increasing. + */ + function memoizedBinarySearch(haystack, needle, state, key) { + const { lastKey, lastNeedle, lastIndex } = state; + let low = 0; + let high = haystack.length - 1; + if (key === lastKey) { + if (needle === lastNeedle) { + found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; + return lastIndex; + } + if (needle >= lastNeedle) { + // lastIndex may be -1 if the previous needle was not found. + low = lastIndex === -1 ? 0 : lastIndex; + } + else { + high = lastIndex; + } + } + state.lastKey = key; + state.lastNeedle = needle; + return (state.lastIndex = binarySearch(haystack, needle, low, high)); + } + + // Rebuilds the original source files, with mappings that are ordered by source line/column instead + // of generated line/column. + function buildBySources(decoded, memos) { + const sources = memos.map(buildNullArray); + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + if (seg.length === 1) + continue; + const sourceIndex = seg[SOURCES_INDEX]; + const sourceLine = seg[SOURCE_LINE]; + const sourceColumn = seg[SOURCE_COLUMN]; + const originalSource = sources[sourceIndex]; + const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); + const memo = memos[sourceIndex]; + // The binary search either found a match, or it found the left-index just before where the + // segment should go. Either way, we want to insert after that. And there may be multiple + // generated segments associated with an original location, so there may need to move several + // indexes before we find where we need to insert. + const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); + insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); + } + } + return sources; + } + function insert(array, index, value) { + for (let i = array.length; i > index; i--) { + array[i] = array[i - 1]; + } + array[index] = value; + } + // Null arrays allow us to use ordered index keys without actually allocating contiguous memory like + // a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. + // Numeric properties on objects are magically sorted in ascending order by the engine regardless of + // the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending + // order when iterating with for-in. + function buildNullArray() { + return { __proto__: null }; + } + + const AnyMap = function (map, mapUrl) { + const parsed = typeof map === 'string' ? JSON.parse(map) : map; + if (!('sections' in parsed)) + return new TraceMap(parsed, mapUrl); + const mappings = []; + const sources = []; + const sourcesContent = []; + const names = []; + const { sections } = parsed; + let i = 0; + for (; i < sections.length - 1; i++) { + const no = sections[i + 1].offset; + addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column); + } + if (sections.length > 0) { + addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity); + } + const joined = { + version: 3, + file: parsed.file, + names, + sources, + sourcesContent, + mappings, + }; + return exports.presortedDecodedMap(joined); + }; + function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) { + const map = AnyMap(section.map, mapUrl); + const { line: lineOffset, column: columnOffset } = section.offset; + const sourcesOffset = sources.length; + const namesOffset = names.length; + const decoded = exports.decodedMappings(map); + const { resolvedSources } = map; + append(sources, resolvedSources); + append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length)); + append(names, map.names); + // If this section jumps forwards several lines, we need to add lines to the output mappings catch up. + for (let i = mappings.length; i <= lineOffset; i++) + mappings.push([]); + // We can only add so many lines before we step into the range that the next section's map + // controls. When we get to the last line, then we'll start checking the segments to see if + // they've crossed into the column range. + const stopI = stopLine - lineOffset; + const len = Math.min(decoded.length, stopI + 1); + for (let i = 0; i < len; i++) { + const line = decoded[i]; + // On the 0th loop, the line will already exist due to a previous section, or the line catch up + // loop above. + const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []); + // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the + // map can be multiple lines), it doesn't. + const cOffset = i === 0 ? columnOffset : 0; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const column = cOffset + seg[COLUMN]; + // If this segment steps into the column range that the next section's map controls, we need + // to stop early. + if (i === stopI && column >= stopColumn) + break; + if (seg.length === 1) { + out.push([column]); + continue; + } + const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; + const sourceLine = seg[SOURCE_LINE]; + const sourceColumn = seg[SOURCE_COLUMN]; + if (seg.length === 4) { + out.push([column, sourcesIndex, sourceLine, sourceColumn]); + continue; + } + out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); + } + } + } + function append(arr, other) { + for (let i = 0; i < other.length; i++) + arr.push(other[i]); + } + // Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of + // equal length to the sources. This is because the sources and sourcesContent are paired arrays, + // where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined + // sourcemap would desynchronize the sources/contents. + function fillSourcesContent(len) { + const sourcesContent = []; + for (let i = 0; i < len; i++) + sourcesContent[i] = null; + return sourcesContent; + } + + const INVALID_ORIGINAL_MAPPING = Object.freeze({ + source: null, + line: null, + column: null, + name: null, + }); + const INVALID_GENERATED_MAPPING = Object.freeze({ + line: null, + column: null, + }); + const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; + const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; + const LEAST_UPPER_BOUND = -1; + const GREATEST_LOWER_BOUND = 1; + /** + * Returns the encoded (VLQ string) form of the SourceMap's mappings field. + */ + exports.encodedMappings = void 0; + /** + * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. + */ + exports.decodedMappings = void 0; + /** + * A low-level API to find the segment associated with a generated line/column (think, from a + * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. + */ + exports.traceSegment = void 0; + /** + * A higher-level API to find the source/line/column associated with a generated line/column + * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in + * `source-map` library. + */ + exports.originalPositionFor = void 0; + /** + * Finds the source/line/column directly after the mapping returned by originalPositionFor, provided + * the found mapping is from the same source and line as the originalPositionFor mapping. + * + * Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1` + * using the same needle that would return `id` when calling `originalPositionFor`. + */ + exports.generatedPositionFor = void 0; + /** + * Iterates each mapping in generated position order. + */ + exports.eachMapping = void 0; + /** + * A helper that skips sorting of the input map's mappings array, which can be expensive for larger + * maps. + */ + exports.presortedDecodedMap = void 0; + /** + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ + exports.decodedMap = void 0; + /** + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ + exports.encodedMap = void 0; + class TraceMap { + constructor(map, mapUrl) { + this._decodedMemo = memoizedState(); + this._bySources = undefined; + this._bySourceMemos = undefined; + const isString = typeof map === 'string'; + if (!isString && map.constructor === TraceMap) + return map; + const parsed = (isString ? JSON.parse(map) : map); + const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; + this.version = version; + this.file = file; + this.names = names; + this.sourceRoot = sourceRoot; + this.sources = sources; + this.sourcesContent = sourcesContent; + if (sourceRoot || mapUrl) { + const from = resolve(sourceRoot || '', stripFilename(mapUrl)); + this.resolvedSources = sources.map((s) => resolve(s || '', from)); + } + else { + this.resolvedSources = sources.map((s) => s || ''); + } + const { mappings } = parsed; + if (typeof mappings === 'string') { + this._encoded = mappings; + this._decoded = undefined; + } + else { + this._encoded = undefined; + this._decoded = maybeSort(mappings, isString); + } + } + } + (() => { + exports.encodedMappings = (map) => { + var _a; + return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded))); + }; + exports.decodedMappings = (map) => { + return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded))); + }; + exports.traceSegment = (map, line, column) => { + const decoded = exports.decodedMappings(map); + // It's common for parent source maps to have pointers to lines that have no + // mapping (like a "//# sourceMappingURL=") at the end of the child file. + if (line >= decoded.length) + return null; + return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND); + }; + exports.originalPositionFor = (map, { line, column, bias }) => { + line--; + if (line < 0) + throw new Error(LINE_GTR_ZERO); + if (column < 0) + throw new Error(COL_GTR_EQ_ZERO); + const decoded = exports.decodedMappings(map); + // It's common for parent source maps to have pointers to lines that have no + // mapping (like a "//# sourceMappingURL=") at the end of the child file. + if (line >= decoded.length) + return INVALID_ORIGINAL_MAPPING; + const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); + if (segment == null) + return INVALID_ORIGINAL_MAPPING; + if (segment.length == 1) + return INVALID_ORIGINAL_MAPPING; + const { names, resolvedSources } = map; + return { + source: resolvedSources[segment[SOURCES_INDEX]], + line: segment[SOURCE_LINE] + 1, + column: segment[SOURCE_COLUMN], + name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null, + }; + }; + exports.generatedPositionFor = (map, { source, line, column, bias }) => { + line--; + if (line < 0) + throw new Error(LINE_GTR_ZERO); + if (column < 0) + throw new Error(COL_GTR_EQ_ZERO); + const { sources, resolvedSources } = map; + let sourceIndex = sources.indexOf(source); + if (sourceIndex === -1) + sourceIndex = resolvedSources.indexOf(source); + if (sourceIndex === -1) + return INVALID_GENERATED_MAPPING; + const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); + const memos = map._bySourceMemos; + const segments = generated[sourceIndex][line]; + if (segments == null) + return INVALID_GENERATED_MAPPING; + const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND); + if (segment == null) + return INVALID_GENERATED_MAPPING; + return { + line: segment[REV_GENERATED_LINE] + 1, + column: segment[REV_GENERATED_COLUMN], + }; + }; + exports.eachMapping = (map, cb) => { + const decoded = exports.decodedMappings(map); + const { names, resolvedSources } = map; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const generatedLine = i + 1; + const generatedColumn = seg[0]; + let source = null; + let originalLine = null; + let originalColumn = null; + let name = null; + if (seg.length !== 1) { + source = resolvedSources[seg[1]]; + originalLine = seg[2] + 1; + originalColumn = seg[3]; + } + if (seg.length === 5) + name = names[seg[4]]; + cb({ + generatedLine, + generatedColumn, + source, + originalLine, + originalColumn, + name, + }); + } + } + }; + exports.presortedDecodedMap = (map, mapUrl) => { + const clone = Object.assign({}, map); + clone.mappings = []; + const tracer = new TraceMap(clone, mapUrl); + tracer._decoded = map.mappings; + return tracer; + }; + exports.decodedMap = (map) => { + return { + version: 3, + file: map.file, + names: map.names, + sourceRoot: map.sourceRoot, + sources: map.sources, + sourcesContent: map.sourcesContent, + mappings: exports.decodedMappings(map), + }; + }; + exports.encodedMap = (map) => { + return { + version: 3, + file: map.file, + names: map.names, + sourceRoot: map.sourceRoot, + sources: map.sources, + sourcesContent: map.sourcesContent, + mappings: exports.encodedMappings(map), + }; + }; + })(); + function traceSegmentInternal(segments, memo, line, column, bias) { + let index = memoizedBinarySearch(segments, column, memo, line); + if (found) { + index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); + } + else if (bias === LEAST_UPPER_BOUND) + index++; + if (index === -1 || index === segments.length) + return null; + return segments[index]; + } + + exports.AnyMap = AnyMap; + exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; + exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; + exports.TraceMap = TraceMap; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=trace-mapping.umd.js.map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map new file mode 100644 index 000000000..4ef72e7fa --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"trace-mapping.umd.js","sources":["../../src/resolve.ts","../../src/strip-filename.ts","../../src/sourcemap-segment.ts","../../src/sort.ts","../../src/binary-search.ts","../../src/by-source.ts","../../src/any-map.ts","../../src/trace-mapping.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["resolveUri","presortedDecodedMap","decodedMappings","encodedMappings","traceSegment","originalPositionFor","generatedPositionFor","eachMapping","decodedMap","encodedMap","encode","decode","bsFound"],"mappings":";;;;;;;;;;aAEwB,OAAO,CAAC,KAAa,EAAE,IAAwB;;;;QAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,IAAI,IAAI,GAAG,CAAC;QAE7C,OAAOA,8BAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC;;ICTA;;;aAGwB,aAAa,CAAC,IAA+B;QACnE,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC;;ICQO,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IAEtB,MAAM,kBAAkB,GAAG,CAAC,CAAC;IAC7B,MAAM,oBAAoB,GAAG,CAAC;;aClBb,SAAS,CAC/B,QAA8B,EAC9B,KAAc;QAEd,MAAM,aAAa,GAAG,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC3D,IAAI,aAAa,KAAK,QAAQ,CAAC,MAAM;YAAE,OAAO,QAAQ,CAAC;;;QAIvD,IAAI,CAAC,KAAK;YAAE,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;QAExC,KAAK,IAAI,CAAC,GAAG,aAAa,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,uBAAuB,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;YAC7F,QAAQ,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;SAChD;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,SAAS,uBAAuB,CAAC,QAA8B,EAAE,KAAa;QAC5E,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAAE,OAAO,CAAC,CAAC;SACtC;QACD,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,SAAS,QAAQ,CAAC,IAAwB;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;gBACzC,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,YAAY,CAAC,IAAwB,EAAE,KAAc;QAC5D,IAAI,CAAC,KAAK;YAAE,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,SAAS,cAAc,CAAC,CAAmB,EAAE,CAAmB;QAC9D,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/B;;ICnCO,IAAI,KAAK,GAAG,KAAK,CAAC;IAEzB;;;;;;;;;;;;;;;;aAgBgB,YAAY,CAC1B,QAA+C,EAC/C,MAAc,EACd,GAAW,EACX,IAAY;QAEZ,OAAO,GAAG,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;YACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;YAE3C,IAAI,GAAG,KAAK,CAAC,EAAE;gBACb,KAAK,GAAG,IAAI,CAAC;gBACb,OAAO,GAAG,CAAC;aACZ;YAED,IAAI,GAAG,GAAG,CAAC,EAAE;gBACX,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;aACf;iBAAM;gBACL,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;aAChB;SACF;QAED,KAAK,GAAG,KAAK,CAAC;QACd,OAAO,GAAG,GAAG,CAAC,CAAC;IACjB,CAAC;aAEe,UAAU,CACxB,QAA+C,EAC/C,MAAc,EACd,KAAa;QAEb,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;YACzD,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM;gBAAE,MAAM;SAC3C;QACD,OAAO,KAAK,CAAC;IACf,CAAC;aAEe,UAAU,CACxB,QAA+C,EAC/C,MAAc,EACd,KAAa;QAEb,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;YAC5C,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM;gBAAE,MAAM;SAC3C;QACD,OAAO,KAAK,CAAC;IACf,CAAC;aAEe,aAAa;QAC3B,OAAO;YACL,OAAO,EAAE,CAAC,CAAC;YACX,UAAU,EAAE,CAAC,CAAC;YACd,SAAS,EAAE,CAAC,CAAC;SACd,CAAC;IACJ,CAAC;IAED;;;;aAIgB,oBAAoB,CAClC,QAA+C,EAC/C,MAAc,EACd,KAAgB,EAChB,GAAW;QAEX,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QAEjD,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,KAAK,OAAO,EAAE;YACnB,IAAI,MAAM,KAAK,UAAU,EAAE;gBACzB,KAAK,GAAG,SAAS,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;gBACnE,OAAO,SAAS,CAAC;aAClB;YAED,IAAI,MAAM,IAAI,UAAU,EAAE;;gBAExB,GAAG,GAAG,SAAS,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;aACxC;iBAAM;gBACL,IAAI,GAAG,SAAS,CAAC;aAClB;SACF;QACD,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;QACpB,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;QAE1B,QAAQ,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IACvE;;ICvGA;IACA;aACwB,cAAc,CACpC,OAAsC,EACtC,KAAkB;QAElB,MAAM,OAAO,GAAa,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAEpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBAE/B,MAAM,WAAW,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;gBACvC,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;gBACpC,MAAM,YAAY,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;gBACxC,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;gBAC5C,MAAM,YAAY,IAAI,cAAc,CAAC,UAAU,MAAzB,cAAc,CAAC,UAAU,IAAM,EAAE,EAAC,CAAC;gBACzD,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;;;;;gBAMhC,MAAM,KAAK,GAAG,UAAU,CACtB,YAAY,EACZ,YAAY,EACZ,oBAAoB,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC,CACnE,CAAC;gBAEF,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aACpF;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS,MAAM,CAAI,KAAU,EAAE,KAAa,EAAE,KAAQ;QACpD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YACzC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACzB;QACD,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;IACA;IACA;IACA;IACA;IACA,SAAS,cAAc;QACrB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAO,CAAC;IAClC;;UC9Ca,MAAM,GAAW,UAAU,GAAG,EAAE,MAAM;QACjD,MAAM,MAAM,GACV,OAAO,GAAG,KAAK,QAAQ,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAA8C,GAAG,GAAG,CAAC;QAEhG,IAAI,EAAE,UAAU,IAAI,MAAM,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAyB,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,cAAc,GAAsB,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAE5B,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YACnC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;YAClC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;SAC/F;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;SAC/F;QAED,MAAM,MAAM,GAAqB;YAC/B,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK;YACL,OAAO;YACP,cAAc;YACd,QAAQ;SACT,CAAC;QAEF,OAAOC,2BAAmB,CAAC,MAAM,CAAC,CAAC;IACrC,EAAY;IAEZ,SAAS,UAAU,CACjB,OAAgB,EAChB,MAAiC,EACjC,QAA8B,EAC9B,OAAiB,EACjB,cAAiC,EACjC,KAAe,EACf,QAAgB,EAChB,UAAkB;QAElB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACxC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QAElE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACrC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;QACjC,MAAM,OAAO,GAAGC,uBAAe,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;QAChC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QACjC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,kBAAkB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QACzF,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;;QAGzB,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;;;QAKtE,MAAM,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;QACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;;;YAGxB,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;;;YAG7E,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,YAAY,GAAG,CAAC,CAAC;YAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,MAAM,MAAM,GAAG,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;;;gBAIrC,IAAI,CAAC,KAAK,KAAK,IAAI,MAAM,IAAI,UAAU;oBAAE,MAAM;gBAE/C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;oBACpB,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;oBACnB,SAAS;iBACV;gBAED,MAAM,YAAY,GAAG,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;gBACxD,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;gBACpC,MAAM,YAAY,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;gBACxC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;oBACpB,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;oBAC3D,SAAS;iBACV;gBAED,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;aAC5F;SACF;IACH,CAAC;IAED,SAAS,MAAM,CAAI,GAAQ,EAAE,KAAU;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;YAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;IACA;IACA;IACA;IACA,SAAS,kBAAkB,CAAC,GAAW;QACrC,MAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE;YAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACvD,OAAO,cAAc,CAAC;IACxB;;ICxEA,MAAM,wBAAwB,GAA2B,MAAM,CAAC,MAAM,CAAC;QACrE,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;IAEH,MAAM,yBAAyB,GAA4B,MAAM,CAAC,MAAM,CAAC;QACvE,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,uDAAuD,CAAC;IAC9E,MAAM,eAAe,GAAG,yEAAyE,CAAC;UAErF,iBAAiB,GAAG,CAAC,EAAE;UACvB,oBAAoB,GAAG,EAAE;IAEtC;;;AAGWC,qCAAiE;IAE5E;;;AAGWD,qCAA2E;IAEtF;;;;AAIWE,kCAI4B;IAEvC;;;;;AAKWC,yCAGmC;IAE9C;;;;;;;AAOWC,0CAGqC;IAEhD;;;AAGWC,iCAAyE;IAEpF;;;;AAIWN,yCAA0E;IAErF;;;;AAIWO,gCAE2E;IAEtF;;;;AAIWC,gCAAgD;UAI9C,QAAQ;QAiBnB,YAAY,GAAmB,EAAE,MAAsB;YAL/C,iBAAY,GAAG,aAAa,EAAE,CAAC;YAE/B,eAAU,GAAyB,SAAS,CAAC;YAC7C,mBAAc,GAA4B,SAAS,CAAC;YAG1D,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC;YAEzC,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,WAAW,KAAK,QAAQ;gBAAE,OAAO,GAAG,CAAC;YAE1D,MAAM,MAAM,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAA+C,CAAC;YAEhG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;YAC7E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;YAErC,IAAI,UAAU,IAAI,MAAM,EAAE;gBACxB,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC9D,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;aACnE;iBAAM;gBACL,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;aACpD;YAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;YAC5B,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;gBAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBACzB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;aAC3B;iBAAM;gBACL,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;gBAC1B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;aAC/C;SACF;KA+JF;IA7JC;QACEN,uBAAe,GAAG,CAAC,GAAG;;YACpB,cAAQ,GAAG,CAAC,QAAQ,oCAAZ,GAAG,CAAC,QAAQ,GAAKO,qBAAM,CAAC,GAAG,CAAC,QAAS,CAAC,GAAE;SACjD,CAAC;QAEFR,uBAAe,GAAG,CAAC,GAAG;YACpB,QAAQ,GAAG,CAAC,QAAQ,KAAZ,GAAG,CAAC,QAAQ,GAAKS,qBAAM,CAAC,GAAG,CAAC,QAAS,CAAC,GAAE;SACjD,CAAC;QAEFP,oBAAY,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM;YAC/B,MAAM,OAAO,GAAGF,uBAAe,CAAC,GAAG,CAAC,CAAC;;;YAIrC,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YAExC,OAAO,oBAAoB,CACzB,OAAO,CAAC,IAAI,CAAC,EACb,GAAG,CAAC,YAAY,EAChB,IAAI,EACJ,MAAM,EACN,oBAAoB,CACrB,CAAC;SACH,CAAC;QAEFG,2BAAmB,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAChD,IAAI,EAAE,CAAC;YACP,IAAI,IAAI,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;YAC7C,IAAI,MAAM,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;YAEjD,MAAM,OAAO,GAAGH,uBAAe,CAAC,GAAG,CAAC,CAAC;;;YAIrC,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM;gBAAE,OAAO,wBAAwB,CAAC;YAE5D,MAAM,OAAO,GAAG,oBAAoB,CAClC,OAAO,CAAC,IAAI,CAAC,EACb,GAAG,CAAC,YAAY,EAChB,IAAI,EACJ,MAAM,EACN,IAAI,IAAI,oBAAoB,CAC7B,CAAC;YAEF,IAAI,OAAO,IAAI,IAAI;gBAAE,OAAO,wBAAwB,CAAC;YACrD,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;gBAAE,OAAO,wBAAwB,CAAC;YAEzD,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;YACvC,OAAO;gBACL,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;gBAC/C,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC;gBAC9B,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC;gBAC9B,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI;aAChE,CAAC;SACH,CAAC;QAEFI,4BAAoB,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YACzD,IAAI,EAAE,CAAC;YACP,IAAI,IAAI,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;YAC7C,IAAI,MAAM,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;YAEjD,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;YACzC,IAAI,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,WAAW,KAAK,CAAC,CAAC;gBAAE,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACtE,IAAI,WAAW,KAAK,CAAC,CAAC;gBAAE,OAAO,yBAAyB,CAAC;YAEzD,MAAM,SAAS,IAAI,GAAG,CAAC,UAAU,KAAd,GAAG,CAAC,UAAU,GAAK,cAAc,CAClDJ,uBAAe,CAAC,GAAG,CAAC,GACnB,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EACjD,EAAC,CAAC;YACH,MAAM,KAAK,GAAG,GAAG,CAAC,cAAe,CAAC;YAElC,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;YAE9C,IAAI,QAAQ,IAAI,IAAI;gBAAE,OAAO,yBAAyB,CAAC;YAEvD,MAAM,OAAO,GAAG,oBAAoB,CAClC,QAAQ,EACR,KAAK,CAAC,WAAW,CAAC,EAClB,IAAI,EACJ,MAAM,EACN,IAAI,IAAI,oBAAoB,CAC7B,CAAC;YAEF,IAAI,OAAO,IAAI,IAAI;gBAAE,OAAO,yBAAyB,CAAC;YACtD,OAAO;gBACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC;gBACrC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC;aACtC,CAAC;SACH,CAAC;QAEFK,mBAAW,GAAG,CAAC,GAAG,EAAE,EAAE;YACpB,MAAM,OAAO,GAAGL,uBAAe,CAAC,GAAG,CAAC,CAAC;YACrC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;YAEvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;oBAEpB,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;oBAC5B,MAAM,eAAe,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;oBAC/B,IAAI,MAAM,GAAG,IAAI,CAAC;oBAClB,IAAI,YAAY,GAAG,IAAI,CAAC;oBACxB,IAAI,cAAc,GAAG,IAAI,CAAC;oBAC1B,IAAI,IAAI,GAAG,IAAI,CAAC;oBAChB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;wBACpB,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;wBACjC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;wBAC1B,cAAc,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;qBACzB;oBACD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;wBAAE,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oBAE3C,EAAE,CAAC;wBACD,aAAa;wBACb,eAAe;wBACf,MAAM;wBACN,YAAY;wBACZ,cAAc;wBACd,IAAI;qBACU,CAAC,CAAC;iBACnB;aACF;SACF,CAAC;QAEFD,2BAAmB,GAAG,CAAC,GAAG,EAAE,MAAM;YAChC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;YACrC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;YACpB,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC3C,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;YAC/B,OAAO,MAAM,CAAC;SACf,CAAC;QAEFO,kBAAU,GAAG,CAAC,GAAG;YACf,OAAO;gBACL,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,cAAc,EAAE,GAAG,CAAC,cAAc;gBAClC,QAAQ,EAAEN,uBAAe,CAAC,GAAG,CAAC;aAC/B,CAAC;SACH,CAAC;QAEFO,kBAAU,GAAG,CAAC,GAAG;YACf,OAAO;gBACL,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,cAAc,EAAE,GAAG,CAAC,cAAc;gBAClC,QAAQ,EAAEN,uBAAe,CAAC,GAAG,CAAC;aAC/B,CAAC;SACH,CAAC;IACJ,CAAC,GAAA,CAAA;IAiBH,SAAS,oBAAoB,CAC3B,QAA+C,EAC/C,IAAe,EACf,IAAY,EACZ,MAAc,EACd,IAA4D;QAE5D,IAAI,KAAK,GAAG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/D,IAAIS,KAAO,EAAE;YACX,KAAK,GAAG,CAAC,IAAI,KAAK,iBAAiB,GAAG,UAAU,GAAG,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;SACzF;aAAM,IAAI,IAAI,KAAK,iBAAiB;YAAE,KAAK,EAAE,CAAC;QAE/C,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,QAAQ,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC3D,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts new file mode 100644 index 000000000..08bca6bfa --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts @@ -0,0 +1,8 @@ +import { TraceMap } from './trace-mapping'; +import type { SectionedSourceMapInput } from './types'; +declare type AnyMap = { + new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap; + (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap; +}; +export declare const AnyMap: AnyMap; +export {}; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts new file mode 100644 index 000000000..88820e500 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts @@ -0,0 +1,32 @@ +import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment'; +export declare type MemoState = { + lastKey: number; + lastNeedle: number; + lastIndex: number; +}; +export declare let found: boolean; +/** + * A binary search implementation that returns the index if a match is found. + * If no match is found, then the left-index (the index associated with the item that comes just + * before the desired index) is returned. To maintain proper sort order, a splice would happen at + * the next index: + * + * ```js + * const array = [1, 3]; + * const needle = 2; + * const index = binarySearch(array, needle, (item, needle) => item - needle); + * + * assert.equal(index, 0); + * array.splice(index + 1, 0, needle); + * assert.deepEqual(array, [1, 2, 3]); + * ``` + */ +export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number; +export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; +export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; +export declare function memoizedState(): MemoState; +/** + * This overly complicated beast is just to record the last tested line/column and the resulting + * index, allowing us to skip a few tests if mappings are monotonically increasing. + */ +export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts new file mode 100644 index 000000000..8d1e53833 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts @@ -0,0 +1,7 @@ +import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment'; +import type { MemoState } from './binary-search'; +export declare type Source = { + __proto__: null; + [line: number]: Exclude[]; +}; +export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[]; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts new file mode 100644 index 000000000..cf7d4f8a5 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts @@ -0,0 +1 @@ +export default function resolve(input: string, base: string | undefined): string; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts new file mode 100644 index 000000000..2bfb5dc10 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts @@ -0,0 +1,2 @@ +import type { SourceMapSegment } from './sourcemap-segment'; +export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][]; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts new file mode 100644 index 000000000..6d70924e1 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts @@ -0,0 +1,16 @@ +declare type GeneratedColumn = number; +declare type SourcesIndex = number; +declare type SourceLine = number; +declare type SourceColumn = number; +declare type NamesIndex = number; +declare type GeneratedLine = number; +export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; +export declare type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn]; +export declare const COLUMN = 0; +export declare const SOURCES_INDEX = 1; +export declare const SOURCE_LINE = 2; +export declare const SOURCE_COLUMN = 3; +export declare const NAMES_INDEX = 4; +export declare const REV_GENERATED_LINE = 1; +export declare const REV_GENERATED_COLUMN = 2; +export {}; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts new file mode 100644 index 000000000..bead5c12c --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts @@ -0,0 +1,4 @@ +/** + * Removes everything after the last "/", but leaves the slash. + */ +export default function stripFilename(path: string | undefined | null): string; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts new file mode 100644 index 000000000..8cd457449 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts @@ -0,0 +1,70 @@ +import type { SourceMapSegment } from './sourcemap-segment'; +import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping } from './types'; +export type { SourceMapSegment } from './sourcemap-segment'; +export type { SourceMapInput, SectionedSourceMapInput, DecodedSourceMap, EncodedSourceMap, SectionedSourceMap, InvalidOriginalMapping, OriginalMapping as Mapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, EachMapping, } from './types'; +export declare const LEAST_UPPER_BOUND = -1; +export declare const GREATEST_LOWER_BOUND = 1; +/** + * Returns the encoded (VLQ string) form of the SourceMap's mappings field. + */ +export declare let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings']; +/** + * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. + */ +export declare let decodedMappings: (map: TraceMap) => Readonly; +/** + * A low-level API to find the segment associated with a generated line/column (think, from a + * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. + */ +export declare let traceSegment: (map: TraceMap, line: number, column: number) => Readonly | null; +/** + * A higher-level API to find the source/line/column associated with a generated line/column + * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in + * `source-map` library. + */ +export declare let originalPositionFor: (map: TraceMap, needle: Needle) => OriginalMapping | InvalidOriginalMapping; +/** + * Finds the source/line/column directly after the mapping returned by originalPositionFor, provided + * the found mapping is from the same source and line as the originalPositionFor mapping. + * + * Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1` + * using the same needle that would return `id` when calling `originalPositionFor`. + */ +export declare let generatedPositionFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping | InvalidGeneratedMapping; +/** + * Iterates each mapping in generated position order. + */ +export declare let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void; +/** + * A helper that skips sorting of the input map's mappings array, which can be expensive for larger + * maps. + */ +export declare let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap; +/** + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ +export declare let decodedMap: (map: TraceMap) => Omit & { + mappings: readonly SourceMapSegment[][]; +}; +/** + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ +export declare let encodedMap: (map: TraceMap) => EncodedSourceMap; +export { AnyMap } from './any-map'; +export declare class TraceMap implements SourceMap { + version: SourceMapV3['version']; + file: SourceMapV3['file']; + names: SourceMapV3['names']; + sourceRoot: SourceMapV3['sourceRoot']; + sources: SourceMapV3['sources']; + sourcesContent: SourceMapV3['sourcesContent']; + resolvedSources: string[]; + private _encoded; + private _decoded; + private _decodedMemo; + private _bySources; + private _bySourceMemos; + constructor(map: SourceMapInput, mapUrl?: string | null); +} diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts new file mode 100644 index 000000000..2cc90c0c2 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts @@ -0,0 +1,85 @@ +import type { SourceMapSegment } from './sourcemap-segment'; +import type { TraceMap } from './trace-mapping'; +export interface SourceMapV3 { + file?: string | null; + names: string[]; + sourceRoot?: string; + sources: (string | null)[]; + sourcesContent?: (string | null)[]; + version: 3; +} +export interface EncodedSourceMap extends SourceMapV3 { + mappings: string; +} +export interface DecodedSourceMap extends SourceMapV3 { + mappings: SourceMapSegment[][]; +} +export interface Section { + offset: { + line: number; + column: number; + }; + map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap; +} +export interface SectionedSourceMap { + file?: string | null; + sections: Section[]; + version: 3; +} +export declare type OriginalMapping = { + source: string | null; + line: number; + column: number; + name: string | null; +}; +export declare type InvalidOriginalMapping = { + source: null; + line: null; + column: null; + name: null; +}; +export declare type GeneratedMapping = { + line: number; + column: number; +}; +export declare type InvalidGeneratedMapping = { + line: null; + column: null; +}; +export declare type SourceMapInput = string | EncodedSourceMap | DecodedSourceMap | TraceMap; +export declare type SectionedSourceMapInput = SourceMapInput | SectionedSourceMap; +export declare type Needle = { + line: number; + column: number; + bias?: 1 | -1; +}; +export declare type SourceNeedle = { + source: string; + line: number; + column: number; + bias?: 1 | -1; +}; +export declare type EachMapping = { + generatedLine: number; + generatedColumn: number; + source: null; + originalLine: null; + originalColumn: null; + name: null; +} | { + generatedLine: number; + generatedColumn: number; + source: string | null; + originalLine: number; + originalColumn: number; + name: string | null; +}; +export declare abstract class SourceMap { + version: SourceMapV3['version']; + file: SourceMapV3['file']; + names: SourceMapV3['names']; + sourceRoot: SourceMapV3['sourceRoot']; + sources: SourceMapV3['sources']; + sourcesContent: SourceMapV3['sourcesContent']; + resolvedSources: SourceMapV3['sources']; +} diff --git a/node_modules/@jridgewell/trace-mapping/package.json b/node_modules/@jridgewell/trace-mapping/package.json new file mode 100644 index 000000000..a95778035 --- /dev/null +++ b/node_modules/@jridgewell/trace-mapping/package.json @@ -0,0 +1,70 @@ +{ + "name": "@jridgewell/trace-mapping", + "version": "0.3.9", + "description": "Trace the original position through a source map", + "keywords": [ + "source", + "map" + ], + "main": "dist/trace-mapping.umd.js", + "module": "dist/trace-mapping.mjs", + "typings": "dist/types/trace-mapping.d.ts", + "files": [ + "dist" + ], + "exports": { + ".": { + "browser": "./dist/trace-mapping.umd.js", + "require": "./dist/trace-mapping.umd.js", + "import": "./dist/trace-mapping.mjs" + }, + "./package.json": "./package.json" + }, + "author": "Justin Ridgewell ", + "repository": { + "type": "git", + "url": "git+https://github.com/jridgewell/trace-mapping.git" + }, + "license": "MIT", + "scripts": { + "benchmark": "run-s build:rollup benchmark:*", + "benchmark:install": "cd benchmark && npm install", + "benchmark:only": "node benchmark/index.mjs", + "build": "run-s -n build:*", + "build:rollup": "rollup -c rollup.config.js", + "build:ts": "tsc --project tsconfig.build.json", + "lint": "run-s -n lint:*", + "lint:prettier": "npm run test:lint:prettier -- --write", + "lint:ts": "npm run test:lint:ts -- --fix", + "prebuild": "rm -rf dist", + "prepublishOnly": "npm run preversion", + "preversion": "run-s test build", + "test": "run-s -n test:lint test:only", + "test:debug": "ava debug", + "test:lint": "run-s -n test:lint:*", + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'", + "test:lint:ts": "eslint '{src,test}/**/*.ts'", + "test:only": "c8 ava", + "test:watch": "ava --watch" + }, + "devDependencies": { + "@rollup/plugin-typescript": "8.3.0", + "@typescript-eslint/eslint-plugin": "5.10.0", + "@typescript-eslint/parser": "5.10.0", + "ava": "4.0.1", + "benchmark": "2.1.4", + "c8": "7.11.0", + "esbuild": "0.14.14", + "esbuild-node-loader": "0.6.4", + "eslint": "8.7.0", + "eslint-config-prettier": "8.3.0", + "npm-run-all": "4.1.5", + "prettier": "2.5.1", + "rollup": "2.64.0", + "typescript": "4.5.4" + }, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } +} diff --git a/node_modules/@sinclair/typebox/license b/node_modules/@sinclair/typebox/license new file mode 100644 index 000000000..3d4e77479 --- /dev/null +++ b/node_modules/@sinclair/typebox/license @@ -0,0 +1,23 @@ +TypeBox: JSON Schema Type Builder with Static Type Resolution for TypeScript + +The MIT License (MIT) + +Copyright (c) 2021 Haydn Paterson (sinclair) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@sinclair/typebox/package.json b/node_modules/@sinclair/typebox/package.json new file mode 100644 index 000000000..d3f0c373b --- /dev/null +++ b/node_modules/@sinclair/typebox/package.json @@ -0,0 +1,40 @@ +{ + "name": "@sinclair/typebox", + "version": "0.23.4", + "description": "JSONSchema Type Builder with Static Type Resolution for TypeScript", + "keywords": [ + "json-schema", + "typescript", + "static-types", + "runtime-typechecking" + ], + "author": "sinclairzx81", + "license": "MIT", + "main": "./typebox.js", + "types": "./typebox.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/sinclairzx81/typebox" + }, + "scripts": { + "clean": "hammer task clean", + "build": "hammer task build", + "example": "hammer task example", + "spec": "hammer task spec", + "spec:types": "hammer task spec_types", + "spec:schemas": "hammer task spec_schemas", + "test": "npm run spec" + }, + "devDependencies": { + "@sinclair/hammer": "^0.16.3", + "@types/chai": "^4.3.0", + "@types/mocha": "^9.1.0", + "@types/node": "^17.0.12", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "chai": "^4.3.5", + "mocha": "^9.2.0", + "tsd": "^0.19.1", + "typescript": "^4.5.5" + } +} diff --git a/node_modules/@sinclair/typebox/readme.md b/node_modules/@sinclair/typebox/readme.md new file mode 100644 index 000000000..32364fc74 --- /dev/null +++ b/node_modules/@sinclair/typebox/readme.md @@ -0,0 +1,739 @@ +
+ +

TypeBox

+ + + +

JSON Schema Type Builder with Static Type Resolution for TypeScript

+ + + +[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox) [![GitHub CI](https://github.com/sinclairzx81/typebox/workflows/GitHub%20CI/badge.svg)](https://github.com/sinclairzx81/typebox/actions) + +
+ + + +## Install + +#### Node + +```bash +$ npm install @sinclair/typebox --save +``` + +#### Deno + +```typescript +import { Static, Type } from 'https://deno.land/x/typebox/src/typebox.ts' +``` + +## Example + +```typescript +import { Static, Type } from '@sinclair/typebox' + +const T = Type.String() // const T = { "type": "string" } + +type T = Static // type T = string +``` + + + +## Overview + +TypeBox is a library that creates in-memory JSON Schema objects that can be statically inferred as TypeScript types. The schemas produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox allows one to create a unified type that can be both statically asserted by the TypeScript compiler and runtime asserted using standard JSON Schema validation. + +TypeBox can be used as a simple tool to build up complex schemas or integrated into RPC or REST services to help validate JSON data received over the wire. TypeBox does not provide any JSON schema validation. Please use libraries such as AJV to validate schemas built with this library. + +Requires TypeScript 4.3.5 and above. + +License MIT + +## Contents +- [Install](#Install) +- [Overview](#Overview) +- [Usage](#Usage) +- [Types](#Types) +- [Modifiers](#Modifiers) +- [Options](#Options) +- [Generic Types](#Generic-Types) +- [Reference Types](#Reference-Types) +- [Recursive Types](#Recursive-Types) +- [Extended Types](#Extended-Types) +- [Strict](#Strict) +- [Validation](#Validation) +- [OpenAPI](#OpenAPI) + + + +## Usage + +The following demonstrates TypeBox's general usage. + +```typescript + +import { Static, Type } from '@sinclair/typebox' + +//-------------------------------------------------------------------------------------------- +// +// Let's say you have the following type ... +// +//-------------------------------------------------------------------------------------------- + +type T = { + id: string, + name: string, + timestamp: number +} + +//-------------------------------------------------------------------------------------------- +// +// ... you can express this type in the following way. +// +//-------------------------------------------------------------------------------------------- + +const T = Type.Object({ // const T = { + id: Type.String(), // type: 'object', + name: Type.String(), // properties: { + timestamp: Type.Integer() // id: { +}) // type: 'string' + // }, + // name: { + // type: 'string' + // }, + // timestamp: { + // type: 'integer' + // } + // }, + // required: [ + // "id", + // "name", + // "timestamp" + // ] + // } + +//-------------------------------------------------------------------------------------------- +// +// ... then infer back to the original static type this way. +// +//-------------------------------------------------------------------------------------------- + +type T = Static // type T = { + // id: string, + // name: string, + // timestamp: number + // } + +//-------------------------------------------------------------------------------------------- +// +// ... then use the type both as JSON schema and as a TypeScript type. +// +//-------------------------------------------------------------------------------------------- + +function receive(value: T) { // ... as a Type + + if(JSON.validate(T, value)) { // ... as a Schema + + // ok... + } +} +``` + + + +## Types + +The following table outlines the TypeBox mappings between TypeScript and JSON schema. + +```typescript +┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ +│ TypeBox │ TypeScript │ JSON Schema │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Any() │ type T = any │ const T = { } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Unknown() │ type T = unknown │ const T = { } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.String() │ type T = string │ const T = { │ +│ │ │ type: 'string' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Number() │ type T = number │ const T = { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Integer() │ type T = number │ const T = { │ +│ │ │ type: 'integer' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Boolean() │ type T = boolean │ const T = { │ +│ │ │ type: 'boolean' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Null() │ type T = null │ const T = { │ +│ │ │ type: 'null' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.RegEx(/foo/) │ type T = string │ const T = { │ +│ │ │ type: 'string', │ +│ │ │ pattern: 'foo' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Literal(42) │ type T = 42 │ const T = { │ +│ │ │ const: 42 │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Array( │ type T = number[] │ const T = { │ +│ Type.Number() │ │ type: 'array', │ +│ ) │ │ items: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ x: Type.Number(), │ x: number, │ type: 'object', │ +│ y: Type.Number() │ y: number │ properties: { │ +│ }) │ } │ x: { │ +│ │ │ type: 'number' │ +│ │ │ }, │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ }, │ +│ │ │ required: ['x', 'y'] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Tuple([ │ type T = [number, number] │ const T = { │ +│ Type.Number(), │ │ type: 'array', │ +│ Type.Number() │ │ items: [ │ +│ ]) │ │ { │ +│ │ │ type: 'number' │ +│ │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ ], │ +│ │ │ additionalItems: false, │ +│ │ │ minItems: 2, │ +│ │ │ maxItems: 2, │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ enum Foo { │ enum Foo { │ const T = { │ +│ A, │ A, │ anyOf: [{ │ +│ B │ B │ type: 'number', │ +│ } │ } │ const: 0 │ +│ │ │ }, { │ +│ const T = Type.Enum(Foo) │ type T = Foo │ type: 'number', │ +│ │ │ const: 1 │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.KeyOf( │ type T = keyof { │ const T = { │ +│ Type.Object({ │ x: number, │ enum: ['x', 'y'], │ +│ x: Type.Number(), │ y: number │ type: 'string' │ +│ y: Type.Number() │ } │ } │ +│ }) │ │ │ +│ ) │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Union([ │ type T = string | number │ const T = { │ +│ Type.String(), │ │ anyOf: [{ │ +│ Type.Number() │ │ type: 'string' │ +│ ]) │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Intersect([ │ type T = { │ const T = { │ +│ Type.Object({ │ x: number │ allOf: [{ │ +│ x: Type.Number() │ } & { │ type: 'object', │ +│ }), │ y: number │ properties: { │ +│ Type.Object({ │ } │ x: { │ +│ y: Type.Number() │ │ type: 'number' │ +│ }) │ │ } │ +│ }) │ │ }, │ +│ │ │ required: ['x'] │ +│ │ │ }, { │ +│ │ │ type: 'object', │ +│ │ │ properties: { │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ }, │ +│ │ │ required: ['y'] │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Record( │ type T = { │ const T = { │ +│ Type.String(), │ [key: string]: number │ type: 'object', │ +│ Type.Number() │ } │ patternProperties: { │ +│ ) │ │ '^.*$': { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Partial( │ type T = Partial<{ │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number(), │ y: number │ properties: { │ +│ y: Type.Number() | }> │ x: { │ +│ }) │ │ type: 'number' │ +│ ) │ │ }, │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Required( │ type T = Required<{ │ const T = { │ +│ Type.Object({ │ x?: number, │ type: 'object', │ +│ x: Type.Optional( │ y?: number │ properties: { │ +│ Type.Number() | }> │ x: { │ +│ ), │ │ type: 'number' │ +│ y: Type.Optional( │ │ }, │ +│ Type.Number() │ │ y: { │ +│ ) │ │ type: 'number' │ +│ }) │ │ } │ +│ ) │ │ }, │ +│ │ │ required: ['x', 'y'] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Pick( │ type T = Pick<{ │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number(), │ y: number │ properties: { │ +│ y: Type.Number(), | }, 'x'> │ x: { │ +│ }), ['x'] │ │ type: 'number' │ +│ ) │ │ } │ +│ │ │ }, │ +│ │ │ required: ['x'] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Omit( │ type T = Omit<{ │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number(), │ y: number │ properties: { │ +│ y: Type.Number(), | }, 'x'> │ y: { │ +│ }), ['x'] │ │ type: 'number' │ +│ ) │ │ } │ +│ │ │ }, │ +│ │ │ required: ['y'] │ +│ │ │ } │ +│ │ │ │ +└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ +``` + + +### Modifiers + +TypeBox provides modifiers that can be applied to an objects properties. This allows for `optional` and `readonly` to be applied to that property. The following table illustates how they map between TypeScript and JSON Schema. + +```typescript +┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ +│ TypeBox │ TypeScript │ JSON Schema │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ name: Type.Optional( │ name?: string, │ type: 'object', │ +│ Type.String(), │ } │ properties: { │ +│ ) │ │ name: { │ +│ }) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ name: Type.Readonly( │ readonly name: string, │ type: 'object', │ +│ Type.String(), │ } │ properties: { │ +│ ) │ │ name: { │ +│ }) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ }, │ +│ │ │ required: ['name'] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ name: Type.ReadonlyOptional( │ readonly name?: string, │ type: 'object', │ +│ Type.String(), │ } │ properties: { │ +│ ) │ │ name: { │ +│ }) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ +``` + + + +### Options + +You can pass additional JSON schema options on the last argument of any given type. The following are some examples. + +```typescript +// string must be an email +const T = Type.String({ format: 'email' }) + +// number must be a multiple of 2 +const T = Type.Number({ multipleOf: 2 }) + +// array must have at least 5 integer values +const T = Type.Array(Type.Integer(), { minItems: 5 }) +``` + + +### Generic Types + +Generic types can be created using functions. The following creates a generic `Nullable` type. + +```typescript +import { Type, Static, TSchema } from '@sinclair/typebox' + +// type Nullable = T | null + +const Nullable = (type: T) => Type.Union([type, Type.Null()]) + +const T = Nullable(Type.String()) // const T = { + // "anyOf": [{ + // type: 'string' + // }, { + // type: 'null' + // }] + // } + +type T = Static // type T = string | null + +const U = Nullable(Type.Number()) // const U = { + // "anyOf": [{ + // type: 'number' + // }, { + // type: 'null' + // }] + // } + +type U = Static // type U = number | null +``` + + + +### Reference Types + +Types can be referenced with `Type.Ref(...)`. To reference a type, the target type must specify an `$id`. + +```typescript +const T = Type.String({ $id: 'T' }) // const T = { + // $id: 'T', + // type: 'string' + // } + +const R = Type.Ref(T) // const R = { + // $ref: 'T' + // } +``` + +It can sometimes be helpful to organize shared referenced types under a common namespace. The `Type.Namespace(...)` function can be used to create a shared definition container for related types. The following creates a `Math3D` container and a `Vertex` structure that references types in the container. + +```typescript +const Math3D = Type.Namespace({ // const Math3D = { + Vector4: Type.Object({ // $id: 'Math3D', + x: Type.Number(), // $defs: { + y: Type.Number(), // Vector4: { + z: Type.Number(), // type: 'object', + w: Type.Number() // properties: { + }), // x: { type: 'number' }, + Vector3: Type.Object({ // y: { type: 'number' }, + x: Type.Number(), // z: { type: 'number' }, + y: Type.Number(), // w: { type: 'number' } + z: Type.Number() // }, + }), // required: ['x', 'y', 'z', 'w'] + Vector2: Type.Object({ // }, + x: Type.Number(), // Vector3: { + y: Type.Number() // type: 'object', + }) // properties: { +}, { $id: 'Math3D' }) // x: { 'type': 'number' }, + // y: { 'type': 'number' }, + // z: { 'type': 'number' } + // }, + // required: ['x', 'y', 'z'] + // }, + // Vector2: { + // type: 'object', + // properties: { + // x: { 'type': 'number' }, + // y: { 'type': 'number' }, + // }, + // required: ['x', 'y'] + // } + // } + // } + +const Vertex = Type.Object({ // const Vertex = { + position: Type.Ref(Math3D, 'Vector4'), // type: 'object', + normal: Type.Ref(Math3D, 'Vector3'), // properties: { + uv: Type.Ref(Math3D, 'Vector2') // position: { $ref: 'Math3D#/$defs/Vector4' }, +}) // normal: { $ref: 'Math3D#/$defs/Vector3' }, + // uv: { $ref: 'Math3D#/$defs/Vector2' } + // }, + // required: ['position', 'normal', 'uv'] + // } +``` + + + +### Recursive Types + +Recursive types can be created with the `Type.Rec(...)` function. The following creates a `Node` type that contains an array of inner Nodes. Note that due to current restrictions on TypeScript inference, it is not possible for TypeBox to statically infer for recursive types. TypeBox will infer the inner recursive type as `any`. + +```typescript +const Node = Type.Rec(Self => Type.Object({ // const Node = { + id: Type.String(), // $id: 'Node', + nodes: Type.Array(Self), // $ref: 'Node#/$defs/self', +}), { $id: 'Node' }) // $defs: { + // self: { + // type: 'object', + // properties: { + // id: { + // type: 'string' + // }, + // nodes: { + // type: 'array', + // items: { + // $ref: 'Node#/$defs/self' + // } + // } + // } + // } + // } + +type Node = Static // type Node = { + // id: string + // nodes: any[] + // } + +function visit(node: Node) { + for(const inner of node.nodes) { + visit(inner as Node) // Assert inner as Node + } +} +``` + + + +### Extended Types + +In addition to JSON schema types, TypeBox provides several extended types that allow for `function` and `constructor` types to be composed. These additional types are not valid JSON Schema and will not validate using typical JSON Schema validation. However, these types can be used to frame JSON schema and describe callable interfaces that may receive JSON validated data. These types are as follows. + +```typescript +┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ +│ TypeBox │ TypeScript │ Extended Schema │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Constructor([ │ type T = new ( │ const T = { │ +│ Type.String(), │ arg0: string, │ type: 'constructor' │ +│ Type.Number(), │ arg1: number │ arguments: [{ │ +│ ], Type.Boolean()) │ ) => boolean │ type: 'string' │ +│ │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }], │ +│ │ │ returns: { │ +│ │ │ type: 'boolean' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Function([ │ type T = ( │ const T = { │ +| Type.String(), │ arg0: string, │ type : 'function', │ +│ Type.Number(), │ arg1: number │ arguments: [{ │ +│ ], Type.Boolean()) │ ) => boolean │ type: 'string' │ +│ │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }], │ +│ │ │ returns: { │ +│ │ │ type: 'boolean' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Promise( │ type T = Promise │ const T = { │ +│ Type.String() │ │ type: 'promise', │ +│ ) │ │ item: { │ +│ │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Undefined() │ type T = undefined │ const T = { │ +│ │ │ type: 'undefined' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Void() │ type T = void │ const T = { │ +│ │ │ type: 'void' │ +│ │ │ } │ +│ │ │ │ +└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ +``` + + + +### Strict + +TypeBox schemas contain the properties `kind` and `modifier`. These properties are provided to enable runtime type reflection on schemas, as well as helping TypeBox apply the appropriate static type inference rules. These properties are not strictly valid JSON schema so in some cases it may be desirable to omit them. TypeBox provides a `Type.Strict()` function that will omit these properties if necessary. + +```typescript +const T = Type.Object({ // const T = { + name: Type.Optional(Type.String()) // kind: Symbol(ObjectKind), +}) // type: 'object', + // properties: { + // name: { + // kind: Symbol(StringKind), + // type: 'string', + // modifier: Symbol(OptionalModifier) + // } + // } + // } + +const U = Type.Strict(T) // const U = { + // type: 'object', + // properties: { + // name: { + // type: 'string' + // } + // } + // } +``` + + + +### Validation + +TypeBox does not provide JSON schema validation so users will need to select an appropriate JSON Schema validator for their needs. TypeBox schemas target JSON Schema draft `2019-09` so any validator capable of draft `2019-09` should be fine. A good library to use for validation in JavaScript environments is [AJV](https://www.npmjs.com/package/ajv). The following example shows setting up AJV 7 to work with TypeBox. + +```bash +$ npm install ajv ajv-formats --save +``` + +```typescript +//-------------------------------------------------------------------------------------------- +// +// Import the 2019 compliant validator from AJV +// +//-------------------------------------------------------------------------------------------- + +import { Type } from '@sinclair/typebox' +import addFormats from 'ajv-formats' +import Ajv from 'ajv/dist/2019' + +//-------------------------------------------------------------------------------------------- +// +// Setup AJV validator with the following options and formats +// +//-------------------------------------------------------------------------------------------- + +const ajv = addFormats(new Ajv({}), [ + 'date-time', + 'time', + 'date', + 'email', + 'hostname', + 'ipv4', + 'ipv6', + 'uri', + 'uri-reference', + 'uuid', + 'uri-template', + 'json-pointer', + 'relative-json-pointer', + 'regex' +]).addKeyword('kind') + .addKeyword('modifier') + +//-------------------------------------------------------------------------------------------- +// +// Create a TypeBox type +// +//-------------------------------------------------------------------------------------------- + +const User = Type.Object({ + userId: Type.String({ format: 'uuid' }), + email: Type.String({ format: 'email' }), + online: Type.Boolean(), +}, { additionalProperties: false }) + +//-------------------------------------------------------------------------------------------- +// +// Validate Data +// +//-------------------------------------------------------------------------------------------- + +const ok = ajv.validate(User, { + userId: '68b4b1d8-0db6-468d-b551-02069a692044', + email: 'dave@domain.com', + online: true +}) // -> ok +``` + +Please refer to the official AJV [documentation](https://ajv.js.org/guide/getting-started.html) for additional information on using AJV. + +### OpenAPI + +TypeBox can be used to create schemas for OpenAPI, however users should be mindful of some disparities between the JSON Schema and OpenAPI for versions prior to OpenAPI 3.1. Two common instances where OpenAPI diverges is the handling nullable and string enum schemas types. The following shows how you can use TypeBox to construct these types. + +```typescript +import { Type, Static, TNull, TLiteral, TUnion, TSchema } from '@sinclair/typebox' + +//-------------------------------------------------------------------------------------------- +// +// Nullable +// +//-------------------------------------------------------------------------------------------- + +function Nullable(schema: T): TUnion<[T, TNull]> { + return { ...schema, nullable: true } as any +} + +const T = Nullable(Type.String()) // const T = { + // type: 'string', + // nullable: true + // } + +type T = Static // type T = string | null + +//-------------------------------------------------------------------------------------------- +// +// StringUnion<[...]> +// +//-------------------------------------------------------------------------------------------- + +type IntoStringUnion = {[K in keyof T]: T[K] extends string ? TLiteral: never } + +function StringUnion(values: [...T]): TUnion> { + return { enum: values } as any +} + +const T = StringUnion(['A', 'B', 'C']) // const T = { + // enum: ['A', 'B', 'C'] + // } + +type T = Static // type T = 'A' | 'B' | 'C' +``` diff --git a/node_modules/@sinclair/typebox/typebox.d.ts b/node_modules/@sinclair/typebox/typebox.d.ts new file mode 100644 index 000000000..f12082145 --- /dev/null +++ b/node_modules/@sinclair/typebox/typebox.d.ts @@ -0,0 +1,350 @@ +export declare const ReadonlyOptionalModifier: unique symbol; +export declare const OptionalModifier: unique symbol; +export declare const ReadonlyModifier: unique symbol; +export declare type TModifier = TReadonlyOptional | TOptional | TReadonly; +export declare type TReadonlyOptional = T & { + modifier: typeof ReadonlyOptionalModifier; +}; +export declare type TOptional = T & { + modifier: typeof OptionalModifier; +}; +export declare type TReadonly = T & { + modifier: typeof ReadonlyModifier; +}; +export declare const NamespaceKind: unique symbol; +export declare const KeyOfKind: unique symbol; +export declare const IntersectKind: unique symbol; +export declare const UnionKind: unique symbol; +export declare const TupleKind: unique symbol; +export declare const ObjectKind: unique symbol; +export declare const RecordKind: unique symbol; +export declare const ArrayKind: unique symbol; +export declare const EnumKind: unique symbol; +export declare const LiteralKind: unique symbol; +export declare const StringKind: unique symbol; +export declare const NumberKind: unique symbol; +export declare const IntegerKind: unique symbol; +export declare const BooleanKind: unique symbol; +export declare const NullKind: unique symbol; +export declare const UnknownKind: unique symbol; +export declare const AnyKind: unique symbol; +export declare const RefKind: unique symbol; +export interface CustomOptions { + $id?: string; + title?: string; + description?: string; + default?: any; + examples?: any; + [prop: string]: any; +} +export declare type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex'; +export declare type StringOptions = { + minLength?: number; + maxLength?: number; + pattern?: string; + format?: TFormat; + contentEncoding?: '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64'; + contentMediaType?: string; +} & CustomOptions; +export declare type ArrayOptions = { + uniqueItems?: boolean; + minItems?: number; + maxItems?: number; +} & CustomOptions; +export declare type NumberOptions = { + exclusiveMaximum?: number; + exclusiveMinimum?: number; + maximum?: number; + minimum?: number; + multipleOf?: number; +} & CustomOptions; +export declare type IntersectOptions = { + unevaluatedProperties?: boolean; +} & CustomOptions; +export declare type ObjectOptions = { + additionalProperties?: boolean; + minProperties?: number; + maxProperties?: number; +} & CustomOptions; +export declare type TDefinitions = { + [key: string]: TSchema; +}; +export declare type TNamespace = { + kind: typeof NamespaceKind; + $defs: T; +} & CustomOptions; +export interface TSchema { + $static: unknown; +} +export declare type TEnumType = Record; +export declare type TKey = string | number | symbol; +export declare type TValue = string | number | boolean; +export declare type TRecordKey = TString | TNumber | TKeyOf | TUnion; +export declare type TEnumKey = { + type: 'number' | 'string'; + const: T; +}; +export interface TProperties { + [key: string]: TSchema; +} +export interface TRecord extends TSchema, ObjectOptions { + $static: StaticRecord; + kind: typeof RecordKind; + type: 'object'; + patternProperties: { + [pattern: string]: T; + }; +} +export interface TTuple extends TSchema, CustomOptions { + $static: StaticTuple; + kind: typeof TupleKind; + type: 'array'; + items?: T; + additionalItems?: false; + minItems: number; + maxItems: number; +} +export interface TObject extends TSchema, ObjectOptions { + $static: StaticObject; + kind: typeof ObjectKind; + type: 'object'; + properties: T; + required?: string[]; +} +export interface TUnion extends TSchema, CustomOptions { + $static: StaticUnion; + kind: typeof UnionKind; + anyOf: T; +} +export interface TIntersect extends TSchema, IntersectOptions { + $static: StaticIntersect; + kind: typeof IntersectKind; + type: 'object'; + allOf: T; +} +export interface TKeyOf extends TSchema, CustomOptions { + $static: StaticKeyOf; + kind: typeof KeyOfKind; + type: 'string'; + enum: T; +} +export interface TArray extends TSchema, ArrayOptions { + $static: StaticArray; + kind: typeof ArrayKind; + type: 'array'; + items: T; +} +export interface TLiteral extends TSchema, CustomOptions { + $static: StaticLiteral; + kind: typeof LiteralKind; + const: T; +} +export interface TEnum extends TSchema, CustomOptions { + $static: StaticEnum; + kind: typeof EnumKind; + anyOf: T; +} +export interface TRef extends TSchema, CustomOptions { + $static: Static; + kind: typeof RefKind; + $ref: string; +} +export interface TString extends TSchema, StringOptions { + $static: string; + kind: typeof StringKind; + type: 'string'; +} +export interface TNumber extends TSchema, NumberOptions { + $static: number; + kind: typeof NumberKind; + type: 'number'; +} +export interface TInteger extends TSchema, NumberOptions { + $static: number; + kind: typeof IntegerKind; + type: 'integer'; +} +export interface TBoolean extends TSchema, CustomOptions { + $static: boolean; + kind: typeof BooleanKind; + type: 'boolean'; +} +export interface TNull extends TSchema, CustomOptions { + $static: null; + kind: typeof NullKind; + type: 'null'; +} +export interface TUnknown extends TSchema, CustomOptions { + $static: unknown; + kind: typeof UnknownKind; +} +export interface TAny extends TSchema, CustomOptions { + $static: any; + kind: typeof AnyKind; +} +export declare const ConstructorKind: unique symbol; +export declare const FunctionKind: unique symbol; +export declare const PromiseKind: unique symbol; +export declare const UndefinedKind: unique symbol; +export declare const VoidKind: unique symbol; +export interface TConstructor extends TSchema, CustomOptions { + $static: StaticConstructor; + kind: typeof ConstructorKind; + type: 'constructor'; + arguments: TSchema[]; + returns: TSchema; +} +export interface TFunction extends TSchema, CustomOptions { + $static: StaticFunction; + kind: typeof FunctionKind; + type: 'function'; + arguments: TSchema[]; + returns: TSchema; +} +export interface TPromise extends TSchema, CustomOptions { + $static: StaticPromise; + kind: typeof PromiseKind; + type: 'promise'; + item: TSchema; +} +export interface TUndefined extends TSchema, CustomOptions { + $static: undefined; + kind: typeof UndefinedKind; + type: 'undefined'; +} +export interface TVoid extends TSchema, CustomOptions { + $static: void; + kind: typeof VoidKind; + type: 'void'; +} +export declare type Selectable = TObject | TRef>; +export declare type SelectablePropertyKeys = T extends TObject ? keyof U : T extends TRef> ? keyof U : never; +export declare type SelectableProperties = T extends TObject ? U : T extends TRef> ? U : never; +export declare type UnionToIntersect = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; +export declare type StaticReadonlyOptionalPropertyKeys = { + [K in keyof T]: T[K] extends TReadonlyOptional ? K : never; +}[keyof T]; +export declare type StaticReadonlyPropertyKeys = { + [K in keyof T]: T[K] extends TReadonly ? K : never; +}[keyof T]; +export declare type StaticOptionalPropertyKeys = { + [K in keyof T]: T[K] extends TOptional ? K : never; +}[keyof T]; +export declare type StaticRequiredPropertyKeys = keyof Omit | StaticReadonlyPropertyKeys | StaticOptionalPropertyKeys>; +export declare type StaticIntersectEvaluate = { + [K in keyof T]: T[K] extends TSchema ? Static : never; +}; +export declare type StaticIntersectReduce = T extends [infer A, ...infer B] ? StaticIntersectReduce : I; +export declare type StaticRequired = { + [K in keyof T]: T[K] extends TReadonlyOptional ? TReadonly : T[K] extends TReadonly ? TReadonly : T[K] extends TOptional ? U : T[K]; +}; +export declare type StaticPartial = { + [K in keyof T]: T[K] extends TReadonlyOptional ? TReadonlyOptional : T[K] extends TReadonly ? TReadonlyOptional : T[K] extends TOptional ? TOptional : TOptional; +}; +export declare type StaticProperties = { + readonly [K in StaticReadonlyOptionalPropertyKeys]?: Static; +} & { + readonly [K in StaticReadonlyPropertyKeys]: Static; +} & { + [K in StaticOptionalPropertyKeys]?: Static; +} & { + [K in StaticRequiredPropertyKeys]: Static; +}; +export declare type StaticRecord = K extends TString ? Record> : K extends TNumber ? Record> : K extends TKeyOf ? Record> : K extends TUnion ? Record> : never; +export declare type StaticEnum = T extends TEnumKey[] ? U : never; +export declare type StaticKeyOf = T extends Array ? K : never; +export declare type StaticIntersect = StaticIntersectReduce>; +export declare type StaticUnion = { + [K in keyof T]: T[K] extends TSchema ? Static : never; +}[number]; +export declare type StaticTuple = { + [K in keyof T]: T[K] extends TSchema ? Static : never; +}; +export declare type StaticObject = StaticProperties extends infer I ? { + [K in keyof I]: I[K]; +} : never; +export declare type StaticArray = Array>; +export declare type StaticLiteral = T; +export declare type StaticParameters = { + [K in keyof T]: T[K] extends TSchema ? Static : never; +}; +export declare type StaticConstructor = new (...args: [...StaticParameters]) => Static; +export declare type StaticFunction = (...args: [...StaticParameters]) => Static; +export declare type StaticPromise = Promise>; +export declare type Static = T['$static']; +export declare class TypeBuilder { + protected readonly schemas: Map; + /** `Standard` Modifies an object property to be both readonly and optional */ + ReadonlyOptional(item: T): TReadonlyOptional; + /** `Standard` Modifies an object property to be readonly */ + Readonly(item: T): TReadonly; + /** `Standard` Modifies an object property to be optional */ + Optional(item: T): TOptional; + /** `Standard` Creates a type type */ + Tuple(items: [...T], options?: CustomOptions): TTuple; + /** `Standard` Creates an object type with the given properties */ + Object(properties: T, options?: ObjectOptions): TObject; + /** `Standard` Creates an intersect type. */ + Intersect(items: [...T], options?: IntersectOptions): TIntersect; + /** `Standard` Creates a union type */ + Union(items: [...T], options?: CustomOptions): TUnion; + /** `Standard` Creates an array type */ + Array(items: T, options?: ArrayOptions): TArray; + /** `Standard` Creates an enum type from a TypeScript enum */ + Enum(item: T, options?: CustomOptions): TEnum[]>; + /** `Standard` Creates a literal type. Supports string, number and boolean values only */ + Literal(value: T, options?: CustomOptions): TLiteral; + /** `Standard` Creates a string type */ + String(options?: StringOptions): TString; + /** `Standard` Creates a string type from a regular expression */ + RegEx(regex: RegExp, options?: CustomOptions): TString; + /** `Standard` Creates a number type */ + Number(options?: NumberOptions): TNumber; + /** `Standard` Creates an integer type */ + Integer(options?: NumberOptions): TInteger; + /** `Standard` Creates a boolean type */ + Boolean(options?: CustomOptions): TBoolean; + /** `Standard` Creates a null type */ + Null(options?: CustomOptions): TNull; + /** `Standard` Creates an unknown type */ + Unknown(options?: CustomOptions): TUnknown; + /** `Standard` Creates an any type */ + Any(options?: CustomOptions): TAny; + /** `Standard` Creates a record type */ + Record(key: K, value: T, options?: ObjectOptions): TRecord; + /** `Standard` Creates a keyof type from the given object */ + KeyOf | TRef>>(object: T, options?: CustomOptions): TKeyOf[]>; + /** `Standard` Makes all properties in the given object type required */ + Required | TRef>>(object: T, options?: ObjectOptions): TObject>; + /** `Standard` Makes all properties in the given object type optional */ + Partial | TRef>>(object: T, options?: ObjectOptions): TObject>; + /** `Standard` Picks property keys from the given object type */ + Pick | TRef>, K extends SelectablePropertyKeys[]>(object: T, keys: [...K], options?: ObjectOptions): TObject, K[number]>>; + /** `Standard` Omits property keys from the given object type */ + Omit | TRef>, K extends SelectablePropertyKeys[]>(object: T, keys: [...K], options?: ObjectOptions): TObject, K[number]>>; + /** `Standard` Omits the `kind` and `modifier` properties from the underlying schema */ + Strict(schema: T, options?: CustomOptions): T; + /** `Extended` Creates a constructor type */ + Constructor(args: [...T], returns: U, options?: CustomOptions): TConstructor; + /** `Extended` Creates a function type */ + Function(args: [...T], returns: U, options?: CustomOptions): TFunction; + /** `Extended` Creates a promise type */ + Promise(item: T, options?: CustomOptions): TPromise; + /** `Extended` Creates a undefined type */ + Undefined(options?: CustomOptions): TUndefined; + /** `Extended` Creates a void type */ + Void(options?: CustomOptions): TVoid; + /** `Standard` Creates a namespace for a set of related types */ + Namespace($defs: T, options?: CustomOptions): TNamespace; + /** `Standard` References a type within a namespace. The referenced namespace must specify an `$id` */ + Ref, K extends keyof T['$defs']>(namespace: T, key: K): TRef; + /** `Standard` References type. The referenced type must specify an `$id` */ + Ref(schema: T): TRef; + /** `Experimental` Creates a recursive type */ + Rec(callback: (self: TAny) => T, options?: CustomOptions): T; + /** Conditionally stores and schema if it contains an $id and returns */ + protected Store, S = Omit>(schema: S): T; + /** Conditionally dereferences a schema if RefKind. Otherwise return argument */ + protected Deref(schema: T): any; +} +export declare const Type: TypeBuilder; diff --git a/node_modules/@sinclair/typebox/typebox.js b/node_modules/@sinclair/typebox/typebox.js new file mode 100644 index 000000000..3466f62b3 --- /dev/null +++ b/node_modules/@sinclair/typebox/typebox.js @@ -0,0 +1,342 @@ +"use strict"; +/*-------------------------------------------------------------------------- + +TypeBox: JSON Schema Type Builder with Static Type Resolution for TypeScript + +The MIT License (MIT) + +Copyright (c) 2021 Haydn Paterson (sinclair) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +---------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Type = exports.TypeBuilder = exports.VoidKind = exports.UndefinedKind = exports.PromiseKind = exports.FunctionKind = exports.ConstructorKind = exports.RefKind = exports.AnyKind = exports.UnknownKind = exports.NullKind = exports.BooleanKind = exports.IntegerKind = exports.NumberKind = exports.StringKind = exports.LiteralKind = exports.EnumKind = exports.ArrayKind = exports.RecordKind = exports.ObjectKind = exports.TupleKind = exports.UnionKind = exports.IntersectKind = exports.KeyOfKind = exports.NamespaceKind = exports.ReadonlyModifier = exports.OptionalModifier = exports.ReadonlyOptionalModifier = void 0; +// -------------------------------------------------------------------------- +// Modifiers +// -------------------------------------------------------------------------- +exports.ReadonlyOptionalModifier = Symbol('ReadonlyOptionalModifier'); +exports.OptionalModifier = Symbol('OptionalModifier'); +exports.ReadonlyModifier = Symbol('ReadonlyModifier'); +// -------------------------------------------------------------------------- +// Schema Standard +// -------------------------------------------------------------------------- +exports.NamespaceKind = Symbol('NamespaceKind'); +exports.KeyOfKind = Symbol('KeyOfKind'); +exports.IntersectKind = Symbol('IntersectKind'); +exports.UnionKind = Symbol('UnionKind'); +exports.TupleKind = Symbol('TupleKind'); +exports.ObjectKind = Symbol('ObjectKind'); +exports.RecordKind = Symbol('RecordKind'); +exports.ArrayKind = Symbol('ArrayKind'); +exports.EnumKind = Symbol('EnumKind'); +exports.LiteralKind = Symbol('LiteralKind'); +exports.StringKind = Symbol('StringKind'); +exports.NumberKind = Symbol('NumberKind'); +exports.IntegerKind = Symbol('IntegerKind'); +exports.BooleanKind = Symbol('BooleanKind'); +exports.NullKind = Symbol('NullKind'); +exports.UnknownKind = Symbol('UnknownKind'); +exports.AnyKind = Symbol('AnyKind'); +exports.RefKind = Symbol('RefKind'); +// -------------------------------------------------------------------------- +// Extended Schema Types +// -------------------------------------------------------------------------- +exports.ConstructorKind = Symbol('ConstructorKind'); +exports.FunctionKind = Symbol('FunctionKind'); +exports.PromiseKind = Symbol('PromiseKind'); +exports.UndefinedKind = Symbol('UndefinedKind'); +exports.VoidKind = Symbol('VoidKind'); +// -------------------------------------------------------------------------- +// Utility +// -------------------------------------------------------------------------- +function isObject(object) { + return typeof object === 'object' && object !== null && !Array.isArray(object); +} +function isArray(object) { + return typeof object === 'object' && object !== null && Array.isArray(object); +} +function clone(object) { + if (isObject(object)) + return Object.keys(object).reduce((acc, key) => ({ ...acc, [key]: clone(object[key]) }), {}); + if (isArray(object)) + return object.map((item) => clone(item)); + return object; +} +// -------------------------------------------------------------------------- +// TypeBuilder +// -------------------------------------------------------------------------- +class TypeBuilder { + schemas = new Map(); + /** `Standard` Modifies an object property to be both readonly and optional */ + ReadonlyOptional(item) { + return { ...item, modifier: exports.ReadonlyOptionalModifier }; + } + /** `Standard` Modifies an object property to be readonly */ + Readonly(item) { + return { ...item, modifier: exports.ReadonlyModifier }; + } + /** `Standard` Modifies an object property to be optional */ + Optional(item) { + return { ...item, modifier: exports.OptionalModifier }; + } + /** `Standard` Creates a type type */ + Tuple(items, options = {}) { + const additionalItems = false; + const minItems = items.length; + const maxItems = items.length; + const schema = ((items.length > 0) + ? { ...options, kind: exports.TupleKind, type: 'array', items, additionalItems, minItems, maxItems } + : { ...options, kind: exports.TupleKind, type: 'array', minItems, maxItems }); + return this.Store(schema); + } + /** `Standard` Creates an object type with the given properties */ + Object(properties, options = {}) { + const property_names = Object.keys(properties); + const optional = property_names.filter(name => { + const candidate = properties[name]; + return (candidate.modifier && + (candidate.modifier === exports.OptionalModifier || + candidate.modifier === exports.ReadonlyOptionalModifier)); + }); + const required_names = property_names.filter(name => !optional.includes(name)); + const required = (required_names.length > 0) ? required_names : undefined; + return this.Store(((required) + ? { ...options, kind: exports.ObjectKind, type: 'object', properties, required } + : { ...options, kind: exports.ObjectKind, type: 'object', properties })); + } + /** `Standard` Creates an intersect type. */ + Intersect(items, options = {}) { + return this.Store({ ...options, kind: exports.IntersectKind, type: 'object', allOf: items }); + } + /** `Standard` Creates a union type */ + Union(items, options = {}) { + return this.Store({ ...options, kind: exports.UnionKind, anyOf: items }); + } + /** `Standard` Creates an array type */ + Array(items, options = {}) { + return this.Store({ ...options, kind: exports.ArrayKind, type: 'array', items }); + } + /** `Standard` Creates an enum type from a TypeScript enum */ + Enum(item, options = {}) { + const values = Object.keys(item).filter(key => isNaN(key)).map(key => item[key]); + const anyOf = values.map(value => typeof value === 'string' ? { type: 'string', const: value } : { type: 'number', const: value }); + return this.Store({ ...options, kind: exports.EnumKind, anyOf }); + } + /** `Standard` Creates a literal type. Supports string, number and boolean values only */ + Literal(value, options = {}) { + return this.Store({ ...options, kind: exports.LiteralKind, const: value, type: typeof value }); + } + /** `Standard` Creates a string type */ + String(options = {}) { + return this.Store({ ...options, kind: exports.StringKind, type: 'string' }); + } + /** `Standard` Creates a string type from a regular expression */ + RegEx(regex, options = {}) { + return this.String({ ...options, pattern: regex.source }); + } + /** `Standard` Creates a number type */ + Number(options = {}) { + return this.Store({ ...options, kind: exports.NumberKind, type: 'number' }); + } + /** `Standard` Creates an integer type */ + Integer(options = {}) { + return this.Store({ ...options, kind: exports.IntegerKind, type: 'integer' }); + } + /** `Standard` Creates a boolean type */ + Boolean(options = {}) { + return this.Store({ ...options, kind: exports.BooleanKind, type: 'boolean' }); + } + /** `Standard` Creates a null type */ + Null(options = {}) { + return this.Store({ ...options, kind: exports.NullKind, type: 'null' }); + } + /** `Standard` Creates an unknown type */ + Unknown(options = {}) { + return this.Store({ ...options, kind: exports.UnknownKind }); + } + /** `Standard` Creates an any type */ + Any(options = {}) { + return this.Store({ ...options, kind: exports.AnyKind }); + } + /** `Standard` Creates a record type */ + Record(key, value, options = {}) { + const pattern = (() => { + switch (key.kind) { + case exports.UnionKind: return `^${key.anyOf.map((literal) => literal.const).join('|')}$`; + case exports.KeyOfKind: return `^${key.enum.join('|')}$`; + case exports.NumberKind: return '^(0|[1-9][0-9]*)$'; + case exports.StringKind: return key.pattern ? key.pattern : '^.*$'; + default: throw Error('Invalid Record Key'); + } + })(); + return this.Store({ ...options, kind: exports.RecordKind, type: 'object', patternProperties: { [pattern]: value } }); + } + /** `Standard` Creates a keyof type from the given object */ + KeyOf(object, options = {}) { + const source = this.Deref(object); + const keys = Object.keys(source.properties); + return this.Store({ ...options, kind: exports.KeyOfKind, type: 'string', enum: keys }); + } + /** `Standard` Makes all properties in the given object type required */ + Required(object, options = {}) { + const source = this.Deref(object); + const schema = { ...clone(source), ...options }; + schema.required = Object.keys(schema.properties); + for (const key of Object.keys(schema.properties)) { + const property = schema.properties[key]; + switch (property.modifier) { + case exports.ReadonlyOptionalModifier: + property.modifier = exports.ReadonlyModifier; + break; + case exports.ReadonlyModifier: + property.modifier = exports.ReadonlyModifier; + break; + case exports.OptionalModifier: + delete property.modifier; + break; + default: + delete property.modifier; + break; + } + } + return this.Store(schema); + } + /** `Standard` Makes all properties in the given object type optional */ + Partial(object, options = {}) { + const source = this.Deref(object); + const schema = { ...clone(source), ...options }; + delete schema.required; + for (const key of Object.keys(schema.properties)) { + const property = schema.properties[key]; + switch (property.modifier) { + case exports.ReadonlyOptionalModifier: + property.modifier = exports.ReadonlyOptionalModifier; + break; + case exports.ReadonlyModifier: + property.modifier = exports.ReadonlyOptionalModifier; + break; + case exports.OptionalModifier: + property.modifier = exports.OptionalModifier; + break; + default: + property.modifier = exports.OptionalModifier; + break; + } + } + return this.Store(schema); + } + /** `Standard` Picks property keys from the given object type */ + Pick(object, keys, options = {}) { + const source = this.Deref(object); + const schema = { ...clone(source), ...options }; + schema.required = schema.required ? schema.required.filter((key) => keys.includes(key)) : undefined; + for (const key of Object.keys(schema.properties)) { + if (!keys.includes(key)) + delete schema.properties[key]; + } + return this.Store(schema); + } + /** `Standard` Omits property keys from the given object type */ + Omit(object, keys, options = {}) { + const source = this.Deref(object); + const schema = { ...clone(source), ...options }; + schema.required = schema.required ? schema.required.filter((key) => !keys.includes(key)) : undefined; + for (const key of Object.keys(schema.properties)) { + if (keys.includes(key)) + delete schema.properties[key]; + } + return this.Store(schema); + } + /** `Standard` Omits the `kind` and `modifier` properties from the underlying schema */ + Strict(schema, options = {}) { + return JSON.parse(JSON.stringify({ ...options, ...schema })); + } + /** `Extended` Creates a constructor type */ + Constructor(args, returns, options = {}) { + return this.Store({ ...options, kind: exports.ConstructorKind, type: 'constructor', arguments: args, returns }); + } + /** `Extended` Creates a function type */ + Function(args, returns, options = {}) { + return this.Store({ ...options, kind: exports.FunctionKind, type: 'function', arguments: args, returns }); + } + /** `Extended` Creates a promise type */ + Promise(item, options = {}) { + return this.Store({ ...options, type: 'promise', kind: exports.PromiseKind, item }); + } + /** `Extended` Creates a undefined type */ + Undefined(options = {}) { + return this.Store({ ...options, type: 'undefined', kind: exports.UndefinedKind }); + } + /** `Extended` Creates a void type */ + Void(options = {}) { + return this.Store({ ...options, type: 'void', kind: exports.VoidKind }); + } + /** `Standard` Creates a namespace for a set of related types */ + Namespace($defs, options = {}) { + return this.Store({ ...options, kind: exports.NamespaceKind, $defs }); + } + Ref(...args) { + if (args.length === 2) { + const namespace = args[0]; + const targetKey = args[1]; + if (namespace.$id === undefined) + throw new Error(`Referenced namespace has no $id`); + if (!this.schemas.has(namespace.$id)) + throw new Error(`Unable to locate namespace with $id '${namespace.$id}'`); + return this.Store({ kind: exports.RefKind, $ref: `${namespace.$id}#/$defs/${targetKey}` }); + } + else if (args.length === 1) { + const target = args[0]; + if (target.$id === undefined) + throw new Error(`Referenced schema has no $id`); + if (!this.schemas.has(target.$id)) + throw new Error(`Unable to locate schema with $id '${target.$id}'`); + return this.Store({ kind: exports.RefKind, $ref: target.$id }); + } + else { + throw new Error('Type.Ref: Invalid arguments'); + } + } + /** `Experimental` Creates a recursive type */ + Rec(callback, options = {}) { + const $id = options.$id || ''; + const self = callback({ $ref: `${$id}#/$defs/self` }); + return this.Store({ ...options, $ref: `${$id}#/$defs/self`, $defs: { self } }); + } + /** Conditionally stores and schema if it contains an $id and returns */ + Store(schema) { + const $schema = schema; + if (!$schema['$id']) + return $schema; + this.schemas.set($schema['$id'], $schema); + return $schema; + } + /** Conditionally dereferences a schema if RefKind. Otherwise return argument */ + Deref(schema) { + const $schema = schema; + if ($schema['kind'] !== exports.RefKind) + return schema; + if (!this.schemas.has($schema['$ref'])) + throw Error(`Unable to locate schema with $id '${$schema['$ref']}'`); + return this.Deref(this.schemas.get($schema['$ref'])); + } +} +exports.TypeBuilder = TypeBuilder; +exports.Type = new TypeBuilder(); diff --git a/node_modules/babel-plugin-istanbul/CHANGELOG.md b/node_modules/babel-plugin-istanbul/CHANGELOG.md index 4f7b0a830..aa57d4f1a 100644 --- a/node_modules/babel-plugin-istanbul/CHANGELOG.md +++ b/node_modules/babel-plugin-istanbul/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [6.1.1](https://www.github.com/istanbuljs/babel-plugin-istanbul/compare/v6.1.0...v6.1.1) (2021-10-16) + + +### Bug Fixes + +* **build:** first automated publication ([9a1b893](https://www.github.com/istanbuljs/babel-plugin-istanbul/commit/9a1b89342565d1127a011e31262520b057120531)) + +## [6.1.0](https://www.github.com/istanbuljs/babel-plugin-istanbul/compare/v6.0.0...v6.1.0) (2021-10-16) + + +### Features + +* **instrumenter:** instrumenter with fixes for branchMap instrumentation ([#265](https://www.github.com/istanbuljs/babel-plugin-istanbul/issues/265)) ([1e9ec62](https://www.github.com/istanbuljs/babel-plugin-istanbul/commit/1e9ec62b50c9d2224e7bb0ccb071fd10b80e018f)) + ## [6.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.2.0...v6.0.0) (2019-12-20) diff --git a/node_modules/babel-plugin-istanbul/README.md b/node_modules/babel-plugin-istanbul/README.md index 3910baead..a027e9b78 100644 --- a/node_modules/babel-plugin-istanbul/README.md +++ b/node_modules/babel-plugin-istanbul/README.md @@ -1,7 +1,5 @@ # babel-plugin-istanbul -[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/babel-plugin-istanbul.svg)](https://greenkeeper.io/) -[![Build Status](https://travis-ci.org/istanbuljs/babel-plugin-istanbul.svg?branch=master)](https://travis-ci.org/istanbuljs/babel-plugin-istanbul) [![Coverage Status](https://coveralls.io/repos/github/istanbuljs/babel-plugin-istanbul/badge.svg?branch=master)](https://coveralls.io/github/istanbuljs/babel-plugin-istanbul?branch=master) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) [![community slack](http://devtoolscommunity.herokuapp.com/badge.svg)](http://devtoolscommunity.herokuapp.com) diff --git a/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js b/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js index 5d621835e..790679384 100644 --- a/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js +++ b/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js @@ -7,10 +7,10 @@ const { async function main() { const [cwd, nycrcPath] = process.argv.slice(2); - console.log(JSON.stringify((await loadNycConfig({ + console.log(JSON.stringify(await loadNycConfig({ cwd, nycrcPath - })))); + }))); } main().catch(error => { diff --git a/node_modules/@jest/transform/node_modules/.bin/semver b/node_modules/babel-plugin-istanbul/node_modules/.bin/semver similarity index 100% rename from node_modules/@jest/transform/node_modules/.bin/semver rename to node_modules/babel-plugin-istanbul/node_modules/.bin/semver diff --git a/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/CHANGELOG.md b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/CHANGELOG.md new file mode 100644 index 000000000..59a0151ed --- /dev/null +++ b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/CHANGELOG.md @@ -0,0 +1,624 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [5.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.1.0...istanbul-lib-instrument-v5.2.0) (2022-02-21) + + +### Features + +* exclude Empty Object and Arrays in Truthy Detection ([#666](https://github.com/istanbuljs/istanbuljs/issues/666)) ([e279684](https://github.com/istanbuljs/istanbuljs/commit/e279684e735f4b7dbe2b632cde2515f6862099de)) + +## [5.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.4...istanbul-lib-instrument-v5.1.0) (2021-10-27) + + +### Features + +* option to evaluate logical truthiness, for applications such as fuzzing ([#629](https://www.github.com/istanbuljs/istanbuljs/issues/629)) ([a743b84](https://www.github.com/istanbuljs/istanbuljs/commit/a743b8442e977f0c77ffa282eed7ac84ca200d1f)) + +### [5.0.4](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.3...istanbul-lib-instrument-v5.0.4) (2021-10-16) + + +### Bug Fixes + +* **magic-value:** make incrementing magic value a manual step ([#641](https://www.github.com/istanbuljs/istanbuljs/issues/641)) ([823010b](https://www.github.com/istanbuljs/istanbuljs/commit/823010b821cf81bd91377d75fc83f0875925db66)) + +### [5.0.3](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.2...istanbul-lib-instrument-v5.0.3) (2021-10-06) + + +### Bug Fixes + +* coverage.branchMap else location. ([#633](https://www.github.com/istanbuljs/istanbuljs/issues/633)) ([eb4b4ec](https://www.github.com/istanbuljs/istanbuljs/commit/eb4b4ec8f4b858655a66b0033fcc662f44ef4cc9)) + +### [5.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.1...istanbul-lib-instrument-v5.0.2) (2021-09-13) + + +### Bug Fixes + +* **build:** verfiy automated publication ([b232690](https://www.github.com/istanbuljs/istanbuljs/commit/b232690193f4b524332046c96dd1cdc6e881c6c7)) + +### [5.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.0...istanbul-lib-instrument-v5.0.1) (2021-09-13) + + +### Bug Fixes + +* **build:** verfiy automated publication ([74c96bd](https://www.github.com/istanbuljs/istanbuljs/commit/74c96bdc4224a06e2e1166ebd9adf8faf28438b1)) + +## [5.0.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v4.0.3...istanbul-lib-instrument-v5.0.0) (2021-09-13) + + +### ⚠ BREAKING CHANGES + +* istanbul-lib-instrument no longer uses babel + +### Code Refactoring + +* istanbul-lib-instrument no longer uses babel ([8d3badb](https://www.github.com/istanbuljs/istanbuljs/commit/8d3badb8f6c9a4bed9af8e19c3ac6459ebd7267b)) + +## [4.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.2...istanbul-lib-instrument@4.0.3) (2020-05-09) + + +### Bug Fixes + +* Prevent readInitialCoverage from reading babel config ([#562](https://github.com/istanbuljs/istanbuljs/issues/562)) ([49b4745](https://github.com/istanbuljs/istanbuljs/commit/49b474525c15e703642916011bd86f663aca0c3d)) + + + + + +## [4.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.1...istanbul-lib-instrument@4.0.2) (2020-05-06) + + +### Bug Fixes + +* Add ts-ignore to reassignment of generated function ([#557](https://github.com/istanbuljs/istanbuljs/issues/557)) ([817efb0](https://github.com/istanbuljs/istanbuljs/commit/817efb04fc161efae426b2231a0221606b09f559)) +* Use @babel/core for all babel imports. ([#555](https://github.com/istanbuljs/istanbuljs/issues/555)) ([a99a13e](https://github.com/istanbuljs/istanbuljs/commit/a99a13ee6931fc124a2a723c3f511cdbcb0aa81d)) + + + + + +## [4.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0...istanbul-lib-instrument@4.0.1) (2020-02-03) + + +### Bug Fixes + +* Always call coverage initialization function ([#524](https://github.com/istanbuljs/istanbuljs/issues/524)) ([c6536c1](https://github.com/istanbuljs/istanbuljs/commit/c6536c14bf0663ca7e0493dd40ea132b05352594)) + + + + + +# [4.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.3...istanbul-lib-instrument@4.0.0) (2019-12-20) + +**Note:** Version bump only for package istanbul-lib-instrument + + + + + +# [4.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.2...istanbul-lib-instrument@4.0.0-alpha.3) (2019-12-07) + +**Note:** Version bump only for package istanbul-lib-instrument + + + + + +# [4.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.1...istanbul-lib-instrument@4.0.0-alpha.2) (2019-11-01) + + +### Bug Fixes + +* Produce properly merged source-maps when inputSourceMap is provided ([#487](https://github.com/istanbuljs/istanbuljs/issues/487)) ([8f8c88e](https://github.com/istanbuljs/istanbuljs/commit/8f8c88e3a2add4c08729e41e356aa7981dc69d4d)) + + + + + +# [4.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.0...istanbul-lib-instrument@4.0.0-alpha.1) (2019-10-06) + + +### Bug Fixes + +* Eliminate babel hoisting of the coverage variable ([#481](https://github.com/istanbuljs/istanbuljs/issues/481)) ([8dfbcba](https://github.com/istanbuljs/istanbuljs/commit/8dfbcba)), closes [#92](https://github.com/istanbuljs/istanbuljs/issues/92) +* Honor ignore hints in chained if statements ([#469](https://github.com/istanbuljs/istanbuljs/issues/469)) ([a629770](https://github.com/istanbuljs/istanbuljs/commit/a629770)), closes [#468](https://github.com/istanbuljs/istanbuljs/issues/468) +* Populate lastFileCoverage for already instrumented files ([#470](https://github.com/istanbuljs/istanbuljs/issues/470)) ([ea6d779](https://github.com/istanbuljs/istanbuljs/commit/ea6d779)), closes [istanbuljs/nyc#594](https://github.com/istanbuljs/nyc/issues/594) + + +### Features + +* Use @istanbuljs/schema to pull defaults ([#485](https://github.com/istanbuljs/istanbuljs/issues/485)) ([87e27f3](https://github.com/istanbuljs/istanbuljs/commit/87e27f3)), closes [#460](https://github.com/istanbuljs/istanbuljs/issues/460) + + +### BREAKING CHANGES + +* The defaults for `autoWrap`, `preserveComments`, +`esModules` and `produceSourceMap` are now true. This applies only to +the stand-alone instrumenter, the visitor does not use these options. +* The `flow` and `jsx` parser plugins are no longer +enabled by default. This applies only to the stand-alone instrumenter, +the visitor does not use this option. +* The `plugins` option of the stand-alone instrumenter +has been renamed to `parserPlugins` to match nyc. + + + + + +# [4.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.3.0...istanbul-lib-instrument@4.0.0-alpha.0) (2019-06-19) + + +### Features + +* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) + + +### BREAKING CHANGES + +* Node.js 8 is now required + + + + + +# [3.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.2.0...istanbul-lib-instrument@3.3.0) (2019-04-24) + + +### Features + +* Enable classProperties and classPrivateProperties parsers and coverage. ([#379](https://github.com/istanbuljs/istanbuljs/issues/379)) ([c09dc38](https://github.com/istanbuljs/istanbuljs/commit/c09dc38)) + + + + + +# [3.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.2...istanbul-lib-instrument@3.2.0) (2019-04-09) + + +### Features + +* Add bigInt and importMeta to default parser plugins. ([#356](https://github.com/istanbuljs/istanbuljs/issues/356)) ([fb4d6ed](https://github.com/istanbuljs/istanbuljs/commit/fb4d6ed)), closes [#338](https://github.com/istanbuljs/istanbuljs/issues/338) + + + + + +## [3.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.1...istanbul-lib-instrument@3.1.2) (2019-04-03) + + +### Bug Fixes + +* Be more friendly to ts-node. ([#352](https://github.com/istanbuljs/istanbuljs/issues/352)) ([40d15f5](https://github.com/istanbuljs/istanbuljs/commit/40d15f5)), closes [#336](https://github.com/istanbuljs/istanbuljs/issues/336) + + + + + +## [3.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.0...istanbul-lib-instrument@3.1.1) (2019-03-12) + + +### Bug Fixes + +* Honor istanbul ignore next hints placed before export statement. ([#298](https://github.com/istanbuljs/istanbuljs/issues/298)) ([f24795d](https://github.com/istanbuljs/istanbuljs/commit/f24795d)), closes [#297](https://github.com/istanbuljs/istanbuljs/issues/297) + + + + + +# [3.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.1...istanbul-lib-instrument@3.1.0) (2019-01-26) + + +### Features + +* dont skip for loop initialization instrumentation ([#188](https://github.com/istanbuljs/istanbuljs/issues/188)) ([2e0258e](https://github.com/istanbuljs/istanbuljs/commit/2e0258e)) +* New options coverageGlobalScope and coverageGlobalScopeFunc. ([#200](https://github.com/istanbuljs/istanbuljs/issues/200)) ([25509c7](https://github.com/istanbuljs/istanbuljs/commit/25509c7)), closes [#199](https://github.com/istanbuljs/istanbuljs/issues/199) + + + + + + +## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.0...istanbul-lib-instrument@3.0.1) (2018-12-25) + + + + +**Note:** Version bump only for package istanbul-lib-instrument + + +# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.2...istanbul-lib-instrument@3.0.0) (2018-09-06) + + +### Chores + +* Update test for babel 7. ([#218](https://github.com/istanbuljs/istanbuljs/issues/218)) ([9cf4d43](https://github.com/istanbuljs/istanbuljs/commit/9cf4d43)), closes [#205](https://github.com/istanbuljs/istanbuljs/issues/205) + + +### Features + +* Add option plugins ([#205](https://github.com/istanbuljs/istanbuljs/issues/205)) ([312f81f](https://github.com/istanbuljs/istanbuljs/commit/312f81f)) +* Update babel to 7.0.0. ([#215](https://github.com/istanbuljs/istanbuljs/issues/215)) ([8a96613](https://github.com/istanbuljs/istanbuljs/commit/8a96613)) + + +### BREAKING CHANGES + +* was added which requires an option for the `decorators` +plugin. Add it to get tests working again, commit updated api.md. + + + + + +## [2.3.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.1...istanbul-lib-instrument@2.3.2) (2018-07-24) + + + + +**Note:** Version bump only for package istanbul-lib-instrument + + +## [2.3.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.0...istanbul-lib-instrument@2.3.1) (2018-07-07) + + +### Bug Fixes + +* Don't ignore src/visitor.js for self test. ([#194](https://github.com/istanbuljs/istanbuljs/issues/194)) ([71b815d](https://github.com/istanbuljs/istanbuljs/commit/71b815d)) + + + + + +# [2.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.1...istanbul-lib-instrument@2.3.0) (2018-06-27) + + +### Features + +* update pinned babel version to latest release. ([#189](https://github.com/istanbuljs/istanbuljs/issues/189)) ([ac8ec07](https://github.com/istanbuljs/istanbuljs/commit/ac8ec07)) + + + + + +## [2.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.0...istanbul-lib-instrument@2.2.1) (2018-06-26) + + +### Bug Fixes + +* Instrument ObjectMethod's. ([#182](https://github.com/istanbuljs/istanbuljs/issues/182)) ([126f09d](https://github.com/istanbuljs/istanbuljs/commit/126f09d)) +* update default args test guard to work on supported versions. ([#185](https://github.com/istanbuljs/istanbuljs/issues/185)) ([955511a](https://github.com/istanbuljs/istanbuljs/commit/955511a)) + + + + + +# [2.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.2.0) (2018-06-06) + + +### Features + +* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f)) + + + + + +# [2.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.1.0) (2018-05-31) + + +### Features + +* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f)) + + + + + +## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.1...istanbul-lib-instrument@2.0.2) (2018-05-31) + + + + +**Note:** Version bump only for package istanbul-lib-instrument + + +## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.0...istanbul-lib-instrument@2.0.1) (2018-05-31) + + +### Bug Fixes + +* should import [@babel](https://github.com/babel)/template ([85a0d1a](https://github.com/istanbuljs/istanbuljs/commit/85a0d1a)) + + + + + +# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.1...istanbul-lib-instrument@2.0.0) (2018-05-31) + + +### Bug Fixes + +* parenthesize superClass on non-idetifier case ([#158](https://github.com/istanbuljs/istanbuljs/issues/158)) ([6202c88](https://github.com/istanbuljs/istanbuljs/commit/6202c88)) + + +### Chores + +* upgrade babel in instrumenter ([#174](https://github.com/istanbuljs/istanbuljs/issues/174)) ([ce23e91](https://github.com/istanbuljs/istanbuljs/commit/ce23e91)) + + +### BREAKING CHANGES + +* babel@7 drops Node@4 support + + + + + +## [1.10.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.0...istanbul-lib-instrument@1.10.1) (2018-03-09) + + +### Bug Fixes + +* default value for ignorelassMethods ([#151](https://github.com/istanbuljs/istanbuljs/issues/151)) ([5dd88e8](https://github.com/istanbuljs/istanbuljs/commit/5dd88e8)) + + + + + +# [1.10.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.2...istanbul-lib-instrument@1.10.0) (2018-03-04) + + +### Features + +* allows an array of ignored method names to be provided ([#127](https://github.com/istanbuljs/istanbuljs/issues/127)) ([67918e2](https://github.com/istanbuljs/istanbuljs/commit/67918e2)) + + + + + +## [1.9.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.1...istanbul-lib-instrument@1.9.2) (2018-02-13) + + +### Bug Fixes + +* compatibility with babel 7 ([#135](https://github.com/istanbuljs/istanbuljs/issues/135)) ([6cac849](https://github.com/istanbuljs/istanbuljs/commit/6cac849)) +* handle instrumentation when a function is called Function ([#131](https://github.com/istanbuljs/istanbuljs/issues/131)) ([b12a07e](https://github.com/istanbuljs/istanbuljs/commit/b12a07e)) +* proper passing of the preserveComments option to babel ([#122](https://github.com/istanbuljs/istanbuljs/issues/122)) ([470bb0e](https://github.com/istanbuljs/istanbuljs/commit/470bb0e)) +* update instrument, account for lack of arrow expression ([#119](https://github.com/istanbuljs/istanbuljs/issues/119)) ([#125](https://github.com/istanbuljs/istanbuljs/issues/125)) ([0968206](https://github.com/istanbuljs/istanbuljs/commit/0968206)) + + + + + +## [1.9.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.0...istanbul-lib-instrument@1.9.1) (2017-10-22) + + +### Bug Fixes + +* address issue with class instrumentation ([#111](https://github.com/istanbuljs/istanbuljs/issues/111)) ([cbd1c14](https://github.com/istanbuljs/istanbuljs/commit/cbd1c14)) + + + + + +# [1.9.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.8.0...istanbul-lib-instrument@1.9.0) (2017-10-21) + + +### Bug Fixes + +* support conditional expression for superClass ([#106](https://github.com/istanbuljs/istanbuljs/issues/106)) ([aae256f](https://github.com/istanbuljs/istanbuljs/commit/aae256f)) + + +### Features + +* add support for ignoring entire files ([#108](https://github.com/istanbuljs/istanbuljs/issues/108)) ([f12da65](https://github.com/istanbuljs/istanbuljs/commit/f12da65)) + + + + + +# [1.8.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.5...istanbul-lib-instrument@1.8.0) (2017-09-05) + + +### Features + +* add support for object-spread syntax ([#82](https://github.com/istanbuljs/istanbuljs/issues/82)) ([28d5566](https://github.com/istanbuljs/istanbuljs/commit/28d5566)) + + + + + +## [1.7.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.4...istanbul-lib-instrument@1.7.5) (2017-08-23) + + +### Bug Fixes + +* name of function is now preserved or named exports ([#79](https://github.com/istanbuljs/istanbuljs/issues/79)) ([2ce8974](https://github.com/istanbuljs/istanbuljs/commit/2ce8974)) + + + + + +## [1.7.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.3...istanbul-lib-instrument@1.7.4) (2017-07-16) + + +### Bug Fixes + +* update increment operator to appropriate expression type ([#74](https://github.com/istanbuljs/istanbuljs/issues/74)) ([dc69e66](https://github.com/istanbuljs/istanbuljs/commit/dc69e66)) + + + + + +## [1.7.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.2...istanbul-lib-instrument@1.7.3) (2017-06-25) + + + + + +## [1.7.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.1...istanbul-lib-instrument@1.7.2) (2017-05-27) + + +### Bug Fixes + +* hoist statement counter for class variables, so that name is preserved ([#60](https://github.com/istanbuljs/istanbuljs/issues/60)) ([120d221](https://github.com/istanbuljs/istanbuljs/commit/120d221)) + + + + + +## [1.7.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.7.0...istanbul-lib-instrument@1.7.1) (2017-04-29) + + +### Bug Fixes + +* don't instrument a file if it has already been instrumented ([#38](https://github.com/istanbuljs/istanbuljs/issues/38)) ([9c38e4e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9c38e4e)) + + + + + +# [1.7.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.2...istanbul-lib-instrument@1.7.0) (2017-03-27) + + +### Features + +* use extended babylon support; adding features such as jsx ([#22](https://github.com/istanbuljs/istanbuljs/issues/22)) ([11c2438](https://github.com/istanbuljs/istanbul-lib-instrument/commit/11c2438)) + + +## [1.6.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.1...istanbul-lib-instrument@1.6.2) (2017-03-22) + + +### Bug Fixes + +* loc is sometimes not defined, so loc.start fails see [#99](https://github.com/istanbuljs/istanbuljs/issues/99) ([#18](https://github.com/istanbuljs/istanbuljs/issues/18)) ([df85ba6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/df85ba6)) + + +## [1.6.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.0...istanbul-lib-instrument@1.6.1) (2017-03-21) + + +# [1.6.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.4.2...istanbul-lib-instrument@1.6.0) (2017-03-21) + + +### Features + +* adds line number property back to coverage.json ([b03b927](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b03b927)) + + +## [1.4.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.1...v1.4.2) (2017-01-04) + + +### Bug Fixes + +* only hoist counter for a smaller subset of function declarations ([9f8931e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9f8931e)) + + + + +## [1.4.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.0...v1.4.1) (2017-01-04) + + +### Bug Fixes + +* address regression discussed in https://github.com/istanbuljs/babel-plugin-istanbul/issues/78 ([#40](https://github.com/istanbuljs/istanbul-lib-instrument/issues/40)) ([7f458a3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7f458a3)) + + + + +# [1.4.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.1...v1.4.0) (2017-01-02) + + +### Features + +* preserve inferred function names ([#38](https://github.com/istanbuljs/istanbul-lib-instrument/issues/38)) ([312666e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/312666e)) + + + + +## [1.3.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.0...v1.3.1) (2016-12-27) + + +### Bug Fixes + +* function declaration assignment now retains function name ([#33](https://github.com/istanbuljs/istanbul-lib-instrument/issues/33)) ([2d781da](https://github.com/istanbuljs/istanbul-lib-instrument/commit/2d781da)) + + + + +# [1.3.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.2.0...v1.3.0) (2016-11-10) + + +### Features + +* allow an input source-map to be passed to instrumentSync() ([#23](https://github.com/istanbuljs/istanbul-lib-instrument/issues/23)) ([b08e4f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b08e4f5)) + + + + +# [1.2.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.4...v1.2.0) (2016-10-25) + + +### Features + +* implement function to extract empty coverage data from an instrumented file ([#28](https://github.com/istanbuljs/istanbul-lib-instrument/issues/28)) ([06d0ef6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/06d0ef6)) + + + + +## [1.1.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.3...v1.1.4) (2016-10-17) + + +### Bug Fixes + +* hoist coverage variable to very top of file ([#26](https://github.com/istanbuljs/istanbul-lib-instrument/issues/26)) ([0225e8c](https://github.com/istanbuljs/istanbul-lib-instrument/commit/0225e8c)) + + + + +## [1.1.3](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.2...v1.1.3) (2016-09-13) + + +### Performance Improvements + +* simplify coverage variable naming https://github.com/istanbuljs/istanbul-lib-instrument/pull/24 ([7252aae](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7252aae)) + + + + +## [1.1.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.1...v1.1.2) (2016-09-08) + + +### Performance Improvements + +* use zero-based numeric indices for much faster instrumented code ([#22](https://github.com/istanbuljs/istanbul-lib-instrument/issues/22)) ([5b401f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/5b401f5)) + + + + +## [1.1.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0...v1.1.1) (2016-08-30) + + +### Bug Fixes + +* upgrade istanbul-lib-coverage ([eb9b1f6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/eb9b1f6)) + + + + +# [1.1.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0-alpha.4...v1.1.0) (2016-08-11) + + +### Bug Fixes + +* guard against invalid loc ([#16](https://github.com/istanbuljs/istanbul-lib-instrument/issues/16)) ([23ebfc3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/23ebfc3)) + + + + +# [1.1.0-alpha.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.0.0-alpha.5...v1.1.0-alpha.4) (2016-07-20) + + +### Bug Fixes + +* require more performant babel-generator ([#15](https://github.com/istanbuljs/istanbul-lib-instrument/issues/15)) ([21b2563](https://github.com/istanbuljs/istanbul-lib-instrument/commit/21b2563)) diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-coverage/LICENSE b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/LICENSE similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-coverage/LICENSE rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/LICENSE diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/README.md b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/README.md similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/README.md rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/README.md diff --git a/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/package.json b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/package.json new file mode 100644 index 000000000..46a2917a8 --- /dev/null +++ b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/package.json @@ -0,0 +1,50 @@ +{ + "name": "istanbul-lib-instrument", + "version": "5.2.0", + "description": "Core istanbul API for JS code coverage", + "author": "Krishnan Anantheswaran ", + "main": "src/index.js", + "files": [ + "src" + ], + "scripts": { + "test": "nyc mocha" + }, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "devDependencies": { + "@babel/cli": "^7.7.5", + "chai": "^4.2.0", + "clone": "^2.1.2", + "debug": "^4.1.1", + "documentation": "^12.1.4", + "js-yaml": "^3.13.1", + "mocha": "^6.2.3", + "nopt": "^4.0.1", + "nyc": "^15.1.0" + }, + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/istanbuljs/istanbuljs/issues" + }, + "homepage": "https://istanbul.js.org/", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", + "directory": "packages/istanbul-lib-instrument" + }, + "keywords": [ + "coverage", + "istanbul", + "js", + "instrumentation" + ], + "engines": { + "node": ">=8" + } +} diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/constants.js b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/constants.js similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/constants.js rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/constants.js diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/index.js b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/index.js similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/index.js rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/index.js diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/instrumenter.js b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/instrumenter.js similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/instrumenter.js rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/instrumenter.js diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/read-coverage.js b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/read-coverage.js similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/read-coverage.js rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/read-coverage.js diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/source-coverage.js b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/source-coverage.js similarity index 100% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/source-coverage.js rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/source-coverage.js diff --git a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/visitor.js b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/visitor.js similarity index 86% rename from node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/visitor.js rename to node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/visitor.js index 64f924513..387f41dc9 100644 --- a/node_modules/@jest/transform/node_modules/istanbul-lib-instrument/src/visitor.js +++ b/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/src/visitor.js @@ -200,10 +200,7 @@ class VisitState { ), T.parenthesizedExpression( T.conditionalExpression( - T.memberExpression( - T.callExpression(T.identifier(this.varName), []), - T.identifier(tempName) - ), + this.validateTrueNonTrivial(T, tempName), this.increase(type, id, index), T.nullLiteral() ) @@ -215,6 +212,97 @@ class VisitState { ]); } + validateTrueNonTrivial(T, tempName) { + return T.logicalExpression( + '&&', + T.memberExpression( + T.callExpression(T.identifier(this.varName), []), + T.identifier(tempName) + ), + T.logicalExpression( + '&&', + T.parenthesizedExpression( + T.logicalExpression( + '||', + T.unaryExpression( + '!', + T.callExpression( + T.memberExpression( + T.identifier('Array'), + T.identifier('isArray') + ), + [ + T.memberExpression( + T.callExpression( + T.identifier(this.varName), + [] + ), + T.identifier(tempName) + ) + ] + ) + ), + T.memberExpression( + T.memberExpression( + T.callExpression( + T.identifier(this.varName), + [] + ), + T.identifier(tempName) + ), + T.identifier('length') + ) + ) + ), + T.parenthesizedExpression( + T.logicalExpression( + '||', + T.binaryExpression( + '!==', + T.callExpression( + T.memberExpression( + T.identifier('Object'), + T.identifier('getPrototypeOf') + ), + [ + T.memberExpression( + T.callExpression( + T.identifier(this.varName), + [] + ), + T.identifier(tempName) + ) + ] + ), + T.memberExpression( + T.identifier('Object'), + T.identifier('prototype') + ) + ), + T.memberExpression( + T.callExpression( + T.memberExpression( + T.identifier('Object'), + T.identifier('values') + ), + [ + T.memberExpression( + T.callExpression( + T.identifier(this.varName), + [] + ), + T.identifier(tempName) + ) + ] + ), + T.identifier('length') + ) + ) + ) + ) + ); + } + insertCounter(path, increment) { const T = this.types; if (path.isBlockStatement()) { diff --git a/node_modules/@jest/transform/node_modules/semver/CHANGELOG.md b/node_modules/babel-plugin-istanbul/node_modules/semver/CHANGELOG.md similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/CHANGELOG.md rename to node_modules/babel-plugin-istanbul/node_modules/semver/CHANGELOG.md diff --git a/node_modules/@jest/transform/node_modules/semver/LICENSE b/node_modules/babel-plugin-istanbul/node_modules/semver/LICENSE similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/LICENSE rename to node_modules/babel-plugin-istanbul/node_modules/semver/LICENSE diff --git a/node_modules/@jest/transform/node_modules/semver/README.md b/node_modules/babel-plugin-istanbul/node_modules/semver/README.md similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/README.md rename to node_modules/babel-plugin-istanbul/node_modules/semver/README.md diff --git a/node_modules/@jest/transform/node_modules/semver/bin/semver.js b/node_modules/babel-plugin-istanbul/node_modules/semver/bin/semver.js similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/bin/semver.js rename to node_modules/babel-plugin-istanbul/node_modules/semver/bin/semver.js diff --git a/node_modules/@jest/transform/node_modules/semver/package.json b/node_modules/babel-plugin-istanbul/node_modules/semver/package.json similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/package.json rename to node_modules/babel-plugin-istanbul/node_modules/semver/package.json diff --git a/node_modules/@jest/transform/node_modules/semver/range.bnf b/node_modules/babel-plugin-istanbul/node_modules/semver/range.bnf similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/range.bnf rename to node_modules/babel-plugin-istanbul/node_modules/semver/range.bnf diff --git a/node_modules/@jest/transform/node_modules/semver/semver.js b/node_modules/babel-plugin-istanbul/node_modules/semver/semver.js similarity index 100% rename from node_modules/@jest/transform/node_modules/semver/semver.js rename to node_modules/babel-plugin-istanbul/node_modules/semver/semver.js diff --git a/node_modules/babel-plugin-istanbul/package.json b/node_modules/babel-plugin-istanbul/package.json index 4003a8aea..2b5851392 100644 --- a/node_modules/babel-plugin-istanbul/package.json +++ b/node_modules/babel-plugin-istanbul/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-istanbul", - "version": "6.0.0", + "version": "6.1.1", "author": "Thai Pangsakulyanont @dtinth", "license": "BSD-3-Clause", "description": "A babel plugin that adds istanbul instrumentation to ES6 code", @@ -12,7 +12,7 @@ "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-instrument": "^5.0.4", "test-exclude": "^6.0.0" }, "devDependencies": { @@ -26,16 +26,14 @@ "mocha": "^6.2.2", "nyc": "^15.0.0", "pmock": "^0.2.3", - "standard": "^14.3.1", - "standard-version": "^7.1.0" + "standard": "^14.3.1" }, "scripts": { "coverage": "nyc report --reporter=text-lcov | coveralls", "release": "babel src --out-dir lib", "pretest": "standard && npm run release", "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha --timeout 5000 test/*.js", - "prepublish": "npm test && npm run release", - "version": "standard-version" + "prepublish": "npm test && npm run release" }, "standard": { "ignore": [ diff --git a/node_modules/expect/build/asymmetricMatchers.d.ts b/node_modules/expect/build/asymmetricMatchers.d.ts deleted file mode 100644 index da5077080..000000000 --- a/node_modules/expect/build/asymmetricMatchers.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { AsymmetricMatcher as AsymmetricMatcherInterface, MatcherState } from './types'; -export declare abstract class AsymmetricMatcher implements AsymmetricMatcherInterface { - protected sample: T; - protected inverse: boolean; - $$typeof: symbol; - constructor(sample: T, inverse?: boolean); - protected getMatcherContext(): State; - abstract asymmetricMatch(other: unknown): boolean; - abstract toString(): string; - getExpectedType?(): string; - toAsymmetricMatcher?(): string; -} -declare class Any extends AsymmetricMatcher { - constructor(sample: unknown); - asymmetricMatch(other: unknown): boolean; - toString(): string; - getExpectedType(): string; - toAsymmetricMatcher(): string; -} -declare class Anything extends AsymmetricMatcher { - asymmetricMatch(other: unknown): boolean; - toString(): string; - toAsymmetricMatcher(): string; -} -declare class ArrayContaining extends AsymmetricMatcher> { - constructor(sample: Array, inverse?: boolean); - asymmetricMatch(other: Array): boolean; - toString(): string; - getExpectedType(): string; -} -declare class ObjectContaining extends AsymmetricMatcher> { - constructor(sample: Record, inverse?: boolean); - asymmetricMatch(other: any): boolean; - toString(): string; - getExpectedType(): string; -} -declare class StringContaining extends AsymmetricMatcher { - constructor(sample: string, inverse?: boolean); - asymmetricMatch(other: string): boolean; - toString(): string; - getExpectedType(): string; -} -declare class StringMatching extends AsymmetricMatcher { - constructor(sample: string | RegExp, inverse?: boolean); - asymmetricMatch(other: string): boolean; - toString(): string; - getExpectedType(): string; -} -declare class CloseTo extends AsymmetricMatcher { - private precision; - constructor(sample: number, precision?: number, inverse?: boolean); - asymmetricMatch(other: number): boolean; - toString(): string; - getExpectedType(): string; -} -export declare const any: (expectedObject: unknown) => Any; -export declare const anything: () => Anything; -export declare const arrayContaining: (sample: Array) => ArrayContaining; -export declare const arrayNotContaining: (sample: Array) => ArrayContaining; -export declare const objectContaining: (sample: Record) => ObjectContaining; -export declare const objectNotContaining: (sample: Record) => ObjectContaining; -export declare const stringContaining: (expected: string) => StringContaining; -export declare const stringNotContaining: (expected: string) => StringContaining; -export declare const stringMatching: (expected: string | RegExp) => StringMatching; -export declare const stringNotMatching: (expected: string | RegExp) => StringMatching; -export declare const closeTo: (expected: number, precision?: number | undefined) => CloseTo; -export declare const notCloseTo: (expected: number, precision?: number | undefined) => CloseTo; -export {}; diff --git a/node_modules/expect/build/asymmetricMatchers.js b/node_modules/expect/build/asymmetricMatchers.js index ff3d093b5..4000a26f7 100644 --- a/node_modules/expect/build/asymmetricMatchers.js +++ b/node_modules/expect/build/asymmetricMatchers.js @@ -3,6 +3,14 @@ Object.defineProperty(exports, '__esModule', { value: true }); +exports.closeTo = + exports.arrayNotContaining = + exports.arrayContaining = + exports.anything = + exports.any = + exports.AsymmetricMatcher = + void 0; +exports.hasProperty = hasProperty; exports.stringNotMatching = exports.stringNotContaining = exports.stringMatching = @@ -10,22 +18,16 @@ exports.stringNotMatching = exports.objectNotContaining = exports.objectContaining = exports.notCloseTo = - exports.closeTo = - exports.arrayNotContaining = - exports.arrayContaining = - exports.anything = - exports.any = - exports.AsymmetricMatcher = void 0; +var _expectUtils = require('@jest/expect-utils'); + var matcherUtils = _interopRequireWildcard(require('jest-matcher-utils')); -var _jasmineUtils = require('./jasmineUtils'); +var _jestUtil = require('jest-util'); var _jestMatchersObject = require('./jestMatchersObject'); -var _utils = require('./utils'); - function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== 'function') return null; var cacheBabelInterop = new WeakMap(); @@ -68,46 +70,54 @@ function _interopRequireWildcard(obj, nodeInterop) { return newObj; } -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +const functionToString = Function.prototype.toString; + +function fnNameFor(func) { + if (func.name) { + return func.name; + } + + const matches = functionToString + .call(func) + .match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/); + return matches ? matches[1] : ''; } const utils = Object.freeze({ ...matcherUtils, - iterableEquality: _utils.iterableEquality, - subsetEquality: _utils.subsetEquality + iterableEquality: _expectUtils.iterableEquality, + subsetEquality: _expectUtils.subsetEquality }); +function getPrototype(obj) { + if (Object.getPrototypeOf) { + return Object.getPrototypeOf(obj); + } + + if (obj.constructor.prototype == obj) { + return null; + } + + return obj.constructor.prototype; +} + +function hasProperty(obj, property) { + if (!obj) { + return false; + } + + if (Object.prototype.hasOwnProperty.call(obj, property)) { + return true; + } + + return hasProperty(getPrototype(obj), property); +} + class AsymmetricMatcher { - constructor(sample, inverse = false) { - _defineProperty(this, '$$typeof', Symbol.for('jest.asymmetricMatcher')); + $$typeof = Symbol.for('jest.asymmetricMatcher'); + constructor(sample, inverse = false) { this.sample = sample; this.inverse = inverse; } @@ -115,7 +125,7 @@ class AsymmetricMatcher { getMatcherContext() { return { ...(0, _jestMatchersObject.getState)(), - equals: _jasmineUtils.equals, + equals: _expectUtils.equals, isNot: this.inverse, utils }; @@ -193,17 +203,17 @@ class Any extends AsymmetricMatcher { return 'boolean'; } - return (0, _jasmineUtils.fnNameFor)(this.sample); + return fnNameFor(this.sample); } toAsymmetricMatcher() { - return 'Any<' + (0, _jasmineUtils.fnNameFor)(this.sample) + '>'; + return `Any<${fnNameFor(this.sample)}>`; } } class Anything extends AsymmetricMatcher { asymmetricMatch(other) { - return !(0, _jasmineUtils.isUndefined)(other) && other !== null; + return other != null; } toString() { @@ -223,9 +233,8 @@ class ArrayContaining extends AsymmetricMatcher { asymmetricMatch(other) { if (!Array.isArray(this.sample)) { throw new Error( - `You must provide an array to ${this.toString()}, not '` + - typeof this.sample + - "'." + `You must provide an array to ${this.toString()}, not '${typeof this + .sample}'.` ); } @@ -233,7 +242,7 @@ class ArrayContaining extends AsymmetricMatcher { this.sample.length === 0 || (Array.isArray(other) && this.sample.every(item => - other.some(another => (0, _jasmineUtils.equals)(item, another)) + other.some(another => (0, _expectUtils.equals)(item, another)) )); return this.inverse ? !result : result; } @@ -255,9 +264,8 @@ class ObjectContaining extends AsymmetricMatcher { asymmetricMatch(other) { if (typeof this.sample !== 'object') { throw new Error( - `You must provide an object to ${this.toString()}, not '` + - typeof this.sample + - "'." + `You must provide an object to ${this.toString()}, not '${typeof this + .sample}'.` ); } @@ -265,8 +273,8 @@ class ObjectContaining extends AsymmetricMatcher { for (const property in this.sample) { if ( - !(0, _jasmineUtils.hasProperty)(other, property) || - !(0, _jasmineUtils.equals)(this.sample[property], other[property]) + !hasProperty(other, property) || + !(0, _expectUtils.equals)(this.sample[property], other[property]) ) { result = false; break; @@ -287,7 +295,7 @@ class ObjectContaining extends AsymmetricMatcher { class StringContaining extends AsymmetricMatcher { constructor(sample, inverse = false) { - if (!(0, _jasmineUtils.isA)('String', sample)) { + if (!(0, _expectUtils.isA)('String', sample)) { throw new Error('Expected is not a string'); } @@ -296,7 +304,7 @@ class StringContaining extends AsymmetricMatcher { asymmetricMatch(other) { const result = - (0, _jasmineUtils.isA)('String', other) && other.includes(this.sample); + (0, _expectUtils.isA)('String', other) && other.includes(this.sample); return this.inverse ? !result : result; } @@ -312,8 +320,8 @@ class StringContaining extends AsymmetricMatcher { class StringMatching extends AsymmetricMatcher { constructor(sample, inverse = false) { if ( - !(0, _jasmineUtils.isA)('String', sample) && - !(0, _jasmineUtils.isA)('RegExp', sample) + !(0, _expectUtils.isA)('String', sample) && + !(0, _expectUtils.isA)('RegExp', sample) ) { throw new Error('Expected is not a String or a RegExp'); } @@ -323,7 +331,7 @@ class StringMatching extends AsymmetricMatcher { asymmetricMatch(other) { const result = - (0, _jasmineUtils.isA)('String', other) && this.sample.test(other); + (0, _expectUtils.isA)('String', other) && this.sample.test(other); return this.inverse ? !result : result; } @@ -337,25 +345,24 @@ class StringMatching extends AsymmetricMatcher { } class CloseTo extends AsymmetricMatcher { + precision; + constructor(sample, precision = 2, inverse = false) { - if (!(0, _jasmineUtils.isA)('Number', sample)) { + if (!(0, _expectUtils.isA)('Number', sample)) { throw new Error('Expected is not a Number'); } - if (!(0, _jasmineUtils.isA)('Number', precision)) { + if (!(0, _expectUtils.isA)('Number', precision)) { throw new Error('Precision is not a Number'); } super(sample); - - _defineProperty(this, 'precision', void 0); - this.inverse = inverse; this.precision = precision; } asymmetricMatch(other) { - if (!(0, _jasmineUtils.isA)('Number', other)) { + if (!(0, _expectUtils.isA)('Number', other)) { return false; } @@ -380,6 +387,14 @@ class CloseTo extends AsymmetricMatcher { getExpectedType() { return 'number'; } + + toAsymmetricMatcher() { + return [ + this.toString(), + this.sample, + `(${(0, _jestUtil.pluralize)('digit', this.precision)})` + ].join(' '); + } } const any = expectedObject => new Any(expectedObject); diff --git a/node_modules/expect/build/extractExpectedAssertionsErrors.d.ts b/node_modules/expect/build/extractExpectedAssertionsErrors.d.ts deleted file mode 100644 index 03ccd3ebf..000000000 --- a/node_modules/expect/build/extractExpectedAssertionsErrors.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { Expect } from './types'; -declare const extractExpectedAssertionsErrors: Expect['extractExpectedAssertionsErrors']; -export default extractExpectedAssertionsErrors; diff --git a/node_modules/expect/build/extractExpectedAssertionsErrors.js b/node_modules/expect/build/extractExpectedAssertionsErrors.js index b3dcbdd58..d53679624 100644 --- a/node_modules/expect/build/extractExpectedAssertionsErrors.js +++ b/node_modules/expect/build/extractExpectedAssertionsErrors.js @@ -44,20 +44,18 @@ const extractExpectedAssertionsErrors = () => { (0, _jestMatcherUtils.pluralize)('assertion', expectedAssertionsNumber) ); expectedAssertionsNumberError.message = - (0, _jestMatcherUtils.matcherHint)( + `${(0, _jestMatcherUtils.matcherHint)( '.assertions', '', - String(expectedAssertionsNumber), + expectedAssertionsNumber.toString(), { isDirectExpectCall: true } - ) + - '\n\n' + - `Expected ${numOfAssertionsExpected} to be called but received ` + - (0, _jestMatcherUtils.RECEIVED_COLOR)( + )}\n\n` + + `Expected ${numOfAssertionsExpected} to be called but received ${(0, + _jestMatcherUtils.RECEIVED_COLOR)( (0, _jestMatcherUtils.pluralize)('assertion call', assertionCalls || 0) - ) + - '.'; + )}.`; result.push({ actual: assertionCalls.toString(), error: expectedAssertionsNumberError, @@ -70,12 +68,14 @@ const extractExpectedAssertionsErrors = () => { 'at least one assertion' ); const received = (0, _jestMatcherUtils.RECEIVED_COLOR)('received none'); - isExpectingAssertionsError.message = - (0, _jestMatcherUtils.matcherHint)('.hasAssertions', '', '', { + isExpectingAssertionsError.message = `${(0, _jestMatcherUtils.matcherHint)( + '.hasAssertions', + '', + '', + { isDirectExpectCall: true - }) + - '\n\n' + - `Expected ${expected} to be called but ${received}.`; + } + )}\n\nExpected ${expected} to be called but ${received}.`; result.push({ actual: 'none', error: isExpectingAssertionsError, diff --git a/node_modules/expect/build/index.d.ts b/node_modules/expect/build/index.d.ts index f8e44b975..30fd15b3b 100644 --- a/node_modules/expect/build/index.d.ts +++ b/node_modules/expect/build/index.d.ts @@ -3,13 +3,351 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * */ -import type { Expect, MatcherState as JestMatcherState, Matchers as MatcherInterface } from './types'; -declare const expectExport: Expect; -declare namespace expectExport { - type MatcherState = JestMatcherState; - interface Matchers extends MatcherInterface { - } -} -export = expectExport; +import type {EqualsFunction} from '@jest/expect-utils'; +import type * as jestMatcherUtils from 'jest-matcher-utils'; +import type {Tester} from '@jest/expect-utils'; + +export declare abstract class AsymmetricMatcher + implements AsymmetricMatcher_2 +{ + protected sample: T; + protected inverse: boolean; + $$typeof: symbol; + constructor(sample: T, inverse?: boolean); + protected getMatcherContext(): MatcherState; + abstract asymmetricMatch(other: unknown): boolean; + abstract toString(): string; + getExpectedType?(): string; + toAsymmetricMatcher?(): string; +} + +declare type AsymmetricMatcher_2 = { + asymmetricMatch(other: unknown): boolean; + toString(): string; + getExpectedType?(): string; + toAsymmetricMatcher?(): string; +}; + +export declare interface AsymmetricMatchers { + any(sample: unknown): AsymmetricMatcher_2; + anything(): AsymmetricMatcher_2; + arrayContaining(sample: Array): AsymmetricMatcher_2; + closeTo(sample: number, precision?: number): AsymmetricMatcher_2; + objectContaining(sample: Record): AsymmetricMatcher_2; + stringContaining(sample: string): AsymmetricMatcher_2; + stringMatching(sample: string | RegExp): AsymmetricMatcher_2; +} + +declare type AsyncExpectationResult = Promise; + +export declare interface BaseExpect { + assertions(numberOfAssertions: number): void; + extend(matchers: MatchersObject): void; + extractExpectedAssertionsErrors(): ExpectedAssertionsErrors; + getState(): MatcherState; + hasAssertions(): void; + setState(state: Partial): void; +} + +export declare type Expect = { + (actual: T): Matchers & + Inverse> & + PromiseMatchers; +} & BaseExpect & + AsymmetricMatchers & + Inverse>; + +declare const expect_2: Expect; +export default expect_2; +export {expect_2 as expect}; + +declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult; + +declare type ExpectedAssertionsErrors = Array<{ + actual: string | number; + error: Error; + expected: string; +}>; + +declare type Inverse = { + /** + * Inverse next matcher. If you know how to test something, `.not` lets you test its opposite. + */ + not: Matchers; +}; + +export declare class JestAssertionError extends Error { + matcherResult?: Omit & { + message: string; + }; +} + +export declare type MatcherFunction = []> = + MatcherFunctionWithState; + +export declare type MatcherFunctionWithState< + State extends MatcherState = MatcherState, + Expected extends Array = [] /** TODO should be: extends Array = [] */, +> = (this: State, actual: unknown, ...expected: Expected) => ExpectationResult; + +export declare interface Matchers> { + /** + * Ensures the last call to a mock function was provided specific args. + */ + lastCalledWith(...expected: [unknown, ...Array]): R; + /** + * Ensure that the last call to a mock function has returned a specified value. + */ + lastReturnedWith(expected: unknown): R; + /** + * Ensure that a mock function is called with specific arguments on an Nth call. + */ + nthCalledWith(nth: number, ...expected: [unknown, ...Array]): R; + /** + * Ensure that the nth call to a mock function has returned a specified value. + */ + nthReturnedWith(nth: number, expected: unknown): R; + /** + * Checks that a value is what you expect. It uses `===` to check strict equality. + * Don't use `toBe` with floating-point numbers. + */ + toBe(expected: unknown): R; + /** + * Ensures that a mock function is called. + */ + toBeCalled(): R; + /** + * Ensures that a mock function is called an exact number of times. + */ + toBeCalledTimes(expected: number): R; + /** + * Ensure that a mock function is called with specific arguments. + */ + toBeCalledWith(...expected: [unknown, ...Array]): R; + /** + * Using exact equality with floating point numbers is a bad idea. + * Rounding means that intuitive things fail. + * The default for `precision` is 2. + */ + toBeCloseTo(expected: number, precision?: number): R; + /** + * Ensure that a variable is not undefined. + */ + toBeDefined(): R; + /** + * When you don't care what a value is, you just want to + * ensure a value is false in a boolean context. + */ + toBeFalsy(): R; + /** + * For comparing floating point numbers. + */ + toBeGreaterThan(expected: number | bigint): R; + /** + * For comparing floating point numbers. + */ + toBeGreaterThanOrEqual(expected: number | bigint): R; + /** + * Ensure that an object is an instance of a class. + * This matcher uses `instanceof` underneath. + */ + toBeInstanceOf(expected: unknown): R; + /** + * For comparing floating point numbers. + */ + toBeLessThan(expected: number | bigint): R; + /** + * For comparing floating point numbers. + */ + toBeLessThanOrEqual(expected: number | bigint): R; + /** + * Used to check that a variable is NaN. + */ + toBeNaN(): R; + /** + * This is the same as `.toBe(null)` but the error messages are a bit nicer. + * So use `.toBeNull()` when you want to check that something is null. + */ + toBeNull(): R; + /** + * Use when you don't care what a value is, you just want to ensure a value + * is true in a boolean context. In JavaScript, there are six falsy values: + * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. + */ + toBeTruthy(): R; + /** + * Used to check that a variable is undefined. + */ + toBeUndefined(): R; + /** + * Used when you want to check that an item is in a list. + * For testing the items in the list, this uses `===`, a strict equality check. + */ + toContain(expected: unknown): R; + /** + * Used when you want to check that an item is in a list. + * For testing the items in the list, this matcher recursively checks the + * equality of all fields, rather than checking for object identity. + */ + toContainEqual(expected: unknown): R; + /** + * Used when you want to check that two objects have the same value. + * This matcher recursively checks the equality of all fields, rather than checking for object identity. + */ + toEqual(expected: unknown): R; + /** + * Ensures that a mock function is called. + */ + toHaveBeenCalled(): R; + /** + * Ensures that a mock function is called an exact number of times. + */ + toHaveBeenCalledTimes(expected: number): R; + /** + * Ensure that a mock function is called with specific arguments. + */ + toHaveBeenCalledWith(...expected: [unknown, ...Array]): R; + /** + * Ensure that a mock function is called with specific arguments on an Nth call. + */ + toHaveBeenNthCalledWith( + nth: number, + ...expected: [unknown, ...Array] + ): R; + /** + * If you have a mock function, you can use `.toHaveBeenLastCalledWith` + * to test what arguments it was last called with. + */ + toHaveBeenLastCalledWith(...expected: [unknown, ...Array]): R; + /** + * Use to test the specific value that a mock function last returned. + * If the last call to the mock function threw an error, then this matcher will fail + * no matter what value you provided as the expected return value. + */ + toHaveLastReturnedWith(expected: unknown): R; + /** + * Used to check that an object has a `.length` property + * and it is set to a certain numeric value. + */ + toHaveLength(expected: number): R; + /** + * Use to test the specific value that a mock function returned for the nth call. + * If the nth call to the mock function threw an error, then this matcher will fail + * no matter what value you provided as the expected return value. + */ + toHaveNthReturnedWith(nth: number, expected: unknown): R; + /** + * Use to check if property at provided reference keyPath exists for an object. + * For checking deeply nested properties in an object you may use dot notation or an array containing + * the keyPath for deep references. + * + * Optionally, you can provide a value to check if it's equal to the value present at keyPath + * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks + * the equality of all fields. + * + * @example + * + * expect(houseForSale).toHaveProperty('kitchen.area', 20); + */ + toHaveProperty( + expectedPath: string | Array, + expectedValue?: unknown, + ): R; + /** + * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time + */ + toHaveReturned(): R; + /** + * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times. + * Any calls to the mock function that throw an error are not counted toward the number of times the function returned. + */ + toHaveReturnedTimes(expected: number): R; + /** + * Use to ensure that a mock function returned a specific value. + */ + toHaveReturnedWith(expected: unknown): R; + /** + * Check that a string matches a regular expression. + */ + toMatch(expected: string | RegExp): R; + /** + * Used to check that a JavaScript object matches a subset of the properties of an object + */ + toMatchObject( + expected: Record | Array>, + ): R; + /** + * Ensure that a mock function has returned (as opposed to thrown) at least once. + */ + toReturn(): R; + /** + * Ensure that a mock function has returned (as opposed to thrown) a specified number of times. + */ + toReturnTimes(expected: number): R; + /** + * Ensure that a mock function has returned a specified value at least once. + */ + toReturnWith(expected: unknown): R; + /** + * Use to test that objects have the same types as well as structure. + */ + toStrictEqual(expected: unknown): R; + /** + * Used to test that a function throws when it is called. + */ + toThrow(expected?: unknown): R; + /** + * If you want to test that a specific error is thrown inside a function. + */ + toThrowError(expected?: unknown): R; +} + +declare type MatchersObject = { + [name: string]: RawMatcherFn; +}; + +export declare interface MatcherState { + assertionCalls: number; + currentTestName?: string; + dontThrow?(): void; + error?: Error; + equals: EqualsFunction; + expand?: boolean; + expectedAssertionsNumber?: number | null; + expectedAssertionsNumberError?: Error; + isExpectingAssertions?: boolean; + isExpectingAssertionsError?: Error; + isNot: boolean; + promise: string; + suppressedErrors: Array; + testPath?: string; + utils: typeof jestMatcherUtils & { + iterableEquality: Tester; + subsetEquality: Tester; + }; +} + +declare type PromiseMatchers = { + /** + * Unwraps the reason of a rejected promise so any other matcher can be chained. + * If the promise is fulfilled the assertion fails. + */ + rejects: Matchers> & Inverse>>; + /** + * Unwraps the value of a fulfilled promise so any other matcher can be chained. + * If the promise is rejected the assertion fails. + */ + resolves: Matchers> & Inverse>>; +}; + +declare type RawMatcherFn = { + (this: State, actual: any, ...expected: Array): ExpectationResult; +}; + +declare type SyncExpectationResult = { + pass: boolean; + message(): string; +}; + +export {}; diff --git a/node_modules/expect/build/index.js b/node_modules/expect/build/index.js index 07ab2c9ed..98ea823bf 100644 --- a/node_modules/expect/build/index.js +++ b/node_modules/expect/build/index.js @@ -1,20 +1,17 @@ 'use strict'; -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); +Object.defineProperty(exports, '__esModule', { + value: true +}); +Object.defineProperty(exports, 'AsymmetricMatcher', { + enumerable: true, + get: function () { + return _asymmetricMatchers.AsymmetricMatcher; } -})(); +}); +exports.expect = exports.default = exports.JestAssertionError = void 0; -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var _expectUtils = require('@jest/expect-utils'); var matcherUtils = _interopRequireWildcard(require('jest-matcher-utils')); @@ -24,8 +21,6 @@ var _extractExpectedAssertionsErrors = _interopRequireDefault( require('./extractExpectedAssertionsErrors') ); -var _jasmineUtils = require('./jasmineUtils'); - var _jestMatchersObject = require('./jestMatchersObject'); var _matchers = _interopRequireDefault(require('./matchers')); @@ -34,8 +29,6 @@ var _spyMatchers = _interopRequireDefault(require('./spyMatchers')); var _toThrowMatchers = _interopRequireWildcard(require('./toThrowMatchers')); -var _utils = require('./utils'); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {default: obj}; } @@ -82,60 +75,17 @@ function _interopRequireWildcard(obj, nodeInterop) { return newObj; } -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var Promise = + globalThis[Symbol.for('jest-native-promise')] || globalThis.Promise; class JestAssertionError extends Error { - constructor(...args) { - super(...args); - - _defineProperty(this, 'matcherResult', void 0); - } + matcherResult; } +exports.JestAssertionError = JestAssertionError; + const isPromise = obj => !!obj && (typeof obj === 'object' || typeof obj === 'function') && @@ -213,6 +163,8 @@ const expect = (actual, ...rest) => { return expectation; }; +exports.expect = expect; + const getMessage = message => (message && message()) || matcherUtils.RECEIVED_COLOR('No message was specified for this matcher.'); @@ -248,8 +200,12 @@ const makeResolveMatcher = ), reason => { outerErr.message = - matcherUtils.matcherHint(matcherName, undefined, '', options) + - '\n\n' + + `${matcherUtils.matcherHint( + matcherName, + undefined, + '', + options + )}\n\n` + 'Received promise rejected instead of resolved\n' + `Rejected to value: ${matcherUtils.printReceived(reason)}`; return Promise.reject(outerErr); @@ -286,8 +242,12 @@ const makeRejectMatcher = return actualWrapper.then( result => { outerErr.message = - matcherUtils.matcherHint(matcherName, undefined, '', options) + - '\n\n' + + `${matcherUtils.matcherHint( + matcherName, + undefined, + '', + options + )}\n\n` + 'Received promise resolved instead of rejected\n' + `Resolved to value: ${matcherUtils.printReceived(result)}`; return Promise.reject(outerErr); @@ -305,8 +265,8 @@ const makeThrowingMatcher = (matcher, isNot, promise, actual, err) => let throws = true; const utils = { ...matcherUtils, - iterableEquality: _utils.iterableEquality, - subsetEquality: _utils.subsetEquality + iterableEquality: _expectUtils.iterableEquality, + subsetEquality: _expectUtils.subsetEquality }; const matcherContext = { // When throws is disabled, the matcher will not throw errors during test @@ -316,7 +276,7 @@ const makeThrowingMatcher = (matcher, isNot, promise, actual, err) => // failures in a test. dontThrow: () => (throws = false), ...(0, _jestMatchersObject.getState)(), - equals: _jasmineUtils.equals, + equals: _expectUtils.equals, error: err, isNot, promise, @@ -472,14 +432,11 @@ function hasAssertions(...args) { (0, _jestMatchersObject.setMatchers)(_matchers.default, true, expect); (0, _jestMatchersObject.setMatchers)(_spyMatchers.default, true, expect); (0, _jestMatchersObject.setMatchers)(_toThrowMatchers.default, true, expect); - -expect.addSnapshotSerializer = () => void 0; - expect.assertions = assertions; expect.hasAssertions = hasAssertions; expect.getState = _jestMatchersObject.getState; expect.setState = _jestMatchersObject.setState; expect.extractExpectedAssertionsErrors = _extractExpectedAssertionsErrors.default; -const expectExport = expect; -module.exports = expectExport; +var _default = expect; +exports.default = _default; diff --git a/node_modules/expect/build/jasmineUtils.d.ts b/node_modules/expect/build/jasmineUtils.d.ts deleted file mode 100644 index 1a2f0f6bc..000000000 --- a/node_modules/expect/build/jasmineUtils.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Tester } from './types'; -export declare function equals(a: unknown, b: unknown, customTesters?: Array, strictCheck?: boolean): boolean; -export declare function isA(typeName: string, value: unknown): boolean; -export declare function fnNameFor(func: Function): string; -export declare function isUndefined(obj: any): boolean; -export declare function hasProperty(obj: object | null, property: string): boolean; -export declare function isImmutableUnorderedKeyed(maybeKeyed: any): boolean; -export declare function isImmutableUnorderedSet(maybeSet: any): boolean; diff --git a/node_modules/expect/build/jestMatchersObject.d.ts b/node_modules/expect/build/jestMatchersObject.d.ts deleted file mode 100644 index ce40e41de..000000000 --- a/node_modules/expect/build/jestMatchersObject.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { Expect, MatcherState, MatchersObject } from './types'; -export declare const INTERNAL_MATCHER_FLAG: unique symbol; -export declare const getState: () => State; -export declare const setState: (state: Partial) => void; -export declare const getMatchers: () => MatchersObject; -export declare const setMatchers: (matchers: MatchersObject, isInternal: boolean, expect: Expect) => void; diff --git a/node_modules/expect/build/jestMatchersObject.js b/node_modules/expect/build/jestMatchersObject.js index f183a34bd..af8e30efb 100644 --- a/node_modules/expect/build/jestMatchersObject.js +++ b/node_modules/expect/build/jestMatchersObject.js @@ -10,23 +10,11 @@ exports.setState = exports.INTERNAL_MATCHER_FLAG = void 0; +var _jestGetType = require('jest-get-type'); + var _asymmetricMatchers = require('./asymmetricMatchers'); -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; // Global matchers object holds the list of available matchers and // the state, that can hold matcher specific values that change over time. const JEST_MATCHERS_OBJECT = Symbol.for('$$jest-matchers-object'); // Notes a built-in/internal Jest matcher. @@ -35,14 +23,14 @@ const JEST_MATCHERS_OBJECT = Symbol.for('$$jest-matchers-object'); // Notes a bu const INTERNAL_MATCHER_FLAG = Symbol.for('$$jest-internal-matcher'); exports.INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG; -if (!global.hasOwnProperty(JEST_MATCHERS_OBJECT)) { +if (!Object.prototype.hasOwnProperty.call(globalThis, JEST_MATCHERS_OBJECT)) { const defaultState = { assertionCalls: 0, expectedAssertionsNumber: null, isExpectingAssertions: false, suppressedErrors: [] // errors that are not thrown immediately. }; - Object.defineProperty(global, JEST_MATCHERS_OBJECT, { + Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, { value: { matchers: Object.create(null), state: defaultState @@ -50,23 +38,31 @@ if (!global.hasOwnProperty(JEST_MATCHERS_OBJECT)) { }); } -const getState = () => global[JEST_MATCHERS_OBJECT].state; +const getState = () => globalThis[JEST_MATCHERS_OBJECT].state; exports.getState = getState; const setState = state => { - Object.assign(global[JEST_MATCHERS_OBJECT].state, state); + Object.assign(globalThis[JEST_MATCHERS_OBJECT].state, state); }; exports.setState = setState; -const getMatchers = () => global[JEST_MATCHERS_OBJECT].matchers; +const getMatchers = () => globalThis[JEST_MATCHERS_OBJECT].matchers; exports.getMatchers = getMatchers; const setMatchers = (matchers, isInternal, expect) => { Object.keys(matchers).forEach(key => { const matcher = matchers[key]; + + if (typeof matcher !== 'function') { + throw new TypeError( + `expect.extend: \`${key}\` is not a valid matcher. Must be a function, is "${(0, + _jestGetType.getType)(matcher)}"` + ); + } + Object.defineProperty(matcher, INTERNAL_MATCHER_FLAG, { value: isInternal }); @@ -114,7 +110,7 @@ const setMatchers = (matchers, isInternal, expect) => { }); } }); - Object.assign(global[JEST_MATCHERS_OBJECT].matchers, matchers); + Object.assign(globalThis[JEST_MATCHERS_OBJECT].matchers, matchers); }; exports.setMatchers = setMatchers; diff --git a/node_modules/expect/build/matchers.d.ts b/node_modules/expect/build/matchers.d.ts deleted file mode 100644 index 650147309..000000000 --- a/node_modules/expect/build/matchers.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { MatchersObject } from './types'; -declare const matchers: MatchersObject; -export default matchers; diff --git a/node_modules/expect/build/matchers.js b/node_modules/expect/build/matchers.js index e0cf502ac..18158781e 100644 --- a/node_modules/expect/build/matchers.js +++ b/node_modules/expect/build/matchers.js @@ -5,16 +5,14 @@ Object.defineProperty(exports, '__esModule', { }); exports.default = void 0; +var _expectUtils = require('@jest/expect-utils'); + var _jestGetType = require('jest-get-type'); var _jestMatcherUtils = require('jest-matcher-utils'); -var _jasmineUtils = require('./jasmineUtils'); - var _print = require('./print'); -var _utils = require('./utils'); - /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * @@ -33,10 +31,10 @@ const RECEIVED_VALUE_LABEL = 'Received value'; // The optional property of match const isExpand = expand => expand !== false; const toStrictEqualTesters = [ - _utils.iterableEquality, - _utils.typeEquality, - _utils.sparseArrayEquality, - _utils.arrayBufferEquality + _expectUtils.iterableEquality, + _expectUtils.typeEquality, + _expectUtils.sparseArrayEquality, + _expectUtils.arrayBufferEquality ]; const matchers = { toBe(received, expected) { @@ -49,6 +47,7 @@ const matchers = { const pass = Object.is(received, expected); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -65,7 +64,7 @@ const matchers = { // If deep equality passes when referential identity fails, // but exclude map and set until review of their equality logic. if ( - (0, _jasmineUtils.equals)( + (0, _expectUtils.equals)( received, expected, toStrictEqualTesters, @@ -74,8 +73,8 @@ const matchers = { ) { deepEqualityName = 'toStrictEqual'; } else if ( - (0, _jasmineUtils.equals)(received, expected, [ - _utils.iterableEquality + (0, _expectUtils.equals)(received, expected, [ + _expectUtils.iterableEquality ]) ) { deepEqualityName = 'toEqual'; @@ -83,6 +82,7 @@ const matchers = { } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -91,9 +91,9 @@ const matchers = { ) + '\n\n' + (deepEqualityName !== null - ? (0, _jestMatcherUtils.DIM_COLOR)( + ? `${(0, _jestMatcherUtils.DIM_COLOR)( `If it should pass with deep equality, replace "${matcherName}" with "${deepEqualityName}"` - ) + '\n\n' + )}\n\n` : '') + (0, _jestMatcherUtils.printDiffOrStringify)( expected, @@ -185,6 +185,7 @@ const matchers = { const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -198,14 +199,14 @@ const matchers = { : `Received: ${(0, _jestMatcherUtils.printReceived)( received )}\n` + - '\n' + - (0, _print.printCloseTo)( + `\n${(0, _print.printCloseTo)( receivedDiff, expectedDiff, precision, isNot - )) + )}`) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -238,6 +239,7 @@ const matchers = { const pass = received !== void 0; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + `Received: ${(0, _jestMatcherUtils.printReceived)(received)}`; @@ -258,6 +260,7 @@ const matchers = { const pass = !received; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + `Received: ${(0, _jestMatcherUtils.printReceived)(received)}`; @@ -284,6 +287,7 @@ const matchers = { const pass = received > expected; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -320,6 +324,7 @@ const matchers = { const pass = received >= expected; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -369,6 +374,7 @@ const matchers = { const pass = received instanceof expected; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -389,6 +395,7 @@ const matchers = { ) : '') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -434,6 +441,7 @@ const matchers = { const pass = received < expected; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -470,6 +478,7 @@ const matchers = { const pass = received <= expected; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -498,6 +507,7 @@ const matchers = { const pass = Number.isNaN(received); const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + `Received: ${(0, _jestMatcherUtils.printReceived)(received)}`; @@ -518,6 +528,7 @@ const matchers = { const pass = received === null; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + `Received: ${(0, _jestMatcherUtils.printReceived)(received)}`; @@ -538,6 +549,7 @@ const matchers = { const pass = !!received; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + `Received: ${(0, _jestMatcherUtils.printReceived)(received)}`; @@ -558,6 +570,7 @@ const matchers = { const pass = received === void 0; const message = () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + `Received: ${(0, _jestMatcherUtils.printReceived)(received)}`; @@ -614,7 +627,7 @@ const matchers = { String(expected), options ), - wrongTypeErrorMessage, + wrongTypeErrorMessage, // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.printWithType)( 'Expected', expected, @@ -643,6 +656,7 @@ const matchers = { labelReceived ); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -682,6 +696,7 @@ const matchers = { labelReceived ); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -698,7 +713,9 @@ const matchers = { }` + (!isNot && indexable.findIndex(item => - (0, _jasmineUtils.equals)(item, expected, [_utils.iterableEquality]) + (0, _expectUtils.equals)(item, expected, [ + _expectUtils.iterableEquality + ]) ) !== -1 ? `\n\n${_jestMatcherUtils.SUGGEST_TO_CONTAIN_EQUAL}` : '') @@ -742,7 +759,7 @@ const matchers = { } const index = Array.from(received).findIndex(item => - (0, _jasmineUtils.equals)(item, expected, [_utils.iterableEquality]) + (0, _expectUtils.equals)(item, expected, [_expectUtils.iterableEquality]) ); const pass = index !== -1; @@ -754,6 +771,7 @@ const matchers = { labelReceived ); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -784,11 +802,12 @@ const matchers = { isNot: this.isNot, promise: this.promise }; - const pass = (0, _jasmineUtils.equals)(received, expected, [ - _utils.iterableEquality + const pass = (0, _expectUtils.equals)(received, expected, [ + _expectUtils.iterableEquality ]); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -802,6 +821,7 @@ const matchers = { ? `Received: ${(0, _jestMatcherUtils.printReceived)(received)}` : '') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -880,6 +900,7 @@ const matchers = { labelReceivedValue ); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -960,7 +981,7 @@ const matchers = { const expectedPathLength = typeof expectedPath === 'string' - ? (0, _utils.pathAsArray)(expectedPath).length + ? (0, _expectUtils.pathAsArray)(expectedPath).length : expectedPath.length; if (expectedPathType === 'array' && expectedPathLength === 0) { @@ -984,56 +1005,20 @@ const matchers = { ); } - const result = (0, _utils.getPath)(received, expectedPath); - const {lastTraversedObject, hasEndProp} = result; + const result = (0, _expectUtils.getPath)(received, expectedPath); + const {lastTraversedObject, endPropIsDefined, hasEndProp, value} = result; const receivedPath = result.traversedPath; const hasCompletePath = receivedPath.length === expectedPathLength; const receivedValue = hasCompletePath ? result.value : lastTraversedObject; - const pass = hasValue - ? (0, _jasmineUtils.equals)(result.value, expectedValue, [ - _utils.iterableEquality - ]) - : Boolean(hasEndProp); // theoretically undefined if empty path - // Remove type cast if we rewrite getPath as iterative algorithm. - // Delete this unique report if future breaking change - // removes the edge case that expected value undefined - // also matches absence of a property with the key path. - - if (pass && !hasCompletePath) { - const message = () => - (0, _jestMatcherUtils.matcherHint)( - matcherName, - undefined, - expectedArgument, - options - ) + - '\n\n' + - `Expected path: ${(0, _jestMatcherUtils.printExpected)( - expectedPath - )}\n` + - `Received path: ${(0, _jestMatcherUtils.printReceived)( - expectedPathType === 'array' || receivedPath.length === 0 - ? receivedPath - : receivedPath.join('.') - )}\n\n` + - `Expected value: not ${(0, _jestMatcherUtils.printExpected)( - expectedValue - )}\n` + - `Received value: ${(0, _jestMatcherUtils.printReceived)( - receivedValue - )}\n\n` + - (0, _jestMatcherUtils.DIM_COLOR)( - 'Because a positive assertion passes for expected value undefined if the property does not exist, this negative assertion fails unless the property does exist and has a defined value' - ); - - return { - message, - pass - }; - } - + const pass = + hasValue && endPropIsDefined + ? (0, _expectUtils.equals)(value, expectedValue, [ + _expectUtils.iterableEquality + ]) + : Boolean(hasEndProp); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1047,13 +1032,13 @@ const matchers = { )}\n\n` + `Expected value: not ${(0, _jestMatcherUtils.printExpected)( expectedValue - )}` + - ((0, _jestMatcherUtils.stringify)(expectedValue) !== - (0, _jestMatcherUtils.stringify)(receivedValue) - ? `\nReceived value: ${(0, _jestMatcherUtils.printReceived)( - receivedValue - )}` - : '') + )}${ + (0, _jestMatcherUtils.stringify)(expectedValue) !== + (0, _jestMatcherUtils.stringify)(receivedValue) + ? `\nReceived value: ${(0, + _jestMatcherUtils.printReceived)(receivedValue)}` + : '' + }` : `Expected path: not ${(0, _jestMatcherUtils.printExpected)( expectedPath )}\n\n` + @@ -1061,6 +1046,7 @@ const matchers = { receivedValue )}`) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1072,25 +1058,24 @@ const matchers = { expectedPath )}\n` + (hasCompletePath - ? '\n' + - (0, _jestMatcherUtils.printDiffOrStringify)( + ? `\n${(0, _jestMatcherUtils.printDiffOrStringify)( expectedValue, receivedValue, EXPECTED_VALUE_LABEL, RECEIVED_VALUE_LABEL, isExpand(this.expand) - ) + )}` : `Received path: ${(0, _jestMatcherUtils.printReceived)( expectedPathType === 'array' || receivedPath.length === 0 ? receivedPath : receivedPath.join('.') - )}\n\n` + - (hasValue - ? `Expected value: ${(0, _jestMatcherUtils.printExpected)( - expectedValue - )}\n` - : '') + - `Received value: ${(0, _jestMatcherUtils.printReceived)( + )}\n\n${ + hasValue + ? `Expected value: ${(0, _jestMatcherUtils.printExpected)( + expectedValue + )}\n` + : '' + }Received value: ${(0, _jestMatcherUtils.printReceived)( receivedValue )}`); return { @@ -1157,7 +1142,7 @@ const matchers = { : new RegExp(expected).test(received); const message = pass ? () => - typeof expected === 'string' + typeof expected === 'string' // eslint-disable-next-line prefer-template ? (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1173,7 +1158,7 @@ const matchers = { received, received.indexOf(expected), expected.length - )}` + )}` // eslint-disable-next-line prefer-template : (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1201,6 +1186,7 @@ const matchers = { labelReceived ); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1271,12 +1257,13 @@ const matchers = { ); } - const pass = (0, _jasmineUtils.equals)(received, expected, [ - _utils.iterableEquality, - _utils.subsetEquality + const pass = (0, _expectUtils.equals)(received, expected, [ + _expectUtils.iterableEquality, + _expectUtils.subsetEquality ]); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1292,6 +1279,7 @@ const matchers = { )}` : '') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1301,7 +1289,7 @@ const matchers = { '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)( expected, - (0, _utils.getObjectSubset)(received, expected), + (0, _expectUtils.getObjectSubset)(received, expected), EXPECTED_LABEL, RECEIVED_LABEL, isExpand(this.expand) @@ -1319,7 +1307,7 @@ const matchers = { isNot: this.isNot, promise: this.promise }; - const pass = (0, _jasmineUtils.equals)( + const pass = (0, _expectUtils.equals)( received, expected, toStrictEqualTesters, @@ -1327,6 +1315,7 @@ const matchers = { ); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -1340,6 +1329,7 @@ const matchers = { ? `Received: ${(0, _jestMatcherUtils.printReceived)(received)}` : '') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, diff --git a/node_modules/expect/build/print.d.ts b/node_modules/expect/build/print.d.ts deleted file mode 100644 index 9c197516a..000000000 --- a/node_modules/expect/build/print.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -export declare const printReceivedStringContainExpectedSubstring: (received: string, start: number, length: number) => string; -export declare const printReceivedStringContainExpectedResult: (received: string, result: RegExpExecArray | null) => string; -export declare const printReceivedArrayContainExpectedItem: (received: Array, index: number) => string; -export declare const printCloseTo: (receivedDiff: number, expectedDiff: number, precision: number, isNot: boolean) => string; -export declare const printExpectedConstructorName: (label: string, expected: Function) => string; -export declare const printExpectedConstructorNameNot: (label: string, expected: Function) => string; -export declare const printReceivedConstructorName: (label: string, received: Function) => string; -export declare const printReceivedConstructorNameNot: (label: string, received: Function, expected: Function) => string; diff --git a/node_modules/expect/build/print.js b/node_modules/expect/build/print.js index a44925644..f6f770f7f 100644 --- a/node_modules/expect/build/print.js +++ b/node_modules/expect/build/print.js @@ -34,13 +34,10 @@ const printReceivedStringContainExpectedSubstring = ( length // not end ) => (0, _jestMatcherUtils.RECEIVED_COLOR)( - '"' + - printSubstring(received.slice(0, start)) + - (0, _jestMatcherUtils.INVERTED_COLOR)( - printSubstring(received.slice(start, start + length)) - ) + - printSubstring(received.slice(start + length)) + - '"' + `"${printSubstring(received.slice(0, start))}${(0, + _jestMatcherUtils.INVERTED_COLOR)( + printSubstring(received.slice(start, start + length)) + )}${printSubstring(received.slice(start + length))}"` ); exports.printReceivedStringContainExpectedSubstring = @@ -62,16 +59,14 @@ exports.printReceivedStringContainExpectedResult = const printReceivedArrayContainExpectedItem = (received, index) => (0, _jestMatcherUtils.RECEIVED_COLOR)( - '[' + - received - .map((item, i) => { - const stringified = (0, _jestMatcherUtils.stringify)(item); - return i === index - ? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified) - : stringified; - }) - .join(', ') + - ']' + `[${received + .map((item, i) => { + const stringified = (0, _jestMatcherUtils.stringify)(item); + return i === index + ? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified) + : stringified; + }) + .join(', ')}]` ); exports.printReceivedArrayContainExpectedItem = @@ -99,17 +94,17 @@ const printCloseTo = (receivedDiff, expectedDiff, precision, isNot) => { exports.printCloseTo = printCloseTo; const printExpectedConstructorName = (label, expected) => - printConstructorName(label, expected, false, true) + '\n'; + `${printConstructorName(label, expected, false, true)}\n`; exports.printExpectedConstructorName = printExpectedConstructorName; const printExpectedConstructorNameNot = (label, expected) => - printConstructorName(label, expected, true, true) + '\n'; + `${printConstructorName(label, expected, true, true)}\n`; exports.printExpectedConstructorNameNot = printExpectedConstructorNameNot; const printReceivedConstructorName = (label, received) => - printConstructorName(label, received, false, false) + '\n'; // Do not call function if received is equal to expected. + `${printConstructorName(label, received, false, false)}\n`; // Do not call function if received is equal to expected. exports.printReceivedConstructorName = printReceivedConstructorName; @@ -118,14 +113,12 @@ const printReceivedConstructorNameNot = (label, received, expected) => expected.name.length !== 0 && typeof received.name === 'string' && received.name.length !== 0 - ? printConstructorName(label, received, true, false) + - ` ${ + ? `${printConstructorName(label, received, true, false)} ${ Object.getPrototypeOf(received) === expected ? 'extends' : 'extends … extends' - } ${(0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)}` + - '\n' - : printConstructorName(label, received, false, false) + '\n'; + } ${(0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)}\n` + : `${printConstructorName(label, received, false, false)}\n`; exports.printReceivedConstructorNameNot = printReceivedConstructorNameNot; diff --git a/node_modules/expect/build/spyMatchers.d.ts b/node_modules/expect/build/spyMatchers.d.ts deleted file mode 100644 index 433b443be..000000000 --- a/node_modules/expect/build/spyMatchers.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { MatchersObject } from './types'; -declare const spyMatchers: MatchersObject; -export default spyMatchers; diff --git a/node_modules/expect/build/spyMatchers.js b/node_modules/expect/build/spyMatchers.js index 3181d088d..b2c297c60 100644 --- a/node_modules/expect/build/spyMatchers.js +++ b/node_modules/expect/build/spyMatchers.js @@ -5,14 +5,12 @@ Object.defineProperty(exports, '__esModule', { }); exports.default = void 0; +var _expectUtils = require('@jest/expect-utils'); + var _jestGetType = require('jest-get-type'); var _jestMatcherUtils = require('jest-matcher-utils'); -var _jasmineUtils = require('./jasmineUtils'); - -var _utils = require('./utils'); - /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * @@ -47,9 +45,10 @@ const printCommon = val => (0, _jestMatcherUtils.DIM_COLOR)((0, _jestMatcherUtils.stringify)(val)); const isEqualValue = (expected, received) => - (0, _jasmineUtils.equals)(expected, received, [_utils.iterableEquality]); + (0, _expectUtils.equals)(expected, received, [_expectUtils.iterableEquality]); -const isEqualCall = (expected, received) => isEqualValue(expected, received); +const isEqualCall = (expected, received) => + received.length === expected.length && isEqualValue(expected, received); const isEqualReturn = (expected, result) => result.type === 'return' && isEqualValue(expected, result.value); @@ -58,10 +57,13 @@ const countReturns = results => results.reduce((n, result) => (result.type === 'return' ? n + 1 : n), 0); const printNumberOfReturns = (countReturns, countCalls) => - `\nNumber of returns: ${(0, _jestMatcherUtils.printReceived)(countReturns)}` + - (countCalls !== countReturns - ? `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(countCalls)}` - : ''); + `\nNumber of returns: ${(0, _jestMatcherUtils.printReceived)(countReturns)}${ + countCalls !== countReturns + ? `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)( + countCalls + )}` + : '' + }`; // Given a label, return a function which given a string, // right-aligns it preceding the colon in the label. @@ -71,7 +73,7 @@ const getRightAlignedPrinter = label => { const suffix = label.slice(index); return (string, isExpectedCall) => (isExpectedCall - ? '->' + ' '.repeat(Math.max(0, index - 2 - string.length)) + ? `->${' '.repeat(Math.max(0, index - 2 - string.length))}` : ' '.repeat(Math.max(index - string.length))) + string + suffix; @@ -90,21 +92,19 @@ const printReceivedCallsNegative = ( const label = 'Received: '; if (isOnlyCall) { - return label + printReceivedArgs(indexedCalls[0], expected) + '\n'; + return `${label + printReceivedArgs(indexedCalls[0], expected)}\n`; } const printAligned = getRightAlignedPrinter(label); - return ( - 'Received\n' + - indexedCalls.reduce( - (printed, [i, args]) => + return `Received\n${indexedCalls.reduce( + (printed, [i, args]) => + `${ printed + printAligned(String(i + 1), i === iExpectedCall) + - printReceivedArgs(args, expected) + - '\n', - '' - ) - ); + printReceivedArgs(args, expected) + }\n`, + '' + )}`; }; const printExpectedReceivedCallsPositive = ( @@ -156,7 +156,7 @@ const printExpectedReceivedCallsPositive = ( difference.includes('+ Received') ) { // Omit annotation in case multiple args have diff. - lines.push(difference.split('\n').slice(3).join('\n') + ','); + lines.push(`${difference.split('\n').slice(3).join('\n')},`); continue; } } @@ -164,42 +164,42 @@ const printExpectedReceivedCallsPositive = ( if (i < expected.length) { lines.push( - (0, _jestMatcherUtils.EXPECTED_COLOR)( - '- ' + (0, _jestMatcherUtils.stringify)(expected[i]) - ) + ',' + `${(0, _jestMatcherUtils.EXPECTED_COLOR)( + `- ${(0, _jestMatcherUtils.stringify)(expected[i])}` + )},` ); } if (i < received.length) { lines.push( - (0, _jestMatcherUtils.RECEIVED_COLOR)( - '+ ' + (0, _jestMatcherUtils.stringify)(received[i]) - ) + ',' + `${(0, _jestMatcherUtils.RECEIVED_COLOR)( + `+ ${(0, _jestMatcherUtils.stringify)(received[i])}` + )},` ); } } - return lines.join('\n') + '\n'; + return `${lines.join('\n')}\n`; } - return expectedLine + label + printReceivedArgs(received, expected) + '\n'; + return `${expectedLine + label + printReceivedArgs(received, expected)}\n`; } const printAligned = getRightAlignedPrinter(label); return ( + // eslint-disable-next-line prefer-template expectedLine + 'Received\n' + indexedCalls.reduce((printed, [i, received]) => { const aligned = printAligned(String(i + 1), i === iExpectedCall); - return ( + return `${ printed + ((i === iExpectedCall || iExpectedCall === undefined) && isLineDiffableCall(expected, received) ? aligned.replace(': ', '\n') + printDiffCall(expected, received, expand) - : aligned + printReceivedArgs(received, expected)) + - '\n' - ); + : aligned + printReceivedArgs(received, expected)) + }\n`; }, '') ); }; @@ -211,7 +211,7 @@ const printDiffCall = (expected, received, expand) => .map((arg, i) => { if (i < expected.length) { if (isEqualValue(expected[i], arg)) { - return indentation + ' ' + printCommon(arg) + ','; + return `${indentation} ${printCommon(arg)},`; } if (isLineDiffableArg(expected[i], arg)) { @@ -226,26 +226,23 @@ const printDiffCall = (expected, received, expand) => ) { // Display diff with indentation. // Omit annotation in case multiple args have diff. - return ( - difference - .split('\n') - .slice(3) - .map(line => indentation + line) - .join('\n') + ',' - ); + return `${difference + .split('\n') + .slice(3) + .map(line => indentation + line) + .join('\n')},`; } } } // Display + only if received arg has no corresponding expected arg. - return ( + return `${ indentation + (i < expected.length - ? ' ' + (0, _jestMatcherUtils.printReceived)(arg) + ? ` ${(0, _jestMatcherUtils.printReceived)(arg)}` : (0, _jestMatcherUtils.RECEIVED_COLOR)( - '+ ' + (0, _jestMatcherUtils.stringify)(arg) - )) + - ',' - ); + `+ ${(0, _jestMatcherUtils.stringify)(arg)}` + )) + },`; }) .join('\n'); @@ -319,19 +316,21 @@ const printReceivedResults = ( } if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) { - return label + printResult(indexedResults[0][1], expected) + '\n'; + return `${label + printResult(indexedResults[0][1], expected)}\n`; } const printAligned = getRightAlignedPrinter(label); return ( + // eslint-disable-next-line prefer-template label.replace(':', '').trim() + '\n' + indexedResults.reduce( (printed, [i, result]) => - printed + - printAligned(String(i + 1), i === iExpectedCall) + - printResult(result, expected) + - '\n', + `${ + printed + + printAligned(String(i + 1), i === iExpectedCall) + + printResult(result, expected) + }\n`, '' ) ); @@ -357,6 +356,7 @@ const createToBeCalledMatcher = matcherName => const pass = count > 0; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -380,6 +380,7 @@ const createToBeCalledMatcher = matcherName => }, []) .join('\n') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -417,6 +418,7 @@ const createToReturnMatcher = matcherName => const pass = count > 0; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -448,6 +450,7 @@ const createToReturnMatcher = matcherName => _jestMatcherUtils.printReceived)(received.mock.calls.length)}` : '') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -490,6 +493,7 @@ const createToBeCalledTimesMatcher = matcherName => const pass = count === expected; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -501,6 +505,7 @@ const createToBeCalledTimesMatcher = matcherName => expected )}` : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -542,6 +547,7 @@ const createToReturnTimesMatcher = matcherName => const pass = count === expected; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -556,6 +562,7 @@ const createToReturnTimesMatcher = matcherName => _jestMatcherUtils.printReceived)(received.mock.calls.length)}` : '') : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -608,6 +615,7 @@ const createToBeCalledWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -641,6 +649,7 @@ const createToBeCalledWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -691,6 +700,7 @@ const createToReturnWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -726,6 +736,7 @@ const createToReturnWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -775,6 +786,7 @@ const createLastCalledWithMatcher = matcherName => indexedCalls.push([iLast, calls[iLast]]); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -820,6 +832,7 @@ const createLastCalledWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -868,6 +881,7 @@ const createLastReturnedMatcher = matcherName => indexedResults.push([iLast, results[iLast]]); return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -915,6 +929,7 @@ const createLastReturnedMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -994,6 +1009,7 @@ const createNthCalledWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -1071,6 +1087,7 @@ const createNthCalledWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -1149,6 +1166,7 @@ const createNthReturnedWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, @@ -1228,6 +1246,7 @@ const createNthReturnedWithMatcher = matcherName => } return ( + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, receivedName, diff --git a/node_modules/expect/build/toThrowMatchers.d.ts b/node_modules/expect/build/toThrowMatchers.d.ts deleted file mode 100644 index d4967c023..000000000 --- a/node_modules/expect/build/toThrowMatchers.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { MatchersObject, RawMatcherFn } from './types'; -export declare const createMatcher: (matcherName: string, fromPromise?: boolean | undefined) => RawMatcherFn; -declare const matchers: MatchersObject; -export default matchers; diff --git a/node_modules/expect/build/toThrowMatchers.js b/node_modules/expect/build/toThrowMatchers.js index f34f2363d..28a4e840c 100644 --- a/node_modules/expect/build/toThrowMatchers.js +++ b/node_modules/expect/build/toThrowMatchers.js @@ -5,14 +5,14 @@ Object.defineProperty(exports, '__esModule', { }); exports.default = exports.createMatcher = void 0; +var _expectUtils = require('@jest/expect-utils'); + var _jestMatcherUtils = require('jest-matcher-utils'); var _jestMessageUtil = require('jest-message-util'); var _print = require('./print'); -var _utils = require('./utils'); - /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * @@ -53,7 +53,7 @@ const createMatcher = (matcherName, fromPromise) => }; let thrown = null; - if (fromPromise && (0, _utils.isError)(received)) { + if (fromPromise && (0, _expectUtils.isError)(received)) { thrown = getThrown(received); } else { if (typeof received !== 'function') { @@ -134,6 +134,7 @@ const toThrowExpectedRegExp = (matcherName, options, thrown, expected) => { const pass = thrown !== null && expected.test(thrown.message); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -151,6 +152,7 @@ const toThrowExpectedRegExp = (matcherName, options, thrown, expected) => { ) + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value')) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -160,7 +162,7 @@ const toThrowExpectedRegExp = (matcherName, options, thrown, expected) => { '\n\n' + formatExpected('Expected pattern: ', expected) + (thrown === null - ? '\n' + DID_NOT_THROW + ? `\n${DID_NOT_THROW}` : thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) @@ -175,6 +177,7 @@ const toThrowExpectedAsymmetric = (matcherName, options, thrown, expected) => { const pass = thrown !== null && expected.asymmetricMatch(thrown.value); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -190,6 +193,7 @@ const toThrowExpectedAsymmetric = (matcherName, options, thrown, expected) => { formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value')) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -216,6 +220,7 @@ const toThrowExpectedObject = (matcherName, options, thrown, expected) => { const pass = thrown !== null && thrown.message === expected.message; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -228,6 +233,7 @@ const toThrowExpectedObject = (matcherName, options, thrown, expected) => { ? formatStack(thrown) : formatReceived('Received value: ', thrown, 'value')) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -235,11 +241,11 @@ const toThrowExpectedObject = (matcherName, options, thrown, expected) => { options ) + '\n\n' + - (thrown === null + (thrown === null // eslint-disable-next-line prefer-template ? formatExpected('Expected message: ', expected.message) + '\n' + DID_NOT_THROW - : thrown.hasMessage + : thrown.hasMessage // eslint-disable-next-line prefer-template ? (0, _jestMatcherUtils.printDiffOrStringify)( expected.message, thrown.message, @@ -261,6 +267,7 @@ const toThrowExpectedClass = (matcherName, options, thrown, expected) => { const pass = thrown !== null && thrown.value instanceof expected; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -288,6 +295,7 @@ const toThrowExpectedClass = (matcherName, options, thrown, expected) => { formatStack(thrown) : formatReceived('Received value: ', thrown, 'value')) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -300,19 +308,21 @@ const toThrowExpectedClass = (matcherName, options, thrown, expected) => { expected ) + (thrown === null - ? '\n' + DID_NOT_THROW - : (thrown.value != null && - typeof thrown.value.constructor === 'function' - ? (0, _print.printReceivedConstructorName)( - 'Received constructor', - thrown.value.constructor - ) - : '') + - '\n' + - (thrown.hasMessage - ? formatReceived('Received message: ', thrown, 'message') + - formatStack(thrown) - : formatReceived('Received value: ', thrown, 'value'))); + ? `\n${DID_NOT_THROW}` + : `${ + thrown.value != null && + typeof thrown.value.constructor === 'function' + ? (0, _print.printReceivedConstructorName)( + 'Received constructor', + thrown.value.constructor + ) + : '' + }\n${ + thrown.hasMessage + ? formatReceived('Received message: ', thrown, 'message') + + formatStack(thrown) + : formatReceived('Received value: ', thrown, 'value') + }`); return { message, pass @@ -323,6 +333,7 @@ const toThrowExpectedString = (matcherName, options, thrown, expected) => { const pass = thrown !== null && thrown.message.includes(expected); const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -340,6 +351,7 @@ const toThrowExpectedString = (matcherName, options, thrown, expected) => { ) + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value')) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -349,7 +361,7 @@ const toThrowExpectedString = (matcherName, options, thrown, expected) => { '\n\n' + formatExpected('Expected substring: ', expected) + (thrown === null - ? '\n' + DID_NOT_THROW + ? `\n${DID_NOT_THROW}` : thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) @@ -364,6 +376,7 @@ const toThrow = (matcherName, options, thrown) => { const pass = thrown !== null; const message = pass ? () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -377,6 +390,7 @@ const toThrow = (matcherName, options, thrown) => { formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value')) : () => + // eslint-disable-next-line prefer-template (0, _jestMatcherUtils.matcherHint)( matcherName, undefined, @@ -392,7 +406,7 @@ const toThrow = (matcherName, options, thrown) => { }; const formatExpected = (label, expected) => - label + (0, _jestMatcherUtils.printExpected)(expected) + '\n'; + `${label + (0, _jestMatcherUtils.printExpected)(expected)}\n`; const formatReceived = (label, thrown, key, expected) => { if (thrown === null) { @@ -406,40 +420,38 @@ const formatReceived = (label, thrown, key, expected) => { const index = message.indexOf(expected); if (index !== -1) { - return ( + return `${ label + (0, _print.printReceivedStringContainExpectedSubstring)( message, index, expected.length - ) + - '\n' - ); + ) + }\n`; } } else if (expected instanceof RegExp) { - return ( + return `${ label + (0, _print.printReceivedStringContainExpectedResult)( message, typeof expected.exec === 'function' ? expected.exec(message) : null - ) + - '\n' - ); + ) + }\n`; } - return label + (0, _jestMatcherUtils.printReceived)(message) + '\n'; + return `${label + (0, _jestMatcherUtils.printReceived)(message)}\n`; } if (key === 'name') { return thrown.isError - ? label + (0, _jestMatcherUtils.printReceived)(thrown.value.name) + '\n' + ? `${label + (0, _jestMatcherUtils.printReceived)(thrown.value.name)}\n` : ''; } if (key === 'value') { return thrown.isError ? '' - : label + (0, _jestMatcherUtils.printReceived)(thrown.value) + '\n'; + : `${label + (0, _jestMatcherUtils.printReceived)(thrown.value)}\n`; } return ''; diff --git a/node_modules/expect/build/types.d.ts b/node_modules/expect/build/types.d.ts deleted file mode 100644 index 1cd76310a..000000000 --- a/node_modules/expect/build/types.d.ts +++ /dev/null @@ -1,327 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { Config } from '@jest/types'; -import type * as jestMatcherUtils from 'jest-matcher-utils'; -import { INTERNAL_MATCHER_FLAG } from './jestMatchersObject'; -export declare type SyncExpectationResult = { - pass: boolean; - message: () => string; -}; -export declare type AsyncExpectationResult = Promise; -export declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult; -export declare type RawMatcherFn = { - (this: T, received: any, expected: any, options?: any): ExpectationResult; - [INTERNAL_MATCHER_FLAG]?: boolean; -}; -export declare type ThrowingMatcherFn = (actual: any) => void; -export declare type PromiseMatcherFn = (actual: any) => Promise; -export declare type Tester = (a: any, b: any) => boolean | undefined; -export declare type MatcherState = { - assertionCalls: number; - currentTestName?: string; - dontThrow?: () => void; - error?: Error; - equals: (a: unknown, b: unknown, customTesters?: Array, strictCheck?: boolean) => boolean; - expand?: boolean; - expectedAssertionsNumber?: number | null; - expectedAssertionsNumberError?: Error; - isExpectingAssertions?: boolean; - isExpectingAssertionsError?: Error; - isNot: boolean; - promise: string; - suppressedErrors: Array; - testPath?: Config.Path; - utils: typeof jestMatcherUtils & { - iterableEquality: Tester; - subsetEquality: Tester; - }; -}; -export interface AsymmetricMatcher { - asymmetricMatch(other: unknown): boolean; - toString(): string; - getExpectedType?(): string; - toAsymmetricMatcher?(): string; -} -export declare type MatchersObject = { - [id: string]: RawMatcherFn; -}; -export declare type ExpectedAssertionsErrors = Array<{ - actual: string | number; - error: Error; - expected: string; -}>; -interface AsymmetricMatchers { - any(sample: unknown): AsymmetricMatcher; - anything(): AsymmetricMatcher; - arrayContaining(sample: Array): AsymmetricMatcher; - closeTo(sample: number, precision?: number): AsymmetricMatcher; - objectContaining(sample: Record): AsymmetricMatcher; - stringContaining(sample: string): AsymmetricMatcher; - stringMatching(sample: string | RegExp): AsymmetricMatcher; -} -export declare type Expect = { - (actual: T): Matchers; - addSnapshotSerializer(serializer: unknown): void; - assertions(numberOfAssertions: number): void; - extend(matchers: MatchersObject): void; - extractExpectedAssertionsErrors: () => ExpectedAssertionsErrors; - getState(): State; - hasAssertions(): void; - setState(state: Partial): void; -} & AsymmetricMatchers & { - not: Omit; -}; -export interface Matchers { - /** - * Ensures the last call to a mock function was provided specific args. - */ - lastCalledWith(...expected: [unknown, ...Array]): R; - /** - * Ensure that the last call to a mock function has returned a specified value. - */ - lastReturnedWith(expected: unknown): R; - /** - * If you know how to test something, `.not` lets you test its opposite. - */ - not: Matchers; - /** - * Ensure that a mock function is called with specific arguments on an Nth call. - */ - nthCalledWith(nth: number, ...expected: [unknown, ...Array]): R; - /** - * Ensure that the nth call to a mock function has returned a specified value. - */ - nthReturnedWith(nth: number, expected: unknown): R; - /** - * Use resolves to unwrap the value of a fulfilled promise so any other - * matcher can be chained. If the promise is rejected the assertion fails. - */ - resolves: Matchers, T>; - /** - * Unwraps the reason of a rejected promise so any other matcher can be chained. - * If the promise is fulfilled the assertion fails. - */ - rejects: Matchers, T>; - /** - * Checks that a value is what you expect. It uses `===` to check strict equality. - * Don't use `toBe` with floating-point numbers. - */ - toBe(expected: unknown): R; - /** - * Ensures that a mock function is called. - */ - toBeCalled(): R; - /** - * Ensures that a mock function is called an exact number of times. - */ - toBeCalledTimes(expected: number): R; - /** - * Ensure that a mock function is called with specific arguments. - */ - toBeCalledWith(...expected: [unknown, ...Array]): R; - /** - * Using exact equality with floating point numbers is a bad idea. - * Rounding means that intuitive things fail. - * The default for `precision` is 2. - */ - toBeCloseTo(expected: number, precision?: number): R; - /** - * Ensure that a variable is not undefined. - */ - toBeDefined(): R; - /** - * When you don't care what a value is, you just want to - * ensure a value is false in a boolean context. - */ - toBeFalsy(): R; - /** - * For comparing floating point numbers. - */ - toBeGreaterThan(expected: number | bigint): R; - /** - * For comparing floating point numbers. - */ - toBeGreaterThanOrEqual(expected: number | bigint): R; - /** - * Ensure that an object is an instance of a class. - * This matcher uses `instanceof` underneath. - */ - toBeInstanceOf(expected: unknown): R; - /** - * For comparing floating point numbers. - */ - toBeLessThan(expected: number | bigint): R; - /** - * For comparing floating point numbers. - */ - toBeLessThanOrEqual(expected: number | bigint): R; - /** - * This is the same as `.toBe(null)` but the error messages are a bit nicer. - * So use `.toBeNull()` when you want to check that something is null. - */ - toBeNull(): R; - /** - * Use when you don't care what a value is, you just want to ensure a value - * is true in a boolean context. In JavaScript, there are six falsy values: - * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. - */ - toBeTruthy(): R; - /** - * Used to check that a variable is undefined. - */ - toBeUndefined(): R; - /** - * Used to check that a variable is NaN. - */ - toBeNaN(): R; - /** - * Used when you want to check that an item is in a list. - * For testing the items in the list, this uses `===`, a strict equality check. - */ - toContain(expected: unknown): R; - /** - * Used when you want to check that an item is in a list. - * For testing the items in the list, this matcher recursively checks the - * equality of all fields, rather than checking for object identity. - */ - toContainEqual(expected: unknown): R; - /** - * Used when you want to check that two objects have the same value. - * This matcher recursively checks the equality of all fields, rather than checking for object identity. - */ - toEqual(expected: unknown): R; - /** - * Ensures that a mock function is called. - */ - toHaveBeenCalled(): R; - /** - * Ensures that a mock function is called an exact number of times. - */ - toHaveBeenCalledTimes(expected: number): R; - /** - * Ensure that a mock function is called with specific arguments. - */ - toHaveBeenCalledWith(...expected: [unknown, ...Array]): R; - /** - * Ensure that a mock function is called with specific arguments on an Nth call. - */ - toHaveBeenNthCalledWith(nth: number, ...expected: [unknown, ...Array]): R; - /** - * If you have a mock function, you can use `.toHaveBeenLastCalledWith` - * to test what arguments it was last called with. - */ - toHaveBeenLastCalledWith(...expected: [unknown, ...Array]): R; - /** - * Use to test the specific value that a mock function last returned. - * If the last call to the mock function threw an error, then this matcher will fail - * no matter what value you provided as the expected return value. - */ - toHaveLastReturnedWith(expected: unknown): R; - /** - * Used to check that an object has a `.length` property - * and it is set to a certain numeric value. - */ - toHaveLength(expected: number): R; - /** - * Use to test the specific value that a mock function returned for the nth call. - * If the nth call to the mock function threw an error, then this matcher will fail - * no matter what value you provided as the expected return value. - */ - toHaveNthReturnedWith(nth: number, expected: unknown): R; - /** - * Use to check if property at provided reference keyPath exists for an object. - * For checking deeply nested properties in an object you may use dot notation or an array containing - * the keyPath for deep references. - * - * Optionally, you can provide a value to check if it's equal to the value present at keyPath - * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks - * the equality of all fields. - * - * @example - * - * expect(houseForSale).toHaveProperty('kitchen.area', 20); - */ - toHaveProperty(expectedPath: string | Array, expectedValue?: unknown): R; - /** - * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time - */ - toHaveReturned(): R; - /** - * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times. - * Any calls to the mock function that throw an error are not counted toward the number of times the function returned. - */ - toHaveReturnedTimes(expected: number): R; - /** - * Use to ensure that a mock function returned a specific value. - */ - toHaveReturnedWith(expected: unknown): R; - /** - * Check that a string matches a regular expression. - */ - toMatch(expected: string | RegExp): R; - /** - * Used to check that a JavaScript object matches a subset of the properties of an object - */ - toMatchObject(expected: Record | Array>): R; - /** - * Ensure that a mock function has returned (as opposed to thrown) at least once. - */ - toReturn(): R; - /** - * Ensure that a mock function has returned (as opposed to thrown) a specified number of times. - */ - toReturnTimes(expected: number): R; - /** - * Ensure that a mock function has returned a specified value at least once. - */ - toReturnWith(expected: unknown): R; - /** - * Use to test that objects have the same types as well as structure. - */ - toStrictEqual(expected: unknown): R; - /** - * Used to test that a function throws when it is called. - */ - toThrow(expected?: unknown): R; - /** - * If you want to test that a specific error is thrown inside a function. - */ - toThrowError(expected?: unknown): R; - /** - * This ensures that a value matches the most recent snapshot with property matchers. - * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information. - */ - toMatchSnapshot(hint?: string): R; - /** - * This ensures that a value matches the most recent snapshot. - * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information. - */ - toMatchSnapshot>(propertyMatchers: Partial, hint?: string): R; - /** - * This ensures that a value matches the most recent snapshot with property matchers. - * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically. - * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information. - */ - toMatchInlineSnapshot(snapshot?: string): R; - /** - * This ensures that a value matches the most recent snapshot with property matchers. - * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically. - * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information. - */ - toMatchInlineSnapshot>(propertyMatchers: Partial, snapshot?: string): R; - /** - * Used to test that a function throws a error matching the most recent snapshot when it is called. - */ - toThrowErrorMatchingSnapshot(hint?: string): R; - /** - * Used to test that a function throws a error matching the most recent snapshot when it is called. - * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically. - */ - toThrowErrorMatchingInlineSnapshot(snapshot?: string): R; -} -export {}; diff --git a/node_modules/expect/build/utils.d.ts b/node_modules/expect/build/utils.d.ts deleted file mode 100644 index e510748b3..000000000 --- a/node_modules/expect/build/utils.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -declare type GetPath = { - hasEndProp?: boolean; - lastTraversedObject: unknown; - traversedPath: Array; - value?: unknown; -}; -export declare const getPath: (object: Record, propertyPath: string | Array) => GetPath; -export declare const getObjectSubset: (object: any, subset: any, seenReferences?: WeakMap) => any; -export declare const iterableEquality: (a: any, b: any, aStack?: Array, bStack?: Array) => boolean | undefined; -export declare const subsetEquality: (object: unknown, subset: unknown) => boolean | undefined; -export declare const typeEquality: (a: any, b: any) => boolean | undefined; -export declare const arrayBufferEquality: (a: unknown, b: unknown) => boolean | undefined; -export declare const sparseArrayEquality: (a: unknown, b: unknown) => boolean | undefined; -export declare const partition: (items: T[], predicate: (arg: T) => boolean) => [T[], T[]]; -export declare const pathAsArray: (propertyPath: string) => Array; -export declare const isError: (value: unknown) => value is Error; -export declare function emptyObject(obj: unknown): boolean; -export declare const isOneline: (expected: unknown, received: unknown) => boolean; -export {}; diff --git a/node_modules/expect/build/utils.js b/node_modules/expect/build/utils.js deleted file mode 100644 index 66d3144f9..000000000 --- a/node_modules/expect/build/utils.js +++ /dev/null @@ -1,458 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.arrayBufferEquality = void 0; -exports.emptyObject = emptyObject; -exports.typeEquality = - exports.subsetEquality = - exports.sparseArrayEquality = - exports.pathAsArray = - exports.partition = - exports.iterableEquality = - exports.isOneline = - exports.isError = - exports.getPath = - exports.getObjectSubset = - void 0; - -var _jestGetType = require('jest-get-type'); - -var _jasmineUtils = require('./jasmineUtils'); - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -/** - * Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`. - */ -const hasPropertyInObject = (object, key) => { - const shouldTerminate = - !object || typeof object !== 'object' || object === Object.prototype; - - if (shouldTerminate) { - return false; - } - - return ( - Object.prototype.hasOwnProperty.call(object, key) || - hasPropertyInObject(Object.getPrototypeOf(object), key) - ); -}; - -const getPath = (object, propertyPath) => { - if (!Array.isArray(propertyPath)) { - propertyPath = pathAsArray(propertyPath); - } - - if (propertyPath.length) { - const lastProp = propertyPath.length === 1; - const prop = propertyPath[0]; - const newObject = object[prop]; - - if (!lastProp && (newObject === null || newObject === undefined)) { - // This is not the last prop in the chain. If we keep recursing it will - // hit a `can't access property X of undefined | null`. At this point we - // know that the chain has broken and we can return right away. - return { - hasEndProp: false, - lastTraversedObject: object, - traversedPath: [] - }; - } - - const result = getPath(newObject, propertyPath.slice(1)); - - if (result.lastTraversedObject === null) { - result.lastTraversedObject = object; - } - - result.traversedPath.unshift(prop); - - if (lastProp) { - // Does object have the property with an undefined value? - // Although primitive values support bracket notation (above) - // they would throw TypeError for in operator (below). - result.hasEndProp = - newObject !== undefined || - (!(0, _jestGetType.isPrimitive)(object) && prop in object); - - if (!result.hasEndProp) { - result.traversedPath.shift(); - } - } - - return result; - } - - return { - lastTraversedObject: null, - traversedPath: [], - value: object - }; -}; // Strip properties from object that are not present in the subset. Useful for -// printing the diff for toMatchObject() without adding unrelated noise. - -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - -exports.getPath = getPath; - -const getObjectSubset = (object, subset, seenReferences = new WeakMap()) => { - /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ - if (Array.isArray(object)) { - if (Array.isArray(subset) && subset.length === object.length) { - // The map method returns correct subclass of subset. - return subset.map((sub, i) => getObjectSubset(object[i], sub)); - } - } else if (object instanceof Date) { - return object; - } else if (isObject(object) && isObject(subset)) { - if ( - (0, _jasmineUtils.equals)(object, subset, [ - iterableEquality, - subsetEquality - ]) - ) { - // Avoid unnecessary copy which might return Object instead of subclass. - return subset; - } - - const trimmed = {}; - seenReferences.set(object, trimmed); - Object.keys(object) - .filter(key => hasPropertyInObject(subset, key)) - .forEach(key => { - trimmed[key] = seenReferences.has(object[key]) - ? seenReferences.get(object[key]) - : getObjectSubset(object[key], subset[key], seenReferences); - }); - - if (Object.keys(trimmed).length > 0) { - return trimmed; - } - } - - return object; -}; - -exports.getObjectSubset = getObjectSubset; -const IteratorSymbol = Symbol.iterator; - -const hasIterator = object => !!(object != null && object[IteratorSymbol]); -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - -const iterableEquality = ( - a, - b, - /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ - aStack = [], - bStack = [] -) => { - if ( - typeof a !== 'object' || - typeof b !== 'object' || - Array.isArray(a) || - Array.isArray(b) || - !hasIterator(a) || - !hasIterator(b) - ) { - return undefined; - } - - if (a.constructor !== b.constructor) { - return false; - } - - let length = aStack.length; - - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - // circular references at same depth are equal - // circular reference is not equal to non-circular one - if (aStack[length] === a) { - return bStack[length] === b; - } - } - - aStack.push(a); - bStack.push(b); - - const iterableEqualityWithStack = (a, b) => - iterableEquality(a, b, [...aStack], [...bStack]); - - if (a.size !== undefined) { - if (a.size !== b.size) { - return false; - } else if ( - (0, _jasmineUtils.isA)('Set', a) || - (0, _jasmineUtils.isImmutableUnorderedSet)(a) - ) { - let allFound = true; - - for (const aValue of a) { - if (!b.has(aValue)) { - let has = false; - - for (const bValue of b) { - const isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [ - iterableEqualityWithStack - ]); - - if (isEqual === true) { - has = true; - } - } - - if (has === false) { - allFound = false; - break; - } - } - } // Remove the first value from the stack of traversed values. - - aStack.pop(); - bStack.pop(); - return allFound; - } else if ( - (0, _jasmineUtils.isA)('Map', a) || - (0, _jasmineUtils.isImmutableUnorderedKeyed)(a) - ) { - let allFound = true; - - for (const aEntry of a) { - if ( - !b.has(aEntry[0]) || - !(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [ - iterableEqualityWithStack - ]) - ) { - let has = false; - - for (const bEntry of b) { - const matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], [ - iterableEqualityWithStack - ]); - let matchedValue = false; - - if (matchedKey === true) { - matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], [ - iterableEqualityWithStack - ]); - } - - if (matchedValue === true) { - has = true; - } - } - - if (has === false) { - allFound = false; - break; - } - } - } // Remove the first value from the stack of traversed values. - - aStack.pop(); - bStack.pop(); - return allFound; - } - } - - const bIterator = b[IteratorSymbol](); - - for (const aValue of a) { - const nextB = bIterator.next(); - - if ( - nextB.done || - !(0, _jasmineUtils.equals)(aValue, nextB.value, [ - iterableEqualityWithStack - ]) - ) { - return false; - } - } - - if (!bIterator.next().done) { - return false; - } // Remove the first value from the stack of traversed values. - - aStack.pop(); - bStack.pop(); - return true; -}; - -exports.iterableEquality = iterableEquality; - -const isObject = a => a !== null && typeof a === 'object'; - -const isObjectWithKeys = a => - isObject(a) && - !(a instanceof Error) && - !(a instanceof Array) && - !(a instanceof Date); - -const subsetEquality = (object, subset) => { - // subsetEquality needs to keep track of the references - // it has already visited to avoid infinite loops in case - // there are circular references in the subset passed to it. - const subsetEqualityWithContext = - (seenReferences = new WeakMap()) => - (object, subset) => { - if (!isObjectWithKeys(subset)) { - return undefined; - } - - return Object.keys(subset).every(key => { - if (isObjectWithKeys(subset[key])) { - if (seenReferences.has(subset[key])) { - return (0, _jasmineUtils.equals)(object[key], subset[key], [ - iterableEquality - ]); - } - - seenReferences.set(subset[key], true); - } - - const result = - object != null && - hasPropertyInObject(object, key) && - (0, _jasmineUtils.equals)(object[key], subset[key], [ - iterableEquality, - subsetEqualityWithContext(seenReferences) - ]); // The main goal of using seenReference is to avoid circular node on tree. - // It will only happen within a parent and its child, not a node and nodes next to it (same level) - // We should keep the reference for a parent and its child only - // Thus we should delete the reference immediately so that it doesn't interfere - // other nodes within the same level on tree. - - seenReferences.delete(subset[key]); - return result; - }); - }; - - return subsetEqualityWithContext()(object, subset); -}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - -exports.subsetEquality = subsetEquality; - -const typeEquality = (a, b) => { - if (a == null || b == null || a.constructor === b.constructor) { - return undefined; - } - - return false; -}; - -exports.typeEquality = typeEquality; - -const arrayBufferEquality = (a, b) => { - if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) { - return undefined; - } - - const dataViewA = new DataView(a); - const dataViewB = new DataView(b); // Buffers are not equal when they do not have the same byte length - - if (dataViewA.byteLength !== dataViewB.byteLength) { - return false; - } // Check if every byte value is equal to each other - - for (let i = 0; i < dataViewA.byteLength; i++) { - if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) { - return false; - } - } - - return true; -}; - -exports.arrayBufferEquality = arrayBufferEquality; - -const sparseArrayEquality = (a, b) => { - if (!Array.isArray(a) || !Array.isArray(b)) { - return undefined; - } // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"] - - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - return ( - (0, _jasmineUtils.equals)(a, b, [iterableEquality, typeEquality], true) && - (0, _jasmineUtils.equals)(aKeys, bKeys) - ); -}; - -exports.sparseArrayEquality = sparseArrayEquality; - -const partition = (items, predicate) => { - const result = [[], []]; - items.forEach(item => result[predicate(item) ? 0 : 1].push(item)); - return result; -}; - -exports.partition = partition; - -const pathAsArray = propertyPath => { - const properties = []; - - if (propertyPath === '') { - properties.push(''); - return properties; - } // will match everything that's not a dot or a bracket, and "" for consecutive dots. - - const pattern = RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g'); // Because the regex won't match a dot in the beginning of the path, if present. - - if (propertyPath[0] === '.') { - properties.push(''); - } - - propertyPath.replace(pattern, match => { - properties.push(match); - return match; - }); - return properties; -}; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693 - -exports.pathAsArray = pathAsArray; - -const isError = value => { - switch (Object.prototype.toString.call(value)) { - case '[object Error]': - case '[object Exception]': - case '[object DOMException]': - return true; - - default: - return value instanceof Error; - } -}; - -exports.isError = isError; - -function emptyObject(obj) { - return obj && typeof obj === 'object' ? !Object.keys(obj).length : false; -} - -const MULTILINE_REGEXP = /[\r\n]/; - -const isOneline = (expected, received) => - typeof expected === 'string' && - typeof received === 'string' && - (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received)); - -exports.isOneline = isOneline; diff --git a/node_modules/expect/node_modules/@jest/types/build/Circus.d.ts b/node_modules/expect/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/expect/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/expect/node_modules/@jest/types/build/Config.d.ts b/node_modules/expect/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/expect/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/expect/node_modules/@jest/types/build/Global.d.ts b/node_modules/expect/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/expect/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/expect/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/expect/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/expect/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/expect/node_modules/@jest/types/build/Transform.d.ts b/node_modules/expect/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/expect/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/expect/node_modules/@jest/types/build/index.d.ts b/node_modules/expect/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/expect/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/expect/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/expect/node_modules/@jest/types/package.json b/node_modules/expect/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/expect/node_modules/@jest/types/package.json +++ b/node_modules/expect/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/expect/node_modules/@types/yargs/README.md b/node_modules/expect/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/expect/node_modules/@types/yargs/README.md +++ b/node_modules/expect/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/expect/node_modules/@types/yargs/helpers.d.mts b/node_modules/expect/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/expect/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/expect/node_modules/@types/yargs/index.d.mts b/node_modules/expect/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/expect/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/expect/node_modules/@types/yargs/index.d.ts b/node_modules/expect/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/expect/node_modules/@types/yargs/index.d.ts +++ b/node_modules/expect/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/expect/node_modules/@types/yargs/package.json b/node_modules/expect/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/expect/node_modules/@types/yargs/package.json +++ b/node_modules/expect/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/expect/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/expect/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/expect/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/expect/node_modules/ansi-regex/index.d.ts b/node_modules/expect/node_modules/ansi-regex/index.d.ts new file mode 100644 index 000000000..2dbf6af2b --- /dev/null +++ b/node_modules/expect/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/node_modules/expect/node_modules/ansi-regex/index.js b/node_modules/expect/node_modules/ansi-regex/index.js new file mode 100644 index 000000000..616ff837d --- /dev/null +++ b/node_modules/expect/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/jest-circus/node_modules/escape-string-regexp/license b/node_modules/expect/node_modules/ansi-regex/license similarity index 100% rename from node_modules/jest-circus/node_modules/escape-string-regexp/license rename to node_modules/expect/node_modules/ansi-regex/license diff --git a/node_modules/expect/node_modules/ansi-regex/package.json b/node_modules/expect/node_modules/ansi-regex/package.json new file mode 100644 index 000000000..017f53116 --- /dev/null +++ b/node_modules/expect/node_modules/ansi-regex/package.json @@ -0,0 +1,55 @@ +{ + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/expect/node_modules/ansi-regex/readme.md b/node_modules/expect/node_modules/ansi-regex/readme.md new file mode 100644 index 000000000..4d848bc36 --- /dev/null +++ b/node_modules/expect/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
+Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/expect/node_modules/ansi-styles/index.d.ts b/node_modules/expect/node_modules/ansi-styles/index.d.ts new file mode 100644 index 000000000..e0170aa3d --- /dev/null +++ b/node_modules/expect/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,167 @@ +declare namespace ansiStyles { + interface CSPair { + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; + } + + interface ColorBase { + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + + ansi256(code: number): string; + + ansi16m(red: number, green: number, blue: number): string; + } + + interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Make text overline. + + Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. + */ + readonly overline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; + } + + interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; + } + + interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; + } + + interface ConvertColor { + /** + Convert from the RGB color space to the ANSI 256 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi256(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the RGB color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToRgb(hex: string): [red: number, green: number, blue: number]; + + /** + Convert from the RGB HEX color space to the ANSI 256 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi256(hex: string): number; + } +} + +declare const ansiStyles: { + readonly modifier: ansiStyles.Modifier; + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; + readonly codes: ReadonlyMap; +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier & ansiStyles.ConvertColor; + +export = ansiStyles; diff --git a/node_modules/expect/node_modules/ansi-styles/index.js b/node_modules/expect/node_modules/ansi-styles/index.js new file mode 100644 index 000000000..a9eac5895 --- /dev/null +++ b/node_modules/expect/node_modules/ansi-styles/index.js @@ -0,0 +1,164 @@ +'use strict'; + +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value: (red, green, blue) => { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false + }, + hexToRgb: { + value: hex => { + const matches = /(?[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let {colorString} = matches.groups; + + if (colorString.length === 3) { + colorString = colorString.split('').map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF + ]; + }, + enumerable: false + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false + } + }); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/node_modules/jest-message-util/node_modules/@babel/highlight/node_modules/chalk/license b/node_modules/expect/node_modules/ansi-styles/license similarity index 100% rename from node_modules/jest-message-util/node_modules/@babel/highlight/node_modules/chalk/license rename to node_modules/expect/node_modules/ansi-styles/license diff --git a/node_modules/expect/node_modules/ansi-styles/package.json b/node_modules/expect/node_modules/ansi-styles/package.json new file mode 100644 index 000000000..b3c89c907 --- /dev/null +++ b/node_modules/expect/node_modules/ansi-styles/package.json @@ -0,0 +1,52 @@ +{ + "name": "ansi-styles", + "version": "5.2.0", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "ava": "^2.4.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.14.0", + "xo": "^0.37.1" + } +} diff --git a/node_modules/expect/node_modules/ansi-styles/readme.md b/node_modules/expect/node_modules/ansi-styles/readme.md new file mode 100644 index 000000000..7d1246652 --- /dev/null +++ b/node_modules/expect/node_modules/ansi-styles/readme.md @@ -0,0 +1,144 @@ +# ansi-styles + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + +## Install + +``` +$ npm install ansi-styles +``` + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); + + +// Color conversion between 256/truecolor +// NOTE: When converting from truecolor to 256 colors, the original color +// may be degraded to fit the new color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(`${style.color.ansi256(style.rgbToAnsi256(199, 20, 250))}Hello World${style.color.close}`) +console.log(`${style.color.ansi16m(...style.hexToRgb('#abcdef'))}Hello World${style.color.close}`) +``` + +## API + +Each style has an `open` and `close` property. + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.* +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```js +console.log(style.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +console.log(style.codes.get(36)); +//=> 39 +``` + +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 256 and 16 million colors. + +The following color spaces from `color-convert` are supported: + +- `rgb` +- `hex` +- `ansi256` + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi256(style.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code +style.bgColor.ansi256(style.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code + +style.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code +style.bgColor.ansi16m(...style.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/expect/node_modules/ci-info/CHANGELOG.md b/node_modules/expect/node_modules/ci-info/CHANGELOG.md new file mode 100644 index 000000000..fc293eb97 --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/CHANGELOG.md @@ -0,0 +1,122 @@ +# Changelog + +## v3.3.0 + +- support Expo Application Services ([#70](https://github.com/watson/ci-info/pull/70)) + +## v3.2.0 + +- support LayerCI ([#68](https://github.com/watson/ci-info/pull/68)) +- support Appcircle ([#69](https://github.com/watson/ci-info/pull/69)) +- support Codefresh CI ([#65](https://github.com/watson/ci-info/pull/65)) +- Add support for nodejs v16 + +## v3.1.1 + +Bug Fixes: + +- remove duplicate declaration in typings + +## v3.1.0 + +Features: + +- add typings + +## v3.0.0 + +Features: + +- Add support nodejs versions: 14, 15 +- support Nevercode ([#30](https://github.com/watson/ci-info/pull/30)) +- support Render CI ([#36](https://github.com/watson/ci-info/pull/36)) +- support Now CI ([#37](https://github.com/watson/ci-info/pull/37)) +- support GitLab PR ([#59](https://github.com/watson/ci-info/pull/59)) +- support Screwdriver CD ([#60](https://github.com/watson/ci-info/pull/60)) +- support Visual Studio App Center ([#61](https://github.com/watson/ci-info/pull/61)) + +Bug Fixes: + +- update Netlify env constant ([#47](https://github.com/watson/ci-info/pull/47)) + +Breaking changes: + +- Drop support for Node.js end-of-life versions: 6, 13 +- replace `Zeit Now` with `Vercel` ([#55](https://github.com/watson/ci-info/pull/55)) + +## v2.0.0 + +Breaking changes: + +- Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7, + and 9 +- Team Foundation Server will now be detected as Azure Pipelines. The + constant `ci.TFS` no longer exists - use `ci.AZURE_PIPELINES` instead +- Remove deprecated `ci.TDDIUM` constant - use `ci.SOLANDO` instead + +New features: + +- feat: support Azure Pipelines ([#23](https://github.com/watson/ci-info/pull/23)) +- feat: support Netlify CI ([#26](https://github.com/watson/ci-info/pull/26)) +- feat: support Bitbucket pipelines PR detection ([#27](https://github.com/watson/ci-info/pull/27)) + +## v1.6.0 + +- feat: add Sail CI support +- feat: add Buddy support +- feat: add Bitrise support +- feat: detect Jenkins PRs +- feat: detect Drone PRs + +## v1.5.1 + +- fix: use full path to vendors.json + +## v1.5.0 + +- feat: add dsari detection ([#15](https://github.com/watson/ci-info/pull/15)) +- feat: add ci.isPR ([#16](https://github.com/watson/ci-info/pull/16)) + +## v1.4.0 + +- feat: add Cirrus CI detection ([#13](https://github.com/watson/ci-info/pull/13)) +- feat: add Shippable CI detection ([#14](https://github.com/watson/ci-info/pull/14)) + +## v1.3.1 + +- chore: reduce npm package size by not including `.github` folder content ([#11](https://github.com/watson/ci-info/pull/11)) + +## v1.3.0 + +- feat: add support for Strider CD +- chore: deprecate vendor constant `TDDIUM` in favor of `SOLANO` +- docs: add missing vendor constant to docs + +## v1.2.0 + +- feat: detect solano-ci ([#9](https://github.com/watson/ci-info/pull/9)) + +## v1.1.3 + +- fix: fix spelling of Hunson in `ci.name` + +## v1.1.2 + +- fix: no more false positive matches for Jenkins + +## v1.1.1 + +- docs: sort lists of CI servers in README.md +- docs: add missing AWS CodeBuild to the docs + +## v1.1.0 + +- feat: add AWS CodeBuild to CI detection ([#2](https://github.com/watson/ci-info/pull/2)) + +## v1.0.1 + +- chore: reduce npm package size by using an `.npmignore` file ([#3](https://github.com/watson/ci-info/pull/3)) + +## v1.0.0 + +- Initial release diff --git a/node_modules/expect/node_modules/ci-info/LICENSE b/node_modules/expect/node_modules/ci-info/LICENSE new file mode 100644 index 000000000..2cc7405a8 --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2021 Thomas Watson Steen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/ci-info/README.md b/node_modules/expect/node_modules/ci-info/README.md new file mode 100644 index 000000000..e7790b39b --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/README.md @@ -0,0 +1,118 @@ +# ci-info + +Get details about the current Continuous Integration environment. + +Please [open an +issue](https://github.com/watson/ci-info/issues/new?template=ci-server-not-detected.md) +if your CI server isn't properly detected :) + +[![npm](https://img.shields.io/npm/v/ci-info.svg)](https://www.npmjs.com/package/ci-info) +[![Tests](https://github.com/watson/ci-info/workflows/Tests/badge.svg)](https://github.com/watson/ci-info/actions) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) + +## Installation + +```bash +npm install ci-info --save +``` + +## Usage + +```js +var ci = require('ci-info') + +if (ci.isCI) { + console.log('The name of the CI server is:', ci.name) +} else { + console.log('This program is not running on a CI server') +} +``` + +## Supported CI tools + +Officially supported CI servers: + +| Name | Constant | isPR | +| ------------------------------------------------------------------------------- | -------------------- | ---- | +| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 | +| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ | +| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ | +| [Appcircle](https://appcircle.io/) | `ci.APPCIRCLE` | 🚫 | +| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 | +| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ | +| [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ | +| [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ | +| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ | +| [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ | +| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ | +| [Codefresh](https://codefresh.io/) | `ci.CODEFRESH` | ✅ | +| [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 | +| [Drone](https://drone.io) | `ci.DRONE` | ✅ | +| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 | +| [Expo Application Services](https://expo.dev/eas) | `ci.EAS_BUILD` | 🚫 | +| [GitHub Actions](https://github.com/features/actions/) | `ci.GITHUB_ACTIONS` | ✅ | +| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | ✅ | +| [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 | +| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 | +| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ | +| [LayerCI](https://layerci.com/) | `ci.LAYERCI` | ✅ | +| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 | +| [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ | +| [Nevercode](http://nevercode.io/) | `ci.NEVERCODE` | ✅ | +| [Render](https://render.com/) | `ci.RENDER` | ✅ | +| [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ | +| [Screwdriver](https://screwdriver.cd/) | `ci.SCREWDRIVER` | ✅ | +| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ | +| [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | ✅ | +| [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | ✅ | +| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 | +| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 | +| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 | +| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ | +| [Vercel](https://vercel.com/) | `ci.VERCEL` | 🚫 | +| [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 | + +## API + +### `ci.name` + +Returns a string containing name of the CI server the code is running on. +If CI server is not detected, it returns `null`. + +Don't depend on the value of this string not to change for a specific +vendor. If you find your self writing `ci.name === 'Travis CI'`, you +most likely want to use `ci.TRAVIS` instead. + +### `ci.isCI` + +Returns a boolean. Will be `true` if the code is running on a CI server, +otherwise `false`. + +Some CI servers not listed here might still trigger the `ci.isCI` +boolean to be set to `true` if they use certain vendor neutral +environment variables. In those cases `ci.name` will be `null` and no +vendor specific boolean will be set to `true`. + +### `ci.isPR` + +Returns a boolean if PR detection is supported for the current CI server. Will +be `true` if a PR is being tested, otherwise `false`. If PR detection is +not supported for the current CI server, the value will be `null`. + +### `ci.` + +A vendor specific boolean constant is exposed for each support CI +vendor. A constant will be `true` if the code is determined to run on +the given CI server, otherwise `false`. + +Examples of vendor constants are `ci.TRAVIS` or `ci.APPVEYOR`. For a +complete list, see the support table above. + +Deprecated vendor constants that will be removed in the next major +release: + +- `ci.TDDIUM` (Solano CI) This have been renamed `ci.SOLANO` + +## License + +[MIT](LICENSE) diff --git a/node_modules/expect/node_modules/ci-info/index.d.ts b/node_modules/expect/node_modules/ci-info/index.d.ts new file mode 100644 index 000000000..04f79c6d0 --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/index.d.ts @@ -0,0 +1,62 @@ +/** + * Returns a boolean. Will be `true` if the code is running on a CI server, + * otherwise `false`. + * + * Some CI servers not listed here might still trigger the `ci.isCI` + * boolean to be set to `true` if they use certain vendor neutral environment + * variables. In those cases `ci.name` will be `null` and no vendor specific + * boolean will be set to `true`. + */ +export const isCI: boolean; +/** + * Returns a boolean if PR detection is supported for the current CI server. + * Will be `true` if a PR is being tested, otherwise `false`. If PR detection is + * not supported for the current CI server, the value will be `null`. + */ +export const isPR: boolean | null; +/** + * Returns a string containing name of the CI server the code is running on. If + * CI server is not detected, it returns `null`. + * + * Don't depend on the value of this string not to change for a specific vendor. + * If you find your self writing `ci.name === 'Travis CI'`, you most likely want + * to use `ci.TRAVIS` instead. + */ +export const name: string | null; + +export const APPVEYOR: boolean; +export const AZURE_PIPELINES: boolean; +export const APPCIRCLE: boolean; +export const BAMBOO: boolean; +export const BITBUCKET: boolean; +export const BITRISE: boolean; +export const BUDDY: boolean; +export const BUILDKITE: boolean; +export const CIRCLE: boolean; +export const CIRRUS: boolean; +export const CODEBUILD: boolean; +export const CODEFRESH: boolean; +export const CODESHIP: boolean; +export const DRONE: boolean; +export const DSARI: boolean; +export const GITHUB_ACTIONS: boolean; +export const GITLAB: boolean; +export const GOCD: boolean; +export const HUDSON: boolean; +export const JENKINS: boolean; +export const LAYERCI: boolean; +export const MAGNUM: boolean; +export const NETLIFY: boolean; +export const NEVERCODE: boolean; +export const RENDER: boolean; +export const SAIL: boolean; +export const SEMAPHORE: boolean; +export const SCREWDRIVER: boolean; +export const SHIPPABLE: boolean; +export const SOLANO: boolean; +export const STRIDER: boolean; +export const TASKCLUSTER: boolean; +export const TEAMCITY: boolean; +export const TRAVIS: boolean; +export const VERCEL: boolean; +export const APPCENTER: boolean; diff --git a/node_modules/expect/node_modules/ci-info/index.js b/node_modules/expect/node_modules/ci-info/index.js new file mode 100644 index 000000000..b747a891a --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/index.js @@ -0,0 +1,66 @@ +'use strict' + +const vendors = require('./vendors.json') + +const env = process.env + +// Used for testing only +Object.defineProperty(exports, '_vendors', { + value: vendors.map(function (v) { return v.constant }) +}) + +exports.name = null +exports.isPR = null + +vendors.forEach(function (vendor) { + const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env] + const isCI = envs.every(function (obj) { + return checkEnv(obj) + }) + + exports[vendor.constant] = isCI + + if (isCI) { + exports.name = vendor.name + + switch (typeof vendor.pr) { + case 'string': + // "pr": "CIRRUS_PR" + exports.isPR = !!env[vendor.pr] + break + case 'object': + if ('env' in vendor.pr) { + // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" } + exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne + } else if ('any' in vendor.pr) { + // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] } + exports.isPR = vendor.pr.any.some(function (key) { + return !!env[key] + }) + } else { + // "pr": { "DRONE_BUILD_EVENT": "pull_request" } + exports.isPR = checkEnv(vendor.pr) + } + break + default: + // PR detection not supported for this vendor + exports.isPR = null + } + } +}) + +exports.isCI = !!( + env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari + env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI + env.BUILD_NUMBER || // Jenkins, TeamCity + env.RUN_ID || // TaskCluster, dsari + exports.name || + false +) + +function checkEnv (obj) { + if (typeof obj === 'string') return !!env[obj] + return Object.keys(obj).every(function (k) { + return env[k] === obj[k] + }) +} diff --git a/node_modules/expect/node_modules/ci-info/package.json b/node_modules/expect/node_modules/ci-info/package.json new file mode 100644 index 000000000..136015c8d --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/package.json @@ -0,0 +1,36 @@ +{ + "name": "ci-info", + "version": "3.3.0", + "description": "Get details about the current Continuous Integration environment", + "main": "index.js", + "typings": "index.d.ts", + "author": "Thomas Watson Steen (https://twitter.com/wa7son)", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/watson/ci-info.git" + }, + "bugs": { + "url": "https://github.com/watson/ci-info/issues" + }, + "homepage": "https://github.com/watson/ci-info", + "keywords": [ + "ci", + "continuous", + "integration", + "test", + "detect" + ], + "coordinates": [ + 55.778231, + 12.593179 + ], + "scripts": { + "test": "standard && node test.js" + }, + "devDependencies": { + "clear-module": "^4.1.2", + "standard": "^16.0.4", + "tape": "^5.3.2" + } +} diff --git a/node_modules/expect/node_modules/ci-info/vendors.json b/node_modules/expect/node_modules/ci-info/vendors.json new file mode 100644 index 000000000..1c9e2ee49 --- /dev/null +++ b/node_modules/expect/node_modules/ci-info/vendors.json @@ -0,0 +1,210 @@ +[ + { + "name": "AppVeyor", + "constant": "APPVEYOR", + "env": "APPVEYOR", + "pr": "APPVEYOR_PULL_REQUEST_NUMBER" + }, + { + "name": "Azure Pipelines", + "constant": "AZURE_PIPELINES", + "env": "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", + "pr": "SYSTEM_PULLREQUEST_PULLREQUESTID" + }, + { + "name": "Appcircle", + "constant": "APPCIRCLE", + "env": "AC_APPCIRCLE" + }, + { + "name": "Bamboo", + "constant": "BAMBOO", + "env": "bamboo_planKey" + }, + { + "name": "Bitbucket Pipelines", + "constant": "BITBUCKET", + "env": "BITBUCKET_COMMIT", + "pr": "BITBUCKET_PR_ID" + }, + { + "name": "Bitrise", + "constant": "BITRISE", + "env": "BITRISE_IO", + "pr": "BITRISE_PULL_REQUEST" + }, + { + "name": "Buddy", + "constant": "BUDDY", + "env": "BUDDY_WORKSPACE_ID", + "pr": "BUDDY_EXECUTION_PULL_REQUEST_ID" + }, + { + "name": "Buildkite", + "constant": "BUILDKITE", + "env": "BUILDKITE", + "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" } + }, + { + "name": "CircleCI", + "constant": "CIRCLE", + "env": "CIRCLECI", + "pr": "CIRCLE_PULL_REQUEST" + }, + { + "name": "Cirrus CI", + "constant": "CIRRUS", + "env": "CIRRUS_CI", + "pr": "CIRRUS_PR" + }, + { + "name": "AWS CodeBuild", + "constant": "CODEBUILD", + "env": "CODEBUILD_BUILD_ARN" + }, + { + "name": "Codefresh", + "constant": "CODEFRESH", + "env": "CF_BUILD_ID", + "pr": { "any": ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] } + }, + { + "name": "Codeship", + "constant": "CODESHIP", + "env": { "CI_NAME": "codeship" } + }, + { + "name": "Drone", + "constant": "DRONE", + "env": "DRONE", + "pr": { "DRONE_BUILD_EVENT": "pull_request" } + }, + { + "name": "dsari", + "constant": "DSARI", + "env": "DSARI" + }, + { + "name": "Expo Application Services", + "constant": "EAS", + "env": "EAS_BUILD" + }, + { + "name": "GitHub Actions", + "constant": "GITHUB_ACTIONS", + "env": "GITHUB_ACTIONS", + "pr": { "GITHUB_EVENT_NAME": "pull_request" } + }, + { + "name": "GitLab CI", + "constant": "GITLAB", + "env": "GITLAB_CI", + "pr": "CI_MERGE_REQUEST_ID" + }, + { + "name": "GoCD", + "constant": "GOCD", + "env": "GO_PIPELINE_LABEL" + }, + { + "name": "LayerCI", + "constant": "LAYERCI", + "env": "LAYERCI", + "pr": "LAYERCI_PULL_REQUEST" + }, + { + "name": "Hudson", + "constant": "HUDSON", + "env": "HUDSON_URL" + }, + { + "name": "Jenkins", + "constant": "JENKINS", + "env": ["JENKINS_URL", "BUILD_ID"], + "pr": { "any": ["ghprbPullId", "CHANGE_ID"] } + }, + { + "name": "Magnum CI", + "constant": "MAGNUM", + "env": "MAGNUM" + }, + { + "name": "Netlify CI", + "constant": "NETLIFY", + "env": "NETLIFY", + "pr": { "env": "PULL_REQUEST", "ne": "false" } + }, + { + "name": "Nevercode", + "constant": "NEVERCODE", + "env": "NEVERCODE", + "pr": { "env": "NEVERCODE_PULL_REQUEST", "ne": "false" } + }, + { + "name": "Render", + "constant": "RENDER", + "env": "RENDER", + "pr": { "IS_PULL_REQUEST": "true" } + }, + { + "name": "Sail CI", + "constant": "SAIL", + "env": "SAILCI", + "pr": "SAIL_PULL_REQUEST_NUMBER" + }, + { + "name": "Semaphore", + "constant": "SEMAPHORE", + "env": "SEMAPHORE", + "pr": "PULL_REQUEST_NUMBER" + }, + { + "name": "Screwdriver", + "constant": "SCREWDRIVER", + "env": "SCREWDRIVER", + "pr": { "env": "SD_PULL_REQUEST", "ne": "false" } + }, + { + "name": "Shippable", + "constant": "SHIPPABLE", + "env": "SHIPPABLE", + "pr": { "IS_PULL_REQUEST": "true" } + }, + { + "name": "Solano CI", + "constant": "SOLANO", + "env": "TDDIUM", + "pr": "TDDIUM_PR_ID" + }, + { + "name": "Strider CD", + "constant": "STRIDER", + "env": "STRIDER" + }, + { + "name": "TaskCluster", + "constant": "TASKCLUSTER", + "env": ["TASK_ID", "RUN_ID"] + }, + { + "name": "TeamCity", + "constant": "TEAMCITY", + "env": "TEAMCITY_VERSION" + }, + { + "name": "Travis CI", + "constant": "TRAVIS", + "env": "TRAVIS", + "pr": { "env": "TRAVIS_PULL_REQUEST", "ne": "false" } + }, + { + "name": "Vercel", + "constant": "VERCEL", + "env": "NOW_BUILDER" + }, + { + "name": "Visual Studio App Center", + "constant": "APPCENTER", + "env": "APPCENTER_BUILD_ID" + } +] diff --git a/node_modules/expect/node_modules/diff-sequences/LICENSE b/node_modules/expect/node_modules/diff-sequences/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/expect/node_modules/diff-sequences/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/diff-sequences/README.md b/node_modules/expect/node_modules/diff-sequences/README.md new file mode 100644 index 000000000..fd5b99bea --- /dev/null +++ b/node_modules/expect/node_modules/diff-sequences/README.md @@ -0,0 +1,404 @@ +# diff-sequences + +Compare items in two sequences to find a **longest common subsequence**. + +The items not in common are the items to delete or insert in a **shortest edit script**. + +To maximize flexibility and minimize memory, you write **callback** functions as configuration: + +**Input** function `isCommon(aIndex, bIndex)` compares items at indexes in the sequences and returns a truthy/falsey value. This package might call your function more than once for some pairs of indexes. + +- Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion. +- Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data. + +**Output** function `foundSubsequence(nCommon, aCommon, bCommon)` receives the number of adjacent items and starting indexes of each common subsequence. If sequences do not have common items, then this package does not call your function. + +If N is the sum of lengths of sequences and L is length of a longest common subsequence, then D = N – 2L is the number of **differences** in the corresponding shortest edit script. + +[_An O(ND) Difference Algorithm and Its Variations_](http://xmailserver.org/diff2.pdf) by Eugene W. Myers is fast when sequences have **few** differences. + +This package implements the **linear space** variation with optimizations so it is fast even when sequences have **many** differences. + +## Usage + +To add this package as a dependency of a project, do either of the following: + +- `npm install diff-sequences` +- `yarn add diff-sequences` + +To use `diff` as the name of the default export from this package, do either of the following: + +- `var diff = require('diff-sequences').default; // CommonJS modules` +- `import diff from 'diff-sequences'; // ECMAScript modules` + +Call `diff` with the **lengths** of sequences and your **callback** functions: + +```js +const a = ['a', 'b', 'c', 'a', 'b', 'b', 'a']; +const b = ['c', 'b', 'a', 'b', 'a', 'c']; + +function isCommon(aIndex, bIndex) { + return a[aIndex] === b[bIndex]; +} +function foundSubsequence(nCommon, aCommon, bCommon) { + // see examples +} + +diff(a.length, b.length, isCommon, foundSubsequence); +``` + +## Example of longest common subsequence + +Some sequences (for example, `a` and `b` in the example of usage) have more than one longest common subsequence. + +This package finds the following common items: + +| comparisons of common items | values | output arguments | +| :------------------------------- | :--------- | --------------------------: | +| `a[2] === b[0]` | `'c'` | `foundSubsequence(1, 2, 0)` | +| `a[4] === b[1]` | `'b'` | `foundSubsequence(1, 4, 1)` | +| `a[5] === b[3] && a[6] === b[4]` | `'b', 'a'` | `foundSubsequence(2, 5, 3)` | + +The “edit graph” analogy in the Myers paper shows the following common items: + +| comparisons of common items | values | +| :------------------------------- | :--------- | +| `a[2] === b[0]` | `'c'` | +| `a[3] === b[2] && a[4] === b[3]` | `'a', 'b'` | +| `a[6] === b[4]` | `'a'` | + +Various packages which implement the Myers algorithm will **always agree** on the **length** of a longest common subsequence, but might **sometimes disagree** on which **items** are in it. + +## Example of callback functions to count common items + +```js +// Return length of longest common subsequence according to === operator. +function countCommonItems(a, b) { + let n = 0; + function isCommon(aIndex, bIndex) { + return a[aIndex] === b[bIndex]; + } + function foundSubsequence(nCommon) { + n += nCommon; + } + + diff(a.length, b.length, isCommon, foundSubsequence); + + return n; +} + +const commonLength = countCommonItems( + ['a', 'b', 'c', 'a', 'b', 'b', 'a'], + ['c', 'b', 'a', 'b', 'a', 'c'], +); +``` + +| category of items | expression | value | +| :----------------- | ------------------------: | ----: | +| in common | `commonLength` | `4` | +| to delete from `a` | `a.length - commonLength` | `3` | +| to insert from `b` | `b.length - commonLength` | `2` | + +If the length difference `b.length - a.length` is: + +- negative: its absolute value is the minimum number of items to **delete** from `a` +- positive: it is the minimum number of items to **insert** from `b` +- zero: there is an **equal** number of items to delete from `a` and insert from `b` +- non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b` + +In this example, `6 - 7` is: + +- negative: `1` is the minimum number of items to **delete** from `a` +- non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b` + +## Example of callback functions to find common items + +```js +// Return array of items in longest common subsequence according to Object.is method. +const findCommonItems = (a, b) => { + const array = []; + diff( + a.length, + b.length, + (aIndex, bIndex) => Object.is(a[aIndex], b[bIndex]), + (nCommon, aCommon) => { + for (; nCommon !== 0; nCommon -= 1, aCommon += 1) { + array.push(a[aCommon]); + } + }, + ); + return array; +}; + +const commonItems = findCommonItems( + ['a', 'b', 'c', 'a', 'b', 'b', 'a'], + ['c', 'b', 'a', 'b', 'a', 'c'], +); +``` + +| `i` | `commonItems[i]` | `aIndex` | +| --: | :--------------- | -------: | +| `0` | `'c'` | `2` | +| `1` | `'b'` | `4` | +| `2` | `'b'` | `5` | +| `3` | `'a'` | `6` | + +## Example of callback functions to diff index intervals + +Instead of slicing array-like objects, you can adjust indexes in your callback functions. + +```js +// Diff index intervals that are half open [start, end) like array slice method. +const diffIndexIntervals = (a, aStart, aEnd, b, bStart, bEnd) => { + // Validate: 0 <= aStart and aStart <= aEnd and aEnd <= a.length + // Validate: 0 <= bStart and bStart <= bEnd and bEnd <= b.length + + diff( + aEnd - aStart, + bEnd - bStart, + (aIndex, bIndex) => Object.is(a[aStart + aIndex], b[bStart + bIndex]), + (nCommon, aCommon, bCommon) => { + // aStart + aCommon, bStart + bCommon + }, + ); + + // After the last common subsequence, do any remaining work. +}; +``` + +## Example of callback functions to emulate diff command + +Linux or Unix has a `diff` command to compare files line by line. Its output is a **shortest edit script**: + +- **c**hange adjacent lines from the first file to lines from the second file +- **d**elete lines from the first file +- **a**ppend or insert lines from the second file + +```js +// Given zero-based half-open range [start, end) of array indexes, +// return one-based closed range [start + 1, end] as string. +const getRange = (start, end) => + start + 1 === end ? `${start + 1}` : `${start + 1},${end}`; + +// Given index intervals of lines to delete or insert, or both, or neither, +// push formatted diff lines onto array. +const pushDelIns = (aLines, aIndex, aEnd, bLines, bIndex, bEnd, array) => { + const deleteLines = aIndex !== aEnd; + const insertLines = bIndex !== bEnd; + const changeLines = deleteLines && insertLines; + if (changeLines) { + array.push(`${getRange(aIndex, aEnd)}c${getRange(bIndex, bEnd)}`); + } else if (deleteLines) { + array.push(`${getRange(aIndex, aEnd)}d${String(bIndex)}`); + } else if (insertLines) { + array.push(`${String(aIndex)}a${getRange(bIndex, bEnd)}`); + } else { + return; + } + + for (; aIndex !== aEnd; aIndex += 1) { + array.push(`< ${aLines[aIndex]}`); // delete is less than + } + + if (changeLines) { + array.push('---'); + } + + for (; bIndex !== bEnd; bIndex += 1) { + array.push(`> ${bLines[bIndex]}`); // insert is greater than + } +}; + +// Given content of two files, return emulated output of diff utility. +const findShortestEditScript = (a, b) => { + const aLines = a.split('\n'); + const bLines = b.split('\n'); + const aLength = aLines.length; + const bLength = bLines.length; + + const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex]; + + let aIndex = 0; + let bIndex = 0; + const array = []; + const foundSubsequence = (nCommon, aCommon, bCommon) => { + pushDelIns(aLines, aIndex, aCommon, bLines, bIndex, bCommon, array); + aIndex = aCommon + nCommon; // number of lines compared in a + bIndex = bCommon + nCommon; // number of lines compared in b + }; + + diff(aLength, bLength, isCommon, foundSubsequence); + + // After the last common subsequence, push remaining change lines. + pushDelIns(aLines, aIndex, aLength, bLines, bIndex, bLength, array); + + return array.length === 0 ? '' : `${array.join('\n')}\n`; +}; +``` + +## Example of callback functions to format diff lines + +Here is simplified code to format **changed and unchanged lines** in expected and received values after a test fails in Jest: + +```js +// Format diff with minus or plus for change lines and space for common lines. +const formatDiffLines = (a, b) => { + // Jest depends on pretty-format package to serialize objects as strings. + // Unindented for comparison to avoid distracting differences: + const aLinesUn = format(a, {indent: 0 /*, other options*/}).split('\n'); + const bLinesUn = format(b, {indent: 0 /*, other options*/}).split('\n'); + // Indented to display changed and unchanged lines: + const aLinesIn = format(a, {indent: 2 /*, other options*/}).split('\n'); + const bLinesIn = format(b, {indent: 2 /*, other options*/}).split('\n'); + + const aLength = aLinesIn.length; // Validate: aLinesUn.length === aLength + const bLength = bLinesIn.length; // Validate: bLinesUn.length === bLength + + const isCommon = (aIndex, bIndex) => aLinesUn[aIndex] === bLinesUn[bIndex]; + + // Only because the GitHub Flavored Markdown doc collapses adjacent spaces, + // this example code and the following table represent spaces as middle dots. + let aIndex = 0; + let bIndex = 0; + const array = []; + const foundSubsequence = (nCommon, aCommon, bCommon) => { + for (; aIndex !== aCommon; aIndex += 1) { + array.push(`-·${aLinesIn[aIndex]}`); // delete is minus + } + for (; bIndex !== bCommon; bIndex += 1) { + array.push(`+·${bLinesIn[bIndex]}`); // insert is plus + } + for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) { + // For common lines, received indentation seems more intuitive. + array.push(`··${bLinesIn[bIndex]}`); // common is space + } + }; + + diff(aLength, bLength, isCommon, foundSubsequence); + + // After the last common subsequence, push remaining change lines. + for (; aIndex !== aLength; aIndex += 1) { + array.push(`-·${aLinesIn[aIndex]}`); + } + for (; bIndex !== bLength; bIndex += 1) { + array.push(`+·${bLinesIn[bIndex]}`); + } + + return array; +}; + +const expected = { + searching: '', + sorting: { + ascending: true, + fieldKey: 'what', + }, +}; +const received = { + searching: '', + sorting: [ + { + descending: false, + fieldKey: 'what', + }, + ], +}; + +const diffLines = formatDiffLines(expected, received); +``` + +If N is the sum of lengths of sequences and L is length of a longest common subsequence, then N – L is length of an array of diff lines. In this example, N is 7 + 9, L is 5, and N – L is 11. + +| `i` | `diffLines[i]` | `aIndex` | `bIndex` | +| ---: | :--------------------------------- | -------: | -------: | +| `0` | `'··Object {'` | `0` | `0` | +| `1` | `'····"searching": "",'` | `1` | `1` | +| `2` | `'-···"sorting": Object {'` | `2` | | +| `3` | `'-·····"ascending": true,'` | `3` | | +| `4` | `'+·····"sorting": Array ['` | | `2` | +| `5` | `'+·······Object {'` | | `3` | +| `6` | `'+·········"descending": false,'` | | `4` | +| `7` | `'··········"fieldKey": "what",'` | `4` | `5` | +| `8` | `'········},'` | `5` | `6` | +| `9` | `'+·····],'` | | `7` | +| `10` | `'··}'` | `6` | `8` | + +## Example of callback functions to find diff items + +Here is simplified code to find changed and unchanged substrings **within adjacent changed lines** in expected and received values after a test fails in Jest: + +```js +// Return diff items for strings (compatible with diff-match-patch package). +const findDiffItems = (a, b) => { + const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex]; + + let aIndex = 0; + let bIndex = 0; + const array = []; + const foundSubsequence = (nCommon, aCommon, bCommon) => { + if (aIndex !== aCommon) { + array.push([-1, a.slice(aIndex, aCommon)]); // delete is -1 + } + if (bIndex !== bCommon) { + array.push([1, b.slice(bIndex, bCommon)]); // insert is 1 + } + + aIndex = aCommon + nCommon; // number of characters compared in a + bIndex = bCommon + nCommon; // number of characters compared in b + array.push([0, a.slice(aCommon, aIndex)]); // common is 0 + }; + + diff(a.length, b.length, isCommon, foundSubsequence); + + // After the last common subsequence, push remaining change items. + if (aIndex !== a.length) { + array.push([-1, a.slice(aIndex)]); + } + if (bIndex !== b.length) { + array.push([1, b.slice(bIndex)]); + } + + return array; +}; + +const expectedDeleted = ['"sorting": Object {', '"ascending": true,'].join( + '\n', +); +const receivedInserted = [ + '"sorting": Array [', + 'Object {', + '"descending": false,', +].join('\n'); + +const diffItems = findDiffItems(expectedDeleted, receivedInserted); +``` + +| `i` | `diffItems[i][0]` | `diffItems[i][1]` | +| --: | ----------------: | :---------------- | +| `0` | `0` | `'"sorting": '` | +| `1` | `1` | `'Array [\n'` | +| `2` | `0` | `'Object {\n"'` | +| `3` | `-1` | `'a'` | +| `4` | `1` | `'de'` | +| `5` | `0` | `'scending": '` | +| `6` | `-1` | `'tru'` | +| `7` | `1` | `'fals'` | +| `8` | `0` | `'e,'` | + +The length difference `b.length - a.length` is equal to the sum of `diffItems[i][0]` values times `diffItems[i][1]` lengths. In this example, the difference `48 - 38` is equal to the sum `10`. + +| category of diff item | `[0]` | `[1]` lengths | subtotal | +| :-------------------- | ----: | -----------------: | -------: | +| in common | `0` | `11 + 10 + 11 + 2` | `0` | +| to delete from `a` | `–1` | `1 + 3` | `-4` | +| to insert from `b` | `1` | `8 + 2 + 4` | `14` | + +Instead of formatting the changed substrings with escape codes for colors in the `foundSubsequence` function to save memory, this example spends memory to **gain flexibility** before formatting, so a separate heuristic algorithm might modify the generic array of diff items to show changes more clearly: + +| `i` | `diffItems[i][0]` | `diffItems[i][1]` | +| --: | ----------------: | :---------------- | +| `6` | `-1` | `'true'` | +| `7` | `1` | `'false'` | +| `8` | `0` | `','` | + +For expected and received strings of serialized data, the result of finding changed **lines**, and then finding changed **substrings** within adjacent changed lines (as in the preceding two examples) sometimes displays the changes in a more intuitive way than the result of finding changed substrings, and then splitting them into changed and unchanged lines. diff --git a/node_modules/expect/node_modules/diff-sequences/build/index.d.ts b/node_modules/expect/node_modules/diff-sequences/build/index.d.ts new file mode 100644 index 000000000..5598ec926 --- /dev/null +++ b/node_modules/expect/node_modules/diff-sequences/build/index.d.ts @@ -0,0 +1,38 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type Callbacks = { + foundSubsequence: FoundSubsequence; + isCommon: IsCommon; +}; + +declare function diffSequence( + aLength: number, + bLength: number, + isCommon: IsCommon, + foundSubsequence: FoundSubsequence, +): void; +export default diffSequence; + +declare type FoundSubsequence = ( + nCommon: number, // caller can assume: 0 < nCommon + aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength + bCommon: number, +) => void; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +declare type IsCommon = ( + aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength + bIndex: number, +) => boolean; + +export {}; diff --git a/node_modules/expect/node_modules/diff-sequences/build/index.js b/node_modules/expect/node_modules/diff-sequences/build/index.js new file mode 100644 index 000000000..7ac63396a --- /dev/null +++ b/node_modules/expect/node_modules/diff-sequences/build/index.js @@ -0,0 +1,816 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = diffSequence; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This diff-sequences package implements the linear space variation in +// An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers +// Relationship in notation between Myers paper and this package: +// A is a +// N is aLength, aEnd - aStart, and so on +// x is aIndex, aFirst, aLast, and so on +// B is b +// M is bLength, bEnd - bStart, and so on +// y is bIndex, bFirst, bLast, and so on +// Δ = N - M is negative of baDeltaLength = bLength - aLength +// D is d +// k is kF +// k + Δ is kF = kR - baDeltaLength +// V is aIndexesF or aIndexesR (see comment below about Indexes type) +// index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength) +// starting point in forward direction (0, 0) is (-1, -1) +// starting point in reverse direction (N + 1, M + 1) is (aLength, bLength) +// The “edit graph” for sequences a and b corresponds to items: +// in a on the horizontal axis +// in b on the vertical axis +// +// Given a-coordinate of a point in a diagonal, you can compute b-coordinate. +// +// Forward diagonals kF: +// zero diagonal intersects top left corner +// positive diagonals intersect top edge +// negative diagonals insersect left edge +// +// Reverse diagonals kR: +// zero diagonal intersects bottom right corner +// positive diagonals intersect right edge +// negative diagonals intersect bottom edge +// The graph contains a directed acyclic graph of edges: +// horizontal: delete an item from a +// vertical: insert an item from b +// diagonal: common item in a and b +// +// The algorithm solves dual problems in the graph analogy: +// Find longest common subsequence: path with maximum number of diagonal edges +// Find shortest edit script: path with minimum number of non-diagonal edges +// Input callback function compares items at indexes in the sequences. +// Output callback function receives the number of adjacent items +// and starting indexes of each common subsequence. +// Either original functions or wrapped to swap indexes if graph is transposed. +// Indexes in sequence a of last point of forward or reverse paths in graph. +// Myers algorithm indexes by diagonal k which for negative is bad deopt in V8. +// This package indexes by iF and iR which are greater than or equal to zero. +// and also updates the index arrays in place to cut memory in half. +// kF = 2 * iF - d +// kR = d - 2 * iR +// Division of index intervals in sequences a and b at the middle change. +// Invariant: intervals do not have common items at the start or end. +const pkg = 'diff-sequences'; // for error messages + +const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8 +// Return the number of common items that follow in forward direction. +// The length of what Myers paper calls a “snake” in a forward path. + +const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => { + let nCommon = 0; + + while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) { + aIndex += 1; + bIndex += 1; + nCommon += 1; + } + + return nCommon; +}; // Return the number of common items that precede in reverse direction. +// The length of what Myers paper calls a “snake” in a reverse path. + +const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => { + let nCommon = 0; + + while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) { + aIndex -= 1; + bIndex -= 1; + nCommon += 1; + } + + return nCommon; +}; // A simple function to extend forward paths from (d - 1) to d changes +// when forward and reverse paths cannot yet overlap. + +const extendPathsF = ( + d, + aEnd, + bEnd, + bF, + isCommon, + aIndexesF, + iMaxF // return the value because optimization might decrease it +) => { + // Unroll the first iteration. + let iF = 0; + let kF = -d; // kF = 2 * iF - d + + let aFirst = aIndexesF[iF]; // in first iteration always insert + + let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration + + aIndexesF[iF] += countCommonItemsF( + aFirst + 1, + aEnd, + bF + aFirst - kF + 1, + bEnd, + isCommon + ); // Optimization: skip diagonals in which paths cannot ever overlap. + + const nF = d < iMaxF ? d : iMaxF; // The diagonals kF are odd when d is odd and even when d is even. + + for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) { + // To get first point of path segment, move one change in forward direction + // from last point of previous path segment in an adjacent diagonal. + // In last possible iteration when iF === d and kF === d always delete. + if (iF !== d && aIndexPrev1 < aIndexesF[iF]) { + aFirst = aIndexesF[iF]; // vertical to insert from b + } else { + aFirst = aIndexPrev1 + 1; // horizontal to delete from a + + if (aEnd <= aFirst) { + // Optimization: delete moved past right of graph. + return iF - 1; + } + } // To get last point of path segment, move along diagonal of common items. + + aIndexPrev1 = aIndexesF[iF]; + aIndexesF[iF] = + aFirst + + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon); + } + + return iMaxF; +}; // A simple function to extend reverse paths from (d - 1) to d changes +// when reverse and forward paths cannot yet overlap. + +const extendPathsR = ( + d, + aStart, + bStart, + bR, + isCommon, + aIndexesR, + iMaxR // return the value because optimization might decrease it +) => { + // Unroll the first iteration. + let iR = 0; + let kR = d; // kR = d - 2 * iR + + let aFirst = aIndexesR[iR]; // in first iteration always insert + + let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration + + aIndexesR[iR] -= countCommonItemsR( + aStart, + aFirst - 1, + bStart, + bR + aFirst - kR - 1, + isCommon + ); // Optimization: skip diagonals in which paths cannot ever overlap. + + const nR = d < iMaxR ? d : iMaxR; // The diagonals kR are odd when d is odd and even when d is even. + + for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) { + // To get first point of path segment, move one change in reverse direction + // from last point of previous path segment in an adjacent diagonal. + // In last possible iteration when iR === d and kR === -d always delete. + if (iR !== d && aIndexesR[iR] < aIndexPrev1) { + aFirst = aIndexesR[iR]; // vertical to insert from b + } else { + aFirst = aIndexPrev1 - 1; // horizontal to delete from a + + if (aFirst < aStart) { + // Optimization: delete moved past left of graph. + return iR - 1; + } + } // To get last point of path segment, move along diagonal of common items. + + aIndexPrev1 = aIndexesR[iR]; + aIndexesR[iR] = + aFirst - + countCommonItemsR( + aStart, + aFirst - 1, + bStart, + bR + aFirst - kR - 1, + isCommon + ); + } + + return iMaxR; +}; // A complete function to extend forward paths from (d - 1) to d changes. +// Return true if a path overlaps reverse path of (d - 1) changes in its diagonal. + +const extendOverlappablePathsF = ( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division // update prop values if return true +) => { + const bF = bStart - aStart; // bIndex = bF + aIndex - kF + + const aLength = aEnd - aStart; + const bLength = bEnd - bStart; + const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength + // Range of diagonals in which forward and reverse paths might overlap. + + const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR + + const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1) + + let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration + // Optimization: skip diagonals in which paths cannot ever overlap. + + const nF = d < iMaxF ? d : iMaxF; // The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even. + + for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) { + // To get first point of path segment, move one change in forward direction + // from last point of previous path segment in an adjacent diagonal. + // In first iteration when iF === 0 and kF === -d always insert. + // In last possible iteration when iF === d and kF === d always delete. + const insert = iF === 0 || (iF !== d && aIndexPrev1 < aIndexesF[iF]); + const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1; + const aFirst = insert + ? aLastPrev // vertical to insert from b + : aLastPrev + 1; // horizontal to delete from a + // To get last point of path segment, move along diagonal of common items. + + const bFirst = bF + aFirst - kF; + const nCommonF = countCommonItemsF( + aFirst + 1, + aEnd, + bFirst + 1, + bEnd, + isCommon + ); + const aLast = aFirst + nCommonF; + aIndexPrev1 = aIndexesF[iF]; + aIndexesF[iF] = aLast; + + if (kMinOverlapF <= kF && kF <= kMaxOverlapF) { + // Solve for iR of reverse path with (d - 1) changes in diagonal kF: + // kR = kF + baDeltaLength + // kR = (d - 1) - 2 * iR + const iR = (d - 1 - (kF + baDeltaLength)) / 2; // If this forward path overlaps the reverse path in this diagonal, + // then this is the middle change of the index intervals. + + if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) { + // Unlike the Myers algorithm which finds only the middle “snake” + // this package can find two common subsequences per division. + // Last point of previous path segment is on an adjacent diagonal. + const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1); // Because of invariant that intervals preceding the middle change + // cannot have common items at the end, + // move in reverse direction along a diagonal of common items. + + const nCommonR = countCommonItemsR( + aStart, + aLastPrev, + bStart, + bLastPrev, + isCommon + ); + const aIndexPrevFirst = aLastPrev - nCommonR; + const bIndexPrevFirst = bLastPrev - nCommonR; + const aEndPreceding = aIndexPrevFirst + 1; + const bEndPreceding = bIndexPrevFirst + 1; + division.nChangePreceding = d - 1; + + if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) { + // Optimization: number of preceding changes in forward direction + // is equal to number of items in preceding interval, + // therefore it cannot contain any common items. + division.aEndPreceding = aStart; + division.bEndPreceding = bStart; + } else { + division.aEndPreceding = aEndPreceding; + division.bEndPreceding = bEndPreceding; + } + + division.nCommonPreceding = nCommonR; + + if (nCommonR !== 0) { + division.aCommonPreceding = aEndPreceding; + division.bCommonPreceding = bEndPreceding; + } + + division.nCommonFollowing = nCommonF; + + if (nCommonF !== 0) { + division.aCommonFollowing = aFirst + 1; + division.bCommonFollowing = bFirst + 1; + } + + const aStartFollowing = aLast + 1; + const bStartFollowing = bFirst + nCommonF + 1; + division.nChangeFollowing = d - 1; + + if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) { + // Optimization: number of changes in reverse direction + // is equal to number of items in following interval, + // therefore it cannot contain any common items. + division.aStartFollowing = aEnd; + division.bStartFollowing = bEnd; + } else { + division.aStartFollowing = aStartFollowing; + division.bStartFollowing = bStartFollowing; + } + + return true; + } + } + } + + return false; +}; // A complete function to extend reverse paths from (d - 1) to d changes. +// Return true if a path overlaps forward path of d changes in its diagonal. + +const extendOverlappablePathsR = ( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division // update prop values if return true +) => { + const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR + + const aLength = aEnd - aStart; + const bLength = bEnd - bStart; + const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength + // Range of diagonals in which forward and reverse paths might overlap. + + const kMinOverlapR = baDeltaLength - d; // -d <= kF + + const kMaxOverlapR = baDeltaLength + d; // kF <= d + + let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration + // Optimization: skip diagonals in which paths cannot ever overlap. + + const nR = d < iMaxR ? d : iMaxR; // The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even. + + for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) { + // To get first point of path segment, move one change in reverse direction + // from last point of previous path segment in an adjacent diagonal. + // In first iteration when iR === 0 and kR === d always insert. + // In last possible iteration when iR === d and kR === -d always delete. + const insert = iR === 0 || (iR !== d && aIndexesR[iR] < aIndexPrev1); + const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1; + const aFirst = insert + ? aLastPrev // vertical to insert from b + : aLastPrev - 1; // horizontal to delete from a + // To get last point of path segment, move along diagonal of common items. + + const bFirst = bR + aFirst - kR; + const nCommonR = countCommonItemsR( + aStart, + aFirst - 1, + bStart, + bFirst - 1, + isCommon + ); + const aLast = aFirst - nCommonR; + aIndexPrev1 = aIndexesR[iR]; + aIndexesR[iR] = aLast; + + if (kMinOverlapR <= kR && kR <= kMaxOverlapR) { + // Solve for iF of forward path with d changes in diagonal kR: + // kF = kR - baDeltaLength + // kF = 2 * iF - d + const iF = (d + (kR - baDeltaLength)) / 2; // If this reverse path overlaps the forward path in this diagonal, + // then this is a middle change of the index intervals. + + if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) { + const bLast = bFirst - nCommonR; + division.nChangePreceding = d; + + if (d === aLast + bLast - aStart - bStart) { + // Optimization: number of changes in reverse direction + // is equal to number of items in preceding interval, + // therefore it cannot contain any common items. + division.aEndPreceding = aStart; + division.bEndPreceding = bStart; + } else { + division.aEndPreceding = aLast; + division.bEndPreceding = bLast; + } + + division.nCommonPreceding = nCommonR; + + if (nCommonR !== 0) { + // The last point of reverse path segment is start of common subsequence. + division.aCommonPreceding = aLast; + division.bCommonPreceding = bLast; + } + + division.nChangeFollowing = d - 1; + + if (d === 1) { + // There is no previous path segment. + division.nCommonFollowing = 0; + division.aStartFollowing = aEnd; + division.bStartFollowing = bEnd; + } else { + // Unlike the Myers algorithm which finds only the middle “snake” + // this package can find two common subsequences per division. + // Last point of previous path segment is on an adjacent diagonal. + const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1); // Because of invariant that intervals following the middle change + // cannot have common items at the start, + // move in forward direction along a diagonal of common items. + + const nCommonF = countCommonItemsF( + aLastPrev, + aEnd, + bLastPrev, + bEnd, + isCommon + ); + division.nCommonFollowing = nCommonF; + + if (nCommonF !== 0) { + // The last point of reverse path segment is start of common subsequence. + division.aCommonFollowing = aLastPrev; + division.bCommonFollowing = bLastPrev; + } + + const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev + + const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev + + if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) { + // Optimization: number of changes in forward direction + // is equal to number of items in following interval, + // therefore it cannot contain any common items. + division.aStartFollowing = aEnd; + division.bStartFollowing = bEnd; + } else { + division.aStartFollowing = aStartFollowing; + division.bStartFollowing = bStartFollowing; + } + } + + return true; + } + } + } + + return false; +}; // Given index intervals and input function to compare items at indexes, +// divide at the middle change. +// +// DO NOT CALL if start === end, because interval cannot contain common items +// and because this function will throw the “no overlap” error. + +const divide = ( + nChange, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + aIndexesR, + division // output +) => { + const bF = bStart - aStart; // bIndex = bF + aIndex - kF + + const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR + + const aLength = aEnd - aStart; + const bLength = bEnd - bStart; // Because graph has square or portrait orientation, + // length difference is minimum number of items to insert from b. + // Corresponding forward and reverse diagonals in graph + // depend on length difference of the sequences: + // kF = kR - baDeltaLength + // kR = kF + baDeltaLength + + const baDeltaLength = bLength - aLength; // Optimization: max diagonal in graph intersects corner of shorter side. + + let iMaxF = aLength; + let iMaxR = aLength; // Initialize no changes yet in forward or reverse direction: + + aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start + + aIndexesR[0] = aEnd; // at open end of interval + + if (baDeltaLength % 2 === 0) { + // The number of changes in paths is 2 * d if length difference is even. + const dMin = (nChange || baDeltaLength) / 2; + const dMax = (aLength + bLength) / 2; + + for (let d = 1; d <= dMax; d += 1) { + iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); + + if (d < dMin) { + iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR); + } else if ( + // If a reverse path overlaps a forward path in the same diagonal, + // return a division of the index intervals at the middle change. + extendOverlappablePathsR( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division + ) + ) { + return; + } + } + } else { + // The number of changes in paths is 2 * d - 1 if length difference is odd. + const dMin = ((nChange || baDeltaLength) + 1) / 2; + const dMax = (aLength + bLength + 1) / 2; // Unroll first half iteration so loop extends the relevant pairs of paths. + // Because of invariant that intervals have no common items at start or end, + // and limitation not to call divide with empty intervals, + // therefore it cannot be called if a forward path with one change + // would overlap a reverse path with no changes, even if dMin === 1. + + let d = 1; + iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); + + for (d += 1; d <= dMax; d += 1) { + iMaxR = extendPathsR( + d - 1, + aStart, + bStart, + bR, + isCommon, + aIndexesR, + iMaxR + ); + + if (d < dMin) { + iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); + } else if ( + // If a forward path overlaps a reverse path in the same diagonal, + // return a division of the index intervals at the middle change. + extendOverlappablePathsF( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division + ) + ) { + return; + } + } + } + /* istanbul ignore next */ + + throw new Error( + `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}` + ); +}; // Given index intervals and input function to compare items at indexes, +// return by output function the number of adjacent items and starting indexes +// of each common subsequence. Divide and conquer with only linear space. +// +// The index intervals are half open [start, end) like array slice method. +// DO NOT CALL if start === end, because interval cannot contain common items +// and because divide function will throw the “no overlap” error. + +const findSubsequences = ( + nChange, + aStart, + aEnd, + bStart, + bEnd, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division // temporary memory, not input nor output +) => { + if (bEnd - bStart < aEnd - aStart) { + // Transpose graph so it has portrait instead of landscape orientation. + // Always compare shorter to longer sequence for consistency and optimization. + transposed = !transposed; + + if (transposed && callbacks.length === 1) { + // Lazily wrap callback functions to swap args if graph is transposed. + const {foundSubsequence, isCommon} = callbacks[0]; + callbacks[1] = { + foundSubsequence: (nCommon, bCommon, aCommon) => { + foundSubsequence(nCommon, aCommon, bCommon); + }, + isCommon: (bIndex, aIndex) => isCommon(aIndex, bIndex) + }; + } + + const tStart = aStart; + const tEnd = aEnd; + aStart = bStart; + aEnd = bEnd; + bStart = tStart; + bEnd = tEnd; + } + + const {foundSubsequence, isCommon} = callbacks[transposed ? 1 : 0]; // Divide the index intervals at the middle change. + + divide( + nChange, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + aIndexesR, + division + ); + const { + nChangePreceding, + aEndPreceding, + bEndPreceding, + nCommonPreceding, + aCommonPreceding, + bCommonPreceding, + nCommonFollowing, + aCommonFollowing, + bCommonFollowing, + nChangeFollowing, + aStartFollowing, + bStartFollowing + } = division; // Unless either index interval is empty, they might contain common items. + + if (aStart < aEndPreceding && bStart < bEndPreceding) { + // Recursely find and return common subsequences preceding the division. + findSubsequences( + nChangePreceding, + aStart, + aEndPreceding, + bStart, + bEndPreceding, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division + ); + } // Return common subsequences that are adjacent to the middle change. + + if (nCommonPreceding !== 0) { + foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding); + } + + if (nCommonFollowing !== 0) { + foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing); + } // Unless either index interval is empty, they might contain common items. + + if (aStartFollowing < aEnd && bStartFollowing < bEnd) { + // Recursely find and return common subsequences following the division. + findSubsequences( + nChangeFollowing, + aStartFollowing, + aEnd, + bStartFollowing, + bEnd, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division + ); + } +}; + +const validateLength = (name, arg) => { + if (typeof arg !== 'number') { + throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`); + } + + if (!Number.isSafeInteger(arg)) { + throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`); + } + + if (arg < 0) { + throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`); + } +}; + +const validateCallback = (name, arg) => { + const type = typeof arg; + + if (type !== 'function') { + throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`); + } +}; // Compare items in two sequences to find a longest common subsequence. +// Given lengths of sequences and input function to compare items at indexes, +// return by output function the number of adjacent items and starting indexes +// of each common subsequence. + +function diffSequence(aLength, bLength, isCommon, foundSubsequence) { + validateLength('aLength', aLength); + validateLength('bLength', bLength); + validateCallback('isCommon', isCommon); + validateCallback('foundSubsequence', foundSubsequence); // Count common items from the start in the forward direction. + + const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon); + + if (nCommonF !== 0) { + foundSubsequence(nCommonF, 0, 0); + } // Unless both sequences consist of common items only, + // find common items in the half-trimmed index intervals. + + if (aLength !== nCommonF || bLength !== nCommonF) { + // Invariant: intervals do not have common items at the start. + // The start of an index interval is closed like array slice method. + const aStart = nCommonF; + const bStart = nCommonF; // Count common items from the end in the reverse direction. + + const nCommonR = countCommonItemsR( + aStart, + aLength - 1, + bStart, + bLength - 1, + isCommon + ); // Invariant: intervals do not have common items at the end. + // The end of an index interval is open like array slice method. + + const aEnd = aLength - nCommonR; + const bEnd = bLength - nCommonR; // Unless one sequence consists of common items only, + // therefore the other trimmed index interval consists of changes only, + // find common items in the trimmed index intervals. + + const nCommonFR = nCommonF + nCommonR; + + if (aLength !== nCommonFR && bLength !== nCommonFR) { + const nChange = 0; // number of change items is not yet known + + const transposed = false; // call the original unwrapped functions + + const callbacks = [ + { + foundSubsequence, + isCommon + } + ]; // Indexes in sequence a of last points in furthest reaching paths + // from outside the start at top left in the forward direction: + + const aIndexesF = [NOT_YET_SET]; // from the end at bottom right in the reverse direction: + + const aIndexesR = [NOT_YET_SET]; // Initialize one object as output of all calls to divide function. + + const division = { + aCommonFollowing: NOT_YET_SET, + aCommonPreceding: NOT_YET_SET, + aEndPreceding: NOT_YET_SET, + aStartFollowing: NOT_YET_SET, + bCommonFollowing: NOT_YET_SET, + bCommonPreceding: NOT_YET_SET, + bEndPreceding: NOT_YET_SET, + bStartFollowing: NOT_YET_SET, + nChangeFollowing: NOT_YET_SET, + nChangePreceding: NOT_YET_SET, + nCommonFollowing: NOT_YET_SET, + nCommonPreceding: NOT_YET_SET + }; // Find and return common subsequences in the trimmed index intervals. + + findSubsequences( + nChange, + aStart, + aEnd, + bStart, + bEnd, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division + ); + } + + if (nCommonR !== 0) { + foundSubsequence(nCommonR, aEnd, bEnd); + } + } +} diff --git a/node_modules/expect/node_modules/diff-sequences/package.json b/node_modules/expect/node_modules/diff-sequences/package.json new file mode 100644 index 000000000..e4fdd9045 --- /dev/null +++ b/node_modules/expect/node_modules/diff-sequences/package.json @@ -0,0 +1,39 @@ +{ + "name": "diff-sequences", + "version": "28.0.0", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/diff-sequences" + }, + "license": "MIT", + "description": "Compare items in two sequences to find a longest common subsequence", + "keywords": [ + "fast", + "linear", + "space", + "callback", + "diff" + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "devDependencies": { + "benchmark": "^2.1.4", + "diff": "^5.0.0", + "fast-check": "^2.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" +} diff --git a/node_modules/expect/node_modules/jest-diff/LICENSE b/node_modules/expect/node_modules/jest-diff/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/jest-diff/README.md b/node_modules/expect/node_modules/jest-diff/README.md new file mode 100644 index 000000000..d52f82178 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/README.md @@ -0,0 +1,671 @@ +# jest-diff + +Display differences clearly so people can review changes confidently. + +The `diff` named export serializes JavaScript **values**, compares them line-by-line, and returns a string which includes comparison lines. + +Two named exports compare **strings** character-by-character: + +- `diffStringsUnified` returns a string. +- `diffStringsRaw` returns an array of `Diff` objects. + +Three named exports compare **arrays of strings** line-by-line: + +- `diffLinesUnified` and `diffLinesUnified2` return a string. +- `diffLinesRaw` returns an array of `Diff` objects. + +## Installation + +To add this package as a dependency of a project, run either of the following commands: + +- `npm install jest-diff` +- `yarn add jest-diff` + +## Usage of `diff()` + +Given JavaScript **values**, `diff(a, b, options?)` does the following: + +1. **serialize** the values as strings using the `pretty-format` package +2. **compare** the strings line-by-line using the `diff-sequences` package +3. **format** the changed or common lines using the `chalk` package + +To use this function, write either of the following: + +- `const {diff} = require('jest-diff');` in CommonJS modules +- `import {diff} from 'jest-diff';` in ECMAScript modules + +### Example of `diff()` + +```js +const a = ['delete', 'common', 'changed from']; +const b = ['common', 'changed to', 'insert']; + +const difference = diff(a, b); +``` + +The returned **string** consists of: + +- annotation lines: describe the two change indicators with labels, and a blank line +- comparison lines: similar to “unified” view on GitHub, but `Expected` lines are green, `Received` lines are red, and common lines are dim (by default, see Options) + +```diff +- Expected ++ Received + + Array [ +- "delete", + "common", +- "changed from", ++ "changed to", ++ "insert", + ] +``` + +### Edge cases of `diff()` + +Here are edge cases for the return value: + +- `' Comparing two different types of values. …'` if the arguments have **different types** according to the `jest-get-type` package (instances of different classes have the same `'object'` type) +- `'Compared values have no visual difference.'` if the arguments have either **referential identity** according to `Object.is` method or **same serialization** according to the `pretty-format` package +- `null` if either argument is a so-called **asymmetric matcher** in Jasmine or Jest + +## Usage of diffStringsUnified + +Given **strings**, `diffStringsUnified(a, b, options?)` does the following: + +1. **compare** the strings character-by-character using the `diff-sequences` package +2. **clean up** small (often coincidental) common substrings, also known as chaff +3. **format** the changed or common lines using the `chalk` package + +Although the function is mainly for **multiline** strings, it compares any strings. + +Write either of the following: + +- `const {diffStringsUnified} = require('jest-diff');` in CommonJS modules +- `import {diffStringsUnified} from 'jest-diff';` in ECMAScript modules + +### Example of diffStringsUnified + +```js +const a = 'common\nchanged from'; +const b = 'common\nchanged to'; + +const difference = diffStringsUnified(a, b); +``` + +The returned **string** consists of: + +- annotation lines: describe the two change indicators with labels, and a blank line +- comparison lines: similar to “unified” view on GitHub, and **changed substrings** have **inverse** foreground and background colors (that is, `from` has white-on-green and `to` has white-on-red, which the following example does not show) + +```diff +- Expected ++ Received + + common +- changed from ++ changed to +``` + +### Performance of diffStringsUnified + +To get the benefit of **changed substrings** within the comparison lines, a character-by-character comparison has a higher computational cost (in time and space) than a line-by-line comparison. + +If the input strings can have **arbitrary length**, we recommend that the calling code set a limit, beyond which splits the strings, and then calls `diffLinesUnified` instead. For example, Jest falls back to line-by-line comparison if either string has length greater than 20K characters. + +## Usage of diffLinesUnified + +Given **arrays of strings**, `diffLinesUnified(aLines, bLines, options?)` does the following: + +1. **compare** the arrays line-by-line using the `diff-sequences` package +2. **format** the changed or common lines using the `chalk` package + +You might call this function when strings have been split into lines and you do not need to see changed substrings within lines. + +### Example of diffLinesUnified + +```js +const aLines = ['delete', 'common', 'changed from']; +const bLines = ['common', 'changed to', 'insert']; + +const difference = diffLinesUnified(aLines, bLines); +``` + +```diff +- Expected ++ Received + +- delete + common +- changed from ++ changed to ++ insert +``` + +### Edge cases of diffLinesUnified or diffStringsUnified + +Here are edge cases for arguments and return values: + +- both `a` and `b` are empty strings: no comparison lines +- only `a` is empty string: all comparison lines have `bColor` and `bIndicator` (see Options) +- only `b` is empty string: all comparison lines have `aColor` and `aIndicator` (see Options) +- `a` and `b` are equal non-empty strings: all comparison lines have `commonColor` and `commonIndicator` (see Options) + +## Usage of diffLinesUnified2 + +Given two **pairs** of arrays of strings, `diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options?)` does the following: + +1. **compare** the pair of `Compare` arrays line-by-line using the `diff-sequences` package +2. **format** the corresponding lines in the pair of `Display` arrays using the `chalk` package + +Jest calls this function to consider lines as common instead of changed if the only difference is indentation. + +You might call this function for case insensitive or Unicode equivalence comparison of lines. + +### Example of diffLinesUnified2 + +```js +import {format} from 'pretty-format'; + +const a = { + text: 'Ignore indentation in serialized object', + time: '2019-09-19T12:34:56.000Z', + type: 'CREATE_ITEM', +}; +const b = { + payload: { + text: 'Ignore indentation in serialized object', + time: '2019-09-19T12:34:56.000Z', + }, + type: 'CREATE_ITEM', +}; + +const difference = diffLinesUnified2( + // serialize with indentation to display lines + format(a).split('\n'), + format(b).split('\n'), + // serialize without indentation to compare lines + format(a, {indent: 0}).split('\n'), + format(b, {indent: 0}).split('\n'), +); +``` + +The `text` and `time` properties are common, because their only difference is indentation: + +```diff +- Expected ++ Received + + Object { ++ payload: Object { + text: 'Ignore indentation in serialized object', + time: '2019-09-19T12:34:56.000Z', ++ }, + type: 'CREATE_ITEM', + } +``` + +The preceding example illustrates why (at least for indentation) it seems more intuitive that the function returns the common line from the `bLinesDisplay` array instead of from the `aLinesDisplay` array. + +## Usage of diffStringsRaw + +Given **strings** and a boolean option, `diffStringsRaw(a, b, cleanup)` does the following: + +1. **compare** the strings character-by-character using the `diff-sequences` package +2. optionally **clean up** small (often coincidental) common substrings, also known as chaff + +Because `diffStringsRaw` returns the difference as **data** instead of a string, you can format it as your application requires (for example, enclosed in HTML markup for browser instead of escape sequences for console). + +The returned **array** describes substrings as instances of the `Diff` class, which calling code can access like array tuples: + +The value at index `0` is one of the following: + +| value | named export | description | +| ----: | :------------ | :-------------------- | +| `0` | `DIFF_EQUAL` | in `a` and in `b` | +| `-1` | `DIFF_DELETE` | in `a` but not in `b` | +| `1` | `DIFF_INSERT` | in `b` but not in `a` | + +The value at index `1` is a substring of `a` or `b` or both. + +### Example of diffStringsRaw with cleanup + +```js +const diffs = diffStringsRaw('changed from', 'changed to', true); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------ | +| `0` | `0` | `'changed '` | +| `1` | `-1` | `'from'` | +| `2` | `1` | `'to'` | + +### Example of diffStringsRaw without cleanup + +```js +const diffs = diffStringsRaw('changed from', 'changed to', false); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------ | +| `0` | `0` | `'changed '` | +| `1` | `-1` | `'fr'` | +| `2` | `1` | `'t'` | +| `3` | `0` | `'o'` | +| `4` | `-1` | `'m'` | + +### Advanced import for diffStringsRaw + +Here are all the named imports that you might need for the `diffStringsRaw` function: + +- `const {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, diffStringsRaw} = require('jest-diff');` in CommonJS modules +- `import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, diffStringsRaw} from 'jest-diff';` in ECMAScript modules + +To write a **formatting** function, you might need the named constants (and `Diff` in TypeScript annotations). + +If you write an application-specific **cleanup** algorithm, then you might need to call the `Diff` constructor: + +```js +const diffCommon = new Diff(DIFF_EQUAL, 'changed '); +const diffDelete = new Diff(DIFF_DELETE, 'from'); +const diffInsert = new Diff(DIFF_INSERT, 'to'); +``` + +## Usage of diffLinesRaw + +Given **arrays of strings**, `diffLinesRaw(aLines, bLines)` does the following: + +- **compare** the arrays line-by-line using the `diff-sequences` package + +Because `diffLinesRaw` returns the difference as **data** instead of a string, you can format it as your application requires. + +### Example of diffLinesRaw + +```js +const aLines = ['delete', 'common', 'changed from']; +const bLines = ['common', 'changed to', 'insert']; + +const diffs = diffLinesRaw(aLines, bLines); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :--------------- | +| `0` | `-1` | `'delete'` | +| `1` | `0` | `'common'` | +| `2` | `-1` | `'changed from'` | +| `3` | `1` | `'changed to'` | +| `4` | `1` | `'insert'` | + +### Edge case of diffLinesRaw + +If you call `string.split('\n')` for an empty string: + +- the result is `['']` an array which contains an empty string +- instead of `[]` an empty array + +Depending of your application, you might call `diffLinesRaw` with either array. + +### Example of split method + +```js +import {diffLinesRaw} from 'jest-diff'; + +const a = 'non-empty string'; +const b = ''; + +const diffs = diffLinesRaw(a.split('\n'), b.split('\n')); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------------- | +| `0` | `-1` | `'non-empty string'` | +| `1` | `1` | `''` | + +Which you might format as follows: + +```diff +- Expected - 1 ++ Received + 1 + +- non-empty string ++ +``` + +### Example of splitLines0 function + +For edge case behavior like the `diffLinesUnified` function, you might define a `splitLines0` function, which given an empty string, returns `[]` an empty array: + +```js +export const splitLines0 = string => + string.length === 0 ? [] : string.split('\n'); +``` + +```js +import {diffLinesRaw} from 'jest-diff'; + +const a = ''; +const b = 'line 1\nline 2\nline 3'; + +const diffs = diffLinesRaw(a.split('\n'), b.split('\n')); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------ | +| `0` | `1` | `'line 1'` | +| `1` | `1` | `'line 2'` | +| `2` | `1` | `'line 3'` | + +Which you might format as follows: + +```diff +- Expected - 0 ++ Received + 3 + ++ line 1 ++ line 2 ++ line 3 +``` + +In contrast to the `diffLinesRaw` function, the `diffLinesUnified` and `diffLinesUnified2` functions **automatically** convert array arguments computed by string `split` method, so callers do **not** need a `splitLine0` function. + +## Options + +The default options are for the report when an assertion fails from the `expect` package used by Jest. + +For other applications, you can provide an options object as a third argument: + +- `diff(a, b, options)` +- `diffStringsUnified(a, b, options)` +- `diffLinesUnified(aLines, bLines, options)` +- `diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options)` + +### Properties of options object + +| name | default | +| :-------------------------------- | :----------------- | +| `aAnnotation` | `'Expected'` | +| `aColor` | `chalk.green` | +| `aIndicator` | `'-'` | +| `bAnnotation` | `'Received'` | +| `bColor` | `chalk.red` | +| `bIndicator` | `'+'` | +| `changeColor` | `chalk.inverse` | +| `changeLineTrailingSpaceColor` | `string => string` | +| `commonColor` | `chalk.dim` | +| `commonIndicator` | `' '` | +| `commonLineTrailingSpaceColor` | `string => string` | +| `compareKeys` | `undefined` | +| `contextLines` | `5` | +| `emptyFirstOrLastLinePlaceholder` | `''` | +| `expand` | `true` | +| `includeChangeCounts` | `false` | +| `omitAnnotationLines` | `false` | +| `patchColor` | `chalk.yellow` | + +For more information about the options, see the following examples. + +### Example of options for labels + +If the application is code modification, you might replace the labels: + +```js +const options = { + aAnnotation: 'Original', + bAnnotation: 'Modified', +}; +``` + +```diff +- Original ++ Modified + + common +- changed from ++ changed to +``` + +The `jest-diff` package does not assume that the 2 labels have equal length. + +### Example of options for colors of changed lines + +For consistency with most diff tools, you might exchange the colors: + +```ts +import chalk = require('chalk'); + +const options = { + aColor: chalk.red, + bColor: chalk.green, +}; +``` + +### Example of option for color of changed substrings + +Although the default inverse of foreground and background colors is hard to beat for changed substrings **within lines**, especially because it highlights spaces, if you want bold font weight on yellow background color: + +```ts +import chalk = require('chalk'); + +const options = { + changeColor: chalk.bold.bgYellowBright, +}; +``` + +### Example of option to format trailing spaces + +Because `diff()` does not display substring differences within lines, formatting can help you see when lines differ by the presence or absence of trailing spaces found by `/\s+$/` regular expression. + +- If change lines have a background color, then you can see trailing spaces. +- If common lines have default dim color, then you cannot see trailing spaces. You might want yellowish background color to see them. + +```js +const options = { + aColor: chalk.rgb(128, 0, 128).bgRgb(255, 215, 255), // magenta + bColor: chalk.rgb(0, 95, 0).bgRgb(215, 255, 215), // green + commonLineTrailingSpaceColor: chalk.bgYellow, +}; +``` + +The value of a Color option is a function, which given a string, returns a string. + +If you want to replace trailing spaces with middle dot characters: + +```js +const replaceSpacesWithMiddleDot = string => '·'.repeat(string.length); + +const options = { + changeLineTrailingSpaceColor: replaceSpacesWithMiddleDot, + commonLineTrailingSpaceColor: replaceSpacesWithMiddleDot, +}; +``` + +If you need the TypeScript type of a Color option: + +```ts +import {DiffOptionsColor} from 'jest-diff'; +``` + +### Example of options for no colors + +To store the difference in a file without escape codes for colors, provide an identity function: + +```js +const noColor = string => string; + +const options = { + aColor: noColor, + bColor: noColor, + changeColor: noColor, + commonColor: noColor, + patchColor: noColor, +}; +``` + +### Example of options for indicators + +For consistency with the `diff` command, you might replace the indicators: + +```js +const options = { + aIndicator: '<', + bIndicator: '>', +}; +``` + +The `jest-diff` package assumes (but does not enforce) that the 3 indicators have equal length. + +### Example of options to limit common lines + +By default, the output includes all common lines. + +To emphasize the changes, you might limit the number of common “context” lines: + +```js +const options = { + contextLines: 1, + expand: false, +}; +``` + +A patch mark like `@@ -12,7 +12,9 @@` accounts for omitted common lines. + +### Example of option for color of patch marks + +If you want patch marks to have the same dim color as common lines: + +```ts +import chalk = require('chalk'); + +const options = { + expand: false, + patchColor: chalk.dim, +}; +``` + +### Example of option to include change counts + +To display the number of changed lines at the right of annotation lines: + +```js +const a = ['common', 'changed from']; +const b = ['common', 'changed to', 'insert']; + +const options = { + includeChangeCounts: true, +}; + +const difference = diff(a, b, options); +``` + +```diff +- Expected - 1 ++ Received + 2 + + Array [ + "common", +- "changed from", ++ "changed to", ++ "insert", + ] +``` + +### Example of option to omit annotation lines + +To display only the comparison lines: + +```js +const a = 'common\nchanged from'; +const b = 'common\nchanged to'; + +const options = { + omitAnnotationLines: true, +}; + +const difference = diffStringsUnified(a, b, options); +``` + +```diff + common +- changed from ++ changed to +``` + +### Example of option for empty first or last lines + +If the **first** or **last** comparison line is **empty**, because the content is empty and the indicator is a space, you might not notice it. + +The replacement option is a string whose default value is `''` empty string. + +Because Jest trims the report when a matcher fails, it deletes an empty last line. + +Therefore, Jest uses as placeholder the downwards arrow with corner leftwards: + +```js +const options = { + emptyFirstOrLastLinePlaceholder: '↵', // U+21B5 +}; +``` + +If a content line is empty, then the corresponding comparison line is automatically trimmed to remove the margin space (represented as a middle dot below) for the default indicators: + +| Indicator | untrimmed | trimmed | +| ----------------: | :-------- | :------ | +| `aIndicator` | `'-·'` | `'-'` | +| `bIndicator` | `'+·'` | `'+'` | +| `commonIndicator` | `' ·'` | `''` | + +### Example of option for sorting object keys + +When two objects are compared their keys are printed in alphabetical order by default. If this was not the original order of the keys the diff becomes harder to read as the keys are not in their original position. + +Use `compareKeys` to pass a function which will be used when sorting the object keys. + +```js +const a = {c: 'c', b: 'b1', a: 'a'}; +const b = {c: 'c', b: 'b2', a: 'a'}; + +const options = { + // The keys will be in their original order + compareKeys: () => 0, +}; + +const difference = diff(a, b, options); +``` + +```diff +- Expected ++ Received + + Object { + "c": "c", +- "b": "b1", ++ "b": "b2", + "a": "a", + } +``` + +Depending on the implementation of `compareKeys` any sort order can be used. + +```js +const a = {c: 'c', b: 'b1', a: 'a'}; +const b = {c: 'c', b: 'b2', a: 'a'}; + +const options = { + // The keys will be in reverse order + compareKeys: (a, b) => (a > b ? -1 : 1), +}; + +const difference = diff(a, b, options); +``` + +```diff +- Expected ++ Received + + Object { + "a": "a", +- "b": "b1", ++ "b": "b2", + "c": "c", + } +``` diff --git a/node_modules/expect/node_modules/jest-diff/build/cleanupSemantic.js b/node_modules/expect/node_modules/jest-diff/build/cleanupSemantic.js new file mode 100644 index 000000000..6640de597 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/cleanupSemantic.js @@ -0,0 +1,640 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.cleanupSemantic = + exports.Diff = + exports.DIFF_INSERT = + exports.DIFF_EQUAL = + exports.DIFF_DELETE = + void 0; + +/** + * Diff Match and Patch + * Copyright 2018 The diff-match-patch Authors. + * https://github.com/google/diff-match-patch + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Computes the difference between two texts to create a patch. + * Applies the patch onto another text, allowing for errors. + * @author fraser@google.com (Neil Fraser) + */ + +/** + * CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file: + * + * 1. Delete anything not needed to use diff_cleanupSemantic method + * 2. Convert from prototype properties to var declarations + * 3. Convert Diff to class from constructor and prototype + * 4. Add type annotations for arguments and return values + * 5. Add exports + */ + +/** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ +var DIFF_DELETE = -1; +exports.DIFF_DELETE = DIFF_DELETE; +var DIFF_INSERT = 1; +exports.DIFF_INSERT = DIFF_INSERT; +var DIFF_EQUAL = 0; +/** + * Class representing one diff tuple. + * Attempts to look like a two-element array (which is what this used to be). + * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. + * @param {string} text Text to be deleted, inserted, or retained. + * @constructor + */ + +exports.DIFF_EQUAL = DIFF_EQUAL; + +class Diff { + 0; + 1; + + constructor(op, text) { + this[0] = op; + this[1] = text; + } +} +/** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ + +exports.Diff = Diff; + +var diff_commonPrefix = function (text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) { + return 0; + } // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; + + while (pointermin < pointermid) { + if ( + text1.substring(pointerstart, pointermid) == + text2.substring(pointerstart, pointermid) + ) { + pointermin = pointermid; + pointerstart = pointermin; + } else { + pointermax = pointermid; + } + + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + + return pointermid; +}; +/** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ + +var diff_commonSuffix = function (text1, text2) { + // Quick check for common null cases. + if ( + !text1 || + !text2 || + text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1) + ) { + return 0; + } // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; + + while (pointermin < pointermid) { + if ( + text1.substring(text1.length - pointermid, text1.length - pointerend) == + text2.substring(text2.length - pointermid, text2.length - pointerend) + ) { + pointermin = pointermid; + pointerend = pointermin; + } else { + pointermax = pointermid; + } + + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + + return pointermid; +}; +/** + * Determine if the suffix of one string is the prefix of another. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of the first + * string and the start of the second string. + * @private + */ + +var diff_commonOverlap_ = function (text1, text2) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; // Eliminate the null case. + + if (text1_length == 0 || text2_length == 0) { + return 0; + } // Truncate the longer string. + + if (text1_length > text2_length) { + text1 = text1.substring(text1_length - text2_length); + } else if (text1_length < text2_length) { + text2 = text2.substring(0, text1_length); + } + + var text_length = Math.min(text1_length, text2_length); // Quick check for the worst case. + + if (text1 == text2) { + return text_length; + } // Start by looking for a single character match + // and increase length until no match is found. + // Performance analysis: https://neil.fraser.name/news/2010/11/04/ + + var best = 0; + var length = 1; + + while (true) { + var pattern = text1.substring(text_length - length); + var found = text2.indexOf(pattern); + + if (found == -1) { + return best; + } + + length += found; + + if ( + found == 0 || + text1.substring(text_length - length) == text2.substring(0, length) + ) { + best = length; + length++; + } + } +}; +/** + * Reduce the number of edits by eliminating semantically trivial equalities. + * @param {!Array.} diffs Array of diff tuples. + */ + +var diff_cleanupSemantic = function (diffs) { + var changes = false; + var equalities = []; // Stack of indices where equalities are found. + + var equalitiesLength = 0; // Keeping our own length var is faster in JS. + + /** @type {?string} */ + + var lastEquality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1] + + var pointer = 0; // Index of current position. + // Number of characters that changed prior to the equality. + + var length_insertions1 = 0; + var length_deletions1 = 0; // Number of characters that changed after the equality. + + var length_insertions2 = 0; + var length_deletions2 = 0; + + while (pointer < diffs.length) { + if (diffs[pointer][0] == DIFF_EQUAL) { + // Equality found. + equalities[equalitiesLength++] = pointer; + length_insertions1 = length_insertions2; + length_deletions1 = length_deletions2; + length_insertions2 = 0; + length_deletions2 = 0; + lastEquality = diffs[pointer][1]; + } else { + // An insertion or deletion. + if (diffs[pointer][0] == DIFF_INSERT) { + length_insertions2 += diffs[pointer][1].length; + } else { + length_deletions2 += diffs[pointer][1].length; + } // Eliminate an equality that is smaller or equal to the edits on both + // sides of it. + + if ( + lastEquality && + lastEquality.length <= + Math.max(length_insertions1, length_deletions1) && + lastEquality.length <= Math.max(length_insertions2, length_deletions2) + ) { + // Duplicate record. + diffs.splice( + equalities[equalitiesLength - 1], + 0, + new Diff(DIFF_DELETE, lastEquality) + ); // Change second copy to insert. + + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; // Throw away the equality we just deleted. + + equalitiesLength--; // Throw away the previous equality (it needs to be reevaluated). + + equalitiesLength--; + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + length_insertions1 = 0; // Reset the counters. + + length_deletions1 = 0; + length_insertions2 = 0; + length_deletions2 = 0; + lastEquality = null; + changes = true; + } + } + + pointer++; + } // Normalize the diff. + + if (changes) { + diff_cleanupMerge(diffs); + } + + diff_cleanupSemanticLossless(diffs); // Find any overlaps between deletions and insertions. + // e.g: abcxxxxxxdef + // -> abcxxxdef + // e.g: xxxabcdefxxx + // -> defxxxabc + // Only extract an overlap if it is as big as the edit ahead or behind it. + + pointer = 1; + + while (pointer < diffs.length) { + if ( + diffs[pointer - 1][0] == DIFF_DELETE && + diffs[pointer][0] == DIFF_INSERT + ) { + var deletion = diffs[pointer - 1][1]; + var insertion = diffs[pointer][1]; + var overlap_length1 = diff_commonOverlap_(deletion, insertion); + var overlap_length2 = diff_commonOverlap_(insertion, deletion); + + if (overlap_length1 >= overlap_length2) { + if ( + overlap_length1 >= deletion.length / 2 || + overlap_length1 >= insertion.length / 2 + ) { + // Overlap found. Insert an equality and trim the surrounding edits. + diffs.splice( + pointer, + 0, + new Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1)) + ); + diffs[pointer - 1][1] = deletion.substring( + 0, + deletion.length - overlap_length1 + ); + diffs[pointer + 1][1] = insertion.substring(overlap_length1); + pointer++; + } + } else { + if ( + overlap_length2 >= deletion.length / 2 || + overlap_length2 >= insertion.length / 2 + ) { + // Reverse overlap found. + // Insert an equality and swap and trim the surrounding edits. + diffs.splice( + pointer, + 0, + new Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2)) + ); + diffs[pointer - 1][0] = DIFF_INSERT; + diffs[pointer - 1][1] = insertion.substring( + 0, + insertion.length - overlap_length2 + ); + diffs[pointer + 1][0] = DIFF_DELETE; + diffs[pointer + 1][1] = deletion.substring(overlap_length2); + pointer++; + } + } + + pointer++; + } + + pointer++; + } +}; +/** + * Look for single edits surrounded on both sides by equalities + * which can be shifted sideways to align the edit to a word boundary. + * e.g: The cat came. -> The cat came. + * @param {!Array.} diffs Array of diff tuples. + */ + +exports.cleanupSemantic = diff_cleanupSemantic; + +var diff_cleanupSemanticLossless = function (diffs) { + /** + * Given two strings, compute a score representing whether the internal + * boundary falls on logical boundaries. + * Scores range from 6 (best) to 0 (worst). + * Closure, but does not reference any external variables. + * @param {string} one First string. + * @param {string} two Second string. + * @return {number} The score. + * @private + */ + function diff_cleanupSemanticScore_(one, two) { + if (!one || !two) { + // Edges are the best. + return 6; + } // Each port of this function behaves slightly differently due to + // subtle differences in each language's definition of things like + // 'whitespace'. Since this function's purpose is largely cosmetic, + // the choice has been made to use each language's native features + // rather than force total conformity. + + var char1 = one.charAt(one.length - 1); + var char2 = two.charAt(0); + var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_); + var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_); + var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_); + var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_); + var lineBreak1 = whitespace1 && char1.match(linebreakRegex_); + var lineBreak2 = whitespace2 && char2.match(linebreakRegex_); + var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_); + var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_); + + if (blankLine1 || blankLine2) { + // Five points for blank lines. + return 5; + } else if (lineBreak1 || lineBreak2) { + // Four points for line breaks. + return 4; + } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) { + // Three points for end of sentences. + return 3; + } else if (whitespace1 || whitespace2) { + // Two points for whitespace. + return 2; + } else if (nonAlphaNumeric1 || nonAlphaNumeric2) { + // One point for non-alphanumeric. + return 1; + } + + return 0; + } + + var pointer = 1; // Intentionally ignore the first and last element (don't need checking). + + while (pointer < diffs.length - 1) { + if ( + diffs[pointer - 1][0] == DIFF_EQUAL && + diffs[pointer + 1][0] == DIFF_EQUAL + ) { + // This is a single edit surrounded by equalities. + var equality1 = diffs[pointer - 1][1]; + var edit = diffs[pointer][1]; + var equality2 = diffs[pointer + 1][1]; // First, shift the edit as far left as possible. + + var commonOffset = diff_commonSuffix(equality1, edit); + + if (commonOffset) { + var commonString = edit.substring(edit.length - commonOffset); + equality1 = equality1.substring(0, equality1.length - commonOffset); + edit = commonString + edit.substring(0, edit.length - commonOffset); + equality2 = commonString + equality2; + } // Second, step character by character right, looking for the best fit. + + var bestEquality1 = equality1; + var bestEdit = edit; + var bestEquality2 = equality2; + var bestScore = + diff_cleanupSemanticScore_(equality1, edit) + + diff_cleanupSemanticScore_(edit, equality2); + + while (edit.charAt(0) === equality2.charAt(0)) { + equality1 += edit.charAt(0); + edit = edit.substring(1) + equality2.charAt(0); + equality2 = equality2.substring(1); + var score = + diff_cleanupSemanticScore_(equality1, edit) + + diff_cleanupSemanticScore_(edit, equality2); // The >= encourages trailing rather than leading whitespace on edits. + + if (score >= bestScore) { + bestScore = score; + bestEquality1 = equality1; + bestEdit = edit; + bestEquality2 = equality2; + } + } + + if (diffs[pointer - 1][1] != bestEquality1) { + // We have an improvement, save it back to the diff. + if (bestEquality1) { + diffs[pointer - 1][1] = bestEquality1; + } else { + diffs.splice(pointer - 1, 1); + pointer--; + } + + diffs[pointer][1] = bestEdit; + + if (bestEquality2) { + diffs[pointer + 1][1] = bestEquality2; + } else { + diffs.splice(pointer + 1, 1); + pointer--; + } + } + } + + pointer++; + } +}; // Define some regex patterns for matching boundaries. + +var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/; +var whitespaceRegex_ = /\s/; +var linebreakRegex_ = /[\r\n]/; +var blanklineEndRegex_ = /\n\r?\n$/; +var blanklineStartRegex_ = /^\r?\n\r?\n/; +/** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {!Array.} diffs Array of diff tuples. + */ + +var diff_cleanupMerge = function (diffs) { + // Add a dummy entry at the end. + diffs.push(new Diff(DIFF_EQUAL, '')); + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; + var commonlength; + + while (pointer < diffs.length) { + switch (diffs[pointer][0]) { + case DIFF_INSERT: + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; + + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; + + case DIFF_EQUAL: + // Upon reaching an equality, check for prior redundancies. + if (count_delete + count_insert > 1) { + if (count_delete !== 0 && count_insert !== 0) { + // Factor out any common prefixies. + commonlength = diff_commonPrefix(text_insert, text_delete); + + if (commonlength !== 0) { + if ( + pointer - count_delete - count_insert > 0 && + diffs[pointer - count_delete - count_insert - 1][0] == + DIFF_EQUAL + ) { + diffs[pointer - count_delete - count_insert - 1][1] += + text_insert.substring(0, commonlength); + } else { + diffs.splice( + 0, + 0, + new Diff(DIFF_EQUAL, text_insert.substring(0, commonlength)) + ); + pointer++; + } + + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); + } // Factor out any common suffixies. + + commonlength = diff_commonSuffix(text_insert, text_delete); + + if (commonlength !== 0) { + diffs[pointer][1] = + text_insert.substring(text_insert.length - commonlength) + + diffs[pointer][1]; + text_insert = text_insert.substring( + 0, + text_insert.length - commonlength + ); + text_delete = text_delete.substring( + 0, + text_delete.length - commonlength + ); + } + } // Delete the offending records and add the merged ones. + + pointer -= count_delete + count_insert; + diffs.splice(pointer, count_delete + count_insert); + + if (text_delete.length) { + diffs.splice(pointer, 0, new Diff(DIFF_DELETE, text_delete)); + pointer++; + } + + if (text_insert.length) { + diffs.splice(pointer, 0, new Diff(DIFF_INSERT, text_insert)); + pointer++; + } + + pointer++; + } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) { + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else { + pointer++; + } + + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; + } + } + + if (diffs[diffs.length - 1][1] === '') { + diffs.pop(); // Remove the dummy entry at the end. + } // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + + var changes = false; + pointer = 1; // Intentionally ignore the first and last element (don't need checking). + + while (pointer < diffs.length - 1) { + if ( + diffs[pointer - 1][0] == DIFF_EQUAL && + diffs[pointer + 1][0] == DIFF_EQUAL + ) { + // This is a single edit surrounded by equalities. + if ( + diffs[pointer][1].substring( + diffs[pointer][1].length - diffs[pointer - 1][1].length + ) == diffs[pointer - 1][1] + ) { + // Shift the edit over the previous equality. + diffs[pointer][1] = + diffs[pointer - 1][1] + + diffs[pointer][1].substring( + 0, + diffs[pointer][1].length - diffs[pointer - 1][1].length + ); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if ( + diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == + diffs[pointer + 1][1] + ) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = + diffs[pointer][1].substring(diffs[pointer + 1][1].length) + + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + + pointer++; + } // If shifts were made, the diff needs reordering and another shift sweep. + + if (changes) { + diff_cleanupMerge(diffs); + } +}; diff --git a/node_modules/expect/node_modules/jest-diff/build/constants.js b/node_modules/expect/node_modules/jest-diff/build/constants.js new file mode 100644 index 000000000..ccf73e512 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/constants.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.SIMILAR_MESSAGE = exports.NO_DIFF_MESSAGE = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const NO_DIFF_MESSAGE = 'Compared values have no visual difference.'; +exports.NO_DIFF_MESSAGE = NO_DIFF_MESSAGE; +const SIMILAR_MESSAGE = + 'Compared values serialize to the same structure.\n' + + 'Printing internal object structure without calling `toJSON` instead.'; +exports.SIMILAR_MESSAGE = SIMILAR_MESSAGE; diff --git a/node_modules/expect/node_modules/jest-diff/build/diffLines.js b/node_modules/expect/node_modules/jest-diff/build/diffLines.js new file mode 100644 index 000000000..65ea41b17 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/diffLines.js @@ -0,0 +1,215 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printDiffLines = + exports.diffLinesUnified2 = + exports.diffLinesUnified = + exports.diffLinesRaw = + void 0; + +var _diffSequences = _interopRequireDefault(require('diff-sequences')); + +var _cleanupSemantic = require('./cleanupSemantic'); + +var _joinAlignedDiffs = require('./joinAlignedDiffs'); + +var _normalizeDiffOptions = require('./normalizeDiffOptions'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const isEmptyString = lines => lines.length === 1 && lines[0].length === 0; + +const countChanges = diffs => { + let a = 0; + let b = 0; + diffs.forEach(diff => { + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + a += 1; + break; + + case _cleanupSemantic.DIFF_INSERT: + b += 1; + break; + } + }); + return { + a, + b + }; +}; + +const printAnnotation = ( + { + aAnnotation, + aColor, + aIndicator, + bAnnotation, + bColor, + bIndicator, + includeChangeCounts, + omitAnnotationLines + }, + changeCounts +) => { + if (omitAnnotationLines) { + return ''; + } + + let aRest = ''; + let bRest = ''; + + if (includeChangeCounts) { + const aCount = String(changeCounts.a); + const bCount = String(changeCounts.b); // Padding right aligns the ends of the annotations. + + const baAnnotationLengthDiff = bAnnotation.length - aAnnotation.length; + const aAnnotationPadding = ' '.repeat(Math.max(0, baAnnotationLengthDiff)); + const bAnnotationPadding = ' '.repeat(Math.max(0, -baAnnotationLengthDiff)); // Padding left aligns the ends of the counts. + + const baCountLengthDiff = bCount.length - aCount.length; + const aCountPadding = ' '.repeat(Math.max(0, baCountLengthDiff)); + const bCountPadding = ' '.repeat(Math.max(0, -baCountLengthDiff)); + aRest = `${aAnnotationPadding} ${aIndicator} ${aCountPadding}${aCount}`; + bRest = `${bAnnotationPadding} ${bIndicator} ${bCountPadding}${bCount}`; + } + + const a = `${aIndicator} ${aAnnotation}${aRest}`; + const b = `${bIndicator} ${bAnnotation}${bRest}`; + return `${aColor(a)}\n${bColor(b)}\n\n`; +}; + +const printDiffLines = (diffs, options) => + printAnnotation(options, countChanges(diffs)) + + (options.expand + ? (0, _joinAlignedDiffs.joinAlignedDiffsExpand)(diffs, options) + : (0, _joinAlignedDiffs.joinAlignedDiffsNoExpand)(diffs, options)); // Compare two arrays of strings line-by-line. Format as comparison lines. + +exports.printDiffLines = printDiffLines; + +const diffLinesUnified = (aLines, bLines, options) => + printDiffLines( + diffLinesRaw( + isEmptyString(aLines) ? [] : aLines, + isEmptyString(bLines) ? [] : bLines + ), + (0, _normalizeDiffOptions.normalizeDiffOptions)(options) + ); // Given two pairs of arrays of strings: +// Compare the pair of comparison arrays line-by-line. +// Format the corresponding lines in the pair of displayable arrays. + +exports.diffLinesUnified = diffLinesUnified; + +const diffLinesUnified2 = ( + aLinesDisplay, + bLinesDisplay, + aLinesCompare, + bLinesCompare, + options +) => { + if (isEmptyString(aLinesDisplay) && isEmptyString(aLinesCompare)) { + aLinesDisplay = []; + aLinesCompare = []; + } + + if (isEmptyString(bLinesDisplay) && isEmptyString(bLinesCompare)) { + bLinesDisplay = []; + bLinesCompare = []; + } + + if ( + aLinesDisplay.length !== aLinesCompare.length || + bLinesDisplay.length !== bLinesCompare.length + ) { + // Fall back to diff of display lines. + return diffLinesUnified(aLinesDisplay, bLinesDisplay, options); + } + + const diffs = diffLinesRaw(aLinesCompare, bLinesCompare); // Replace comparison lines with displayable lines. + + let aIndex = 0; + let bIndex = 0; + diffs.forEach(diff => { + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + diff[1] = aLinesDisplay[aIndex]; + aIndex += 1; + break; + + case _cleanupSemantic.DIFF_INSERT: + diff[1] = bLinesDisplay[bIndex]; + bIndex += 1; + break; + + default: + diff[1] = bLinesDisplay[bIndex]; + aIndex += 1; + bIndex += 1; + } + }); + return printDiffLines( + diffs, + (0, _normalizeDiffOptions.normalizeDiffOptions)(options) + ); +}; // Compare two arrays of strings line-by-line. + +exports.diffLinesUnified2 = diffLinesUnified2; + +const diffLinesRaw = (aLines, bLines) => { + const aLength = aLines.length; + const bLength = bLines.length; + + const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex]; + + const diffs = []; + let aIndex = 0; + let bIndex = 0; + + const foundSubsequence = (nCommon, aCommon, bCommon) => { + for (; aIndex !== aCommon; aIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, aLines[aIndex]) + ); + } + + for (; bIndex !== bCommon; bIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, bLines[bIndex]) + ); + } + + for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_EQUAL, bLines[bIndex]) + ); + } + }; + + (0, _diffSequences.default)(aLength, bLength, isCommon, foundSubsequence); // After the last common subsequence, push remaining change items. + + for (; aIndex !== aLength; aIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, aLines[aIndex]) + ); + } + + for (; bIndex !== bLength; bIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, bLines[bIndex]) + ); + } + + return diffs; +}; + +exports.diffLinesRaw = diffLinesRaw; diff --git a/node_modules/expect/node_modules/jest-diff/build/diffStrings.js b/node_modules/expect/node_modules/jest-diff/build/diffStrings.js new file mode 100644 index 000000000..3ad4f1a5b --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/diffStrings.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _diffSequences = _interopRequireDefault(require('diff-sequences')); + +var _cleanupSemantic = require('./cleanupSemantic'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const diffStrings = (a, b) => { + const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex]; + + let aIndex = 0; + let bIndex = 0; + const diffs = []; + + const foundSubsequence = (nCommon, aCommon, bCommon) => { + if (aIndex !== aCommon) { + diffs.push( + new _cleanupSemantic.Diff( + _cleanupSemantic.DIFF_DELETE, + a.slice(aIndex, aCommon) + ) + ); + } + + if (bIndex !== bCommon) { + diffs.push( + new _cleanupSemantic.Diff( + _cleanupSemantic.DIFF_INSERT, + b.slice(bIndex, bCommon) + ) + ); + } + + aIndex = aCommon + nCommon; // number of characters compared in a + + bIndex = bCommon + nCommon; // number of characters compared in b + + diffs.push( + new _cleanupSemantic.Diff( + _cleanupSemantic.DIFF_EQUAL, + b.slice(bCommon, bIndex) + ) + ); + }; + + (0, _diffSequences.default)(a.length, b.length, isCommon, foundSubsequence); // After the last common subsequence, push remaining change items. + + if (aIndex !== a.length) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, a.slice(aIndex)) + ); + } + + if (bIndex !== b.length) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, b.slice(bIndex)) + ); + } + + return diffs; +}; + +var _default = diffStrings; +exports.default = _default; diff --git a/node_modules/expect/node_modules/jest-diff/build/getAlignedDiffs.js b/node_modules/expect/node_modules/jest-diff/build/getAlignedDiffs.js new file mode 100644 index 000000000..60dc1414f --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/getAlignedDiffs.js @@ -0,0 +1,231 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _cleanupSemantic = require('./cleanupSemantic'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Given change op and array of diffs, return concatenated string: +// * include common strings +// * include change strings which have argument op with changeColor +// * exclude change strings which have opposite op +const concatenateRelevantDiffs = (op, diffs, changeColor) => + diffs.reduce( + (reduced, diff) => + reduced + + (diff[0] === _cleanupSemantic.DIFF_EQUAL + ? diff[1] + : diff[0] === op && diff[1].length !== 0 // empty if change is newline + ? changeColor(diff[1]) + : ''), + '' + ); // Encapsulate change lines until either a common newline or the end. + +class ChangeBuffer { + op; + line; // incomplete line + + lines; // complete lines + + changeColor; + + constructor(op, changeColor) { + this.op = op; + this.line = []; + this.lines = []; + this.changeColor = changeColor; + } + + pushSubstring(substring) { + this.pushDiff(new _cleanupSemantic.Diff(this.op, substring)); + } + + pushLine() { + // Assume call only if line has at least one diff, + // therefore an empty line must have a diff which has an empty string. + // If line has multiple diffs, then assume it has a common diff, + // therefore change diffs have change color; + // otherwise then it has line color only. + this.lines.push( + this.line.length !== 1 + ? new _cleanupSemantic.Diff( + this.op, + concatenateRelevantDiffs(this.op, this.line, this.changeColor) + ) + : this.line[0][0] === this.op + ? this.line[0] // can use instance + : new _cleanupSemantic.Diff(this.op, this.line[0][1]) // was common diff + ); + this.line.length = 0; + } + + isLineEmpty() { + return this.line.length === 0; + } // Minor input to buffer. + + pushDiff(diff) { + this.line.push(diff); + } // Main input to buffer. + + align(diff) { + const string = diff[1]; + + if (string.includes('\n')) { + const substrings = string.split('\n'); + const iLast = substrings.length - 1; + substrings.forEach((substring, i) => { + if (i < iLast) { + // The first substring completes the current change line. + // A middle substring is a change line. + this.pushSubstring(substring); + this.pushLine(); + } else if (substring.length !== 0) { + // The last substring starts a change line, if it is not empty. + // Important: This non-empty condition also automatically omits + // the newline appended to the end of expected and received strings. + this.pushSubstring(substring); + } + }); + } else { + // Append non-multiline string to current change line. + this.pushDiff(diff); + } + } // Output from buffer. + + moveLinesTo(lines) { + if (!this.isLineEmpty()) { + this.pushLine(); + } + + lines.push(...this.lines); + this.lines.length = 0; + } +} // Encapsulate common and change lines. + +class CommonBuffer { + deleteBuffer; + insertBuffer; + lines; + + constructor(deleteBuffer, insertBuffer) { + this.deleteBuffer = deleteBuffer; + this.insertBuffer = insertBuffer; + this.lines = []; + } + + pushDiffCommonLine(diff) { + this.lines.push(diff); + } + + pushDiffChangeLines(diff) { + const isDiffEmpty = diff[1].length === 0; // An empty diff string is redundant, unless a change line is empty. + + if (!isDiffEmpty || this.deleteBuffer.isLineEmpty()) { + this.deleteBuffer.pushDiff(diff); + } + + if (!isDiffEmpty || this.insertBuffer.isLineEmpty()) { + this.insertBuffer.pushDiff(diff); + } + } + + flushChangeLines() { + this.deleteBuffer.moveLinesTo(this.lines); + this.insertBuffer.moveLinesTo(this.lines); + } // Input to buffer. + + align(diff) { + const op = diff[0]; + const string = diff[1]; + + if (string.includes('\n')) { + const substrings = string.split('\n'); + const iLast = substrings.length - 1; + substrings.forEach((substring, i) => { + if (i === 0) { + const subdiff = new _cleanupSemantic.Diff(op, substring); + + if ( + this.deleteBuffer.isLineEmpty() && + this.insertBuffer.isLineEmpty() + ) { + // If both current change lines are empty, + // then the first substring is a common line. + this.flushChangeLines(); + this.pushDiffCommonLine(subdiff); + } else { + // If either current change line is non-empty, + // then the first substring completes the change lines. + this.pushDiffChangeLines(subdiff); + this.flushChangeLines(); + } + } else if (i < iLast) { + // A middle substring is a common line. + this.pushDiffCommonLine(new _cleanupSemantic.Diff(op, substring)); + } else if (substring.length !== 0) { + // The last substring starts a change line, if it is not empty. + // Important: This non-empty condition also automatically omits + // the newline appended to the end of expected and received strings. + this.pushDiffChangeLines(new _cleanupSemantic.Diff(op, substring)); + } + }); + } else { + // Append non-multiline string to current change lines. + // Important: It cannot be at the end following empty change lines, + // because newline appended to the end of expected and received strings. + this.pushDiffChangeLines(diff); + } + } // Output from buffer. + + getLines() { + this.flushChangeLines(); + return this.lines; + } +} // Given diffs from expected and received strings, +// return new array of diffs split or joined into lines. +// +// To correctly align a change line at the end, the algorithm: +// * assumes that a newline was appended to the strings +// * omits the last newline from the output array +// +// Assume the function is not called: +// * if either expected or received is empty string +// * if neither expected nor received is multiline string + +const getAlignedDiffs = (diffs, changeColor) => { + const deleteBuffer = new ChangeBuffer( + _cleanupSemantic.DIFF_DELETE, + changeColor + ); + const insertBuffer = new ChangeBuffer( + _cleanupSemantic.DIFF_INSERT, + changeColor + ); + const commonBuffer = new CommonBuffer(deleteBuffer, insertBuffer); + diffs.forEach(diff => { + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + deleteBuffer.align(diff); + break; + + case _cleanupSemantic.DIFF_INSERT: + insertBuffer.align(diff); + break; + + default: + commonBuffer.align(diff); + } + }); + return commonBuffer.getLines(); +}; + +var _default = getAlignedDiffs; +exports.default = _default; diff --git a/node_modules/expect/node_modules/jest-diff/build/index.d.ts b/node_modules/expect/node_modules/jest-diff/build/index.d.ts new file mode 100644 index 000000000..2b2625c66 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/index.d.ts @@ -0,0 +1,93 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type {CompareKeys} from 'pretty-format'; + +/** + * Class representing one diff tuple. + * Attempts to look like a two-element array (which is what this used to be). + * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. + * @param {string} text Text to be deleted, inserted, or retained. + * @constructor + */ +export declare class Diff { + 0: number; + 1: string; + constructor(op: number, text: string); +} + +export declare function diff( + a: any, + b: any, + options?: DiffOptions, +): string | null; + +/** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ +export declare var DIFF_DELETE: number; + +export declare var DIFF_EQUAL: number; + +export declare var DIFF_INSERT: number; + +export declare const diffLinesRaw: ( + aLines: Array, + bLines: Array, +) => Array; + +export declare const diffLinesUnified: ( + aLines: Array, + bLines: Array, + options?: DiffOptions | undefined, +) => string; + +export declare const diffLinesUnified2: ( + aLinesDisplay: Array, + bLinesDisplay: Array, + aLinesCompare: Array, + bLinesCompare: Array, + options?: DiffOptions | undefined, +) => string; + +export declare type DiffOptions = { + aAnnotation?: string; + aColor?: DiffOptionsColor; + aIndicator?: string; + bAnnotation?: string; + bColor?: DiffOptionsColor; + bIndicator?: string; + changeColor?: DiffOptionsColor; + changeLineTrailingSpaceColor?: DiffOptionsColor; + commonColor?: DiffOptionsColor; + commonIndicator?: string; + commonLineTrailingSpaceColor?: DiffOptionsColor; + contextLines?: number; + emptyFirstOrLastLinePlaceholder?: string; + expand?: boolean; + includeChangeCounts?: boolean; + omitAnnotationLines?: boolean; + patchColor?: DiffOptionsColor; + compareKeys?: CompareKeys; +}; + +export declare type DiffOptionsColor = (arg: string) => string; + +export declare const diffStringsRaw: ( + a: string, + b: string, + cleanup: boolean, +) => Array; + +export declare const diffStringsUnified: ( + a: string, + b: string, + options?: DiffOptions | undefined, +) => string; + +export {}; diff --git a/node_modules/expect/node_modules/jest-diff/build/index.js b/node_modules/expect/node_modules/jest-diff/build/index.js new file mode 100644 index 000000000..cd0b86611 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/index.js @@ -0,0 +1,253 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +Object.defineProperty(exports, 'DIFF_DELETE', { + enumerable: true, + get: function () { + return _cleanupSemantic.DIFF_DELETE; + } +}); +Object.defineProperty(exports, 'DIFF_EQUAL', { + enumerable: true, + get: function () { + return _cleanupSemantic.DIFF_EQUAL; + } +}); +Object.defineProperty(exports, 'DIFF_INSERT', { + enumerable: true, + get: function () { + return _cleanupSemantic.DIFF_INSERT; + } +}); +Object.defineProperty(exports, 'Diff', { + enumerable: true, + get: function () { + return _cleanupSemantic.Diff; + } +}); +exports.diff = diff; +Object.defineProperty(exports, 'diffLinesRaw', { + enumerable: true, + get: function () { + return _diffLines.diffLinesRaw; + } +}); +Object.defineProperty(exports, 'diffLinesUnified', { + enumerable: true, + get: function () { + return _diffLines.diffLinesUnified; + } +}); +Object.defineProperty(exports, 'diffLinesUnified2', { + enumerable: true, + get: function () { + return _diffLines.diffLinesUnified2; + } +}); +Object.defineProperty(exports, 'diffStringsRaw', { + enumerable: true, + get: function () { + return _printDiffs.diffStringsRaw; + } +}); +Object.defineProperty(exports, 'diffStringsUnified', { + enumerable: true, + get: function () { + return _printDiffs.diffStringsUnified; + } +}); + +var _chalk = _interopRequireDefault(require('chalk')); + +var _jestGetType = require('jest-get-type'); + +var _prettyFormat = require('pretty-format'); + +var _cleanupSemantic = require('./cleanupSemantic'); + +var _constants = require('./constants'); + +var _diffLines = require('./diffLines'); + +var _normalizeDiffOptions = require('./normalizeDiffOptions'); + +var _printDiffs = require('./printDiffs'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; + +const getCommonMessage = (message, options) => { + const {commonColor} = (0, _normalizeDiffOptions.normalizeDiffOptions)( + options + ); + return commonColor(message); +}; + +const { + AsymmetricMatcher, + DOMCollection, + DOMElement, + Immutable, + ReactElement, + ReactTestComponent +} = _prettyFormat.plugins; +const PLUGINS = [ + ReactTestComponent, + ReactElement, + DOMElement, + DOMCollection, + Immutable, + AsymmetricMatcher +]; +const FORMAT_OPTIONS = { + plugins: PLUGINS +}; +const FALLBACK_FORMAT_OPTIONS = { + callToJSON: false, + maxDepth: 10, + plugins: PLUGINS +}; // Generate a string that will highlight the difference between two values +// with green and red. (similar to how github does code diffing) +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + +function diff(a, b, options) { + if (Object.is(a, b)) { + return getCommonMessage(_constants.NO_DIFF_MESSAGE, options); + } + + const aType = (0, _jestGetType.getType)(a); + let expectedType = aType; + let omitDifference = false; + + if (aType === 'object' && typeof a.asymmetricMatch === 'function') { + if (a.$$typeof !== Symbol.for('jest.asymmetricMatcher')) { + // Do not know expected type of user-defined asymmetric matcher. + return null; + } + + if (typeof a.getExpectedType !== 'function') { + // For example, expect.anything() matches either null or undefined + return null; + } + + expectedType = a.getExpectedType(); // Primitive types boolean and number omit difference below. + // For example, omit difference for expect.stringMatching(regexp) + + omitDifference = expectedType === 'string'; + } + + if (expectedType !== (0, _jestGetType.getType)(b)) { + return ( + ' Comparing two different types of values.' + + ` Expected ${_chalk.default.green(expectedType)} but ` + + `received ${_chalk.default.red((0, _jestGetType.getType)(b))}.` + ); + } + + if (omitDifference) { + return null; + } + + switch (aType) { + case 'string': + return (0, _diffLines.diffLinesUnified)( + a.split('\n'), + b.split('\n'), + options + ); + + case 'boolean': + case 'number': + return comparePrimitive(a, b, options); + + case 'map': + return compareObjects(sortMap(a), sortMap(b), options); + + case 'set': + return compareObjects(sortSet(a), sortSet(b), options); + + default: + return compareObjects(a, b, options); + } +} + +function comparePrimitive(a, b, options) { + const aFormat = (0, _prettyFormat.format)(a, FORMAT_OPTIONS); + const bFormat = (0, _prettyFormat.format)(b, FORMAT_OPTIONS); + return aFormat === bFormat + ? getCommonMessage(_constants.NO_DIFF_MESSAGE, options) + : (0, _diffLines.diffLinesUnified)( + aFormat.split('\n'), + bFormat.split('\n'), + options + ); +} + +function sortMap(map) { + return new Map(Array.from(map.entries()).sort()); +} + +function sortSet(set) { + return new Set(Array.from(set.values()).sort()); +} + +function compareObjects(a, b, options) { + let difference; + let hasThrown = false; + + try { + const formatOptions = getFormatOptions(FORMAT_OPTIONS, options); + difference = getObjectsDifference(a, b, formatOptions, options); + } catch { + hasThrown = true; + } + + const noDiffMessage = getCommonMessage(_constants.NO_DIFF_MESSAGE, options); // If the comparison yields no results, compare again but this time + // without calling `toJSON`. It's also possible that toJSON might throw. + + if (difference === undefined || difference === noDiffMessage) { + const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options); + difference = getObjectsDifference(a, b, formatOptions, options); + + if (difference !== noDiffMessage && !hasThrown) { + difference = `${getCommonMessage( + _constants.SIMILAR_MESSAGE, + options + )}\n\n${difference}`; + } + } + + return difference; +} + +function getFormatOptions(formatOptions, options) { + const {compareKeys} = (0, _normalizeDiffOptions.normalizeDiffOptions)( + options + ); + return {...formatOptions, compareKeys}; +} + +function getObjectsDifference(a, b, formatOptions, options) { + const formatOptionsZeroIndent = {...formatOptions, indent: 0}; + const aCompare = (0, _prettyFormat.format)(a, formatOptionsZeroIndent); + const bCompare = (0, _prettyFormat.format)(b, formatOptionsZeroIndent); + + if (aCompare === bCompare) { + return getCommonMessage(_constants.NO_DIFF_MESSAGE, options); + } else { + const aDisplay = (0, _prettyFormat.format)(a, formatOptions); + const bDisplay = (0, _prettyFormat.format)(b, formatOptions); + return (0, _diffLines.diffLinesUnified2)( + aDisplay.split('\n'), + bDisplay.split('\n'), + aCompare.split('\n'), + bCompare.split('\n'), + options + ); + } +} diff --git a/node_modules/expect/node_modules/jest-diff/build/joinAlignedDiffs.js b/node_modules/expect/node_modules/jest-diff/build/joinAlignedDiffs.js new file mode 100644 index 000000000..9eba70fd1 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/joinAlignedDiffs.js @@ -0,0 +1,303 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.joinAlignedDiffsNoExpand = exports.joinAlignedDiffsExpand = void 0; + +var _cleanupSemantic = require('./cleanupSemantic'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const formatTrailingSpaces = (line, trailingSpaceFormatter) => + line.replace(/\s+$/, match => trailingSpaceFormatter(match)); + +const printDiffLine = ( + line, + isFirstOrLast, + color, + indicator, + trailingSpaceFormatter, + emptyFirstOrLastLinePlaceholder +) => + line.length !== 0 + ? color( + `${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}` + ) + : indicator !== ' ' + ? color(indicator) + : isFirstOrLast && emptyFirstOrLastLinePlaceholder.length !== 0 + ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`) + : ''; + +const printDeleteLine = ( + line, + isFirstOrLast, + { + aColor, + aIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + aColor, + aIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); + +const printInsertLine = ( + line, + isFirstOrLast, + { + bColor, + bIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + bColor, + bIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); + +const printCommonLine = ( + line, + isFirstOrLast, + { + commonColor, + commonIndicator, + commonLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + commonColor, + commonIndicator, + commonLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); // In GNU diff format, indexes are one-based instead of zero-based. + +const createPatchMark = (aStart, aEnd, bStart, bEnd, {patchColor}) => + patchColor( + `@@ -${aStart + 1},${aEnd - aStart} +${bStart + 1},${bEnd - bStart} @@` + ); // jest --no-expand +// +// Given array of aligned strings with inverse highlight formatting, +// return joined lines with diff formatting (and patch marks, if needed). + +const joinAlignedDiffsNoExpand = (diffs, options) => { + const iLength = diffs.length; + const nContextLines = options.contextLines; + const nContextLines2 = nContextLines + nContextLines; // First pass: count output lines and see if it has patches. + + let jLength = iLength; + let hasExcessAtStartOrEnd = false; + let nExcessesBetweenChanges = 0; + let i = 0; + + while (i !== iLength) { + const iStart = i; + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) { + i += 1; + } + + if (iStart !== i) { + if (iStart === 0) { + // at start + if (i > nContextLines) { + jLength -= i - nContextLines; // subtract excess common lines + + hasExcessAtStartOrEnd = true; + } + } else if (i === iLength) { + // at end + const n = i - iStart; + + if (n > nContextLines) { + jLength -= n - nContextLines; // subtract excess common lines + + hasExcessAtStartOrEnd = true; + } + } else { + // between changes + const n = i - iStart; + + if (n > nContextLines2) { + jLength -= n - nContextLines2; // subtract excess common lines + + nExcessesBetweenChanges += 1; + } + } + } + + while (i !== iLength && diffs[i][0] !== _cleanupSemantic.DIFF_EQUAL) { + i += 1; + } + } + + const hasPatch = nExcessesBetweenChanges !== 0 || hasExcessAtStartOrEnd; + + if (nExcessesBetweenChanges !== 0) { + jLength += nExcessesBetweenChanges + 1; // add patch lines + } else if (hasExcessAtStartOrEnd) { + jLength += 1; // add patch line + } + + const jLast = jLength - 1; + const lines = []; + let jPatchMark = 0; // index of placeholder line for current patch mark + + if (hasPatch) { + lines.push(''); // placeholder line for first patch mark + } // Indexes of expected or received lines in current patch: + + let aStart = 0; + let bStart = 0; + let aEnd = 0; + let bEnd = 0; + + const pushCommonLine = line => { + const j = lines.length; + lines.push(printCommonLine(line, j === 0 || j === jLast, options)); + aEnd += 1; + bEnd += 1; + }; + + const pushDeleteLine = line => { + const j = lines.length; + lines.push(printDeleteLine(line, j === 0 || j === jLast, options)); + aEnd += 1; + }; + + const pushInsertLine = line => { + const j = lines.length; + lines.push(printInsertLine(line, j === 0 || j === jLast, options)); + bEnd += 1; + }; // Second pass: push lines with diff formatting (and patch marks, if needed). + + i = 0; + + while (i !== iLength) { + let iStart = i; + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) { + i += 1; + } + + if (iStart !== i) { + if (iStart === 0) { + // at beginning + if (i > nContextLines) { + iStart = i - nContextLines; + aStart = iStart; + bStart = iStart; + aEnd = aStart; + bEnd = bStart; + } + + for (let iCommon = iStart; iCommon !== i; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } else if (i === iLength) { + // at end + const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i; + + for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } else { + // between changes + const nCommon = i - iStart; + + if (nCommon > nContextLines2) { + const iEnd = iStart + nContextLines; + + for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + + lines[jPatchMark] = createPatchMark( + aStart, + aEnd, + bStart, + bEnd, + options + ); + jPatchMark = lines.length; + lines.push(''); // placeholder line for next patch mark + + const nOmit = nCommon - nContextLines2; + aStart = aEnd + nOmit; + bStart = bEnd + nOmit; + aEnd = aStart; + bEnd = bStart; + + for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } else { + for (let iCommon = iStart; iCommon !== i; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } + } + } + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_DELETE) { + pushDeleteLine(diffs[i][1]); + i += 1; + } + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_INSERT) { + pushInsertLine(diffs[i][1]); + i += 1; + } + } + + if (hasPatch) { + lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options); + } + + return lines.join('\n'); +}; // jest --expand +// +// Given array of aligned strings with inverse highlight formatting, +// return joined lines with diff formatting. + +exports.joinAlignedDiffsNoExpand = joinAlignedDiffsNoExpand; + +const joinAlignedDiffsExpand = (diffs, options) => + diffs + .map((diff, i, diffs) => { + const line = diff[1]; + const isFirstOrLast = i === 0 || i === diffs.length - 1; + + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + return printDeleteLine(line, isFirstOrLast, options); + + case _cleanupSemantic.DIFF_INSERT: + return printInsertLine(line, isFirstOrLast, options); + + default: + return printCommonLine(line, isFirstOrLast, options); + } + }) + .join('\n'); + +exports.joinAlignedDiffsExpand = joinAlignedDiffsExpand; diff --git a/node_modules/expect/node_modules/jest-diff/build/normalizeDiffOptions.js b/node_modules/expect/node_modules/jest-diff/build/normalizeDiffOptions.js new file mode 100644 index 000000000..b22a80476 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/normalizeDiffOptions.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.normalizeDiffOptions = exports.noColor = void 0; + +var _chalk = _interopRequireDefault(require('chalk')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const noColor = string => string; + +exports.noColor = noColor; +const DIFF_CONTEXT_DEFAULT = 5; +const OPTIONS_DEFAULT = { + aAnnotation: 'Expected', + aColor: _chalk.default.green, + aIndicator: '-', + bAnnotation: 'Received', + bColor: _chalk.default.red, + bIndicator: '+', + changeColor: _chalk.default.inverse, + changeLineTrailingSpaceColor: noColor, + commonColor: _chalk.default.dim, + commonIndicator: ' ', + commonLineTrailingSpaceColor: noColor, + compareKeys: undefined, + contextLines: DIFF_CONTEXT_DEFAULT, + emptyFirstOrLastLinePlaceholder: '', + expand: true, + includeChangeCounts: false, + omitAnnotationLines: false, + patchColor: _chalk.default.yellow +}; + +const getCompareKeys = compareKeys => + compareKeys && typeof compareKeys === 'function' + ? compareKeys + : OPTIONS_DEFAULT.compareKeys; + +const getContextLines = contextLines => + typeof contextLines === 'number' && + Number.isSafeInteger(contextLines) && + contextLines >= 0 + ? contextLines + : DIFF_CONTEXT_DEFAULT; // Pure function returns options with all properties. + +const normalizeDiffOptions = (options = {}) => ({ + ...OPTIONS_DEFAULT, + ...options, + compareKeys: getCompareKeys(options.compareKeys), + contextLines: getContextLines(options.contextLines) +}); + +exports.normalizeDiffOptions = normalizeDiffOptions; diff --git a/node_modules/expect/node_modules/jest-diff/build/printDiffs.js b/node_modules/expect/node_modules/jest-diff/build/printDiffs.js new file mode 100644 index 000000000..497ff0728 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/printDiffs.js @@ -0,0 +1,85 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.diffStringsUnified = exports.diffStringsRaw = void 0; + +var _cleanupSemantic = require('./cleanupSemantic'); + +var _diffLines = require('./diffLines'); + +var _diffStrings = _interopRequireDefault(require('./diffStrings')); + +var _getAlignedDiffs = _interopRequireDefault(require('./getAlignedDiffs')); + +var _normalizeDiffOptions = require('./normalizeDiffOptions'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const hasCommonDiff = (diffs, isMultiline) => { + if (isMultiline) { + // Important: Ignore common newline that was appended to multiline strings! + const iLast = diffs.length - 1; + return diffs.some( + (diff, i) => + diff[0] === _cleanupSemantic.DIFF_EQUAL && + (i !== iLast || diff[1] !== '\n') + ); + } + + return diffs.some(diff => diff[0] === _cleanupSemantic.DIFF_EQUAL); +}; // Compare two strings character-by-character. +// Format as comparison lines in which changed substrings have inverse colors. + +const diffStringsUnified = (a, b, options) => { + if (a !== b && a.length !== 0 && b.length !== 0) { + const isMultiline = a.includes('\n') || b.includes('\n'); // getAlignedDiffs assumes that a newline was appended to the strings. + + const diffs = diffStringsRaw( + isMultiline ? `${a}\n` : a, + isMultiline ? `${b}\n` : b, + true // cleanupSemantic + ); + + if (hasCommonDiff(diffs, isMultiline)) { + const optionsNormalized = (0, _normalizeDiffOptions.normalizeDiffOptions)( + options + ); + const lines = (0, _getAlignedDiffs.default)( + diffs, + optionsNormalized.changeColor + ); + return (0, _diffLines.printDiffLines)(lines, optionsNormalized); + } + } // Fall back to line-by-line diff. + + return (0, _diffLines.diffLinesUnified)( + a.split('\n'), + b.split('\n'), + options + ); +}; // Compare two strings character-by-character. +// Optionally clean up small common substrings, also known as chaff. + +exports.diffStringsUnified = diffStringsUnified; + +const diffStringsRaw = (a, b, cleanup) => { + const diffs = (0, _diffStrings.default)(a, b); + + if (cleanup) { + (0, _cleanupSemantic.cleanupSemantic)(diffs); // impure function + } + + return diffs; +}; + +exports.diffStringsRaw = diffStringsRaw; diff --git a/node_modules/expect/node_modules/jest-diff/build/types.js b/node_modules/expect/node_modules/jest-diff/build/types.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/expect/node_modules/jest-diff/package.json b/node_modules/expect/node_modules/jest-diff/package.json new file mode 100644 index 000000000..2d249c921 --- /dev/null +++ b/node_modules/expect/node_modules/jest-diff/package.json @@ -0,0 +1,36 @@ +{ + "name": "jest-diff", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-diff" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.0.0", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "devDependencies": { + "@jest/test-utils": "^28.0.1", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/expect/node_modules/jest-get-type/build/index.d.ts b/node_modules/expect/node_modules/jest-get-type/build/index.d.ts index 46b6128d6..096d2d1ea 100644 --- a/node_modules/expect/node_modules/jest-get-type/build/index.d.ts +++ b/node_modules/expect/node_modules/jest-get-type/build/index.d.ts @@ -4,7 +4,24 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -declare type ValueType = 'array' | 'bigint' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined'; export declare function getType(value: unknown): ValueType; + export declare const isPrimitive: (value: unknown) => boolean; + +declare type ValueType = + | 'array' + | 'bigint' + | 'boolean' + | 'function' + | 'null' + | 'number' + | 'object' + | 'regexp' + | 'map' + | 'set' + | 'date' + | 'string' + | 'symbol' + | 'undefined'; + export {}; diff --git a/node_modules/expect/node_modules/jest-get-type/package.json b/node_modules/expect/node_modules/jest-get-type/package.json index 89f5ab8fb..b56e68df1 100644 --- a/node_modules/expect/node_modules/jest-get-type/package.json +++ b/node_modules/expect/node_modules/jest-get-type/package.json @@ -1,14 +1,14 @@ { "name": "jest-get-type", "description": "A utility function to get the type of a value", - "version": "27.5.1", + "version": "28.0.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-get-type" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -23,5 +23,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" } diff --git a/node_modules/expect/node_modules/jest-matcher-utils/LICENSE b/node_modules/expect/node_modules/jest-matcher-utils/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/jest-matcher-utils/README.md b/node_modules/expect/node_modules/jest-matcher-utils/README.md new file mode 100644 index 000000000..d3e9d13bf --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/README.md @@ -0,0 +1,24 @@ +# jest-matcher-utils + +This package's exports are most notably used by `expect`'s [`this.utils`](https://jestjs.io/docs/expect#thisutils). + +## Installation + +To add this package as a dependency of a project, run either of the following commands: + +- `npm install jest-matcher-utils` +- `yarn add jest-matcher-utils` + +## Exports ([src/index.ts](https://github.com/facebook/jest/blob/HEAD/packages/jest-matcher-utils/src/index.ts)) + +### Functions + +`stringify` `highlightTrailingWhitespace` `printReceived` `printExpected` `printWithType` `ensureNoExpected` `ensureActualIsNumber` `ensureExpectedIsNumber` `ensureNumbers` `ensureExpectedIsNonNegativeInteger` `printDiffOrStringify` `diff` `pluralize` `getLabelPrinter` `matcherErrorMessage` `matcherHint` + +### Types + +`MatcherHintOptions` `DiffOptions` + +### Constants + +`EXPECTED_COLOR` `RECEIVED_COLOR` `INVERTED_COLOR` `BOLD_WEIGHT` `DIM_COLOR` `SUGGEST_TO_CONTAIN_EQUAL` diff --git a/node_modules/expect/node_modules/jest-matcher-utils/build/Replaceable.js b/node_modules/expect/node_modules/jest-matcher-utils/build/Replaceable.js new file mode 100644 index 000000000..83330c797 --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/build/Replaceable.js @@ -0,0 +1,73 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _jestGetType = require('jest-get-type'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const supportTypes = ['map', 'array', 'object']; + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +class Replaceable { + object; + type; + + constructor(object) { + this.object = object; + this.type = (0, _jestGetType.getType)(object); + + if (!supportTypes.includes(this.type)) { + throw new Error(`Type ${this.type} is not support in Replaceable!`); + } + } + + static isReplaceable(obj1, obj2) { + const obj1Type = (0, _jestGetType.getType)(obj1); + const obj2Type = (0, _jestGetType.getType)(obj2); + return obj1Type === obj2Type && supportTypes.includes(obj1Type); + } + + forEach(cb) { + if (this.type === 'object') { + const descriptors = Object.getOwnPropertyDescriptors(this.object); + [ + ...Object.keys(descriptors), + ...Object.getOwnPropertySymbols(descriptors) + ] //@ts-expect-error because typescript do not support symbol key in object + //https://github.com/microsoft/TypeScript/issues/1863 + .filter(key => descriptors[key].enumerable) + .forEach(key => { + cb(this.object[key], key, this.object); + }); + } else { + this.object.forEach(cb); + } + } + + get(key) { + if (this.type === 'map') { + return this.object.get(key); + } + + return this.object[key]; + } + + set(key, value) { + if (this.type === 'map') { + this.object.set(key, value); + } else { + this.object[key] = value; + } + } +} +/* eslint-enable */ + +exports.default = Replaceable; diff --git a/node_modules/expect/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js b/node_modules/expect/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js new file mode 100644 index 000000000..15a13e50b --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js @@ -0,0 +1,110 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = deepCyclicCopyReplaceable; + +var _prettyFormat = require('pretty-format'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const builtInObject = [ + Array, + Date, + Float32Array, + Float64Array, + Int16Array, + Int32Array, + Int8Array, + Map, + Set, + RegExp, + Uint16Array, + Uint32Array, + Uint8Array, + Uint8ClampedArray +]; + +if (typeof Buffer !== 'undefined') { + builtInObject.push(Buffer); +} + +const isBuiltInObject = object => builtInObject.includes(object.constructor); + +const isMap = value => value.constructor === Map; + +function deepCyclicCopyReplaceable(value, cycles = new WeakMap()) { + if (typeof value !== 'object' || value === null) { + return value; + } else if (cycles.has(value)) { + return cycles.get(value); + } else if (Array.isArray(value)) { + return deepCyclicCopyArray(value, cycles); + } else if (isMap(value)) { + return deepCyclicCopyMap(value, cycles); + } else if (isBuiltInObject(value)) { + return value; + } else if (_prettyFormat.plugins.DOMElement.test(value)) { + return value.cloneNode(true); + } else { + return deepCyclicCopyObject(value, cycles); + } +} + +function deepCyclicCopyObject(object, cycles) { + const newObject = Object.create(Object.getPrototypeOf(object)); + const descriptors = Object.getOwnPropertyDescriptors(object); + cycles.set(object, newObject); + const newDescriptors = [ + ...Object.keys(descriptors), + ...Object.getOwnPropertySymbols(descriptors) + ].reduce( + //@ts-expect-error because typescript do not support symbol key in object + //https://github.com/microsoft/TypeScript/issues/1863 + (newDescriptors, key) => { + const enumerable = descriptors[key].enumerable; + newDescriptors[key] = { + configurable: true, + enumerable, + value: deepCyclicCopyReplaceable( + // this accesses the value or getter, depending. We just care about the value anyways, and this allows us to not mess with accessors + // it has the side effect of invoking the getter here though, rather than copying it over + object[key], + cycles + ), + writable: true + }; + return newDescriptors; + }, + {} + ); //@ts-expect-error because typescript do not support symbol key in object + //https://github.com/microsoft/TypeScript/issues/1863 + + return Object.defineProperties(newObject, newDescriptors); +} + +function deepCyclicCopyArray(array, cycles) { + const newArray = new (Object.getPrototypeOf(array).constructor)(array.length); + const length = array.length; + cycles.set(array, newArray); + + for (let i = 0; i < length; i++) { + newArray[i] = deepCyclicCopyReplaceable(array[i], cycles); + } + + return newArray; +} + +function deepCyclicCopyMap(map, cycles) { + const newMap = new Map(); + cycles.set(map, newMap); + map.forEach((value, key) => { + newMap.set(key, deepCyclicCopyReplaceable(value, cycles)); + }); + return newMap; +} diff --git a/node_modules/expect/node_modules/jest-matcher-utils/build/index.d.ts b/node_modules/expect/node_modules/jest-matcher-utils/build/index.d.ts new file mode 100644 index 000000000..9c4b65fd0 --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/build/index.d.ts @@ -0,0 +1,128 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import chalk = require('chalk'); +import {DiffOptions as DiffOptions_2} from 'jest-diff'; + +export declare const BOLD_WEIGHT: chalk.Chalk; + +export declare const diff: ( + a: unknown, + b: unknown, + options?: DiffOptions_2 | undefined, +) => string | null; + +export declare type DiffOptions = DiffOptions_2; + +export declare const DIM_COLOR: chalk.Chalk; + +/** + * Ensures that `actual` is of type `number | bigint` + */ +export declare const ensureActualIsNumber: ( + actual: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +export declare const ensureExpectedIsNonNegativeInteger: ( + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +/** + * Ensures that `expected` is of type `number | bigint` + */ +export declare const ensureExpectedIsNumber: ( + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +export declare const ensureNoExpected: ( + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +/** + * Ensures that `actual` & `expected` are of type `number | bigint` + */ +export declare const ensureNumbers: ( + actual: unknown, + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +export declare const EXPECTED_COLOR: chalk.Chalk; + +export declare const getLabelPrinter: (...strings: Array) => PrintLabel; + +export declare const highlightTrailingWhitespace: (text: string) => string; + +export declare const INVERTED_COLOR: chalk.Chalk; + +export declare const matcherErrorMessage: ( + hint: string, + generic: string, + specific?: string | undefined, +) => string; + +export declare const matcherHint: ( + matcherName: string, + received?: string, + expected?: string, + options?: MatcherHintOptions, +) => string; + +declare type MatcherHintColor = (arg: string) => string; + +export declare type MatcherHintOptions = { + comment?: string; + expectedColor?: MatcherHintColor; + isDirectExpectCall?: boolean; + isNot?: boolean; + promise?: string; + receivedColor?: MatcherHintColor; + secondArgument?: string; + secondArgumentColor?: MatcherHintColor; +}; + +export declare const pluralize: (word: string, count: number) => string; + +export declare const printDiffOrStringify: ( + expected: unknown, + received: unknown, + expectedLabel: string, + receivedLabel: string, + expand: boolean, +) => string; + +export declare const printExpected: (value: unknown) => string; + +declare type PrintLabel = (string: string) => string; + +export declare const printReceived: (object: unknown) => string; + +export declare function printWithType( + name: string, + value: T, + print: (value: T) => string, +): string; + +export declare const RECEIVED_COLOR: chalk.Chalk; + +export declare const stringify: ( + object: unknown, + maxDepth?: number, + maxWidth?: number, +) => string; + +export declare const SUGGEST_TO_CONTAIN_EQUAL: string; + +export {}; diff --git a/node_modules/expect/node_modules/jest-matcher-utils/build/index.js b/node_modules/expect/node_modules/jest-matcher-utils/build/index.js new file mode 100644 index 000000000..fca426e3c --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/build/index.js @@ -0,0 +1,590 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printReceived = + exports.printExpected = + exports.printDiffOrStringify = + exports.pluralize = + exports.matcherHint = + exports.matcherErrorMessage = + exports.highlightTrailingWhitespace = + exports.getLabelPrinter = + exports.ensureNumbers = + exports.ensureNoExpected = + exports.ensureExpectedIsNumber = + exports.ensureExpectedIsNonNegativeInteger = + exports.ensureActualIsNumber = + exports.diff = + exports.SUGGEST_TO_CONTAIN_EQUAL = + exports.RECEIVED_COLOR = + exports.INVERTED_COLOR = + exports.EXPECTED_COLOR = + exports.DIM_COLOR = + exports.BOLD_WEIGHT = + void 0; +exports.printWithType = printWithType; +exports.stringify = void 0; + +var _chalk = _interopRequireDefault(require('chalk')); + +var _jestDiff = require('jest-diff'); + +var _jestGetType = require('jest-get-type'); + +var _prettyFormat = require('pretty-format'); + +var _Replaceable = _interopRequireDefault(require('./Replaceable')); + +var _deepCyclicCopyReplaceable = _interopRequireDefault( + require('./deepCyclicCopyReplaceable') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* eslint-disable local/ban-types-eventually */ +const { + AsymmetricMatcher, + DOMCollection, + DOMElement, + Immutable, + ReactElement, + ReactTestComponent +} = _prettyFormat.plugins; +const PLUGINS = [ + ReactTestComponent, + ReactElement, + DOMElement, + DOMCollection, + Immutable, + AsymmetricMatcher +]; +const EXPECTED_COLOR = _chalk.default.green; +exports.EXPECTED_COLOR = EXPECTED_COLOR; +const RECEIVED_COLOR = _chalk.default.red; +exports.RECEIVED_COLOR = RECEIVED_COLOR; +const INVERTED_COLOR = _chalk.default.inverse; +exports.INVERTED_COLOR = INVERTED_COLOR; +const BOLD_WEIGHT = _chalk.default.bold; +exports.BOLD_WEIGHT = BOLD_WEIGHT; +const DIM_COLOR = _chalk.default.dim; +exports.DIM_COLOR = DIM_COLOR; +const MULTILINE_REGEXP = /\n/; +const SPACE_SYMBOL = '\u{00B7}'; // middle dot + +const NUMBERS = [ + 'zero', + 'one', + 'two', + 'three', + 'four', + 'five', + 'six', + 'seven', + 'eight', + 'nine', + 'ten', + 'eleven', + 'twelve', + 'thirteen' +]; + +const SUGGEST_TO_CONTAIN_EQUAL = _chalk.default.dim( + 'Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.' +); + +exports.SUGGEST_TO_CONTAIN_EQUAL = SUGGEST_TO_CONTAIN_EQUAL; + +const stringify = (object, maxDepth = 10, maxWidth = 10) => { + const MAX_LENGTH = 10000; + let result; + + try { + result = (0, _prettyFormat.format)(object, { + maxDepth, + maxWidth, + min: true, + plugins: PLUGINS + }); + } catch { + result = (0, _prettyFormat.format)(object, { + callToJSON: false, + maxDepth, + maxWidth, + min: true, + plugins: PLUGINS + }); + } + + if (result.length >= MAX_LENGTH && maxDepth > 1) { + return stringify(object, Math.floor(maxDepth / 2), maxWidth); + } else if (result.length >= MAX_LENGTH && maxWidth > 1) { + return stringify(object, maxDepth, Math.floor(maxWidth / 2)); + } else { + return result; + } +}; + +exports.stringify = stringify; + +const highlightTrailingWhitespace = text => + text.replace(/\s+$/gm, _chalk.default.inverse('$&')); // Instead of inverse highlight which now implies a change, +// replace common spaces with middle dot at the end of any line. + +exports.highlightTrailingWhitespace = highlightTrailingWhitespace; + +const replaceTrailingSpaces = text => + text.replace(/\s+$/gm, spaces => SPACE_SYMBOL.repeat(spaces.length)); + +const printReceived = object => + RECEIVED_COLOR(replaceTrailingSpaces(stringify(object))); + +exports.printReceived = printReceived; + +const printExpected = value => + EXPECTED_COLOR(replaceTrailingSpaces(stringify(value))); + +exports.printExpected = printExpected; + +function printWithType(name, value, print) { + const type = (0, _jestGetType.getType)(value); + const hasType = + type !== 'null' && type !== 'undefined' + ? `${name} has type: ${type}\n` + : ''; + const hasValue = `${name} has value: ${print(value)}`; + return hasType + hasValue; +} + +const ensureNoExpected = (expected, matcherName, options) => { + if (typeof expected !== 'undefined') { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, '', options), // Because expected is omitted in hint above, + // expected is black instead of green in message below. + 'this matcher must not have an expected argument', + printWithType('Expected', expected, printExpected) + ) + ); + } +}; +/** + * Ensures that `actual` is of type `number | bigint` + */ + +exports.ensureNoExpected = ensureNoExpected; + +const ensureActualIsNumber = (actual, matcherName, options) => { + if (typeof actual !== 'number' && typeof actual !== 'bigint') { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, undefined, options), + `${RECEIVED_COLOR('received')} value must be a number or bigint`, + printWithType('Received', actual, printReceived) + ) + ); + } +}; +/** + * Ensures that `expected` is of type `number | bigint` + */ + +exports.ensureActualIsNumber = ensureActualIsNumber; + +const ensureExpectedIsNumber = (expected, matcherName, options) => { + if (typeof expected !== 'number' && typeof expected !== 'bigint') { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, undefined, options), + `${EXPECTED_COLOR('expected')} value must be a number or bigint`, + printWithType('Expected', expected, printExpected) + ) + ); + } +}; +/** + * Ensures that `actual` & `expected` are of type `number | bigint` + */ + +exports.ensureExpectedIsNumber = ensureExpectedIsNumber; + +const ensureNumbers = (actual, expected, matcherName, options) => { + ensureActualIsNumber(actual, matcherName, options); + ensureExpectedIsNumber(expected, matcherName, options); +}; + +exports.ensureNumbers = ensureNumbers; + +const ensureExpectedIsNonNegativeInteger = (expected, matcherName, options) => { + if ( + typeof expected !== 'number' || + !Number.isSafeInteger(expected) || + expected < 0 + ) { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, undefined, options), + `${EXPECTED_COLOR('expected')} value must be a non-negative integer`, + printWithType('Expected', expected, printExpected) + ) + ); + } +}; // Given array of diffs, return concatenated string: +// * include common substrings +// * exclude change substrings which have opposite op +// * include change substrings which have argument op +// with inverse highlight only if there is a common substring + +exports.ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger; + +const getCommonAndChangedSubstrings = (diffs, op, hasCommonDiff) => + diffs.reduce( + (reduced, diff) => + reduced + + (diff[0] === _jestDiff.DIFF_EQUAL + ? diff[1] + : diff[0] !== op + ? '' + : hasCommonDiff + ? INVERTED_COLOR(diff[1]) + : diff[1]), + '' + ); + +const isLineDiffable = (expected, received) => { + const expectedType = (0, _jestGetType.getType)(expected); + const receivedType = (0, _jestGetType.getType)(received); + + if (expectedType !== receivedType) { + return false; + } + + if ((0, _jestGetType.isPrimitive)(expected)) { + // Print generic line diff for strings only: + // * if neither string is empty + // * if either string has more than one line + return ( + typeof expected === 'string' && + typeof received === 'string' && + expected.length !== 0 && + received.length !== 0 && + (MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received)) + ); + } + + if ( + expectedType === 'date' || + expectedType === 'function' || + expectedType === 'regexp' + ) { + return false; + } + + if (expected instanceof Error && received instanceof Error) { + return false; + } + + if ( + receivedType === 'object' && + typeof received.asymmetricMatch === 'function' + ) { + return false; + } + + return true; +}; + +const MAX_DIFF_STRING_LENGTH = 20000; + +const printDiffOrStringify = ( + expected, + received, + expectedLabel, + receivedLabel, + expand // CLI options: true if `--expand` or false if `--no-expand` +) => { + if ( + typeof expected === 'string' && + typeof received === 'string' && + expected.length !== 0 && + received.length !== 0 && + expected.length <= MAX_DIFF_STRING_LENGTH && + received.length <= MAX_DIFF_STRING_LENGTH && + expected !== received + ) { + if (expected.includes('\n') || received.includes('\n')) { + return (0, _jestDiff.diffStringsUnified)(expected, received, { + aAnnotation: expectedLabel, + bAnnotation: receivedLabel, + changeLineTrailingSpaceColor: _chalk.default.bgYellow, + commonLineTrailingSpaceColor: _chalk.default.bgYellow, + emptyFirstOrLastLinePlaceholder: '↵', + // U+21B5 + expand, + includeChangeCounts: true + }); + } + + const diffs = (0, _jestDiff.diffStringsRaw)(expected, received, true); + const hasCommonDiff = diffs.some(diff => diff[0] === _jestDiff.DIFF_EQUAL); + const printLabel = getLabelPrinter(expectedLabel, receivedLabel); + const expectedLine = + printLabel(expectedLabel) + + printExpected( + getCommonAndChangedSubstrings( + diffs, + _jestDiff.DIFF_DELETE, + hasCommonDiff + ) + ); + const receivedLine = + printLabel(receivedLabel) + + printReceived( + getCommonAndChangedSubstrings( + diffs, + _jestDiff.DIFF_INSERT, + hasCommonDiff + ) + ); + return `${expectedLine}\n${receivedLine}`; + } + + if (isLineDiffable(expected, received)) { + const {replacedExpected, replacedReceived} = + replaceMatchedToAsymmetricMatcher( + (0, _deepCyclicCopyReplaceable.default)(expected), + (0, _deepCyclicCopyReplaceable.default)(received), + [], + [] + ); + const difference = (0, _jestDiff.diff)(replacedExpected, replacedReceived, { + aAnnotation: expectedLabel, + bAnnotation: receivedLabel, + expand, + includeChangeCounts: true + }); + + if ( + typeof difference === 'string' && + difference.includes(`- ${expectedLabel}`) && + difference.includes(`+ ${receivedLabel}`) + ) { + return difference; + } + } + + const printLabel = getLabelPrinter(expectedLabel, receivedLabel); + const expectedLine = printLabel(expectedLabel) + printExpected(expected); + const receivedLine = + printLabel(receivedLabel) + + (stringify(expected) === stringify(received) + ? 'serializes to the same string' + : printReceived(received)); + return `${expectedLine}\n${receivedLine}`; +}; // Sometimes, e.g. when comparing two numbers, the output from jest-diff +// does not contain more information than the `Expected:` / `Received:` already gives. +// In those cases, we do not print a diff to make the output shorter and not redundant. + +exports.printDiffOrStringify = printDiffOrStringify; + +const shouldPrintDiff = (actual, expected) => { + if (typeof actual === 'number' && typeof expected === 'number') { + return false; + } + + if (typeof actual === 'bigint' && typeof expected === 'bigint') { + return false; + } + + if (typeof actual === 'boolean' && typeof expected === 'boolean') { + return false; + } + + return true; +}; + +function replaceMatchedToAsymmetricMatcher( + replacedExpected, + replacedReceived, + expectedCycles, + receivedCycles +) { + if (!_Replaceable.default.isReplaceable(replacedExpected, replacedReceived)) { + return { + replacedExpected, + replacedReceived + }; + } + + if ( + expectedCycles.includes(replacedExpected) || + receivedCycles.includes(replacedReceived) + ) { + return { + replacedExpected, + replacedReceived + }; + } + + expectedCycles.push(replacedExpected); + receivedCycles.push(replacedReceived); + const expectedReplaceable = new _Replaceable.default(replacedExpected); + const receivedReplaceable = new _Replaceable.default(replacedReceived); + expectedReplaceable.forEach((expectedValue, key) => { + const receivedValue = receivedReplaceable.get(key); + + if (isAsymmetricMatcher(expectedValue)) { + if (expectedValue.asymmetricMatch(receivedValue)) { + receivedReplaceable.set(key, expectedValue); + } + } else if (isAsymmetricMatcher(receivedValue)) { + if (receivedValue.asymmetricMatch(expectedValue)) { + expectedReplaceable.set(key, receivedValue); + } + } else if ( + _Replaceable.default.isReplaceable(expectedValue, receivedValue) + ) { + const replaced = replaceMatchedToAsymmetricMatcher( + expectedValue, + receivedValue, + expectedCycles, + receivedCycles + ); + expectedReplaceable.set(key, replaced.replacedExpected); + receivedReplaceable.set(key, replaced.replacedReceived); + } + }); + return { + replacedExpected: expectedReplaceable.object, + replacedReceived: receivedReplaceable.object + }; +} + +function isAsymmetricMatcher(data) { + const type = (0, _jestGetType.getType)(data); + return type === 'object' && typeof data.asymmetricMatch === 'function'; +} + +const diff = (a, b, options) => + shouldPrintDiff(a, b) ? (0, _jestDiff.diff)(a, b, options) : null; + +exports.diff = diff; + +const pluralize = (word, count) => + `${NUMBERS[count] || count} ${word}${count === 1 ? '' : 's'}`; // To display lines of labeled values as two columns with monospace alignment: +// given the strings which will describe the values, +// return function which given each string, returns the label: +// string, colon, space, and enough padding spaces to align the value. + +exports.pluralize = pluralize; + +const getLabelPrinter = (...strings) => { + const maxLength = strings.reduce( + (max, string) => (string.length > max ? string.length : max), + 0 + ); + return string => `${string}: ${' '.repeat(maxLength - string.length)}`; +}; + +exports.getLabelPrinter = getLabelPrinter; + +const matcherErrorMessage = ( + hint, + generic, + specific // incorrect value returned from call to printWithType +) => + `${hint}\n\n${_chalk.default.bold('Matcher error')}: ${generic}${ + typeof specific === 'string' ? `\n\n${specific}` : '' + }`; // Display assertion for the report when a test fails. +// New format: rejects/resolves, not, and matcher name have black color +// Old format: matcher name has dim color + +exports.matcherErrorMessage = matcherErrorMessage; + +const matcherHint = ( + matcherName, + received = 'received', + expected = 'expected', + options = {} +) => { + const { + comment = '', + expectedColor = EXPECTED_COLOR, + isDirectExpectCall = false, + // seems redundant with received === '' + isNot = false, + promise = '', + receivedColor = RECEIVED_COLOR, + secondArgument = '', + secondArgumentColor = EXPECTED_COLOR + } = options; + let hint = ''; + let dimString = 'expect'; // concatenate adjacent dim substrings + + if (!isDirectExpectCall && received !== '') { + hint += DIM_COLOR(`${dimString}(`) + receivedColor(received); + dimString = ')'; + } + + if (promise !== '') { + hint += DIM_COLOR(`${dimString}.`) + promise; + dimString = ''; + } + + if (isNot) { + hint += `${DIM_COLOR(`${dimString}.`)}not`; + dimString = ''; + } + + if (matcherName.includes('.')) { + // Old format: for backward compatibility, + // especially without promise or isNot options + dimString += matcherName; + } else { + // New format: omit period from matcherName arg + hint += DIM_COLOR(`${dimString}.`) + matcherName; + dimString = ''; + } + + if (expected === '') { + dimString += '()'; + } else { + hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected); + + if (secondArgument) { + hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument); + } + + dimString = ')'; + } + + if (comment !== '') { + dimString += ` // ${comment}`; + } + + if (dimString !== '') { + hint += DIM_COLOR(dimString); + } + + return hint; +}; + +exports.matcherHint = matcherHint; diff --git a/node_modules/expect/node_modules/jest-matcher-utils/package.json b/node_modules/expect/node_modules/jest-matcher-utils/package.json new file mode 100644 index 000000000..b05c8da1f --- /dev/null +++ b/node_modules/expect/node_modules/jest-matcher-utils/package.json @@ -0,0 +1,37 @@ +{ + "name": "jest-matcher-utils", + "description": "A set of utility functions for expect and related packages", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-matcher-utils" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.0.1", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "devDependencies": { + "@jest/test-utils": "^28.0.1", + "@types/node": "*" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/expect/node_modules/jest-util/LICENSE b/node_modules/expect/node_modules/jest-util/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/jest-util/build/ErrorWithStack.js b/node_modules/expect/node_modules/jest-util/build/ErrorWithStack.js new file mode 100644 index 000000000..87f6deb8d --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/ErrorWithStack.js @@ -0,0 +1,33 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +class ErrorWithStack extends Error { + constructor(message, callsite, stackLimit) { + // Ensure we have a large stack length so we get full details. + const originalStackLimit = Error.stackTraceLimit; + + if (stackLimit) { + Error.stackTraceLimit = Math.max(stackLimit, originalStackLimit || 10); + } + + super(message); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, callsite); + } + + Error.stackTraceLimit = originalStackLimit; + } +} + +exports.default = ErrorWithStack; diff --git a/node_modules/expect/node_modules/jest-util/build/clearLine.js b/node_modules/expect/node_modules/jest-util/build/clearLine.js new file mode 100644 index 000000000..36c258a8b --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/clearLine.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = clearLine; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function clearLine(stream) { + if (stream.isTTY) { + stream.write('\x1b[999D\x1b[K'); + } +} diff --git a/node_modules/expect/node_modules/jest-util/build/convertDescriptorToString.js b/node_modules/expect/node_modules/jest-util/build/convertDescriptorToString.js new file mode 100644 index 000000000..a2b7066cf --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/convertDescriptorToString.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = convertDescriptorToString; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function convertDescriptorToString(descriptor) { + switch (typeof descriptor) { + case 'function': + if (descriptor.name) { + return descriptor.name; + } + + break; + + case 'number': + case 'undefined': + return `${descriptor}`; + + case 'string': + return descriptor; + } + + throw new Error( + `Invalid first argument, ${descriptor}. It must be a named class, named function, number, or string.` + ); +} diff --git a/node_modules/expect/node_modules/jest-util/build/createDirectory.js b/node_modules/expect/node_modules/jest-util/build/createDirectory.js new file mode 100644 index 000000000..d2a28b7c5 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/createDirectory.js @@ -0,0 +1,76 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = createDirectory; + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function createDirectory(path) { + try { + fs().mkdirSync(path, { + recursive: true + }); + } catch (e) { + if (e.code !== 'EEXIST') { + throw e; + } + } +} diff --git a/node_modules/expect/node_modules/jest-util/build/createProcessObject.js b/node_modules/expect/node_modules/jest-util/build/createProcessObject.js new file mode 100644 index 000000000..ec35a42ad --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/createProcessObject.js @@ -0,0 +1,124 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = createProcessObject; + +var _deepCyclicCopy = _interopRequireDefault(require('./deepCyclicCopy')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const BLACKLIST = new Set(['env', 'mainModule', '_events']); +const isWin32 = process.platform === 'win32'; +const proto = Object.getPrototypeOf(process.env); // The "process.env" object has a bunch of particularities: first, it does not +// directly extend from Object; second, it converts any assigned value to a +// string; and third, it is case-insensitive in Windows. We use a proxy here to +// mimic it (see https://nodejs.org/api/process.html#process_process_env). + +function createProcessEnv() { + const real = Object.create(proto); + const lookup = {}; + + function deletePropertyWin32(_target, key) { + for (const name in real) { + if (Object.prototype.hasOwnProperty.call(real, name)) { + if (typeof key === 'string') { + if (name.toLowerCase() === key.toLowerCase()) { + delete real[name]; + delete lookup[name.toLowerCase()]; + } + } else { + if (key === name) { + delete real[name]; + delete lookup[name]; + } + } + } + } + + return true; + } + + function deleteProperty(_target, key) { + delete real[key]; + delete lookup[key]; + return true; + } + + function getProperty(_target, key) { + return real[key]; + } + + function getPropertyWin32(_target, key) { + if (typeof key === 'string') { + return lookup[key in proto ? key : key.toLowerCase()]; + } else { + return real[key]; + } + } + + const proxy = new Proxy(real, { + deleteProperty: isWin32 ? deletePropertyWin32 : deleteProperty, + get: isWin32 ? getPropertyWin32 : getProperty, + + set(_target, key, value) { + const strValue = `${value}`; + + if (typeof key === 'string') { + lookup[key.toLowerCase()] = strValue; + } + + real[key] = strValue; + return true; + } + }); + return Object.assign(proxy, process.env); +} + +function createProcessObject() { + const process = require('process'); + + const newProcess = (0, _deepCyclicCopy.default)(process, { + blacklist: BLACKLIST, + keepPrototype: true + }); + + try { + // This fails on Node 12, but it's already set to 'process' + newProcess[Symbol.toStringTag] = 'process'; + } catch (e) { + // Make sure it's actually set instead of potentially ignoring errors + if (newProcess[Symbol.toStringTag] !== 'process') { + e.message = `Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n${e.message}`; + throw e; + } + } // Sequentially execute all constructors over the object. + + let proto = process; + + while ((proto = Object.getPrototypeOf(proto))) { + if (typeof proto.constructor === 'function') { + proto.constructor.call(newProcess); + } + } + + newProcess.env = createProcessEnv(); + + newProcess.send = () => true; + + Object.defineProperty(newProcess, 'domain', { + get() { + return process.domain; + } + }); + return newProcess; +} diff --git a/node_modules/expect/node_modules/jest-util/build/deepCyclicCopy.js b/node_modules/expect/node_modules/jest-util/build/deepCyclicCopy.js new file mode 100644 index 000000000..7a81dbc1e --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/deepCyclicCopy.js @@ -0,0 +1,84 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = deepCyclicCopy; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const EMPTY = new Set(); + +function deepCyclicCopy( + value, + options = { + blacklist: EMPTY, + keepPrototype: false + }, + cycles = new WeakMap() +) { + if (typeof value !== 'object' || value === null || Buffer.isBuffer(value)) { + return value; + } else if (cycles.has(value)) { + return cycles.get(value); + } else if (Array.isArray(value)) { + return deepCyclicCopyArray(value, options, cycles); + } else { + return deepCyclicCopyObject(value, options, cycles); + } +} + +function deepCyclicCopyObject(object, options, cycles) { + const newObject = options.keepPrototype + ? Object.create(Object.getPrototypeOf(object)) + : {}; + const descriptors = Object.getOwnPropertyDescriptors(object); + cycles.set(object, newObject); + Object.keys(descriptors).forEach(key => { + if (options.blacklist && options.blacklist.has(key)) { + delete descriptors[key]; + return; + } + + const descriptor = descriptors[key]; + + if (typeof descriptor.value !== 'undefined') { + descriptor.value = deepCyclicCopy( + descriptor.value, + { + blacklist: EMPTY, + keepPrototype: options.keepPrototype + }, + cycles + ); + } + + descriptor.configurable = true; + }); + return Object.defineProperties(newObject, descriptors); +} + +function deepCyclicCopyArray(array, options, cycles) { + const newArray = options.keepPrototype + ? new (Object.getPrototypeOf(array).constructor)(array.length) + : []; + const length = array.length; + cycles.set(array, newArray); + + for (let i = 0; i < length; i++) { + newArray[i] = deepCyclicCopy( + array[i], + { + blacklist: EMPTY, + keepPrototype: options.keepPrototype + }, + cycles + ); + } + + return newArray; +} diff --git a/node_modules/expect/node_modules/jest-util/build/formatTime.js b/node_modules/expect/node_modules/jest-util/build/formatTime.js new file mode 100644 index 000000000..fad4b8cc2 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/formatTime.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = formatTime; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function formatTime(time, prefixPower = -3, padLeftLength = 0) { + const prefixes = ['n', 'μ', 'm', '']; + const prefixIndex = Math.max( + 0, + Math.min( + Math.trunc(prefixPower / 3) + prefixes.length - 1, + prefixes.length - 1 + ) + ); + return `${String(time).padStart(padLeftLength)} ${prefixes[prefixIndex]}s`; +} diff --git a/node_modules/expect/node_modules/jest-util/build/globsToMatcher.js b/node_modules/expect/node_modules/jest-util/build/globsToMatcher.js new file mode 100644 index 000000000..b359fd5bd --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/globsToMatcher.js @@ -0,0 +1,108 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = globsToMatcher; + +function _picomatch() { + const data = _interopRequireDefault(require('picomatch')); + + _picomatch = function () { + return data; + }; + + return data; +} + +var _replacePathSepForGlob = _interopRequireDefault( + require('./replacePathSepForGlob') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const globsToMatchersMap = new Map(); +const picomatchOptions = { + dot: true +}; +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ + +function globsToMatcher(globs) { + if (globs.length === 0) { + // Since there were no globs given, we can simply have a fast path here and + // return with a very simple function. + return () => false; + } + + const matchers = globs.map(glob => { + if (!globsToMatchersMap.has(glob)) { + const isMatch = (0, _picomatch().default)(glob, picomatchOptions, true); + const matcher = { + isMatch, + // Matchers that are negated have different behavior than matchers that + // are not negated, so we need to store this information ahead of time. + negated: isMatch.state.negated || !!isMatch.state.negatedExtglob + }; + globsToMatchersMap.set(glob, matcher); + } + + return globsToMatchersMap.get(glob); + }); + return path => { + const replacedPath = (0, _replacePathSepForGlob.default)(path); + let kept = undefined; + let negatives = 0; + + for (let i = 0; i < matchers.length; i++) { + const {isMatch, negated} = matchers[i]; + + if (negated) { + negatives++; + } + + const matched = isMatch(replacedPath); + + if (!matched && negated) { + // The path was not matched, and the matcher is a negated matcher, so we + // want to omit the path. This means that the negative matcher is + // filtering the path out. + kept = false; + } else if (matched && !negated) { + // The path was matched, and the matcher is not a negated matcher, so we + // want to keep the path. + kept = true; + } + } // If all of the globs were negative globs, then we want to include the path + // as long as it was not explicitly not kept. Otherwise only include + // the path if it was kept. This allows sets of globs that are all negated + // to allow some paths to be matched, while sets of globs that are mixed + // negated and non-negated to cause the negated matchers to only omit paths + // and not keep them. + + return negatives === matchers.length ? kept !== false : !!kept; + }; +} diff --git a/node_modules/expect/node_modules/jest-util/build/index.d.ts b/node_modules/expect/node_modules/jest-util/build/index.d.ts new file mode 100644 index 000000000..3b55159b4 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/index.d.ts @@ -0,0 +1,125 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// + +import type {Config} from '@jest/types'; +import type {Global} from '@jest/types'; + +declare const ARROW = ' \u203A '; + +declare const CLEAR: string; + +export declare function clearLine(stream: NodeJS.WriteStream): void; + +export declare function convertDescriptorToString( + descriptor: Global.BlockNameLike | undefined, +): string; + +export declare function createDirectory(path: string): void; + +export declare function deepCyclicCopy( + value: T, + options?: DeepCyclicCopyOptions, + cycles?: WeakMap, +): T; + +declare type DeepCyclicCopyOptions = { + blacklist?: Set; + keepPrototype?: boolean; +}; + +export declare class ErrorWithStack extends Error { + constructor( + message: string | undefined, + callsite: (...args: Array) => unknown, + stackLimit?: number, + ); +} + +export declare function formatTime( + time: number, + prefixPower?: number, + padLeftLength?: number, +): string; + +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ +export declare function globsToMatcher(globs: Array): Matcher; + +declare const ICONS: { + failed: string; + pending: string; + success: string; + todo: string; +}; + +export declare function installCommonGlobals( + globalObject: typeof globalThis, + globals: Config.ConfigGlobals, +): typeof globalThis & Config.ConfigGlobals; + +export declare function interopRequireDefault(obj: any): any; + +export declare const isInteractive: boolean; + +export declare const isPromise: ( + candidate: unknown, +) => candidate is Promise; + +declare type Matcher = (str: string) => boolean; + +export declare function pluralize(word: string, count: number): string; + +declare namespace preRunMessage { + export {print_2 as print, remove}; +} +export {preRunMessage}; + +declare const print_2: (stream: NodeJS.WriteStream) => void; + +declare const remove: (stream: NodeJS.WriteStream) => void; + +export declare function replacePathSepForGlob(path: string): string; + +export declare function requireOrImportModule( + filePath: string, + applyInteropRequireDefault?: boolean, +): Promise; + +export declare function setGlobal( + globalToMutate: typeof globalThis | Global.Global, + key: string, + value: unknown, +): void; + +declare namespace specialChars { + export {ARROW, ICONS, CLEAR}; +} +export {specialChars}; + +export declare function testPathPatternToRegExp( + testPathPattern: Config.GlobalConfig['testPathPattern'], +): RegExp; + +export declare function tryRealpath(path: string): string; + +export {}; diff --git a/node_modules/expect/node_modules/jest-util/build/index.js b/node_modules/expect/node_modules/jest-util/build/index.js new file mode 100644 index 000000000..f23c93aba --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/index.js @@ -0,0 +1,209 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +Object.defineProperty(exports, 'ErrorWithStack', { + enumerable: true, + get: function () { + return _ErrorWithStack.default; + } +}); +Object.defineProperty(exports, 'clearLine', { + enumerable: true, + get: function () { + return _clearLine.default; + } +}); +Object.defineProperty(exports, 'convertDescriptorToString', { + enumerable: true, + get: function () { + return _convertDescriptorToString.default; + } +}); +Object.defineProperty(exports, 'createDirectory', { + enumerable: true, + get: function () { + return _createDirectory.default; + } +}); +Object.defineProperty(exports, 'deepCyclicCopy', { + enumerable: true, + get: function () { + return _deepCyclicCopy.default; + } +}); +Object.defineProperty(exports, 'formatTime', { + enumerable: true, + get: function () { + return _formatTime.default; + } +}); +Object.defineProperty(exports, 'globsToMatcher', { + enumerable: true, + get: function () { + return _globsToMatcher.default; + } +}); +Object.defineProperty(exports, 'installCommonGlobals', { + enumerable: true, + get: function () { + return _installCommonGlobals.default; + } +}); +Object.defineProperty(exports, 'interopRequireDefault', { + enumerable: true, + get: function () { + return _interopRequireDefault.default; + } +}); +Object.defineProperty(exports, 'isInteractive', { + enumerable: true, + get: function () { + return _isInteractive.default; + } +}); +Object.defineProperty(exports, 'isPromise', { + enumerable: true, + get: function () { + return _isPromise.default; + } +}); +Object.defineProperty(exports, 'pluralize', { + enumerable: true, + get: function () { + return _pluralize.default; + } +}); +exports.preRunMessage = void 0; +Object.defineProperty(exports, 'replacePathSepForGlob', { + enumerable: true, + get: function () { + return _replacePathSepForGlob.default; + } +}); +Object.defineProperty(exports, 'requireOrImportModule', { + enumerable: true, + get: function () { + return _requireOrImportModule.default; + } +}); +Object.defineProperty(exports, 'setGlobal', { + enumerable: true, + get: function () { + return _setGlobal.default; + } +}); +exports.specialChars = void 0; +Object.defineProperty(exports, 'testPathPatternToRegExp', { + enumerable: true, + get: function () { + return _testPathPatternToRegExp.default; + } +}); +Object.defineProperty(exports, 'tryRealpath', { + enumerable: true, + get: function () { + return _tryRealpath.default; + } +}); + +var preRunMessage = _interopRequireWildcard(require('./preRunMessage')); + +exports.preRunMessage = preRunMessage; + +var specialChars = _interopRequireWildcard(require('./specialChars')); + +exports.specialChars = specialChars; + +var _clearLine = _interopRequireDefault2(require('./clearLine')); + +var _createDirectory = _interopRequireDefault2(require('./createDirectory')); + +var _ErrorWithStack = _interopRequireDefault2(require('./ErrorWithStack')); + +var _installCommonGlobals = _interopRequireDefault2( + require('./installCommonGlobals') +); + +var _interopRequireDefault = _interopRequireDefault2( + require('./interopRequireDefault') +); + +var _isInteractive = _interopRequireDefault2(require('./isInteractive')); + +var _isPromise = _interopRequireDefault2(require('./isPromise')); + +var _setGlobal = _interopRequireDefault2(require('./setGlobal')); + +var _deepCyclicCopy = _interopRequireDefault2(require('./deepCyclicCopy')); + +var _convertDescriptorToString = _interopRequireDefault2( + require('./convertDescriptorToString') +); + +var _replacePathSepForGlob = _interopRequireDefault2( + require('./replacePathSepForGlob') +); + +var _testPathPatternToRegExp = _interopRequireDefault2( + require('./testPathPatternToRegExp') +); + +var _globsToMatcher = _interopRequireDefault2(require('./globsToMatcher')); + +var _pluralize = _interopRequireDefault2(require('./pluralize')); + +var _formatTime = _interopRequireDefault2(require('./formatTime')); + +var _tryRealpath = _interopRequireDefault2(require('./tryRealpath')); + +var _requireOrImportModule = _interopRequireDefault2( + require('./requireOrImportModule') +); + +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} diff --git a/node_modules/expect/node_modules/jest-util/build/installCommonGlobals.js b/node_modules/expect/node_modules/jest-util/build/installCommonGlobals.js new file mode 100644 index 000000000..6435f75d2 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/installCommonGlobals.js @@ -0,0 +1,123 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = installCommonGlobals; + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +var _createProcessObject = _interopRequireDefault( + require('./createProcessObject') +); + +var _deepCyclicCopy = _interopRequireDefault(require('./deepCyclicCopy')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const DTRACE = Object.keys(globalThis).filter(key => key.startsWith('DTRACE')); + +function installCommonGlobals(globalObject, globals) { + globalObject.process = (0, _createProcessObject.default)(); + const symbol = globalObject.Symbol; // Keep a reference to some globals that Jest needs + + Object.defineProperties(globalObject, { + [symbol.for('jest-native-promise')]: { + enumerable: false, + value: Promise, + writable: false + }, + [symbol.for('jest-native-now')]: { + enumerable: false, + value: globalObject.Date.now.bind(globalObject.Date), + writable: false + }, + [symbol.for('jest-native-read-file')]: { + enumerable: false, + value: fs().readFileSync.bind(fs()), + writable: false + }, + [symbol.for('jest-native-write-file')]: { + enumerable: false, + value: fs().writeFileSync.bind(fs()), + writable: false + }, + [symbol.for('jest-native-exists-file')]: { + enumerable: false, + value: fs().existsSync.bind(fs()), + writable: false + }, + 'jest-symbol-do-not-touch': { + enumerable: false, + value: symbol, + writable: false + } + }); // Forward some APIs. + + DTRACE.forEach(dtrace => { + // @ts-expect-error: no index + globalObject[dtrace] = function (...args) { + // @ts-expect-error: no index + return globalThis[dtrace].apply(this, args); + }; + }); + return Object.assign(globalObject, (0, _deepCyclicCopy.default)(globals)); +} diff --git a/node_modules/expect/node_modules/jest-util/build/interopRequireDefault.js b/node_modules/expect/node_modules/jest-util/build/interopRequireDefault.js new file mode 100644 index 000000000..69f2ebaeb --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/interopRequireDefault.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = interopRequireDefault; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// copied from https://github.com/babel/babel/blob/56044c7851d583d498f919e9546caddf8f80a72f/packages/babel-helpers/src/helpers.js#L558-L562 +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function interopRequireDefault(obj) { + return obj && obj.__esModule + ? obj + : { + default: obj + }; +} diff --git a/node_modules/expect/node_modules/jest-util/build/isInteractive.js b/node_modules/expect/node_modules/jest-util/build/isInteractive.js new file mode 100644 index 000000000..bc25399ec --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/isInteractive.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _ciInfo() { + const data = require('ci-info'); + + _ciInfo = function () { + return data; + }; + + return data; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var _default = + !!process.stdout.isTTY && process.env.TERM !== 'dumb' && !_ciInfo().isCI; + +exports.default = _default; diff --git a/node_modules/expect/node_modules/jest-util/build/isPromise.js b/node_modules/expect/node_modules/jest-util/build/isPromise.js new file mode 100644 index 000000000..5a7202064 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/isPromise.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// capture globalThis.Promise before it may potentially be overwritten +const Promise = globalThis.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 + +const isPromise = candidate => Promise.resolve(candidate) === candidate; + +var _default = isPromise; +exports.default = _default; diff --git a/node_modules/expect/node_modules/jest-util/build/pluralize.js b/node_modules/expect/node_modules/jest-util/build/pluralize.js new file mode 100644 index 000000000..55f533ee0 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/pluralize.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = pluralize; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function pluralize(word, count) { + return `${count} ${word}${count === 1 ? '' : 's'}`; +} diff --git a/node_modules/expect/node_modules/jest-util/build/preRunMessage.js b/node_modules/expect/node_modules/jest-util/build/preRunMessage.js new file mode 100644 index 000000000..370460167 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/preRunMessage.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.remove = exports.print = void 0; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +var _clearLine = _interopRequireDefault(require('./clearLine')); + +var _isInteractive = _interopRequireDefault(require('./isInteractive')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const print = stream => { + if (_isInteractive.default) { + stream.write( + _chalk().default.bold.dim('Determining test suites to run...') + ); + } +}; + +exports.print = print; + +const remove = stream => { + if (_isInteractive.default) { + (0, _clearLine.default)(stream); + } +}; + +exports.remove = remove; diff --git a/node_modules/expect/node_modules/jest-util/build/replacePathSepForGlob.js b/node_modules/expect/node_modules/jest-util/build/replacePathSepForGlob.js new file mode 100644 index 000000000..b7a1d0f90 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/replacePathSepForGlob.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = replacePathSepForGlob; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function replacePathSepForGlob(path) { + return path.replace(/\\(?![{}()+?.^$])/g, '/'); +} diff --git a/node_modules/expect/node_modules/jest-util/build/requireOrImportModule.js b/node_modules/expect/node_modules/jest-util/build/requireOrImportModule.js new file mode 100644 index 000000000..14bb2a387 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/requireOrImportModule.js @@ -0,0 +1,91 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = requireOrImportModule; + +function _path() { + const data = require('path'); + + _path = function () { + return data; + }; + + return data; +} + +function _url() { + const data = require('url'); + + _url = function () { + return data; + }; + + return data; +} + +var _interopRequireDefault = _interopRequireDefault2( + require('./interopRequireDefault') +); + +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +async function requireOrImportModule( + filePath, + applyInteropRequireDefault = true +) { + if (!(0, _path().isAbsolute)(filePath) && filePath[0] === '.') { + throw new Error( + `Jest: requireOrImportModule path must be absolute, was "${filePath}"` + ); + } + + try { + const requiredModule = require(filePath); + + if (!applyInteropRequireDefault) { + return requiredModule; + } + + return (0, _interopRequireDefault.default)(requiredModule).default; + } catch (error) { + if (error.code === 'ERR_REQUIRE_ESM') { + try { + const moduleUrl = (0, _url().pathToFileURL)(filePath); // node `import()` supports URL, but TypeScript doesn't know that + + const importedModule = await import(moduleUrl.href); + + if (!applyInteropRequireDefault) { + return importedModule; + } + + if (!importedModule.default) { + throw new Error( + `Jest: Failed to load ESM at ${filePath} - did you use a default export?` + ); + } + + return importedModule.default; + } catch (innerError) { + if (innerError.message === 'Not supported') { + throw new Error( + `Jest: Your version of Node does not support dynamic import - please enable it or use a .cjs file extension for file ${filePath}` + ); + } + + throw innerError; + } + } else { + throw error; + } + } +} diff --git a/node_modules/expect/node_modules/jest-util/build/setGlobal.js b/node_modules/expect/node_modules/jest-util/build/setGlobal.js new file mode 100644 index 000000000..7fdd77e39 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/setGlobal.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = setGlobal; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function setGlobal(globalToMutate, key, value) { + // @ts-expect-error: no index + globalToMutate[key] = value; +} diff --git a/node_modules/expect/node_modules/jest-util/build/specialChars.js b/node_modules/expect/node_modules/jest-util/build/specialChars.js new file mode 100644 index 000000000..b859ebd39 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/specialChars.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.ICONS = exports.CLEAR = exports.ARROW = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const isWindows = process.platform === 'win32'; +const ARROW = ' \u203A '; +exports.ARROW = ARROW; +const ICONS = { + failed: isWindows ? '\u00D7' : '\u2715', + pending: '\u25CB', + success: isWindows ? '\u221A' : '\u2713', + todo: '\u270E' +}; +exports.ICONS = ICONS; +const CLEAR = isWindows ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H'; +exports.CLEAR = CLEAR; diff --git a/node_modules/expect/node_modules/jest-util/build/testPathPatternToRegExp.js b/node_modules/expect/node_modules/jest-util/build/testPathPatternToRegExp.js new file mode 100644 index 000000000..5d64c6237 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/testPathPatternToRegExp.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = testPathPatternToRegExp; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Because we serialize/deserialize globalConfig when we spawn workers, +// we can't pass regular expression. Using this shared function on both sides +// will ensure that we produce consistent regexp for testPathPattern. +function testPathPatternToRegExp(testPathPattern) { + return new RegExp(testPathPattern, 'i'); +} diff --git a/node_modules/expect/node_modules/jest-util/build/tryRealpath.js b/node_modules/expect/node_modules/jest-util/build/tryRealpath.js new file mode 100644 index 000000000..445933861 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/build/tryRealpath.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = tryRealpath; + +function _gracefulFs() { + const data = require('graceful-fs'); + + _gracefulFs = function () { + return data; + }; + + return data; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function tryRealpath(path) { + try { + path = _gracefulFs().realpathSync.native(path); + } catch (error) { + if (error.code !== 'ENOENT') { + throw error; + } + } + + return path; +} diff --git a/node_modules/expect/node_modules/jest-util/package.json b/node_modules/expect/node_modules/jest-util/package.json new file mode 100644 index 000000000..1bd8f7d17 --- /dev/null +++ b/node_modules/expect/node_modules/jest-util/package.json @@ -0,0 +1,38 @@ +{ + "name": "jest-util", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-util" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "@jest/types": "^28.0.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "devDependencies": { + "@types/graceful-fs": "^4.1.3", + "@types/picomatch": "^2.2.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/expect/node_modules/pretty-format/LICENSE b/node_modules/expect/node_modules/pretty-format/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/pretty-format/README.md b/node_modules/expect/node_modules/pretty-format/README.md new file mode 100755 index 000000000..55dca1a88 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/README.md @@ -0,0 +1,463 @@ +# pretty-format + +Stringify any JavaScript value. + +- Serialize built-in JavaScript types. +- Serialize application-specific data types with built-in or user-defined plugins. + +## Installation + +```sh +$ yarn add pretty-format +``` + +## Usage + +```js +const {format: prettyFormat} = require('pretty-format'); // CommonJS +``` + +```js +import {format as prettyFormat} from 'pretty-format'; // ES2015 modules +``` + +```js +const val = {object: {}}; +val.circularReference = val; +val[Symbol('foo')] = 'foo'; +val.map = new Map([['prop', 'value']]); +val.array = [-0, Infinity, NaN]; + +console.log(prettyFormat(val)); +/* +Object { + "array": Array [ + -0, + Infinity, + NaN, + ], + "circularReference": [Circular], + "map": Map { + "prop" => "value", + }, + "object": Object {}, + Symbol(foo): "foo", +} +*/ +``` + +## Usage with options + +```js +function onClick() {} + +console.log(prettyFormat(onClick)); +/* +[Function onClick] +*/ + +const options = { + printFunctionName: false, +}; +console.log(prettyFormat(onClick, options)); +/* +[Function] +*/ +``` + + +| key | type | default | description | +| :-------------------- | :-------- | :--------- | :------------------------------------------------------ | +| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects | +| `compareKeys` | `function`| `undefined`| compare function used when sorting object keys | +| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions | +| `escapeString` | `boolean` | `true` | escape special characters in strings | +| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) | +| `indent` | `number` | `2` | spaces in each level of indentation | +| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on | +| `maxWidth` | `number` | `Infinity` | number of elements to print in arrays, sets, and so on | +| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks | +| `plugins` | `array` | `[]` | plugins to serialize application-specific data types | +| `printBasicPrototype` | `boolean` | `false` | print the prototype for plain objects and arrays | +| `printFunctionName` | `boolean` | `true` | include or omit the name of a function | +| `theme` | `object` | | colors to highlight syntax in terminal | + +Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors) + +```js +const DEFAULT_THEME = { + comment: 'gray', + content: 'reset', + prop: 'yellow', + tag: 'cyan', + value: 'green', +}; +``` + +## Usage with plugins + +The `pretty-format` package provides some built-in plugins, including: + +- `ReactElement` for elements from `react` +- `ReactTestComponent` for test objects from `react-test-renderer` + +```js +// CommonJS +const React = require('react'); +const renderer = require('react-test-renderer'); +const {format: prettyFormat, plugins} = require('pretty-format'); + +const {ReactElement, ReactTestComponent} = plugins; +``` + +```js +// ES2015 modules and destructuring assignment +import React from 'react'; +import renderer from 'react-test-renderer'; +import {plugins, format as prettyFormat} from 'pretty-format'; + +const {ReactElement, ReactTestComponent} = plugins; +``` + +```js +const onClick = () => {}; +const element = React.createElement('button', {onClick}, 'Hello World'); + +const formatted1 = prettyFormat(element, { + plugins: [ReactElement], + printFunctionName: false, +}); +const formatted2 = prettyFormat(renderer.create(element).toJSON(), { + plugins: [ReactTestComponent], + printFunctionName: false, +}); +/* + +*/ +``` + +## Usage in Jest + +For snapshot tests, Jest uses `pretty-format` with options that include some of its built-in plugins. For this purpose, plugins are also known as **snapshot serializers**. + +To serialize application-specific data types, you can add modules to `devDependencies` of a project, and then: + +In an **individual** test file, you can add a module as follows. It precedes any modules from Jest configuration. + +```js +import serializer from 'my-serializer-module'; +expect.addSnapshotSerializer(serializer); + +// tests which have `expect(value).toMatchSnapshot()` assertions +``` + +For **all** test files, you can specify modules in Jest configuration. They precede built-in plugins for React, HTML, and Immutable.js data types. For example, in a `package.json` file: + +```json +{ + "jest": { + "snapshotSerializers": ["my-serializer-module"] + } +} +``` + +## Writing plugins + +A plugin is a JavaScript object. + +If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either: + +- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later) +- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method) + +### test + +Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors: + +- `TypeError: Cannot read property 'whatever' of null` +- `TypeError: Cannot read property 'whatever' of undefined` + +For example, `test` method of built-in `ReactElement` plugin: + +```js +const elementSymbol = Symbol.for('react.element'); +const test = val => val && val.$$typeof === elementSymbol; +``` + +Pay attention to efficiency in `test` because `pretty-format` calls it often. + +### serialize + +The **improved** interface is available in **version 21** or later. + +Write `serialize` to return a string, given the arguments: + +- `val` which “passed the test” +- unchanging `config` object: derived from `options` +- current `indentation` string: concatenate to `indent` from `config` +- current `depth` number: compare to `maxDepth` from `config` +- current `refs` array: find circular references in objects +- `printer` callback function: serialize children + +### config + + +| key | type | description | +| :------------------ | :-------- | :------------------------------------------------------ | +| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects | +| `compareKeys` | `function`| compare function used when sorting object keys | +| `colors` | `Object` | escape codes for colors to highlight syntax | +| `escapeRegex` | `boolean` | escape special characters in regular expressions | +| `escapeString` | `boolean` | escape special characters in strings | +| `indent` | `string` | spaces in each level of indentation | +| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on | +| `min` | `boolean` | minimize added space: no indentation nor line breaks | +| `plugins` | `array` | plugins to serialize application-specific data types | +| `printFunctionName` | `boolean` | include or omit the name of a function | +| `spacingInner` | `string` | spacing to separate items in a list | +| `spacingOuter` | `string` | spacing to enclose a list of items | + +Each property of `colors` in `config` corresponds to a property of `theme` in `options`: + +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) + +Some properties in `config` are derived from `min` in `options`: + +- `spacingInner` and `spacingOuter` are **newline** if `min` is `false` +- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true` + +### Example of serialize and test + +This plugin is a pattern you can apply to serialize composite data types. Side note: `pretty-format` does not need a plugin to serialize arrays. + +```js +// We reused more code when we factored out a function for child items +// that is independent of depth, name, and enclosing punctuation (see below). +const SEPARATOR = ','; +function serializeItems(items, config, indentation, depth, refs, printer) { + if (items.length === 0) { + return ''; + } + const indentationItems = indentation + config.indent; + return ( + config.spacingOuter + + items + .map( + item => + indentationItems + + printer(item, config, indentationItems, depth, refs), // callback + ) + .join(SEPARATOR + config.spacingInner) + + (config.min ? '' : SEPARATOR) + // following the last item + config.spacingOuter + + indentation + ); +} + +const plugin = { + test(val) { + return Array.isArray(val); + }, + serialize(array, config, indentation, depth, refs, printer) { + const name = array.constructor.name; + return ++depth > config.maxDepth + ? `[${name}]` + : `${config.min ? '' : `${name} `}[${serializeItems( + array, + config, + indentation, + depth, + refs, + printer, + )}]`; + }, +}; +``` + +```js +const val = { + filter: 'completed', + items: [ + { + text: 'Write test', + completed: true, + }, + { + text: 'Write serialize', + completed: true, + }, + ], +}; +``` + +```js +console.log( + prettyFormat(val, { + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": Array [ + Object { + "completed": true, + "text": "Write test", + }, + Object { + "completed": true, + "text": "Write serialize", + }, + ], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + indent: 4, + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": Array [ + Object { + "completed": true, + "text": "Write test", + }, + Object { + "completed": true, + "text": "Write serialize", + }, + ], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + maxDepth: 1, + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": [Array], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + min: true, + plugins: [plugin], + }), +); +/* +{"filter": "completed", "items": [{"completed": true, "text": "Write test"}, {"completed": true, "text": "Write serialize"}]} +*/ +``` + +### print + +The **original** interface is adequate for plugins: + +- that **do not** depend on options other than `highlight` or `min` +- that **do not** depend on `depth` or `refs` in recursive traversal, and +- if values either + - do **not** require indentation, or + - do **not** occur as children of JavaScript data structures (for example, array) + +Write `print` to return a string, given the arguments: + +- `val` which “passed the test” +- current `printer(valChild)` callback function: serialize children +- current `indenter(lines)` callback function: indent lines at the next level +- unchanging `config` object: derived from `options` +- unchanging `colors` object: derived from `options` + +The 3 properties of `config` are `min` in `options` and: + +- `spacing` and `edgeSpacing` are **newline** if `min` is `false` +- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true` + +Each property of `colors` corresponds to a property of `theme` in `options`: + +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) + +### Example of print and test + +This plugin prints functions with the **number of named arguments** excluding rest argument. + +```js +const plugin = { + print(val) { + return `[Function ${val.name || 'anonymous'} ${val.length}]`; + }, + test(val) { + return typeof val === 'function'; + }, +}; +``` + +```js +const val = { + onClick(event) {}, + render() {}, +}; + +prettyFormat(val, { + plugins: [plugin], +}); +/* +Object { + "onClick": [Function onClick 1], + "render": [Function render 0], +} +*/ + +prettyFormat(val); +/* +Object { + "onClick": [Function onClick], + "render": [Function render], +} +*/ +``` + +This plugin **ignores** the `printFunctionName` option. That limitation of the original `print` interface is a reason to use the improved `serialize` interface, described above. + +```js +prettyFormat(val, { + plugins: [pluginOld], + printFunctionName: false, +}); +/* +Object { + "onClick": [Function onClick 1], + "render": [Function render 0], +} +*/ + +prettyFormat(val, { + printFunctionName: false, +}); +/* +Object { + "onClick": [Function], + "render": [Function], +} +*/ +``` diff --git a/node_modules/expect/node_modules/pretty-format/build/collections.js b/node_modules/expect/node_modules/pretty-format/build/collections.js new file mode 100644 index 000000000..3af756b94 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/collections.js @@ -0,0 +1,206 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printIteratorEntries = printIteratorEntries; +exports.printIteratorValues = printIteratorValues; +exports.printListItems = printListItems; +exports.printObjectProperties = printObjectProperties; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +const getKeysOfEnumerableProperties = (object, compareKeys) => { + const keys = Object.keys(object).sort(compareKeys); + + if (Object.getOwnPropertySymbols) { + Object.getOwnPropertySymbols(object).forEach(symbol => { + if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) { + keys.push(symbol); + } + }); + } + + return keys; +}; +/** + * Return entries (for example, of a map) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ + +function printIteratorEntries( + iterator, + config, + indentation, + depth, + refs, + printer, // Too bad, so sad that separator for ECMAScript Map has been ' => ' + // What a distracting diff if you change a data structure to/from + // ECMAScript Object or Immutable.Map/OrderedMap which use the default. + separator = ': ' +) { + let result = ''; + let width = 0; + let current = iterator.next(); + + if (!current.done) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + while (!current.done) { + result += indentationNext; + + if (width++ === config.maxWidth) { + result += '…'; + break; + } + + const name = printer( + current.value[0], + config, + indentationNext, + depth, + refs + ); + const value = printer( + current.value[1], + config, + indentationNext, + depth, + refs + ); + result += name + separator + value; + current = iterator.next(); + + if (!current.done) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return values (for example, of a set) + * with spacing, indentation, and comma + * without surrounding punctuation (braces or brackets) + */ + +function printIteratorValues( + iterator, + config, + indentation, + depth, + refs, + printer +) { + let result = ''; + let width = 0; + let current = iterator.next(); + + if (!current.done) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + while (!current.done) { + result += indentationNext; + + if (width++ === config.maxWidth) { + result += '…'; + break; + } + + result += printer(current.value, config, indentationNext, depth, refs); + current = iterator.next(); + + if (!current.done) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return items (for example, of an array) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, brackets) + **/ + +function printListItems(list, config, indentation, depth, refs, printer) { + let result = ''; + + if (list.length) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + for (let i = 0; i < list.length; i++) { + result += indentationNext; + + if (i === config.maxWidth) { + result += '…'; + break; + } + + if (i in list) { + result += printer(list[i], config, indentationNext, depth, refs); + } + + if (i < list.length - 1) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return properties of an object + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ + +function printObjectProperties(val, config, indentation, depth, refs, printer) { + let result = ''; + const keys = getKeysOfEnumerableProperties(val, config.compareKeys); + + if (keys.length) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const name = printer(key, config, indentationNext, depth, refs); + const value = printer(val[key], config, indentationNext, depth, refs); + result += `${indentationNext + name}: ${value}`; + + if (i < keys.length - 1) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} diff --git a/node_modules/expect/node_modules/pretty-format/build/index.d.ts b/node_modules/expect/node_modules/pretty-format/build/index.d.ts new file mode 100644 index 000000000..239b79b6f --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/index.d.ts @@ -0,0 +1,142 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type {SnapshotFormat} from '@jest/schemas'; + +export declare type Colors = { + comment: { + close: string; + open: string; + }; + content: { + close: string; + open: string; + }; + prop: { + close: string; + open: string; + }; + tag: { + close: string; + open: string; + }; + value: { + close: string; + open: string; + }; +}; + +export declare type CompareKeys = + | ((a: string, b: string) => number) + | undefined; + +export declare type Config = { + callToJSON: boolean; + compareKeys: CompareKeys; + colors: Colors; + escapeRegex: boolean; + escapeString: boolean; + indent: string; + maxDepth: number; + maxWidth: number; + min: boolean; + plugins: Plugins; + printBasicPrototype: boolean; + printFunctionName: boolean; + spacingInner: string; + spacingOuter: string; +}; + +export declare const DEFAULT_OPTIONS: Options; + +/** + * Returns a presentation string of your `val` object + * @param val any potential JavaScript object + * @param options Custom settings + */ +declare function format(val: unknown, options?: OptionsReceived): string; +export default format; +export {format}; + +declare type Indent = (arg0: string) => string; + +export declare type NewPlugin = { + serialize: ( + val: any, + config: Config, + indentation: string, + depth: number, + refs: Refs, + printer: Printer, + ) => string; + test: Test; +}; + +export declare type OldPlugin = { + print: ( + val: unknown, + print: Print, + indent: Indent, + options: PluginOptions, + colors: Colors, + ) => string; + test: Test; +}; + +export declare interface Options + extends Omit { + compareKeys: CompareKeys; + theme: Required; +} + +export declare type OptionsReceived = PrettyFormatOptions; + +declare type Plugin_2 = NewPlugin | OldPlugin; +export {Plugin_2 as Plugin}; + +declare type PluginOptions = { + edgeSpacing: string; + min: boolean; + spacing: string; +}; + +export declare type Plugins = Array; + +export declare const plugins: { + AsymmetricMatcher: NewPlugin; + ConvertAnsi: NewPlugin; + DOMCollection: NewPlugin; + DOMElement: NewPlugin; + Immutable: NewPlugin; + ReactElement: NewPlugin; + ReactTestComponent: NewPlugin; +}; + +export declare interface PrettyFormatOptions extends SnapshotFormat { + compareKeys?: CompareKeys; + plugins?: Plugins; +} + +declare type Print = (arg0: unknown) => string; + +export declare type Printer = ( + val: unknown, + config: Config, + indentation: string, + depth: number, + refs: Refs, + hasCalledToJSON?: boolean, +) => string; + +export declare type Refs = Array; + +declare type RequiredOptions = Required; + +declare type Test = (arg0: any) => boolean; + +export declare type Theme = Options['theme']; + +export {}; diff --git a/node_modules/expect/node_modules/pretty-format/build/index.js b/node_modules/expect/node_modules/pretty-format/build/index.js new file mode 100644 index 000000000..93132266b --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/index.js @@ -0,0 +1,635 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.DEFAULT_OPTIONS = void 0; +exports.format = format; +exports.plugins = void 0; + +var _ansiStyles = _interopRequireDefault(require('ansi-styles')); + +var _collections = require('./collections'); + +var _AsymmetricMatcher = _interopRequireDefault( + require('./plugins/AsymmetricMatcher') +); + +var _ConvertAnsi = _interopRequireDefault(require('./plugins/ConvertAnsi')); + +var _DOMCollection = _interopRequireDefault(require('./plugins/DOMCollection')); + +var _DOMElement = _interopRequireDefault(require('./plugins/DOMElement')); + +var _Immutable = _interopRequireDefault(require('./plugins/Immutable')); + +var _ReactElement = _interopRequireDefault(require('./plugins/ReactElement')); + +var _ReactTestComponent = _interopRequireDefault( + require('./plugins/ReactTestComponent') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* eslint-disable local/ban-types-eventually */ +const toString = Object.prototype.toString; +const toISOString = Date.prototype.toISOString; +const errorToString = Error.prototype.toString; +const regExpToString = RegExp.prototype.toString; +/** + * Explicitly comparing typeof constructor to function avoids undefined as name + * when mock identity-obj-proxy returns the key as the value for any key. + */ + +const getConstructorName = val => + (typeof val.constructor === 'function' && val.constructor.name) || 'Object'; +/* global window */ + +/** Is val is equal to global window object? Works even if it does not exist :) */ + +const isWindow = val => typeof window !== 'undefined' && val === window; + +const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/; +const NEWLINE_REGEXP = /\n/gi; + +class PrettyFormatPluginError extends Error { + constructor(message, stack) { + super(message); + this.stack = stack; + this.name = this.constructor.name; + } +} + +function isToStringedArrayType(toStringed) { + return ( + toStringed === '[object Array]' || + toStringed === '[object ArrayBuffer]' || + toStringed === '[object DataView]' || + toStringed === '[object Float32Array]' || + toStringed === '[object Float64Array]' || + toStringed === '[object Int8Array]' || + toStringed === '[object Int16Array]' || + toStringed === '[object Int32Array]' || + toStringed === '[object Uint8Array]' || + toStringed === '[object Uint8ClampedArray]' || + toStringed === '[object Uint16Array]' || + toStringed === '[object Uint32Array]' + ); +} + +function printNumber(val) { + return Object.is(val, -0) ? '-0' : String(val); +} + +function printBigInt(val) { + return String(`${val}n`); +} + +function printFunction(val, printFunctionName) { + if (!printFunctionName) { + return '[Function]'; + } + + return `[Function ${val.name || 'anonymous'}]`; +} + +function printSymbol(val) { + return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)'); +} + +function printError(val) { + return `[${errorToString.call(val)}]`; +} +/** + * The first port of call for printing an object, handles most of the + * data-types in JS. + */ + +function printBasicValue(val, printFunctionName, escapeRegex, escapeString) { + if (val === true || val === false) { + return `${val}`; + } + + if (val === undefined) { + return 'undefined'; + } + + if (val === null) { + return 'null'; + } + + const typeOf = typeof val; + + if (typeOf === 'number') { + return printNumber(val); + } + + if (typeOf === 'bigint') { + return printBigInt(val); + } + + if (typeOf === 'string') { + if (escapeString) { + return `"${val.replace(/"|\\/g, '\\$&')}"`; + } + + return `"${val}"`; + } + + if (typeOf === 'function') { + return printFunction(val, printFunctionName); + } + + if (typeOf === 'symbol') { + return printSymbol(val); + } + + const toStringed = toString.call(val); + + if (toStringed === '[object WeakMap]') { + return 'WeakMap {}'; + } + + if (toStringed === '[object WeakSet]') { + return 'WeakSet {}'; + } + + if ( + toStringed === '[object Function]' || + toStringed === '[object GeneratorFunction]' + ) { + return printFunction(val, printFunctionName); + } + + if (toStringed === '[object Symbol]') { + return printSymbol(val); + } + + if (toStringed === '[object Date]') { + return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val); + } + + if (toStringed === '[object Error]') { + return printError(val); + } + + if (toStringed === '[object RegExp]') { + if (escapeRegex) { + // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js + return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + return regExpToString.call(val); + } + + if (val instanceof Error) { + return printError(val); + } + + return null; +} +/** + * Handles more complex objects ( such as objects with circular references. + * maps and sets etc ) + */ + +function printComplexValue( + val, + config, + indentation, + depth, + refs, + hasCalledToJSON +) { + if (refs.indexOf(val) !== -1) { + return '[Circular]'; + } + + refs = refs.slice(); + refs.push(val); + const hitMaxDepth = ++depth > config.maxDepth; + const min = config.min; + + if ( + config.callToJSON && + !hitMaxDepth && + val.toJSON && + typeof val.toJSON === 'function' && + !hasCalledToJSON + ) { + return printer(val.toJSON(), config, indentation, depth, refs, true); + } + + const toStringed = toString.call(val); + + if (toStringed === '[object Arguments]') { + return hitMaxDepth + ? '[Arguments]' + : `${min ? '' : 'Arguments '}[${(0, _collections.printListItems)( + val, + config, + indentation, + depth, + refs, + printer + )}]`; + } + + if (isToStringedArrayType(toStringed)) { + return hitMaxDepth + ? `[${val.constructor.name}]` + : `${ + min + ? '' + : !config.printBasicPrototype && val.constructor.name === 'Array' + ? '' + : `${val.constructor.name} ` + }[${(0, _collections.printListItems)( + val, + config, + indentation, + depth, + refs, + printer + )}]`; + } + + if (toStringed === '[object Map]') { + return hitMaxDepth + ? '[Map]' + : `Map {${(0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer, + ' => ' + )}}`; + } + + if (toStringed === '[object Set]') { + return hitMaxDepth + ? '[Set]' + : `Set {${(0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + )}}`; + } // Avoid failure to serialize global window object in jsdom test environment. + // For example, not even relevant if window is prop of React element. + + return hitMaxDepth || isWindow(val) + ? `[${getConstructorName(val)}]` + : `${ + min + ? '' + : !config.printBasicPrototype && getConstructorName(val) === 'Object' + ? '' + : `${getConstructorName(val)} ` + }{${(0, _collections.printObjectProperties)( + val, + config, + indentation, + depth, + refs, + printer + )}}`; +} + +function isNewPlugin(plugin) { + return plugin.serialize != null; +} + +function printPlugin(plugin, val, config, indentation, depth, refs) { + let printed; + + try { + printed = isNewPlugin(plugin) + ? plugin.serialize(val, config, indentation, depth, refs, printer) + : plugin.print( + val, + valChild => printer(valChild, config, indentation, depth, refs), + str => { + const indentationNext = indentation + config.indent; + return ( + indentationNext + + str.replace(NEWLINE_REGEXP, `\n${indentationNext}`) + ); + }, + { + edgeSpacing: config.spacingOuter, + min: config.min, + spacing: config.spacingInner + }, + config.colors + ); + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + + if (typeof printed !== 'string') { + throw new Error( + `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".` + ); + } + + return printed; +} + +function findPlugin(plugins, val) { + for (let p = 0; p < plugins.length; p++) { + try { + if (plugins[p].test(val)) { + return plugins[p]; + } + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + } + + return null; +} + +function printer(val, config, indentation, depth, refs, hasCalledToJSON) { + const plugin = findPlugin(config.plugins, val); + + if (plugin !== null) { + return printPlugin(plugin, val, config, indentation, depth, refs); + } + + const basicResult = printBasicValue( + val, + config.printFunctionName, + config.escapeRegex, + config.escapeString + ); + + if (basicResult !== null) { + return basicResult; + } + + return printComplexValue( + val, + config, + indentation, + depth, + refs, + hasCalledToJSON + ); +} + +const DEFAULT_THEME = { + comment: 'gray', + content: 'reset', + prop: 'yellow', + tag: 'cyan', + value: 'green' +}; +const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME); +const DEFAULT_OPTIONS = { + callToJSON: true, + compareKeys: undefined, + escapeRegex: false, + escapeString: true, + highlight: false, + indent: 2, + maxDepth: Infinity, + maxWidth: Infinity, + min: false, + plugins: [], + printBasicPrototype: true, + printFunctionName: true, + theme: DEFAULT_THEME +}; +exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS; + +function validateOptions(options) { + Object.keys(options).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) { + throw new Error(`pretty-format: Unknown option "${key}".`); + } + }); + + if (options.min && options.indent !== undefined && options.indent !== 0) { + throw new Error( + 'pretty-format: Options "min" and "indent" cannot be used together.' + ); + } + + if (options.theme !== undefined) { + if (options.theme === null) { + throw new Error('pretty-format: Option "theme" must not be null.'); + } + + if (typeof options.theme !== 'object') { + throw new Error( + `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".` + ); + } + } +} + +const getColorsHighlight = options => + DEFAULT_THEME_KEYS.reduce((colors, key) => { + const value = + options.theme && options.theme[key] !== undefined + ? options.theme[key] + : DEFAULT_THEME[key]; + const color = value && _ansiStyles.default[value]; + + if ( + color && + typeof color.close === 'string' && + typeof color.open === 'string' + ) { + colors[key] = color; + } else { + throw new Error( + `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.` + ); + } + + return colors; + }, Object.create(null)); + +const getColorsEmpty = () => + DEFAULT_THEME_KEYS.reduce((colors, key) => { + colors[key] = { + close: '', + open: '' + }; + return colors; + }, Object.create(null)); + +const getPrintFunctionName = options => { + var _options$printFunctio; + + return (_options$printFunctio = + options === null || options === void 0 + ? void 0 + : options.printFunctionName) !== null && _options$printFunctio !== void 0 + ? _options$printFunctio + : DEFAULT_OPTIONS.printFunctionName; +}; + +const getEscapeRegex = options => { + var _options$escapeRegex; + + return (_options$escapeRegex = + options === null || options === void 0 ? void 0 : options.escapeRegex) !== + null && _options$escapeRegex !== void 0 + ? _options$escapeRegex + : DEFAULT_OPTIONS.escapeRegex; +}; + +const getEscapeString = options => { + var _options$escapeString; + + return (_options$escapeString = + options === null || options === void 0 ? void 0 : options.escapeString) !== + null && _options$escapeString !== void 0 + ? _options$escapeString + : DEFAULT_OPTIONS.escapeString; +}; + +const getConfig = options => { + var _options$callToJSON, + _options$indent, + _options$maxDepth, + _options$maxWidth, + _options$min, + _options$plugins, + _options$printBasicPr; + + return { + callToJSON: + (_options$callToJSON = + options === null || options === void 0 + ? void 0 + : options.callToJSON) !== null && _options$callToJSON !== void 0 + ? _options$callToJSON + : DEFAULT_OPTIONS.callToJSON, + colors: + options !== null && options !== void 0 && options.highlight + ? getColorsHighlight(options) + : getColorsEmpty(), + compareKeys: + typeof (options === null || options === void 0 + ? void 0 + : options.compareKeys) === 'function' + ? options.compareKeys + : DEFAULT_OPTIONS.compareKeys, + escapeRegex: getEscapeRegex(options), + escapeString: getEscapeString(options), + indent: + options !== null && options !== void 0 && options.min + ? '' + : createIndent( + (_options$indent = + options === null || options === void 0 + ? void 0 + : options.indent) !== null && _options$indent !== void 0 + ? _options$indent + : DEFAULT_OPTIONS.indent + ), + maxDepth: + (_options$maxDepth = + options === null || options === void 0 ? void 0 : options.maxDepth) !== + null && _options$maxDepth !== void 0 + ? _options$maxDepth + : DEFAULT_OPTIONS.maxDepth, + maxWidth: + (_options$maxWidth = + options === null || options === void 0 ? void 0 : options.maxWidth) !== + null && _options$maxWidth !== void 0 + ? _options$maxWidth + : DEFAULT_OPTIONS.maxWidth, + min: + (_options$min = + options === null || options === void 0 ? void 0 : options.min) !== + null && _options$min !== void 0 + ? _options$min + : DEFAULT_OPTIONS.min, + plugins: + (_options$plugins = + options === null || options === void 0 ? void 0 : options.plugins) !== + null && _options$plugins !== void 0 + ? _options$plugins + : DEFAULT_OPTIONS.plugins, + printBasicPrototype: + (_options$printBasicPr = + options === null || options === void 0 + ? void 0 + : options.printBasicPrototype) !== null && + _options$printBasicPr !== void 0 + ? _options$printBasicPr + : true, + printFunctionName: getPrintFunctionName(options), + spacingInner: + options !== null && options !== void 0 && options.min ? ' ' : '\n', + spacingOuter: + options !== null && options !== void 0 && options.min ? '' : '\n' + }; +}; + +function createIndent(indent) { + return new Array(indent + 1).join(' '); +} +/** + * Returns a presentation string of your `val` object + * @param val any potential JavaScript object + * @param options Custom settings + */ + +function format(val, options) { + if (options) { + validateOptions(options); + + if (options.plugins) { + const plugin = findPlugin(options.plugins, val); + + if (plugin !== null) { + return printPlugin(plugin, val, getConfig(options), '', 0, []); + } + } + } + + const basicResult = printBasicValue( + val, + getPrintFunctionName(options), + getEscapeRegex(options), + getEscapeString(options) + ); + + if (basicResult !== null) { + return basicResult; + } + + return printComplexValue(val, getConfig(options), '', 0, []); +} + +const plugins = { + AsymmetricMatcher: _AsymmetricMatcher.default, + ConvertAnsi: _ConvertAnsi.default, + DOMCollection: _DOMCollection.default, + DOMElement: _DOMElement.default, + Immutable: _Immutable.default, + ReactElement: _ReactElement.default, + ReactTestComponent: _ReactTestComponent.default +}; +exports.plugins = plugins; +var _default = format; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js b/node_modules/expect/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js new file mode 100644 index 000000000..41107e8ee --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js @@ -0,0 +1,97 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _collections = require('../collections'); + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +const asymmetricMatcher = + typeof Symbol === 'function' && Symbol.for + ? Symbol.for('jest.asymmetricMatcher') + : 0x1357a5; +const SPACE = ' '; + +const serialize = (val, config, indentation, depth, refs, printer) => { + const stringedValue = val.toString(); + + if ( + stringedValue === 'ArrayContaining' || + stringedValue === 'ArrayNotContaining' + ) { + if (++depth > config.maxDepth) { + return `[${stringedValue}]`; + } + + return `${stringedValue + SPACE}[${(0, _collections.printListItems)( + val.sample, + config, + indentation, + depth, + refs, + printer + )}]`; + } + + if ( + stringedValue === 'ObjectContaining' || + stringedValue === 'ObjectNotContaining' + ) { + if (++depth > config.maxDepth) { + return `[${stringedValue}]`; + } + + return `${stringedValue + SPACE}{${(0, _collections.printObjectProperties)( + val.sample, + config, + indentation, + depth, + refs, + printer + )}}`; + } + + if ( + stringedValue === 'StringMatching' || + stringedValue === 'StringNotMatching' + ) { + return ( + stringedValue + + SPACE + + printer(val.sample, config, indentation, depth, refs) + ); + } + + if ( + stringedValue === 'StringContaining' || + stringedValue === 'StringNotContaining' + ) { + return ( + stringedValue + + SPACE + + printer(val.sample, config, indentation, depth, refs) + ); + } + + if (typeof val.toAsymmetricMatcher !== 'function') { + throw new Error( + `Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()` + ); + } + + return val.toAsymmetricMatcher(); +}; + +exports.serialize = serialize; + +const test = val => val && val.$$typeof === asymmetricMatcher; + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/ConvertAnsi.js b/node_modules/expect/node_modules/pretty-format/build/plugins/ConvertAnsi.js new file mode 100644 index 000000000..c5edf00c1 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/ConvertAnsi.js @@ -0,0 +1,96 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _ansiRegex = _interopRequireDefault(require('ansi-regex')); + +var _ansiStyles = _interopRequireDefault(require('ansi-styles')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const toHumanReadableAnsi = text => + text.replace((0, _ansiRegex.default)(), match => { + switch (match) { + case _ansiStyles.default.red.close: + case _ansiStyles.default.green.close: + case _ansiStyles.default.cyan.close: + case _ansiStyles.default.gray.close: + case _ansiStyles.default.white.close: + case _ansiStyles.default.yellow.close: + case _ansiStyles.default.bgRed.close: + case _ansiStyles.default.bgGreen.close: + case _ansiStyles.default.bgYellow.close: + case _ansiStyles.default.inverse.close: + case _ansiStyles.default.dim.close: + case _ansiStyles.default.bold.close: + case _ansiStyles.default.reset.open: + case _ansiStyles.default.reset.close: + return ''; + + case _ansiStyles.default.red.open: + return ''; + + case _ansiStyles.default.green.open: + return ''; + + case _ansiStyles.default.cyan.open: + return ''; + + case _ansiStyles.default.gray.open: + return ''; + + case _ansiStyles.default.white.open: + return ''; + + case _ansiStyles.default.yellow.open: + return ''; + + case _ansiStyles.default.bgRed.open: + return ''; + + case _ansiStyles.default.bgGreen.open: + return ''; + + case _ansiStyles.default.bgYellow.open: + return ''; + + case _ansiStyles.default.inverse.open: + return ''; + + case _ansiStyles.default.dim.open: + return ''; + + case _ansiStyles.default.bold.open: + return ''; + + default: + return ''; + } + }); + +const test = val => + typeof val === 'string' && !!val.match((0, _ansiRegex.default)()); + +exports.test = test; + +const serialize = (val, config, indentation, depth, refs, printer) => + printer(toHumanReadableAnsi(val), config, indentation, depth, refs); + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/DOMCollection.js b/node_modules/expect/node_modules/pretty-format/build/plugins/DOMCollection.js new file mode 100644 index 000000000..69b958b94 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/DOMCollection.js @@ -0,0 +1,74 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _collections = require('../collections'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const SPACE = ' '; +const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap']; +const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/; + +const testName = name => + OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name); + +const test = val => + val && + val.constructor && + !!val.constructor.name && + testName(val.constructor.name); + +exports.test = test; + +const isNamedNodeMap = collection => + collection.constructor.name === 'NamedNodeMap'; + +const serialize = (collection, config, indentation, depth, refs, printer) => { + const name = collection.constructor.name; + + if (++depth > config.maxDepth) { + return `[${name}]`; + } + + return ( + (config.min ? '' : name + SPACE) + + (OBJECT_NAMES.indexOf(name) !== -1 + ? `{${(0, _collections.printObjectProperties)( + isNamedNodeMap(collection) + ? Array.from(collection).reduce((props, attribute) => { + props[attribute.name] = attribute.value; + return props; + }, {}) + : {...collection}, + config, + indentation, + depth, + refs, + printer + )}}` + : `[${(0, _collections.printListItems)( + Array.from(collection), + config, + indentation, + depth, + refs, + printer + )}]`) + ); +}; + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/DOMElement.js b/node_modules/expect/node_modules/pretty-format/build/plugins/DOMElement.js new file mode 100644 index 000000000..b9d30cec2 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/DOMElement.js @@ -0,0 +1,128 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _markup = require('./lib/markup'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const ELEMENT_NODE = 1; +const TEXT_NODE = 3; +const COMMENT_NODE = 8; +const FRAGMENT_NODE = 11; +const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/; + +const testHasAttribute = val => { + try { + return typeof val.hasAttribute === 'function' && val.hasAttribute('is'); + } catch { + return false; + } +}; + +const testNode = val => { + const constructorName = val.constructor.name; + const {nodeType, tagName} = val; + const isCustomElement = + (typeof tagName === 'string' && tagName.includes('-')) || + testHasAttribute(val); + return ( + (nodeType === ELEMENT_NODE && + (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) || + (nodeType === TEXT_NODE && constructorName === 'Text') || + (nodeType === COMMENT_NODE && constructorName === 'Comment') || + (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment') + ); +}; + +const test = val => { + var _val$constructor; + + return ( + (val === null || val === void 0 + ? void 0 + : (_val$constructor = val.constructor) === null || + _val$constructor === void 0 + ? void 0 + : _val$constructor.name) && testNode(val) + ); +}; + +exports.test = test; + +function nodeIsText(node) { + return node.nodeType === TEXT_NODE; +} + +function nodeIsComment(node) { + return node.nodeType === COMMENT_NODE; +} + +function nodeIsFragment(node) { + return node.nodeType === FRAGMENT_NODE; +} + +const serialize = (node, config, indentation, depth, refs, printer) => { + if (nodeIsText(node)) { + return (0, _markup.printText)(node.data, config); + } + + if (nodeIsComment(node)) { + return (0, _markup.printComment)(node.data, config); + } + + const type = nodeIsFragment(node) + ? 'DocumentFragment' + : node.tagName.toLowerCase(); + + if (++depth > config.maxDepth) { + return (0, _markup.printElementAsLeaf)(type, config); + } + + return (0, _markup.printElement)( + type, + (0, _markup.printProps)( + nodeIsFragment(node) + ? [] + : Array.from(node.attributes) + .map(attr => attr.name) + .sort(), + nodeIsFragment(node) + ? {} + : Array.from(node.attributes).reduce((props, attribute) => { + props[attribute.name] = attribute.value; + return props; + }, {}), + config, + indentation + config.indent, + depth, + refs, + printer + ), + (0, _markup.printChildren)( + Array.prototype.slice.call(node.childNodes || node.children), + config, + indentation + config.indent, + depth, + refs, + printer + ), + config, + indentation + ); +}; + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/Immutable.js b/node_modules/expect/node_modules/pretty-format/build/plugins/Immutable.js new file mode 100644 index 000000000..f3e1e6510 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/Immutable.js @@ -0,0 +1,230 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _collections = require('../collections'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// SENTINEL constants are from https://github.com/facebook/immutable-js +const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; +const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; +const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; +const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; +const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; +const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4 + +const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; +const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; +const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; + +const getImmutableName = name => `Immutable.${name}`; + +const printAsLeaf = name => `[${name}]`; + +const SPACE = ' '; +const LAZY = '…'; // Seq is lazy if it calls a method like filter + +const printImmutableEntries = ( + val, + config, + indentation, + depth, + refs, + printer, + type +) => + ++depth > config.maxDepth + ? printAsLeaf(getImmutableName(type)) + : `${getImmutableName(type) + SPACE}{${(0, + _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer + )}}`; // Record has an entries method because it is a collection in immutable v3. +// Return an iterator for Immutable Record from version v3 or v4. + +function getRecordEntries(val) { + let i = 0; + return { + next() { + if (i < val._keys.length) { + const key = val._keys[i++]; + return { + done: false, + value: [key, val.get(key)] + }; + } + + return { + done: true, + value: undefined + }; + } + }; +} + +const printImmutableRecord = ( + val, + config, + indentation, + depth, + refs, + printer +) => { + // _name property is defined only for an Immutable Record instance + // which was constructed with a second optional descriptive name arg + const name = getImmutableName(val._name || 'Record'); + return ++depth > config.maxDepth + ? printAsLeaf(name) + : `${name + SPACE}{${(0, _collections.printIteratorEntries)( + getRecordEntries(val), + config, + indentation, + depth, + refs, + printer + )}}`; +}; + +const printImmutableSeq = (val, config, indentation, depth, refs, printer) => { + const name = getImmutableName('Seq'); + + if (++depth > config.maxDepth) { + return printAsLeaf(name); + } + + if (val[IS_KEYED_SENTINEL]) { + return `${name + SPACE}{${ + // from Immutable collection of entries or from ECMAScript object + val._iter || val._object + ? (0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer + ) + : LAZY + }}`; + } + + return `${name + SPACE}[${ + val._iter || // from Immutable collection of values + val._array || // from ECMAScript array + val._collection || // from ECMAScript collection in immutable v4 + val._iterable // from ECMAScript collection in immutable v3 + ? (0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + ) + : LAZY + }]`; +}; + +const printImmutableValues = ( + val, + config, + indentation, + depth, + refs, + printer, + type +) => + ++depth > config.maxDepth + ? printAsLeaf(getImmutableName(type)) + : `${getImmutableName(type) + SPACE}[${(0, + _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + )}]`; + +const serialize = (val, config, indentation, depth, refs, printer) => { + if (val[IS_MAP_SENTINEL]) { + return printImmutableEntries( + val, + config, + indentation, + depth, + refs, + printer, + val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map' + ); + } + + if (val[IS_LIST_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + 'List' + ); + } + + if (val[IS_SET_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set' + ); + } + + if (val[IS_STACK_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + 'Stack' + ); + } + + if (val[IS_SEQ_SENTINEL]) { + return printImmutableSeq(val, config, indentation, depth, refs, printer); + } // For compatibility with immutable v3 and v4, let record be the default. + + return printImmutableRecord(val, config, indentation, depth, refs, printer); +}; // Explicitly comparing sentinel properties to true avoids false positive +// when mock identity-obj-proxy returns the key as the value for any key. + +exports.serialize = serialize; + +const test = val => + val && + (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true); + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/ReactElement.js b/node_modules/expect/node_modules/pretty-format/build/plugins/ReactElement.js new file mode 100644 index 000000000..96325765b --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/ReactElement.js @@ -0,0 +1,164 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var ReactIs = _interopRequireWildcard(require('react-is')); + +var _markup = require('./lib/markup'); + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Given element.props.children, or subtree during recursive traversal, +// return flattened array of children. +const getChildren = (arg, children = []) => { + if (Array.isArray(arg)) { + arg.forEach(item => { + getChildren(item, children); + }); + } else if (arg != null && arg !== false) { + children.push(arg); + } + + return children; +}; + +const getType = element => { + const type = element.type; + + if (typeof type === 'string') { + return type; + } + + if (typeof type === 'function') { + return type.displayName || type.name || 'Unknown'; + } + + if (ReactIs.isFragment(element)) { + return 'React.Fragment'; + } + + if (ReactIs.isSuspense(element)) { + return 'React.Suspense'; + } + + if (typeof type === 'object' && type !== null) { + if (ReactIs.isContextProvider(element)) { + return 'Context.Provider'; + } + + if (ReactIs.isContextConsumer(element)) { + return 'Context.Consumer'; + } + + if (ReactIs.isForwardRef(element)) { + if (type.displayName) { + return type.displayName; + } + + const functionName = type.render.displayName || type.render.name || ''; + return functionName !== '' ? `ForwardRef(${functionName})` : 'ForwardRef'; + } + + if (ReactIs.isMemo(element)) { + const functionName = + type.displayName || type.type.displayName || type.type.name || ''; + return functionName !== '' ? `Memo(${functionName})` : 'Memo'; + } + } + + return 'UNDEFINED'; +}; + +const getPropKeys = element => { + const {props} = element; + return Object.keys(props) + .filter(key => key !== 'children' && props[key] !== undefined) + .sort(); +}; + +const serialize = (element, config, indentation, depth, refs, printer) => + ++depth > config.maxDepth + ? (0, _markup.printElementAsLeaf)(getType(element), config) + : (0, _markup.printElement)( + getType(element), + (0, _markup.printProps)( + getPropKeys(element), + element.props, + config, + indentation + config.indent, + depth, + refs, + printer + ), + (0, _markup.printChildren)( + getChildren(element.props.children), + config, + indentation + config.indent, + depth, + refs, + printer + ), + config, + indentation + ); + +exports.serialize = serialize; + +const test = val => val != null && ReactIs.isElement(val); + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/ReactTestComponent.js b/node_modules/expect/node_modules/pretty-format/build/plugins/ReactTestComponent.js new file mode 100644 index 000000000..fcdcfd79b --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/ReactTestComponent.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _markup = require('./lib/markup'); + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +const testSymbol = + typeof Symbol === 'function' && Symbol.for + ? Symbol.for('react.test.json') + : 0xea71357; + +const getPropKeys = object => { + const {props} = object; + return props + ? Object.keys(props) + .filter(key => props[key] !== undefined) + .sort() + : []; +}; + +const serialize = (object, config, indentation, depth, refs, printer) => + ++depth > config.maxDepth + ? (0, _markup.printElementAsLeaf)(object.type, config) + : (0, _markup.printElement)( + object.type, + object.props + ? (0, _markup.printProps)( + getPropKeys(object), + object.props, + config, + indentation + config.indent, + depth, + refs, + printer + ) + : '', + object.children + ? (0, _markup.printChildren)( + object.children, + config, + indentation + config.indent, + depth, + refs, + printer + ) + : '', + config, + indentation + ); + +exports.serialize = serialize; + +const test = val => val && val.$$typeof === testSymbol; + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/lib/escapeHTML.js b/node_modules/expect/node_modules/pretty-format/build/plugins/lib/escapeHTML.js new file mode 100644 index 000000000..50dda2590 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/lib/escapeHTML.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = escapeHTML; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function escapeHTML(str) { + return str.replace(//g, '>'); +} diff --git a/node_modules/expect/node_modules/pretty-format/build/plugins/lib/markup.js b/node_modules/expect/node_modules/pretty-format/build/plugins/lib/markup.js new file mode 100644 index 000000000..3eeda6d4c --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/plugins/lib/markup.js @@ -0,0 +1,125 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printText = + exports.printProps = + exports.printElementAsLeaf = + exports.printElement = + exports.printComment = + exports.printChildren = + void 0; + +var _escapeHTML = _interopRequireDefault(require('./escapeHTML')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Return empty string if keys is empty. +const printProps = (keys, props, config, indentation, depth, refs, printer) => { + const indentationNext = indentation + config.indent; + const colors = config.colors; + return keys + .map(key => { + const value = props[key]; + let printed = printer(value, config, indentationNext, depth, refs); + + if (typeof value !== 'string') { + if (printed.indexOf('\n') !== -1) { + printed = + config.spacingOuter + + indentationNext + + printed + + config.spacingOuter + + indentation; + } + + printed = `{${printed}}`; + } + + return `${ + config.spacingInner + + indentation + + colors.prop.open + + key + + colors.prop.close + }=${colors.value.open}${printed}${colors.value.close}`; + }) + .join(''); +}; // Return empty string if children is empty. + +exports.printProps = printProps; + +const printChildren = (children, config, indentation, depth, refs, printer) => + children + .map( + child => + config.spacingOuter + + indentation + + (typeof child === 'string' + ? printText(child, config) + : printer(child, config, indentation, depth, refs)) + ) + .join(''); + +exports.printChildren = printChildren; + +const printText = (text, config) => { + const contentColor = config.colors.content; + return ( + contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close + ); +}; + +exports.printText = printText; + +const printComment = (comment, config) => { + const commentColor = config.colors.comment; + return `${commentColor.open}${ + commentColor.close + }`; +}; // Separate the functions to format props, children, and element, +// so a plugin could override a particular function, if needed. +// Too bad, so sad: the traditional (but unnecessary) space +// in a self-closing tagColor requires a second test of printedProps. + +exports.printComment = printComment; + +const printElement = ( + type, + printedProps, + printedChildren, + config, + indentation +) => { + const tagColor = config.colors.tag; + return `${tagColor.open}<${type}${ + printedProps && + tagColor.close + + printedProps + + config.spacingOuter + + indentation + + tagColor.open + }${ + printedChildren + ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}${tagColor.close}`; +}; + +exports.printElement = printElement; + +const printElementAsLeaf = (type, config) => { + const tagColor = config.colors.tag; + return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`; +}; + +exports.printElementAsLeaf = printElementAsLeaf; diff --git a/node_modules/expect/node_modules/pretty-format/build/types.js b/node_modules/expect/node_modules/pretty-format/build/types.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/expect/node_modules/pretty-format/package.json b/node_modules/expect/node_modules/pretty-format/package.json new file mode 100644 index 000000000..07ca91691 --- /dev/null +++ b/node_modules/expect/node_modules/pretty-format/package.json @@ -0,0 +1,46 @@ +{ + "name": "pretty-format", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/pretty-format" + }, + "license": "MIT", + "description": "Stringify any JavaScript value.", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json", + "./ConvertAnsi": "./build/plugins/ConvertAnsi.js" + }, + "author": "James Kyle ", + "dependencies": { + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "devDependencies": { + "@types/react": "^17.0.3", + "@types/react-is": "^17.0.0", + "@types/react-test-renderer": "17.0.2", + "expect": "^28.0.1", + "immutable": "^4.0.0", + "jest-util": "^28.0.1", + "react": "17.0.2", + "react-dom": "^17.0.1", + "react-test-renderer": "17.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/expect/node_modules/react-is/LICENSE b/node_modules/expect/node_modules/react-is/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/expect/node_modules/react-is/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/expect/node_modules/react-is/README.md b/node_modules/expect/node_modules/react-is/README.md new file mode 100644 index 000000000..d25597761 --- /dev/null +++ b/node_modules/expect/node_modules/react-is/README.md @@ -0,0 +1,104 @@ +# `react-is` + +This package allows you to test arbitrary values and see if they're a particular React element type. + +## Installation + +```sh +# Yarn +yarn add react-is + +# NPM +npm install react-is +``` + +## Usage + +### Determining if a Component is Valid + +```js +import React from "react"; +import * as ReactIs from "react-is"; + +class ClassComponent extends React.Component { + render() { + return React.createElement("div"); + } +} + +const FunctionComponent = () => React.createElement("div"); + +const ForwardRefComponent = React.forwardRef((props, ref) => + React.createElement(Component, { forwardedRef: ref, ...props }) +); + +const Context = React.createContext(false); + +ReactIs.isValidElementType("div"); // true +ReactIs.isValidElementType(ClassComponent); // true +ReactIs.isValidElementType(FunctionComponent); // true +ReactIs.isValidElementType(ForwardRefComponent); // true +ReactIs.isValidElementType(Context.Provider); // true +ReactIs.isValidElementType(Context.Consumer); // true +ReactIs.isValidElementType(React.createFactory("div")); // true +``` + +### Determining an Element's Type + +#### Context + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +const ThemeContext = React.createContext("blue"); + +ReactIs.isContextConsumer(); // true +ReactIs.isContextProvider(); // true +ReactIs.typeOf() === ReactIs.ContextProvider; // true +ReactIs.typeOf() === ReactIs.ContextConsumer; // true +``` + +#### Element + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isElement(
); // true +ReactIs.typeOf(
) === ReactIs.Element; // true +``` + +#### Fragment + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isFragment(<>); // true +ReactIs.typeOf(<>) === ReactIs.Fragment; // true +``` + +#### Portal + +```js +import React from "react"; +import ReactDOM from "react-dom"; +import * as ReactIs from 'react-is'; + +const div = document.createElement("div"); +const portal = ReactDOM.createPortal(
, div); + +ReactIs.isPortal(portal); // true +ReactIs.typeOf(portal) === ReactIs.Portal; // true +``` + +#### StrictMode + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isStrictMode(); // true +ReactIs.typeOf() === ReactIs.StrictMode; // true +``` diff --git a/node_modules/expect/node_modules/react-is/cjs/react-is.development.js b/node_modules/expect/node_modules/react-is/cjs/react-is.development.js new file mode 100644 index 000000000..4cefe6be8 --- /dev/null +++ b/node_modules/expect/node_modules/react-is/cjs/react-is.development.js @@ -0,0 +1,216 @@ +/** + * @license React + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// ATTENTION +// When adding new symbols to this file, +// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' +// The Symbol used to tag the ReactElement-like types. +var REACT_ELEMENT_TYPE = Symbol.for('react.element'); +var REACT_PORTAL_TYPE = Symbol.for('react.portal'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); +var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); +var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); +var REACT_CONTEXT_TYPE = Symbol.for('react.context'); +var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); +var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); +var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); +var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); +var REACT_MEMO_TYPE = Symbol.for('react.memo'); +var REACT_LAZY_TYPE = Symbol.for('react.lazy'); +var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); + +// ----------------------------------------------------------------------------- + +var enableScopeAPI = false; // Experimental Create Event Handle API. +var enableCacheElement = false; +var enableTransitionTracing = false; // No known bugs, but needs performance testing + +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber +// stuff. Intended to enable React core members to more easily debug scheduling +// issues in DEV builds. + +var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + +var REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); +function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var SuspenseList = REACT_SUSPENSE_LIST_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; +var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; +} +function isConcurrentMode(object) { + { + if (!hasWarnedAboutDeprecatedIsConcurrentMode) { + hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} +function isSuspenseList(object) { + return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; +} + +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.SuspenseList = SuspenseList; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isSuspenseList = isSuspenseList; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} diff --git a/node_modules/expect/node_modules/react-is/cjs/react-is.production.min.js b/node_modules/expect/node_modules/react-is/cjs/react-is.production.min.js new file mode 100644 index 000000000..239f2f33c --- /dev/null +++ b/node_modules/expect/node_modules/react-is/cjs/react-is.production.min.js @@ -0,0 +1,14 @@ +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u=Symbol.for("react.module.reference"); +function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m; +exports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p}; +exports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v; diff --git a/node_modules/expect/node_modules/react-is/index.js b/node_modules/expect/node_modules/react-is/index.js new file mode 100644 index 000000000..3ae098d07 --- /dev/null +++ b/node_modules/expect/node_modules/react-is/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} diff --git a/node_modules/expect/node_modules/react-is/package.json b/node_modules/expect/node_modules/react-is/package.json new file mode 100644 index 000000000..333426d6e --- /dev/null +++ b/node_modules/expect/node_modules/react-is/package.json @@ -0,0 +1,26 @@ +{ + "name": "react-is", + "version": "18.0.0", + "description": "Brand checking of React Elements.", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react-is" + }, + "keywords": [ + "react" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/facebook/react/issues" + }, + "homepage": "https://reactjs.org/", + "files": [ + "LICENSE", + "README.md", + "index.js", + "cjs/", + "umd/" + ] +} \ No newline at end of file diff --git a/node_modules/expect/node_modules/react-is/umd/react-is.development.js b/node_modules/expect/node_modules/react-is/umd/react-is.development.js new file mode 100644 index 000000000..b56b5adb5 --- /dev/null +++ b/node_modules/expect/node_modules/react-is/umd/react-is.development.js @@ -0,0 +1,215 @@ +/** + * @license React + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.ReactIs = {})); +}(this, (function (exports) { 'use strict'; + + // ATTENTION + // When adding new symbols to this file, + // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' + // The Symbol used to tag the ReactElement-like types. + var REACT_ELEMENT_TYPE = Symbol.for('react.element'); + var REACT_PORTAL_TYPE = Symbol.for('react.portal'); + var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); + var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); + var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); + var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); + var REACT_CONTEXT_TYPE = Symbol.for('react.context'); + var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); + var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); + var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); + var REACT_MEMO_TYPE = Symbol.for('react.memo'); + var REACT_LAZY_TYPE = Symbol.for('react.lazy'); + var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); + + // ----------------------------------------------------------------------------- + + var enableScopeAPI = false; // Experimental Create Event Handle API. + var enableCacheElement = false; + var enableTransitionTracing = false; // No known bugs, but needs performance testing + + var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber + // stuff. Intended to enable React core members to more easily debug scheduling + // issues in DEV builds. + + var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + + var REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); + function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; + } + + function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; + } + var ContextConsumer = REACT_CONTEXT_TYPE; + var ContextProvider = REACT_PROVIDER_TYPE; + var Element = REACT_ELEMENT_TYPE; + var ForwardRef = REACT_FORWARD_REF_TYPE; + var Fragment = REACT_FRAGMENT_TYPE; + var Lazy = REACT_LAZY_TYPE; + var Memo = REACT_MEMO_TYPE; + var Portal = REACT_PORTAL_TYPE; + var Profiler = REACT_PROFILER_TYPE; + var StrictMode = REACT_STRICT_MODE_TYPE; + var Suspense = REACT_SUSPENSE_TYPE; + var SuspenseList = REACT_SUSPENSE_LIST_TYPE; + var hasWarnedAboutDeprecatedIsAsyncMode = false; + var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated + + function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; + } + function isConcurrentMode(object) { + { + if (!hasWarnedAboutDeprecatedIsConcurrentMode) { + hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + function isSuspenseList(object) { + return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; + } + + exports.ContextConsumer = ContextConsumer; + exports.ContextProvider = ContextProvider; + exports.Element = Element; + exports.ForwardRef = ForwardRef; + exports.Fragment = Fragment; + exports.Lazy = Lazy; + exports.Memo = Memo; + exports.Portal = Portal; + exports.Profiler = Profiler; + exports.StrictMode = StrictMode; + exports.Suspense = Suspense; + exports.SuspenseList = SuspenseList; + exports.isAsyncMode = isAsyncMode; + exports.isConcurrentMode = isConcurrentMode; + exports.isContextConsumer = isContextConsumer; + exports.isContextProvider = isContextProvider; + exports.isElement = isElement; + exports.isForwardRef = isForwardRef; + exports.isFragment = isFragment; + exports.isLazy = isLazy; + exports.isMemo = isMemo; + exports.isPortal = isPortal; + exports.isProfiler = isProfiler; + exports.isStrictMode = isStrictMode; + exports.isSuspense = isSuspense; + exports.isSuspenseList = isSuspenseList; + exports.isValidElementType = isValidElementType; + exports.typeOf = typeOf; + +}))); diff --git a/node_modules/expect/node_modules/react-is/umd/react-is.production.min.js b/node_modules/expect/node_modules/react-is/umd/react-is.production.min.js new file mode 100644 index 000000000..3a88bc263 --- /dev/null +++ b/node_modules/expect/node_modules/react-is/umd/react-is.production.min.js @@ -0,0 +1,15 @@ +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +(function(){'use strict';(function(b,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):(b=b||self,c(b.ReactIs={}))})(this,function(b){function c(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case q:switch(a=a.type,a){case d:case e:case f:case g:case h:return a;default:switch(a=a&&a.$$typeof,a){case t:case k:case l:case m:case n:case p:return a;default:return b}}case r:return b}}}var q=Symbol.for("react.element"), +r=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),e=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),k=Symbol.for("react.context"),t=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),u=Symbol.for("react.offscreen"),v=Symbol.for("react.module.reference");b.ContextConsumer=k;b.ContextProvider=p;b.Element=q; +b.ForwardRef=l;b.Fragment=d;b.Lazy=m;b.Memo=n;b.Portal=r;b.Profiler=e;b.StrictMode=f;b.Suspense=g;b.SuspenseList=h;b.isAsyncMode=function(a){return!1};b.isConcurrentMode=function(a){return!1};b.isContextConsumer=function(a){return c(a)===k};b.isContextProvider=function(a){return c(a)===p};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===q};b.isForwardRef=function(a){return c(a)===l};b.isFragment=function(a){return c(a)===d};b.isLazy=function(a){return c(a)===m};b.isMemo=function(a){return c(a)=== +n};b.isPortal=function(a){return c(a)===r};b.isProfiler=function(a){return c(a)===e};b.isStrictMode=function(a){return c(a)===f};b.isSuspense=function(a){return c(a)===g};b.isSuspenseList=function(a){return c(a)===h};b.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===e||a===f||a===g||a===h||a===u||"object"===typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===n||a.$$typeof===p||a.$$typeof===k||a.$$typeof===l||a.$$typeof===v||void 0!==a.getModuleId)?!0:!1}; +b.typeOf=c}); +})(); diff --git a/node_modules/expect/package.json b/node_modules/expect/package.json index 3b0102eb4..12bbe35a6 100644 --- a/node_modules/expect/package.json +++ b/node_modules/expect/package.json @@ -1,6 +1,6 @@ { "name": "expect", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -15,28 +15,28 @@ "default": "./build/index.js" }, "./package.json": "./package.json", - "./build/utils": "./build/utils.js", "./build/matchers": "./build/matchers.js" }, "dependencies": { - "@jest/types": "^27.5.1", - "jest-get-type": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1" + "@jest/expect-utils": "^28.0.1", + "jest-get-type": "^28.0.0", + "jest-matcher-utils": "^28.0.1", + "jest-message-util": "^28.0.1", + "jest-util": "^28.0.1" }, "devDependencies": { - "@jest/test-utils": "^27.5.1", - "@tsd/typescript": "~4.1.5", + "@jest/test-utils": "^28.0.1", + "@tsd/typescript": "~4.6.2", "chalk": "^4.0.0", "fast-check": "^2.0.0", "immutable": "^4.0.0", "tsd-lite": "^0.5.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/graceful-fs/LICENSE b/node_modules/graceful-fs/LICENSE index 9d2c80369..e906a25ac 100644 --- a/node_modules/graceful-fs/LICENSE +++ b/node_modules/graceful-fs/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/graceful-fs/README.md b/node_modules/graceful-fs/README.md index 5273a50ad..82d6e4daf 100644 --- a/node_modules/graceful-fs/README.md +++ b/node_modules/graceful-fs/README.md @@ -30,9 +30,19 @@ the directory. var fs = require('graceful-fs') // now go and do stuff with it... -fs.readFileSync('some-file-or-whatever') +fs.readFile('some-file-or-whatever', (err, data) => { + // Do stuff here. +}) ``` +## Sync methods + +This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync +methods. If you use sync methods which open file descriptors then you are +responsible for dealing with any errors. + +This is a known limitation, not a bug. + ## Global Patching If you want to patch the global fs module (or any other fs-like diff --git a/node_modules/graceful-fs/clone.js b/node_modules/graceful-fs/clone.js index 028356c96..dff3cc8c5 100644 --- a/node_modules/graceful-fs/clone.js +++ b/node_modules/graceful-fs/clone.js @@ -2,12 +2,16 @@ module.exports = clone +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + function clone (obj) { if (obj === null || typeof obj !== 'object') return obj if (obj instanceof Object) - var copy = { __proto__: obj.__proto__ } + var copy = { __proto__: getPrototypeOf(obj) } else var copy = Object.create(null) diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js index de3df47fd..8d5b89e4f 100644 --- a/node_modules/graceful-fs/graceful-fs.js +++ b/node_modules/graceful-fs/graceful-fs.js @@ -54,7 +54,7 @@ if (!fs[gracefulQueue]) { return fs$close.call(fs, fd, function (err) { // This function uses the graceful-fs shared queue if (!err) { - retry() + resetQueue() } if (typeof cb === 'function') @@ -72,7 +72,7 @@ if (!fs[gracefulQueue]) { function closeSync (fd) { // This function uses the graceful-fs shared queue fs$closeSync.apply(fs, arguments) - retry() + resetQueue() } Object.defineProperty(closeSync, previousSymbol, { @@ -114,14 +114,13 @@ function patch (fs) { return go$readFile(path, options, cb) - function go$readFile (path, options, cb) { + function go$readFile (path, options, cb, startTime) { return fs$readFile(path, options, function (err) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb]]) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -135,14 +134,13 @@ function patch (fs) { return go$writeFile(path, data, options, cb) - function go$writeFile (path, data, options, cb) { + function go$writeFile (path, data, options, cb, startTime) { return fs$writeFile(path, data, options, function (err) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb]]) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -157,14 +155,35 @@ function patch (fs) { return go$appendFile(path, data, options, cb) - function go$appendFile (path, data, options, cb) { + function go$appendFile (path, data, options, cb, startTime) { return fs$appendFile(path, data, options, function (err) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb]]) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -172,36 +191,46 @@ function patch (fs) { var fs$readdir = fs.readdir fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ function readdir (path, options, cb) { - var args = [path] - if (typeof options !== 'function') { - args.push(options) - } else { - cb = options - } - args.push(go$readdir$cb) + if (typeof options === 'function') + cb = options, options = null - return go$readdir(args) + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } - function go$readdir$cb (err, files) { - if (files && files.sort) - files.sort() + return go$readdir(path, options, cb) - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [args]]) + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) + else { + if (files && files.sort) + files.sort() - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() + if (typeof cb === 'function') + cb.call(this, err, files) + } } } } - function go$readdir (args) { - return fs$readdir.apply(fs, args) - } - if (process.version.substr(0, 4) === 'v0.8') { var legStreams = legacy(fs) ReadStream = legStreams.ReadStream @@ -324,14 +353,13 @@ function patch (fs) { return go$open(path, flags, mode, cb) - function go$open (path, flags, mode, cb) { + function go$open (path, flags, mode, cb, startTime) { return fs$open(path, flags, mode, function (err, fd) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb]]) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -343,12 +371,78 @@ function patch (fs) { function enqueue (elem) { debug('ENQUEUE', elem[0].name, elem[1]) fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() } function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + var elem = fs[gracefulQueue].shift() - if (elem) { - debug('RETRY', elem[0].name, elem[1]) - elem[0].apply(null, elem[1]) + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) } } diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index 0a56eb73f..305785687 100644 --- a/node_modules/graceful-fs/package.json +++ b/node_modules/graceful-fs/package.json @@ -1,7 +1,7 @@ { "name": "graceful-fs", "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.4", + "version": "4.2.10", "repository": { "type": "git", "url": "https://github.com/isaacs/node-graceful-fs" @@ -14,7 +14,8 @@ "preversion": "npm test", "postversion": "npm publish", "postpublish": "git push origin --follow-tags", - "test": "node test.js | tap -" + "test": "nyc --silent node test.js | tap -c -", + "posttest": "nyc report" }, "keywords": [ "fs", @@ -45,6 +46,5 @@ "legacy-streams.js", "polyfills.js", "clone.js" - ], - "dependencies": {} + ] } diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js index a5808d23f..46dea36cc 100644 --- a/node_modules/graceful-fs/polyfills.js +++ b/node_modules/graceful-fs/polyfills.js @@ -14,10 +14,14 @@ try { process.cwd() } catch (er) {} -var chdir = process.chdir -process.chdir = function(d) { - cwd = null - chdir.call(process, d) +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) } module.exports = patch @@ -67,13 +71,13 @@ function patch (fs) { fs.lstatSync = statFixSync(fs.lstatSync) // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { + if (fs.chmod && !fs.lchmod) { fs.lchmod = function (path, mode, cb) { if (cb) process.nextTick(cb) } fs.lchmodSync = function () {} } - if (!fs.lchown) { + if (fs.chown && !fs.lchown) { fs.lchown = function (path, uid, gid, cb) { if (cb) process.nextTick(cb) } @@ -90,32 +94,38 @@ function patch (fs) { // CPU to a busy looping process, which can cause the program causing the lock // contention to be starved of CPU by node, so the contention doesn't resolve. if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) } // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { function read (fd, buffer, offset, length, position, callback_) { var callback if (callback_ && typeof callback_ === 'function') { @@ -132,11 +142,12 @@ function patch (fs) { } // This ensures `util.promisify` works as it does for native `fs.read`. - read.__proto__ = fs$read + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) return read })(fs.read) - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { var eagCounter = 0 while (true) { try { @@ -195,7 +206,7 @@ function patch (fs) { } function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { fs.lutimes = function (path, at, mt, cb) { fs.open(path, constants.O_SYMLINK, function (er, fd) { if (er) { @@ -229,7 +240,7 @@ function patch (fs) { return ret } - } else { + } else if (fs.futimes) { fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } fs.lutimesSync = function () {} } @@ -306,8 +317,10 @@ function patch (fs) { return function (target, options) { var stats = options ? orig.call(fs, target, options) : orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } return stats; } } diff --git a/node_modules/istanbul-lib-coverage/CHANGELOG.md b/node_modules/istanbul-lib-coverage/CHANGELOG.md index f1c3d1652..172546b20 100644 --- a/node_modules/istanbul-lib-coverage/CHANGELOG.md +++ b/node_modules/istanbul-lib-coverage/CHANGELOG.md @@ -46,6 +46,34 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline +## [3.2.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.1.0...istanbul-lib-coverage-v3.2.0) (2021-10-17) + + +### Features + +* allow FileCoverage to be initialized with logical tracking ([#644](https://www.github.com/istanbuljs/istanbuljs/issues/644)) ([4cb5af1](https://www.github.com/istanbuljs/istanbuljs/commit/4cb5af1daaf33c3e9a5f3ee44f6bb7f958e5ba04)) + +## [3.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.2...istanbul-lib-coverage-v3.1.0) (2021-10-17) + + +### Features + +* support tracking Logic Truthiness as additional metric in coverage API ([#639](https://www.github.com/istanbuljs/istanbuljs/issues/639)) ([0967c80](https://www.github.com/istanbuljs/istanbuljs/commit/0967c80b905c3c17675ff2185b2325784e8dc0a2)) + +### [3.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.1...istanbul-lib-coverage-v3.0.2) (2021-10-11) + + +### Bug Fixes + +* handle merging '0' indexed coverage with '1' indexed coverage ([5dac2bc](https://www.github.com/istanbuljs/istanbuljs/commit/5dac2bcf28d6f27dbb720be72c2b692153418ab5)), closes [#632](https://www.github.com/istanbuljs/istanbuljs/issues/632) + +### [3.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.0...istanbul-lib-coverage-v3.0.1) (2021-09-23) + + +### Bug Fixes + +* merge branch/statement/functionMap's together when merging two coverage reports ([#617](https://www.github.com/istanbuljs/istanbuljs/issues/617)) ([ff1b5e9](https://www.github.com/istanbuljs/istanbuljs/commit/ff1b5e915201e4ff8f737010509bab98d8238118)) + ## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.4...istanbul-lib-coverage@2.0.5) (2019-04-24) **Note:** Version bump only for package istanbul-lib-coverage diff --git a/node_modules/istanbul-lib-coverage/lib/coverage-summary.js b/node_modules/istanbul-lib-coverage/lib/coverage-summary.js index 51e7b64b2..9b769c66a 100644 --- a/node_modules/istanbul-lib-coverage/lib/coverage-summary.js +++ b/node_modules/istanbul-lib-coverage/lib/coverage-summary.js @@ -19,7 +19,8 @@ function blankSummary() { lines: empty(), statements: empty(), functions: empty(), - branches: empty() + branches: empty(), + branchesTrue: empty() }; } @@ -63,12 +64,20 @@ class CoverageSummary { * @param {CoverageSummary} obj - another coverage summary object */ merge(obj) { - const keys = ['lines', 'statements', 'branches', 'functions']; + const keys = [ + 'lines', + 'statements', + 'branches', + 'functions', + 'branchesTrue' + ]; keys.forEach(key => { - this[key].total += obj[key].total; - this[key].covered += obj[key].covered; - this[key].skipped += obj[key].skipped; - this[key].pct = percent(this[key].covered, this[key].total); + if (obj[key]) { + this[key].total += obj[key].total; + this[key].covered += obj[key].covered; + this[key].skipped += obj[key].skipped; + this[key].pct = percent(this[key].covered, this[key].total); + } }); return this; @@ -94,7 +103,8 @@ dataProperties(CoverageSummary, [ 'lines', 'statements', 'functions', - 'branches' + 'branches', + 'branchesTrue' ]); module.exports = { diff --git a/node_modules/istanbul-lib-coverage/lib/file-coverage.js b/node_modules/istanbul-lib-coverage/lib/file-coverage.js index ed056a6f3..80a36ab55 100644 --- a/node_modules/istanbul-lib-coverage/lib/file-coverage.js +++ b/node_modules/istanbul-lib-coverage/lib/file-coverage.js @@ -9,8 +9,8 @@ const dataProperties = require('./data-properties'); const { CoverageSummary } = require('./coverage-summary'); // returns a data object that represents empty coverage -function emptyCoverage(filePath) { - return { +function emptyCoverage(filePath, reportLogic) { + const cov = { path: filePath, statementMap: {}, fnMap: {}, @@ -19,6 +19,8 @@ function emptyCoverage(filePath) { f: {}, b: {} }; + if (reportLogic) cov.bT = {}; + return cov; } // asserts that a data object "looks like" a coverage object @@ -40,6 +42,45 @@ function assertValidObject(obj) { } } +const keyFromLoc = ({ start, end }) => + `${start.line}|${start.column}|${end.line}|${end.column}`; + +const mergeProp = (aHits, aMap, bHits, bMap, itemKey = keyFromLoc) => { + const aItems = {}; + for (const [key, itemHits] of Object.entries(aHits)) { + const item = aMap[key]; + aItems[itemKey(item)] = [itemHits, item]; + } + for (const [key, bItemHits] of Object.entries(bHits)) { + const bItem = bMap[key]; + const k = itemKey(bItem); + + if (aItems[k]) { + const aPair = aItems[k]; + if (bItemHits.forEach) { + // should this throw an exception if aPair[0] is not an array? + bItemHits.forEach((hits, h) => { + if (aPair[0][h] !== undefined) aPair[0][h] += hits; + else aPair[0][h] = hits; + }); + } else { + aPair[0] += bItemHits; + } + } else { + aItems[k] = [bItemHits, bItem]; + } + } + const hits = {}; + const map = {}; + + Object.values(aItems).forEach(([itemHits, item], i) => { + hits[i] = itemHits; + map[i] = item; + }); + + return [hits, map]; +}; + /** * provides a read-only view of coverage for a single file. * The deep structure of this object is documented elsewhere. It has the following @@ -60,14 +101,14 @@ class FileCoverage { * and empty coverage object with the specified file path or a data object that * has all the required properties for a file coverage object. */ - constructor(pathOrObj) { + constructor(pathOrObj, reportLogic = false) { if (!pathOrObj) { throw new Error( 'Coverage must be initialized with a path or an object' ); } if (typeof pathOrObj === 'string') { - this.data = emptyCoverage(pathOrObj); + this.data = emptyCoverage(pathOrObj, reportLogic); } else if (pathOrObj instanceof FileCoverage) { this.data = pathOrObj.data; } else if (typeof pathOrObj === 'object') { @@ -166,24 +207,50 @@ class FileCoverage { return; } - Object.entries(other.s).forEach(([k, v]) => { - this.data.s[k] += v; - }); - Object.entries(other.f).forEach(([k, v]) => { - this.data.f[k] += v; - }); - Object.entries(other.b).forEach(([k, v]) => { - let i; - const retArray = this.data.b[k]; - /* istanbul ignore if: is this even possible? */ - if (!retArray) { - this.data.b[k] = v; - return; - } - for (i = 0; i < retArray.length; i += 1) { - retArray[i] += v[i]; - } - }); + let [hits, map] = mergeProp( + this.s, + this.statementMap, + other.s, + other.statementMap + ); + this.data.s = hits; + this.data.statementMap = map; + + const keyFromLocProp = x => keyFromLoc(x.loc); + const keyFromLocationsProp = x => keyFromLoc(x.locations[0]); + + [hits, map] = mergeProp( + this.f, + this.fnMap, + other.f, + other.fnMap, + keyFromLocProp + ); + this.data.f = hits; + this.data.fnMap = map; + + [hits, map] = mergeProp( + this.b, + this.branchMap, + other.b, + other.branchMap, + keyFromLocationsProp + ); + this.data.b = hits; + this.data.branchMap = map; + + // Tracking additional information about branch truthiness + // can be optionally enabled: + if (this.bT && other.bT) { + [hits, map] = mergeProp( + this.bT, + this.branchMap, + other.bT, + other.branchMap, + keyFromLocationsProp + ); + this.data.bT = hits; + } } computeSimpleTotals(property) { @@ -202,8 +269,8 @@ class FileCoverage { return ret; } - computeBranchTotals() { - const stats = this.b; + computeBranchTotals(property) { + const stats = this[property]; const ret = { total: 0, covered: 0, skipped: 0 }; Object.values(stats).forEach(branches => { @@ -222,6 +289,7 @@ class FileCoverage { const statements = this.s; const functions = this.f; const branches = this.b; + const branchesTrue = this.bT; Object.keys(statements).forEach(s => { statements[s] = 0; }); @@ -231,6 +299,13 @@ class FileCoverage { Object.keys(branches).forEach(b => { branches[b].fill(0); }); + // Tracking additional information about branch truthiness + // can be optionally enabled: + if (branchesTrue) { + Object.keys(branchesTrue).forEach(bT => { + branchesTrue[bT].fill(0); + }); + } } /** @@ -242,7 +317,12 @@ class FileCoverage { ret.lines = this.computeSimpleTotals('getLineCoverage'); ret.functions = this.computeSimpleTotals('f', 'fnMap'); ret.statements = this.computeSimpleTotals('s', 'statementMap'); - ret.branches = this.computeBranchTotals(); + ret.branches = this.computeBranchTotals('b'); + // Tracking additional information about branch truthiness + // can be optionally enabled: + if (this['bt']) { + ret.branchesTrue = this.computeBranchTotals('bT'); + } return new CoverageSummary(ret); } } @@ -256,6 +336,7 @@ dataProperties(FileCoverage, [ 's', 'f', 'b', + 'bT', 'all' ]); diff --git a/node_modules/istanbul-lib-coverage/lib/percent.js b/node_modules/istanbul-lib-coverage/lib/percent.js index b5dac80c0..c7b7aafa4 100644 --- a/node_modules/istanbul-lib-coverage/lib/percent.js +++ b/node_modules/istanbul-lib-coverage/lib/percent.js @@ -7,7 +7,7 @@ module.exports = function percent(covered, total) { let tmp; if (total > 0) { - tmp = (1000 * 100 * covered) / total + 5; + tmp = (1000 * 100 * covered) / total; return Math.floor(tmp / 10) / 100; } else { return 100.0; diff --git a/node_modules/istanbul-lib-coverage/package.json b/node_modules/istanbul-lib-coverage/package.json index b83e727f1..628584f1a 100644 --- a/node_modules/istanbul-lib-coverage/package.json +++ b/node_modules/istanbul-lib-coverage/package.json @@ -1,6 +1,6 @@ { "name": "istanbul-lib-coverage", - "version": "3.0.0", + "version": "3.2.0", "description": "Data library for istanbul coverage objects", "author": "Krishnan Anantheswaran ", "main": "index.js", @@ -9,7 +9,7 @@ "index.js" ], "scripts": { - "test": "nyc --nycrc-path=../../monorepo-per-package-full.js mocha" + "test": "nyc mocha" }, "devDependencies": { "chai": "^4.2.0", @@ -43,6 +43,5 @@ "homepage": "https://istanbul.js.org/", "engines": { "node": ">=8" - }, - "gitHead": "5319df684b508ff6fb19fe8b9a6147a3c5924e4b" + } } diff --git a/node_modules/jest-circus/build/eventHandler.d.ts b/node_modules/jest-circus/build/eventHandler.d.ts deleted file mode 100644 index 666bd207f..000000000 --- a/node_modules/jest-circus/build/eventHandler.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Circus } from '@jest/types'; -declare const eventHandler: Circus.EventHandler; -export default eventHandler; diff --git a/node_modules/jest-circus/build/eventHandler.js b/node_modules/jest-circus/build/eventHandler.js index 1dac46b0e..23a89333e 100644 --- a/node_modules/jest-circus/build/eventHandler.js +++ b/node_modules/jest-circus/build/eventHandler.js @@ -11,55 +11,10 @@ var _types = require('./types'); var _utils = require('./utils'); -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var jestNow = globalThis[Symbol.for('jest-native-now')] || globalThis.Date.now; -var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now; - -// TODO: investigate why a shorter (event, state) signature results into TS7006 compiler error const eventHandler = (event, state) => { switch (event.name) { case 'include_test_location_in_result': { @@ -176,7 +131,7 @@ const eventHandler = (event, state) => { case 'add_test': { const {currentDescribeBlock, currentlyRunningTest, hasStarted} = state; - const {asyncError, fn, mode, testName: name, timeout} = event; + const {asyncError, fn, mode, testName: name, timeout, concurrent} = event; if (currentlyRunningTest) { currentlyRunningTest.errors.push( @@ -197,6 +152,7 @@ const eventHandler = (event, state) => { const test = (0, _utils.makeTest)( fn, mode, + concurrent, name, currentDescribeBlock, timeout, @@ -274,14 +230,25 @@ const eventHandler = (event, state) => { } case 'test_retry': { + const logErrorsBeforeRetry = // eslint-disable-next-line no-restricted-globals + global[_types.LOG_ERRORS_BEFORE_RETRY] || false; + + if (logErrorsBeforeRetry) { + event.test.retryReasons.push(...event.test.errors); + } + event.test.errors = []; break; } case 'run_start': { state.hasStarted = true; + /* eslint-disable no-restricted-globals */ + global[_types.TEST_TIMEOUT_SYMBOL] && (state.testTimeout = global[_types.TEST_TIMEOUT_SYMBOL]); + /* eslint-enable */ + break; } diff --git a/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts b/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts deleted file mode 100644 index 0e70ecbc5..000000000 --- a/node_modules/jest-circus/build/formatNodeAssertErrors.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Circus } from '@jest/types'; -declare const formatNodeAssertErrors: (event: Circus.Event, state: Circus.State) => void; -export default formatNodeAssertErrors; diff --git a/node_modules/jest-circus/build/formatNodeAssertErrors.js b/node_modules/jest-circus/build/formatNodeAssertErrors.js index 38d5799fd..2fd3af243 100644 --- a/node_modules/jest-circus/build/formatNodeAssertErrors.js +++ b/node_modules/jest-circus/build/formatNodeAssertErrors.js @@ -86,10 +86,6 @@ const getOperatorName = (operator, stack) => { if (stack.match('.throws')) { return 'throws'; - } // this fallback is only needed for versions older than node 10 - - if (stack.match('.fail')) { - return 'fail'; } return ''; @@ -106,7 +102,7 @@ const operatorMessage = operator => { const assertThrowingMatcherHint = operatorName => operatorName ? _chalk.default.dim('assert') + - _chalk.default.dim('.' + operatorName + '(') + + _chalk.default.dim(`.${operatorName}(`) + _chalk.default.red('function') + _chalk.default.dim(')') : ''; @@ -123,7 +119,7 @@ const assertMatcherHint = (operator, operatorName, expected) => { } else if (operatorName) { message = _chalk.default.dim('assert') + - _chalk.default.dim('.' + operatorName + '(') + + _chalk.default.dim(`.${operatorName}(`) + _chalk.default.red('received') + _chalk.default.dim(', ') + _chalk.default.green('expected') + @@ -144,12 +140,13 @@ function assertionErrorMessage(error, options) { if (operatorName === 'doesNotThrow') { return ( + // eslint-disable-next-line prefer-template buildHintString(assertThrowingMatcherHint(operatorName)) + _chalk.default.reset('Expected the function not to throw an error.\n') + _chalk.default.reset('Instead, it threw:\n') + ` ${(0, _jestMatcherUtils.printReceived)(actual)}` + _chalk.default.reset( - hasCustomMessage ? '\n\nMessage:\n ' + message : '' + hasCustomMessage ? `\n\nMessage:\n ${message}` : '' ) + trimmedStack ); @@ -161,7 +158,7 @@ function assertionErrorMessage(error, options) { _chalk.default.reset('Expected the function to throw an error.\n') + _chalk.default.reset("But it didn't throw anything.") + _chalk.default.reset( - hasCustomMessage ? '\n\nMessage:\n ' + message : '' + hasCustomMessage ? `\n\nMessage:\n ${message}` : '' ) + trimmedStack ); @@ -170,18 +167,19 @@ function assertionErrorMessage(error, options) { if (operatorName === 'fail') { return ( buildHintString(assertMatcherHint(operator, operatorName, expected)) + - _chalk.default.reset(hasCustomMessage ? 'Message:\n ' + message : '') + + _chalk.default.reset(hasCustomMessage ? `Message:\n ${message}` : '') + trimmedStack ); } return ( + // eslint-disable-next-line prefer-template buildHintString(assertMatcherHint(operator, operatorName, expected)) + _chalk.default.reset(`Expected value ${operatorMessage(operator)}`) + ` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` + _chalk.default.reset('Received:\n') + ` ${(0, _jestMatcherUtils.printReceived)(actual)}` + - _chalk.default.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') + + _chalk.default.reset(hasCustomMessage ? `\n\nMessage:\n ${message}` : '') + (diffString ? `\n\nDifference:\n\n${diffString}` : '') + trimmedStack ); @@ -197,7 +195,7 @@ function isAssertionError(error) { } function buildHintString(hint) { - return hint ? hint + '\n\n' : ''; + return hint ? `${hint}\n\n` : ''; } var _default = formatNodeAssertErrors; diff --git a/node_modules/jest-circus/build/globalErrorHandlers.d.ts b/node_modules/jest-circus/build/globalErrorHandlers.d.ts deleted file mode 100644 index d25393f4f..000000000 --- a/node_modules/jest-circus/build/globalErrorHandlers.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Circus } from '@jest/types'; -export declare const injectGlobalErrorHandlers: (parentProcess: NodeJS.Process) => Circus.GlobalErrorHandlers; -export declare const restoreGlobalErrorHandlers: (parentProcess: NodeJS.Process, originalErrorHandlers: Circus.GlobalErrorHandlers) => void; diff --git a/node_modules/jest-circus/build/index.d.ts b/node_modules/jest-circus/build/index.d.ts index d51b3bcc8..adab032cd 100644 --- a/node_modules/jest-circus/build/index.d.ts +++ b/node_modules/jest-circus/build/index.d.ts @@ -4,49 +4,118 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type { Circus, Global } from '@jest/types'; -export { setState, getState, resetState } from './state'; -export { default as run } from './run'; -declare type THook = (fn: Circus.HookFn, timeout?: number) => void; -declare const describe: { - (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void; - each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; +import type {Circus} from '@jest/types'; +import type {Global} from '@jest/types'; + +declare const afterAll_2: THook; +export {afterAll_2 as afterAll}; + +declare const afterEach_2: THook; +export {afterEach_2 as afterEach}; + +declare const beforeAll_2: THook; +export {beforeAll_2 as beforeAll}; + +declare const beforeEach_2: THook; +export {beforeEach_2 as beforeEach}; + +declare const _default: { + afterAll: THook; + afterEach: THook; + beforeAll: THook; + beforeEach: THook; + describe: { + (blockName: Global.BlockNameLike, blockFn: Global.BlockFn): void; + each: ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData + ) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; only: { - (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void; - each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; + (blockName: Global.BlockNameLike, blockFn: Global.BlockFn): void; + each: ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData + ) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; }; skip: { - (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void; - each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; + (blockName: Global.BlockNameLike, blockFn: Global.BlockFn): void; + each: ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData + ) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; }; -}; -declare const beforeEach: THook; -declare const beforeAll: THook; -declare const afterEach: THook; -declare const afterAll: THook; -declare const test: Global.It; -declare const it: Global.It; -export declare type Event = Circus.Event; -export declare type State = Circus.State; -export { afterAll, afterEach, beforeAll, beforeEach, describe, it, test }; -declare const _default: { - afterAll: THook; - afterEach: THook; - beforeAll: THook; - beforeEach: THook; - describe: { - (blockName: string, blockFn: Global.BlockFn): void; - each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: { - (blockName: string, blockFn: Global.BlockFn): void; - each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; - skip: { - (blockName: string, blockFn: Global.BlockFn): void; - each: (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; - }; - it: Global.It; - test: Global.It; + }; + it: Global.It; + test: Global.It; }; export default _default; + +declare const describe_2: { + (blockName: Circus.BlockNameLike, blockFn: Circus.BlockFn): void; + each: ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData + ) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: { + (blockName: Circus.BlockNameLike, blockFn: Circus.BlockFn): void; + each: ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData + ) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; + skip: { + (blockName: Circus.BlockNameLike, blockFn: Circus.BlockFn): void; + each: ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData + ) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; +}; +export {describe_2 as describe}; + +declare type Event_2 = Circus.Event; +export {Event_2 as Event}; + +export declare const getState: () => Circus.State; + +declare const it_2: Global.It; +export {it_2 as it}; + +export declare const resetState: () => void; + +export declare const run: () => Promise; + +export declare const setState: (state: Circus.State) => Circus.State; + +export declare type State = Circus.State; + +declare const test_2: Global.It; +export {test_2 as test}; + +declare type THook = (fn: Circus.HookFn, timeout?: number) => void; + +export {}; diff --git a/node_modules/jest-circus/build/index.js b/node_modules/jest-circus/build/index.js index 415556782..ed5e7924e 100644 --- a/node_modules/jest-circus/build/index.js +++ b/node_modules/jest-circus/build/index.js @@ -89,6 +89,13 @@ const _dispatchDescribe = (blockFn, blockName, describeFn, mode) => { throw asyncError; } + try { + blockName = (0, _jestUtil.convertDescriptorToString)(blockName); + } catch (error) { + asyncError.message = error.message; + throw asyncError; + } + (0, _state.dispatchSync)({ asyncError, blockName, @@ -155,13 +162,19 @@ exports.afterAll = afterAll; const test = (() => { const test = (testName, fn, timeout) => - _addTest(testName, undefined, fn, test, timeout); + _addTest(testName, undefined, false, fn, test, timeout); const skip = (testName, fn, timeout) => - _addTest(testName, 'skip', fn, skip, timeout); + _addTest(testName, 'skip', false, fn, skip, timeout); const only = (testName, fn, timeout) => - _addTest(testName, 'only', fn, test.only, timeout); + _addTest(testName, 'only', false, fn, test.only, timeout); + + const concurrentTest = (testName, fn, timeout) => + _addTest(testName, undefined, true, fn, concurrentTest, timeout); + + const concurrentOnly = (testName, fn, timeout) => + _addTest(testName, 'only', true, fn, concurrentOnly, timeout); test.todo = (testName, ...rest) => { if (rest.length > 0 || typeof testName !== 'string') { @@ -171,14 +184,16 @@ const test = (() => { ); } - return _addTest(testName, 'todo', () => {}, test.todo); + return _addTest(testName, 'todo', false, () => {}, test.todo); }; - const _addTest = (testName, mode, fn, testFn, timeout) => { + const _addTest = (testName, mode, concurrent, fn, testFn, timeout) => { const asyncError = new _jestUtil.ErrorWithStack(undefined, testFn); - if (typeof testName !== 'string') { - asyncError.message = `Invalid first argument, ${testName}. It must be a string.`; + try { + testName = (0, _jestUtil.convertDescriptorToString)(testName); + } catch (error) { + asyncError.message = error.message; throw asyncError; } @@ -195,6 +210,7 @@ const test = (() => { return (0, _state.dispatchSync)({ asyncError, + concurrent, fn, mode, name: 'add_test', @@ -206,8 +222,13 @@ const test = (() => { test.each = (0, _jestEach.bind)(test); only.each = (0, _jestEach.bind)(only); skip.each = (0, _jestEach.bind)(skip); + concurrentTest.each = (0, _jestEach.bind)(concurrentTest, false); + concurrentOnly.each = (0, _jestEach.bind)(concurrentOnly, false); test.only = only; test.skip = skip; + test.concurrent = concurrentTest; + concurrentTest.only = concurrentOnly; + concurrentTest.skip = skip; return test; })(); diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts deleted file mode 100644 index 7aa430a0c..000000000 --- a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { JestEnvironment } from '@jest/environment'; -import type { TestFileEvent, TestResult } from '@jest/test-result'; -import type { Config } from '@jest/types'; -import type Runtime from 'jest-runtime'; -declare const jestAdapter: (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string, sendMessageToJest?: TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined) => Promise; -export = jestAdapter; diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js index 1c36d4ebf..97c3972ba 100644 --- a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js +++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js @@ -1,5 +1,10 @@ 'use strict'; +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + var _jestUtil = require('jest-util'); /** @@ -31,11 +36,13 @@ const jestAdapter = async ( testPath }); - if (config.timers === 'fake' || config.timers === 'modern') { - // during setup, this cannot be null (and it's fine to explode if it is) - environment.fakeTimersModern.useFakeTimers(); - } else if (config.timers === 'legacy') { - environment.fakeTimers.useFakeTimers(); + if (config.fakeTimers.enableGlobally) { + if (config.fakeTimers.legacyFakeTimers) { + // during setup, this cannot be null (and it's fine to explode if it is) + environment.fakeTimers.useFakeTimers(); + } else { + environment.fakeTimersModern.useFakeTimers(); + } } globals.beforeEach(() => { @@ -50,7 +57,10 @@ const jestAdapter = async ( if (config.resetMocks) { runtime.resetAllMocks(); - if (config.timers === 'legacy') { + if ( + config.fakeTimers.enableGlobally && + config.fakeTimers.legacyFakeTimers + ) { // during setup, this cannot be null (and it's fine to explode if it is) environment.fakeTimers.useFakeTimers(); } @@ -120,4 +130,5 @@ const _addSnapshotData = (results, snapshotState) => { results.snapshot.uncheckedKeys = Array.from(uncheckedKeys); }; -module.exports = jestAdapter; +var _default = jestAdapter; +exports.default = _default; diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts deleted file mode 100644 index b09ec314a..000000000 --- a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type { JestEnvironment } from '@jest/environment'; -import { TestFileEvent, TestResult } from '@jest/test-result'; -import type { Config, Global } from '@jest/types'; -import { SnapshotStateType } from 'jest-snapshot'; -import globals from '..'; -import { Expect } from './jestExpect'; -declare type Process = NodeJS.Process; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: Expect; -} -export declare const initialize: ({ config, environment, globalConfig, localRequire, parentProcess, sendMessageToJest, setGlobalsForRuntime, testPath, }: { - config: Config.ProjectConfig; - environment: JestEnvironment; - globalConfig: Config.GlobalConfig; - localRequire: (path: Config.Path) => T; - testPath: Config.Path; - parentProcess: Process; - sendMessageToJest?: TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined; - setGlobalsForRuntime: (globals: JestGlobals) => void; -}) => Promise<{ - globals: Global.TestFrameworkGlobals; - snapshotState: SnapshotStateType; -}>; -export declare const runAndTransformResultsToJestFormat: ({ config, globalConfig, testPath, }: { - config: Config.ProjectConfig; - globalConfig: Config.GlobalConfig; - testPath: string; -}) => Promise; -export {}; diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js index 7059ad2ac..007f22202 100644 --- a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js +++ b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js @@ -5,14 +5,10 @@ Object.defineProperty(exports, '__esModule', { }); exports.runAndTransformResultsToJestFormat = exports.initialize = void 0; -var _throat = _interopRequireDefault(require('throat')); +var _expect = require('@jest/expect'); var _testResult = require('@jest/test-result'); -var _expect = require('expect'); - -var _jestEach = require('jest-each'); - var _jestMessageUtil = require('jest-message-util'); var _jestSnapshot = require('jest-snapshot'); @@ -29,8 +25,6 @@ var _testCaseReportHandler = _interopRequireDefault( var _utils = require('../utils'); -var _jestExpect = _interopRequireDefault(require('./jestExpect')); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {default: obj}; } @@ -55,7 +49,7 @@ const initialize = async ({ (0, _state.getState)().testTimeout = globalConfig.testTimeout; } - const mutex = (0, _throat.default)(globalConfig.maxConcurrency); // @ts-expect-error + (0, _state.getState)().maxConcurrency = globalConfig.maxConcurrency; // @ts-expect-error const globalsObject = { ..._.default, @@ -65,46 +59,17 @@ const initialize = async ({ xit: _.default.it.skip, xtest: _.default.it.skip }; - - globalsObject.test.concurrent = (test => { - const concurrent = (testName, testFn, timeout) => { - // For concurrent tests we first run the function that returns promise, and then register a - // normal test that will be waiting on the returned promise (when we start the test, the promise - // will already be in the process of execution). - // Unfortunately at this stage there's no way to know if there are any `.only` tests in the suite - // that will result in this test to be skipped, so we'll be executing the promise function anyway, - // even if it ends up being skipped. - const promise = mutex(() => testFn()); // Avoid triggering the uncaught promise rejection handler in case the test errors before - // being awaited on. - - promise.catch(() => {}); - globalsObject.test(testName, () => promise, timeout); - }; - - const only = (testName, testFn, timeout) => { - const promise = mutex(() => testFn()); // eslint-disable-next-line jest/no-focused-tests - - test.only(testName, () => promise, timeout); - }; - - concurrent.only = only; - concurrent.skip = test.skip; - concurrent.each = (0, _jestEach.bind)(test, false); - concurrent.skip.each = (0, _jestEach.bind)(test.skip, false); - only.each = (0, _jestEach.bind)(test.only, false); - return concurrent; - })(globalsObject.test); - (0, _state.addEventHandler)(eventHandler); if (environment.handleTestEvent) { (0, _state.addEventHandler)(environment.handleTestEvent.bind(environment)); } - const runtimeGlobals = { - ...globalsObject, - expect: (0, _jestExpect.default)(globalConfig) - }; + _expect.jestExpect.setState({ + expand: globalConfig.expand + }); + + const runtimeGlobals = {...globalsObject, expect: _expect.jestExpect}; setGlobalsForRuntime(runtimeGlobals); if (config.injectGlobals) { @@ -129,23 +94,23 @@ const initialize = async ({ .concat() .reverse() .forEach(path => (0, _jestSnapshot.addSerializer)(localRequire(path))); - const {expand, updateSnapshot} = globalConfig; const snapshotResolver = await (0, _jestSnapshot.buildSnapshotResolver)( config, localRequire ); const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath); const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, { - expand, + expand: globalConfig.expand, prettierPath: config.prettierPath, snapshotFormat: config.snapshotFormat, - updateSnapshot - }); // @ts-expect-error: snapshotState is a jest extension of `expect` + updateSnapshot: globalConfig.updateSnapshot + }); - (0, _expect.setState)({ + _expect.jestExpect.setState({ snapshotState, testPath }); + (0, _state.addEventHandler)(handleSnapshotStateAfterRetry(snapshotState)); if (sendMessageToJest) { @@ -204,6 +169,7 @@ const runAndTransformResultsToJestFormat = async ({ invocations: testResult.invocations, location: testResult.location, numPassingAsserts: 0, + retryReasons: testResult.retryReasons, status, title: testResult.testPath[testResult.testPath.length - 1] }; @@ -221,14 +187,11 @@ const runAndTransformResultsToJestFormat = async ({ message: '', stack: runResult.unhandledErrors.join('\n') }; - failureMessage = - (failureMessage || '') + - '\n\n' + - runResult.unhandledErrors - .map(err => - (0, _jestMessageUtil.formatExecError)(err, config, globalConfig) - ) - .join('\n'); + failureMessage = `${failureMessage || ''}\n\n${runResult.unhandledErrors + .map(err => + (0, _jestMessageUtil.formatExecError)(err, config, globalConfig) + ) + .join('\n')}`; } await (0, _state.dispatch)({ @@ -263,9 +226,10 @@ const handleSnapshotStateAfterRetry = snapshotState => event => { const eventHandler = async event => { switch (event.name) { case 'test_start': { - (0, _expect.setState)({ + _expect.jestExpect.setState({ currentTestName: (0, _utils.getTestID)(event.test) }); + break; } @@ -280,7 +244,8 @@ const eventHandler = async event => { }; const _addExpectedAssertionErrors = test => { - const failures = (0, _expect.extractExpectedAssertionsErrors)(); + const failures = _expect.jestExpect.extractExpectedAssertionsErrors(); + const errors = failures.map(failure => failure.error); test.errors = test.errors.concat(errors); }; // Get suppressed errors from ``jest-matchers`` that weren't throw during @@ -288,8 +253,9 @@ const _addExpectedAssertionErrors = test => { // a passing test. const _addSuppressedErrors = test => { - const {suppressedErrors} = (0, _expect.getState)(); - (0, _expect.setState)({ + const {suppressedErrors} = _expect.jestExpect.getState(); + + _expect.jestExpect.setState({ suppressedErrors: [] }); diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts deleted file mode 100644 index 8902dc01a..000000000 --- a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -import expect = require('expect'); -export declare type Expect = typeof expect; -export default function jestExpect(config: Pick): Expect; diff --git a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js b/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js deleted file mode 100644 index d3617666e..000000000 --- a/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestExpect.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = jestExpect; - -var _expect = _interopRequireDefault(require('expect')); - -var _jestSnapshot = require('jest-snapshot'); - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -function jestExpect(config) { - _expect.default.setState({ - expand: config.expand - }); - - _expect.default.extend({ - toMatchInlineSnapshot: _jestSnapshot.toMatchInlineSnapshot, - toMatchSnapshot: _jestSnapshot.toMatchSnapshot, - toThrowErrorMatchingInlineSnapshot: - _jestSnapshot.toThrowErrorMatchingInlineSnapshot, - toThrowErrorMatchingSnapshot: _jestSnapshot.toThrowErrorMatchingSnapshot - }); - - _expect.default.addSnapshotSerializer = _jestSnapshot.addSerializer; - return _expect.default; -} diff --git a/node_modules/jest-circus/build/run.d.ts b/node_modules/jest-circus/build/run.d.ts deleted file mode 100644 index 6e8313633..000000000 --- a/node_modules/jest-circus/build/run.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Circus } from '@jest/types'; -declare const run: () => Promise; -export default run; diff --git a/node_modules/jest-circus/build/run.js b/node_modules/jest-circus/build/run.js index c12ee9664..152ffbdc8 100644 --- a/node_modules/jest-circus/build/run.js +++ b/node_modules/jest-circus/build/run.js @@ -5,12 +5,18 @@ Object.defineProperty(exports, '__esModule', { }); exports.default = void 0; +var _throat = _interopRequireDefault(require('throat')); + var _state = require('./state'); var _types = require('./types'); var _utils = require('./utils'); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * @@ -22,7 +28,7 @@ const run = async () => { await (0, _state.dispatch)({ name: 'run_start' }); - await _runTestsForDescribeBlock(rootDescribeBlock); + await _runTestsForDescribeBlock(rootDescribeBlock, true); await (0, _state.dispatch)({ name: 'run_finish' }); @@ -32,7 +38,10 @@ const run = async () => { ); }; -const _runTestsForDescribeBlock = async describeBlock => { +const _runTestsForDescribeBlock = async ( + describeBlock, + isRootBlock = false +) => { await (0, _state.dispatch)({ describeBlock, name: 'run_describe_start' @@ -49,7 +58,28 @@ const _runTestsForDescribeBlock = async describeBlock => { hook }); } + } + + if (isRootBlock) { + const concurrentTests = collectConcurrentTests(describeBlock); + const mutex = (0, _throat.default)((0, _state.getState)().maxConcurrency); + + for (const test of concurrentTests) { + try { + const promise = mutex(test.fn); // Avoid triggering the uncaught promise rejection handler in case the + // test errors before being awaited on. + + promise.catch(() => {}); + + test.fn = () => promise; + } catch (err) { + test.fn = () => { + throw err; + }; + } + } } // Tests that fail and are retried we run after other tests + // eslint-disable-next-line no-restricted-globals const retryTimes = parseInt(global[_types.RETRY_TIMES], 10) || 0; const deferredRetryTests = []; @@ -107,6 +137,29 @@ const _runTestsForDescribeBlock = async describeBlock => { }); }; +function collectConcurrentTests(describeBlock) { + if (describeBlock.mode === 'skip') { + return []; + } + + const {hasFocusedTests, testNamePattern} = (0, _state.getState)(); + return describeBlock.children.flatMap(child => { + switch (child.type) { + case 'describeBlock': + return collectConcurrentTests(child); + + case 'test': + const skip = + !child.concurrent || + child.mode === 'skip' || + (hasFocusedTests && child.mode !== 'only') || + (testNamePattern && + !testNamePattern.test((0, _utils.getTestID)(child))); + return skip ? [] : [child]; + } + }); +} + const _runTest = async (test, parentSkipped) => { await (0, _state.dispatch)({ name: 'test_start', @@ -170,7 +223,12 @@ const _runTest = async (test, parentSkipped) => { }); }; -const _callCircusHook = async ({hook, test, describeBlock, testContext}) => { +const _callCircusHook = async ({ + hook, + test, + describeBlock, + testContext = {} +}) => { await (0, _state.dispatch)({ hook, name: 'hook_start' diff --git a/node_modules/jest-circus/build/state.d.ts b/node_modules/jest-circus/build/state.d.ts deleted file mode 100644 index e686aef92..000000000 --- a/node_modules/jest-circus/build/state.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Circus } from '@jest/types'; -export declare const ROOT_DESCRIBE_BLOCK_NAME = "ROOT_DESCRIBE_BLOCK"; -export declare const resetState: () => void; -export declare const getState: () => Circus.State; -export declare const setState: (state: Circus.State) => Circus.State; -export declare const dispatch: (event: Circus.AsyncEvent) => Promise; -export declare const dispatchSync: (event: Circus.SyncEvent) => void; -export declare const addEventHandler: (handler: Circus.EventHandler) => void; diff --git a/node_modules/jest-circus/build/state.js b/node_modules/jest-circus/build/state.js index d9d3ca28b..528b77447 100644 --- a/node_modules/jest-circus/build/state.js +++ b/node_modules/jest-circus/build/state.js @@ -47,6 +47,7 @@ const createState = () => { hasFocusedTests: false, hasStarted: false, includeTestLocationInResult: false, + maxConcurrency: 5, parentProcess: null, rootDescribeBlock: ROOT_DESCRIBE_BLOCK, testNamePattern: null, @@ -54,6 +55,7 @@ const createState = () => { unhandledErrors: [] }; }; +/* eslint-disable no-restricted-globals */ const resetState = () => { global[_types.STATE_SYM] = createState(); @@ -67,6 +69,7 @@ const getState = () => global[_types.STATE_SYM]; exports.getState = getState; const setState = state => (global[_types.STATE_SYM] = state); +/* eslint-enable */ exports.setState = setState; diff --git a/node_modules/jest-circus/build/testCaseReportHandler.d.ts b/node_modules/jest-circus/build/testCaseReportHandler.d.ts deleted file mode 100644 index 093fe9b91..000000000 --- a/node_modules/jest-circus/build/testCaseReportHandler.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { TestFileEvent } from '@jest/test-result'; -import type { Circus } from '@jest/types'; -declare const testCaseReportHandler: (testPath: string, sendMessageToJest: TestFileEvent) => (event: Circus.Event) => void; -export default testCaseReportHandler; diff --git a/node_modules/jest-circus/build/types.d.ts b/node_modules/jest-circus/build/types.d.ts deleted file mode 100644 index 930a49c76..000000000 --- a/node_modules/jest-circus/build/types.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Circus } from '@jest/types'; -import expect = require('expect'); -export declare const STATE_SYM: "STATE_SYM_SYMBOL"; -export declare const RETRY_TIMES: "RETRY_TIMES_SYMBOL"; -export declare const TEST_TIMEOUT_SYMBOL: "TEST_TIMEOUT_SYMBOL"; -declare global { - namespace NodeJS { - interface Global { - STATE_SYM_SYMBOL: Circus.State; - RETRY_TIMES_SYMBOL: string; - TEST_TIMEOUT_SYMBOL: number; - expect: typeof expect; - } - } -} diff --git a/node_modules/jest-circus/build/types.js b/node_modules/jest-circus/build/types.js index 2b2ade0f1..70116de09 100644 --- a/node_modules/jest-circus/build/types.js +++ b/node_modules/jest-circus/build/types.js @@ -3,29 +3,19 @@ Object.defineProperty(exports, '__esModule', { value: true }); -exports.TEST_TIMEOUT_SYMBOL = exports.STATE_SYM = exports.RETRY_TIMES = void 0; +exports.TEST_TIMEOUT_SYMBOL = + exports.STATE_SYM = + exports.RETRY_TIMES = + exports.LOG_ERRORS_BEFORE_RETRY = + void 0; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; -var _expect = _interopRequireDefault(require('expect')); - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ const STATE_SYM = Symbol('JEST_STATE_SYMBOL'); exports.STATE_SYM = STATE_SYM; const RETRY_TIMES = Symbol.for('RETRY_TIMES'); // To pass this value from Runtime object to state we need to use global[sym] @@ -33,3 +23,5 @@ const RETRY_TIMES = Symbol.for('RETRY_TIMES'); // To pass this value from Runtim exports.RETRY_TIMES = RETRY_TIMES; const TEST_TIMEOUT_SYMBOL = Symbol.for('TEST_TIMEOUT_SYMBOL'); exports.TEST_TIMEOUT_SYMBOL = TEST_TIMEOUT_SYMBOL; +const LOG_ERRORS_BEFORE_RETRY = Symbol.for('LOG_ERRORS_BEFORE_RETRY'); +exports.LOG_ERRORS_BEFORE_RETRY = LOG_ERRORS_BEFORE_RETRY; diff --git a/node_modules/jest-circus/build/utils.d.ts b/node_modules/jest-circus/build/utils.d.ts deleted file mode 100644 index f22b4fca0..000000000 --- a/node_modules/jest-circus/build/utils.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { AssertionResult } from '@jest/test-result'; -import type { Circus } from '@jest/types'; -export declare const makeDescribe: (name: Circus.BlockName, parent?: Circus.DescribeBlock | undefined, mode?: void | "skip" | "only" | "todo" | undefined) => Circus.DescribeBlock; -export declare const makeTest: (fn: Circus.TestFn, mode: Circus.TestMode, name: Circus.TestName, parent: Circus.DescribeBlock, timeout: number | undefined, asyncError: Circus.Exception) => Circus.TestEntry; -declare type DescribeHooks = { - beforeAll: Array; - afterAll: Array; -}; -export declare const getAllHooksForDescribe: (describe: Circus.DescribeBlock) => DescribeHooks; -declare type TestHooks = { - beforeEach: Array; - afterEach: Array; -}; -export declare const getEachHooksForTest: (test: Circus.TestEntry) => TestHooks; -export declare const describeBlockHasTests: (describe: Circus.DescribeBlock) => boolean; -export declare const callAsyncCircusFn: (testOrHook: Circus.TestEntry | Circus.Hook, testContext: Circus.TestContext | undefined, { isHook, timeout }: { - isHook: boolean; - timeout: number; -}) => Promise; -export declare const getTestDuration: (test: Circus.TestEntry) => number | null; -export declare const makeRunResult: (describeBlock: Circus.DescribeBlock, unhandledErrors: Array) => Circus.RunResult; -export declare const makeSingleTestResult: (test: Circus.TestEntry) => Circus.TestResult; -export declare const getTestID: (test: Circus.TestEntry) => string; -export declare const addErrorToEachTestUnderDescribe: (describeBlock: Circus.DescribeBlock, error: Circus.Exception, asyncError: Circus.Exception) => void; -export declare function invariant(condition: unknown, message?: string): asserts condition; -export declare const parseSingleTestResult: (testResult: Circus.TestResult) => AssertionResult; -export {}; diff --git a/node_modules/jest-circus/build/utils.js b/node_modules/jest-circus/build/utils.js index 521a2961f..2f3edb044 100644 --- a/node_modules/jest-circus/build/utils.js +++ b/node_modules/jest-circus/build/utils.js @@ -83,85 +83,12 @@ function _interopRequireWildcard(obj, nodeInterop) { return newObj; } -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; - -var global = (function () { - if (typeof globalThis !== 'undefined') { - return globalThis; - } else if (typeof global !== 'undefined') { - return global; - } else if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this')(); - } -})(); - -var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var jestNow = globalThis[Symbol.for('jest-native-now')] || globalThis.Date.now; +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +var Promise = + globalThis[Symbol.for('jest-native-promise')] || globalThis.Promise; const stackUtils = new _stackUtils.default({ cwd: 'A path that does not exist' }); @@ -199,10 +126,11 @@ const makeDescribe = (name, parent, mode) => { exports.makeDescribe = makeDescribe; -const makeTest = (fn, mode, name, parent, timeout, asyncError) => ({ +const makeTest = (fn, mode, concurrent, name, parent, timeout, asyncError) => ({ type: 'test', // eslint-disable-next-line sort-keys asyncError, + concurrent, duration: null, errors: [], fn, @@ -210,6 +138,7 @@ const makeTest = (fn, mode, name, parent, timeout, asyncError) => ({ mode, name: (0, _jestUtil.convertDescriptorToString)(name), parent, + retryReasons: [], seenDone: false, startedAt: null, status: null, @@ -262,14 +191,18 @@ const getEachHooksForTest = test => { afterEach: [], beforeEach: [] }; + + if (test.concurrent) { + // *Each hooks are not run for concurrent tests + return result; + } + let block = test.parent; do { - const beforeEachForCurrentBlock = []; // TODO: inline after https://github.com/microsoft/TypeScript/pull/34840 is released - - let hook; + const beforeEachForCurrentBlock = []; - for (hook of block.hooks) { + for (const hook of block.hooks) { switch (hook.type) { case 'beforeEach': beforeEachForCurrentBlock.push(hook); @@ -303,7 +236,7 @@ const _makeTimeoutMessage = (timeout, isHook) => }.\nUse jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test.`; // Global values can be overwritten by mocks or tests. We'll capture // the original values in the variables before we require any files. -const {setTimeout, clearTimeout} = global; +const {setTimeout, clearTimeout} = globalThis; function checkIsError(error) { return !!(error && error.message && error.stack); @@ -332,11 +265,12 @@ const callAsyncCircusFn = (testOrHook, testContext, {isHook, timeout}) => { 'Expected done to be called once, but it was called multiple times.'; if (reason) { - errorAtDone.message += - ' Reason: ' + - (0, _prettyFormat.format)(reason, { + errorAtDone.message += ` Reason: ${(0, _prettyFormat.format)( + reason, + { maxDepth: 3 - }); + } + )}`; } reject(errorAtDone); @@ -368,9 +302,7 @@ const callAsyncCircusFn = (testOrHook, testContext, {isHook, timeout}) => { } // Consider always throwing, regardless if `reason` is set or not if (completed && reason) { - errorAsErrorObject.message = - 'Caught error after test environment was torn down\n\n' + - errorAsErrorObject.message; + errorAsErrorObject.message = `Caught error after test environment was torn down\n\n${errorAsErrorObject.message}`; throw errorAsErrorObject; } @@ -511,6 +443,7 @@ const makeSingleTestResult = test => { errorsDetailed, invocations: test.invocations, location, + retryReasons: test.retryReasons.map(_getError).map(getErrorStack), status, testPath: Array.from(testPath) }; @@ -629,6 +562,7 @@ const parseSingleTestResult = testResult => { invocations: testResult.invocations, location: testResult.location, numPassingAsserts: 0, + retryReasons: Array.from(testResult.retryReasons), status, title: testResult.testPath[testResult.testPath.length - 1] }; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/Circus.d.ts b/node_modules/jest-circus/node_modules/@jest/types/build/Circus.d.ts deleted file mode 100644 index 683832eb1..000000000 --- a/node_modules/jest-circus/node_modules/@jest/types/build/Circus.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -import type * as Global from './Global'; -declare type Process = NodeJS.Process; -export declare type DoneFn = Global.DoneFn; -export declare type BlockFn = Global.BlockFn; -export declare type BlockName = Global.BlockName; -export declare type BlockMode = void | 'skip' | 'only' | 'todo'; -export declare type TestMode = BlockMode; -export declare type TestName = Global.TestName; -export declare type TestFn = Global.TestFn; -export declare type HookFn = Global.HookFn; -export declare type AsyncFn = TestFn | HookFn; -export declare type SharedHookType = 'afterAll' | 'beforeAll'; -export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; -export declare type TestContext = Global.TestContext; -export declare type Exception = any; -export declare type FormattedError = string; -export declare type Hook = { - asyncError: Error; - fn: HookFn; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; -export interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} -export declare type Event = SyncEvent | AsyncEvent; -interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} -export declare type SyncEvent = { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName; -} | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName; -} | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn; - timeout: number | undefined; -} | { - asyncError: Error; - name: 'add_test'; - testName: TestName; - fn: TestFn; - mode?: TestMode; - timeout: number | undefined; -} | { - name: 'error'; - error: Exception; -}; -export declare type AsyncEvent = { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; -} | { - name: 'include_test_location_in_result'; -} | { - name: 'hook_start'; - hook: Hook; -} | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; -} | { - name: 'test_fn_start'; - test: TestEntry; -} | { - name: 'test_fn_success'; - test: TestEntry; -} | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; -} | { - name: 'test_retry'; - test: TestEntry; -} | { - name: 'test_start'; - test: TestEntry; -} | { - name: 'test_skip'; - test: TestEntry; -} | { - name: 'test_todo'; - test: TestEntry; -} | { - name: 'test_done'; - test: TestEntry; -} | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; -} | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; -} | { - name: 'run_start'; -} | { - name: 'run_finish'; -} | { - name: 'teardown'; -}; -export declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; -export declare type TestStatus = 'skip' | 'done' | 'todo'; -export declare type TestResult = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - testPath: Array; -}; -export declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; -export declare type TestResults = Array; -export declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; -}; -export declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - rootDescribeBlock: DescribeBlock; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; -}; -export declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; -export declare type TestError = Exception | [Exception | undefined, Exception]; -export declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - fn: TestFn; - invocations: number; - mode: TestMode; - name: TestName; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; -}; -export {}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/Config.d.ts b/node_modules/jest-circus/node_modules/@jest/types/build/Config.d.ts deleted file mode 100644 index 6290147c2..000000000 --- a/node_modules/jest-circus/node_modules/@jest/types/build/Config.d.ts +++ /dev/null @@ -1,462 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { ForegroundColor } from 'chalk'; -import type { ReportOptions } from 'istanbul-reports'; -import type { Arguments } from 'yargs'; -declare type CoverageProvider = 'babel' | 'v8'; -declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; -export declare type Path = string; -export declare type Glob = string; -export declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** Path to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; -}; -export declare type CoverageReporterName = keyof ReportOptions; -export declare type CoverageReporterWithOptions = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial] : never; -export declare type CoverageReporters = Array; -export declare type ReporterConfig = [string, Record]; -export declare type TransformerConfig = [string, Record]; -export interface ConfigGlobals { - [K: string]: unknown; -} -export interface PrettyFormatOptions { -} -export declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: Path; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - testURL: string; - timers: Timers; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; -}; -export declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; -export declare type InitialOptionsWithRootDir = InitialOptions & Required>; -export declare type InitialProjectOptions = Pick; -export declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: Path; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter: Path; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader: Path; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - name: string; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: Path; - passWithNoTests: boolean; - /** - * @deprecated Use `transformIgnorePatterns` options instead. - */ - preprocessorIgnorePatterns: Array; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: Path | null | undefined; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - runTestsByPath: boolean; - /** - * @deprecated Use `transform` options instead. - */ - scriptPreprocessor: string; - setupFiles: Array; - /** - * @deprecated Use `setupFilesAfterEnv` options instead. - */ - setupTestFrameworkScriptFile: Path; - setupFilesAfterEnv: Array; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - /** - * @deprecated Use `roots` options instead. - */ - testPathDirs: Array; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number; - timers: Timers; - transform: { - [regex: string]: Path | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; -}>; -export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; -declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; -export declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; -export declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - collectCoverageOnlyFrom?: { - [key: string]: boolean; - }; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: Path; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: Path; - onlyChanged: boolean; - onlyFailures: boolean; - passWithNoTests: boolean; - projects: Array; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: Path; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: PrettyFormatOptions; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; -}; -export declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: Path; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: Path; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - extraGlobals: Array; - filter?: Path; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleLoader?: Path; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - name: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: Path; - restoreMocks: boolean; - rootDir: Path; - roots: Array; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: Path; - snapshotSerializers: Array; - snapshotFormat: PrettyFormatOptions; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testURL: string; - timers: Timers; - transform: Array<[string, Path, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; -}; -export declare type Argv = Arguments; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - projects: Array; - prettierPath: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testURL: string; - testTimeout: number | null | undefined; - timers: string; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; -}>>; -export {}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/Global.d.ts b/node_modules/jest-circus/node_modules/@jest/types/build/Global.d.ts deleted file mode 100644 index ed498e54e..000000000 --- a/node_modules/jest-circus/node_modules/@jest/types/build/Global.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { CoverageMapData } from 'istanbul-lib-coverage'; -export declare type ValidTestReturnValues = void | undefined; -declare type TestReturnValuePromise = Promise; -declare type TestReturnValueGenerator = Generator; -export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; -export declare type TestContext = Record; -export declare type DoneFn = (reason?: string | Error) => void; -export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; -export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; -export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; -export declare type TestName = string; -export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; -export declare type ConcurrentTestFn = () => TestReturnValuePromise; -export declare type BlockFn = () => void; -export declare type BlockName = string; -export declare type HookFn = TestFn; -export declare type Col = unknown; -export declare type Row = ReadonlyArray; -export declare type Table = ReadonlyArray; -export declare type ArrayTable = Table | Row; -export declare type TemplateTable = TemplateStringsArray; -export declare type TemplateData = ReadonlyArray; -export declare type EachTable = ArrayTable | TemplateTable; -export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; -export declare type EachTestFn = (...args: ReadonlyArray) => ReturnType; -declare type Jasmine = { - _DEFAULT_TIMEOUT_INTERVAL?: number; - addMatchers: (matchers: Record) => void; -}; -declare type Each = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn, timeout?: number) => void) | (() => () => void); -export interface HookBase { - (fn: HookFn, timeout?: number): void; -} -export interface ItBase { - (testName: TestName, fn: TestFn, timeout?: number): void; - each: Each; -} -export interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestName) => void; -} -export interface ItConcurrentBase { - (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; -} -export interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} -export interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} -export interface DescribeBase { - (blockName: BlockName, blockFn: BlockFn): void; - each: Each; -} -export interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} -export interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} -export interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; - jasmine: Jasmine; - fail: () => void; - pending: () => void; - spyOn: () => void; - spyOnProperty: () => void; -} -export interface Global extends GlobalAdditions, Omit { - [extras: string]: unknown; -} -export {}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.d.ts deleted file mode 100644 index a05dca9d0..000000000 --- a/node_modules/jest-circus/node_modules/@jest/types/build/TestResult.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type Milliseconds = number; -declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; -declare type Callsite = { - column: number; - line: number; -}; -export declare type AssertionResult = { - ancestorTitles: Array; - duration?: Milliseconds | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - status: Status; - title: string; -}; -export declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; -export {}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/Transform.d.ts b/node_modules/jest-circus/node_modules/@jest/types/build/Transform.d.ts deleted file mode 100644 index 69abd9206..000000000 --- a/node_modules/jest-circus/node_modules/@jest/types/build/Transform.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/index.d.ts b/node_modules/jest-circus/node_modules/@jest/types/build/index.d.ts index be82158e4..584f78c36 100644 --- a/node_modules/jest-circus/node_modules/@jest/types/build/index.d.ts +++ b/node_modules/jest-circus/node_modules/@jest/types/build/index.d.ts @@ -4,9 +4,1125 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import type * as Circus from './Circus'; -import type * as Config from './Config'; -import type * as Global from './Global'; -import type * as TestResult from './TestResult'; -import type * as TransformTypes from './Transform'; -export type { Circus, Config, Global, TestResult, TransformTypes }; +/// + +import type {Arguments} from 'yargs'; +import type {CoverageMapData} from 'istanbul-lib-coverage'; +import type {ForegroundColor} from 'chalk'; +import type {ReportOptions} from 'istanbul-reports'; +import type {SnapshotFormat} from '@jest/schemas'; + +declare type Argv = Arguments< + Partial<{ + all: boolean; + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + changedSince: string; + ci: boolean; + clearCache: boolean; + clearMocks: boolean; + collectCoverage: boolean; + collectCoverageFrom: string; + collectCoverageOnlyFrom: Array; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + ignoreProjects: Array; + init: boolean; + injectGlobals: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + reporters: Array; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + selectProjects: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + shard: string; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number | null | undefined; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; + }> +>; + +declare type ArrayTable = Table | Row; + +declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureDetails: Array; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + retryReasons?: Array; + status: Status; + title: string; +}; + +declare type AsyncEvent = + | { + name: 'setup'; + testNamePattern?: string; + runtimeGlobals: JestGlobals; + parentProcess: Process; + } + | { + name: 'include_test_location_in_result'; + } + | { + name: 'hook_start'; + hook: Hook; + } + | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; + } + | { + name: 'test_fn_start'; + test: TestEntry; + } + | { + name: 'test_fn_success'; + test: TestEntry; + } + | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; + } + | { + name: 'test_retry'; + test: TestEntry; + } + | { + name: 'test_start'; + test: TestEntry; + } + | { + name: 'test_skip'; + test: TestEntry; + } + | { + name: 'test_todo'; + test: TestEntry; + } + | { + name: 'test_done'; + test: TestEntry; + } + | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; + } + | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; + } + | { + name: 'run_start'; + } + | { + name: 'run_finish'; + } + | { + name: 'teardown'; + }; + +declare type AsyncFn = TestFn_2 | HookFn_2; + +declare type BlockFn = () => void; + +declare type BlockFn_2 = Global.BlockFn; + +declare type BlockMode = void | 'skip' | 'only' | 'todo'; + +declare type BlockName = string; + +declare type BlockName_2 = Global.BlockName; + +declare type BlockNameLike = BlockName | NameLike; + +declare type BlockNameLike_2 = Global.BlockNameLike; + +declare type Callsite = { + column: number; + line: number; +}; + +declare namespace Circus { + export { + DoneFn, + BlockFn_2 as BlockFn, + BlockName_2 as BlockName, + BlockNameLike_2 as BlockNameLike, + BlockMode, + TestMode, + TestName_2 as TestName, + TestNameLike_2 as TestNameLike, + TestFn_2 as TestFn, + ConcurrentTestFn_2 as ConcurrentTestFn, + HookFn_2 as HookFn, + AsyncFn, + SharedHookType, + HookType, + TestContext_2 as TestContext, + Exception, + FormattedError, + Hook, + EventHandler, + Event_2 as Event, + SyncEvent, + AsyncEvent, + MatcherResults, + TestStatus, + TestResult_2 as TestResult, + RunResult, + TestResults, + GlobalErrorHandlers, + State, + DescribeBlock, + TestError, + TestEntry, + }; +} +export {Circus}; + +declare type Col = unknown; + +declare type ConcurrentTestFn = () => TestReturnValuePromise; + +declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; + +declare namespace Config { + export { + FakeableAPI, + GlobalFakeTimersConfig, + FakeTimersConfig, + LegacyFakeTimersConfig, + HasteConfig, + CoverageReporterName, + CoverageReporterWithOptions, + CoverageReporters, + ReporterConfig, + TransformerConfig, + ConfigGlobals, + DefaultOptions, + DisplayName, + InitialOptionsWithRootDir, + InitialProjectOptions, + InitialOptions, + SnapshotUpdateState, + CoverageThresholdValue, + GlobalConfig, + ProjectConfig, + Argv, + }; +} +export {Config}; + +declare interface ConfigGlobals { + [K: string]: unknown; +} + +declare type CoverageProvider = 'babel' | 'v8'; + +declare type CoverageReporterName = keyof ReportOptions; + +declare type CoverageReporters = Array< + CoverageReporterName | CoverageReporterWithOptions +>; + +declare type CoverageReporterWithOptions = + K extends CoverageReporterName + ? ReportOptions[K] extends never + ? never + : [K, Partial] + : never; + +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; + +declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; + +declare type DefaultOptions = { + automock: boolean; + bail: number; + cache: boolean; + cacheDirectory: string; + changedFilesWithAncestor: boolean; + ci: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + detectLeaks: boolean; + detectOpenHandles: boolean; + errorOnDeprecated: boolean; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + injectGlobals: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + passWithNoTests: boolean; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + slowTestThreshold: number; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; + +declare interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} + +declare interface DescribeBase { + (blockName: BlockNameLike, blockFn: BlockFn): void; + each: Each; +} + +declare type DescribeBlock = { + type: 'describeBlock'; + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName_2; + parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; +}; + +declare type DisplayName = { + name: string; + color: typeof ForegroundColor; +}; + +declare type DoneFn = Global.DoneFn; + +declare type DoneFn_2 = (reason?: string | Error) => void; + +declare type DoneTakingTestFn = ( + this: TestContext, + done: DoneFn_2, +) => ValidTestReturnValues; + +declare type Each = + | (( + table: EachTable, + ...taggedTemplateData: TemplateData + ) => (name: Name, test: EachTestFn, timeout?: number) => void) + | (() => () => void); + +declare type EachTable = ArrayTable | TemplateTable; + +declare type EachTestFn = ( + ...args: ReadonlyArray +) => ReturnType; + +declare type Event_2 = SyncEvent | AsyncEvent; + +declare interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} + +declare type Exception = any; + +declare type FakeableAPI = + | 'Date' + | 'hrtime' + | 'nextTick' + | 'performance' + | 'queueMicrotask' + | 'requestAnimationFrame' + | 'cancelAnimationFrame' + | 'requestIdleCallback' + | 'cancelIdleCallback' + | 'setImmediate' + | 'clearImmediate' + | 'setInterval' + | 'clearInterval' + | 'setTimeout' + | 'clearTimeout'; + +declare type FakeTimers = GlobalFakeTimersConfig & + ( + | (FakeTimersConfig & { + now?: Exclude; + }) + | LegacyFakeTimersConfig + ); + +declare type FakeTimersConfig = { + /** + * If set to `true` all timers will be advanced automatically + * by 20 milliseconds every 20 milliseconds. A custom time delta + * may be provided by passing a number. + * + * @defaultValue + * The default is `false`. + */ + advanceTimers?: boolean | number; + /** + * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, + * `setTimeout()`) that should not be faked. + * + * @defaultValue + * The default is `[]`, meaning all APIs are faked. + * */ + doNotFake?: Array; + /** + * Sets current system time to be used by fake timers. + * + * @defaultValue + * The default is `Date.now()`. + */ + now?: number | Date; + /** + * The maximum number of recursive timers that will be run when calling + * `jest.runAllTimers()`. + * + * @defaultValue + * The default is `100_000` timers. + */ + timerLimit?: number; + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: false; +}; + +declare type FormattedError = string; + +declare type GeneratorReturningTestFn = ( + this: TestContext, +) => TestReturnValueGenerator; + +declare namespace Global { + export { + ValidTestReturnValues, + TestReturnValue, + TestContext, + DoneFn_2 as DoneFn, + DoneTakingTestFn, + PromiseReturningTestFn, + GeneratorReturningTestFn, + NameLike, + TestName, + TestNameLike, + TestFn, + ConcurrentTestFn, + BlockFn, + BlockName, + BlockNameLike, + HookFn, + Col, + Row, + Table, + ArrayTable, + TemplateTable, + TemplateData, + EachTable, + TestCallback, + EachTestFn, + HookBase, + ItBase, + It, + ItConcurrentBase, + ItConcurrentExtended, + ItConcurrent, + DescribeBase, + Describe, + TestFrameworkGlobals, + GlobalAdditions, + Global_2 as Global, + }; +} +export {Global}; + +declare interface Global_2 + extends GlobalAdditions, + Omit { + [extras: PropertyKey]: unknown; +} + +declare interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; +} + +declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + ci: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + expand: boolean; + filter?: string; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: string; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: string; + shard?: ShardConfig; + silent?: boolean; + skipFilter: boolean; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; + +declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array< + (exception: Exception, promise: Promise) => void + >; +}; + +declare type GlobalFakeTimersConfig = { + /** + * Whether fake timers should be enabled globally for all test files. + * + * @defaultValue + * The default is `false`. + * */ + enableGlobally?: boolean; +}; + +declare type HasteConfig = { + /** Whether to hash files using SHA-1. */ + computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ + defaultPlatform?: string | null; + /** Force use of Node's `fs` APIs rather than shelling out to `find` */ + forceNodeFilesystemAPI?: boolean; + /** + * Whether to follow symlinks when crawling for files. + * This options cannot be used in projects which use watchman. + * Projects with `watchman` set to true will error if this option is set to true. + */ + enableSymlinks?: boolean; + /** string to a custom implementation of Haste. */ + hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ + platforms?: Array; + /** Whether to throw on error on module collision. */ + throwOnModuleCollision?: boolean; + /** Custom HasteMap module */ + hasteMapModulePath?: string; + /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ + retainAllFiles?: boolean; +}; + +declare type Hook = { + asyncError: Error; + fn: HookFn_2; + type: HookType; + parent: DescribeBlock; + seenDone: boolean; + timeout: number | undefined | null; +}; + +declare interface HookBase { + (fn: HookFn, timeout?: number): void; +} + +declare type HookFn = TestFn; + +declare type HookFn_2 = Global.HookFn; + +declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; + +declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + cache: boolean; + cacheDirectory: string; + ci: boolean; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: CoverageReporters; + coverageThreshold: CoverageThreshold; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: string | DisplayName; + expand: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter: string; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + onlyFailures: boolean; + outputFile: string; + passWithNoTests: boolean; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runTestsByPath: boolean; + runtime: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + slowTestThreshold: number; + snapshotResolver: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testTimeout: number; + transform: { + [regex: string]: string | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; + +declare type InitialOptionsWithRootDir = InitialOptions & + Required>; + +declare type InitialProjectOptions = Pick< + InitialOptions & { + cwd?: string; + }, + keyof ProjectConfig +>; + +declare interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestNameLike) => void; +} + +declare interface ItBase { + (testName: TestNameLike, fn: TestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} + +declare interface ItConcurrentBase { + (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; + each: Each; +} + +declare interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} + +declare interface JestGlobals extends Global.TestFrameworkGlobals { + expect: unknown; +} + +declare type LegacyFakeTimersConfig = { + /** + * Use the old fake timers implementation instead of one backed by + * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). + * + * @defaultValue + * The default is `false`. + */ + legacyFakeTimers?: true; +}; + +declare type MatcherResults = { + actual: unknown; + expected: unknown; + name: string; + pass: boolean; +}; + +declare type Milliseconds = number; + +declare type NameLike = number | Function; + +declare type NotifyMode = + | 'always' + | 'failure' + | 'success' + | 'change' + | 'success-change' + | 'failure-change'; + +declare type Process = NodeJS.Process; + +declare type ProjectConfig = { + automock: boolean; + cache: boolean; + cacheDirectory: string; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: string; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extensionsToTreatAsEsm: Array; + fakeTimers: FakeTimers; + filter?: string; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + id: string; + injectGlobals: boolean; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: string; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runner: string; + runtime?: string; + sandboxInjectedGlobals: Array; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + slowTestThreshold: number; + snapshotResolver?: string; + snapshotSerializers: Array; + snapshotFormat: SnapshotFormat; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + transform: Array<[string, string, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; + +declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; + +declare type ReporterConfig = [string, Record]; + +declare type Row = ReadonlyArray; + +declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; + +declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; + +declare type ShardConfig = { + shardIndex: number; + shardCount: number; +}; + +declare type SharedHookType = 'afterAll' | 'beforeAll'; + +declare type SnapshotUpdateState = 'all' | 'new' | 'none'; + +declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + hasStarted: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; + maxConcurrency: number; +}; + +declare type Status = + | 'passed' + | 'failed' + | 'skipped' + | 'pending' + | 'todo' + | 'disabled'; + +declare type SyncEvent = + | { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName_2; + } + | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName_2; + } + | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn_2; + timeout: number | undefined; + } + | { + asyncError: Error; + name: 'add_test'; + testName: TestName_2; + fn: TestFn_2; + mode?: TestMode; + concurrent: boolean; + timeout: number | undefined; + } + | { + name: 'error'; + error: Exception; + }; + +declare type Table = ReadonlyArray; + +declare type TemplateData = ReadonlyArray; + +declare type TemplateTable = TemplateStringsArray; + +declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; + +declare type TestContext = Record; + +declare type TestContext_2 = Global.TestContext; + +declare type TestEntry = { + type: 'test'; + asyncError: Exception; + errors: Array; + retryReasons: Array; + fn: TestFn_2; + invocations: number; + mode: TestMode; + concurrent: boolean; + name: TestName_2; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + seenDone: boolean; + status?: TestStatus | null; + timeout?: number; +}; + +declare type TestError = Exception | [Exception | undefined, Exception]; + +declare type TestFn = + | PromiseReturningTestFn + | GeneratorReturningTestFn + | DoneTakingTestFn; + +declare type TestFn_2 = Global.TestFn; + +declare interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookBase; + beforeEach: HookBase; + afterEach: HookBase; + afterAll: HookBase; +} + +declare type TestMode = BlockMode; + +declare type TestName = string; + +declare type TestName_2 = Global.TestName; + +declare type TestNameLike = TestName | NameLike; + +declare type TestNameLike_2 = Global.TestNameLike; + +declare namespace TestResult { + export {Milliseconds, AssertionResult, SerializableError}; +} +export {TestResult}; + +declare type TestResult_2 = { + duration?: number | null; + errors: Array; + errorsDetailed: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + retryReasons: Array; + testPath: Array; +}; + +declare type TestResults = Array; + +declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; + +declare type TestReturnValueGenerator = Generator; + +declare type TestReturnValuePromise = Promise; + +declare type TestStatus = 'skip' | 'done' | 'todo'; + +declare type TransformerConfig = [string, Record]; + +declare type TransformResult = { + code: string; + originalCode: string; + sourceMapPath: string | null; +}; + +declare namespace TransformTypes { + export {TransformResult}; +} +export {TransformTypes}; + +declare type ValidTestReturnValues = void | undefined; + +export {}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/package.json b/node_modules/jest-circus/node_modules/@jest/types/package.json index 9f7100a26..dac10d625 100644 --- a/node_modules/jest-circus/node_modules/@jest/types/package.json +++ b/node_modules/jest-circus/node_modules/@jest/types/package.json @@ -1,13 +1,13 @@ { "name": "@jest/types", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-types" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "license": "MIT", "main": "./build/index.js", @@ -20,18 +20,19 @@ "./package.json": "./package.json" }, "dependencies": { + "@jest/schemas": "^28.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "devDependencies": { - "@tsd/typescript": "~4.1.5", + "@tsd/typescript": "~4.6.2", "tsd-lite": "^0.5.1" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/jest-circus/node_modules/@types/yargs/README.md b/node_modules/jest-circus/node_modules/@types/yargs/README.md index 4d7a0e9dc..bd90803ff 100755 --- a/node_modules/jest-circus/node_modules/@types/yargs/README.md +++ b/node_modules/jest-circus/node_modules/@types/yargs/README.md @@ -5,12 +5,12 @@ This package contains type definitions for yargs (https://github.com/chevex/yargs). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs/v16. +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs. ### Additional Details - * Last updated: Fri, 02 Jul 2021 16:32:05 GMT + * Last updated: Thu, 17 Mar 2022 22:31:44 GMT * Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser) * Global values: none # Credits -These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen). +These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe). diff --git a/node_modules/jest-circus/node_modules/@types/yargs/helpers.d.mts b/node_modules/jest-circus/node_modules/@types/yargs/helpers.d.mts new file mode 100755 index 000000000..de0386392 --- /dev/null +++ b/node_modules/jest-circus/node_modules/@types/yargs/helpers.d.mts @@ -0,0 +1 @@ +export * from "./helpers.js"; \ No newline at end of file diff --git a/node_modules/jest-circus/node_modules/@types/yargs/index.d.mts b/node_modules/jest-circus/node_modules/@types/yargs/index.d.mts new file mode 100755 index 000000000..0b076c333 --- /dev/null +++ b/node_modules/jest-circus/node_modules/@types/yargs/index.d.mts @@ -0,0 +1,39 @@ +import yargs = require("./index.js"); +interface RequireType { + (path: string): Function; + main: MainType; +} + +interface MainType { + filename: string; + children: MainType[]; +} +declare const _instanceFactory: (processArgs: string[], cwd?: string, parentRequire?: RequireType) => yargs.Argv; +export default _instanceFactory; + +export type { + BuilderCallback, + ParserConfigurationOptions, + Argv, + Arguments, + RequireDirectoryOptions, + Options, + PositionalOptions, + Defined, + ToArray, + ToString, + ToNumber, + InferredOptionType, + InferredOptionTypeInner, + RequiredOptionType, + InferredOptionTypes, + CommandModule, + ParseCallback, + CommandBuilder, + SyncCompletionFunction, + AsyncCompletionFunction, + PromiseCompletionFunction, + MiddlewareFunction, + Choices, + PositionalOptionsType, +} from './index.js'; diff --git a/node_modules/jest-circus/node_modules/@types/yargs/index.d.ts b/node_modules/jest-circus/node_modules/@types/yargs/index.d.ts index c2e0c00cb..1b6cec7be 100755 --- a/node_modules/jest-circus/node_modules/@types/yargs/index.d.ts +++ b/node_modules/jest-circus/node_modules/@types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 16.0 +// Type definitions for yargs 17.0 // Project: https://github.com/chevex/yargs, https://yargs.js.org // Definitions by: Martin Poelstra // Mizunashi Mana @@ -8,8 +8,8 @@ // Emily Marigold Klassen // ExE Boss // Aankhen +// Ben Coe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 // The following TSLint rules have been disabled: // unified-signatures: Because there is useful information in the argument names of the overloaded signatures @@ -44,7 +44,7 @@ declare namespace yargs { * `Arguments` to simplify the inferred type signature in client code. */ interface Argv { - (): { [key in keyof Arguments]: Arguments[key] }; + (): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; (args: ReadonlyArray, cwd?: string): Argv; /** @@ -70,7 +70,7 @@ declare namespace yargs { * it will ignore the first parameter since it expects it to be the script name. In order to override * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. */ - argv: { [key in keyof Arguments]: Arguments[key] }; + argv: { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * Tell the parser to interpret `key` as an array. @@ -148,7 +148,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { command: string | ReadonlyArray, description: string, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -165,7 +165,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: BuilderCallback, - handler?: (args: Arguments) => void, + handler?: (args: ArgumentsCamelCase) => void | Promise, middlewares?: MiddlewareFunction[], deprecated?: boolean | string, ): Argv; @@ -173,7 +173,7 @@ declare namespace yargs { command: string | ReadonlyArray, showInHelp: false, builder?: O, - handler?: (args: Arguments>) => void, + handler?: (args: ArgumentsCamelCase>) => void | Promise, ): Argv; command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; command(module: CommandModule): Argv; @@ -332,7 +332,7 @@ declare namespace yargs { * Method to execute when a failure occurs, rather than printing the failure message. * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. */ - fail(func: (msg: string, err: Error, yargs: Argv) => any): Argv; + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; /** * Allows to programmatically get completion choices for any line. @@ -341,6 +341,11 @@ declare namespace yargs { */ getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + /** * Indicate that an option (or group of options) should not be reset when a command is executed * @@ -453,8 +458,16 @@ declare namespace yargs { * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. * @param [context] Provides a useful mechanism for passing state information to commands */ - parse(): { [key in keyof Arguments]: Arguments[key] }; - parse(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parse(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] } | Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments as key | CamelCaseKey]: Arguments[key] }>; /** * If the arguments have not been parsed, this property is `false`. @@ -508,12 +521,6 @@ declare namespace yargs { requiresArg(key: string | ReadonlyArray): Argv; - /** - * @deprecated since version 6.6.0 - * Use '.global()' instead - */ - reset(): Argv; - /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ scriptName($0: string): Argv; @@ -552,6 +559,12 @@ declare namespace yargs { */ showHelpOnFail(enable: boolean, message?: string): Argv; + /** + * Print the version data using the console function consoleLevel or the specified function. + * @param [level='error'] + */ + showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv; + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ skipValidation(key: string | ReadonlyArray): Argv; @@ -610,10 +623,20 @@ declare namespace yargs { * and allows you to provide configuration for the positional arguments accepted by your program: */ usage(message: string): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; - usage(command: string | ReadonlyArray, description: string, builder?: O, handler?: (args: Arguments>) => void): Argv; - usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: O, handler?: (args: Arguments>) => void): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: ArgumentsCamelCase) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: ArgumentsCamelCase>) => void | Promise, + ): Argv; /** * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. @@ -647,6 +670,16 @@ declare namespace yargs { [argName: string]: unknown; }; + /** Arguments type, with camelcased keys */ + type ArgumentsCamelCase = { [key in keyof T as key | CamelCaseKey]: T[key] } & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + interface RequireDirectoryOptions { /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ recurse?: boolean | undefined; @@ -734,7 +767,7 @@ declare namespace yargs { skipValidation?: boolean | undefined; /** boolean, interpret option as a string, see `string()` */ string?: boolean | undefined; - type?: "array" | "count" | PositionalOptionsType | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; } interface PositionalOptions { @@ -765,6 +798,26 @@ declare namespace yargs { type?: PositionalOptionsType | undefined; } + // not implemented: yargs camelizes '_', but only if there's a '-' in the arg name + // not implemented: yargs decamelizes (converts fooBar to foo-bar) + + /** Convert literal string types like 'foo-bar' to 'FooBar' */ + type PascalCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${Capitalize}${PascalCase}` + : Capitalize; + + /** Convert literal string types like 'foo-bar' to 'fooBar' */ + type CamelCase = string extends S + ? string + : S extends `${infer T}-${infer U}` + ? `${T}${PascalCase}` + : S; + + /** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */ + type CamelCaseKey = K extends string ? Exclude, ''> : K; + /** Remove keys K in T */ type Omit = { [key in Exclude]: T[key] }; @@ -780,17 +833,26 @@ declare namespace yargs { /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + // prettier-ignore type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = O extends { default: any, coerce: (arg: any) => infer T } ? T : O extends { default: infer D } ? D : O extends { type: "count" } ? number : O extends { count: true } ? number : - O extends { required: string | true } ? RequiredOptionType : - O extends { require: string | true } ? RequiredOptionType : - O extends { demand: string | true } ? RequiredOptionType : - O extends { demandOption: string | true } ? RequiredOptionType : RequiredOptionType | undefined; + // prettier-ignore type RequiredOptionType = O extends { type: "array", string: true } ? string[] : O extends { type: "array", number: true } ? number[] : @@ -827,17 +889,17 @@ declare namespace yargs { /** string used as the description for the command in help text, use `false` for a hidden command */ describe?: string | false | undefined; /** a function which will be passed the parsed argv. */ - handler: (args: Arguments) => void; + handler: (args: ArgumentsCamelCase) => void | Promise; } - type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type ParseCallback = (err: Error | undefined, argv: ArgumentsCamelCase, output: string) => void | Promise; type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; type PromiseCompletionFunction = (current: string, argv: any) => Promise; - type MiddlewareFunction = (args: Arguments) => void; + type MiddlewareFunction = (args: Arguments) => void | Promise; type Choices = ReadonlyArray; - type PositionalOptionsType = "boolean" | "number" | "string"; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; } declare var yargs: yargs.Argv; diff --git a/node_modules/jest-circus/node_modules/@types/yargs/package.json b/node_modules/jest-circus/node_modules/@types/yargs/package.json index 135f75a03..f5020bf8a 100755 --- a/node_modules/jest-circus/node_modules/@types/yargs/package.json +++ b/node_modules/jest-circus/node_modules/@types/yargs/package.json @@ -1,6 +1,6 @@ { "name": "@types/yargs", - "version": "16.0.4", + "version": "17.0.10", "description": "TypeScript definitions for yargs", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs", "license": "MIT", @@ -44,10 +44,22 @@ "name": "Aankhen", "url": "https://github.com/Aankhen", "githubUsername": "Aankhen" + }, + { + "name": "Ben Coe", + "url": "https://github.com/bcoe", + "githubUsername": "bcoe" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=4.1": { + "*": [ + "ts4.1/*" + ] + } + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -57,6 +69,26 @@ "dependencies": { "@types/yargs-parser": "*" }, - "typesPublisherContentHash": "d46fdfa13e8760d2fb36fecd2e85de1f955504f612121a84f42188b00876dc45", - "typeScriptVersion": "3.6" + "typesPublisherContentHash": "3a3301ae1e830cacd8e2ff90d3e54797b81ab3d844e13c4f0c49351248d8d002", + "typeScriptVersion": "3.9", + "exports": { + ".": { + "types": { + "import": "./index.d.mts", + "default": "./index.d.ts" + } + }, + "./helpers": { + "types": { + "import": "./helpers.d.mts", + "default": "./helpers.d.ts" + } + }, + "./yargs": { + "types": { + "default": "./yargs.d.ts" + } + }, + "./package.json": "./package.json" + } } \ No newline at end of file diff --git a/node_modules/jest-circus/node_modules/@types/yargs/ts4.1/index.d.ts b/node_modules/jest-circus/node_modules/@types/yargs/ts4.1/index.d.ts new file mode 100755 index 000000000..04bb988eb --- /dev/null +++ b/node_modules/jest-circus/node_modules/@types/yargs/ts4.1/index.d.ts @@ -0,0 +1,857 @@ +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | ReadonlyArray') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray`, +// thus it's preferred to use `command: string | ReadonlyArray` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +import { DetailedArguments, Configuration } from 'yargs-parser'; + +declare namespace yargs { + type BuilderCallback = ((args: Argv) => PromiseLike>) | ((args: Argv) => Argv) | ((args: Argv) => void); + + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + + /** + * The type parameter `T` is the expected shape of the parsed options. + * `Arguments` is those options plus `_` and `$0`, and an indexer falling + * back to `unknown` for unknown options. + * + * For the return type / `argv` property, we create a mapped type over + * `Arguments` to simplify the inferred type signature in client code. + */ + interface Argv { + (): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + (args: ReadonlyArray, cwd?: string): Argv; + + /** + * Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. + * + * Optionally `.alias()` can take an object that maps keys to aliases. + * Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. + */ + // Aliases for previously declared options can inherit the types of those options. + alias(shortName: K1, longName: K2 | ReadonlyArray): Argv; + alias(shortName: K2, longName: K1 | ReadonlyArray): Argv; + alias(shortName: string | ReadonlyArray, longName: string | ReadonlyArray): Argv; + alias(aliases: { [shortName: string]: string | ReadonlyArray }): Argv; + + /** + * Get the arguments as a plain old object. + * + * Arguments without a corresponding flag show up in the `argv._` array. + * + * The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. + * + * If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js), + * it will ignore the first parameter since it expects it to be the script name. In order to override + * this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored. + */ + argv: { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * Tell the parser to interpret `key` as an array. + * If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`. + * Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']` + * + * When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array. + */ + array(key: K | ReadonlyArray): Argv & { [key in K]: ToArray }>; + array(key: K | ReadonlyArray): Argv | undefined }>; + + /** + * Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. + * + * `key` will default to `false`, unless a `default(key, undefined)` is explicitly set. + * + * If `key` is an array, interpret all the elements as booleans. + */ + boolean(key: K | ReadonlyArray): Argv & { [key in K]: boolean | undefined }>; + boolean(key: K | ReadonlyArray): Argv; + + /** + * Check that certain conditions are met in the provided arguments. + * @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases. + * If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit. + * @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command. + */ + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + /** + * Limit valid values for key to a predefined set of choices, given as an array or as an individual value. + * If this method is called multiple times, all enumerated values will be merged together. + * Choices are generally strings or numbers, and value matching is case-sensitive. + * + * Optionally `.choices()` can take an object that maps multiple keys to their choices. + * + * Choices can also be specified as choices in the object given to `option()`. + */ + choices>(key: K, values: C): Argv & { [key in K]: C[number] | undefined }>; + choices>(key: K, values: C): Argv; + choices }>(choices: C): Argv & { [key in keyof C]: C[key][number] | undefined }>; + + /** + * Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`. + * + * The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error. + * The returned value will be used as the value for `key` (or one of its aliases) in `argv`. + * + * If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console. + * + * Coercion will be applied to a value after all other modifications, such as `.normalize()`. + * + * Optionally `.coerce()` can take an object that maps several keys to their respective coercion function. + * + * You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`. + * + * If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed + */ + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv & { [key in K]: V | undefined }>; + coerce(key: K | ReadonlyArray, func: (arg: any) => V): Argv; + coerce any }>(opts: O): Argv & { [key in keyof O]: ReturnType | undefined }>; + + /** + * Define the commands exposed by your application. + * @param command Should be a string representing the command or an array of strings representing the command and its aliases. + * @param description Use to provide a description for each command your application accepts (the values stored in `argv._`). + * Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion. + * @param [builder] Object to give hints about the options that your command accepts. + * Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command-specific help. + * + * Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments. + * @param [handler] Function, which will be executed with the parsed `argv` object. + */ + command( + command: string | ReadonlyArray, + description: string, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command(command: string | ReadonlyArray, description: string, module: CommandModule): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: BuilderCallback, + handler?: (args: Arguments) => void | Promise, + middlewares?: MiddlewareFunction[], + deprecated?: boolean | string, + ): Argv; + command( + command: string | ReadonlyArray, + showInHelp: false, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + command(command: string | ReadonlyArray, showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + /** Apply command modules from a directory relative to the module calling this method. */ + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + /** + * Enable bash/zsh-completion shortcuts for commands and options. + * + * If invoked without parameters, `.completion()` will make completion the command to output the completion script. + * + * @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted. + * To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh). + * @param [description] Provide a description in your usage instructions for the command that generates the completion scripts. + * @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method. + */ + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, func?: PromiseCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv; + + /** + * Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file. + * The file is loaded and parsed, and its properties are set as arguments. + * Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly. + * + * If invoked without parameters, `.config()` will make --config the option to pass the JSON config file. + * + * @param [description] Provided to customize the config (`key`) option in the usage string. + * @param [explicitConfigurationObject] An explicit configuration `object` + */ + config(): Argv; + config(key: string | ReadonlyArray, description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | ReadonlyArray, parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + /** + * Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with. + * + * Optionally `.conflicts()` can accept an object specifying multiple conflicting keys. + */ + conflicts(key: string, value: string | ReadonlyArray): Argv; + conflicts(conflicts: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`. + */ + count(key: K | ReadonlyArray): Argv & { [key in K]: number }>; + count(key: K | ReadonlyArray): Argv; + + /** + * Set `argv[key]` to `value` if no option was specified in `process.argv`. + * + * Optionally `.default()` can take an object that maps keys to default values. + * + * The default value can be a `function` which returns a value. The name of the function will be used in the usage string. + * + * Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions. + */ + default(key: K, value: V, description?: string): Argv & { [key in K]: V }>; + default(key: K, value: V, description?: string): Argv; + default(defaults: D, description?: string): Argv & D>; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: K | ReadonlyArray, msg?: string | true): Argv>; + demand(key: K | ReadonlyArray, msg?: string | true): Argv; + demand(key: string | ReadonlyArray, required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + /** + * @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`. + * If is an array, demand each element. + * @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message. + * @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters. + */ + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv>; + demandOption(key: K | ReadonlyArray, msg?: string | true): Argv; + demandOption(key: string | ReadonlyArray, demand?: boolean): Argv; + + /** + * Demand in context of commands. + * You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met. + */ + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + /** + * Shows a [deprecated] notice in front of the option + */ + deprecateOption(option: string, msg?: string): Argv; + + /** + * Describe a `key` for the generated usage information. + * + * Optionally `.describe()` can take an object that maps keys to descriptions. + */ + describe(key: string | ReadonlyArray, description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + /** Should yargs attempt to detect the os' locale? Defaults to `true`. */ + detectLocale(detect: boolean): Argv; + + /** + * Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments. + * + * Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo) + * + * If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv. + * + * Program arguments are defined in this order of precedence: + * 1. Command line args + * 2. Env vars + * 3. Config file/objects + * 4. Configured defaults + * + * Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration. + */ + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + /** A message to print at the end of the usage instructions */ + epilog(msg: string): Argv; + /** A message to print at the end of the usage instructions */ + epilogue(msg: string): Argv; + + /** + * Give some example invocations of your program. + * Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * Examples will be printed out as part of the help message. + */ + example(command: string, description: string): Argv; + example(command: ReadonlyArray<[string, string?]>): Argv; + + /** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */ + exit(code: number, err: Error): void; + + /** + * By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails. + * Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + */ + exitProcess(enabled: boolean): Argv; + + /** + * Method to execute when a failure occurs, rather than printing the failure message. + * @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred. + */ + fail(func: ((msg: string, err: Error, yargs: Argv) => any) | boolean): Argv; + + /** + * Allows to programmatically get completion choices for any line. + * @param args An array of the words in the command line to complete. + * @param done The callback to be called with the resulting completions. + */ + getCompletion(args: ReadonlyArray, done: (completions: ReadonlyArray) => void): Argv; + + /** + * Returns a promise which resolves to a string containing the help text. + */ + getHelp(): Promise; + + /** + * Indicate that an option (or group of options) should not be reset when a command is executed + * + * Options default to being global. + */ + global(key: string | ReadonlyArray): Argv; + + /** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */ + group(key: string | ReadonlyArray, groupName: string): Argv; + + /** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */ + hide(key: string): Argv; + + /** + * Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process. + * By default yargs enables help on the `--help` option. + * + * Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command. + * If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command. + * + * If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output. + * + * @param [description] Customizes the description of the help option in the usage string. + * @param [enableExplicit] If `false` is provided, it will disable --help. + */ + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + /** + * Given the key `x` is set, it is required that the key `y` is set. + * y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`. + * + * Optionally `.implies()` can accept an object specifying multiple implications. + */ + implies(key: string, value: string | ReadonlyArray): Argv; + implies(implies: { [key: string]: string | ReadonlyArray }): Argv; + + /** + * Return the locale that yargs is currently using. + * + * By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language. + */ + locale(): string; + /** + * Override the auto-detected locale from the user's operating system with a static locale. + * Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable. + */ + locale(loc: string): Argv; + + /** + * Define global middleware functions to be called first, in list order, for all cli command. + * @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv. + * @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing. + */ + middleware(callbacks: MiddlewareFunction | ReadonlyArray>, applyBeforeValidation?: boolean): Argv; + + /** + * The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity. + * + * Optionally `.nargs()` can take an object of `key`/`narg` pairs. + */ + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + /** The key provided represents a path and should have `path.normalize()` applied. */ + normalize(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + normalize(key: K | ReadonlyArray): Argv; + + /** + * Tell the parser to always interpret key as a number. + * + * If `key` is an array, all elements will be parsed as numbers. + * + * If the option is given on the command line without a value, `argv` will be populated with `undefined`. + * + * If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`. + * + * Note that decimals, hexadecimals, and scientific notation are all accepted. + */ + number(key: K | ReadonlyArray): Argv & { [key in K]: ToNumber }>; + number(key: K | ReadonlyArray): Argv; + + /** + * Method to execute when a command finishes successfully. + * @param func Is called with the successful result of the command that finished. + */ + onFinishCommand(func: (result: any) => void): Argv; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + option(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + option(key: K, options: O): Argv }>; + option(options: O): Argv & InferredOptionTypes>; + + /** + * This method can be used to make yargs aware of options that could exist. + * You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option. + */ + options(key: K, options: O): Argv & { [key in K]: InferredOptionType }>; + options(key: K, options: O): Argv }>; + options(options: O): Argv & InferredOptionTypes>; + + /** + * Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string. + * + * Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked. + * @param [context] Provides a useful mechanism for passing state information to commands + */ + parse(): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parse( + arg: string | ReadonlyArray, + context?: object, + parseCallback?: ParseCallback, + ): { [key in keyof Arguments]: Arguments[key] } | Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseSync(): { [key in keyof Arguments]: Arguments[key] }; + parseSync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): { [key in keyof Arguments]: Arguments[key] }; + parseAsync(): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + parseAsync(arg: string | ReadonlyArray, context?: object, parseCallback?: ParseCallback): Promise<{ [key in keyof Arguments]: Arguments[key] }>; + + /** + * If the arguments have not been parsed, this property is `false`. + * + * If the arguments have been parsed, this contain detailed parsed arguments. + */ + parsed: DetailedArguments | false; + + /** Allows to configure advanced yargs features. */ + parserConfiguration(configuration: Partial): Argv; + + /** + * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. + * @param [cwd] If provided, the package.json will be read from this location + */ + pkgConf(key: string | ReadonlyArray, cwd?: string): Argv; + + /** + * Allows you to configure a command's positional arguments with an API similar to `.option()`. + * `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: K, opt: O): Argv & { [key in K]: InferredOptionType }>; + positional(key: K, opt: O): Argv }>; + + /** Should yargs provide suggestions regarding similar commands if no matching command is found? */ + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: K | ReadonlyArray, msg?: string | true): Argv>; + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: ReadonlyArray, msg: string): Argv; + require(keys: ReadonlyArray, required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: K | ReadonlyArray, msg?: string | true): Argv>; + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: ReadonlyArray, msg: string): Argv; + required(keys: ReadonlyArray, required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | ReadonlyArray): Argv; + + /** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */ + scriptName($0: string): Argv; + + /** + * Generate a bash completion script. + * Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. + */ + showCompletionScript(): Argv; + + /** + * Configure the `--show-hidden` option that displays the hidden keys (see `hide()`). + * @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`. + * If `string` it changes the key name ("--show-hidden"). + * @param description Changes the default description ("Show hidden options") + */ + showHidden(option?: string | boolean): Argv; + showHidden(option: string, description?: string): Argv; + + /** + * Print the usage data using the console function consoleLevel for printing. + * @param [consoleLevel='error'] + */ + showHelp(consoleLevel?: string): Argv; + + /** + * Provide the usage data as a string. + * @param printCallback a function with a single argument. + */ + showHelp(printCallback: (s: string) => void): Argv; + + /** + * By default, yargs outputs a usage string if any error is detected. + * Use the `.showHelpOnFail()` method to customize this behavior. + * @param enable If `false`, the usage string is not output. + * @param [message] Message that is output after the error message. + */ + showHelpOnFail(enable: boolean, message?: string): Argv; + + /** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */ + skipValidation(key: string | ReadonlyArray): Argv; + + /** + * Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. + * + * Unrecognized commands will also be reported as errors. + */ + strict(): Argv; + strict(enabled: boolean): Argv; + + /** + * Similar to .strict(), except that it only applies to unrecognized commands. + * A user can still provide arbitrary options, but unknown positional commands + * will raise an error. + */ + strictCommands(): Argv; + strictCommands(enabled: boolean): Argv; + + /** + * Similar to `.strict()`, except that it only applies to unrecognized options. A + * user can still provide arbitrary positional options, but unknown options + * will raise an error. + */ + strictOptions(): Argv; + strictOptions(enabled: boolean): Argv; + + /** + * Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. + * + * If `key` is an array, interpret all the elements as strings. + * + * `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. + */ + string(key: K | ReadonlyArray): Argv & { [key in K]: ToString }>; + string(key: K | ReadonlyArray): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + /** + * Override the default strings used by yargs with the key/value pairs provided in obj + * + * If you explicitly specify a locale(), you should do so before calling `updateStrings()`. + */ + updateStrings(obj: { [key: string]: string }): Argv; + + /** + * Set a usage message to show which commands to use. + * Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. + * + * If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`. + * This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application + * and allows you to provide configuration for the positional arguments accepted by your program: + */ + usage(message: string): Argv; + usage(command: string | ReadonlyArray, description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage(command: string | ReadonlyArray, showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void | Promise): Argv; + usage( + command: string | ReadonlyArray, + description: string, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + usage( + command: string | ReadonlyArray, + showInHelp: boolean, + builder?: O, + handler?: (args: Arguments>) => void | Promise, + ): Argv; + + /** + * Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process. + * By default yargs enables version for the `--version` option. + * + * If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value. + * + * If the boolean argument `false` is provided, it will disable `--version`. + */ + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + /** + * Format usage output to wrap at columns many columns. + * + * By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align). + * Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions. + */ + wrap(columns: number | null): Argv; + } + + type Arguments = T & { + /** Non-option arguments */ + _: Array; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: unknown; + }; + + interface RequireDirectoryOptions { + /** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */ + recurse?: boolean | undefined; + /** The types of files to look for when requiring command modules. */ + extensions?: ReadonlyArray | undefined; + /** + * A synchronous function called for each command module encountered. + * Accepts `commandObject`, `pathToFile`, and `filename` as arguments. + * Returns `commandObject` to include the command; any falsy value to exclude/skip it. + */ + visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined; + /** Whitelist certain modules */ + include?: RegExp | ((pathToFile: string) => boolean) | undefined; + /** Blacklist certain modules. */ + exclude?: RegExp | ((pathToFile: string) => boolean) | undefined; + } + + interface Options { + /** string or array of strings, alias(es) for the canonical option key, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** boolean, interpret option as a boolean flag, see `boolean()` */ + boolean?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** boolean, interpret option as a path to a JSON config file, see `config()` */ + config?: boolean | undefined; + /** function, provide a custom config parsing function, see `config()` */ + configParser?: ((configPath: string) => object) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, interpret option as a count of boolean flags, see `count()` */ + count?: boolean | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** string, use this description for the default value in help content, see `default()` */ + defaultDescription?: string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecate?: boolean | string | undefined; + /** boolean or string, mark the argument as deprecated, see `deprecateOption()` */ + deprecated?: boolean | string | undefined; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */ + global?: boolean | undefined; + /** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */ + group?: string | undefined; + /** don't display option in help output. */ + hidden?: boolean | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** number, specify how many arguments should be consumed for the option, see `nargs()` */ + nargs?: number | undefined; + /** boolean, apply path.normalize() to the option, see `normalize()` */ + normalize?: boolean | undefined; + /** boolean, interpret option as a number, `number()` */ + number?: boolean | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + require?: boolean | string | undefined; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + required?: boolean | string | undefined; + /** boolean, require the option be specified with a value, see `requiresArg()` */ + requiresArg?: boolean | undefined; + /** boolean, skips validation if the option is present, see `skipValidation()` */ + skipValidation?: boolean | undefined; + /** boolean, interpret option as a string, see `string()` */ + string?: boolean | undefined; + type?: 'array' | 'count' | PositionalOptionsType | undefined; + } + + interface PositionalOptions { + /** string or array of strings, see `alias()` */ + alias?: string | ReadonlyArray | undefined; + /** boolean, interpret option as an array, see `array()` */ + array?: boolean | undefined; + /** value or array of values, limit valid option arguments to a predefined set, see `choices()` */ + choices?: Choices | undefined; + /** function, coerce or transform parsed command line values into another value, see `coerce()` */ + coerce?: ((arg: any) => any) | undefined; + /** string or object, require certain keys not to be set, see `conflicts()` */ + conflicts?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** value, set a default value for the option, see `default()` */ + default?: any; + /** boolean or string, demand the option be given, with optional error message, see `demandOption()` */ + demandOption?: boolean | string | undefined; + /** string, the option description for help content, see `describe()` */ + desc?: string | undefined; + /** string, the option description for help content, see `describe()` */ + describe?: string | undefined; + /** string, the option description for help content, see `describe()` */ + description?: string | undefined; + /** string or object, require certain keys to be set, see `implies()` */ + implies?: string | ReadonlyArray | { [key: string]: string | ReadonlyArray } | undefined; + /** boolean, apply path.normalize() to the option, see normalize() */ + normalize?: boolean | undefined; + type?: PositionalOptionsType | undefined; + } + + /** Remove keys K in T */ + type Omit = { [key in Exclude]: T[key] }; + + /** Remove undefined as a possible value for keys K in T */ + type Defined = Omit & { [key in K]: Exclude }; + + /** Convert T to T[] and T | undefined to T[] | undefined */ + type ToArray = Array> | Extract; + + /** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */ + type ToString = (Exclude extends any[] ? string[] : string) | Extract; + + /** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */ + type ToNumber = (Exclude extends any[] ? number[] : number) | Extract; + + // prettier-ignore + type InferredOptionType = + O extends ( + | { required: string | true } + | { require: string | true } + | { demand: string | true } + | { demandOption: string | true } + ) ? + Exclude, undefined> : + InferredOptionTypeInner; + + // prettier-ignore + type InferredOptionTypeInner = + O extends { default: any, coerce: (arg: any) => infer T } ? T : + O extends { default: infer D } ? D : + O extends { type: "count" } ? number : + O extends { count: true } ? number : + RequiredOptionType | undefined; + + // prettier-ignore + type RequiredOptionType = + O extends { type: "array", string: true } ? string[] : + O extends { type: "array", number: true } ? number[] : + O extends { type: "array", normalize: true } ? string[] : + O extends { type: "string", array: true } ? string[] : + O extends { type: "number", array: true } ? number[] : + O extends { string: true, array: true } ? string[] : + O extends { number: true, array: true } ? number[] : + O extends { normalize: true, array: true } ? string[] : + O extends { type: "array" } ? Array : + O extends { type: "boolean" } ? boolean : + O extends { type: "number" } ? number : + O extends { type: "string" } ? string : + O extends { array: true } ? Array : + O extends { boolean: true } ? boolean : + O extends { number: true } ? number : + O extends { string: true } ? string : + O extends { normalize: true } ? string : + O extends { choices: ReadonlyArray } ? C : + O extends { coerce: (arg: any) => infer T } ? T : + unknown; + + type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; + + interface CommandModule { + /** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */ + aliases?: ReadonlyArray | string | undefined; + /** object declaring the options the command accepts, or a function accepting and returning a yargs instance */ + builder?: CommandBuilder | undefined; + /** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */ + command?: ReadonlyArray | string | undefined; + /** boolean (or string) to show deprecation notice */ + deprecated?: boolean | string | undefined; + /** string used as the description for the command in help text, use `false` for a hidden command */ + describe?: string | false | undefined; + /** a function which will be passed the parsed argv. */ + handler: (args: Arguments) => void | Promise; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments | Promise>, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv) | ((args: Argv) => PromiseLike>); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray) => void) => void; + type PromiseCompletionFunction = (current: string, argv: any) => Promise; + type MiddlewareFunction = (args: Arguments) => void; + type Choices = ReadonlyArray; + type PositionalOptionsType = 'boolean' | 'number' | 'string'; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/node_modules/jest-circus/node_modules/ansi-regex/index.d.ts b/node_modules/jest-circus/node_modules/ansi-regex/index.d.ts new file mode 100644 index 000000000..2dbf6af2b --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/node_modules/jest-circus/node_modules/ansi-regex/index.js b/node_modules/jest-circus/node_modules/ansi-regex/index.js new file mode 100644 index 000000000..616ff837d --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/jest-message-util/node_modules/has-flag/license b/node_modules/jest-circus/node_modules/ansi-regex/license similarity index 100% rename from node_modules/jest-message-util/node_modules/has-flag/license rename to node_modules/jest-circus/node_modules/ansi-regex/license diff --git a/node_modules/jest-circus/node_modules/ansi-regex/package.json b/node_modules/jest-circus/node_modules/ansi-regex/package.json new file mode 100644 index 000000000..017f53116 --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-regex/package.json @@ -0,0 +1,55 @@ +{ + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/jest-circus/node_modules/ansi-regex/readme.md b/node_modules/jest-circus/node_modules/ansi-regex/readme.md new file mode 100644 index 000000000..4d848bc36 --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
+Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/jest-circus/node_modules/ansi-styles/index.d.ts b/node_modules/jest-circus/node_modules/ansi-styles/index.d.ts new file mode 100644 index 000000000..e0170aa3d --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,167 @@ +declare namespace ansiStyles { + interface CSPair { + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; + } + + interface ColorBase { + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + + ansi256(code: number): string; + + ansi16m(red: number, green: number, blue: number): string; + } + + interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Make text overline. + + Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. + */ + readonly overline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; + } + + interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; + } + + interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; + } + + interface ConvertColor { + /** + Convert from the RGB color space to the ANSI 256 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi256(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the RGB color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToRgb(hex: string): [red: number, green: number, blue: number]; + + /** + Convert from the RGB HEX color space to the ANSI 256 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi256(hex: string): number; + } +} + +declare const ansiStyles: { + readonly modifier: ansiStyles.Modifier; + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; + readonly codes: ReadonlyMap; +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier & ansiStyles.ConvertColor; + +export = ansiStyles; diff --git a/node_modules/jest-circus/node_modules/ansi-styles/index.js b/node_modules/jest-circus/node_modules/ansi-styles/index.js new file mode 100644 index 000000000..a9eac5895 --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-styles/index.js @@ -0,0 +1,164 @@ +'use strict'; + +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value: (red, green, blue) => { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false + }, + hexToRgb: { + value: hex => { + const matches = /(?[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let {colorString} = matches.groups; + + if (colorString.length === 3) { + colorString = colorString.split('').map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF + ]; + }, + enumerable: false + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false + } + }); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/node_modules/jest-message-util/node_modules/stack-utils/node_modules/escape-string-regexp/license b/node_modules/jest-circus/node_modules/ansi-styles/license similarity index 100% rename from node_modules/jest-message-util/node_modules/stack-utils/node_modules/escape-string-regexp/license rename to node_modules/jest-circus/node_modules/ansi-styles/license diff --git a/node_modules/jest-circus/node_modules/ansi-styles/package.json b/node_modules/jest-circus/node_modules/ansi-styles/package.json new file mode 100644 index 000000000..b3c89c907 --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-styles/package.json @@ -0,0 +1,52 @@ +{ + "name": "ansi-styles", + "version": "5.2.0", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "ava": "^2.4.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.14.0", + "xo": "^0.37.1" + } +} diff --git a/node_modules/jest-circus/node_modules/ansi-styles/readme.md b/node_modules/jest-circus/node_modules/ansi-styles/readme.md new file mode 100644 index 000000000..7d1246652 --- /dev/null +++ b/node_modules/jest-circus/node_modules/ansi-styles/readme.md @@ -0,0 +1,144 @@ +# ansi-styles + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + +## Install + +``` +$ npm install ansi-styles +``` + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); + + +// Color conversion between 256/truecolor +// NOTE: When converting from truecolor to 256 colors, the original color +// may be degraded to fit the new color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(`${style.color.ansi256(style.rgbToAnsi256(199, 20, 250))}Hello World${style.color.close}`) +console.log(`${style.color.ansi16m(...style.hexToRgb('#abcdef'))}Hello World${style.color.close}`) +``` + +## API + +Each style has an `open` and `close` property. + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.* +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```js +console.log(style.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +console.log(style.codes.get(36)); +//=> 39 +``` + +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 256 and 16 million colors. + +The following color spaces from `color-convert` are supported: + +- `rgb` +- `hex` +- `ansi256` + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi256(style.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code +style.bgColor.ansi256(style.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code + +style.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code +style.bgColor.ansi16m(...style.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/jest-circus/node_modules/diff-sequences/LICENSE b/node_modules/jest-circus/node_modules/diff-sequences/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/jest-circus/node_modules/diff-sequences/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/diff-sequences/README.md b/node_modules/jest-circus/node_modules/diff-sequences/README.md new file mode 100644 index 000000000..fd5b99bea --- /dev/null +++ b/node_modules/jest-circus/node_modules/diff-sequences/README.md @@ -0,0 +1,404 @@ +# diff-sequences + +Compare items in two sequences to find a **longest common subsequence**. + +The items not in common are the items to delete or insert in a **shortest edit script**. + +To maximize flexibility and minimize memory, you write **callback** functions as configuration: + +**Input** function `isCommon(aIndex, bIndex)` compares items at indexes in the sequences and returns a truthy/falsey value. This package might call your function more than once for some pairs of indexes. + +- Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion. +- Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data. + +**Output** function `foundSubsequence(nCommon, aCommon, bCommon)` receives the number of adjacent items and starting indexes of each common subsequence. If sequences do not have common items, then this package does not call your function. + +If N is the sum of lengths of sequences and L is length of a longest common subsequence, then D = N – 2L is the number of **differences** in the corresponding shortest edit script. + +[_An O(ND) Difference Algorithm and Its Variations_](http://xmailserver.org/diff2.pdf) by Eugene W. Myers is fast when sequences have **few** differences. + +This package implements the **linear space** variation with optimizations so it is fast even when sequences have **many** differences. + +## Usage + +To add this package as a dependency of a project, do either of the following: + +- `npm install diff-sequences` +- `yarn add diff-sequences` + +To use `diff` as the name of the default export from this package, do either of the following: + +- `var diff = require('diff-sequences').default; // CommonJS modules` +- `import diff from 'diff-sequences'; // ECMAScript modules` + +Call `diff` with the **lengths** of sequences and your **callback** functions: + +```js +const a = ['a', 'b', 'c', 'a', 'b', 'b', 'a']; +const b = ['c', 'b', 'a', 'b', 'a', 'c']; + +function isCommon(aIndex, bIndex) { + return a[aIndex] === b[bIndex]; +} +function foundSubsequence(nCommon, aCommon, bCommon) { + // see examples +} + +diff(a.length, b.length, isCommon, foundSubsequence); +``` + +## Example of longest common subsequence + +Some sequences (for example, `a` and `b` in the example of usage) have more than one longest common subsequence. + +This package finds the following common items: + +| comparisons of common items | values | output arguments | +| :------------------------------- | :--------- | --------------------------: | +| `a[2] === b[0]` | `'c'` | `foundSubsequence(1, 2, 0)` | +| `a[4] === b[1]` | `'b'` | `foundSubsequence(1, 4, 1)` | +| `a[5] === b[3] && a[6] === b[4]` | `'b', 'a'` | `foundSubsequence(2, 5, 3)` | + +The “edit graph” analogy in the Myers paper shows the following common items: + +| comparisons of common items | values | +| :------------------------------- | :--------- | +| `a[2] === b[0]` | `'c'` | +| `a[3] === b[2] && a[4] === b[3]` | `'a', 'b'` | +| `a[6] === b[4]` | `'a'` | + +Various packages which implement the Myers algorithm will **always agree** on the **length** of a longest common subsequence, but might **sometimes disagree** on which **items** are in it. + +## Example of callback functions to count common items + +```js +// Return length of longest common subsequence according to === operator. +function countCommonItems(a, b) { + let n = 0; + function isCommon(aIndex, bIndex) { + return a[aIndex] === b[bIndex]; + } + function foundSubsequence(nCommon) { + n += nCommon; + } + + diff(a.length, b.length, isCommon, foundSubsequence); + + return n; +} + +const commonLength = countCommonItems( + ['a', 'b', 'c', 'a', 'b', 'b', 'a'], + ['c', 'b', 'a', 'b', 'a', 'c'], +); +``` + +| category of items | expression | value | +| :----------------- | ------------------------: | ----: | +| in common | `commonLength` | `4` | +| to delete from `a` | `a.length - commonLength` | `3` | +| to insert from `b` | `b.length - commonLength` | `2` | + +If the length difference `b.length - a.length` is: + +- negative: its absolute value is the minimum number of items to **delete** from `a` +- positive: it is the minimum number of items to **insert** from `b` +- zero: there is an **equal** number of items to delete from `a` and insert from `b` +- non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b` + +In this example, `6 - 7` is: + +- negative: `1` is the minimum number of items to **delete** from `a` +- non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b` + +## Example of callback functions to find common items + +```js +// Return array of items in longest common subsequence according to Object.is method. +const findCommonItems = (a, b) => { + const array = []; + diff( + a.length, + b.length, + (aIndex, bIndex) => Object.is(a[aIndex], b[bIndex]), + (nCommon, aCommon) => { + for (; nCommon !== 0; nCommon -= 1, aCommon += 1) { + array.push(a[aCommon]); + } + }, + ); + return array; +}; + +const commonItems = findCommonItems( + ['a', 'b', 'c', 'a', 'b', 'b', 'a'], + ['c', 'b', 'a', 'b', 'a', 'c'], +); +``` + +| `i` | `commonItems[i]` | `aIndex` | +| --: | :--------------- | -------: | +| `0` | `'c'` | `2` | +| `1` | `'b'` | `4` | +| `2` | `'b'` | `5` | +| `3` | `'a'` | `6` | + +## Example of callback functions to diff index intervals + +Instead of slicing array-like objects, you can adjust indexes in your callback functions. + +```js +// Diff index intervals that are half open [start, end) like array slice method. +const diffIndexIntervals = (a, aStart, aEnd, b, bStart, bEnd) => { + // Validate: 0 <= aStart and aStart <= aEnd and aEnd <= a.length + // Validate: 0 <= bStart and bStart <= bEnd and bEnd <= b.length + + diff( + aEnd - aStart, + bEnd - bStart, + (aIndex, bIndex) => Object.is(a[aStart + aIndex], b[bStart + bIndex]), + (nCommon, aCommon, bCommon) => { + // aStart + aCommon, bStart + bCommon + }, + ); + + // After the last common subsequence, do any remaining work. +}; +``` + +## Example of callback functions to emulate diff command + +Linux or Unix has a `diff` command to compare files line by line. Its output is a **shortest edit script**: + +- **c**hange adjacent lines from the first file to lines from the second file +- **d**elete lines from the first file +- **a**ppend or insert lines from the second file + +```js +// Given zero-based half-open range [start, end) of array indexes, +// return one-based closed range [start + 1, end] as string. +const getRange = (start, end) => + start + 1 === end ? `${start + 1}` : `${start + 1},${end}`; + +// Given index intervals of lines to delete or insert, or both, or neither, +// push formatted diff lines onto array. +const pushDelIns = (aLines, aIndex, aEnd, bLines, bIndex, bEnd, array) => { + const deleteLines = aIndex !== aEnd; + const insertLines = bIndex !== bEnd; + const changeLines = deleteLines && insertLines; + if (changeLines) { + array.push(`${getRange(aIndex, aEnd)}c${getRange(bIndex, bEnd)}`); + } else if (deleteLines) { + array.push(`${getRange(aIndex, aEnd)}d${String(bIndex)}`); + } else if (insertLines) { + array.push(`${String(aIndex)}a${getRange(bIndex, bEnd)}`); + } else { + return; + } + + for (; aIndex !== aEnd; aIndex += 1) { + array.push(`< ${aLines[aIndex]}`); // delete is less than + } + + if (changeLines) { + array.push('---'); + } + + for (; bIndex !== bEnd; bIndex += 1) { + array.push(`> ${bLines[bIndex]}`); // insert is greater than + } +}; + +// Given content of two files, return emulated output of diff utility. +const findShortestEditScript = (a, b) => { + const aLines = a.split('\n'); + const bLines = b.split('\n'); + const aLength = aLines.length; + const bLength = bLines.length; + + const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex]; + + let aIndex = 0; + let bIndex = 0; + const array = []; + const foundSubsequence = (nCommon, aCommon, bCommon) => { + pushDelIns(aLines, aIndex, aCommon, bLines, bIndex, bCommon, array); + aIndex = aCommon + nCommon; // number of lines compared in a + bIndex = bCommon + nCommon; // number of lines compared in b + }; + + diff(aLength, bLength, isCommon, foundSubsequence); + + // After the last common subsequence, push remaining change lines. + pushDelIns(aLines, aIndex, aLength, bLines, bIndex, bLength, array); + + return array.length === 0 ? '' : `${array.join('\n')}\n`; +}; +``` + +## Example of callback functions to format diff lines + +Here is simplified code to format **changed and unchanged lines** in expected and received values after a test fails in Jest: + +```js +// Format diff with minus or plus for change lines and space for common lines. +const formatDiffLines = (a, b) => { + // Jest depends on pretty-format package to serialize objects as strings. + // Unindented for comparison to avoid distracting differences: + const aLinesUn = format(a, {indent: 0 /*, other options*/}).split('\n'); + const bLinesUn = format(b, {indent: 0 /*, other options*/}).split('\n'); + // Indented to display changed and unchanged lines: + const aLinesIn = format(a, {indent: 2 /*, other options*/}).split('\n'); + const bLinesIn = format(b, {indent: 2 /*, other options*/}).split('\n'); + + const aLength = aLinesIn.length; // Validate: aLinesUn.length === aLength + const bLength = bLinesIn.length; // Validate: bLinesUn.length === bLength + + const isCommon = (aIndex, bIndex) => aLinesUn[aIndex] === bLinesUn[bIndex]; + + // Only because the GitHub Flavored Markdown doc collapses adjacent spaces, + // this example code and the following table represent spaces as middle dots. + let aIndex = 0; + let bIndex = 0; + const array = []; + const foundSubsequence = (nCommon, aCommon, bCommon) => { + for (; aIndex !== aCommon; aIndex += 1) { + array.push(`-·${aLinesIn[aIndex]}`); // delete is minus + } + for (; bIndex !== bCommon; bIndex += 1) { + array.push(`+·${bLinesIn[bIndex]}`); // insert is plus + } + for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) { + // For common lines, received indentation seems more intuitive. + array.push(`··${bLinesIn[bIndex]}`); // common is space + } + }; + + diff(aLength, bLength, isCommon, foundSubsequence); + + // After the last common subsequence, push remaining change lines. + for (; aIndex !== aLength; aIndex += 1) { + array.push(`-·${aLinesIn[aIndex]}`); + } + for (; bIndex !== bLength; bIndex += 1) { + array.push(`+·${bLinesIn[bIndex]}`); + } + + return array; +}; + +const expected = { + searching: '', + sorting: { + ascending: true, + fieldKey: 'what', + }, +}; +const received = { + searching: '', + sorting: [ + { + descending: false, + fieldKey: 'what', + }, + ], +}; + +const diffLines = formatDiffLines(expected, received); +``` + +If N is the sum of lengths of sequences and L is length of a longest common subsequence, then N – L is length of an array of diff lines. In this example, N is 7 + 9, L is 5, and N – L is 11. + +| `i` | `diffLines[i]` | `aIndex` | `bIndex` | +| ---: | :--------------------------------- | -------: | -------: | +| `0` | `'··Object {'` | `0` | `0` | +| `1` | `'····"searching": "",'` | `1` | `1` | +| `2` | `'-···"sorting": Object {'` | `2` | | +| `3` | `'-·····"ascending": true,'` | `3` | | +| `4` | `'+·····"sorting": Array ['` | | `2` | +| `5` | `'+·······Object {'` | | `3` | +| `6` | `'+·········"descending": false,'` | | `4` | +| `7` | `'··········"fieldKey": "what",'` | `4` | `5` | +| `8` | `'········},'` | `5` | `6` | +| `9` | `'+·····],'` | | `7` | +| `10` | `'··}'` | `6` | `8` | + +## Example of callback functions to find diff items + +Here is simplified code to find changed and unchanged substrings **within adjacent changed lines** in expected and received values after a test fails in Jest: + +```js +// Return diff items for strings (compatible with diff-match-patch package). +const findDiffItems = (a, b) => { + const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex]; + + let aIndex = 0; + let bIndex = 0; + const array = []; + const foundSubsequence = (nCommon, aCommon, bCommon) => { + if (aIndex !== aCommon) { + array.push([-1, a.slice(aIndex, aCommon)]); // delete is -1 + } + if (bIndex !== bCommon) { + array.push([1, b.slice(bIndex, bCommon)]); // insert is 1 + } + + aIndex = aCommon + nCommon; // number of characters compared in a + bIndex = bCommon + nCommon; // number of characters compared in b + array.push([0, a.slice(aCommon, aIndex)]); // common is 0 + }; + + diff(a.length, b.length, isCommon, foundSubsequence); + + // After the last common subsequence, push remaining change items. + if (aIndex !== a.length) { + array.push([-1, a.slice(aIndex)]); + } + if (bIndex !== b.length) { + array.push([1, b.slice(bIndex)]); + } + + return array; +}; + +const expectedDeleted = ['"sorting": Object {', '"ascending": true,'].join( + '\n', +); +const receivedInserted = [ + '"sorting": Array [', + 'Object {', + '"descending": false,', +].join('\n'); + +const diffItems = findDiffItems(expectedDeleted, receivedInserted); +``` + +| `i` | `diffItems[i][0]` | `diffItems[i][1]` | +| --: | ----------------: | :---------------- | +| `0` | `0` | `'"sorting": '` | +| `1` | `1` | `'Array [\n'` | +| `2` | `0` | `'Object {\n"'` | +| `3` | `-1` | `'a'` | +| `4` | `1` | `'de'` | +| `5` | `0` | `'scending": '` | +| `6` | `-1` | `'tru'` | +| `7` | `1` | `'fals'` | +| `8` | `0` | `'e,'` | + +The length difference `b.length - a.length` is equal to the sum of `diffItems[i][0]` values times `diffItems[i][1]` lengths. In this example, the difference `48 - 38` is equal to the sum `10`. + +| category of diff item | `[0]` | `[1]` lengths | subtotal | +| :-------------------- | ----: | -----------------: | -------: | +| in common | `0` | `11 + 10 + 11 + 2` | `0` | +| to delete from `a` | `–1` | `1 + 3` | `-4` | +| to insert from `b` | `1` | `8 + 2 + 4` | `14` | + +Instead of formatting the changed substrings with escape codes for colors in the `foundSubsequence` function to save memory, this example spends memory to **gain flexibility** before formatting, so a separate heuristic algorithm might modify the generic array of diff items to show changes more clearly: + +| `i` | `diffItems[i][0]` | `diffItems[i][1]` | +| --: | ----------------: | :---------------- | +| `6` | `-1` | `'true'` | +| `7` | `1` | `'false'` | +| `8` | `0` | `','` | + +For expected and received strings of serialized data, the result of finding changed **lines**, and then finding changed **substrings** within adjacent changed lines (as in the preceding two examples) sometimes displays the changes in a more intuitive way than the result of finding changed substrings, and then splitting them into changed and unchanged lines. diff --git a/node_modules/jest-circus/node_modules/diff-sequences/build/index.d.ts b/node_modules/jest-circus/node_modules/diff-sequences/build/index.d.ts new file mode 100644 index 000000000..5598ec926 --- /dev/null +++ b/node_modules/jest-circus/node_modules/diff-sequences/build/index.d.ts @@ -0,0 +1,38 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type Callbacks = { + foundSubsequence: FoundSubsequence; + isCommon: IsCommon; +}; + +declare function diffSequence( + aLength: number, + bLength: number, + isCommon: IsCommon, + foundSubsequence: FoundSubsequence, +): void; +export default diffSequence; + +declare type FoundSubsequence = ( + nCommon: number, // caller can assume: 0 < nCommon + aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength + bCommon: number, +) => void; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +declare type IsCommon = ( + aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength + bIndex: number, +) => boolean; + +export {}; diff --git a/node_modules/jest-circus/node_modules/diff-sequences/build/index.js b/node_modules/jest-circus/node_modules/diff-sequences/build/index.js new file mode 100644 index 000000000..7ac63396a --- /dev/null +++ b/node_modules/jest-circus/node_modules/diff-sequences/build/index.js @@ -0,0 +1,816 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = diffSequence; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This diff-sequences package implements the linear space variation in +// An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers +// Relationship in notation between Myers paper and this package: +// A is a +// N is aLength, aEnd - aStart, and so on +// x is aIndex, aFirst, aLast, and so on +// B is b +// M is bLength, bEnd - bStart, and so on +// y is bIndex, bFirst, bLast, and so on +// Δ = N - M is negative of baDeltaLength = bLength - aLength +// D is d +// k is kF +// k + Δ is kF = kR - baDeltaLength +// V is aIndexesF or aIndexesR (see comment below about Indexes type) +// index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength) +// starting point in forward direction (0, 0) is (-1, -1) +// starting point in reverse direction (N + 1, M + 1) is (aLength, bLength) +// The “edit graph” for sequences a and b corresponds to items: +// in a on the horizontal axis +// in b on the vertical axis +// +// Given a-coordinate of a point in a diagonal, you can compute b-coordinate. +// +// Forward diagonals kF: +// zero diagonal intersects top left corner +// positive diagonals intersect top edge +// negative diagonals insersect left edge +// +// Reverse diagonals kR: +// zero diagonal intersects bottom right corner +// positive diagonals intersect right edge +// negative diagonals intersect bottom edge +// The graph contains a directed acyclic graph of edges: +// horizontal: delete an item from a +// vertical: insert an item from b +// diagonal: common item in a and b +// +// The algorithm solves dual problems in the graph analogy: +// Find longest common subsequence: path with maximum number of diagonal edges +// Find shortest edit script: path with minimum number of non-diagonal edges +// Input callback function compares items at indexes in the sequences. +// Output callback function receives the number of adjacent items +// and starting indexes of each common subsequence. +// Either original functions or wrapped to swap indexes if graph is transposed. +// Indexes in sequence a of last point of forward or reverse paths in graph. +// Myers algorithm indexes by diagonal k which for negative is bad deopt in V8. +// This package indexes by iF and iR which are greater than or equal to zero. +// and also updates the index arrays in place to cut memory in half. +// kF = 2 * iF - d +// kR = d - 2 * iR +// Division of index intervals in sequences a and b at the middle change. +// Invariant: intervals do not have common items at the start or end. +const pkg = 'diff-sequences'; // for error messages + +const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8 +// Return the number of common items that follow in forward direction. +// The length of what Myers paper calls a “snake” in a forward path. + +const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => { + let nCommon = 0; + + while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) { + aIndex += 1; + bIndex += 1; + nCommon += 1; + } + + return nCommon; +}; // Return the number of common items that precede in reverse direction. +// The length of what Myers paper calls a “snake” in a reverse path. + +const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => { + let nCommon = 0; + + while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) { + aIndex -= 1; + bIndex -= 1; + nCommon += 1; + } + + return nCommon; +}; // A simple function to extend forward paths from (d - 1) to d changes +// when forward and reverse paths cannot yet overlap. + +const extendPathsF = ( + d, + aEnd, + bEnd, + bF, + isCommon, + aIndexesF, + iMaxF // return the value because optimization might decrease it +) => { + // Unroll the first iteration. + let iF = 0; + let kF = -d; // kF = 2 * iF - d + + let aFirst = aIndexesF[iF]; // in first iteration always insert + + let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration + + aIndexesF[iF] += countCommonItemsF( + aFirst + 1, + aEnd, + bF + aFirst - kF + 1, + bEnd, + isCommon + ); // Optimization: skip diagonals in which paths cannot ever overlap. + + const nF = d < iMaxF ? d : iMaxF; // The diagonals kF are odd when d is odd and even when d is even. + + for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) { + // To get first point of path segment, move one change in forward direction + // from last point of previous path segment in an adjacent diagonal. + // In last possible iteration when iF === d and kF === d always delete. + if (iF !== d && aIndexPrev1 < aIndexesF[iF]) { + aFirst = aIndexesF[iF]; // vertical to insert from b + } else { + aFirst = aIndexPrev1 + 1; // horizontal to delete from a + + if (aEnd <= aFirst) { + // Optimization: delete moved past right of graph. + return iF - 1; + } + } // To get last point of path segment, move along diagonal of common items. + + aIndexPrev1 = aIndexesF[iF]; + aIndexesF[iF] = + aFirst + + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon); + } + + return iMaxF; +}; // A simple function to extend reverse paths from (d - 1) to d changes +// when reverse and forward paths cannot yet overlap. + +const extendPathsR = ( + d, + aStart, + bStart, + bR, + isCommon, + aIndexesR, + iMaxR // return the value because optimization might decrease it +) => { + // Unroll the first iteration. + let iR = 0; + let kR = d; // kR = d - 2 * iR + + let aFirst = aIndexesR[iR]; // in first iteration always insert + + let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration + + aIndexesR[iR] -= countCommonItemsR( + aStart, + aFirst - 1, + bStart, + bR + aFirst - kR - 1, + isCommon + ); // Optimization: skip diagonals in which paths cannot ever overlap. + + const nR = d < iMaxR ? d : iMaxR; // The diagonals kR are odd when d is odd and even when d is even. + + for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) { + // To get first point of path segment, move one change in reverse direction + // from last point of previous path segment in an adjacent diagonal. + // In last possible iteration when iR === d and kR === -d always delete. + if (iR !== d && aIndexesR[iR] < aIndexPrev1) { + aFirst = aIndexesR[iR]; // vertical to insert from b + } else { + aFirst = aIndexPrev1 - 1; // horizontal to delete from a + + if (aFirst < aStart) { + // Optimization: delete moved past left of graph. + return iR - 1; + } + } // To get last point of path segment, move along diagonal of common items. + + aIndexPrev1 = aIndexesR[iR]; + aIndexesR[iR] = + aFirst - + countCommonItemsR( + aStart, + aFirst - 1, + bStart, + bR + aFirst - kR - 1, + isCommon + ); + } + + return iMaxR; +}; // A complete function to extend forward paths from (d - 1) to d changes. +// Return true if a path overlaps reverse path of (d - 1) changes in its diagonal. + +const extendOverlappablePathsF = ( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division // update prop values if return true +) => { + const bF = bStart - aStart; // bIndex = bF + aIndex - kF + + const aLength = aEnd - aStart; + const bLength = bEnd - bStart; + const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength + // Range of diagonals in which forward and reverse paths might overlap. + + const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR + + const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1) + + let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration + // Optimization: skip diagonals in which paths cannot ever overlap. + + const nF = d < iMaxF ? d : iMaxF; // The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even. + + for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) { + // To get first point of path segment, move one change in forward direction + // from last point of previous path segment in an adjacent diagonal. + // In first iteration when iF === 0 and kF === -d always insert. + // In last possible iteration when iF === d and kF === d always delete. + const insert = iF === 0 || (iF !== d && aIndexPrev1 < aIndexesF[iF]); + const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1; + const aFirst = insert + ? aLastPrev // vertical to insert from b + : aLastPrev + 1; // horizontal to delete from a + // To get last point of path segment, move along diagonal of common items. + + const bFirst = bF + aFirst - kF; + const nCommonF = countCommonItemsF( + aFirst + 1, + aEnd, + bFirst + 1, + bEnd, + isCommon + ); + const aLast = aFirst + nCommonF; + aIndexPrev1 = aIndexesF[iF]; + aIndexesF[iF] = aLast; + + if (kMinOverlapF <= kF && kF <= kMaxOverlapF) { + // Solve for iR of reverse path with (d - 1) changes in diagonal kF: + // kR = kF + baDeltaLength + // kR = (d - 1) - 2 * iR + const iR = (d - 1 - (kF + baDeltaLength)) / 2; // If this forward path overlaps the reverse path in this diagonal, + // then this is the middle change of the index intervals. + + if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) { + // Unlike the Myers algorithm which finds only the middle “snake” + // this package can find two common subsequences per division. + // Last point of previous path segment is on an adjacent diagonal. + const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1); // Because of invariant that intervals preceding the middle change + // cannot have common items at the end, + // move in reverse direction along a diagonal of common items. + + const nCommonR = countCommonItemsR( + aStart, + aLastPrev, + bStart, + bLastPrev, + isCommon + ); + const aIndexPrevFirst = aLastPrev - nCommonR; + const bIndexPrevFirst = bLastPrev - nCommonR; + const aEndPreceding = aIndexPrevFirst + 1; + const bEndPreceding = bIndexPrevFirst + 1; + division.nChangePreceding = d - 1; + + if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) { + // Optimization: number of preceding changes in forward direction + // is equal to number of items in preceding interval, + // therefore it cannot contain any common items. + division.aEndPreceding = aStart; + division.bEndPreceding = bStart; + } else { + division.aEndPreceding = aEndPreceding; + division.bEndPreceding = bEndPreceding; + } + + division.nCommonPreceding = nCommonR; + + if (nCommonR !== 0) { + division.aCommonPreceding = aEndPreceding; + division.bCommonPreceding = bEndPreceding; + } + + division.nCommonFollowing = nCommonF; + + if (nCommonF !== 0) { + division.aCommonFollowing = aFirst + 1; + division.bCommonFollowing = bFirst + 1; + } + + const aStartFollowing = aLast + 1; + const bStartFollowing = bFirst + nCommonF + 1; + division.nChangeFollowing = d - 1; + + if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) { + // Optimization: number of changes in reverse direction + // is equal to number of items in following interval, + // therefore it cannot contain any common items. + division.aStartFollowing = aEnd; + division.bStartFollowing = bEnd; + } else { + division.aStartFollowing = aStartFollowing; + division.bStartFollowing = bStartFollowing; + } + + return true; + } + } + } + + return false; +}; // A complete function to extend reverse paths from (d - 1) to d changes. +// Return true if a path overlaps forward path of d changes in its diagonal. + +const extendOverlappablePathsR = ( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division // update prop values if return true +) => { + const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR + + const aLength = aEnd - aStart; + const bLength = bEnd - bStart; + const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength + // Range of diagonals in which forward and reverse paths might overlap. + + const kMinOverlapR = baDeltaLength - d; // -d <= kF + + const kMaxOverlapR = baDeltaLength + d; // kF <= d + + let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration + // Optimization: skip diagonals in which paths cannot ever overlap. + + const nR = d < iMaxR ? d : iMaxR; // The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even. + + for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) { + // To get first point of path segment, move one change in reverse direction + // from last point of previous path segment in an adjacent diagonal. + // In first iteration when iR === 0 and kR === d always insert. + // In last possible iteration when iR === d and kR === -d always delete. + const insert = iR === 0 || (iR !== d && aIndexesR[iR] < aIndexPrev1); + const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1; + const aFirst = insert + ? aLastPrev // vertical to insert from b + : aLastPrev - 1; // horizontal to delete from a + // To get last point of path segment, move along diagonal of common items. + + const bFirst = bR + aFirst - kR; + const nCommonR = countCommonItemsR( + aStart, + aFirst - 1, + bStart, + bFirst - 1, + isCommon + ); + const aLast = aFirst - nCommonR; + aIndexPrev1 = aIndexesR[iR]; + aIndexesR[iR] = aLast; + + if (kMinOverlapR <= kR && kR <= kMaxOverlapR) { + // Solve for iF of forward path with d changes in diagonal kR: + // kF = kR - baDeltaLength + // kF = 2 * iF - d + const iF = (d + (kR - baDeltaLength)) / 2; // If this reverse path overlaps the forward path in this diagonal, + // then this is a middle change of the index intervals. + + if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) { + const bLast = bFirst - nCommonR; + division.nChangePreceding = d; + + if (d === aLast + bLast - aStart - bStart) { + // Optimization: number of changes in reverse direction + // is equal to number of items in preceding interval, + // therefore it cannot contain any common items. + division.aEndPreceding = aStart; + division.bEndPreceding = bStart; + } else { + division.aEndPreceding = aLast; + division.bEndPreceding = bLast; + } + + division.nCommonPreceding = nCommonR; + + if (nCommonR !== 0) { + // The last point of reverse path segment is start of common subsequence. + division.aCommonPreceding = aLast; + division.bCommonPreceding = bLast; + } + + division.nChangeFollowing = d - 1; + + if (d === 1) { + // There is no previous path segment. + division.nCommonFollowing = 0; + division.aStartFollowing = aEnd; + division.bStartFollowing = bEnd; + } else { + // Unlike the Myers algorithm which finds only the middle “snake” + // this package can find two common subsequences per division. + // Last point of previous path segment is on an adjacent diagonal. + const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1); // Because of invariant that intervals following the middle change + // cannot have common items at the start, + // move in forward direction along a diagonal of common items. + + const nCommonF = countCommonItemsF( + aLastPrev, + aEnd, + bLastPrev, + bEnd, + isCommon + ); + division.nCommonFollowing = nCommonF; + + if (nCommonF !== 0) { + // The last point of reverse path segment is start of common subsequence. + division.aCommonFollowing = aLastPrev; + division.bCommonFollowing = bLastPrev; + } + + const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev + + const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev + + if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) { + // Optimization: number of changes in forward direction + // is equal to number of items in following interval, + // therefore it cannot contain any common items. + division.aStartFollowing = aEnd; + division.bStartFollowing = bEnd; + } else { + division.aStartFollowing = aStartFollowing; + division.bStartFollowing = bStartFollowing; + } + } + + return true; + } + } + } + + return false; +}; // Given index intervals and input function to compare items at indexes, +// divide at the middle change. +// +// DO NOT CALL if start === end, because interval cannot contain common items +// and because this function will throw the “no overlap” error. + +const divide = ( + nChange, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + aIndexesR, + division // output +) => { + const bF = bStart - aStart; // bIndex = bF + aIndex - kF + + const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR + + const aLength = aEnd - aStart; + const bLength = bEnd - bStart; // Because graph has square or portrait orientation, + // length difference is minimum number of items to insert from b. + // Corresponding forward and reverse diagonals in graph + // depend on length difference of the sequences: + // kF = kR - baDeltaLength + // kR = kF + baDeltaLength + + const baDeltaLength = bLength - aLength; // Optimization: max diagonal in graph intersects corner of shorter side. + + let iMaxF = aLength; + let iMaxR = aLength; // Initialize no changes yet in forward or reverse direction: + + aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start + + aIndexesR[0] = aEnd; // at open end of interval + + if (baDeltaLength % 2 === 0) { + // The number of changes in paths is 2 * d if length difference is even. + const dMin = (nChange || baDeltaLength) / 2; + const dMax = (aLength + bLength) / 2; + + for (let d = 1; d <= dMax; d += 1) { + iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); + + if (d < dMin) { + iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR); + } else if ( + // If a reverse path overlaps a forward path in the same diagonal, + // return a division of the index intervals at the middle change. + extendOverlappablePathsR( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division + ) + ) { + return; + } + } + } else { + // The number of changes in paths is 2 * d - 1 if length difference is odd. + const dMin = ((nChange || baDeltaLength) + 1) / 2; + const dMax = (aLength + bLength + 1) / 2; // Unroll first half iteration so loop extends the relevant pairs of paths. + // Because of invariant that intervals have no common items at start or end, + // and limitation not to call divide with empty intervals, + // therefore it cannot be called if a forward path with one change + // would overlap a reverse path with no changes, even if dMin === 1. + + let d = 1; + iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); + + for (d += 1; d <= dMax; d += 1) { + iMaxR = extendPathsR( + d - 1, + aStart, + bStart, + bR, + isCommon, + aIndexesR, + iMaxR + ); + + if (d < dMin) { + iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); + } else if ( + // If a forward path overlaps a reverse path in the same diagonal, + // return a division of the index intervals at the middle change. + extendOverlappablePathsF( + d, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + iMaxF, + aIndexesR, + iMaxR, + division + ) + ) { + return; + } + } + } + /* istanbul ignore next */ + + throw new Error( + `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}` + ); +}; // Given index intervals and input function to compare items at indexes, +// return by output function the number of adjacent items and starting indexes +// of each common subsequence. Divide and conquer with only linear space. +// +// The index intervals are half open [start, end) like array slice method. +// DO NOT CALL if start === end, because interval cannot contain common items +// and because divide function will throw the “no overlap” error. + +const findSubsequences = ( + nChange, + aStart, + aEnd, + bStart, + bEnd, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division // temporary memory, not input nor output +) => { + if (bEnd - bStart < aEnd - aStart) { + // Transpose graph so it has portrait instead of landscape orientation. + // Always compare shorter to longer sequence for consistency and optimization. + transposed = !transposed; + + if (transposed && callbacks.length === 1) { + // Lazily wrap callback functions to swap args if graph is transposed. + const {foundSubsequence, isCommon} = callbacks[0]; + callbacks[1] = { + foundSubsequence: (nCommon, bCommon, aCommon) => { + foundSubsequence(nCommon, aCommon, bCommon); + }, + isCommon: (bIndex, aIndex) => isCommon(aIndex, bIndex) + }; + } + + const tStart = aStart; + const tEnd = aEnd; + aStart = bStart; + aEnd = bEnd; + bStart = tStart; + bEnd = tEnd; + } + + const {foundSubsequence, isCommon} = callbacks[transposed ? 1 : 0]; // Divide the index intervals at the middle change. + + divide( + nChange, + aStart, + aEnd, + bStart, + bEnd, + isCommon, + aIndexesF, + aIndexesR, + division + ); + const { + nChangePreceding, + aEndPreceding, + bEndPreceding, + nCommonPreceding, + aCommonPreceding, + bCommonPreceding, + nCommonFollowing, + aCommonFollowing, + bCommonFollowing, + nChangeFollowing, + aStartFollowing, + bStartFollowing + } = division; // Unless either index interval is empty, they might contain common items. + + if (aStart < aEndPreceding && bStart < bEndPreceding) { + // Recursely find and return common subsequences preceding the division. + findSubsequences( + nChangePreceding, + aStart, + aEndPreceding, + bStart, + bEndPreceding, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division + ); + } // Return common subsequences that are adjacent to the middle change. + + if (nCommonPreceding !== 0) { + foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding); + } + + if (nCommonFollowing !== 0) { + foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing); + } // Unless either index interval is empty, they might contain common items. + + if (aStartFollowing < aEnd && bStartFollowing < bEnd) { + // Recursely find and return common subsequences following the division. + findSubsequences( + nChangeFollowing, + aStartFollowing, + aEnd, + bStartFollowing, + bEnd, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division + ); + } +}; + +const validateLength = (name, arg) => { + if (typeof arg !== 'number') { + throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`); + } + + if (!Number.isSafeInteger(arg)) { + throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`); + } + + if (arg < 0) { + throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`); + } +}; + +const validateCallback = (name, arg) => { + const type = typeof arg; + + if (type !== 'function') { + throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`); + } +}; // Compare items in two sequences to find a longest common subsequence. +// Given lengths of sequences and input function to compare items at indexes, +// return by output function the number of adjacent items and starting indexes +// of each common subsequence. + +function diffSequence(aLength, bLength, isCommon, foundSubsequence) { + validateLength('aLength', aLength); + validateLength('bLength', bLength); + validateCallback('isCommon', isCommon); + validateCallback('foundSubsequence', foundSubsequence); // Count common items from the start in the forward direction. + + const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon); + + if (nCommonF !== 0) { + foundSubsequence(nCommonF, 0, 0); + } // Unless both sequences consist of common items only, + // find common items in the half-trimmed index intervals. + + if (aLength !== nCommonF || bLength !== nCommonF) { + // Invariant: intervals do not have common items at the start. + // The start of an index interval is closed like array slice method. + const aStart = nCommonF; + const bStart = nCommonF; // Count common items from the end in the reverse direction. + + const nCommonR = countCommonItemsR( + aStart, + aLength - 1, + bStart, + bLength - 1, + isCommon + ); // Invariant: intervals do not have common items at the end. + // The end of an index interval is open like array slice method. + + const aEnd = aLength - nCommonR; + const bEnd = bLength - nCommonR; // Unless one sequence consists of common items only, + // therefore the other trimmed index interval consists of changes only, + // find common items in the trimmed index intervals. + + const nCommonFR = nCommonF + nCommonR; + + if (aLength !== nCommonFR && bLength !== nCommonFR) { + const nChange = 0; // number of change items is not yet known + + const transposed = false; // call the original unwrapped functions + + const callbacks = [ + { + foundSubsequence, + isCommon + } + ]; // Indexes in sequence a of last points in furthest reaching paths + // from outside the start at top left in the forward direction: + + const aIndexesF = [NOT_YET_SET]; // from the end at bottom right in the reverse direction: + + const aIndexesR = [NOT_YET_SET]; // Initialize one object as output of all calls to divide function. + + const division = { + aCommonFollowing: NOT_YET_SET, + aCommonPreceding: NOT_YET_SET, + aEndPreceding: NOT_YET_SET, + aStartFollowing: NOT_YET_SET, + bCommonFollowing: NOT_YET_SET, + bCommonPreceding: NOT_YET_SET, + bEndPreceding: NOT_YET_SET, + bStartFollowing: NOT_YET_SET, + nChangeFollowing: NOT_YET_SET, + nChangePreceding: NOT_YET_SET, + nCommonFollowing: NOT_YET_SET, + nCommonPreceding: NOT_YET_SET + }; // Find and return common subsequences in the trimmed index intervals. + + findSubsequences( + nChange, + aStart, + aEnd, + bStart, + bEnd, + transposed, + callbacks, + aIndexesF, + aIndexesR, + division + ); + } + + if (nCommonR !== 0) { + foundSubsequence(nCommonR, aEnd, bEnd); + } + } +} diff --git a/node_modules/jest-circus/node_modules/diff-sequences/package.json b/node_modules/jest-circus/node_modules/diff-sequences/package.json new file mode 100644 index 000000000..e4fdd9045 --- /dev/null +++ b/node_modules/jest-circus/node_modules/diff-sequences/package.json @@ -0,0 +1,39 @@ +{ + "name": "diff-sequences", + "version": "28.0.0", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/diff-sequences" + }, + "license": "MIT", + "description": "Compare items in two sequences to find a longest common subsequence", + "keywords": [ + "fast", + "linear", + "space", + "callback", + "diff" + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "devDependencies": { + "benchmark": "^2.1.4", + "diff": "^5.0.0", + "fast-check": "^2.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" +} diff --git a/node_modules/jest-circus/node_modules/escape-string-regexp/index.d.ts b/node_modules/jest-circus/node_modules/escape-string-regexp/index.d.ts deleted file mode 100644 index 7d34edc7c..000000000 --- a/node_modules/jest-circus/node_modules/escape-string-regexp/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** -Escape RegExp special characters. - -You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. - -@example -``` -import escapeStringRegexp = require('escape-string-regexp'); - -const escapedString = escapeStringRegexp('How much $ for a 🦄?'); -//=> 'How much \\$ for a 🦄\\?' - -new RegExp(escapedString); -``` -*/ -declare const escapeStringRegexp: (string: string) => string; - -export = escapeStringRegexp; diff --git a/node_modules/jest-circus/node_modules/escape-string-regexp/index.js b/node_modules/jest-circus/node_modules/escape-string-regexp/index.js deleted file mode 100644 index 58217a4ef..000000000 --- a/node_modules/jest-circus/node_modules/escape-string-regexp/index.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g; - -module.exports = string => { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } - - return string.replace(matchOperatorsRegex, '\\$&'); -}; diff --git a/node_modules/jest-circus/node_modules/escape-string-regexp/package.json b/node_modules/jest-circus/node_modules/escape-string-regexp/package.json deleted file mode 100644 index 2e343cfa0..000000000 --- a/node_modules/jest-circus/node_modules/escape-string-regexp/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "escape-string-regexp", - "version": "2.0.0", - "description": "Escape RegExp special characters", - "license": "MIT", - "repository": "sindresorhus/escape-string-regexp", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "maintainers": [ - "Sindre Sorhus (sindresorhus.com)", - "Joshua Boy Nicolai Appelman (jbna.nl)" - ], - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "escape", - "regex", - "regexp", - "re", - "regular", - "expression", - "string", - "str", - "special", - "characters" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/jest-circus/node_modules/escape-string-regexp/readme.md b/node_modules/jest-circus/node_modules/escape-string-regexp/readme.md deleted file mode 100644 index 157472b7a..000000000 --- a/node_modules/jest-circus/node_modules/escape-string-regexp/readme.md +++ /dev/null @@ -1,29 +0,0 @@ -# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) - -> Escape RegExp special characters - - -## Install - -``` -$ npm install escape-string-regexp -``` - - -## Usage - -```js -const escapeStringRegexp = require('escape-string-regexp'); - -const escapedString = escapeStringRegexp('How much $ for a 🦄?'); -//=> 'How much \\$ for a 🦄\\?' - -new RegExp(escapedString); -``` - -You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/jest-circus/node_modules/graceful-fs/LICENSE b/node_modules/jest-circus/node_modules/graceful-fs/LICENSE deleted file mode 100644 index 9d2c80369..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/graceful-fs/README.md b/node_modules/jest-circus/node_modules/graceful-fs/README.md deleted file mode 100644 index 82d6e4daf..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# graceful-fs - -graceful-fs functions as a drop-in replacement for the fs module, -making various improvements. - -The improvements are meant to normalize behavior across different -platforms and environments, and to make filesystem access more -resilient to errors. - -## Improvements over [fs module](https://nodejs.org/api/fs.html) - -* Queues up `open` and `readdir` calls, and retries them once - something closes if there is an EMFILE error from too many file - descriptors. -* fixes `lchmod` for Node versions prior to 0.6.2. -* implements `fs.lutimes` if possible. Otherwise it becomes a noop. -* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or - `lchown` if the user isn't root. -* makes `lchmod` and `lchown` become noops, if not available. -* retries reading a file if `read` results in EAGAIN error. - -On Windows, it retries renaming a file for up to one second if `EACCESS` -or `EPERM` error occurs, likely because antivirus software has locked -the directory. - -## USAGE - -```javascript -// use just like fs -var fs = require('graceful-fs') - -// now go and do stuff with it... -fs.readFile('some-file-or-whatever', (err, data) => { - // Do stuff here. -}) -``` - -## Sync methods - -This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync -methods. If you use sync methods which open file descriptors then you are -responsible for dealing with any errors. - -This is a known limitation, not a bug. - -## Global Patching - -If you want to patch the global fs module (or any other fs-like -module) you can do this: - -```javascript -// Make sure to read the caveat below. -var realFs = require('fs') -var gracefulFs = require('graceful-fs') -gracefulFs.gracefulify(realFs) -``` - -This should only ever be done at the top-level application layer, in -order to delay on EMFILE errors from any fs-using dependencies. You -should **not** do this in a library, because it can cause unexpected -delays in other parts of the program. - -## Changes - -This module is fairly stable at this point, and used by a lot of -things. That being said, because it implements a subtle behavior -change in a core part of the node API, even modest changes can be -extremely breaking, and the versioning is thus biased towards -bumping the major when in doubt. - -The main change between major versions has been switching between -providing a fully-patched `fs` module vs monkey-patching the node core -builtin, and the approach by which a non-monkey-patched `fs` was -created. - -The goal is to trade `EMFILE` errors for slower fs operations. So, if -you try to open a zillion files, rather than crashing, `open` -operations will be queued up and wait for something else to `close`. - -There are advantages to each approach. Monkey-patching the fs means -that no `EMFILE` errors can possibly occur anywhere in your -application, because everything is using the same core `fs` module, -which is patched. However, it can also obviously cause undesirable -side-effects, especially if the module is loaded multiple times. - -Implementing a separate-but-identical patched `fs` module is more -surgical (and doesn't run the risk of patching multiple times), but -also imposes the challenge of keeping in sync with the core module. - -The current approach loads the `fs` module, and then creates a -lookalike object that has all the same methods, except a few that are -patched. It is safe to use in all versions of Node from 0.8 through -7.0. - -### v4 - -* Do not monkey-patch the fs module. This module may now be used as a - drop-in dep, and users can opt into monkey-patching the fs builtin - if their app requires it. - -### v3 - -* Monkey-patch fs, because the eval approach no longer works on recent - node. -* fixed possible type-error throw if rename fails on windows -* verify that we *never* get EMFILE errors -* Ignore ENOSYS from chmod/chown -* clarify that graceful-fs must be used as a drop-in - -### v2.1.0 - -* Use eval rather than monkey-patching fs. -* readdir: Always sort the results -* win32: requeue a file if error has an OK status - -### v2.0 - -* A return to monkey patching -* wrap process.cwd - -### v1.1 - -* wrap readFile -* Wrap fs.writeFile. -* readdir protection -* Don't clobber the fs builtin -* Handle fs.read EAGAIN errors by trying again -* Expose the curOpen counter -* No-op lchown/lchmod if not implemented -* fs.rename patch only for win32 -* Patch fs.rename to handle AV software on Windows -* Close #4 Chown should not fail on einval or eperm if non-root -* Fix isaacs/fstream#1 Only wrap fs one time -* Fix #3 Start at 1024 max files, then back off on EMFILE -* lutimes that doens't blow up on Linux -* A full on-rewrite using a queue instead of just swallowing the EMFILE error -* Wrap Read/Write streams as well - -### 1.0 - -* Update engines for node 0.6 -* Be lstat-graceful on Windows -* first diff --git a/node_modules/jest-circus/node_modules/graceful-fs/clone.js b/node_modules/jest-circus/node_modules/graceful-fs/clone.js deleted file mode 100644 index dff3cc8c5..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} diff --git a/node_modules/jest-circus/node_modules/graceful-fs/graceful-fs.js b/node_modules/jest-circus/node_modules/graceful-fs/graceful-fs.js deleted file mode 100644 index 947cd94bb..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/graceful-fs.js +++ /dev/null @@ -1,429 +0,0 @@ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - require('assert').equal(fs[gracefulQueue].length, 0) - }) - } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) - - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readdir(path, options, cb) - - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (files && files.sort) - files.sort() - - if (typeof cb === 'function') - cb.call(this, err, files) - } - }) - } - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} - -// keep track of the timeout between retry() calls -var retryTimer - -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} - -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined - - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} diff --git a/node_modules/jest-circus/node_modules/graceful-fs/legacy-streams.js b/node_modules/jest-circus/node_modules/graceful-fs/legacy-streams.js deleted file mode 100644 index d617b50fc..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/legacy-streams.js +++ /dev/null @@ -1,118 +0,0 @@ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} diff --git a/node_modules/jest-circus/node_modules/graceful-fs/package.json b/node_modules/jest-circus/node_modules/graceful-fs/package.json deleted file mode 100644 index e1cb58473..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "graceful-fs", - "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-graceful-fs" - }, - "main": "graceful-fs.js", - "directories": { - "test": "test" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "nyc --silent node test.js | tap -c -", - "posttest": "nyc report" - }, - "keywords": [ - "fs", - "module", - "reading", - "retry", - "retries", - "queue", - "error", - "errors", - "handling", - "EMFILE", - "EAGAIN", - "EINVAL", - "EPERM", - "EACCESS" - ], - "license": "ISC", - "devDependencies": { - "import-fresh": "^2.0.0", - "mkdirp": "^0.5.0", - "rimraf": "^2.2.8", - "tap": "^12.7.0" - }, - "files": [ - "fs.js", - "graceful-fs.js", - "legacy-streams.js", - "polyfills.js", - "clone.js" - ] -} diff --git a/node_modules/jest-circus/node_modules/graceful-fs/polyfills.js b/node_modules/jest-circus/node_modules/graceful-fs/polyfills.js deleted file mode 100644 index 26804ef0a..000000000 --- a/node_modules/jest-circus/node_modules/graceful-fs/polyfills.js +++ /dev/null @@ -1,348 +0,0 @@ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} diff --git a/node_modules/jest-circus/node_modules/jest-diff/LICENSE b/node_modules/jest-circus/node_modules/jest-diff/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/jest-diff/README.md b/node_modules/jest-circus/node_modules/jest-diff/README.md new file mode 100644 index 000000000..d52f82178 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/README.md @@ -0,0 +1,671 @@ +# jest-diff + +Display differences clearly so people can review changes confidently. + +The `diff` named export serializes JavaScript **values**, compares them line-by-line, and returns a string which includes comparison lines. + +Two named exports compare **strings** character-by-character: + +- `diffStringsUnified` returns a string. +- `diffStringsRaw` returns an array of `Diff` objects. + +Three named exports compare **arrays of strings** line-by-line: + +- `diffLinesUnified` and `diffLinesUnified2` return a string. +- `diffLinesRaw` returns an array of `Diff` objects. + +## Installation + +To add this package as a dependency of a project, run either of the following commands: + +- `npm install jest-diff` +- `yarn add jest-diff` + +## Usage of `diff()` + +Given JavaScript **values**, `diff(a, b, options?)` does the following: + +1. **serialize** the values as strings using the `pretty-format` package +2. **compare** the strings line-by-line using the `diff-sequences` package +3. **format** the changed or common lines using the `chalk` package + +To use this function, write either of the following: + +- `const {diff} = require('jest-diff');` in CommonJS modules +- `import {diff} from 'jest-diff';` in ECMAScript modules + +### Example of `diff()` + +```js +const a = ['delete', 'common', 'changed from']; +const b = ['common', 'changed to', 'insert']; + +const difference = diff(a, b); +``` + +The returned **string** consists of: + +- annotation lines: describe the two change indicators with labels, and a blank line +- comparison lines: similar to “unified” view on GitHub, but `Expected` lines are green, `Received` lines are red, and common lines are dim (by default, see Options) + +```diff +- Expected ++ Received + + Array [ +- "delete", + "common", +- "changed from", ++ "changed to", ++ "insert", + ] +``` + +### Edge cases of `diff()` + +Here are edge cases for the return value: + +- `' Comparing two different types of values. …'` if the arguments have **different types** according to the `jest-get-type` package (instances of different classes have the same `'object'` type) +- `'Compared values have no visual difference.'` if the arguments have either **referential identity** according to `Object.is` method or **same serialization** according to the `pretty-format` package +- `null` if either argument is a so-called **asymmetric matcher** in Jasmine or Jest + +## Usage of diffStringsUnified + +Given **strings**, `diffStringsUnified(a, b, options?)` does the following: + +1. **compare** the strings character-by-character using the `diff-sequences` package +2. **clean up** small (often coincidental) common substrings, also known as chaff +3. **format** the changed or common lines using the `chalk` package + +Although the function is mainly for **multiline** strings, it compares any strings. + +Write either of the following: + +- `const {diffStringsUnified} = require('jest-diff');` in CommonJS modules +- `import {diffStringsUnified} from 'jest-diff';` in ECMAScript modules + +### Example of diffStringsUnified + +```js +const a = 'common\nchanged from'; +const b = 'common\nchanged to'; + +const difference = diffStringsUnified(a, b); +``` + +The returned **string** consists of: + +- annotation lines: describe the two change indicators with labels, and a blank line +- comparison lines: similar to “unified” view on GitHub, and **changed substrings** have **inverse** foreground and background colors (that is, `from` has white-on-green and `to` has white-on-red, which the following example does not show) + +```diff +- Expected ++ Received + + common +- changed from ++ changed to +``` + +### Performance of diffStringsUnified + +To get the benefit of **changed substrings** within the comparison lines, a character-by-character comparison has a higher computational cost (in time and space) than a line-by-line comparison. + +If the input strings can have **arbitrary length**, we recommend that the calling code set a limit, beyond which splits the strings, and then calls `diffLinesUnified` instead. For example, Jest falls back to line-by-line comparison if either string has length greater than 20K characters. + +## Usage of diffLinesUnified + +Given **arrays of strings**, `diffLinesUnified(aLines, bLines, options?)` does the following: + +1. **compare** the arrays line-by-line using the `diff-sequences` package +2. **format** the changed or common lines using the `chalk` package + +You might call this function when strings have been split into lines and you do not need to see changed substrings within lines. + +### Example of diffLinesUnified + +```js +const aLines = ['delete', 'common', 'changed from']; +const bLines = ['common', 'changed to', 'insert']; + +const difference = diffLinesUnified(aLines, bLines); +``` + +```diff +- Expected ++ Received + +- delete + common +- changed from ++ changed to ++ insert +``` + +### Edge cases of diffLinesUnified or diffStringsUnified + +Here are edge cases for arguments and return values: + +- both `a` and `b` are empty strings: no comparison lines +- only `a` is empty string: all comparison lines have `bColor` and `bIndicator` (see Options) +- only `b` is empty string: all comparison lines have `aColor` and `aIndicator` (see Options) +- `a` and `b` are equal non-empty strings: all comparison lines have `commonColor` and `commonIndicator` (see Options) + +## Usage of diffLinesUnified2 + +Given two **pairs** of arrays of strings, `diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options?)` does the following: + +1. **compare** the pair of `Compare` arrays line-by-line using the `diff-sequences` package +2. **format** the corresponding lines in the pair of `Display` arrays using the `chalk` package + +Jest calls this function to consider lines as common instead of changed if the only difference is indentation. + +You might call this function for case insensitive or Unicode equivalence comparison of lines. + +### Example of diffLinesUnified2 + +```js +import {format} from 'pretty-format'; + +const a = { + text: 'Ignore indentation in serialized object', + time: '2019-09-19T12:34:56.000Z', + type: 'CREATE_ITEM', +}; +const b = { + payload: { + text: 'Ignore indentation in serialized object', + time: '2019-09-19T12:34:56.000Z', + }, + type: 'CREATE_ITEM', +}; + +const difference = diffLinesUnified2( + // serialize with indentation to display lines + format(a).split('\n'), + format(b).split('\n'), + // serialize without indentation to compare lines + format(a, {indent: 0}).split('\n'), + format(b, {indent: 0}).split('\n'), +); +``` + +The `text` and `time` properties are common, because their only difference is indentation: + +```diff +- Expected ++ Received + + Object { ++ payload: Object { + text: 'Ignore indentation in serialized object', + time: '2019-09-19T12:34:56.000Z', ++ }, + type: 'CREATE_ITEM', + } +``` + +The preceding example illustrates why (at least for indentation) it seems more intuitive that the function returns the common line from the `bLinesDisplay` array instead of from the `aLinesDisplay` array. + +## Usage of diffStringsRaw + +Given **strings** and a boolean option, `diffStringsRaw(a, b, cleanup)` does the following: + +1. **compare** the strings character-by-character using the `diff-sequences` package +2. optionally **clean up** small (often coincidental) common substrings, also known as chaff + +Because `diffStringsRaw` returns the difference as **data** instead of a string, you can format it as your application requires (for example, enclosed in HTML markup for browser instead of escape sequences for console). + +The returned **array** describes substrings as instances of the `Diff` class, which calling code can access like array tuples: + +The value at index `0` is one of the following: + +| value | named export | description | +| ----: | :------------ | :-------------------- | +| `0` | `DIFF_EQUAL` | in `a` and in `b` | +| `-1` | `DIFF_DELETE` | in `a` but not in `b` | +| `1` | `DIFF_INSERT` | in `b` but not in `a` | + +The value at index `1` is a substring of `a` or `b` or both. + +### Example of diffStringsRaw with cleanup + +```js +const diffs = diffStringsRaw('changed from', 'changed to', true); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------ | +| `0` | `0` | `'changed '` | +| `1` | `-1` | `'from'` | +| `2` | `1` | `'to'` | + +### Example of diffStringsRaw without cleanup + +```js +const diffs = diffStringsRaw('changed from', 'changed to', false); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------ | +| `0` | `0` | `'changed '` | +| `1` | `-1` | `'fr'` | +| `2` | `1` | `'t'` | +| `3` | `0` | `'o'` | +| `4` | `-1` | `'m'` | + +### Advanced import for diffStringsRaw + +Here are all the named imports that you might need for the `diffStringsRaw` function: + +- `const {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, diffStringsRaw} = require('jest-diff');` in CommonJS modules +- `import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, diffStringsRaw} from 'jest-diff';` in ECMAScript modules + +To write a **formatting** function, you might need the named constants (and `Diff` in TypeScript annotations). + +If you write an application-specific **cleanup** algorithm, then you might need to call the `Diff` constructor: + +```js +const diffCommon = new Diff(DIFF_EQUAL, 'changed '); +const diffDelete = new Diff(DIFF_DELETE, 'from'); +const diffInsert = new Diff(DIFF_INSERT, 'to'); +``` + +## Usage of diffLinesRaw + +Given **arrays of strings**, `diffLinesRaw(aLines, bLines)` does the following: + +- **compare** the arrays line-by-line using the `diff-sequences` package + +Because `diffLinesRaw` returns the difference as **data** instead of a string, you can format it as your application requires. + +### Example of diffLinesRaw + +```js +const aLines = ['delete', 'common', 'changed from']; +const bLines = ['common', 'changed to', 'insert']; + +const diffs = diffLinesRaw(aLines, bLines); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :--------------- | +| `0` | `-1` | `'delete'` | +| `1` | `0` | `'common'` | +| `2` | `-1` | `'changed from'` | +| `3` | `1` | `'changed to'` | +| `4` | `1` | `'insert'` | + +### Edge case of diffLinesRaw + +If you call `string.split('\n')` for an empty string: + +- the result is `['']` an array which contains an empty string +- instead of `[]` an empty array + +Depending of your application, you might call `diffLinesRaw` with either array. + +### Example of split method + +```js +import {diffLinesRaw} from 'jest-diff'; + +const a = 'non-empty string'; +const b = ''; + +const diffs = diffLinesRaw(a.split('\n'), b.split('\n')); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------------- | +| `0` | `-1` | `'non-empty string'` | +| `1` | `1` | `''` | + +Which you might format as follows: + +```diff +- Expected - 1 ++ Received + 1 + +- non-empty string ++ +``` + +### Example of splitLines0 function + +For edge case behavior like the `diffLinesUnified` function, you might define a `splitLines0` function, which given an empty string, returns `[]` an empty array: + +```js +export const splitLines0 = string => + string.length === 0 ? [] : string.split('\n'); +``` + +```js +import {diffLinesRaw} from 'jest-diff'; + +const a = ''; +const b = 'line 1\nline 2\nline 3'; + +const diffs = diffLinesRaw(a.split('\n'), b.split('\n')); +``` + +| `i` | `diffs[i][0]` | `diffs[i][1]` | +| --: | ------------: | :------------ | +| `0` | `1` | `'line 1'` | +| `1` | `1` | `'line 2'` | +| `2` | `1` | `'line 3'` | + +Which you might format as follows: + +```diff +- Expected - 0 ++ Received + 3 + ++ line 1 ++ line 2 ++ line 3 +``` + +In contrast to the `diffLinesRaw` function, the `diffLinesUnified` and `diffLinesUnified2` functions **automatically** convert array arguments computed by string `split` method, so callers do **not** need a `splitLine0` function. + +## Options + +The default options are for the report when an assertion fails from the `expect` package used by Jest. + +For other applications, you can provide an options object as a third argument: + +- `diff(a, b, options)` +- `diffStringsUnified(a, b, options)` +- `diffLinesUnified(aLines, bLines, options)` +- `diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options)` + +### Properties of options object + +| name | default | +| :-------------------------------- | :----------------- | +| `aAnnotation` | `'Expected'` | +| `aColor` | `chalk.green` | +| `aIndicator` | `'-'` | +| `bAnnotation` | `'Received'` | +| `bColor` | `chalk.red` | +| `bIndicator` | `'+'` | +| `changeColor` | `chalk.inverse` | +| `changeLineTrailingSpaceColor` | `string => string` | +| `commonColor` | `chalk.dim` | +| `commonIndicator` | `' '` | +| `commonLineTrailingSpaceColor` | `string => string` | +| `compareKeys` | `undefined` | +| `contextLines` | `5` | +| `emptyFirstOrLastLinePlaceholder` | `''` | +| `expand` | `true` | +| `includeChangeCounts` | `false` | +| `omitAnnotationLines` | `false` | +| `patchColor` | `chalk.yellow` | + +For more information about the options, see the following examples. + +### Example of options for labels + +If the application is code modification, you might replace the labels: + +```js +const options = { + aAnnotation: 'Original', + bAnnotation: 'Modified', +}; +``` + +```diff +- Original ++ Modified + + common +- changed from ++ changed to +``` + +The `jest-diff` package does not assume that the 2 labels have equal length. + +### Example of options for colors of changed lines + +For consistency with most diff tools, you might exchange the colors: + +```ts +import chalk = require('chalk'); + +const options = { + aColor: chalk.red, + bColor: chalk.green, +}; +``` + +### Example of option for color of changed substrings + +Although the default inverse of foreground and background colors is hard to beat for changed substrings **within lines**, especially because it highlights spaces, if you want bold font weight on yellow background color: + +```ts +import chalk = require('chalk'); + +const options = { + changeColor: chalk.bold.bgYellowBright, +}; +``` + +### Example of option to format trailing spaces + +Because `diff()` does not display substring differences within lines, formatting can help you see when lines differ by the presence or absence of trailing spaces found by `/\s+$/` regular expression. + +- If change lines have a background color, then you can see trailing spaces. +- If common lines have default dim color, then you cannot see trailing spaces. You might want yellowish background color to see them. + +```js +const options = { + aColor: chalk.rgb(128, 0, 128).bgRgb(255, 215, 255), // magenta + bColor: chalk.rgb(0, 95, 0).bgRgb(215, 255, 215), // green + commonLineTrailingSpaceColor: chalk.bgYellow, +}; +``` + +The value of a Color option is a function, which given a string, returns a string. + +If you want to replace trailing spaces with middle dot characters: + +```js +const replaceSpacesWithMiddleDot = string => '·'.repeat(string.length); + +const options = { + changeLineTrailingSpaceColor: replaceSpacesWithMiddleDot, + commonLineTrailingSpaceColor: replaceSpacesWithMiddleDot, +}; +``` + +If you need the TypeScript type of a Color option: + +```ts +import {DiffOptionsColor} from 'jest-diff'; +``` + +### Example of options for no colors + +To store the difference in a file without escape codes for colors, provide an identity function: + +```js +const noColor = string => string; + +const options = { + aColor: noColor, + bColor: noColor, + changeColor: noColor, + commonColor: noColor, + patchColor: noColor, +}; +``` + +### Example of options for indicators + +For consistency with the `diff` command, you might replace the indicators: + +```js +const options = { + aIndicator: '<', + bIndicator: '>', +}; +``` + +The `jest-diff` package assumes (but does not enforce) that the 3 indicators have equal length. + +### Example of options to limit common lines + +By default, the output includes all common lines. + +To emphasize the changes, you might limit the number of common “context” lines: + +```js +const options = { + contextLines: 1, + expand: false, +}; +``` + +A patch mark like `@@ -12,7 +12,9 @@` accounts for omitted common lines. + +### Example of option for color of patch marks + +If you want patch marks to have the same dim color as common lines: + +```ts +import chalk = require('chalk'); + +const options = { + expand: false, + patchColor: chalk.dim, +}; +``` + +### Example of option to include change counts + +To display the number of changed lines at the right of annotation lines: + +```js +const a = ['common', 'changed from']; +const b = ['common', 'changed to', 'insert']; + +const options = { + includeChangeCounts: true, +}; + +const difference = diff(a, b, options); +``` + +```diff +- Expected - 1 ++ Received + 2 + + Array [ + "common", +- "changed from", ++ "changed to", ++ "insert", + ] +``` + +### Example of option to omit annotation lines + +To display only the comparison lines: + +```js +const a = 'common\nchanged from'; +const b = 'common\nchanged to'; + +const options = { + omitAnnotationLines: true, +}; + +const difference = diffStringsUnified(a, b, options); +``` + +```diff + common +- changed from ++ changed to +``` + +### Example of option for empty first or last lines + +If the **first** or **last** comparison line is **empty**, because the content is empty and the indicator is a space, you might not notice it. + +The replacement option is a string whose default value is `''` empty string. + +Because Jest trims the report when a matcher fails, it deletes an empty last line. + +Therefore, Jest uses as placeholder the downwards arrow with corner leftwards: + +```js +const options = { + emptyFirstOrLastLinePlaceholder: '↵', // U+21B5 +}; +``` + +If a content line is empty, then the corresponding comparison line is automatically trimmed to remove the margin space (represented as a middle dot below) for the default indicators: + +| Indicator | untrimmed | trimmed | +| ----------------: | :-------- | :------ | +| `aIndicator` | `'-·'` | `'-'` | +| `bIndicator` | `'+·'` | `'+'` | +| `commonIndicator` | `' ·'` | `''` | + +### Example of option for sorting object keys + +When two objects are compared their keys are printed in alphabetical order by default. If this was not the original order of the keys the diff becomes harder to read as the keys are not in their original position. + +Use `compareKeys` to pass a function which will be used when sorting the object keys. + +```js +const a = {c: 'c', b: 'b1', a: 'a'}; +const b = {c: 'c', b: 'b2', a: 'a'}; + +const options = { + // The keys will be in their original order + compareKeys: () => 0, +}; + +const difference = diff(a, b, options); +``` + +```diff +- Expected ++ Received + + Object { + "c": "c", +- "b": "b1", ++ "b": "b2", + "a": "a", + } +``` + +Depending on the implementation of `compareKeys` any sort order can be used. + +```js +const a = {c: 'c', b: 'b1', a: 'a'}; +const b = {c: 'c', b: 'b2', a: 'a'}; + +const options = { + // The keys will be in reverse order + compareKeys: (a, b) => (a > b ? -1 : 1), +}; + +const difference = diff(a, b, options); +``` + +```diff +- Expected ++ Received + + Object { + "a": "a", +- "b": "b1", ++ "b": "b2", + "c": "c", + } +``` diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/cleanupSemantic.js b/node_modules/jest-circus/node_modules/jest-diff/build/cleanupSemantic.js new file mode 100644 index 000000000..6640de597 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/cleanupSemantic.js @@ -0,0 +1,640 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.cleanupSemantic = + exports.Diff = + exports.DIFF_INSERT = + exports.DIFF_EQUAL = + exports.DIFF_DELETE = + void 0; + +/** + * Diff Match and Patch + * Copyright 2018 The diff-match-patch Authors. + * https://github.com/google/diff-match-patch + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Computes the difference between two texts to create a patch. + * Applies the patch onto another text, allowing for errors. + * @author fraser@google.com (Neil Fraser) + */ + +/** + * CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file: + * + * 1. Delete anything not needed to use diff_cleanupSemantic method + * 2. Convert from prototype properties to var declarations + * 3. Convert Diff to class from constructor and prototype + * 4. Add type annotations for arguments and return values + * 5. Add exports + */ + +/** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ +var DIFF_DELETE = -1; +exports.DIFF_DELETE = DIFF_DELETE; +var DIFF_INSERT = 1; +exports.DIFF_INSERT = DIFF_INSERT; +var DIFF_EQUAL = 0; +/** + * Class representing one diff tuple. + * Attempts to look like a two-element array (which is what this used to be). + * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. + * @param {string} text Text to be deleted, inserted, or retained. + * @constructor + */ + +exports.DIFF_EQUAL = DIFF_EQUAL; + +class Diff { + 0; + 1; + + constructor(op, text) { + this[0] = op; + this[1] = text; + } +} +/** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ + +exports.Diff = Diff; + +var diff_commonPrefix = function (text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) { + return 0; + } // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; + + while (pointermin < pointermid) { + if ( + text1.substring(pointerstart, pointermid) == + text2.substring(pointerstart, pointermid) + ) { + pointermin = pointermid; + pointerstart = pointermin; + } else { + pointermax = pointermid; + } + + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + + return pointermid; +}; +/** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ + +var diff_commonSuffix = function (text1, text2) { + // Quick check for common null cases. + if ( + !text1 || + !text2 || + text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1) + ) { + return 0; + } // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; + + while (pointermin < pointermid) { + if ( + text1.substring(text1.length - pointermid, text1.length - pointerend) == + text2.substring(text2.length - pointermid, text2.length - pointerend) + ) { + pointermin = pointermid; + pointerend = pointermin; + } else { + pointermax = pointermid; + } + + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + + return pointermid; +}; +/** + * Determine if the suffix of one string is the prefix of another. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of the first + * string and the start of the second string. + * @private + */ + +var diff_commonOverlap_ = function (text1, text2) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; // Eliminate the null case. + + if (text1_length == 0 || text2_length == 0) { + return 0; + } // Truncate the longer string. + + if (text1_length > text2_length) { + text1 = text1.substring(text1_length - text2_length); + } else if (text1_length < text2_length) { + text2 = text2.substring(0, text1_length); + } + + var text_length = Math.min(text1_length, text2_length); // Quick check for the worst case. + + if (text1 == text2) { + return text_length; + } // Start by looking for a single character match + // and increase length until no match is found. + // Performance analysis: https://neil.fraser.name/news/2010/11/04/ + + var best = 0; + var length = 1; + + while (true) { + var pattern = text1.substring(text_length - length); + var found = text2.indexOf(pattern); + + if (found == -1) { + return best; + } + + length += found; + + if ( + found == 0 || + text1.substring(text_length - length) == text2.substring(0, length) + ) { + best = length; + length++; + } + } +}; +/** + * Reduce the number of edits by eliminating semantically trivial equalities. + * @param {!Array.} diffs Array of diff tuples. + */ + +var diff_cleanupSemantic = function (diffs) { + var changes = false; + var equalities = []; // Stack of indices where equalities are found. + + var equalitiesLength = 0; // Keeping our own length var is faster in JS. + + /** @type {?string} */ + + var lastEquality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1] + + var pointer = 0; // Index of current position. + // Number of characters that changed prior to the equality. + + var length_insertions1 = 0; + var length_deletions1 = 0; // Number of characters that changed after the equality. + + var length_insertions2 = 0; + var length_deletions2 = 0; + + while (pointer < diffs.length) { + if (diffs[pointer][0] == DIFF_EQUAL) { + // Equality found. + equalities[equalitiesLength++] = pointer; + length_insertions1 = length_insertions2; + length_deletions1 = length_deletions2; + length_insertions2 = 0; + length_deletions2 = 0; + lastEquality = diffs[pointer][1]; + } else { + // An insertion or deletion. + if (diffs[pointer][0] == DIFF_INSERT) { + length_insertions2 += diffs[pointer][1].length; + } else { + length_deletions2 += diffs[pointer][1].length; + } // Eliminate an equality that is smaller or equal to the edits on both + // sides of it. + + if ( + lastEquality && + lastEquality.length <= + Math.max(length_insertions1, length_deletions1) && + lastEquality.length <= Math.max(length_insertions2, length_deletions2) + ) { + // Duplicate record. + diffs.splice( + equalities[equalitiesLength - 1], + 0, + new Diff(DIFF_DELETE, lastEquality) + ); // Change second copy to insert. + + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; // Throw away the equality we just deleted. + + equalitiesLength--; // Throw away the previous equality (it needs to be reevaluated). + + equalitiesLength--; + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + length_insertions1 = 0; // Reset the counters. + + length_deletions1 = 0; + length_insertions2 = 0; + length_deletions2 = 0; + lastEquality = null; + changes = true; + } + } + + pointer++; + } // Normalize the diff. + + if (changes) { + diff_cleanupMerge(diffs); + } + + diff_cleanupSemanticLossless(diffs); // Find any overlaps between deletions and insertions. + // e.g: abcxxxxxxdef + // -> abcxxxdef + // e.g: xxxabcdefxxx + // -> defxxxabc + // Only extract an overlap if it is as big as the edit ahead or behind it. + + pointer = 1; + + while (pointer < diffs.length) { + if ( + diffs[pointer - 1][0] == DIFF_DELETE && + diffs[pointer][0] == DIFF_INSERT + ) { + var deletion = diffs[pointer - 1][1]; + var insertion = diffs[pointer][1]; + var overlap_length1 = diff_commonOverlap_(deletion, insertion); + var overlap_length2 = diff_commonOverlap_(insertion, deletion); + + if (overlap_length1 >= overlap_length2) { + if ( + overlap_length1 >= deletion.length / 2 || + overlap_length1 >= insertion.length / 2 + ) { + // Overlap found. Insert an equality and trim the surrounding edits. + diffs.splice( + pointer, + 0, + new Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1)) + ); + diffs[pointer - 1][1] = deletion.substring( + 0, + deletion.length - overlap_length1 + ); + diffs[pointer + 1][1] = insertion.substring(overlap_length1); + pointer++; + } + } else { + if ( + overlap_length2 >= deletion.length / 2 || + overlap_length2 >= insertion.length / 2 + ) { + // Reverse overlap found. + // Insert an equality and swap and trim the surrounding edits. + diffs.splice( + pointer, + 0, + new Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2)) + ); + diffs[pointer - 1][0] = DIFF_INSERT; + diffs[pointer - 1][1] = insertion.substring( + 0, + insertion.length - overlap_length2 + ); + diffs[pointer + 1][0] = DIFF_DELETE; + diffs[pointer + 1][1] = deletion.substring(overlap_length2); + pointer++; + } + } + + pointer++; + } + + pointer++; + } +}; +/** + * Look for single edits surrounded on both sides by equalities + * which can be shifted sideways to align the edit to a word boundary. + * e.g: The cat came. -> The cat came. + * @param {!Array.} diffs Array of diff tuples. + */ + +exports.cleanupSemantic = diff_cleanupSemantic; + +var diff_cleanupSemanticLossless = function (diffs) { + /** + * Given two strings, compute a score representing whether the internal + * boundary falls on logical boundaries. + * Scores range from 6 (best) to 0 (worst). + * Closure, but does not reference any external variables. + * @param {string} one First string. + * @param {string} two Second string. + * @return {number} The score. + * @private + */ + function diff_cleanupSemanticScore_(one, two) { + if (!one || !two) { + // Edges are the best. + return 6; + } // Each port of this function behaves slightly differently due to + // subtle differences in each language's definition of things like + // 'whitespace'. Since this function's purpose is largely cosmetic, + // the choice has been made to use each language's native features + // rather than force total conformity. + + var char1 = one.charAt(one.length - 1); + var char2 = two.charAt(0); + var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_); + var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_); + var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_); + var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_); + var lineBreak1 = whitespace1 && char1.match(linebreakRegex_); + var lineBreak2 = whitespace2 && char2.match(linebreakRegex_); + var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_); + var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_); + + if (blankLine1 || blankLine2) { + // Five points for blank lines. + return 5; + } else if (lineBreak1 || lineBreak2) { + // Four points for line breaks. + return 4; + } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) { + // Three points for end of sentences. + return 3; + } else if (whitespace1 || whitespace2) { + // Two points for whitespace. + return 2; + } else if (nonAlphaNumeric1 || nonAlphaNumeric2) { + // One point for non-alphanumeric. + return 1; + } + + return 0; + } + + var pointer = 1; // Intentionally ignore the first and last element (don't need checking). + + while (pointer < diffs.length - 1) { + if ( + diffs[pointer - 1][0] == DIFF_EQUAL && + diffs[pointer + 1][0] == DIFF_EQUAL + ) { + // This is a single edit surrounded by equalities. + var equality1 = diffs[pointer - 1][1]; + var edit = diffs[pointer][1]; + var equality2 = diffs[pointer + 1][1]; // First, shift the edit as far left as possible. + + var commonOffset = diff_commonSuffix(equality1, edit); + + if (commonOffset) { + var commonString = edit.substring(edit.length - commonOffset); + equality1 = equality1.substring(0, equality1.length - commonOffset); + edit = commonString + edit.substring(0, edit.length - commonOffset); + equality2 = commonString + equality2; + } // Second, step character by character right, looking for the best fit. + + var bestEquality1 = equality1; + var bestEdit = edit; + var bestEquality2 = equality2; + var bestScore = + diff_cleanupSemanticScore_(equality1, edit) + + diff_cleanupSemanticScore_(edit, equality2); + + while (edit.charAt(0) === equality2.charAt(0)) { + equality1 += edit.charAt(0); + edit = edit.substring(1) + equality2.charAt(0); + equality2 = equality2.substring(1); + var score = + diff_cleanupSemanticScore_(equality1, edit) + + diff_cleanupSemanticScore_(edit, equality2); // The >= encourages trailing rather than leading whitespace on edits. + + if (score >= bestScore) { + bestScore = score; + bestEquality1 = equality1; + bestEdit = edit; + bestEquality2 = equality2; + } + } + + if (diffs[pointer - 1][1] != bestEquality1) { + // We have an improvement, save it back to the diff. + if (bestEquality1) { + diffs[pointer - 1][1] = bestEquality1; + } else { + diffs.splice(pointer - 1, 1); + pointer--; + } + + diffs[pointer][1] = bestEdit; + + if (bestEquality2) { + diffs[pointer + 1][1] = bestEquality2; + } else { + diffs.splice(pointer + 1, 1); + pointer--; + } + } + } + + pointer++; + } +}; // Define some regex patterns for matching boundaries. + +var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/; +var whitespaceRegex_ = /\s/; +var linebreakRegex_ = /[\r\n]/; +var blanklineEndRegex_ = /\n\r?\n$/; +var blanklineStartRegex_ = /^\r?\n\r?\n/; +/** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {!Array.} diffs Array of diff tuples. + */ + +var diff_cleanupMerge = function (diffs) { + // Add a dummy entry at the end. + diffs.push(new Diff(DIFF_EQUAL, '')); + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; + var commonlength; + + while (pointer < diffs.length) { + switch (diffs[pointer][0]) { + case DIFF_INSERT: + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; + + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; + + case DIFF_EQUAL: + // Upon reaching an equality, check for prior redundancies. + if (count_delete + count_insert > 1) { + if (count_delete !== 0 && count_insert !== 0) { + // Factor out any common prefixies. + commonlength = diff_commonPrefix(text_insert, text_delete); + + if (commonlength !== 0) { + if ( + pointer - count_delete - count_insert > 0 && + diffs[pointer - count_delete - count_insert - 1][0] == + DIFF_EQUAL + ) { + diffs[pointer - count_delete - count_insert - 1][1] += + text_insert.substring(0, commonlength); + } else { + diffs.splice( + 0, + 0, + new Diff(DIFF_EQUAL, text_insert.substring(0, commonlength)) + ); + pointer++; + } + + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); + } // Factor out any common suffixies. + + commonlength = diff_commonSuffix(text_insert, text_delete); + + if (commonlength !== 0) { + diffs[pointer][1] = + text_insert.substring(text_insert.length - commonlength) + + diffs[pointer][1]; + text_insert = text_insert.substring( + 0, + text_insert.length - commonlength + ); + text_delete = text_delete.substring( + 0, + text_delete.length - commonlength + ); + } + } // Delete the offending records and add the merged ones. + + pointer -= count_delete + count_insert; + diffs.splice(pointer, count_delete + count_insert); + + if (text_delete.length) { + diffs.splice(pointer, 0, new Diff(DIFF_DELETE, text_delete)); + pointer++; + } + + if (text_insert.length) { + diffs.splice(pointer, 0, new Diff(DIFF_INSERT, text_insert)); + pointer++; + } + + pointer++; + } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) { + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else { + pointer++; + } + + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; + } + } + + if (diffs[diffs.length - 1][1] === '') { + diffs.pop(); // Remove the dummy entry at the end. + } // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + + var changes = false; + pointer = 1; // Intentionally ignore the first and last element (don't need checking). + + while (pointer < diffs.length - 1) { + if ( + diffs[pointer - 1][0] == DIFF_EQUAL && + diffs[pointer + 1][0] == DIFF_EQUAL + ) { + // This is a single edit surrounded by equalities. + if ( + diffs[pointer][1].substring( + diffs[pointer][1].length - diffs[pointer - 1][1].length + ) == diffs[pointer - 1][1] + ) { + // Shift the edit over the previous equality. + diffs[pointer][1] = + diffs[pointer - 1][1] + + diffs[pointer][1].substring( + 0, + diffs[pointer][1].length - diffs[pointer - 1][1].length + ); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if ( + diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == + diffs[pointer + 1][1] + ) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = + diffs[pointer][1].substring(diffs[pointer + 1][1].length) + + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + + pointer++; + } // If shifts were made, the diff needs reordering and another shift sweep. + + if (changes) { + diff_cleanupMerge(diffs); + } +}; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/constants.js b/node_modules/jest-circus/node_modules/jest-diff/build/constants.js new file mode 100644 index 000000000..ccf73e512 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/constants.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.SIMILAR_MESSAGE = exports.NO_DIFF_MESSAGE = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const NO_DIFF_MESSAGE = 'Compared values have no visual difference.'; +exports.NO_DIFF_MESSAGE = NO_DIFF_MESSAGE; +const SIMILAR_MESSAGE = + 'Compared values serialize to the same structure.\n' + + 'Printing internal object structure without calling `toJSON` instead.'; +exports.SIMILAR_MESSAGE = SIMILAR_MESSAGE; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/diffLines.js b/node_modules/jest-circus/node_modules/jest-diff/build/diffLines.js new file mode 100644 index 000000000..65ea41b17 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/diffLines.js @@ -0,0 +1,215 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printDiffLines = + exports.diffLinesUnified2 = + exports.diffLinesUnified = + exports.diffLinesRaw = + void 0; + +var _diffSequences = _interopRequireDefault(require('diff-sequences')); + +var _cleanupSemantic = require('./cleanupSemantic'); + +var _joinAlignedDiffs = require('./joinAlignedDiffs'); + +var _normalizeDiffOptions = require('./normalizeDiffOptions'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const isEmptyString = lines => lines.length === 1 && lines[0].length === 0; + +const countChanges = diffs => { + let a = 0; + let b = 0; + diffs.forEach(diff => { + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + a += 1; + break; + + case _cleanupSemantic.DIFF_INSERT: + b += 1; + break; + } + }); + return { + a, + b + }; +}; + +const printAnnotation = ( + { + aAnnotation, + aColor, + aIndicator, + bAnnotation, + bColor, + bIndicator, + includeChangeCounts, + omitAnnotationLines + }, + changeCounts +) => { + if (omitAnnotationLines) { + return ''; + } + + let aRest = ''; + let bRest = ''; + + if (includeChangeCounts) { + const aCount = String(changeCounts.a); + const bCount = String(changeCounts.b); // Padding right aligns the ends of the annotations. + + const baAnnotationLengthDiff = bAnnotation.length - aAnnotation.length; + const aAnnotationPadding = ' '.repeat(Math.max(0, baAnnotationLengthDiff)); + const bAnnotationPadding = ' '.repeat(Math.max(0, -baAnnotationLengthDiff)); // Padding left aligns the ends of the counts. + + const baCountLengthDiff = bCount.length - aCount.length; + const aCountPadding = ' '.repeat(Math.max(0, baCountLengthDiff)); + const bCountPadding = ' '.repeat(Math.max(0, -baCountLengthDiff)); + aRest = `${aAnnotationPadding} ${aIndicator} ${aCountPadding}${aCount}`; + bRest = `${bAnnotationPadding} ${bIndicator} ${bCountPadding}${bCount}`; + } + + const a = `${aIndicator} ${aAnnotation}${aRest}`; + const b = `${bIndicator} ${bAnnotation}${bRest}`; + return `${aColor(a)}\n${bColor(b)}\n\n`; +}; + +const printDiffLines = (diffs, options) => + printAnnotation(options, countChanges(diffs)) + + (options.expand + ? (0, _joinAlignedDiffs.joinAlignedDiffsExpand)(diffs, options) + : (0, _joinAlignedDiffs.joinAlignedDiffsNoExpand)(diffs, options)); // Compare two arrays of strings line-by-line. Format as comparison lines. + +exports.printDiffLines = printDiffLines; + +const diffLinesUnified = (aLines, bLines, options) => + printDiffLines( + diffLinesRaw( + isEmptyString(aLines) ? [] : aLines, + isEmptyString(bLines) ? [] : bLines + ), + (0, _normalizeDiffOptions.normalizeDiffOptions)(options) + ); // Given two pairs of arrays of strings: +// Compare the pair of comparison arrays line-by-line. +// Format the corresponding lines in the pair of displayable arrays. + +exports.diffLinesUnified = diffLinesUnified; + +const diffLinesUnified2 = ( + aLinesDisplay, + bLinesDisplay, + aLinesCompare, + bLinesCompare, + options +) => { + if (isEmptyString(aLinesDisplay) && isEmptyString(aLinesCompare)) { + aLinesDisplay = []; + aLinesCompare = []; + } + + if (isEmptyString(bLinesDisplay) && isEmptyString(bLinesCompare)) { + bLinesDisplay = []; + bLinesCompare = []; + } + + if ( + aLinesDisplay.length !== aLinesCompare.length || + bLinesDisplay.length !== bLinesCompare.length + ) { + // Fall back to diff of display lines. + return diffLinesUnified(aLinesDisplay, bLinesDisplay, options); + } + + const diffs = diffLinesRaw(aLinesCompare, bLinesCompare); // Replace comparison lines with displayable lines. + + let aIndex = 0; + let bIndex = 0; + diffs.forEach(diff => { + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + diff[1] = aLinesDisplay[aIndex]; + aIndex += 1; + break; + + case _cleanupSemantic.DIFF_INSERT: + diff[1] = bLinesDisplay[bIndex]; + bIndex += 1; + break; + + default: + diff[1] = bLinesDisplay[bIndex]; + aIndex += 1; + bIndex += 1; + } + }); + return printDiffLines( + diffs, + (0, _normalizeDiffOptions.normalizeDiffOptions)(options) + ); +}; // Compare two arrays of strings line-by-line. + +exports.diffLinesUnified2 = diffLinesUnified2; + +const diffLinesRaw = (aLines, bLines) => { + const aLength = aLines.length; + const bLength = bLines.length; + + const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex]; + + const diffs = []; + let aIndex = 0; + let bIndex = 0; + + const foundSubsequence = (nCommon, aCommon, bCommon) => { + for (; aIndex !== aCommon; aIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, aLines[aIndex]) + ); + } + + for (; bIndex !== bCommon; bIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, bLines[bIndex]) + ); + } + + for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_EQUAL, bLines[bIndex]) + ); + } + }; + + (0, _diffSequences.default)(aLength, bLength, isCommon, foundSubsequence); // After the last common subsequence, push remaining change items. + + for (; aIndex !== aLength; aIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, aLines[aIndex]) + ); + } + + for (; bIndex !== bLength; bIndex += 1) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, bLines[bIndex]) + ); + } + + return diffs; +}; + +exports.diffLinesRaw = diffLinesRaw; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/diffStrings.js b/node_modules/jest-circus/node_modules/jest-diff/build/diffStrings.js new file mode 100644 index 000000000..3ad4f1a5b --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/diffStrings.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _diffSequences = _interopRequireDefault(require('diff-sequences')); + +var _cleanupSemantic = require('./cleanupSemantic'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const diffStrings = (a, b) => { + const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex]; + + let aIndex = 0; + let bIndex = 0; + const diffs = []; + + const foundSubsequence = (nCommon, aCommon, bCommon) => { + if (aIndex !== aCommon) { + diffs.push( + new _cleanupSemantic.Diff( + _cleanupSemantic.DIFF_DELETE, + a.slice(aIndex, aCommon) + ) + ); + } + + if (bIndex !== bCommon) { + diffs.push( + new _cleanupSemantic.Diff( + _cleanupSemantic.DIFF_INSERT, + b.slice(bIndex, bCommon) + ) + ); + } + + aIndex = aCommon + nCommon; // number of characters compared in a + + bIndex = bCommon + nCommon; // number of characters compared in b + + diffs.push( + new _cleanupSemantic.Diff( + _cleanupSemantic.DIFF_EQUAL, + b.slice(bCommon, bIndex) + ) + ); + }; + + (0, _diffSequences.default)(a.length, b.length, isCommon, foundSubsequence); // After the last common subsequence, push remaining change items. + + if (aIndex !== a.length) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, a.slice(aIndex)) + ); + } + + if (bIndex !== b.length) { + diffs.push( + new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, b.slice(bIndex)) + ); + } + + return diffs; +}; + +var _default = diffStrings; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/getAlignedDiffs.js b/node_modules/jest-circus/node_modules/jest-diff/build/getAlignedDiffs.js new file mode 100644 index 000000000..60dc1414f --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/getAlignedDiffs.js @@ -0,0 +1,231 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _cleanupSemantic = require('./cleanupSemantic'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Given change op and array of diffs, return concatenated string: +// * include common strings +// * include change strings which have argument op with changeColor +// * exclude change strings which have opposite op +const concatenateRelevantDiffs = (op, diffs, changeColor) => + diffs.reduce( + (reduced, diff) => + reduced + + (diff[0] === _cleanupSemantic.DIFF_EQUAL + ? diff[1] + : diff[0] === op && diff[1].length !== 0 // empty if change is newline + ? changeColor(diff[1]) + : ''), + '' + ); // Encapsulate change lines until either a common newline or the end. + +class ChangeBuffer { + op; + line; // incomplete line + + lines; // complete lines + + changeColor; + + constructor(op, changeColor) { + this.op = op; + this.line = []; + this.lines = []; + this.changeColor = changeColor; + } + + pushSubstring(substring) { + this.pushDiff(new _cleanupSemantic.Diff(this.op, substring)); + } + + pushLine() { + // Assume call only if line has at least one diff, + // therefore an empty line must have a diff which has an empty string. + // If line has multiple diffs, then assume it has a common diff, + // therefore change diffs have change color; + // otherwise then it has line color only. + this.lines.push( + this.line.length !== 1 + ? new _cleanupSemantic.Diff( + this.op, + concatenateRelevantDiffs(this.op, this.line, this.changeColor) + ) + : this.line[0][0] === this.op + ? this.line[0] // can use instance + : new _cleanupSemantic.Diff(this.op, this.line[0][1]) // was common diff + ); + this.line.length = 0; + } + + isLineEmpty() { + return this.line.length === 0; + } // Minor input to buffer. + + pushDiff(diff) { + this.line.push(diff); + } // Main input to buffer. + + align(diff) { + const string = diff[1]; + + if (string.includes('\n')) { + const substrings = string.split('\n'); + const iLast = substrings.length - 1; + substrings.forEach((substring, i) => { + if (i < iLast) { + // The first substring completes the current change line. + // A middle substring is a change line. + this.pushSubstring(substring); + this.pushLine(); + } else if (substring.length !== 0) { + // The last substring starts a change line, if it is not empty. + // Important: This non-empty condition also automatically omits + // the newline appended to the end of expected and received strings. + this.pushSubstring(substring); + } + }); + } else { + // Append non-multiline string to current change line. + this.pushDiff(diff); + } + } // Output from buffer. + + moveLinesTo(lines) { + if (!this.isLineEmpty()) { + this.pushLine(); + } + + lines.push(...this.lines); + this.lines.length = 0; + } +} // Encapsulate common and change lines. + +class CommonBuffer { + deleteBuffer; + insertBuffer; + lines; + + constructor(deleteBuffer, insertBuffer) { + this.deleteBuffer = deleteBuffer; + this.insertBuffer = insertBuffer; + this.lines = []; + } + + pushDiffCommonLine(diff) { + this.lines.push(diff); + } + + pushDiffChangeLines(diff) { + const isDiffEmpty = diff[1].length === 0; // An empty diff string is redundant, unless a change line is empty. + + if (!isDiffEmpty || this.deleteBuffer.isLineEmpty()) { + this.deleteBuffer.pushDiff(diff); + } + + if (!isDiffEmpty || this.insertBuffer.isLineEmpty()) { + this.insertBuffer.pushDiff(diff); + } + } + + flushChangeLines() { + this.deleteBuffer.moveLinesTo(this.lines); + this.insertBuffer.moveLinesTo(this.lines); + } // Input to buffer. + + align(diff) { + const op = diff[0]; + const string = diff[1]; + + if (string.includes('\n')) { + const substrings = string.split('\n'); + const iLast = substrings.length - 1; + substrings.forEach((substring, i) => { + if (i === 0) { + const subdiff = new _cleanupSemantic.Diff(op, substring); + + if ( + this.deleteBuffer.isLineEmpty() && + this.insertBuffer.isLineEmpty() + ) { + // If both current change lines are empty, + // then the first substring is a common line. + this.flushChangeLines(); + this.pushDiffCommonLine(subdiff); + } else { + // If either current change line is non-empty, + // then the first substring completes the change lines. + this.pushDiffChangeLines(subdiff); + this.flushChangeLines(); + } + } else if (i < iLast) { + // A middle substring is a common line. + this.pushDiffCommonLine(new _cleanupSemantic.Diff(op, substring)); + } else if (substring.length !== 0) { + // The last substring starts a change line, if it is not empty. + // Important: This non-empty condition also automatically omits + // the newline appended to the end of expected and received strings. + this.pushDiffChangeLines(new _cleanupSemantic.Diff(op, substring)); + } + }); + } else { + // Append non-multiline string to current change lines. + // Important: It cannot be at the end following empty change lines, + // because newline appended to the end of expected and received strings. + this.pushDiffChangeLines(diff); + } + } // Output from buffer. + + getLines() { + this.flushChangeLines(); + return this.lines; + } +} // Given diffs from expected and received strings, +// return new array of diffs split or joined into lines. +// +// To correctly align a change line at the end, the algorithm: +// * assumes that a newline was appended to the strings +// * omits the last newline from the output array +// +// Assume the function is not called: +// * if either expected or received is empty string +// * if neither expected nor received is multiline string + +const getAlignedDiffs = (diffs, changeColor) => { + const deleteBuffer = new ChangeBuffer( + _cleanupSemantic.DIFF_DELETE, + changeColor + ); + const insertBuffer = new ChangeBuffer( + _cleanupSemantic.DIFF_INSERT, + changeColor + ); + const commonBuffer = new CommonBuffer(deleteBuffer, insertBuffer); + diffs.forEach(diff => { + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + deleteBuffer.align(diff); + break; + + case _cleanupSemantic.DIFF_INSERT: + insertBuffer.align(diff); + break; + + default: + commonBuffer.align(diff); + } + }); + return commonBuffer.getLines(); +}; + +var _default = getAlignedDiffs; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/index.d.ts b/node_modules/jest-circus/node_modules/jest-diff/build/index.d.ts new file mode 100644 index 000000000..2b2625c66 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/index.d.ts @@ -0,0 +1,93 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type {CompareKeys} from 'pretty-format'; + +/** + * Class representing one diff tuple. + * Attempts to look like a two-element array (which is what this used to be). + * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. + * @param {string} text Text to be deleted, inserted, or retained. + * @constructor + */ +export declare class Diff { + 0: number; + 1: string; + constructor(op: number, text: string); +} + +export declare function diff( + a: any, + b: any, + options?: DiffOptions, +): string | null; + +/** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ +export declare var DIFF_DELETE: number; + +export declare var DIFF_EQUAL: number; + +export declare var DIFF_INSERT: number; + +export declare const diffLinesRaw: ( + aLines: Array, + bLines: Array, +) => Array; + +export declare const diffLinesUnified: ( + aLines: Array, + bLines: Array, + options?: DiffOptions | undefined, +) => string; + +export declare const diffLinesUnified2: ( + aLinesDisplay: Array, + bLinesDisplay: Array, + aLinesCompare: Array, + bLinesCompare: Array, + options?: DiffOptions | undefined, +) => string; + +export declare type DiffOptions = { + aAnnotation?: string; + aColor?: DiffOptionsColor; + aIndicator?: string; + bAnnotation?: string; + bColor?: DiffOptionsColor; + bIndicator?: string; + changeColor?: DiffOptionsColor; + changeLineTrailingSpaceColor?: DiffOptionsColor; + commonColor?: DiffOptionsColor; + commonIndicator?: string; + commonLineTrailingSpaceColor?: DiffOptionsColor; + contextLines?: number; + emptyFirstOrLastLinePlaceholder?: string; + expand?: boolean; + includeChangeCounts?: boolean; + omitAnnotationLines?: boolean; + patchColor?: DiffOptionsColor; + compareKeys?: CompareKeys; +}; + +export declare type DiffOptionsColor = (arg: string) => string; + +export declare const diffStringsRaw: ( + a: string, + b: string, + cleanup: boolean, +) => Array; + +export declare const diffStringsUnified: ( + a: string, + b: string, + options?: DiffOptions | undefined, +) => string; + +export {}; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/index.js b/node_modules/jest-circus/node_modules/jest-diff/build/index.js new file mode 100644 index 000000000..cd0b86611 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/index.js @@ -0,0 +1,253 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +Object.defineProperty(exports, 'DIFF_DELETE', { + enumerable: true, + get: function () { + return _cleanupSemantic.DIFF_DELETE; + } +}); +Object.defineProperty(exports, 'DIFF_EQUAL', { + enumerable: true, + get: function () { + return _cleanupSemantic.DIFF_EQUAL; + } +}); +Object.defineProperty(exports, 'DIFF_INSERT', { + enumerable: true, + get: function () { + return _cleanupSemantic.DIFF_INSERT; + } +}); +Object.defineProperty(exports, 'Diff', { + enumerable: true, + get: function () { + return _cleanupSemantic.Diff; + } +}); +exports.diff = diff; +Object.defineProperty(exports, 'diffLinesRaw', { + enumerable: true, + get: function () { + return _diffLines.diffLinesRaw; + } +}); +Object.defineProperty(exports, 'diffLinesUnified', { + enumerable: true, + get: function () { + return _diffLines.diffLinesUnified; + } +}); +Object.defineProperty(exports, 'diffLinesUnified2', { + enumerable: true, + get: function () { + return _diffLines.diffLinesUnified2; + } +}); +Object.defineProperty(exports, 'diffStringsRaw', { + enumerable: true, + get: function () { + return _printDiffs.diffStringsRaw; + } +}); +Object.defineProperty(exports, 'diffStringsUnified', { + enumerable: true, + get: function () { + return _printDiffs.diffStringsUnified; + } +}); + +var _chalk = _interopRequireDefault(require('chalk')); + +var _jestGetType = require('jest-get-type'); + +var _prettyFormat = require('pretty-format'); + +var _cleanupSemantic = require('./cleanupSemantic'); + +var _constants = require('./constants'); + +var _diffLines = require('./diffLines'); + +var _normalizeDiffOptions = require('./normalizeDiffOptions'); + +var _printDiffs = require('./printDiffs'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; + +const getCommonMessage = (message, options) => { + const {commonColor} = (0, _normalizeDiffOptions.normalizeDiffOptions)( + options + ); + return commonColor(message); +}; + +const { + AsymmetricMatcher, + DOMCollection, + DOMElement, + Immutable, + ReactElement, + ReactTestComponent +} = _prettyFormat.plugins; +const PLUGINS = [ + ReactTestComponent, + ReactElement, + DOMElement, + DOMCollection, + Immutable, + AsymmetricMatcher +]; +const FORMAT_OPTIONS = { + plugins: PLUGINS +}; +const FALLBACK_FORMAT_OPTIONS = { + callToJSON: false, + maxDepth: 10, + plugins: PLUGINS +}; // Generate a string that will highlight the difference between two values +// with green and red. (similar to how github does code diffing) +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + +function diff(a, b, options) { + if (Object.is(a, b)) { + return getCommonMessage(_constants.NO_DIFF_MESSAGE, options); + } + + const aType = (0, _jestGetType.getType)(a); + let expectedType = aType; + let omitDifference = false; + + if (aType === 'object' && typeof a.asymmetricMatch === 'function') { + if (a.$$typeof !== Symbol.for('jest.asymmetricMatcher')) { + // Do not know expected type of user-defined asymmetric matcher. + return null; + } + + if (typeof a.getExpectedType !== 'function') { + // For example, expect.anything() matches either null or undefined + return null; + } + + expectedType = a.getExpectedType(); // Primitive types boolean and number omit difference below. + // For example, omit difference for expect.stringMatching(regexp) + + omitDifference = expectedType === 'string'; + } + + if (expectedType !== (0, _jestGetType.getType)(b)) { + return ( + ' Comparing two different types of values.' + + ` Expected ${_chalk.default.green(expectedType)} but ` + + `received ${_chalk.default.red((0, _jestGetType.getType)(b))}.` + ); + } + + if (omitDifference) { + return null; + } + + switch (aType) { + case 'string': + return (0, _diffLines.diffLinesUnified)( + a.split('\n'), + b.split('\n'), + options + ); + + case 'boolean': + case 'number': + return comparePrimitive(a, b, options); + + case 'map': + return compareObjects(sortMap(a), sortMap(b), options); + + case 'set': + return compareObjects(sortSet(a), sortSet(b), options); + + default: + return compareObjects(a, b, options); + } +} + +function comparePrimitive(a, b, options) { + const aFormat = (0, _prettyFormat.format)(a, FORMAT_OPTIONS); + const bFormat = (0, _prettyFormat.format)(b, FORMAT_OPTIONS); + return aFormat === bFormat + ? getCommonMessage(_constants.NO_DIFF_MESSAGE, options) + : (0, _diffLines.diffLinesUnified)( + aFormat.split('\n'), + bFormat.split('\n'), + options + ); +} + +function sortMap(map) { + return new Map(Array.from(map.entries()).sort()); +} + +function sortSet(set) { + return new Set(Array.from(set.values()).sort()); +} + +function compareObjects(a, b, options) { + let difference; + let hasThrown = false; + + try { + const formatOptions = getFormatOptions(FORMAT_OPTIONS, options); + difference = getObjectsDifference(a, b, formatOptions, options); + } catch { + hasThrown = true; + } + + const noDiffMessage = getCommonMessage(_constants.NO_DIFF_MESSAGE, options); // If the comparison yields no results, compare again but this time + // without calling `toJSON`. It's also possible that toJSON might throw. + + if (difference === undefined || difference === noDiffMessage) { + const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options); + difference = getObjectsDifference(a, b, formatOptions, options); + + if (difference !== noDiffMessage && !hasThrown) { + difference = `${getCommonMessage( + _constants.SIMILAR_MESSAGE, + options + )}\n\n${difference}`; + } + } + + return difference; +} + +function getFormatOptions(formatOptions, options) { + const {compareKeys} = (0, _normalizeDiffOptions.normalizeDiffOptions)( + options + ); + return {...formatOptions, compareKeys}; +} + +function getObjectsDifference(a, b, formatOptions, options) { + const formatOptionsZeroIndent = {...formatOptions, indent: 0}; + const aCompare = (0, _prettyFormat.format)(a, formatOptionsZeroIndent); + const bCompare = (0, _prettyFormat.format)(b, formatOptionsZeroIndent); + + if (aCompare === bCompare) { + return getCommonMessage(_constants.NO_DIFF_MESSAGE, options); + } else { + const aDisplay = (0, _prettyFormat.format)(a, formatOptions); + const bDisplay = (0, _prettyFormat.format)(b, formatOptions); + return (0, _diffLines.diffLinesUnified2)( + aDisplay.split('\n'), + bDisplay.split('\n'), + aCompare.split('\n'), + bCompare.split('\n'), + options + ); + } +} diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/joinAlignedDiffs.js b/node_modules/jest-circus/node_modules/jest-diff/build/joinAlignedDiffs.js new file mode 100644 index 000000000..9eba70fd1 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/joinAlignedDiffs.js @@ -0,0 +1,303 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.joinAlignedDiffsNoExpand = exports.joinAlignedDiffsExpand = void 0; + +var _cleanupSemantic = require('./cleanupSemantic'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const formatTrailingSpaces = (line, trailingSpaceFormatter) => + line.replace(/\s+$/, match => trailingSpaceFormatter(match)); + +const printDiffLine = ( + line, + isFirstOrLast, + color, + indicator, + trailingSpaceFormatter, + emptyFirstOrLastLinePlaceholder +) => + line.length !== 0 + ? color( + `${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}` + ) + : indicator !== ' ' + ? color(indicator) + : isFirstOrLast && emptyFirstOrLastLinePlaceholder.length !== 0 + ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`) + : ''; + +const printDeleteLine = ( + line, + isFirstOrLast, + { + aColor, + aIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + aColor, + aIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); + +const printInsertLine = ( + line, + isFirstOrLast, + { + bColor, + bIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + bColor, + bIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); + +const printCommonLine = ( + line, + isFirstOrLast, + { + commonColor, + commonIndicator, + commonLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + commonColor, + commonIndicator, + commonLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); // In GNU diff format, indexes are one-based instead of zero-based. + +const createPatchMark = (aStart, aEnd, bStart, bEnd, {patchColor}) => + patchColor( + `@@ -${aStart + 1},${aEnd - aStart} +${bStart + 1},${bEnd - bStart} @@` + ); // jest --no-expand +// +// Given array of aligned strings with inverse highlight formatting, +// return joined lines with diff formatting (and patch marks, if needed). + +const joinAlignedDiffsNoExpand = (diffs, options) => { + const iLength = diffs.length; + const nContextLines = options.contextLines; + const nContextLines2 = nContextLines + nContextLines; // First pass: count output lines and see if it has patches. + + let jLength = iLength; + let hasExcessAtStartOrEnd = false; + let nExcessesBetweenChanges = 0; + let i = 0; + + while (i !== iLength) { + const iStart = i; + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) { + i += 1; + } + + if (iStart !== i) { + if (iStart === 0) { + // at start + if (i > nContextLines) { + jLength -= i - nContextLines; // subtract excess common lines + + hasExcessAtStartOrEnd = true; + } + } else if (i === iLength) { + // at end + const n = i - iStart; + + if (n > nContextLines) { + jLength -= n - nContextLines; // subtract excess common lines + + hasExcessAtStartOrEnd = true; + } + } else { + // between changes + const n = i - iStart; + + if (n > nContextLines2) { + jLength -= n - nContextLines2; // subtract excess common lines + + nExcessesBetweenChanges += 1; + } + } + } + + while (i !== iLength && diffs[i][0] !== _cleanupSemantic.DIFF_EQUAL) { + i += 1; + } + } + + const hasPatch = nExcessesBetweenChanges !== 0 || hasExcessAtStartOrEnd; + + if (nExcessesBetweenChanges !== 0) { + jLength += nExcessesBetweenChanges + 1; // add patch lines + } else if (hasExcessAtStartOrEnd) { + jLength += 1; // add patch line + } + + const jLast = jLength - 1; + const lines = []; + let jPatchMark = 0; // index of placeholder line for current patch mark + + if (hasPatch) { + lines.push(''); // placeholder line for first patch mark + } // Indexes of expected or received lines in current patch: + + let aStart = 0; + let bStart = 0; + let aEnd = 0; + let bEnd = 0; + + const pushCommonLine = line => { + const j = lines.length; + lines.push(printCommonLine(line, j === 0 || j === jLast, options)); + aEnd += 1; + bEnd += 1; + }; + + const pushDeleteLine = line => { + const j = lines.length; + lines.push(printDeleteLine(line, j === 0 || j === jLast, options)); + aEnd += 1; + }; + + const pushInsertLine = line => { + const j = lines.length; + lines.push(printInsertLine(line, j === 0 || j === jLast, options)); + bEnd += 1; + }; // Second pass: push lines with diff formatting (and patch marks, if needed). + + i = 0; + + while (i !== iLength) { + let iStart = i; + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) { + i += 1; + } + + if (iStart !== i) { + if (iStart === 0) { + // at beginning + if (i > nContextLines) { + iStart = i - nContextLines; + aStart = iStart; + bStart = iStart; + aEnd = aStart; + bEnd = bStart; + } + + for (let iCommon = iStart; iCommon !== i; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } else if (i === iLength) { + // at end + const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i; + + for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } else { + // between changes + const nCommon = i - iStart; + + if (nCommon > nContextLines2) { + const iEnd = iStart + nContextLines; + + for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + + lines[jPatchMark] = createPatchMark( + aStart, + aEnd, + bStart, + bEnd, + options + ); + jPatchMark = lines.length; + lines.push(''); // placeholder line for next patch mark + + const nOmit = nCommon - nContextLines2; + aStart = aEnd + nOmit; + bStart = bEnd + nOmit; + aEnd = aStart; + bEnd = bStart; + + for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } else { + for (let iCommon = iStart; iCommon !== i; iCommon += 1) { + pushCommonLine(diffs[iCommon][1]); + } + } + } + } + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_DELETE) { + pushDeleteLine(diffs[i][1]); + i += 1; + } + + while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_INSERT) { + pushInsertLine(diffs[i][1]); + i += 1; + } + } + + if (hasPatch) { + lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options); + } + + return lines.join('\n'); +}; // jest --expand +// +// Given array of aligned strings with inverse highlight formatting, +// return joined lines with diff formatting. + +exports.joinAlignedDiffsNoExpand = joinAlignedDiffsNoExpand; + +const joinAlignedDiffsExpand = (diffs, options) => + diffs + .map((diff, i, diffs) => { + const line = diff[1]; + const isFirstOrLast = i === 0 || i === diffs.length - 1; + + switch (diff[0]) { + case _cleanupSemantic.DIFF_DELETE: + return printDeleteLine(line, isFirstOrLast, options); + + case _cleanupSemantic.DIFF_INSERT: + return printInsertLine(line, isFirstOrLast, options); + + default: + return printCommonLine(line, isFirstOrLast, options); + } + }) + .join('\n'); + +exports.joinAlignedDiffsExpand = joinAlignedDiffsExpand; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/normalizeDiffOptions.js b/node_modules/jest-circus/node_modules/jest-diff/build/normalizeDiffOptions.js new file mode 100644 index 000000000..b22a80476 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/normalizeDiffOptions.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.normalizeDiffOptions = exports.noColor = void 0; + +var _chalk = _interopRequireDefault(require('chalk')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const noColor = string => string; + +exports.noColor = noColor; +const DIFF_CONTEXT_DEFAULT = 5; +const OPTIONS_DEFAULT = { + aAnnotation: 'Expected', + aColor: _chalk.default.green, + aIndicator: '-', + bAnnotation: 'Received', + bColor: _chalk.default.red, + bIndicator: '+', + changeColor: _chalk.default.inverse, + changeLineTrailingSpaceColor: noColor, + commonColor: _chalk.default.dim, + commonIndicator: ' ', + commonLineTrailingSpaceColor: noColor, + compareKeys: undefined, + contextLines: DIFF_CONTEXT_DEFAULT, + emptyFirstOrLastLinePlaceholder: '', + expand: true, + includeChangeCounts: false, + omitAnnotationLines: false, + patchColor: _chalk.default.yellow +}; + +const getCompareKeys = compareKeys => + compareKeys && typeof compareKeys === 'function' + ? compareKeys + : OPTIONS_DEFAULT.compareKeys; + +const getContextLines = contextLines => + typeof contextLines === 'number' && + Number.isSafeInteger(contextLines) && + contextLines >= 0 + ? contextLines + : DIFF_CONTEXT_DEFAULT; // Pure function returns options with all properties. + +const normalizeDiffOptions = (options = {}) => ({ + ...OPTIONS_DEFAULT, + ...options, + compareKeys: getCompareKeys(options.compareKeys), + contextLines: getContextLines(options.contextLines) +}); + +exports.normalizeDiffOptions = normalizeDiffOptions; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/printDiffs.js b/node_modules/jest-circus/node_modules/jest-diff/build/printDiffs.js new file mode 100644 index 000000000..497ff0728 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/printDiffs.js @@ -0,0 +1,85 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.diffStringsUnified = exports.diffStringsRaw = void 0; + +var _cleanupSemantic = require('./cleanupSemantic'); + +var _diffLines = require('./diffLines'); + +var _diffStrings = _interopRequireDefault(require('./diffStrings')); + +var _getAlignedDiffs = _interopRequireDefault(require('./getAlignedDiffs')); + +var _normalizeDiffOptions = require('./normalizeDiffOptions'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const hasCommonDiff = (diffs, isMultiline) => { + if (isMultiline) { + // Important: Ignore common newline that was appended to multiline strings! + const iLast = diffs.length - 1; + return diffs.some( + (diff, i) => + diff[0] === _cleanupSemantic.DIFF_EQUAL && + (i !== iLast || diff[1] !== '\n') + ); + } + + return diffs.some(diff => diff[0] === _cleanupSemantic.DIFF_EQUAL); +}; // Compare two strings character-by-character. +// Format as comparison lines in which changed substrings have inverse colors. + +const diffStringsUnified = (a, b, options) => { + if (a !== b && a.length !== 0 && b.length !== 0) { + const isMultiline = a.includes('\n') || b.includes('\n'); // getAlignedDiffs assumes that a newline was appended to the strings. + + const diffs = diffStringsRaw( + isMultiline ? `${a}\n` : a, + isMultiline ? `${b}\n` : b, + true // cleanupSemantic + ); + + if (hasCommonDiff(diffs, isMultiline)) { + const optionsNormalized = (0, _normalizeDiffOptions.normalizeDiffOptions)( + options + ); + const lines = (0, _getAlignedDiffs.default)( + diffs, + optionsNormalized.changeColor + ); + return (0, _diffLines.printDiffLines)(lines, optionsNormalized); + } + } // Fall back to line-by-line diff. + + return (0, _diffLines.diffLinesUnified)( + a.split('\n'), + b.split('\n'), + options + ); +}; // Compare two strings character-by-character. +// Optionally clean up small common substrings, also known as chaff. + +exports.diffStringsUnified = diffStringsUnified; + +const diffStringsRaw = (a, b, cleanup) => { + const diffs = (0, _diffStrings.default)(a, b); + + if (cleanup) { + (0, _cleanupSemantic.cleanupSemantic)(diffs); // impure function + } + + return diffs; +}; + +exports.diffStringsRaw = diffStringsRaw; diff --git a/node_modules/jest-circus/node_modules/jest-diff/build/types.js b/node_modules/jest-circus/node_modules/jest-diff/build/types.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/jest-circus/node_modules/jest-diff/package.json b/node_modules/jest-circus/node_modules/jest-diff/package.json new file mode 100644 index 000000000..2d249c921 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-diff/package.json @@ -0,0 +1,36 @@ +{ + "name": "jest-diff", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-diff" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.0.0", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "devDependencies": { + "@jest/test-utils": "^28.0.1", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/jest-circus/node_modules/jest-get-type/LICENSE b/node_modules/jest-circus/node_modules/jest-get-type/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-get-type/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/jest-get-type/build/index.d.ts b/node_modules/jest-circus/node_modules/jest-get-type/build/index.d.ts new file mode 100644 index 000000000..096d2d1ea --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-get-type/build/index.d.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare function getType(value: unknown): ValueType; + +export declare const isPrimitive: (value: unknown) => boolean; + +declare type ValueType = + | 'array' + | 'bigint' + | 'boolean' + | 'function' + | 'null' + | 'number' + | 'object' + | 'regexp' + | 'map' + | 'set' + | 'date' + | 'string' + | 'symbol' + | 'undefined'; + +export {}; diff --git a/node_modules/jest-circus/node_modules/jest-get-type/build/index.js b/node_modules/jest-circus/node_modules/jest-get-type/build/index.js new file mode 100644 index 000000000..d2bc99595 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-get-type/build/index.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.getType = getType; +exports.isPrimitive = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// get the type of a value with handling the edge cases like `typeof []` +// and `typeof null` +function getType(value) { + if (value === undefined) { + return 'undefined'; + } else if (value === null) { + return 'null'; + } else if (Array.isArray(value)) { + return 'array'; + } else if (typeof value === 'boolean') { + return 'boolean'; + } else if (typeof value === 'function') { + return 'function'; + } else if (typeof value === 'number') { + return 'number'; + } else if (typeof value === 'string') { + return 'string'; + } else if (typeof value === 'bigint') { + return 'bigint'; + } else if (typeof value === 'object') { + if (value != null) { + if (value.constructor === RegExp) { + return 'regexp'; + } else if (value.constructor === Map) { + return 'map'; + } else if (value.constructor === Set) { + return 'set'; + } else if (value.constructor === Date) { + return 'date'; + } + } + + return 'object'; + } else if (typeof value === 'symbol') { + return 'symbol'; + } + + throw new Error(`value of unknown type: ${value}`); +} + +const isPrimitive = value => Object(value) !== value; + +exports.isPrimitive = isPrimitive; diff --git a/node_modules/jest-circus/node_modules/jest-get-type/package.json b/node_modules/jest-circus/node_modules/jest-get-type/package.json new file mode 100644 index 000000000..b56e68df1 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-get-type/package.json @@ -0,0 +1,27 @@ +{ + "name": "jest-get-type", + "description": "A utility function to get the type of a value", + "version": "28.0.0", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-get-type" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365" +} diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/LICENSE b/node_modules/jest-circus/node_modules/jest-matcher-utils/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/README.md b/node_modules/jest-circus/node_modules/jest-matcher-utils/README.md new file mode 100644 index 000000000..d3e9d13bf --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/README.md @@ -0,0 +1,24 @@ +# jest-matcher-utils + +This package's exports are most notably used by `expect`'s [`this.utils`](https://jestjs.io/docs/expect#thisutils). + +## Installation + +To add this package as a dependency of a project, run either of the following commands: + +- `npm install jest-matcher-utils` +- `yarn add jest-matcher-utils` + +## Exports ([src/index.ts](https://github.com/facebook/jest/blob/HEAD/packages/jest-matcher-utils/src/index.ts)) + +### Functions + +`stringify` `highlightTrailingWhitespace` `printReceived` `printExpected` `printWithType` `ensureNoExpected` `ensureActualIsNumber` `ensureExpectedIsNumber` `ensureNumbers` `ensureExpectedIsNonNegativeInteger` `printDiffOrStringify` `diff` `pluralize` `getLabelPrinter` `matcherErrorMessage` `matcherHint` + +### Types + +`MatcherHintOptions` `DiffOptions` + +### Constants + +`EXPECTED_COLOR` `RECEIVED_COLOR` `INVERTED_COLOR` `BOLD_WEIGHT` `DIM_COLOR` `SUGGEST_TO_CONTAIN_EQUAL` diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/build/Replaceable.js b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/Replaceable.js new file mode 100644 index 000000000..83330c797 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/Replaceable.js @@ -0,0 +1,73 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _jestGetType = require('jest-get-type'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const supportTypes = ['map', 'array', 'object']; + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +class Replaceable { + object; + type; + + constructor(object) { + this.object = object; + this.type = (0, _jestGetType.getType)(object); + + if (!supportTypes.includes(this.type)) { + throw new Error(`Type ${this.type} is not support in Replaceable!`); + } + } + + static isReplaceable(obj1, obj2) { + const obj1Type = (0, _jestGetType.getType)(obj1); + const obj2Type = (0, _jestGetType.getType)(obj2); + return obj1Type === obj2Type && supportTypes.includes(obj1Type); + } + + forEach(cb) { + if (this.type === 'object') { + const descriptors = Object.getOwnPropertyDescriptors(this.object); + [ + ...Object.keys(descriptors), + ...Object.getOwnPropertySymbols(descriptors) + ] //@ts-expect-error because typescript do not support symbol key in object + //https://github.com/microsoft/TypeScript/issues/1863 + .filter(key => descriptors[key].enumerable) + .forEach(key => { + cb(this.object[key], key, this.object); + }); + } else { + this.object.forEach(cb); + } + } + + get(key) { + if (this.type === 'map') { + return this.object.get(key); + } + + return this.object[key]; + } + + set(key, value) { + if (this.type === 'map') { + this.object.set(key, value); + } else { + this.object[key] = value; + } + } +} +/* eslint-enable */ + +exports.default = Replaceable; diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js new file mode 100644 index 000000000..15a13e50b --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js @@ -0,0 +1,110 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = deepCyclicCopyReplaceable; + +var _prettyFormat = require('pretty-format'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const builtInObject = [ + Array, + Date, + Float32Array, + Float64Array, + Int16Array, + Int32Array, + Int8Array, + Map, + Set, + RegExp, + Uint16Array, + Uint32Array, + Uint8Array, + Uint8ClampedArray +]; + +if (typeof Buffer !== 'undefined') { + builtInObject.push(Buffer); +} + +const isBuiltInObject = object => builtInObject.includes(object.constructor); + +const isMap = value => value.constructor === Map; + +function deepCyclicCopyReplaceable(value, cycles = new WeakMap()) { + if (typeof value !== 'object' || value === null) { + return value; + } else if (cycles.has(value)) { + return cycles.get(value); + } else if (Array.isArray(value)) { + return deepCyclicCopyArray(value, cycles); + } else if (isMap(value)) { + return deepCyclicCopyMap(value, cycles); + } else if (isBuiltInObject(value)) { + return value; + } else if (_prettyFormat.plugins.DOMElement.test(value)) { + return value.cloneNode(true); + } else { + return deepCyclicCopyObject(value, cycles); + } +} + +function deepCyclicCopyObject(object, cycles) { + const newObject = Object.create(Object.getPrototypeOf(object)); + const descriptors = Object.getOwnPropertyDescriptors(object); + cycles.set(object, newObject); + const newDescriptors = [ + ...Object.keys(descriptors), + ...Object.getOwnPropertySymbols(descriptors) + ].reduce( + //@ts-expect-error because typescript do not support symbol key in object + //https://github.com/microsoft/TypeScript/issues/1863 + (newDescriptors, key) => { + const enumerable = descriptors[key].enumerable; + newDescriptors[key] = { + configurable: true, + enumerable, + value: deepCyclicCopyReplaceable( + // this accesses the value or getter, depending. We just care about the value anyways, and this allows us to not mess with accessors + // it has the side effect of invoking the getter here though, rather than copying it over + object[key], + cycles + ), + writable: true + }; + return newDescriptors; + }, + {} + ); //@ts-expect-error because typescript do not support symbol key in object + //https://github.com/microsoft/TypeScript/issues/1863 + + return Object.defineProperties(newObject, newDescriptors); +} + +function deepCyclicCopyArray(array, cycles) { + const newArray = new (Object.getPrototypeOf(array).constructor)(array.length); + const length = array.length; + cycles.set(array, newArray); + + for (let i = 0; i < length; i++) { + newArray[i] = deepCyclicCopyReplaceable(array[i], cycles); + } + + return newArray; +} + +function deepCyclicCopyMap(map, cycles) { + const newMap = new Map(); + cycles.set(map, newMap); + map.forEach((value, key) => { + newMap.set(key, deepCyclicCopyReplaceable(value, cycles)); + }); + return newMap; +} diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.d.ts b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.d.ts new file mode 100644 index 000000000..9c4b65fd0 --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.d.ts @@ -0,0 +1,128 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import chalk = require('chalk'); +import {DiffOptions as DiffOptions_2} from 'jest-diff'; + +export declare const BOLD_WEIGHT: chalk.Chalk; + +export declare const diff: ( + a: unknown, + b: unknown, + options?: DiffOptions_2 | undefined, +) => string | null; + +export declare type DiffOptions = DiffOptions_2; + +export declare const DIM_COLOR: chalk.Chalk; + +/** + * Ensures that `actual` is of type `number | bigint` + */ +export declare const ensureActualIsNumber: ( + actual: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +export declare const ensureExpectedIsNonNegativeInteger: ( + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +/** + * Ensures that `expected` is of type `number | bigint` + */ +export declare const ensureExpectedIsNumber: ( + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +export declare const ensureNoExpected: ( + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +/** + * Ensures that `actual` & `expected` are of type `number | bigint` + */ +export declare const ensureNumbers: ( + actual: unknown, + expected: unknown, + matcherName: string, + options?: MatcherHintOptions | undefined, +) => void; + +export declare const EXPECTED_COLOR: chalk.Chalk; + +export declare const getLabelPrinter: (...strings: Array) => PrintLabel; + +export declare const highlightTrailingWhitespace: (text: string) => string; + +export declare const INVERTED_COLOR: chalk.Chalk; + +export declare const matcherErrorMessage: ( + hint: string, + generic: string, + specific?: string | undefined, +) => string; + +export declare const matcherHint: ( + matcherName: string, + received?: string, + expected?: string, + options?: MatcherHintOptions, +) => string; + +declare type MatcherHintColor = (arg: string) => string; + +export declare type MatcherHintOptions = { + comment?: string; + expectedColor?: MatcherHintColor; + isDirectExpectCall?: boolean; + isNot?: boolean; + promise?: string; + receivedColor?: MatcherHintColor; + secondArgument?: string; + secondArgumentColor?: MatcherHintColor; +}; + +export declare const pluralize: (word: string, count: number) => string; + +export declare const printDiffOrStringify: ( + expected: unknown, + received: unknown, + expectedLabel: string, + receivedLabel: string, + expand: boolean, +) => string; + +export declare const printExpected: (value: unknown) => string; + +declare type PrintLabel = (string: string) => string; + +export declare const printReceived: (object: unknown) => string; + +export declare function printWithType( + name: string, + value: T, + print: (value: T) => string, +): string; + +export declare const RECEIVED_COLOR: chalk.Chalk; + +export declare const stringify: ( + object: unknown, + maxDepth?: number, + maxWidth?: number, +) => string; + +export declare const SUGGEST_TO_CONTAIN_EQUAL: string; + +export {}; diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.js b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.js new file mode 100644 index 000000000..fca426e3c --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.js @@ -0,0 +1,590 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printReceived = + exports.printExpected = + exports.printDiffOrStringify = + exports.pluralize = + exports.matcherHint = + exports.matcherErrorMessage = + exports.highlightTrailingWhitespace = + exports.getLabelPrinter = + exports.ensureNumbers = + exports.ensureNoExpected = + exports.ensureExpectedIsNumber = + exports.ensureExpectedIsNonNegativeInteger = + exports.ensureActualIsNumber = + exports.diff = + exports.SUGGEST_TO_CONTAIN_EQUAL = + exports.RECEIVED_COLOR = + exports.INVERTED_COLOR = + exports.EXPECTED_COLOR = + exports.DIM_COLOR = + exports.BOLD_WEIGHT = + void 0; +exports.printWithType = printWithType; +exports.stringify = void 0; + +var _chalk = _interopRequireDefault(require('chalk')); + +var _jestDiff = require('jest-diff'); + +var _jestGetType = require('jest-get-type'); + +var _prettyFormat = require('pretty-format'); + +var _Replaceable = _interopRequireDefault(require('./Replaceable')); + +var _deepCyclicCopyReplaceable = _interopRequireDefault( + require('./deepCyclicCopyReplaceable') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* eslint-disable local/ban-types-eventually */ +const { + AsymmetricMatcher, + DOMCollection, + DOMElement, + Immutable, + ReactElement, + ReactTestComponent +} = _prettyFormat.plugins; +const PLUGINS = [ + ReactTestComponent, + ReactElement, + DOMElement, + DOMCollection, + Immutable, + AsymmetricMatcher +]; +const EXPECTED_COLOR = _chalk.default.green; +exports.EXPECTED_COLOR = EXPECTED_COLOR; +const RECEIVED_COLOR = _chalk.default.red; +exports.RECEIVED_COLOR = RECEIVED_COLOR; +const INVERTED_COLOR = _chalk.default.inverse; +exports.INVERTED_COLOR = INVERTED_COLOR; +const BOLD_WEIGHT = _chalk.default.bold; +exports.BOLD_WEIGHT = BOLD_WEIGHT; +const DIM_COLOR = _chalk.default.dim; +exports.DIM_COLOR = DIM_COLOR; +const MULTILINE_REGEXP = /\n/; +const SPACE_SYMBOL = '\u{00B7}'; // middle dot + +const NUMBERS = [ + 'zero', + 'one', + 'two', + 'three', + 'four', + 'five', + 'six', + 'seven', + 'eight', + 'nine', + 'ten', + 'eleven', + 'twelve', + 'thirteen' +]; + +const SUGGEST_TO_CONTAIN_EQUAL = _chalk.default.dim( + 'Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.' +); + +exports.SUGGEST_TO_CONTAIN_EQUAL = SUGGEST_TO_CONTAIN_EQUAL; + +const stringify = (object, maxDepth = 10, maxWidth = 10) => { + const MAX_LENGTH = 10000; + let result; + + try { + result = (0, _prettyFormat.format)(object, { + maxDepth, + maxWidth, + min: true, + plugins: PLUGINS + }); + } catch { + result = (0, _prettyFormat.format)(object, { + callToJSON: false, + maxDepth, + maxWidth, + min: true, + plugins: PLUGINS + }); + } + + if (result.length >= MAX_LENGTH && maxDepth > 1) { + return stringify(object, Math.floor(maxDepth / 2), maxWidth); + } else if (result.length >= MAX_LENGTH && maxWidth > 1) { + return stringify(object, maxDepth, Math.floor(maxWidth / 2)); + } else { + return result; + } +}; + +exports.stringify = stringify; + +const highlightTrailingWhitespace = text => + text.replace(/\s+$/gm, _chalk.default.inverse('$&')); // Instead of inverse highlight which now implies a change, +// replace common spaces with middle dot at the end of any line. + +exports.highlightTrailingWhitespace = highlightTrailingWhitespace; + +const replaceTrailingSpaces = text => + text.replace(/\s+$/gm, spaces => SPACE_SYMBOL.repeat(spaces.length)); + +const printReceived = object => + RECEIVED_COLOR(replaceTrailingSpaces(stringify(object))); + +exports.printReceived = printReceived; + +const printExpected = value => + EXPECTED_COLOR(replaceTrailingSpaces(stringify(value))); + +exports.printExpected = printExpected; + +function printWithType(name, value, print) { + const type = (0, _jestGetType.getType)(value); + const hasType = + type !== 'null' && type !== 'undefined' + ? `${name} has type: ${type}\n` + : ''; + const hasValue = `${name} has value: ${print(value)}`; + return hasType + hasValue; +} + +const ensureNoExpected = (expected, matcherName, options) => { + if (typeof expected !== 'undefined') { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, '', options), // Because expected is omitted in hint above, + // expected is black instead of green in message below. + 'this matcher must not have an expected argument', + printWithType('Expected', expected, printExpected) + ) + ); + } +}; +/** + * Ensures that `actual` is of type `number | bigint` + */ + +exports.ensureNoExpected = ensureNoExpected; + +const ensureActualIsNumber = (actual, matcherName, options) => { + if (typeof actual !== 'number' && typeof actual !== 'bigint') { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, undefined, options), + `${RECEIVED_COLOR('received')} value must be a number or bigint`, + printWithType('Received', actual, printReceived) + ) + ); + } +}; +/** + * Ensures that `expected` is of type `number | bigint` + */ + +exports.ensureActualIsNumber = ensureActualIsNumber; + +const ensureExpectedIsNumber = (expected, matcherName, options) => { + if (typeof expected !== 'number' && typeof expected !== 'bigint') { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, undefined, options), + `${EXPECTED_COLOR('expected')} value must be a number or bigint`, + printWithType('Expected', expected, printExpected) + ) + ); + } +}; +/** + * Ensures that `actual` & `expected` are of type `number | bigint` + */ + +exports.ensureExpectedIsNumber = ensureExpectedIsNumber; + +const ensureNumbers = (actual, expected, matcherName, options) => { + ensureActualIsNumber(actual, matcherName, options); + ensureExpectedIsNumber(expected, matcherName, options); +}; + +exports.ensureNumbers = ensureNumbers; + +const ensureExpectedIsNonNegativeInteger = (expected, matcherName, options) => { + if ( + typeof expected !== 'number' || + !Number.isSafeInteger(expected) || + expected < 0 + ) { + // Prepend maybe not only for backward compatibility. + const matcherString = (options ? '' : '[.not]') + matcherName; + throw new Error( + matcherErrorMessage( + matcherHint(matcherString, undefined, undefined, options), + `${EXPECTED_COLOR('expected')} value must be a non-negative integer`, + printWithType('Expected', expected, printExpected) + ) + ); + } +}; // Given array of diffs, return concatenated string: +// * include common substrings +// * exclude change substrings which have opposite op +// * include change substrings which have argument op +// with inverse highlight only if there is a common substring + +exports.ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger; + +const getCommonAndChangedSubstrings = (diffs, op, hasCommonDiff) => + diffs.reduce( + (reduced, diff) => + reduced + + (diff[0] === _jestDiff.DIFF_EQUAL + ? diff[1] + : diff[0] !== op + ? '' + : hasCommonDiff + ? INVERTED_COLOR(diff[1]) + : diff[1]), + '' + ); + +const isLineDiffable = (expected, received) => { + const expectedType = (0, _jestGetType.getType)(expected); + const receivedType = (0, _jestGetType.getType)(received); + + if (expectedType !== receivedType) { + return false; + } + + if ((0, _jestGetType.isPrimitive)(expected)) { + // Print generic line diff for strings only: + // * if neither string is empty + // * if either string has more than one line + return ( + typeof expected === 'string' && + typeof received === 'string' && + expected.length !== 0 && + received.length !== 0 && + (MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received)) + ); + } + + if ( + expectedType === 'date' || + expectedType === 'function' || + expectedType === 'regexp' + ) { + return false; + } + + if (expected instanceof Error && received instanceof Error) { + return false; + } + + if ( + receivedType === 'object' && + typeof received.asymmetricMatch === 'function' + ) { + return false; + } + + return true; +}; + +const MAX_DIFF_STRING_LENGTH = 20000; + +const printDiffOrStringify = ( + expected, + received, + expectedLabel, + receivedLabel, + expand // CLI options: true if `--expand` or false if `--no-expand` +) => { + if ( + typeof expected === 'string' && + typeof received === 'string' && + expected.length !== 0 && + received.length !== 0 && + expected.length <= MAX_DIFF_STRING_LENGTH && + received.length <= MAX_DIFF_STRING_LENGTH && + expected !== received + ) { + if (expected.includes('\n') || received.includes('\n')) { + return (0, _jestDiff.diffStringsUnified)(expected, received, { + aAnnotation: expectedLabel, + bAnnotation: receivedLabel, + changeLineTrailingSpaceColor: _chalk.default.bgYellow, + commonLineTrailingSpaceColor: _chalk.default.bgYellow, + emptyFirstOrLastLinePlaceholder: '↵', + // U+21B5 + expand, + includeChangeCounts: true + }); + } + + const diffs = (0, _jestDiff.diffStringsRaw)(expected, received, true); + const hasCommonDiff = diffs.some(diff => diff[0] === _jestDiff.DIFF_EQUAL); + const printLabel = getLabelPrinter(expectedLabel, receivedLabel); + const expectedLine = + printLabel(expectedLabel) + + printExpected( + getCommonAndChangedSubstrings( + diffs, + _jestDiff.DIFF_DELETE, + hasCommonDiff + ) + ); + const receivedLine = + printLabel(receivedLabel) + + printReceived( + getCommonAndChangedSubstrings( + diffs, + _jestDiff.DIFF_INSERT, + hasCommonDiff + ) + ); + return `${expectedLine}\n${receivedLine}`; + } + + if (isLineDiffable(expected, received)) { + const {replacedExpected, replacedReceived} = + replaceMatchedToAsymmetricMatcher( + (0, _deepCyclicCopyReplaceable.default)(expected), + (0, _deepCyclicCopyReplaceable.default)(received), + [], + [] + ); + const difference = (0, _jestDiff.diff)(replacedExpected, replacedReceived, { + aAnnotation: expectedLabel, + bAnnotation: receivedLabel, + expand, + includeChangeCounts: true + }); + + if ( + typeof difference === 'string' && + difference.includes(`- ${expectedLabel}`) && + difference.includes(`+ ${receivedLabel}`) + ) { + return difference; + } + } + + const printLabel = getLabelPrinter(expectedLabel, receivedLabel); + const expectedLine = printLabel(expectedLabel) + printExpected(expected); + const receivedLine = + printLabel(receivedLabel) + + (stringify(expected) === stringify(received) + ? 'serializes to the same string' + : printReceived(received)); + return `${expectedLine}\n${receivedLine}`; +}; // Sometimes, e.g. when comparing two numbers, the output from jest-diff +// does not contain more information than the `Expected:` / `Received:` already gives. +// In those cases, we do not print a diff to make the output shorter and not redundant. + +exports.printDiffOrStringify = printDiffOrStringify; + +const shouldPrintDiff = (actual, expected) => { + if (typeof actual === 'number' && typeof expected === 'number') { + return false; + } + + if (typeof actual === 'bigint' && typeof expected === 'bigint') { + return false; + } + + if (typeof actual === 'boolean' && typeof expected === 'boolean') { + return false; + } + + return true; +}; + +function replaceMatchedToAsymmetricMatcher( + replacedExpected, + replacedReceived, + expectedCycles, + receivedCycles +) { + if (!_Replaceable.default.isReplaceable(replacedExpected, replacedReceived)) { + return { + replacedExpected, + replacedReceived + }; + } + + if ( + expectedCycles.includes(replacedExpected) || + receivedCycles.includes(replacedReceived) + ) { + return { + replacedExpected, + replacedReceived + }; + } + + expectedCycles.push(replacedExpected); + receivedCycles.push(replacedReceived); + const expectedReplaceable = new _Replaceable.default(replacedExpected); + const receivedReplaceable = new _Replaceable.default(replacedReceived); + expectedReplaceable.forEach((expectedValue, key) => { + const receivedValue = receivedReplaceable.get(key); + + if (isAsymmetricMatcher(expectedValue)) { + if (expectedValue.asymmetricMatch(receivedValue)) { + receivedReplaceable.set(key, expectedValue); + } + } else if (isAsymmetricMatcher(receivedValue)) { + if (receivedValue.asymmetricMatch(expectedValue)) { + expectedReplaceable.set(key, receivedValue); + } + } else if ( + _Replaceable.default.isReplaceable(expectedValue, receivedValue) + ) { + const replaced = replaceMatchedToAsymmetricMatcher( + expectedValue, + receivedValue, + expectedCycles, + receivedCycles + ); + expectedReplaceable.set(key, replaced.replacedExpected); + receivedReplaceable.set(key, replaced.replacedReceived); + } + }); + return { + replacedExpected: expectedReplaceable.object, + replacedReceived: receivedReplaceable.object + }; +} + +function isAsymmetricMatcher(data) { + const type = (0, _jestGetType.getType)(data); + return type === 'object' && typeof data.asymmetricMatch === 'function'; +} + +const diff = (a, b, options) => + shouldPrintDiff(a, b) ? (0, _jestDiff.diff)(a, b, options) : null; + +exports.diff = diff; + +const pluralize = (word, count) => + `${NUMBERS[count] || count} ${word}${count === 1 ? '' : 's'}`; // To display lines of labeled values as two columns with monospace alignment: +// given the strings which will describe the values, +// return function which given each string, returns the label: +// string, colon, space, and enough padding spaces to align the value. + +exports.pluralize = pluralize; + +const getLabelPrinter = (...strings) => { + const maxLength = strings.reduce( + (max, string) => (string.length > max ? string.length : max), + 0 + ); + return string => `${string}: ${' '.repeat(maxLength - string.length)}`; +}; + +exports.getLabelPrinter = getLabelPrinter; + +const matcherErrorMessage = ( + hint, + generic, + specific // incorrect value returned from call to printWithType +) => + `${hint}\n\n${_chalk.default.bold('Matcher error')}: ${generic}${ + typeof specific === 'string' ? `\n\n${specific}` : '' + }`; // Display assertion for the report when a test fails. +// New format: rejects/resolves, not, and matcher name have black color +// Old format: matcher name has dim color + +exports.matcherErrorMessage = matcherErrorMessage; + +const matcherHint = ( + matcherName, + received = 'received', + expected = 'expected', + options = {} +) => { + const { + comment = '', + expectedColor = EXPECTED_COLOR, + isDirectExpectCall = false, + // seems redundant with received === '' + isNot = false, + promise = '', + receivedColor = RECEIVED_COLOR, + secondArgument = '', + secondArgumentColor = EXPECTED_COLOR + } = options; + let hint = ''; + let dimString = 'expect'; // concatenate adjacent dim substrings + + if (!isDirectExpectCall && received !== '') { + hint += DIM_COLOR(`${dimString}(`) + receivedColor(received); + dimString = ')'; + } + + if (promise !== '') { + hint += DIM_COLOR(`${dimString}.`) + promise; + dimString = ''; + } + + if (isNot) { + hint += `${DIM_COLOR(`${dimString}.`)}not`; + dimString = ''; + } + + if (matcherName.includes('.')) { + // Old format: for backward compatibility, + // especially without promise or isNot options + dimString += matcherName; + } else { + // New format: omit period from matcherName arg + hint += DIM_COLOR(`${dimString}.`) + matcherName; + dimString = ''; + } + + if (expected === '') { + dimString += '()'; + } else { + hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected); + + if (secondArgument) { + hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument); + } + + dimString = ')'; + } + + if (comment !== '') { + dimString += ` // ${comment}`; + } + + if (dimString !== '') { + hint += DIM_COLOR(dimString); + } + + return hint; +}; + +exports.matcherHint = matcherHint; diff --git a/node_modules/jest-circus/node_modules/jest-matcher-utils/package.json b/node_modules/jest-circus/node_modules/jest-matcher-utils/package.json new file mode 100644 index 000000000..b05c8da1f --- /dev/null +++ b/node_modules/jest-circus/node_modules/jest-matcher-utils/package.json @@ -0,0 +1,37 @@ +{ + "name": "jest-matcher-utils", + "description": "A set of utility functions for expect and related packages", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-matcher-utils" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.0.1", + "jest-get-type": "^28.0.0", + "pretty-format": "^28.0.1" + }, + "devDependencies": { + "@jest/test-utils": "^28.0.1", + "@types/node": "*" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/jest-circus/node_modules/jest-util/build/ErrorWithStack.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/ErrorWithStack.d.ts deleted file mode 100644 index 30a8dd313..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/ErrorWithStack.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default class ErrorWithStack extends Error { - constructor(message: string | undefined, callsite: (...args: Array) => unknown, stackLimit?: number); -} diff --git a/node_modules/jest-circus/node_modules/jest-util/build/clearLine.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/clearLine.d.ts deleted file mode 100644 index cf56b982c..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/clearLine.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function clearLine(stream: NodeJS.WriteStream): void; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.d.ts deleted file mode 100644 index 4d406660b..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function convertDescriptorToString(descriptor: T): T | string; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.js b/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.js index 4b776af57..a2b7066cf 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.js +++ b/node_modules/jest-circus/node_modules/jest-util/build/convertDescriptorToString.js @@ -11,31 +11,24 @@ exports.default = convertDescriptorToString; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - -/* eslint-disable local/ban-types-eventually */ -// See: https://github.com/facebook/jest/pull/5154 function convertDescriptorToString(descriptor) { - if ( - typeof descriptor === 'string' || - typeof descriptor === 'number' || - descriptor === undefined - ) { - return descriptor; - } + switch (typeof descriptor) { + case 'function': + if (descriptor.name) { + return descriptor.name; + } - if (typeof descriptor !== 'function') { - throw new Error('describe expects a class, function, number, or string.'); - } + break; - if (descriptor.name !== undefined) { - return descriptor.name; - } // Fallback for old browsers, pardon Flow + case 'number': + case 'undefined': + return `${descriptor}`; + + case 'string': + return descriptor; + } - const stringified = descriptor.toString(); - const typeDescriptorMatch = stringified.match(/class|function/); - const indexOfNameSpace = // @ts-expect-error: typeDescriptorMatch exists - typeDescriptorMatch.index + typeDescriptorMatch[0].length; - const indexOfNameAfterSpace = stringified.search(/\(|\{/); - const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace); - return name.trim(); + throw new Error( + `Invalid first argument, ${descriptor}. It must be a named class, named function, number, or string.` + ); } diff --git a/node_modules/jest-circus/node_modules/jest-util/build/createDirectory.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/createDirectory.d.ts deleted file mode 100644 index 7e3e01625..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/createDirectory.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function createDirectory(path: Config.Path): void; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.d.ts deleted file mode 100644 index 29e0db5f4..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export default function createProcessObject(): NodeJS.Process; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.js b/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.js index afc48948c..ec35a42ad 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.js +++ b/node_modules/jest-circus/node_modules/jest-util/build/createProcessObject.js @@ -30,7 +30,7 @@ function createProcessEnv() { function deletePropertyWin32(_target, key) { for (const name in real) { - if (real.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(real, name)) { if (typeof key === 'string') { if (name.toLowerCase() === key.toLowerCase()) { delete real[name]; @@ -71,7 +71,7 @@ function createProcessEnv() { get: isWin32 ? getPropertyWin32 : getProperty, set(_target, key, value) { - const strValue = '' + value; + const strValue = `${value}`; if (typeof key === 'string') { lookup[key.toLowerCase()] = strValue; @@ -98,9 +98,7 @@ function createProcessObject() { } catch (e) { // Make sure it's actually set instead of potentially ignoring errors if (newProcess[Symbol.toStringTag] !== 'process') { - e.message = - 'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' + - e.message; + e.message = `Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n${e.message}`; throw e; } } // Sequentially execute all constructors over the object. diff --git a/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.d.ts deleted file mode 100644 index f8bd716c5..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare type DeepCyclicCopyOptions = { - blacklist?: Set; - keepPrototype?: boolean; -}; -export default function deepCyclicCopy(value: T, options?: DeepCyclicCopyOptions, cycles?: WeakMap): T; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.js b/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.js index e76e34bf2..7a81dbc1e 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.js +++ b/node_modules/jest-circus/node_modules/jest-util/build/deepCyclicCopy.js @@ -21,7 +21,7 @@ function deepCyclicCopy( }, cycles = new WeakMap() ) { - if (typeof value !== 'object' || value === null) { + if (typeof value !== 'object' || value === null || Buffer.isBuffer(value)) { return value; } else if (cycles.has(value)) { return cycles.get(value); diff --git a/node_modules/jest-circus/node_modules/jest-util/build/formatTime.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/formatTime.d.ts deleted file mode 100644 index fc4cd8d75..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/formatTime.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function formatTime(time: number, prefixPower?: number, padLeftLength?: number): string; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/globsToMatcher.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/globsToMatcher.d.ts deleted file mode 100644 index 021ff9e28..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/globsToMatcher.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -declare type Matcher = (str: Config.Path) => boolean; -/** - * Converts a list of globs into a function that matches a path against the - * globs. - * - * Every time picomatch is called, it will parse the glob strings and turn - * them into regexp instances. Instead of calling picomatch repeatedly with - * the same globs, we can use this function which will build the picomatch - * matchers ahead of time and then have an optimized path for determining - * whether an individual path matches. - * - * This function is intended to match the behavior of `micromatch()`. - * - * @example - * const isMatch = globsToMatcher(['*.js', '!*.test.js']); - * isMatch('pizza.js'); // true - * isMatch('pizza.test.js'); // false - */ -export default function globsToMatcher(globs: Array): Matcher; -export {}; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/index.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/index.d.ts index 118162ebe..3b55159b4 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/index.d.ts +++ b/node_modules/jest-circus/node_modules/jest-util/build/index.d.ts @@ -4,22 +4,122 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -export { default as clearLine } from './clearLine'; -export { default as createDirectory } from './createDirectory'; -export { default as ErrorWithStack } from './ErrorWithStack'; -export { default as installCommonGlobals } from './installCommonGlobals'; -export { default as interopRequireDefault } from './interopRequireDefault'; -export { default as isInteractive } from './isInteractive'; -export { default as isPromise } from './isPromise'; -export { default as setGlobal } from './setGlobal'; -export { default as deepCyclicCopy } from './deepCyclicCopy'; -export { default as convertDescriptorToString } from './convertDescriptorToString'; -export * as specialChars from './specialChars'; -export { default as replacePathSepForGlob } from './replacePathSepForGlob'; -export { default as testPathPatternToRegExp } from './testPathPatternToRegExp'; -export { default as globsToMatcher } from './globsToMatcher'; -export * as preRunMessage from './preRunMessage'; -export { default as pluralize } from './pluralize'; -export { default as formatTime } from './formatTime'; -export { default as tryRealpath } from './tryRealpath'; -export { default as requireOrImportModule } from './requireOrImportModule'; +/// + +import type {Config} from '@jest/types'; +import type {Global} from '@jest/types'; + +declare const ARROW = ' \u203A '; + +declare const CLEAR: string; + +export declare function clearLine(stream: NodeJS.WriteStream): void; + +export declare function convertDescriptorToString( + descriptor: Global.BlockNameLike | undefined, +): string; + +export declare function createDirectory(path: string): void; + +export declare function deepCyclicCopy( + value: T, + options?: DeepCyclicCopyOptions, + cycles?: WeakMap, +): T; + +declare type DeepCyclicCopyOptions = { + blacklist?: Set; + keepPrototype?: boolean; +}; + +export declare class ErrorWithStack extends Error { + constructor( + message: string | undefined, + callsite: (...args: Array) => unknown, + stackLimit?: number, + ); +} + +export declare function formatTime( + time: number, + prefixPower?: number, + padLeftLength?: number, +): string; + +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ +export declare function globsToMatcher(globs: Array): Matcher; + +declare const ICONS: { + failed: string; + pending: string; + success: string; + todo: string; +}; + +export declare function installCommonGlobals( + globalObject: typeof globalThis, + globals: Config.ConfigGlobals, +): typeof globalThis & Config.ConfigGlobals; + +export declare function interopRequireDefault(obj: any): any; + +export declare const isInteractive: boolean; + +export declare const isPromise: ( + candidate: unknown, +) => candidate is Promise; + +declare type Matcher = (str: string) => boolean; + +export declare function pluralize(word: string, count: number): string; + +declare namespace preRunMessage { + export {print_2 as print, remove}; +} +export {preRunMessage}; + +declare const print_2: (stream: NodeJS.WriteStream) => void; + +declare const remove: (stream: NodeJS.WriteStream) => void; + +export declare function replacePathSepForGlob(path: string): string; + +export declare function requireOrImportModule( + filePath: string, + applyInteropRequireDefault?: boolean, +): Promise; + +export declare function setGlobal( + globalToMutate: typeof globalThis | Global.Global, + key: string, + value: unknown, +): void; + +declare namespace specialChars { + export {ARROW, ICONS, CLEAR}; +} +export {specialChars}; + +export declare function testPathPatternToRegExp( + testPathPattern: Config.GlobalConfig['testPathPattern'], +): RegExp; + +export declare function tryRealpath(path: string): string; + +export {}; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/index.js b/node_modules/jest-circus/node_modules/jest-util/build/index.js index 64b076e90..f23c93aba 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/index.js +++ b/node_modules/jest-circus/node_modules/jest-util/build/index.js @@ -108,6 +108,14 @@ Object.defineProperty(exports, 'tryRealpath', { } }); +var preRunMessage = _interopRequireWildcard(require('./preRunMessage')); + +exports.preRunMessage = preRunMessage; + +var specialChars = _interopRequireWildcard(require('./specialChars')); + +exports.specialChars = specialChars; + var _clearLine = _interopRequireDefault2(require('./clearLine')); var _createDirectory = _interopRequireDefault2(require('./createDirectory')); @@ -134,10 +142,6 @@ var _convertDescriptorToString = _interopRequireDefault2( require('./convertDescriptorToString') ); -var _specialChars = _interopRequireWildcard(require('./specialChars')); - -exports.specialChars = _specialChars; - var _replacePathSepForGlob = _interopRequireDefault2( require('./replacePathSepForGlob') ); @@ -148,10 +152,6 @@ var _testPathPatternToRegExp = _interopRequireDefault2( var _globsToMatcher = _interopRequireDefault2(require('./globsToMatcher')); -var _preRunMessage = _interopRequireWildcard(require('./preRunMessage')); - -exports.preRunMessage = _preRunMessage; - var _pluralize = _interopRequireDefault2(require('./pluralize')); var _formatTime = _interopRequireDefault2(require('./formatTime')); @@ -162,6 +162,10 @@ var _requireOrImportModule = _interopRequireDefault2( require('./requireOrImportModule') ); +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== 'function') return null; var cacheBabelInterop = new WeakMap(); @@ -203,7 +207,3 @@ function _interopRequireWildcard(obj, nodeInterop) { } return newObj; } - -function _interopRequireDefault2(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.d.ts deleted file mode 100644 index c93689efa..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function installCommonGlobals(globalObject: typeof globalThis, globals: Config.ConfigGlobals): typeof globalThis & Config.ConfigGlobals; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.js b/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.js index 509ceee1a..6435f75d2 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.js +++ b/node_modules/jest-circus/node_modules/jest-util/build/installCommonGlobals.js @@ -73,7 +73,7 @@ function _interopRequireWildcard(obj, nodeInterop) { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -const DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE')); +const DTRACE = Object.keys(globalThis).filter(key => key.startsWith('DTRACE')); function installCommonGlobals(globalObject, globals) { globalObject.process = (0, _createProcessObject.default)(); @@ -116,7 +116,7 @@ function installCommonGlobals(globalObject, globals) { // @ts-expect-error: no index globalObject[dtrace] = function (...args) { // @ts-expect-error: no index - return global[dtrace].apply(this, args); + return globalThis[dtrace].apply(this, args); }; }); return Object.assign(globalObject, (0, _deepCyclicCopy.default)(globals)); diff --git a/node_modules/jest-circus/node_modules/jest-util/build/interopRequireDefault.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/interopRequireDefault.d.ts deleted file mode 100644 index 91b66e4fc..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/interopRequireDefault.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function interopRequireDefault(obj: any): any; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/isInteractive.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/isInteractive.d.ts deleted file mode 100644 index 57ddbf0a7..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/isInteractive.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const _default: boolean; -export default _default; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/isPromise.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/isPromise.d.ts deleted file mode 100644 index ea8589b90..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/isPromise.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -declare const isPromise: (candidate: unknown) => candidate is Promise; -export default isPromise; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/isPromise.js b/node_modules/jest-circus/node_modules/jest-util/build/isPromise.js index 7158df850..5a7202064 100644 --- a/node_modules/jest-circus/node_modules/jest-util/build/isPromise.js +++ b/node_modules/jest-circus/node_modules/jest-util/build/isPromise.js @@ -11,8 +11,8 @@ exports.default = void 0; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// capture global.Promise before it may potentially be overwritten -const Promise = global.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 +// capture globalThis.Promise before it may potentially be overwritten +const Promise = globalThis.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 const isPromise = candidate => Promise.resolve(candidate) === candidate; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/pluralize.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/pluralize.d.ts deleted file mode 100644 index 9be305792..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/pluralize.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function pluralize(word: string, count: number): string; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/preRunMessage.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/preRunMessage.d.ts deleted file mode 100644 index 55acad973..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/preRunMessage.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// -export declare const print: (stream: NodeJS.WriteStream) => void; -export declare const remove: (stream: NodeJS.WriteStream) => void; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/replacePathSepForGlob.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/replacePathSepForGlob.d.ts deleted file mode 100644 index 7f47d18bf..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/replacePathSepForGlob.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function replacePathSepForGlob(path: Config.Path): Config.Glob; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/requireOrImportModule.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/requireOrImportModule.d.ts deleted file mode 100644 index b27bd9477..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/requireOrImportModule.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function requireOrImportModule(filePath: Config.Path, applyInteropRequireDefault?: boolean): Promise; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/setGlobal.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/setGlobal.d.ts deleted file mode 100644 index 94e0e7642..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/setGlobal.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export default function setGlobal(globalToMutate: typeof globalThis, key: string, value: unknown): void; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/specialChars.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/specialChars.d.ts deleted file mode 100644 index 1a50d4954..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/specialChars.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare const ARROW = " \u203A "; -export declare const ICONS: { - failed: string; - pending: string; - success: string; - todo: string; -}; -export declare const CLEAR: string; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/testPathPatternToRegExp.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/testPathPatternToRegExp.d.ts deleted file mode 100644 index 115aadfaa..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/testPathPatternToRegExp.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function testPathPatternToRegExp(testPathPattern: Config.GlobalConfig['testPathPattern']): RegExp; diff --git a/node_modules/jest-circus/node_modules/jest-util/build/tryRealpath.d.ts b/node_modules/jest-circus/node_modules/jest-util/build/tryRealpath.d.ts deleted file mode 100644 index cccdfa0e5..000000000 --- a/node_modules/jest-circus/node_modules/jest-util/build/tryRealpath.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Config } from '@jest/types'; -export default function tryRealpath(path: Config.Path): Config.Path; diff --git a/node_modules/jest-circus/node_modules/jest-util/package.json b/node_modules/jest-circus/node_modules/jest-util/package.json index f1b9788a3..1bd8f7d17 100644 --- a/node_modules/jest-circus/node_modules/jest-util/package.json +++ b/node_modules/jest-circus/node_modules/jest-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-util", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -17,7 +17,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -25,15 +25,14 @@ "picomatch": "^2.2.3" }, "devDependencies": { - "@types/graceful-fs": "^4.1.2", - "@types/micromatch": "^4.0.1", + "@types/graceful-fs": "^4.1.3", "@types/picomatch": "^2.2.2" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/jest-circus/node_modules/picomatch/CHANGELOG.md b/node_modules/jest-circus/node_modules/picomatch/CHANGELOG.md deleted file mode 100644 index 8ccc6c1ba..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ -# Release history - -**All notable changes to this project will be documented in this file.** - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## 2.3.1 (2022-01-02) - -### Fixed - -* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). - -### Changed - -* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). - -## 2.3.0 (2021-05-21) - -### Fixed - -* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) - -## 2.2.3 (2021-04-10) - -### Fixed - -* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). -* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). - -## 2.2.2 (2020-03-21) - -### Fixed - -* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). - -## 2.2.1 (2020-01-04) - -* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. - -## 2.2.0 (2020-01-04) - -* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) -* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. - -## 2.1.0 (2019-10-31) - -* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) -* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) -* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) -* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) -* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) -* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) -* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) -* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) -* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) -* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) -* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) -* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) -* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) -* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) -* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) -* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) -* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) -* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) -* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) -* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) -* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) -* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) - -## 2.0.7 (2019-05-14) - -* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) -* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) -* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) -* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) - -## 2.0.4 (2019-04-10) - -### Fixed - -- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. -- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. - -## 2.0.0 (2019-04-10) - -### Added - -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - -### Breaking changes - -- The unixify option was renamed to `windows` -- caching and all related options and methods have been removed - -## 1.0.0 (2018-11-05) - -- adds `.onMatch` option -- improvements to `.scan` method -- numerous improvements and optimizations for matching and parsing -- better windows path handling - -## 0.1.0 - 2017-04-13 - -First release. - - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/jest-circus/node_modules/picomatch/LICENSE b/node_modules/jest-circus/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca25..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/picomatch/README.md b/node_modules/jest-circus/node_modules/picomatch/README.md deleted file mode 100644 index b0526e28a..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/README.md +++ /dev/null @@ -1,708 +0,0 @@ -

Picomatch

- -

- -version - - -test status - - -coverage status - - -downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.makeRe](#makere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L32) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.test](lib/picomatch.js#L117) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L161) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L183) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L199) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L231) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L245) - -Compile a regular expression from the `state` object returned by the -[parse()](#parse) method. - -**Params** - -* `state` **{Object}** -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. -* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. -* `returns` **{RegExp}** - -### [.makeRe](lib/picomatch.js#L286) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. -* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L321) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | - -picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[] - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -``` -# .makeRe star - picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) - minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) - -# .makeRe star; dot=true - picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) - minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) - -# .makeRe globstar - picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) - minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) - -# .makeRe globstars - picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) - minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) - -# .makeRe with leading star - picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) - minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) - -# .makeRe - basic braces - picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) - minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/node_modules/jest-circus/node_modules/picomatch/index.js b/node_modules/jest-circus/node_modules/picomatch/index.js deleted file mode 100644 index d2f2bc59d..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/node_modules/jest-circus/node_modules/picomatch/lib/constants.js b/node_modules/jest-circus/node_modules/picomatch/lib/constants.js deleted file mode 100644 index a62ef3879..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; - -const path = require('path'); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/node_modules/jest-circus/node_modules/picomatch/lib/parse.js b/node_modules/jest-circus/node_modules/picomatch/lib/parse.js deleted file mode 100644 index 58269d018..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1091 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. - // In this case, we need to parse the string and use it in the output of the original pattern. - // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. - // - // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. - const expression = parse(rest, { ...options, fastpaths: false }).output; - - output = token.close = `)${expression})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/node_modules/jest-circus/node_modules/picomatch/lib/picomatch.js b/node_modules/jest-circus/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index 782d80943..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,342 +0,0 @@ -'use strict'; - -const path = require('path'); -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse(input, options); - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/node_modules/jest-circus/node_modules/picomatch/lib/scan.js b/node_modules/jest-circus/node_modules/picomatch/lib/scan.js deleted file mode 100644 index e59cd7a13..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/node_modules/jest-circus/node_modules/picomatch/lib/utils.js b/node_modules/jest-circus/node_modules/picomatch/lib/utils.js deleted file mode 100644 index c3ca766a7..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const path = require('path'); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; diff --git a/node_modules/jest-circus/node_modules/picomatch/package.json b/node_modules/jest-circus/node_modules/picomatch/package.json deleted file mode 100644 index 3db22d408..000000000 --- a/node_modules/jest-circus/node_modules/picomatch/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "2.3.1", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^6.8.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/node_modules/jest-circus/node_modules/pretty-format/LICENSE b/node_modules/jest-circus/node_modules/pretty-format/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/pretty-format/README.md b/node_modules/jest-circus/node_modules/pretty-format/README.md new file mode 100755 index 000000000..55dca1a88 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/README.md @@ -0,0 +1,463 @@ +# pretty-format + +Stringify any JavaScript value. + +- Serialize built-in JavaScript types. +- Serialize application-specific data types with built-in or user-defined plugins. + +## Installation + +```sh +$ yarn add pretty-format +``` + +## Usage + +```js +const {format: prettyFormat} = require('pretty-format'); // CommonJS +``` + +```js +import {format as prettyFormat} from 'pretty-format'; // ES2015 modules +``` + +```js +const val = {object: {}}; +val.circularReference = val; +val[Symbol('foo')] = 'foo'; +val.map = new Map([['prop', 'value']]); +val.array = [-0, Infinity, NaN]; + +console.log(prettyFormat(val)); +/* +Object { + "array": Array [ + -0, + Infinity, + NaN, + ], + "circularReference": [Circular], + "map": Map { + "prop" => "value", + }, + "object": Object {}, + Symbol(foo): "foo", +} +*/ +``` + +## Usage with options + +```js +function onClick() {} + +console.log(prettyFormat(onClick)); +/* +[Function onClick] +*/ + +const options = { + printFunctionName: false, +}; +console.log(prettyFormat(onClick, options)); +/* +[Function] +*/ +``` + + +| key | type | default | description | +| :-------------------- | :-------- | :--------- | :------------------------------------------------------ | +| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects | +| `compareKeys` | `function`| `undefined`| compare function used when sorting object keys | +| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions | +| `escapeString` | `boolean` | `true` | escape special characters in strings | +| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) | +| `indent` | `number` | `2` | spaces in each level of indentation | +| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on | +| `maxWidth` | `number` | `Infinity` | number of elements to print in arrays, sets, and so on | +| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks | +| `plugins` | `array` | `[]` | plugins to serialize application-specific data types | +| `printBasicPrototype` | `boolean` | `false` | print the prototype for plain objects and arrays | +| `printFunctionName` | `boolean` | `true` | include or omit the name of a function | +| `theme` | `object` | | colors to highlight syntax in terminal | + +Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors) + +```js +const DEFAULT_THEME = { + comment: 'gray', + content: 'reset', + prop: 'yellow', + tag: 'cyan', + value: 'green', +}; +``` + +## Usage with plugins + +The `pretty-format` package provides some built-in plugins, including: + +- `ReactElement` for elements from `react` +- `ReactTestComponent` for test objects from `react-test-renderer` + +```js +// CommonJS +const React = require('react'); +const renderer = require('react-test-renderer'); +const {format: prettyFormat, plugins} = require('pretty-format'); + +const {ReactElement, ReactTestComponent} = plugins; +``` + +```js +// ES2015 modules and destructuring assignment +import React from 'react'; +import renderer from 'react-test-renderer'; +import {plugins, format as prettyFormat} from 'pretty-format'; + +const {ReactElement, ReactTestComponent} = plugins; +``` + +```js +const onClick = () => {}; +const element = React.createElement('button', {onClick}, 'Hello World'); + +const formatted1 = prettyFormat(element, { + plugins: [ReactElement], + printFunctionName: false, +}); +const formatted2 = prettyFormat(renderer.create(element).toJSON(), { + plugins: [ReactTestComponent], + printFunctionName: false, +}); +/* + +*/ +``` + +## Usage in Jest + +For snapshot tests, Jest uses `pretty-format` with options that include some of its built-in plugins. For this purpose, plugins are also known as **snapshot serializers**. + +To serialize application-specific data types, you can add modules to `devDependencies` of a project, and then: + +In an **individual** test file, you can add a module as follows. It precedes any modules from Jest configuration. + +```js +import serializer from 'my-serializer-module'; +expect.addSnapshotSerializer(serializer); + +// tests which have `expect(value).toMatchSnapshot()` assertions +``` + +For **all** test files, you can specify modules in Jest configuration. They precede built-in plugins for React, HTML, and Immutable.js data types. For example, in a `package.json` file: + +```json +{ + "jest": { + "snapshotSerializers": ["my-serializer-module"] + } +} +``` + +## Writing plugins + +A plugin is a JavaScript object. + +If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either: + +- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later) +- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method) + +### test + +Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors: + +- `TypeError: Cannot read property 'whatever' of null` +- `TypeError: Cannot read property 'whatever' of undefined` + +For example, `test` method of built-in `ReactElement` plugin: + +```js +const elementSymbol = Symbol.for('react.element'); +const test = val => val && val.$$typeof === elementSymbol; +``` + +Pay attention to efficiency in `test` because `pretty-format` calls it often. + +### serialize + +The **improved** interface is available in **version 21** or later. + +Write `serialize` to return a string, given the arguments: + +- `val` which “passed the test” +- unchanging `config` object: derived from `options` +- current `indentation` string: concatenate to `indent` from `config` +- current `depth` number: compare to `maxDepth` from `config` +- current `refs` array: find circular references in objects +- `printer` callback function: serialize children + +### config + + +| key | type | description | +| :------------------ | :-------- | :------------------------------------------------------ | +| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects | +| `compareKeys` | `function`| compare function used when sorting object keys | +| `colors` | `Object` | escape codes for colors to highlight syntax | +| `escapeRegex` | `boolean` | escape special characters in regular expressions | +| `escapeString` | `boolean` | escape special characters in strings | +| `indent` | `string` | spaces in each level of indentation | +| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on | +| `min` | `boolean` | minimize added space: no indentation nor line breaks | +| `plugins` | `array` | plugins to serialize application-specific data types | +| `printFunctionName` | `boolean` | include or omit the name of a function | +| `spacingInner` | `string` | spacing to separate items in a list | +| `spacingOuter` | `string` | spacing to enclose a list of items | + +Each property of `colors` in `config` corresponds to a property of `theme` in `options`: + +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) + +Some properties in `config` are derived from `min` in `options`: + +- `spacingInner` and `spacingOuter` are **newline** if `min` is `false` +- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true` + +### Example of serialize and test + +This plugin is a pattern you can apply to serialize composite data types. Side note: `pretty-format` does not need a plugin to serialize arrays. + +```js +// We reused more code when we factored out a function for child items +// that is independent of depth, name, and enclosing punctuation (see below). +const SEPARATOR = ','; +function serializeItems(items, config, indentation, depth, refs, printer) { + if (items.length === 0) { + return ''; + } + const indentationItems = indentation + config.indent; + return ( + config.spacingOuter + + items + .map( + item => + indentationItems + + printer(item, config, indentationItems, depth, refs), // callback + ) + .join(SEPARATOR + config.spacingInner) + + (config.min ? '' : SEPARATOR) + // following the last item + config.spacingOuter + + indentation + ); +} + +const plugin = { + test(val) { + return Array.isArray(val); + }, + serialize(array, config, indentation, depth, refs, printer) { + const name = array.constructor.name; + return ++depth > config.maxDepth + ? `[${name}]` + : `${config.min ? '' : `${name} `}[${serializeItems( + array, + config, + indentation, + depth, + refs, + printer, + )}]`; + }, +}; +``` + +```js +const val = { + filter: 'completed', + items: [ + { + text: 'Write test', + completed: true, + }, + { + text: 'Write serialize', + completed: true, + }, + ], +}; +``` + +```js +console.log( + prettyFormat(val, { + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": Array [ + Object { + "completed": true, + "text": "Write test", + }, + Object { + "completed": true, + "text": "Write serialize", + }, + ], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + indent: 4, + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": Array [ + Object { + "completed": true, + "text": "Write test", + }, + Object { + "completed": true, + "text": "Write serialize", + }, + ], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + maxDepth: 1, + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": [Array], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + min: true, + plugins: [plugin], + }), +); +/* +{"filter": "completed", "items": [{"completed": true, "text": "Write test"}, {"completed": true, "text": "Write serialize"}]} +*/ +``` + +### print + +The **original** interface is adequate for plugins: + +- that **do not** depend on options other than `highlight` or `min` +- that **do not** depend on `depth` or `refs` in recursive traversal, and +- if values either + - do **not** require indentation, or + - do **not** occur as children of JavaScript data structures (for example, array) + +Write `print` to return a string, given the arguments: + +- `val` which “passed the test” +- current `printer(valChild)` callback function: serialize children +- current `indenter(lines)` callback function: indent lines at the next level +- unchanging `config` object: derived from `options` +- unchanging `colors` object: derived from `options` + +The 3 properties of `config` are `min` in `options` and: + +- `spacing` and `edgeSpacing` are **newline** if `min` is `false` +- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true` + +Each property of `colors` corresponds to a property of `theme` in `options`: + +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) + +### Example of print and test + +This plugin prints functions with the **number of named arguments** excluding rest argument. + +```js +const plugin = { + print(val) { + return `[Function ${val.name || 'anonymous'} ${val.length}]`; + }, + test(val) { + return typeof val === 'function'; + }, +}; +``` + +```js +const val = { + onClick(event) {}, + render() {}, +}; + +prettyFormat(val, { + plugins: [plugin], +}); +/* +Object { + "onClick": [Function onClick 1], + "render": [Function render 0], +} +*/ + +prettyFormat(val); +/* +Object { + "onClick": [Function onClick], + "render": [Function render], +} +*/ +``` + +This plugin **ignores** the `printFunctionName` option. That limitation of the original `print` interface is a reason to use the improved `serialize` interface, described above. + +```js +prettyFormat(val, { + plugins: [pluginOld], + printFunctionName: false, +}); +/* +Object { + "onClick": [Function onClick 1], + "render": [Function render 0], +} +*/ + +prettyFormat(val, { + printFunctionName: false, +}); +/* +Object { + "onClick": [Function], + "render": [Function], +} +*/ +``` diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/collections.js b/node_modules/jest-circus/node_modules/pretty-format/build/collections.js new file mode 100644 index 000000000..3af756b94 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/collections.js @@ -0,0 +1,206 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printIteratorEntries = printIteratorEntries; +exports.printIteratorValues = printIteratorValues; +exports.printListItems = printListItems; +exports.printObjectProperties = printObjectProperties; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +const getKeysOfEnumerableProperties = (object, compareKeys) => { + const keys = Object.keys(object).sort(compareKeys); + + if (Object.getOwnPropertySymbols) { + Object.getOwnPropertySymbols(object).forEach(symbol => { + if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) { + keys.push(symbol); + } + }); + } + + return keys; +}; +/** + * Return entries (for example, of a map) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ + +function printIteratorEntries( + iterator, + config, + indentation, + depth, + refs, + printer, // Too bad, so sad that separator for ECMAScript Map has been ' => ' + // What a distracting diff if you change a data structure to/from + // ECMAScript Object or Immutable.Map/OrderedMap which use the default. + separator = ': ' +) { + let result = ''; + let width = 0; + let current = iterator.next(); + + if (!current.done) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + while (!current.done) { + result += indentationNext; + + if (width++ === config.maxWidth) { + result += '…'; + break; + } + + const name = printer( + current.value[0], + config, + indentationNext, + depth, + refs + ); + const value = printer( + current.value[1], + config, + indentationNext, + depth, + refs + ); + result += name + separator + value; + current = iterator.next(); + + if (!current.done) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return values (for example, of a set) + * with spacing, indentation, and comma + * without surrounding punctuation (braces or brackets) + */ + +function printIteratorValues( + iterator, + config, + indentation, + depth, + refs, + printer +) { + let result = ''; + let width = 0; + let current = iterator.next(); + + if (!current.done) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + while (!current.done) { + result += indentationNext; + + if (width++ === config.maxWidth) { + result += '…'; + break; + } + + result += printer(current.value, config, indentationNext, depth, refs); + current = iterator.next(); + + if (!current.done) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return items (for example, of an array) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, brackets) + **/ + +function printListItems(list, config, indentation, depth, refs, printer) { + let result = ''; + + if (list.length) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + for (let i = 0; i < list.length; i++) { + result += indentationNext; + + if (i === config.maxWidth) { + result += '…'; + break; + } + + if (i in list) { + result += printer(list[i], config, indentationNext, depth, refs); + } + + if (i < list.length - 1) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return properties of an object + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ + +function printObjectProperties(val, config, indentation, depth, refs, printer) { + let result = ''; + const keys = getKeysOfEnumerableProperties(val, config.compareKeys); + + if (keys.length) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const name = printer(key, config, indentationNext, depth, refs); + const value = printer(val[key], config, indentationNext, depth, refs); + result += `${indentationNext + name}: ${value}`; + + if (i < keys.length - 1) { + result += `,${config.spacingInner}`; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/index.d.ts b/node_modules/jest-circus/node_modules/pretty-format/build/index.d.ts new file mode 100644 index 000000000..239b79b6f --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/index.d.ts @@ -0,0 +1,142 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type {SnapshotFormat} from '@jest/schemas'; + +export declare type Colors = { + comment: { + close: string; + open: string; + }; + content: { + close: string; + open: string; + }; + prop: { + close: string; + open: string; + }; + tag: { + close: string; + open: string; + }; + value: { + close: string; + open: string; + }; +}; + +export declare type CompareKeys = + | ((a: string, b: string) => number) + | undefined; + +export declare type Config = { + callToJSON: boolean; + compareKeys: CompareKeys; + colors: Colors; + escapeRegex: boolean; + escapeString: boolean; + indent: string; + maxDepth: number; + maxWidth: number; + min: boolean; + plugins: Plugins; + printBasicPrototype: boolean; + printFunctionName: boolean; + spacingInner: string; + spacingOuter: string; +}; + +export declare const DEFAULT_OPTIONS: Options; + +/** + * Returns a presentation string of your `val` object + * @param val any potential JavaScript object + * @param options Custom settings + */ +declare function format(val: unknown, options?: OptionsReceived): string; +export default format; +export {format}; + +declare type Indent = (arg0: string) => string; + +export declare type NewPlugin = { + serialize: ( + val: any, + config: Config, + indentation: string, + depth: number, + refs: Refs, + printer: Printer, + ) => string; + test: Test; +}; + +export declare type OldPlugin = { + print: ( + val: unknown, + print: Print, + indent: Indent, + options: PluginOptions, + colors: Colors, + ) => string; + test: Test; +}; + +export declare interface Options + extends Omit { + compareKeys: CompareKeys; + theme: Required; +} + +export declare type OptionsReceived = PrettyFormatOptions; + +declare type Plugin_2 = NewPlugin | OldPlugin; +export {Plugin_2 as Plugin}; + +declare type PluginOptions = { + edgeSpacing: string; + min: boolean; + spacing: string; +}; + +export declare type Plugins = Array; + +export declare const plugins: { + AsymmetricMatcher: NewPlugin; + ConvertAnsi: NewPlugin; + DOMCollection: NewPlugin; + DOMElement: NewPlugin; + Immutable: NewPlugin; + ReactElement: NewPlugin; + ReactTestComponent: NewPlugin; +}; + +export declare interface PrettyFormatOptions extends SnapshotFormat { + compareKeys?: CompareKeys; + plugins?: Plugins; +} + +declare type Print = (arg0: unknown) => string; + +export declare type Printer = ( + val: unknown, + config: Config, + indentation: string, + depth: number, + refs: Refs, + hasCalledToJSON?: boolean, +) => string; + +export declare type Refs = Array; + +declare type RequiredOptions = Required; + +declare type Test = (arg0: any) => boolean; + +export declare type Theme = Options['theme']; + +export {}; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/index.js b/node_modules/jest-circus/node_modules/pretty-format/build/index.js new file mode 100644 index 000000000..93132266b --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/index.js @@ -0,0 +1,635 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.DEFAULT_OPTIONS = void 0; +exports.format = format; +exports.plugins = void 0; + +var _ansiStyles = _interopRequireDefault(require('ansi-styles')); + +var _collections = require('./collections'); + +var _AsymmetricMatcher = _interopRequireDefault( + require('./plugins/AsymmetricMatcher') +); + +var _ConvertAnsi = _interopRequireDefault(require('./plugins/ConvertAnsi')); + +var _DOMCollection = _interopRequireDefault(require('./plugins/DOMCollection')); + +var _DOMElement = _interopRequireDefault(require('./plugins/DOMElement')); + +var _Immutable = _interopRequireDefault(require('./plugins/Immutable')); + +var _ReactElement = _interopRequireDefault(require('./plugins/ReactElement')); + +var _ReactTestComponent = _interopRequireDefault( + require('./plugins/ReactTestComponent') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* eslint-disable local/ban-types-eventually */ +const toString = Object.prototype.toString; +const toISOString = Date.prototype.toISOString; +const errorToString = Error.prototype.toString; +const regExpToString = RegExp.prototype.toString; +/** + * Explicitly comparing typeof constructor to function avoids undefined as name + * when mock identity-obj-proxy returns the key as the value for any key. + */ + +const getConstructorName = val => + (typeof val.constructor === 'function' && val.constructor.name) || 'Object'; +/* global window */ + +/** Is val is equal to global window object? Works even if it does not exist :) */ + +const isWindow = val => typeof window !== 'undefined' && val === window; + +const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/; +const NEWLINE_REGEXP = /\n/gi; + +class PrettyFormatPluginError extends Error { + constructor(message, stack) { + super(message); + this.stack = stack; + this.name = this.constructor.name; + } +} + +function isToStringedArrayType(toStringed) { + return ( + toStringed === '[object Array]' || + toStringed === '[object ArrayBuffer]' || + toStringed === '[object DataView]' || + toStringed === '[object Float32Array]' || + toStringed === '[object Float64Array]' || + toStringed === '[object Int8Array]' || + toStringed === '[object Int16Array]' || + toStringed === '[object Int32Array]' || + toStringed === '[object Uint8Array]' || + toStringed === '[object Uint8ClampedArray]' || + toStringed === '[object Uint16Array]' || + toStringed === '[object Uint32Array]' + ); +} + +function printNumber(val) { + return Object.is(val, -0) ? '-0' : String(val); +} + +function printBigInt(val) { + return String(`${val}n`); +} + +function printFunction(val, printFunctionName) { + if (!printFunctionName) { + return '[Function]'; + } + + return `[Function ${val.name || 'anonymous'}]`; +} + +function printSymbol(val) { + return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)'); +} + +function printError(val) { + return `[${errorToString.call(val)}]`; +} +/** + * The first port of call for printing an object, handles most of the + * data-types in JS. + */ + +function printBasicValue(val, printFunctionName, escapeRegex, escapeString) { + if (val === true || val === false) { + return `${val}`; + } + + if (val === undefined) { + return 'undefined'; + } + + if (val === null) { + return 'null'; + } + + const typeOf = typeof val; + + if (typeOf === 'number') { + return printNumber(val); + } + + if (typeOf === 'bigint') { + return printBigInt(val); + } + + if (typeOf === 'string') { + if (escapeString) { + return `"${val.replace(/"|\\/g, '\\$&')}"`; + } + + return `"${val}"`; + } + + if (typeOf === 'function') { + return printFunction(val, printFunctionName); + } + + if (typeOf === 'symbol') { + return printSymbol(val); + } + + const toStringed = toString.call(val); + + if (toStringed === '[object WeakMap]') { + return 'WeakMap {}'; + } + + if (toStringed === '[object WeakSet]') { + return 'WeakSet {}'; + } + + if ( + toStringed === '[object Function]' || + toStringed === '[object GeneratorFunction]' + ) { + return printFunction(val, printFunctionName); + } + + if (toStringed === '[object Symbol]') { + return printSymbol(val); + } + + if (toStringed === '[object Date]') { + return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val); + } + + if (toStringed === '[object Error]') { + return printError(val); + } + + if (toStringed === '[object RegExp]') { + if (escapeRegex) { + // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js + return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + return regExpToString.call(val); + } + + if (val instanceof Error) { + return printError(val); + } + + return null; +} +/** + * Handles more complex objects ( such as objects with circular references. + * maps and sets etc ) + */ + +function printComplexValue( + val, + config, + indentation, + depth, + refs, + hasCalledToJSON +) { + if (refs.indexOf(val) !== -1) { + return '[Circular]'; + } + + refs = refs.slice(); + refs.push(val); + const hitMaxDepth = ++depth > config.maxDepth; + const min = config.min; + + if ( + config.callToJSON && + !hitMaxDepth && + val.toJSON && + typeof val.toJSON === 'function' && + !hasCalledToJSON + ) { + return printer(val.toJSON(), config, indentation, depth, refs, true); + } + + const toStringed = toString.call(val); + + if (toStringed === '[object Arguments]') { + return hitMaxDepth + ? '[Arguments]' + : `${min ? '' : 'Arguments '}[${(0, _collections.printListItems)( + val, + config, + indentation, + depth, + refs, + printer + )}]`; + } + + if (isToStringedArrayType(toStringed)) { + return hitMaxDepth + ? `[${val.constructor.name}]` + : `${ + min + ? '' + : !config.printBasicPrototype && val.constructor.name === 'Array' + ? '' + : `${val.constructor.name} ` + }[${(0, _collections.printListItems)( + val, + config, + indentation, + depth, + refs, + printer + )}]`; + } + + if (toStringed === '[object Map]') { + return hitMaxDepth + ? '[Map]' + : `Map {${(0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer, + ' => ' + )}}`; + } + + if (toStringed === '[object Set]') { + return hitMaxDepth + ? '[Set]' + : `Set {${(0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + )}}`; + } // Avoid failure to serialize global window object in jsdom test environment. + // For example, not even relevant if window is prop of React element. + + return hitMaxDepth || isWindow(val) + ? `[${getConstructorName(val)}]` + : `${ + min + ? '' + : !config.printBasicPrototype && getConstructorName(val) === 'Object' + ? '' + : `${getConstructorName(val)} ` + }{${(0, _collections.printObjectProperties)( + val, + config, + indentation, + depth, + refs, + printer + )}}`; +} + +function isNewPlugin(plugin) { + return plugin.serialize != null; +} + +function printPlugin(plugin, val, config, indentation, depth, refs) { + let printed; + + try { + printed = isNewPlugin(plugin) + ? plugin.serialize(val, config, indentation, depth, refs, printer) + : plugin.print( + val, + valChild => printer(valChild, config, indentation, depth, refs), + str => { + const indentationNext = indentation + config.indent; + return ( + indentationNext + + str.replace(NEWLINE_REGEXP, `\n${indentationNext}`) + ); + }, + { + edgeSpacing: config.spacingOuter, + min: config.min, + spacing: config.spacingInner + }, + config.colors + ); + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + + if (typeof printed !== 'string') { + throw new Error( + `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".` + ); + } + + return printed; +} + +function findPlugin(plugins, val) { + for (let p = 0; p < plugins.length; p++) { + try { + if (plugins[p].test(val)) { + return plugins[p]; + } + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + } + + return null; +} + +function printer(val, config, indentation, depth, refs, hasCalledToJSON) { + const plugin = findPlugin(config.plugins, val); + + if (plugin !== null) { + return printPlugin(plugin, val, config, indentation, depth, refs); + } + + const basicResult = printBasicValue( + val, + config.printFunctionName, + config.escapeRegex, + config.escapeString + ); + + if (basicResult !== null) { + return basicResult; + } + + return printComplexValue( + val, + config, + indentation, + depth, + refs, + hasCalledToJSON + ); +} + +const DEFAULT_THEME = { + comment: 'gray', + content: 'reset', + prop: 'yellow', + tag: 'cyan', + value: 'green' +}; +const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME); +const DEFAULT_OPTIONS = { + callToJSON: true, + compareKeys: undefined, + escapeRegex: false, + escapeString: true, + highlight: false, + indent: 2, + maxDepth: Infinity, + maxWidth: Infinity, + min: false, + plugins: [], + printBasicPrototype: true, + printFunctionName: true, + theme: DEFAULT_THEME +}; +exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS; + +function validateOptions(options) { + Object.keys(options).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) { + throw new Error(`pretty-format: Unknown option "${key}".`); + } + }); + + if (options.min && options.indent !== undefined && options.indent !== 0) { + throw new Error( + 'pretty-format: Options "min" and "indent" cannot be used together.' + ); + } + + if (options.theme !== undefined) { + if (options.theme === null) { + throw new Error('pretty-format: Option "theme" must not be null.'); + } + + if (typeof options.theme !== 'object') { + throw new Error( + `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".` + ); + } + } +} + +const getColorsHighlight = options => + DEFAULT_THEME_KEYS.reduce((colors, key) => { + const value = + options.theme && options.theme[key] !== undefined + ? options.theme[key] + : DEFAULT_THEME[key]; + const color = value && _ansiStyles.default[value]; + + if ( + color && + typeof color.close === 'string' && + typeof color.open === 'string' + ) { + colors[key] = color; + } else { + throw new Error( + `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.` + ); + } + + return colors; + }, Object.create(null)); + +const getColorsEmpty = () => + DEFAULT_THEME_KEYS.reduce((colors, key) => { + colors[key] = { + close: '', + open: '' + }; + return colors; + }, Object.create(null)); + +const getPrintFunctionName = options => { + var _options$printFunctio; + + return (_options$printFunctio = + options === null || options === void 0 + ? void 0 + : options.printFunctionName) !== null && _options$printFunctio !== void 0 + ? _options$printFunctio + : DEFAULT_OPTIONS.printFunctionName; +}; + +const getEscapeRegex = options => { + var _options$escapeRegex; + + return (_options$escapeRegex = + options === null || options === void 0 ? void 0 : options.escapeRegex) !== + null && _options$escapeRegex !== void 0 + ? _options$escapeRegex + : DEFAULT_OPTIONS.escapeRegex; +}; + +const getEscapeString = options => { + var _options$escapeString; + + return (_options$escapeString = + options === null || options === void 0 ? void 0 : options.escapeString) !== + null && _options$escapeString !== void 0 + ? _options$escapeString + : DEFAULT_OPTIONS.escapeString; +}; + +const getConfig = options => { + var _options$callToJSON, + _options$indent, + _options$maxDepth, + _options$maxWidth, + _options$min, + _options$plugins, + _options$printBasicPr; + + return { + callToJSON: + (_options$callToJSON = + options === null || options === void 0 + ? void 0 + : options.callToJSON) !== null && _options$callToJSON !== void 0 + ? _options$callToJSON + : DEFAULT_OPTIONS.callToJSON, + colors: + options !== null && options !== void 0 && options.highlight + ? getColorsHighlight(options) + : getColorsEmpty(), + compareKeys: + typeof (options === null || options === void 0 + ? void 0 + : options.compareKeys) === 'function' + ? options.compareKeys + : DEFAULT_OPTIONS.compareKeys, + escapeRegex: getEscapeRegex(options), + escapeString: getEscapeString(options), + indent: + options !== null && options !== void 0 && options.min + ? '' + : createIndent( + (_options$indent = + options === null || options === void 0 + ? void 0 + : options.indent) !== null && _options$indent !== void 0 + ? _options$indent + : DEFAULT_OPTIONS.indent + ), + maxDepth: + (_options$maxDepth = + options === null || options === void 0 ? void 0 : options.maxDepth) !== + null && _options$maxDepth !== void 0 + ? _options$maxDepth + : DEFAULT_OPTIONS.maxDepth, + maxWidth: + (_options$maxWidth = + options === null || options === void 0 ? void 0 : options.maxWidth) !== + null && _options$maxWidth !== void 0 + ? _options$maxWidth + : DEFAULT_OPTIONS.maxWidth, + min: + (_options$min = + options === null || options === void 0 ? void 0 : options.min) !== + null && _options$min !== void 0 + ? _options$min + : DEFAULT_OPTIONS.min, + plugins: + (_options$plugins = + options === null || options === void 0 ? void 0 : options.plugins) !== + null && _options$plugins !== void 0 + ? _options$plugins + : DEFAULT_OPTIONS.plugins, + printBasicPrototype: + (_options$printBasicPr = + options === null || options === void 0 + ? void 0 + : options.printBasicPrototype) !== null && + _options$printBasicPr !== void 0 + ? _options$printBasicPr + : true, + printFunctionName: getPrintFunctionName(options), + spacingInner: + options !== null && options !== void 0 && options.min ? ' ' : '\n', + spacingOuter: + options !== null && options !== void 0 && options.min ? '' : '\n' + }; +}; + +function createIndent(indent) { + return new Array(indent + 1).join(' '); +} +/** + * Returns a presentation string of your `val` object + * @param val any potential JavaScript object + * @param options Custom settings + */ + +function format(val, options) { + if (options) { + validateOptions(options); + + if (options.plugins) { + const plugin = findPlugin(options.plugins, val); + + if (plugin !== null) { + return printPlugin(plugin, val, getConfig(options), '', 0, []); + } + } + } + + const basicResult = printBasicValue( + val, + getPrintFunctionName(options), + getEscapeRegex(options), + getEscapeString(options) + ); + + if (basicResult !== null) { + return basicResult; + } + + return printComplexValue(val, getConfig(options), '', 0, []); +} + +const plugins = { + AsymmetricMatcher: _AsymmetricMatcher.default, + ConvertAnsi: _ConvertAnsi.default, + DOMCollection: _DOMCollection.default, + DOMElement: _DOMElement.default, + Immutable: _Immutable.default, + ReactElement: _ReactElement.default, + ReactTestComponent: _ReactTestComponent.default +}; +exports.plugins = plugins; +var _default = format; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js new file mode 100644 index 000000000..41107e8ee --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js @@ -0,0 +1,97 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _collections = require('../collections'); + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +const asymmetricMatcher = + typeof Symbol === 'function' && Symbol.for + ? Symbol.for('jest.asymmetricMatcher') + : 0x1357a5; +const SPACE = ' '; + +const serialize = (val, config, indentation, depth, refs, printer) => { + const stringedValue = val.toString(); + + if ( + stringedValue === 'ArrayContaining' || + stringedValue === 'ArrayNotContaining' + ) { + if (++depth > config.maxDepth) { + return `[${stringedValue}]`; + } + + return `${stringedValue + SPACE}[${(0, _collections.printListItems)( + val.sample, + config, + indentation, + depth, + refs, + printer + )}]`; + } + + if ( + stringedValue === 'ObjectContaining' || + stringedValue === 'ObjectNotContaining' + ) { + if (++depth > config.maxDepth) { + return `[${stringedValue}]`; + } + + return `${stringedValue + SPACE}{${(0, _collections.printObjectProperties)( + val.sample, + config, + indentation, + depth, + refs, + printer + )}}`; + } + + if ( + stringedValue === 'StringMatching' || + stringedValue === 'StringNotMatching' + ) { + return ( + stringedValue + + SPACE + + printer(val.sample, config, indentation, depth, refs) + ); + } + + if ( + stringedValue === 'StringContaining' || + stringedValue === 'StringNotContaining' + ) { + return ( + stringedValue + + SPACE + + printer(val.sample, config, indentation, depth, refs) + ); + } + + if (typeof val.toAsymmetricMatcher !== 'function') { + throw new Error( + `Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()` + ); + } + + return val.toAsymmetricMatcher(); +}; + +exports.serialize = serialize; + +const test = val => val && val.$$typeof === asymmetricMatcher; + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.js new file mode 100644 index 000000000..c5edf00c1 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ConvertAnsi.js @@ -0,0 +1,96 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _ansiRegex = _interopRequireDefault(require('ansi-regex')); + +var _ansiStyles = _interopRequireDefault(require('ansi-styles')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const toHumanReadableAnsi = text => + text.replace((0, _ansiRegex.default)(), match => { + switch (match) { + case _ansiStyles.default.red.close: + case _ansiStyles.default.green.close: + case _ansiStyles.default.cyan.close: + case _ansiStyles.default.gray.close: + case _ansiStyles.default.white.close: + case _ansiStyles.default.yellow.close: + case _ansiStyles.default.bgRed.close: + case _ansiStyles.default.bgGreen.close: + case _ansiStyles.default.bgYellow.close: + case _ansiStyles.default.inverse.close: + case _ansiStyles.default.dim.close: + case _ansiStyles.default.bold.close: + case _ansiStyles.default.reset.open: + case _ansiStyles.default.reset.close: + return ''; + + case _ansiStyles.default.red.open: + return ''; + + case _ansiStyles.default.green.open: + return ''; + + case _ansiStyles.default.cyan.open: + return ''; + + case _ansiStyles.default.gray.open: + return ''; + + case _ansiStyles.default.white.open: + return ''; + + case _ansiStyles.default.yellow.open: + return ''; + + case _ansiStyles.default.bgRed.open: + return ''; + + case _ansiStyles.default.bgGreen.open: + return ''; + + case _ansiStyles.default.bgYellow.open: + return ''; + + case _ansiStyles.default.inverse.open: + return ''; + + case _ansiStyles.default.dim.open: + return ''; + + case _ansiStyles.default.bold.open: + return ''; + + default: + return ''; + } + }); + +const test = val => + typeof val === 'string' && !!val.match((0, _ansiRegex.default)()); + +exports.test = test; + +const serialize = (val, config, indentation, depth, refs, printer) => + printer(toHumanReadableAnsi(val), config, indentation, depth, refs); + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.js new file mode 100644 index 000000000..69b958b94 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMCollection.js @@ -0,0 +1,74 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _collections = require('../collections'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const SPACE = ' '; +const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap']; +const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/; + +const testName = name => + OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name); + +const test = val => + val && + val.constructor && + !!val.constructor.name && + testName(val.constructor.name); + +exports.test = test; + +const isNamedNodeMap = collection => + collection.constructor.name === 'NamedNodeMap'; + +const serialize = (collection, config, indentation, depth, refs, printer) => { + const name = collection.constructor.name; + + if (++depth > config.maxDepth) { + return `[${name}]`; + } + + return ( + (config.min ? '' : name + SPACE) + + (OBJECT_NAMES.indexOf(name) !== -1 + ? `{${(0, _collections.printObjectProperties)( + isNamedNodeMap(collection) + ? Array.from(collection).reduce((props, attribute) => { + props[attribute.name] = attribute.value; + return props; + }, {}) + : {...collection}, + config, + indentation, + depth, + refs, + printer + )}}` + : `[${(0, _collections.printListItems)( + Array.from(collection), + config, + indentation, + depth, + refs, + printer + )}]`) + ); +}; + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.js new file mode 100644 index 000000000..b9d30cec2 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/DOMElement.js @@ -0,0 +1,128 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _markup = require('./lib/markup'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const ELEMENT_NODE = 1; +const TEXT_NODE = 3; +const COMMENT_NODE = 8; +const FRAGMENT_NODE = 11; +const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/; + +const testHasAttribute = val => { + try { + return typeof val.hasAttribute === 'function' && val.hasAttribute('is'); + } catch { + return false; + } +}; + +const testNode = val => { + const constructorName = val.constructor.name; + const {nodeType, tagName} = val; + const isCustomElement = + (typeof tagName === 'string' && tagName.includes('-')) || + testHasAttribute(val); + return ( + (nodeType === ELEMENT_NODE && + (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) || + (nodeType === TEXT_NODE && constructorName === 'Text') || + (nodeType === COMMENT_NODE && constructorName === 'Comment') || + (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment') + ); +}; + +const test = val => { + var _val$constructor; + + return ( + (val === null || val === void 0 + ? void 0 + : (_val$constructor = val.constructor) === null || + _val$constructor === void 0 + ? void 0 + : _val$constructor.name) && testNode(val) + ); +}; + +exports.test = test; + +function nodeIsText(node) { + return node.nodeType === TEXT_NODE; +} + +function nodeIsComment(node) { + return node.nodeType === COMMENT_NODE; +} + +function nodeIsFragment(node) { + return node.nodeType === FRAGMENT_NODE; +} + +const serialize = (node, config, indentation, depth, refs, printer) => { + if (nodeIsText(node)) { + return (0, _markup.printText)(node.data, config); + } + + if (nodeIsComment(node)) { + return (0, _markup.printComment)(node.data, config); + } + + const type = nodeIsFragment(node) + ? 'DocumentFragment' + : node.tagName.toLowerCase(); + + if (++depth > config.maxDepth) { + return (0, _markup.printElementAsLeaf)(type, config); + } + + return (0, _markup.printElement)( + type, + (0, _markup.printProps)( + nodeIsFragment(node) + ? [] + : Array.from(node.attributes) + .map(attr => attr.name) + .sort(), + nodeIsFragment(node) + ? {} + : Array.from(node.attributes).reduce((props, attribute) => { + props[attribute.name] = attribute.value; + return props; + }, {}), + config, + indentation + config.indent, + depth, + refs, + printer + ), + (0, _markup.printChildren)( + Array.prototype.slice.call(node.childNodes || node.children), + config, + indentation + config.indent, + depth, + refs, + printer + ), + config, + indentation + ); +}; + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.js new file mode 100644 index 000000000..f3e1e6510 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/Immutable.js @@ -0,0 +1,230 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _collections = require('../collections'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// SENTINEL constants are from https://github.com/facebook/immutable-js +const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; +const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; +const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; +const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; +const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; +const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4 + +const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; +const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; +const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; + +const getImmutableName = name => `Immutable.${name}`; + +const printAsLeaf = name => `[${name}]`; + +const SPACE = ' '; +const LAZY = '…'; // Seq is lazy if it calls a method like filter + +const printImmutableEntries = ( + val, + config, + indentation, + depth, + refs, + printer, + type +) => + ++depth > config.maxDepth + ? printAsLeaf(getImmutableName(type)) + : `${getImmutableName(type) + SPACE}{${(0, + _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer + )}}`; // Record has an entries method because it is a collection in immutable v3. +// Return an iterator for Immutable Record from version v3 or v4. + +function getRecordEntries(val) { + let i = 0; + return { + next() { + if (i < val._keys.length) { + const key = val._keys[i++]; + return { + done: false, + value: [key, val.get(key)] + }; + } + + return { + done: true, + value: undefined + }; + } + }; +} + +const printImmutableRecord = ( + val, + config, + indentation, + depth, + refs, + printer +) => { + // _name property is defined only for an Immutable Record instance + // which was constructed with a second optional descriptive name arg + const name = getImmutableName(val._name || 'Record'); + return ++depth > config.maxDepth + ? printAsLeaf(name) + : `${name + SPACE}{${(0, _collections.printIteratorEntries)( + getRecordEntries(val), + config, + indentation, + depth, + refs, + printer + )}}`; +}; + +const printImmutableSeq = (val, config, indentation, depth, refs, printer) => { + const name = getImmutableName('Seq'); + + if (++depth > config.maxDepth) { + return printAsLeaf(name); + } + + if (val[IS_KEYED_SENTINEL]) { + return `${name + SPACE}{${ + // from Immutable collection of entries or from ECMAScript object + val._iter || val._object + ? (0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer + ) + : LAZY + }}`; + } + + return `${name + SPACE}[${ + val._iter || // from Immutable collection of values + val._array || // from ECMAScript array + val._collection || // from ECMAScript collection in immutable v4 + val._iterable // from ECMAScript collection in immutable v3 + ? (0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + ) + : LAZY + }]`; +}; + +const printImmutableValues = ( + val, + config, + indentation, + depth, + refs, + printer, + type +) => + ++depth > config.maxDepth + ? printAsLeaf(getImmutableName(type)) + : `${getImmutableName(type) + SPACE}[${(0, + _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + )}]`; + +const serialize = (val, config, indentation, depth, refs, printer) => { + if (val[IS_MAP_SENTINEL]) { + return printImmutableEntries( + val, + config, + indentation, + depth, + refs, + printer, + val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map' + ); + } + + if (val[IS_LIST_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + 'List' + ); + } + + if (val[IS_SET_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set' + ); + } + + if (val[IS_STACK_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + 'Stack' + ); + } + + if (val[IS_SEQ_SENTINEL]) { + return printImmutableSeq(val, config, indentation, depth, refs, printer); + } // For compatibility with immutable v3 and v4, let record be the default. + + return printImmutableRecord(val, config, indentation, depth, refs, printer); +}; // Explicitly comparing sentinel properties to true avoids false positive +// when mock identity-obj-proxy returns the key as the value for any key. + +exports.serialize = serialize; + +const test = val => + val && + (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true); + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.js new file mode 100644 index 000000000..96325765b --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactElement.js @@ -0,0 +1,164 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var ReactIs = _interopRequireWildcard(require('react-is')); + +var _markup = require('./lib/markup'); + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Given element.props.children, or subtree during recursive traversal, +// return flattened array of children. +const getChildren = (arg, children = []) => { + if (Array.isArray(arg)) { + arg.forEach(item => { + getChildren(item, children); + }); + } else if (arg != null && arg !== false) { + children.push(arg); + } + + return children; +}; + +const getType = element => { + const type = element.type; + + if (typeof type === 'string') { + return type; + } + + if (typeof type === 'function') { + return type.displayName || type.name || 'Unknown'; + } + + if (ReactIs.isFragment(element)) { + return 'React.Fragment'; + } + + if (ReactIs.isSuspense(element)) { + return 'React.Suspense'; + } + + if (typeof type === 'object' && type !== null) { + if (ReactIs.isContextProvider(element)) { + return 'Context.Provider'; + } + + if (ReactIs.isContextConsumer(element)) { + return 'Context.Consumer'; + } + + if (ReactIs.isForwardRef(element)) { + if (type.displayName) { + return type.displayName; + } + + const functionName = type.render.displayName || type.render.name || ''; + return functionName !== '' ? `ForwardRef(${functionName})` : 'ForwardRef'; + } + + if (ReactIs.isMemo(element)) { + const functionName = + type.displayName || type.type.displayName || type.type.name || ''; + return functionName !== '' ? `Memo(${functionName})` : 'Memo'; + } + } + + return 'UNDEFINED'; +}; + +const getPropKeys = element => { + const {props} = element; + return Object.keys(props) + .filter(key => key !== 'children' && props[key] !== undefined) + .sort(); +}; + +const serialize = (element, config, indentation, depth, refs, printer) => + ++depth > config.maxDepth + ? (0, _markup.printElementAsLeaf)(getType(element), config) + : (0, _markup.printElement)( + getType(element), + (0, _markup.printProps)( + getPropKeys(element), + element.props, + config, + indentation + config.indent, + depth, + refs, + printer + ), + (0, _markup.printChildren)( + getChildren(element.props.children), + config, + indentation + config.indent, + depth, + refs, + printer + ), + config, + indentation + ); + +exports.serialize = serialize; + +const test = val => val != null && ReactIs.isElement(val); + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.js new file mode 100644 index 000000000..fcdcfd79b --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/ReactTestComponent.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.test = exports.serialize = exports.default = void 0; + +var _markup = require('./lib/markup'); + +var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; +const testSymbol = + typeof Symbol === 'function' && Symbol.for + ? Symbol.for('react.test.json') + : 0xea71357; + +const getPropKeys = object => { + const {props} = object; + return props + ? Object.keys(props) + .filter(key => props[key] !== undefined) + .sort() + : []; +}; + +const serialize = (object, config, indentation, depth, refs, printer) => + ++depth > config.maxDepth + ? (0, _markup.printElementAsLeaf)(object.type, config) + : (0, _markup.printElement)( + object.type, + object.props + ? (0, _markup.printProps)( + getPropKeys(object), + object.props, + config, + indentation + config.indent, + depth, + refs, + printer + ) + : '', + object.children + ? (0, _markup.printChildren)( + object.children, + config, + indentation + config.indent, + depth, + refs, + printer + ) + : '', + config, + indentation + ); + +exports.serialize = serialize; + +const test = val => val && val.$$typeof === testSymbol; + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.js new file mode 100644 index 000000000..50dda2590 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/escapeHTML.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = escapeHTML; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function escapeHTML(str) { + return str.replace(//g, '>'); +} diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.js b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.js new file mode 100644 index 000000000..3eeda6d4c --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/plugins/lib/markup.js @@ -0,0 +1,125 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printText = + exports.printProps = + exports.printElementAsLeaf = + exports.printElement = + exports.printComment = + exports.printChildren = + void 0; + +var _escapeHTML = _interopRequireDefault(require('./escapeHTML')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Return empty string if keys is empty. +const printProps = (keys, props, config, indentation, depth, refs, printer) => { + const indentationNext = indentation + config.indent; + const colors = config.colors; + return keys + .map(key => { + const value = props[key]; + let printed = printer(value, config, indentationNext, depth, refs); + + if (typeof value !== 'string') { + if (printed.indexOf('\n') !== -1) { + printed = + config.spacingOuter + + indentationNext + + printed + + config.spacingOuter + + indentation; + } + + printed = `{${printed}}`; + } + + return `${ + config.spacingInner + + indentation + + colors.prop.open + + key + + colors.prop.close + }=${colors.value.open}${printed}${colors.value.close}`; + }) + .join(''); +}; // Return empty string if children is empty. + +exports.printProps = printProps; + +const printChildren = (children, config, indentation, depth, refs, printer) => + children + .map( + child => + config.spacingOuter + + indentation + + (typeof child === 'string' + ? printText(child, config) + : printer(child, config, indentation, depth, refs)) + ) + .join(''); + +exports.printChildren = printChildren; + +const printText = (text, config) => { + const contentColor = config.colors.content; + return ( + contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close + ); +}; + +exports.printText = printText; + +const printComment = (comment, config) => { + const commentColor = config.colors.comment; + return `${commentColor.open}${ + commentColor.close + }`; +}; // Separate the functions to format props, children, and element, +// so a plugin could override a particular function, if needed. +// Too bad, so sad: the traditional (but unnecessary) space +// in a self-closing tagColor requires a second test of printedProps. + +exports.printComment = printComment; + +const printElement = ( + type, + printedProps, + printedChildren, + config, + indentation +) => { + const tagColor = config.colors.tag; + return `${tagColor.open}<${type}${ + printedProps && + tagColor.close + + printedProps + + config.spacingOuter + + indentation + + tagColor.open + }${ + printedChildren + ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}${tagColor.close}`; +}; + +exports.printElement = printElement; + +const printElementAsLeaf = (type, config) => { + const tagColor = config.colors.tag; + return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`; +}; + +exports.printElementAsLeaf = printElementAsLeaf; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/types.js b/node_modules/jest-circus/node_modules/pretty-format/build/types.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/jest-circus/node_modules/pretty-format/package.json b/node_modules/jest-circus/node_modules/pretty-format/package.json new file mode 100644 index 000000000..07ca91691 --- /dev/null +++ b/node_modules/jest-circus/node_modules/pretty-format/package.json @@ -0,0 +1,46 @@ +{ + "name": "pretty-format", + "version": "28.0.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/pretty-format" + }, + "license": "MIT", + "description": "Stringify any JavaScript value.", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json", + "./ConvertAnsi": "./build/plugins/ConvertAnsi.js" + }, + "author": "James Kyle ", + "dependencies": { + "@jest/schemas": "^28.0.0", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "devDependencies": { + "@types/react": "^17.0.3", + "@types/react-is": "^17.0.0", + "@types/react-test-renderer": "17.0.2", + "expect": "^28.0.1", + "immutable": "^4.0.0", + "jest-util": "^28.0.1", + "react": "17.0.2", + "react-dom": "^17.0.1", + "react-test-renderer": "17.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" +} diff --git a/node_modules/jest-circus/node_modules/react-is/LICENSE b/node_modules/jest-circus/node_modules/react-is/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/react-is/README.md b/node_modules/jest-circus/node_modules/react-is/README.md new file mode 100644 index 000000000..d25597761 --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/README.md @@ -0,0 +1,104 @@ +# `react-is` + +This package allows you to test arbitrary values and see if they're a particular React element type. + +## Installation + +```sh +# Yarn +yarn add react-is + +# NPM +npm install react-is +``` + +## Usage + +### Determining if a Component is Valid + +```js +import React from "react"; +import * as ReactIs from "react-is"; + +class ClassComponent extends React.Component { + render() { + return React.createElement("div"); + } +} + +const FunctionComponent = () => React.createElement("div"); + +const ForwardRefComponent = React.forwardRef((props, ref) => + React.createElement(Component, { forwardedRef: ref, ...props }) +); + +const Context = React.createContext(false); + +ReactIs.isValidElementType("div"); // true +ReactIs.isValidElementType(ClassComponent); // true +ReactIs.isValidElementType(FunctionComponent); // true +ReactIs.isValidElementType(ForwardRefComponent); // true +ReactIs.isValidElementType(Context.Provider); // true +ReactIs.isValidElementType(Context.Consumer); // true +ReactIs.isValidElementType(React.createFactory("div")); // true +``` + +### Determining an Element's Type + +#### Context + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +const ThemeContext = React.createContext("blue"); + +ReactIs.isContextConsumer(); // true +ReactIs.isContextProvider(); // true +ReactIs.typeOf() === ReactIs.ContextProvider; // true +ReactIs.typeOf() === ReactIs.ContextConsumer; // true +``` + +#### Element + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isElement(
); // true +ReactIs.typeOf(
) === ReactIs.Element; // true +``` + +#### Fragment + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isFragment(<>); // true +ReactIs.typeOf(<>) === ReactIs.Fragment; // true +``` + +#### Portal + +```js +import React from "react"; +import ReactDOM from "react-dom"; +import * as ReactIs from 'react-is'; + +const div = document.createElement("div"); +const portal = ReactDOM.createPortal(
, div); + +ReactIs.isPortal(portal); // true +ReactIs.typeOf(portal) === ReactIs.Portal; // true +``` + +#### StrictMode + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isStrictMode(); // true +ReactIs.typeOf() === ReactIs.StrictMode; // true +``` diff --git a/node_modules/jest-circus/node_modules/react-is/cjs/react-is.development.js b/node_modules/jest-circus/node_modules/react-is/cjs/react-is.development.js new file mode 100644 index 000000000..4cefe6be8 --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/cjs/react-is.development.js @@ -0,0 +1,216 @@ +/** + * @license React + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// ATTENTION +// When adding new symbols to this file, +// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' +// The Symbol used to tag the ReactElement-like types. +var REACT_ELEMENT_TYPE = Symbol.for('react.element'); +var REACT_PORTAL_TYPE = Symbol.for('react.portal'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); +var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); +var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); +var REACT_CONTEXT_TYPE = Symbol.for('react.context'); +var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); +var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); +var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); +var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); +var REACT_MEMO_TYPE = Symbol.for('react.memo'); +var REACT_LAZY_TYPE = Symbol.for('react.lazy'); +var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); + +// ----------------------------------------------------------------------------- + +var enableScopeAPI = false; // Experimental Create Event Handle API. +var enableCacheElement = false; +var enableTransitionTracing = false; // No known bugs, but needs performance testing + +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber +// stuff. Intended to enable React core members to more easily debug scheduling +// issues in DEV builds. + +var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + +var REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); +function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var SuspenseList = REACT_SUSPENSE_LIST_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; +var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; +} +function isConcurrentMode(object) { + { + if (!hasWarnedAboutDeprecatedIsConcurrentMode) { + hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} +function isSuspenseList(object) { + return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; +} + +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.SuspenseList = SuspenseList; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isSuspenseList = isSuspenseList; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} diff --git a/node_modules/jest-circus/node_modules/react-is/cjs/react-is.production.min.js b/node_modules/jest-circus/node_modules/react-is/cjs/react-is.production.min.js new file mode 100644 index 000000000..239f2f33c --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/cjs/react-is.production.min.js @@ -0,0 +1,14 @@ +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u=Symbol.for("react.module.reference"); +function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m; +exports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p}; +exports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v; diff --git a/node_modules/jest-circus/node_modules/react-is/index.js b/node_modules/jest-circus/node_modules/react-is/index.js new file mode 100644 index 000000000..3ae098d07 --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} diff --git a/node_modules/jest-circus/node_modules/react-is/package.json b/node_modules/jest-circus/node_modules/react-is/package.json new file mode 100644 index 000000000..333426d6e --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/package.json @@ -0,0 +1,26 @@ +{ + "name": "react-is", + "version": "18.0.0", + "description": "Brand checking of React Elements.", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react-is" + }, + "keywords": [ + "react" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/facebook/react/issues" + }, + "homepage": "https://reactjs.org/", + "files": [ + "LICENSE", + "README.md", + "index.js", + "cjs/", + "umd/" + ] +} \ No newline at end of file diff --git a/node_modules/jest-circus/node_modules/react-is/umd/react-is.development.js b/node_modules/jest-circus/node_modules/react-is/umd/react-is.development.js new file mode 100644 index 000000000..b56b5adb5 --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/umd/react-is.development.js @@ -0,0 +1,215 @@ +/** + * @license React + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.ReactIs = {})); +}(this, (function (exports) { 'use strict'; + + // ATTENTION + // When adding new symbols to this file, + // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' + // The Symbol used to tag the ReactElement-like types. + var REACT_ELEMENT_TYPE = Symbol.for('react.element'); + var REACT_PORTAL_TYPE = Symbol.for('react.portal'); + var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); + var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); + var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); + var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); + var REACT_CONTEXT_TYPE = Symbol.for('react.context'); + var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); + var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); + var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); + var REACT_MEMO_TYPE = Symbol.for('react.memo'); + var REACT_LAZY_TYPE = Symbol.for('react.lazy'); + var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); + + // ----------------------------------------------------------------------------- + + var enableScopeAPI = false; // Experimental Create Event Handle API. + var enableCacheElement = false; + var enableTransitionTracing = false; // No known bugs, but needs performance testing + + var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber + // stuff. Intended to enable React core members to more easily debug scheduling + // issues in DEV builds. + + var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + + var REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); + function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; + } + + function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; + } + var ContextConsumer = REACT_CONTEXT_TYPE; + var ContextProvider = REACT_PROVIDER_TYPE; + var Element = REACT_ELEMENT_TYPE; + var ForwardRef = REACT_FORWARD_REF_TYPE; + var Fragment = REACT_FRAGMENT_TYPE; + var Lazy = REACT_LAZY_TYPE; + var Memo = REACT_MEMO_TYPE; + var Portal = REACT_PORTAL_TYPE; + var Profiler = REACT_PROFILER_TYPE; + var StrictMode = REACT_STRICT_MODE_TYPE; + var Suspense = REACT_SUSPENSE_TYPE; + var SuspenseList = REACT_SUSPENSE_LIST_TYPE; + var hasWarnedAboutDeprecatedIsAsyncMode = false; + var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated + + function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; + } + function isConcurrentMode(object) { + { + if (!hasWarnedAboutDeprecatedIsConcurrentMode) { + hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); + } + } + + return false; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + function isSuspenseList(object) { + return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; + } + + exports.ContextConsumer = ContextConsumer; + exports.ContextProvider = ContextProvider; + exports.Element = Element; + exports.ForwardRef = ForwardRef; + exports.Fragment = Fragment; + exports.Lazy = Lazy; + exports.Memo = Memo; + exports.Portal = Portal; + exports.Profiler = Profiler; + exports.StrictMode = StrictMode; + exports.Suspense = Suspense; + exports.SuspenseList = SuspenseList; + exports.isAsyncMode = isAsyncMode; + exports.isConcurrentMode = isConcurrentMode; + exports.isContextConsumer = isContextConsumer; + exports.isContextProvider = isContextProvider; + exports.isElement = isElement; + exports.isForwardRef = isForwardRef; + exports.isFragment = isFragment; + exports.isLazy = isLazy; + exports.isMemo = isMemo; + exports.isPortal = isPortal; + exports.isProfiler = isProfiler; + exports.isStrictMode = isStrictMode; + exports.isSuspense = isSuspense; + exports.isSuspenseList = isSuspenseList; + exports.isValidElementType = isValidElementType; + exports.typeOf = typeOf; + +}))); diff --git a/node_modules/jest-circus/node_modules/react-is/umd/react-is.production.min.js b/node_modules/jest-circus/node_modules/react-is/umd/react-is.production.min.js new file mode 100644 index 000000000..3a88bc263 --- /dev/null +++ b/node_modules/jest-circus/node_modules/react-is/umd/react-is.production.min.js @@ -0,0 +1,15 @@ +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +(function(){'use strict';(function(b,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):(b=b||self,c(b.ReactIs={}))})(this,function(b){function c(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case q:switch(a=a.type,a){case d:case e:case f:case g:case h:return a;default:switch(a=a&&a.$$typeof,a){case t:case k:case l:case m:case n:case p:return a;default:return b}}case r:return b}}}var q=Symbol.for("react.element"), +r=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),e=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),k=Symbol.for("react.context"),t=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),u=Symbol.for("react.offscreen"),v=Symbol.for("react.module.reference");b.ContextConsumer=k;b.ContextProvider=p;b.Element=q; +b.ForwardRef=l;b.Fragment=d;b.Lazy=m;b.Memo=n;b.Portal=r;b.Profiler=e;b.StrictMode=f;b.Suspense=g;b.SuspenseList=h;b.isAsyncMode=function(a){return!1};b.isConcurrentMode=function(a){return!1};b.isContextConsumer=function(a){return c(a)===k};b.isContextProvider=function(a){return c(a)===p};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===q};b.isForwardRef=function(a){return c(a)===l};b.isFragment=function(a){return c(a)===d};b.isLazy=function(a){return c(a)===m};b.isMemo=function(a){return c(a)=== +n};b.isPortal=function(a){return c(a)===r};b.isProfiler=function(a){return c(a)===e};b.isStrictMode=function(a){return c(a)===f};b.isSuspense=function(a){return c(a)===g};b.isSuspenseList=function(a){return c(a)===h};b.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===e||a===f||a===g||a===h||a===u||"object"===typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===n||a.$$typeof===p||a.$$typeof===k||a.$$typeof===l||a.$$typeof===v||void 0!==a.getModuleId)?!0:!1}; +b.typeOf=c}); +})(); diff --git a/node_modules/jest-circus/node_modules/stack-utils/index.js b/node_modules/jest-circus/node_modules/stack-utils/index.js deleted file mode 100644 index ed14bd385..000000000 --- a/node_modules/jest-circus/node_modules/stack-utils/index.js +++ /dev/null @@ -1,338 +0,0 @@ -'use strict'; - -const escapeStringRegexp = require('escape-string-regexp'); - -const cwd = typeof process === 'object' && process && typeof process.cwd === 'function' - ? process.cwd() - : '.' - -const natives = [].concat( - require('module').builtinModules, - 'bootstrap_node', - 'node', -).map(n => new RegExp(`(?:\\((?:node:)?${n}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${n}(?:\\.js)?:\\d+:\\d+$)`)); - -natives.push( - /\((?:node:)?internal\/[^:]+:\d+:\d+\)$/, - /\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/, - /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/ -); - -class StackUtils { - constructor (opts) { - opts = { - ignoredPackages: [], - ...opts - }; - - if ('internals' in opts === false) { - opts.internals = StackUtils.nodeInternals(); - } - - if ('cwd' in opts === false) { - opts.cwd = cwd - } - - this._cwd = opts.cwd.replace(/\\/g, '/'); - this._internals = [].concat( - opts.internals, - ignoredPackagesRegExp(opts.ignoredPackages) - ); - - this._wrapCallSite = opts.wrapCallSite || false; - } - - static nodeInternals () { - return [...natives]; - } - - clean (stack, indent = 0) { - indent = ' '.repeat(indent); - - if (!Array.isArray(stack)) { - stack = stack.split('\n'); - } - - if (!(/^\s*at /.test(stack[0])) && (/^\s*at /.test(stack[1]))) { - stack = stack.slice(1); - } - - let outdent = false; - let lastNonAtLine = null; - const result = []; - - stack.forEach(st => { - st = st.replace(/\\/g, '/'); - - if (this._internals.some(internal => internal.test(st))) { - return; - } - - const isAtLine = /^\s*at /.test(st); - - if (outdent) { - st = st.trimEnd().replace(/^(\s+)at /, '$1'); - } else { - st = st.trim(); - if (isAtLine) { - st = st.slice(3); - } - } - - st = st.replace(`${this._cwd}/`, ''); - - if (st) { - if (isAtLine) { - if (lastNonAtLine) { - result.push(lastNonAtLine); - lastNonAtLine = null; - } - - result.push(st); - } else { - outdent = true; - lastNonAtLine = st; - } - } - }); - - return result.map(line => `${indent}${line}\n`).join(''); - } - - captureString (limit, fn = this.captureString) { - if (typeof limit === 'function') { - fn = limit; - limit = Infinity; - } - - const {stackTraceLimit} = Error; - if (limit) { - Error.stackTraceLimit = limit; - } - - const obj = {}; - - Error.captureStackTrace(obj, fn); - const {stack} = obj; - Error.stackTraceLimit = stackTraceLimit; - - return this.clean(stack); - } - - capture (limit, fn = this.capture) { - if (typeof limit === 'function') { - fn = limit; - limit = Infinity; - } - - const {prepareStackTrace, stackTraceLimit} = Error; - Error.prepareStackTrace = (obj, site) => { - if (this._wrapCallSite) { - return site.map(this._wrapCallSite); - } - - return site; - }; - - if (limit) { - Error.stackTraceLimit = limit; - } - - const obj = {}; - Error.captureStackTrace(obj, fn); - const { stack } = obj; - Object.assign(Error, {prepareStackTrace, stackTraceLimit}); - - return stack; - } - - at (fn = this.at) { - const [site] = this.capture(1, fn); - - if (!site) { - return {}; - } - - const res = { - line: site.getLineNumber(), - column: site.getColumnNumber() - }; - - setFile(res, site.getFileName(), this._cwd); - - if (site.isConstructor()) { - res.constructor = true; - } - - if (site.isEval()) { - res.evalOrigin = site.getEvalOrigin(); - } - - // Node v10 stopped with the isNative() on callsites, apparently - /* istanbul ignore next */ - if (site.isNative()) { - res.native = true; - } - - let typename; - try { - typename = site.getTypeName(); - } catch (_) { - } - - if (typename && typename !== 'Object' && typename !== '[object Object]') { - res.type = typename; - } - - const fname = site.getFunctionName(); - if (fname) { - res.function = fname; - } - - const meth = site.getMethodName(); - if (meth && fname !== meth) { - res.method = meth; - } - - return res; - } - - parseLine (line) { - const match = line && line.match(re); - if (!match) { - return null; - } - - const ctor = match[1] === 'new'; - let fname = match[2]; - const evalOrigin = match[3]; - const evalFile = match[4]; - const evalLine = Number(match[5]); - const evalCol = Number(match[6]); - let file = match[7]; - const lnum = match[8]; - const col = match[9]; - const native = match[10] === 'native'; - const closeParen = match[11] === ')'; - let method; - - const res = {}; - - if (lnum) { - res.line = Number(lnum); - } - - if (col) { - res.column = Number(col); - } - - if (closeParen && file) { - // make sure parens are balanced - // if we have a file like "asdf) [as foo] (xyz.js", then odds are - // that the fname should be += " (asdf) [as foo]" and the file - // should be just "xyz.js" - // walk backwards from the end to find the last unbalanced ( - let closes = 0; - for (let i = file.length - 1; i > 0; i--) { - if (file.charAt(i) === ')') { - closes++; - } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') { - closes--; - if (closes === -1 && file.charAt(i - 1) === ' ') { - const before = file.slice(0, i - 1); - const after = file.slice(i + 1); - file = after; - fname += ` (${before}`; - break; - } - } - } - } - - if (fname) { - const methodMatch = fname.match(methodRe); - if (methodMatch) { - fname = methodMatch[1]; - method = methodMatch[2]; - } - } - - setFile(res, file, this._cwd); - - if (ctor) { - res.constructor = true; - } - - if (evalOrigin) { - res.evalOrigin = evalOrigin; - res.evalLine = evalLine; - res.evalColumn = evalCol; - res.evalFile = evalFile && evalFile.replace(/\\/g, '/'); - } - - if (native) { - res.native = true; - } - - if (fname) { - res.function = fname; - } - - if (method && fname !== method) { - res.method = method; - } - - return res; - } -} - -function setFile (result, filename, cwd) { - if (filename) { - filename = filename.replace(/\\/g, '/'); - if (filename.startsWith(`${cwd}/`)) { - filename = filename.slice(cwd.length + 1); - } - - result.file = filename; - } -} - -function ignoredPackagesRegExp(ignoredPackages) { - if (ignoredPackages.length === 0) { - return []; - } - - const packages = ignoredPackages.map(mod => escapeStringRegexp(mod)); - - return new RegExp(`[\/\\\\]node_modules[\/\\\\](?:${packages.join('|')})[\/\\\\][^:]+:\\d+:\\d+`) -} - -const re = new RegExp( - '^' + - // Sometimes we strip out the ' at' because it's noisy - '(?:\\s*at )?' + - // $1 = ctor if 'new' - '(?:(new) )?' + - // $2 = function name (can be literally anything) - // May contain method at the end as [as xyz] - '(?:(.*?) \\()?' + - // (eval at (file.js:1:1), - // $3 = eval origin - // $4:$5:$6 are eval file/line/col, but not normally reported - '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' + - // file:line:col - // $7:$8:$9 - // $10 = 'native' if native - '(?:(.+?):(\\d+):(\\d+)|(native))' + - // maybe close the paren, then end - // if $11 is ), then we only allow balanced parens in the filename - // any imbalance is placed on the fname. This is a heuristic, and - // bound to be incorrect in some edge cases. The bet is that - // having weird characters in method names is more common than - // having weird characters in filenames, which seems reasonable. - '(\\)?)$' -); - -const methodRe = /^(.*?) \[as (.*?)\]$/; - -module.exports = StackUtils; diff --git a/node_modules/jest-circus/node_modules/stack-utils/license b/node_modules/jest-circus/node_modules/stack-utils/license deleted file mode 100644 index 28441ca9f..000000000 --- a/node_modules/jest-circus/node_modules/stack-utils/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Isaac Z. Schlueter , James Talmage (github.com/jamestalmage), and Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/jest-circus/node_modules/stack-utils/package.json b/node_modules/jest-circus/node_modules/stack-utils/package.json deleted file mode 100644 index 565acf6ef..000000000 --- a/node_modules/jest-circus/node_modules/stack-utils/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "stack-utils", - "version": "2.0.5", - "description": "Captures and cleans stack traces", - "license": "MIT", - "repository": "tapjs/stack-utils", - "author": { - "name": "James Talmage", - "email": "james@talmage.io", - "url": "github.com/jamestalmage" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "tap": { - "check-coverage": true - }, - "files": [ - "index.js" - ], - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "devDependencies": { - "bluebird": "^3.7.2", - "coveralls": "^3.0.9", - "nested-error-stacks": "^2.1.0", - "pify": "^4.0.1", - "q": "^1.5.1", - "source-map-support": "^0.5.20", - "tap": "^15.0.9" - } -} diff --git a/node_modules/jest-circus/node_modules/stack-utils/readme.md b/node_modules/jest-circus/node_modules/stack-utils/readme.md deleted file mode 100644 index c91f9d053..000000000 --- a/node_modules/jest-circus/node_modules/stack-utils/readme.md +++ /dev/null @@ -1,143 +0,0 @@ -# stack-utils - -> Captures and cleans stack traces. - -[![Linux Build](https://travis-ci.org/tapjs/stack-utils.svg?branch=master)](https://travis-ci.org/tapjs/stack-utils) [![Build status](https://ci.appveyor.com/api/projects/status/fb9i157knoixe3iq/branch/master?svg=true)](https://ci.appveyor.com/project/jamestalmage/stack-utils-oiw96/branch/master) [![Coverage](https://coveralls.io/repos/tapjs/stack-utils/badge.svg?branch=master&service=github)](https://coveralls.io/github/tapjs/stack-utils?branch=master) - - -Extracted from `lib/stack.js` in the [`node-tap` project](https://github.com/tapjs/node-tap) - -## Install - -``` -$ npm install --save stack-utils -``` - - -## Usage - -```js -const StackUtils = require('stack-utils'); -const stack = new StackUtils({cwd: process.cwd(), internals: StackUtils.nodeInternals()}); - -console.log(stack.clean(new Error().stack)); -// outputs a beautified stack trace -``` - - -## API - - -### new StackUtils([options]) - -Creates a new `stackUtils` instance. - -#### options - -##### internals - -Type: `array` of `RegularExpression`s - -A set of regular expressions that match internal stack stack trace lines which should be culled from the stack trace. -The default is `StackUtils.nodeInternals()`, this can be disabled by setting `[]` or appended using -`StackUtils.nodeInternals().concat(additionalRegExp)`. See also `ignoredPackages`. - -##### ignoredPackages - -Type: `array` of `string`s - -An array of npm modules to be culled from the stack trace. This list will mapped to regular -expressions and merged with the `internals`. - -Default `''`. - -##### cwd - -Type: `string` - -The path to the current working directory. File names in the stack trace will be shown relative to this directory. - -##### wrapCallSite - -Type: `function(CallSite)` - -A mapping function for manipulating CallSites before processing. The first argument is a CallSite instance, and the function should return a modified CallSite. This is useful for providing source map support. - - -### StackUtils.nodeInternals() - -Returns an array of regular expressions that be used to cull lines from the stack trace that reference common Node.js internal files. - - -### stackUtils.clean(stack, indent = 0) - -Cleans up a stack trace by deleting any lines that match the `internals` passed to the constructor, and shortening file names relative to `cwd`. - -Returns a `string` with the cleaned up stack (always terminated with a `\n` newline character). -Spaces at the start of each line are trimmed, indentation can be added by setting `indent` to the desired number of spaces. - -#### stack - -*Required* -Type: `string` or an `array` of `string`s - - -### stackUtils.capture([limit], [startStackFunction]) - -Captures the current stack trace, returning an array of `CallSite`s. There are good overviews of the available CallSite methods [here](https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces), and [here](https://github.com/sindresorhus/callsites#api). - -#### limit - -Type: `number` -Default: `Infinity` - -Limits the number of lines returned by dropping all lines in excess of the limit. This removes lines from the stack trace. - -#### startStackFunction - -Type: `function` - -The function where the stack trace should start. The first line of the stack trace will be the function that called `startStackFunction`. This removes lines from the end of the stack trace. - - -### stackUtils.captureString([limit], [startStackFunction]) - -Captures the current stack trace, cleans it using `stackUtils.clean(stack)`, and returns a string with the cleaned stack trace. It takes the same arguments as `stackUtils.capture`. - - -### stackUtils.at([startStackFunction]) - -Captures the first line of the stack trace (or the first line after `startStackFunction` if supplied), and returns a `CallSite` like object that is serialization friendly (properties are actual values instead of getter functions). - -The available properties are: - - - `line`: `number` - - `column`: `number` - - `file`: `string` - - `constructor`: `boolean` - - `evalOrigin`: `string` - - `native`: `boolean` - - `type`: `string` - - `function`: `string` - - `method`: `string` - -### stackUtils.parseLine(line) - -Parses a `string` (which should be a single line from a stack trace), and generates an object with the following properties: - - - `line`: `number` - - `column`: `number` - - `file`: `string` - - `constructor`: `boolean` - - `evalOrigin`: `string` - - `evalLine`: `number` - - `evalColumn`: `number` - - `evalFile`: `string` - - `native`: `boolean` - - `function`: `string` - - `method`: `string` - - -## License - -MIT © [Isaac Z. Schlueter](http://github.com/isaacs), [James Talmage](http://github.com/jamestalmage) diff --git a/node_modules/jest-circus/package.json b/node_modules/jest-circus/package.json index 8ea4112c6..5a8f80700 100644 --- a/node_modules/jest-circus/package.json +++ b/node_modules/jest-circus/package.json @@ -1,6 +1,6 @@ { "name": "jest-circus", - "version": "27.5.1", + "version": "28.0.1", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -18,30 +18,30 @@ "./runner": "./runner.js" }, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/environment": "^28.0.1", + "@jest/expect": "^28.0.1", + "@jest/test-result": "^28.0.1", + "@jest/types": "^28.0.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", - "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-runtime": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", - "pretty-format": "^27.5.1", + "jest-each": "^28.0.1", + "jest-matcher-utils": "^28.0.1", + "jest-message-util": "^28.0.1", + "jest-runtime": "^28.0.1", + "jest-snapshot": "^28.0.1", + "jest-util": "^28.0.1", + "pretty-format": "^28.0.1", "slash": "^3.0.0", "stack-utils": "^2.0.3", "throat": "^6.0.1" }, "devDependencies": { - "@babel/core": "^7.1.0", + "@babel/core": "^7.11.6", "@babel/register": "^7.0.0", - "@types/co": "^4.6.0", + "@types/co": "^4.6.2", "@types/dedent": "^0.7.0", "@types/graceful-fs": "^4.1.3", "@types/stack-utils": "^2.0.0", @@ -49,10 +49,10 @@ "graceful-fs": "^4.2.9" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" + "gitHead": "0a08639e4299f07becf1020a761adfec83536018" } diff --git a/node_modules/jest-circus/runner.js b/node_modules/jest-circus/runner.js index cb1360dae..f61fd8882 100644 --- a/node_modules/jest-circus/runner.js +++ b/node_modules/jest-circus/runner.js @@ -6,5 +6,5 @@ */ // Allow people to use `jest-circus/runner` as a runner. -const runner = require('./build/legacy-code-todo-rewrite/jestAdapter'); +const runner = require('./build/legacy-code-todo-rewrite/jestAdapter').default; module.exports = runner; diff --git a/node_modules/jest-each/build/bind.d.ts b/node_modules/jest-each/build/bind.d.ts deleted file mode 100644 index 1bce7a37d..000000000 --- a/node_modules/jest-each/build/bind.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { Global } from '@jest/types'; -export declare type EachTests = ReadonlyArray<{ - title: string; - arguments: ReadonlyArray; -}>; -declare type GlobalCallback = (testName: string, fn: Global.ConcurrentTestFn, timeout?: number) => void; -export default function bind(cb: GlobalCallback, supportsDone?: boolean): (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; -export {}; diff --git a/node_modules/jest-each/build/bind.js b/node_modules/jest-each/build/bind.js index 5514ed47b..ff82bc2cf 100644 --- a/node_modules/jest-each/build/bind.js +++ b/node_modules/jest-each/build/bind.js @@ -35,6 +35,8 @@ function _interopRequireDefault(obj) { function bind(cb, supportsDone = true) { return (table, ...taggedTemplateData) => function eachBind(title, test, timeout) { + title = (0, _jestUtil().convertDescriptorToString)(title); + try { const tests = isArrayTable(taggedTemplateData) ? buildArrayTests(title, table) diff --git a/node_modules/jest-each/build/index.d.ts b/node_modules/jest-each/build/index.d.ts index 31fa8d29c..de0dfbaf4 100644 --- a/node_modules/jest-each/build/index.d.ts +++ b/node_modules/jest-each/build/index.d.ts @@ -3,77 +3,264 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * */ -import type { Global } from '@jest/types'; -import bind from './bind'; -declare type Global = Global.Global; -declare const install: (g: Global, table: Global.EachTable, ...data: Global.TemplateData) => { +import type {Global} from '@jest/types'; + +export declare function bind( + cb: GlobalCallback, + supportsDone?: boolean, +): ( + table: Global.EachTable, + ...taggedTemplateData: Global.TemplateData +) => ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, +) => void; + +declare const each: { + (table: Global.EachTable, ...data: Global.TemplateData): ReturnType< + typeof install + >; + withGlobal(g: Global): ( + table: Global.EachTable, + ...data: Global.TemplateData + ) => { describe: { - (title: string, suite: Global.EachTestFn, timeout?: number | undefined): void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; + ( + title: string, + suite: Global.EachTestFn, + timeout?: number | undefined, + ): void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; }; - fdescribe: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - fit: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; + fdescribe: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + fit: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; it: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - concurrent: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + concurrent: { + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; }; test: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - concurrent: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + concurrent: { + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; }; - xdescribe: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - xit: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - xtest: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; + xdescribe: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + xit: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + xtest: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; }; -declare const each: { - (table: Global.EachTable, ...data: Global.TemplateData): ReturnType; - withGlobal(g: Global): (table: Global.EachTable, ...data: Global.TemplateData) => { - describe: { - (title: string, suite: Global.EachTestFn, timeout?: number | undefined): void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; - fdescribe: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - fit: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - it: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - concurrent: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; - }; - test: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - concurrent: { - (title: string, test: Global.EachTestFn, timeout?: number | undefined): void; - only: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - skip: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - }; - }; - xdescribe: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - xit: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; - xtest: (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; +export default each; + +declare type GlobalCallback = ( + testName: string, + fn: Global.ConcurrentTestFn, + timeout?: number, +) => void; + +declare const install: ( + g: Global, + table: Global.EachTable, + ...data: Global.TemplateData +) => { + describe: { + ( + title: string, + suite: Global.EachTestFn, + timeout?: number | undefined, + ): void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; + fdescribe: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + fit: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + it: { + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + concurrent: { + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + }; + }; + test: { + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + concurrent: { + ( + title: string, + test: Global.EachTestFn, + timeout?: number | undefined, + ): void; + only: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + skip: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; }; + }; + xdescribe: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + xit: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; + xtest: ( + title: Global.BlockNameLike, + test: Global.EachTestFn, + timeout?: number | undefined, + ) => void; }; -export { bind }; -export default each; + +export {}; diff --git a/node_modules/jest-each/build/index.js b/node_modules/jest-each/build/index.js index 6d7809dbf..3f779b8a1 100644 --- a/node_modules/jest-each/build/index.js +++ b/node_modules/jest-each/build/index.js @@ -86,7 +86,7 @@ const install = (g, table, ...data) => { }; }; -const each = (table, ...data) => install(global, table, ...data); +const each = (table, ...data) => install(globalThis, table, ...data); each.withGlobal = g => diff --git a/node_modules/jest-each/build/table/array.d.ts b/node_modules/jest-each/build/table/array.d.ts deleted file mode 100644 index a2f4cfbf0..000000000 --- a/node_modules/jest-each/build/table/array.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -import type { Global } from '@jest/types'; -import type { EachTests } from '../bind'; -export default function array(title: string, arrayTable: Global.ArrayTable): EachTests; diff --git a/node_modules/jest-each/build/table/array.js b/node_modules/jest-each/build/table/array.js index c687c819a..996e830f9 100644 --- a/node_modules/jest-each/build/table/array.js +++ b/node_modules/jest-each/build/table/array.js @@ -76,7 +76,7 @@ function _interopRequireWildcard(obj, nodeInterop) { * LICENSE file in the root directory of this source tree. * */ -const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp]/g; +const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp#]/g; const PRETTY_PLACEHOLDER = '%p'; const INDEX_PLACEHOLDER = '%#'; const PLACEHOLDER_PREFIX = '%'; diff --git a/node_modules/jest-each/build/table/interpolation.d.ts b/node_modules/jest-each/build/table/interpolation.d.ts deleted file mode 100644 index 73195062d..000000000 --- a/node_modules/jest-each/build/table/interpolation.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ -export declare type Template = Record; -export declare type Templates = Array