diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6b6efc..b91d595 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,3 +27,7 @@ jobs: timeout-minutes: 1 continue-on-error: true run: bash <(curl -s https://codecov.io/bash) -t ${{secrets.CODECOV_TOKEN}} -B ${{ github.ref }} -f coverage/coverage-final.json + # test the minimum supported peer dependency version + - run: npm install typescript@4.1 rollup@2.55 + # aka `npm test` without the `pretest/build` + - run: node .build/tests/index.js diff --git a/package-lock.json b/package-lock.json index 80e079c..1fd4e64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,10 +5,10 @@ "requires": true, "packages": { "": { - "name": "rollup-plugin-dts", "version": "4.0.1", "license": "LGPL-3.0", "dependencies": { + "@babel/code-frame": "^7.16.0", "magic-string": "^0.25.7" }, "devDependencies": { @@ -16,13 +16,13 @@ "@types/d3-drag": "^3.0.1", "@types/estree": "0.0.50", "@types/fs-extra": "^9.0.13", - "@types/node": "^16.11.10", - "@types/react": "^17.0.37", + "@types/node": "^17.0.4", + "@types/react": "^17.0.38", "c8": "^7.10.0", "fs-extra": "^10.0.0", "rimraf": "^3.0.2", - "rollup": "2.60.1", - "typescript": "4.5.2" + "rollup": "2.55", + "typescript": "4.5.4" }, "engines": { "node": ">=v12.22.7" @@ -34,8 +34,8 @@ "@babel/code-frame": "^7.16.0" }, "peerDependencies": { - "rollup": "^2.60.1", - "typescript": "^4.5.2" + "rollup": "2.55", + "typescript": "~4.1 || ~4.2 || ~4.3 || ~4.4 || ~4.5" } }, "node_modules/@babel/code-frame": { @@ -131,9 +131,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz", - "integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==", + "version": "17.0.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.4.tgz", + "integrity": "sha512-6xwbrW4JJiJLgF+zNypN5wr2ykM9/jHcL7rQ8fZe2vuftggjzZeRSM4OwRc6Xk8qWjwJ99qVHo/JgOGmomWRog==", "dev": true }, "node_modules/@types/prop-types": { @@ -143,10 +143,11 @@ "dev": true }, "node_modules/@types/react": { - "version": "17.0.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.37.tgz", - "integrity": "sha512-2FS1oTqBGcH/s0E+CjrCCR9+JMpsu9b69RTFO+40ua43ZqP5MmQ4iUde/dMjWR909KxZwmOQIFq6AV6NjEG5xg==", + "version": "17.0.38", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.38.tgz", + "integrity": "sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -534,6 +535,7 @@ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, "dependencies": { + "graceful-fs": "^4.1.6", "universalify": "^2.0.0" }, "optionalDependencies": { @@ -681,10 +683,13 @@ } }, "node_modules/rollup": { - "version": "2.60.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.60.1.tgz", - "integrity": "sha512-akwfnpjY0rXEDSn1UTVfKXJhPsEBu+imi1gqBA1ZkHGydUnkV/fWCC90P7rDaLEW8KTwBcS1G3N4893Ndz+jwg==", + "version": "2.55.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.55.1.tgz", + "integrity": "sha512-1P9w5fpb6b4qroePh8vHKGIvPNxwoCQhjJpIqfZGHLKpZ0xcU2/XBmFxFbc9697/6bmHpmFTLk5R1dAQhFSo0g==", "dev": true, + "dependencies": { + "fsevents": "~2.3.2" + }, "bin": { "rollup": "dist/bin/rollup" }, @@ -804,9 +809,9 @@ } }, "node_modules/typescript": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", - "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -1041,9 +1046,9 @@ "dev": true }, "@types/node": { - "version": "16.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz", - "integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==", + "version": "17.0.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.4.tgz", + "integrity": "sha512-6xwbrW4JJiJLgF+zNypN5wr2ykM9/jHcL7rQ8fZe2vuftggjzZeRSM4OwRc6Xk8qWjwJ99qVHo/JgOGmomWRog==", "dev": true }, "@types/prop-types": { @@ -1053,9 +1058,9 @@ "dev": true }, "@types/react": { - "version": "17.0.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.37.tgz", - "integrity": "sha512-2FS1oTqBGcH/s0E+CjrCCR9+JMpsu9b69RTFO+40ua43ZqP5MmQ4iUde/dMjWR909KxZwmOQIFq6AV6NjEG5xg==", + "version": "17.0.38", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.38.tgz", + "integrity": "sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ==", "dev": true, "requires": { "@types/prop-types": "*", @@ -1473,9 +1478,9 @@ } }, "rollup": { - "version": "2.60.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.60.1.tgz", - "integrity": "sha512-akwfnpjY0rXEDSn1UTVfKXJhPsEBu+imi1gqBA1ZkHGydUnkV/fWCC90P7rDaLEW8KTwBcS1G3N4893Ndz+jwg==", + "version": "2.55.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.55.1.tgz", + "integrity": "sha512-1P9w5fpb6b4qroePh8vHKGIvPNxwoCQhjJpIqfZGHLKpZ0xcU2/XBmFxFbc9697/6bmHpmFTLk5R1dAQhFSo0g==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -1566,9 +1571,9 @@ } }, "typescript": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", - "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", "dev": true }, "universalify": { diff --git a/package.json b/package.json index ffaec14..a360e7d 100644 --- a/package.json +++ b/package.json @@ -52,17 +52,17 @@ "@types/d3-drag": "^3.0.1", "@types/estree": "0.0.50", "@types/fs-extra": "^9.0.13", - "@types/node": "^16.11.10", - "@types/react": "^17.0.37", + "@types/node": "^17.0.4", + "@types/react": "^17.0.38", "c8": "^7.10.0", "fs-extra": "^10.0.0", "rimraf": "^3.0.2", - "rollup": "2.60.1", - "typescript": "4.5.2" + "rollup": "2.62.0", + "typescript": "4.5.4" }, "peerDependencies": { - "rollup": "^2.60.1", - "typescript": "^4.5.2" + "rollup": "^2.55", + "typescript": "~4.1 || ~4.2 || ~4.3 || ~4.4 || ~4.5" }, "optionalDependencies": { "@babel/code-frame": "^7.16.0" diff --git a/tests/testcases.ts b/tests/testcases.ts index b67bcd9..9bdd27e 100644 --- a/tests/testcases.ts +++ b/tests/testcases.ts @@ -2,6 +2,7 @@ import * as assert from "assert"; import fsExtra from "fs-extra"; import * as path from "path"; import { InputOption, InputOptions, rollup, RollupOptions, RollupOutput } from "rollup"; +import ts from "typescript"; import dts, { Options } from "../src/index.js"; import { forEachFixture, Harness } from "./utils.js"; @@ -21,6 +22,15 @@ export default (t: Harness) => { meta.rollupOptions = Object.assign(rollupOptions, meta.rollupOptions); } catch {} + if (meta.tsVersion) { + const [major, minor] = ts.versionMajorMinor.split(".").map(Number); + const [reqMajor, reqMinor] = meta.tsVersion.split(".").map(Number); + if (major! < reqMajor! || minor! < reqMinor!) { + // skip unsupported version + return; + } + } + if (!meta.skip) { return assertTestcase(dir, meta, bless); } @@ -33,6 +43,7 @@ interface Meta { rollupOptions: RollupOptions; skip: boolean; expectedError?: string; + tsVersion?: string; } async function createBundle(options: Options, rollupOptions: RollupOptions) { diff --git a/tests/testcases/ts42-abstract/meta.js b/tests/testcases/ts42-abstract/meta.js new file mode 100644 index 0000000..9511e7d --- /dev/null +++ b/tests/testcases/ts42-abstract/meta.js @@ -0,0 +1,3 @@ +export default { + tsVersion: "4.2", +}; diff --git a/tests/testcases/ts43-getset/meta.js b/tests/testcases/ts43-getset/meta.js new file mode 100644 index 0000000..9511e7d --- /dev/null +++ b/tests/testcases/ts43-getset/meta.js @@ -0,0 +1,3 @@ +export default { + tsVersion: "4.2", +};