diff --git a/package-lock.json b/package-lock.json index c4e9f7f82c..2896a482ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5129,16 +5129,6 @@ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "license": "MIT" }, - "node_modules/@tsd/typescript": { - "version": "5.8.3", - "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.8.3.tgz", - "integrity": "sha512-oKarNCN1QUhG148M88mtZdOlBZWWGcInquef+U8QL7gwJkRuNo5WS45Fjsd+3hM9cDJWGpqSZ4Oo097KDx4IWA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.17" - } - }, "node_modules/@tufjs/canonical-json": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz", @@ -5210,17 +5200,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/eslint": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", - "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -10729,188 +10708,6 @@ "eslint": ">=7.0.0" } }, - "node_modules/eslint-formatter-pretty": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz", - "integrity": "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/eslint": "^7.2.13", - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "eslint-rule-docs": "^1.1.5", - "log-symbols": "^4.0.0", - "plur": "^4.0.0", - "string-width": "^4.2.0", - "supports-hyperlinks": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-formatter-pretty/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, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/eslint-formatter-pretty/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/plur": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", - "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", - "dev": true, - "license": "MIT", - "dependencies": { - "irregular-plurals": "^3.2.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -11246,13 +11043,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-rule-docs": { - "version": "1.1.235", - "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", - "integrity": "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A==", - "dev": true, - "license": "MIT" - }, "node_modules/eslint-scope": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", @@ -21334,33 +21124,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/supports-hyperlinks": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", - "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -21881,270 +21644,6 @@ "node": ">=4" } }, - "node_modules/tsd": { - "version": "0.32.0", - "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.32.0.tgz", - "integrity": "sha512-R5lBZCbxGBowOcW0gpQaiIjGYrG5NmU+PfFDKcc3zbtzWjML1o/zAwzdDnS2ZheSlPu9GW51azpFqEPUBq9DoQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@tsd/typescript": "~5.8.3", - "eslint-formatter-pretty": "^4.1.0", - "globby": "^11.0.1", - "jest-diff": "^29.0.3", - "meow": "^9.0.0", - "path-exists": "^4.0.0", - "read-pkg-up": "^7.0.0" - }, - "bin": { - "tsd": "dist/cli.js" - }, - "engines": { - "node": ">=14.16" - } - }, - "node_modules/tsd/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tsd/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "license": "ISC" - }, - "node_modules/tsd/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/meow": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", - "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize": "^1.2.0", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tsd/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tsd/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tsd/node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/tsd/node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/resolve": { - "version": "1.22.10", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", - "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.16.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/tsd/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/tsd/node_modules/type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tsd/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -23793,7 +23292,6 @@ "process-exists": "^5.0.0", "tinyspy": "^4.0.3", "tmp-promise": "^3.0.2", - "tsd": "^0.32.0", "vitest": "^3.0.0", "yarn": "^1.22.22" }, diff --git a/packages/build/package.json b/packages/build/package.json index 8ec2c7f86e..86a5207aaa 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -25,11 +25,11 @@ "prebuild": "rm -rf lib", "postbuild": "npx cpy \"src/**/*.yml\" \"lib/\"", "build": "tsc", - "test:types": "tsd", - "test": "ava && tsd && vitest run", + "test:types": "vitest --typecheck", + "test": "ava && vitest --typecheck && vitest run", "test:dev": "ava -w", "test:ci": "run-p test:ci:*", - "test:ci:types": "tsd", + "test:ci:types": "vitest --typecheck", "test:ci:ava": "c8 -r lcovonly -r text -r json ava", "test:ci:vitest": "vitest run" }, @@ -135,7 +135,6 @@ "process-exists": "^5.0.0", "tinyspy": "^4.0.3", "tmp-promise": "^3.0.2", - "tsd": "^0.32.0", "vitest": "^3.0.0", "yarn": "^1.22.22" }, diff --git a/packages/build/test-d/config/build.test-d.ts b/packages/build/test-d/config/build.test-d.ts new file mode 100644 index 0000000000..427f9f11ff --- /dev/null +++ b/packages/build/test-d/config/build.test-d.ts @@ -0,0 +1,32 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('netlifyConfig.build types', () => { + const handler: OnPreBuild = ({ netlifyConfig: { build } }) => { + expectTypeOf(build.command).toEqualTypeOf() + expectTypeOf(build.publish).toEqualTypeOf() + expectTypeOf(build.base).toEqualTypeOf() + expectTypeOf(build.services.testVar).toEqualTypeOf() + expectTypeOf(build.ignore).toEqualTypeOf() + expectTypeOf(build.edge_handlers).toEqualTypeOf() + expectTypeOf(build.environment.TEST_VAR).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('netlifyConfig.build.processing types', () => { + const handler: OnPreBuild = ({ + netlifyConfig: { + build: { processing }, + }, + }) => { + expectTypeOf(processing.skip_processing).toEqualTypeOf() + expectTypeOf(processing.css.bundle).toEqualTypeOf() + expectTypeOf(processing.css.minify).toEqualTypeOf() + expectTypeOf(processing.js.bundle).toEqualTypeOf() + expectTypeOf(processing.js.minify).toEqualTypeOf() + expectTypeOf(processing.html.pretty_url).toEqualTypeOf() + expectTypeOf(processing.images.compress).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/config/build.ts b/packages/build/test-d/config/build.ts deleted file mode 100644 index d2662f9f19..0000000000 --- a/packages/build/test-d/config/build.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { OnPreBuild } from '@netlify/build' -import { expectType } from 'tsd' - -export const testNetlifyConfigBuild: OnPreBuild = function ({ netlifyConfig: { build } }) { - expectType(build.command) - expectType(build.publish) - expectType(build.base) - expectType(build.services.testVar) - expectType(build.ignore) - expectType(build.edge_handlers) - expectType(build.environment.TEST_VAR) -} - -export const testNetlifyConfigBuildProcessing: OnPreBuild = function ({ - netlifyConfig: { - build: { processing }, - }, -}) { - expectType(processing.skip_processing) - expectType(processing.css.bundle) - expectType(processing.css.minify) - expectType(processing.js.bundle) - expectType(processing.js.minify) - expectType(processing.html.pretty_url) - expectType(processing.images.compress) -} diff --git a/packages/build/test-d/config/functions.test-d.ts b/packages/build/test-d/config/functions.test-d.ts new file mode 100644 index 0000000000..bdde7ae906 --- /dev/null +++ b/packages/build/test-d/config/functions.test-d.ts @@ -0,0 +1,22 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('netlifyConfig.functions types', () => { + const handler: OnPreBuild = ({ + netlifyConfig: { + functions: { '*': functions }, + }, + }) => { + expectTypeOf(functions.node_bundler).toExtend() + expectTypeOf(functions.included_files).toEqualTypeOf() + + if (functions.node_bundler === 'esbuild') { + expectTypeOf(functions.external_node_modules).toEqualTypeOf() + expectTypeOf(functions.ignored_node_modules).toEqualTypeOf() + } else { + expectTypeOf(functions).not.toHaveProperty('external_node_modules') + expectTypeOf(functions).not.toHaveProperty('ignored_node_modules') + } + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/config/functions.ts b/packages/build/test-d/config/functions.ts deleted file mode 100644 index d971b2d8dc..0000000000 --- a/packages/build/test-d/config/functions.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { OnPreBuild } from '@netlify/build' -import { expectAssignable, expectType, expectError } from 'tsd' - -export const testNetlifyConfigFunctions: OnPreBuild = function ({ - netlifyConfig: { - functions: { '*': functions }, - }, -}) { - expectAssignable(functions.node_bundler) - expectType(functions.included_files) - - if (functions.node_bundler === 'esbuild') { - expectType(functions.external_node_modules) - expectType(functions.ignored_node_modules) - } else { - expectError(functions.external_node_modules) - expectError(functions.ignored_node_modules) - } -} diff --git a/packages/build/test-d/config/inputs.test-d.ts b/packages/build/test-d/config/inputs.test-d.ts new file mode 100644 index 0000000000..831f4a1f9b --- /dev/null +++ b/packages/build/test-d/config/inputs.test-d.ts @@ -0,0 +1,31 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' +import type { JSONValue } from '../../src/types/utils/json_value.js' + +test('inputs generic types', () => { + const handler: OnPreBuild = (ctx) => { + expectTypeOf(ctx.inputs.testVar).toExtend() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('inputs specific types', () => { + const handler: OnPreBuild<{ testVar: boolean }> = (ctx) => { + expectTypeOf(ctx.inputs.testVar).toEqualTypeOf() + expectTypeOf(ctx.inputs).not.toHaveProperty('otherTestVar') + } + expectTypeOf(handler).toEqualTypeOf>() +}) + +test('inputs interface types', () => { + interface InputsInterface { + testVar: string + } + + const handler: OnPreBuild = (ctx) => { + expectTypeOf(ctx.inputs.testVar).toEqualTypeOf() + expectTypeOf(ctx.inputs).not.toHaveProperty('otherTestVar') + } + + expectTypeOf(handler).toEqualTypeOf>() +}) diff --git a/packages/build/test-d/config/inputs.ts b/packages/build/test-d/config/inputs.ts deleted file mode 100644 index b3a8430802..0000000000 --- a/packages/build/test-d/config/inputs.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { OnPreBuild } from '@netlify/build' -import { expectAssignable, expectError, expectType } from 'tsd' -import type { JSONValue } from '../../lib/types/utils/json_value.js' - -export const testGenericInputs: OnPreBuild = function ({ inputs }) { - expectAssignable(inputs.testVar) -} - -export const testSpecificInputs: OnPreBuild<{ testVar: boolean }> = function ({ inputs }) { - expectType(inputs.testVar) - expectError(inputs.otherTestVar) -} - -interface InputsInterface { - testVar: string -} - -export const testSpecificInputsInterface: OnPreBuild = function ({ inputs }) { - expectType(inputs.testVar) - expectError(inputs.otherTestVar) -} diff --git a/packages/build/test-d/config/netlify_config.test-d.ts b/packages/build/test-d/config/netlify_config.test-d.ts new file mode 100644 index 0000000000..fbff8ce746 --- /dev/null +++ b/packages/build/test-d/config/netlify_config.test-d.ts @@ -0,0 +1,65 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' +import type { JSONValue } from '../../src/types/utils/json_value.js' + +test('netlifyConfig.plugins types', () => { + const handler: OnPreBuild = (ctx) => { + const [plugin] = ctx.netlifyConfig.plugins + + expectTypeOf(plugin.package).toEqualTypeOf() + expectTypeOf(plugin.inputs.testVar).toEqualTypeOf() + } + + expectTypeOf(handler).toEqualTypeOf() +}) + +test('netlifyConfig.edge_functions types', () => { + const handler: OnPreBuild = (ctx) => { + const [edgeFunction] = ctx.netlifyConfig.edge_functions + + expectTypeOf(edgeFunction.path).toExtend() + expectTypeOf(edgeFunction.function).toEqualTypeOf() + } + + expectTypeOf(handler).toEqualTypeOf() +}) + +test('netlifyConfig.headers types', () => { + const handler: OnPreBuild = (ctx) => { + const [header] = ctx.netlifyConfig.headers + + expectTypeOf(header.for).toEqualTypeOf() + expectTypeOf(header.values.testVar).toEqualTypeOf() + } + + expectTypeOf(handler).toEqualTypeOf() +}) + +test('netlifyConfig.redirects types', () => { + const handler: OnPreBuild = (ctx) => { + const [redirect] = ctx.netlifyConfig.redirects + + expectTypeOf(redirect.from).toEqualTypeOf() + expectTypeOf(redirect.to).toEqualTypeOf() + expectTypeOf(redirect.status).toEqualTypeOf() + expectTypeOf(redirect.force).toEqualTypeOf() + expectTypeOf(redirect.signed).toEqualTypeOf() + + if (redirect.query !== undefined) { + expectTypeOf(redirect.query.testVar).toEqualTypeOf() + } + + if (redirect.headers !== undefined) { + expectTypeOf(redirect.headers.testVar).toEqualTypeOf() + } + + if (redirect.conditions !== undefined) { + expectTypeOf(redirect.conditions.Language).toEqualTypeOf() + expectTypeOf(redirect.conditions.Cookie).toEqualTypeOf() + expectTypeOf(redirect.conditions.Country).toEqualTypeOf() + expectTypeOf(redirect.conditions.Role).toEqualTypeOf() + } + } + + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/config/netlify_config.ts b/packages/build/test-d/config/netlify_config.ts deleted file mode 100644 index 956d0d07b1..0000000000 --- a/packages/build/test-d/config/netlify_config.ts +++ /dev/null @@ -1,58 +0,0 @@ -import type { OnPreBuild, NetlifyConfig } from '@netlify/build' -import { expectAssignable, expectType } from 'tsd' -import type { JSONValue } from '../../lib/types/utils/json_value.js' - -export const testNetlifyConfigPlugins: OnPreBuild = function ({ - netlifyConfig: { - plugins: [plugin], - }, -}: { - netlifyConfig: NetlifyConfig -}) { - expectType(plugin.package) - expectType(plugin.inputs.testVar) -} - -export const testNetlifyConfigEdgeHandlers: OnPreBuild = function ({ - netlifyConfig: { - edge_functions: [edgeFunction], - }, -}: { - netlifyConfig: NetlifyConfig -}) { - expectAssignable(edgeFunction.path) - expectType(edgeFunction.function) -} - -export const testNetlifyConfigHeaders: OnPreBuild = function ({ - netlifyConfig: { - headers: [header], - }, -}: { - netlifyConfig: NetlifyConfig -}) { - expectType(header.for) - expectType(header.values.testVar) -} - -export const testNetlifyConfigRedirects: OnPreBuild = function ({ - netlifyConfig: { - redirects: [redirect], - }, -}: { - netlifyConfig: NetlifyConfig -}) { - expectType(redirect.from) - expectType(redirect.to) - expectType(redirect.status) - expectType(redirect.force) - expectType(redirect.signed) - expectType(redirect.query && redirect.query.testVar) - expectType(redirect.headers && redirect.headers.testVar) - if (redirect.conditions !== undefined) { - expectType(redirect.conditions.Language) - expectType(redirect.conditions.Cookie) - expectType(redirect.conditions.Country) - expectType(redirect.conditions.Role) - } -} diff --git a/packages/build/test-d/netlify_plugin.test-d.ts b/packages/build/test-d/netlify_plugin.test-d.ts new file mode 100644 index 0000000000..db3b2b5742 --- /dev/null +++ b/packages/build/test-d/netlify_plugin.test-d.ts @@ -0,0 +1,37 @@ +import type { NetlifyPlugin, OnPreBuild, OnBuild, OnPostBuild, OnError, OnSuccess, OnEnd } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('events noop types', () => { + const noop = () => {} + + expectTypeOf(noop).toExtend() + expectTypeOf(noop).toExtend() + expectTypeOf(noop).toExtend() + expectTypeOf(noop).toExtend() + expectTypeOf(noop).toExtend() + expectTypeOf(noop).toExtend() + + const plugin: NetlifyPlugin = { + onPreBuild: noop, + onBuild: noop, + onPostBuild: noop, + onError: noop, + onSuccess: noop, + onEnd: noop, + } + expectTypeOf(plugin).toEqualTypeOf() +}) + +test('onError argument types', () => { + const handler: OnError = ({ error }) => { + expectTypeOf(error).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('onEnd argument types', () => { + const handler: OnEnd = ({ error }) => { + expectTypeOf(error).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/netlify_plugin.ts b/packages/build/test-d/netlify_plugin.ts deleted file mode 100644 index a551d9788d..0000000000 --- a/packages/build/test-d/netlify_plugin.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { NetlifyPlugin, OnPreBuild, OnBuild, OnPostBuild, OnError, OnSuccess, OnEnd } from '@netlify/build' -import { expectAssignable, expectType } from 'tsd' - -export const testEventNames = function () { - expectAssignable(noop) - expectAssignable(noop) - expectAssignable(noop) - expectAssignable(noop) - expectAssignable(noop) - expectAssignable(noop) - expectAssignable(noop) -} - -const noop = function () {} - -export const testOnError: OnError = function ({ error }) { - expectType(error) -} - -export const testOnEnd: OnEnd = function ({ error }) { - expectType(error) -} diff --git a/packages/build/test-d/netlify_plugin_options.test-d.ts b/packages/build/test-d/netlify_plugin_options.test-d.ts new file mode 100644 index 0000000000..08e3aee11e --- /dev/null +++ b/packages/build/test-d/netlify_plugin_options.test-d.ts @@ -0,0 +1,29 @@ +import type { NetlifyPluginConstants, NetlifyPluginOptions, OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' +import type { JSONValue } from '../src/types/utils/json_value.js' + +test('constants types', () => { + const handler: OnPreBuild = ({ constants }) => { + expectTypeOf(constants).toEqualTypeOf() + expectTypeOf(constants.CONFIG_PATH).toEqualTypeOf() + expectTypeOf(constants.PUBLISH_DIR).toEqualTypeOf() + expectTypeOf(constants.FUNCTIONS_SRC).toEqualTypeOf() + expectTypeOf(constants.INTERNAL_EDGE_FUNCTIONS_SRC).toEqualTypeOf() + expectTypeOf(constants.INTERNAL_FUNCTIONS_SRC).toEqualTypeOf() + expectTypeOf(constants.FUNCTIONS_DIST).toEqualTypeOf() + expectTypeOf(constants.EDGE_FUNCTIONS_SRC).toEqualTypeOf() + expectTypeOf(constants.EDGE_FUNCTIONS_DIST).toEqualTypeOf() + expectTypeOf(constants.IS_LOCAL).toEqualTypeOf() + expectTypeOf(constants.NETLIFY_BUILD_VERSION).toEqualTypeOf() + expectTypeOf(constants.SITE_ID).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('package.json types', () => { + const handler: OnPreBuild = ({ packageJson }) => { + expectTypeOf(packageJson).toEqualTypeOf() + expectTypeOf(packageJson.version).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/netlify_plugin_options.ts b/packages/build/test-d/netlify_plugin_options.ts deleted file mode 100644 index 97f01d713b..0000000000 --- a/packages/build/test-d/netlify_plugin_options.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { NetlifyPluginConstants, NetlifyPluginOptions, OnPreBuild } from '@netlify/build' -import { expectType } from 'tsd' -import type { JSONValue } from '../lib/types/utils/json_value.js' - -export const testConstants: OnPreBuild = function ({ constants }: { constants: NetlifyPluginConstants }) { - expectType(constants.CONFIG_PATH) - expectType(constants.PUBLISH_DIR) - expectType(constants.FUNCTIONS_SRC) - expectType(constants.INTERNAL_EDGE_FUNCTIONS_SRC) - expectType(constants.INTERNAL_FUNCTIONS_SRC) - expectType(constants.FUNCTIONS_DIST) - expectType(constants.EDGE_FUNCTIONS_SRC) - expectType(constants.EDGE_FUNCTIONS_DIST) - expectType(constants.IS_LOCAL) - expectType(constants.NETLIFY_BUILD_VERSION) - expectType(constants.SITE_ID) -} - -export const testPackageJson: OnPreBuild = function ({ packageJson }: NetlifyPluginOptions) { - expectType(packageJson.version) -} diff --git a/packages/build/test-d/options/netlify_plugin_build_util.test-d.ts b/packages/build/test-d/options/netlify_plugin_build_util.test-d.ts new file mode 100644 index 0000000000..3ede8390e2 --- /dev/null +++ b/packages/build/test-d/options/netlify_plugin_build_util.test-d.ts @@ -0,0 +1,29 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('utils.build.failBuild types', () => { + const handler: OnPreBuild = ({ utils }) => { + utils.build.failBuild('message') + utils.build.failBuild('message', {}) + utils.build.failBuild('message', { error: new Error('message') }) + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.build.failPlugin types', () => { + const handler: OnPreBuild = ({ utils }) => { + utils.build.failPlugin('message') + utils.build.failPlugin('message', {}) + utils.build.failPlugin('message', { error: new Error('message') }) + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.build.cancelBuild types', () => { + const handler: OnPreBuild = ({ utils }) => { + utils.build.cancelBuild('message') + utils.build.cancelBuild('message', {}) + utils.build.cancelBuild('message', { error: new Error('message') }) + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/options/netlify_plugin_build_util.ts b/packages/build/test-d/options/netlify_plugin_build_util.ts deleted file mode 100644 index 49afbf6fb6..0000000000 --- a/packages/build/test-d/options/netlify_plugin_build_util.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { OnPreBuild, NetlifyPluginUtils } from '@netlify/build' - -export const testUtilsBuildFailBuild: OnPreBuild = function ({ - utils: { - build: { failBuild }, - }, -}: { - utils: NetlifyPluginUtils -}) { - failBuild('message') - failBuild('message', {}) - failBuild('message', { error: new Error('message') }) -} - -export const testUtilsBuildFailPlugin: OnPreBuild = function ({ - utils: { - build: { failPlugin }, - }, -}: { - utils: NetlifyPluginUtils -}) { - failPlugin('message') - failPlugin('message', {}) - failPlugin('message', { error: new Error('message') }) -} - -export const testUtilsBuildCancelBuild: OnPreBuild = function ({ - utils: { - build: { cancelBuild }, - }, -}: { - utils: NetlifyPluginUtils -}) { - cancelBuild('message') - cancelBuild('message', {}) - cancelBuild('message', { error: new Error('message') }) -} diff --git a/packages/build/test-d/options/netlify_plugin_cache_util.test-d.ts b/packages/build/test-d/options/netlify_plugin_cache_util.test-d.ts new file mode 100644 index 0000000000..9f2358703e --- /dev/null +++ b/packages/build/test-d/options/netlify_plugin_cache_util.test-d.ts @@ -0,0 +1,67 @@ +import type { OnPreBuild, NetlifyPluginUtils } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('utils.cache.save types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.cache.save('file') + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf().toBeCallableWith('file') + expectTypeOf().toBeCallableWith(['file']) + expectTypeOf().toBeCallableWith('file', {}) + expectTypeOf().toBeCallableWith('file', { + ttl: 1, + digests: ['digest'], + cwd: '.', + }) + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.cache.list types', () => { + const handler: OnPreBuild = ({ utils }) => { + const r1 = utils.cache.list() + const r2 = utils.cache.list({}) + expectTypeOf(r1).toEqualTypeOf>() + expectTypeOf(r2).toEqualTypeOf>() + } + expectTypeOf().toBeCallableWith() + expectTypeOf().toBeCallableWith({}) + expectTypeOf().toBeCallableWith({ depth: 1, cwd: '.' }) + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.cache.restore types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.cache.restore('file') + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf().toBeCallableWith('file') + expectTypeOf().toBeCallableWith(['file']) + expectTypeOf().toBeCallableWith('file', {}) + expectTypeOf().toBeCallableWith('file', { cwd: '.' }) + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.cache.remove types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.cache.remove('file') + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf().toBeCallableWith('file') + expectTypeOf().toBeCallableWith(['file']) + expectTypeOf().toBeCallableWith('file', {}) + expectTypeOf().toBeCallableWith('file', { cwd: '.' }) + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.cache.has types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.cache.has('file') + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf().toBeCallableWith('file') + expectTypeOf().toBeCallableWith(['file']) + expectTypeOf().toBeCallableWith('file', {}) + expectTypeOf().toBeCallableWith('file', { cwd: '.' }) + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/options/netlify_plugin_cache_util.ts b/packages/build/test-d/options/netlify_plugin_cache_util.ts deleted file mode 100644 index 8b49c54f70..0000000000 --- a/packages/build/test-d/options/netlify_plugin_cache_util.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { OnPreBuild, NetlifyPluginUtils } from '@netlify/build' -import { expectType } from 'tsd' - -export const testUtilsCacheSave: OnPreBuild = function ({ - utils: { - cache: { save }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(save('file')) - save(['file']) - save('file', {}) - save('file', { ttl: 1, digests: ['digest'], cwd: '.' }) -} - -export const testUtilsCacheList: OnPreBuild = function ({ - utils: { - cache: { list }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(list({})) - list() - list({}) - list({ depth: 1, cwd: '.' }) -} - -export const testUtilsRestore: OnPreBuild = function ({ - utils: { - cache: { restore }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(restore('file')) - restore(['file']) - restore('file', {}) - restore('file', { cwd: '.' }) -} - -export const testUtilsCacheRemove: OnPreBuild = function ({ - utils: { - cache: { remove }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(remove('file')) - remove(['file']) - remove('file', {}) - remove('file', { cwd: '.' }) -} - -export const testUtilsCacheHas: OnPreBuild = function ({ - utils: { - cache: { has }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(has('file')) - has(['file']) - has('file', {}) - has('file', { cwd: '.' }) -} diff --git a/packages/build/test-d/options/netlify_plugin_functions_util.test-d.ts b/packages/build/test-d/options/netlify_plugin_functions_util.test-d.ts new file mode 100644 index 0000000000..111576d008 --- /dev/null +++ b/packages/build/test-d/options/netlify_plugin_functions_util.test-d.ts @@ -0,0 +1,26 @@ +import type { OnPreBuild, ListedFunction, ListedFunctionFile } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('utils.functions.list types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.functions.list() + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.functions.listAll types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.functions.listAll() + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.functions.add types', () => { + const handler: OnPreBuild = ({ utils }) => { + const ret = utils.functions.add('functionName') + expectTypeOf(ret).toEqualTypeOf>() + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/options/netlify_plugin_functions_util.ts b/packages/build/test-d/options/netlify_plugin_functions_util.ts deleted file mode 100644 index 3c9cf12bec..0000000000 --- a/packages/build/test-d/options/netlify_plugin_functions_util.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { OnPreBuild, NetlifyPluginUtils, ListedFunction, ListedFunctionFile } from '@netlify/build' -import { expectType } from 'tsd' - -export const testUtilsFunctionsList: OnPreBuild = function ({ - utils: { - functions: { list }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(list()) -} - -export const testUtilsListAll: OnPreBuild = function ({ - utils: { - functions: { listAll }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(listAll()) -} - -export const testUtilsFunctionsAdd: OnPreBuild = function ({ - utils: { - functions: { add }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType>(add('functionName')) -} diff --git a/packages/build/test-d/options/netlify_plugin_git_util.test-d.ts b/packages/build/test-d/options/netlify_plugin_git_util.test-d.ts new file mode 100644 index 0000000000..7b12b5ba88 --- /dev/null +++ b/packages/build/test-d/options/netlify_plugin_git_util.test-d.ts @@ -0,0 +1,34 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('utils.git types', () => { + const handler: OnPreBuild = ({ utils }) => { + const matched = utils.git.fileMatch('*') + expectTypeOf(matched).toEqualTypeOf() + + expectTypeOf(utils.git.modifiedFiles).toEqualTypeOf() + expectTypeOf(utils.git.createdFiles).toEqualTypeOf() + expectTypeOf(utils.git.deletedFiles).toEqualTypeOf() + + const loc = utils.git.linesOfCode() + expectTypeOf(loc).toEqualTypeOf>() + } + expectTypeOf(handler).toEqualTypeOf() +}) + +test('utils.git commits types', () => { + const handler: OnPreBuild = ({ utils }) => { + const [commit] = utils.git.commits + + expectTypeOf(commit.sha).toEqualTypeOf() + expectTypeOf(commit.parents).toEqualTypeOf() + expectTypeOf(commit.author.name).toEqualTypeOf() + expectTypeOf(commit.author.email).toEqualTypeOf() + expectTypeOf(commit.author.date).toEqualTypeOf() + expectTypeOf(commit.committer.name).toEqualTypeOf() + expectTypeOf(commit.committer.email).toEqualTypeOf() + expectTypeOf(commit.committer.date).toEqualTypeOf() + expectTypeOf(commit.message).toEqualTypeOf() + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/options/netlify_plugin_git_util.ts b/packages/build/test-d/options/netlify_plugin_git_util.ts deleted file mode 100644 index bfdc58f880..0000000000 --- a/packages/build/test-d/options/netlify_plugin_git_util.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { NetlifyPluginUtils, OnPreBuild } from '@netlify/build' -import { expectType } from 'tsd' - -export const testUtilsGit: OnPreBuild = function ({ utils: { git } }: { utils: NetlifyPluginUtils }) { - expectType(git.fileMatch('*')) - expectType(git.modifiedFiles) - expectType(git.createdFiles) - expectType(git.deletedFiles) - expectType>(git.linesOfCode()) -} - -export const testUtilsGitCommits: OnPreBuild = function ({ - utils: { - git: { - commits: [commit], - }, - }, -}: { - utils: NetlifyPluginUtils -}) { - expectType(commit.sha) - expectType(commit.parents) - expectType(commit.author.name) - expectType(commit.author.email) - expectType(commit.author.date) - expectType(commit.committer.name) - expectType(commit.committer.email) - expectType(commit.committer.date) - expectType(commit.message) -} diff --git a/packages/build/test-d/options/netlify_plugin_run_util.test-d.ts b/packages/build/test-d/options/netlify_plugin_run_util.test-d.ts new file mode 100644 index 0000000000..91c4aa97bf --- /dev/null +++ b/packages/build/test-d/options/netlify_plugin_run_util.test-d.ts @@ -0,0 +1,21 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('utils.run types', () => { + const handler: OnPreBuild = async ({ utils }) => { + expectTypeOf(utils.run('command')).toExtend>() + + const r0 = await utils.run('command') + expectTypeOf(r0).toBeObject() + + await utils.run('command', ['arg']) + await utils.run('command', ['arg'], { preferLocal: false }) + + // @ts-expect-error - TypeScript has no negative-call assertion; this error is the test + await utils.run('command', ['arg'], { unknownOption: false }) + + await utils.run.command('command') + } + + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/options/netlify_plugin_run_util.ts b/packages/build/test-d/options/netlify_plugin_run_util.ts deleted file mode 100644 index 51695bb494..0000000000 --- a/packages/build/test-d/options/netlify_plugin_run_util.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { NetlifyPluginUtils, OnPreBuild } from '@netlify/build' -import { expectAssignable, expectError } from 'tsd' - -export const testUtilsRun: OnPreBuild = function ({ utils: { run } }: { utils: NetlifyPluginUtils }) { - expectAssignable>(run('command')) - run('command', ['arg']) - run('command', ['arg'], { preferLocal: false }) - expectError(run('command', ['arg'], { unknownOption: false })) - - run.command('command') -} diff --git a/packages/build/test-d/options/netlify_plugin_status_util.test-d.ts b/packages/build/test-d/options/netlify_plugin_status_util.test-d.ts new file mode 100644 index 0000000000..71982b767d --- /dev/null +++ b/packages/build/test-d/options/netlify_plugin_status_util.test-d.ts @@ -0,0 +1,10 @@ +import type { OnPreBuild } from '@netlify/build' +import { test, expectTypeOf } from 'vitest' + +test('utils.status.show types', () => { + const handler: OnPreBuild = ({ utils }) => { + utils.status.show({ summary: 'summary' }) + utils.status.show({ summary: 'summary', title: 'title', text: 'text' }) + } + expectTypeOf(handler).toEqualTypeOf() +}) diff --git a/packages/build/test-d/options/netlify_plugin_status_util.ts b/packages/build/test-d/options/netlify_plugin_status_util.ts deleted file mode 100644 index f1f81a4fe6..0000000000 --- a/packages/build/test-d/options/netlify_plugin_status_util.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { NetlifyPluginUtils, OnPreBuild } from '@netlify/build' - -export const testUtilsStatus: OnPreBuild = function ({ - utils: { - status: { show }, - }, -}: { - utils: NetlifyPluginUtils -}) { - show({ summary: 'summary' }) - show({ summary: 'summary', title: 'title', text: 'text' }) -}