diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a877e6083..7afec481f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Lint run: pnpm lint - test-examples: + test: runs-on: ubuntu-latest steps: @@ -91,5 +91,8 @@ jobs: - name: Build module run: pnpm prepack + - name: Test types + run: pnpm test:types + - name: Test examples run: pnpm test:examples diff --git a/package.json b/package.json index ac1400028..210bd3013 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "lint": "eslint --ext .vue,.ts,.js,.mjs .", "lint:fix": "eslint --ext .vue,.ts,.js,.mjs . --fix", "test:examples": "pnpm -r test", + "test:types": "vue-tsc --noEmit", "prepack": "unbuild", "dev:prepare": "nuxi prepare && unbuild --stub && pnpm -r dev:prepare", "release": "pnpm test:examples && pnpm build && changelogen --release --push && pnpm publish" @@ -61,6 +62,7 @@ "@nuxt/module-builder": "0.5.4", "@testing-library/vue": "7.0.0", "@types/estree": "1.0.5", + "@types/jsdom": "^21.1.6", "@vitejs/plugin-vue": "4.5.0", "@vitejs/plugin-vue-jsx": "3.1.0", "@vue/test-utils": "2.4.2", @@ -78,7 +80,8 @@ "unimport": "3.5.0", "vite": "4.5.0", "vitest": "0.33.0", - "vue-router": "4.2.5" + "vue-router": "4.2.5", + "vue-tsc": "^1.8.22" }, "peerDependencies": { "@jest/globals": "^29.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a0571ebf..d6c90d9c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -97,6 +97,9 @@ importers: '@types/estree': specifier: 1.0.5 version: 1.0.5 + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.6 '@vitejs/plugin-vue': specifier: 4.5.0 version: 4.5.0(vite@4.5.0)(vue@3.3.8) @@ -129,7 +132,7 @@ importers: version: 1.9.0 nuxt: specifier: ^3.8.2 - version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) playwright-core: specifier: 1.40.0 version: 1.40.0 @@ -151,12 +154,15 @@ importers: vue-router: specifier: 4.2.5 version: 4.2.5(vue@3.3.8) + vue-tsc: + specifier: ^1.8.22 + version: 1.8.22(typescript@5.2.2) examples/app: dependencies: nuxt: specifier: ^3.8.2 - version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.2.2) @@ -175,7 +181,7 @@ importers: dependencies: nuxt: specifier: ^3.8.2 - version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.2.2) @@ -231,7 +237,7 @@ importers: version: 0.5.5 nuxt: specifier: ^3.8.2 - version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) vitest: specifier: 0.33.0 version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) @@ -247,7 +253,7 @@ importers: devDependencies: nuxt: specifier: ^3.8.2 - version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) stubs/vitest-environment-nuxt: dependencies: @@ -1528,7 +1534,7 @@ packages: '@nuxt/kit': 3.8.2(rollup@3.29.4) '@nuxt/schema': 3.8.2(rollup@3.29.4) execa: 7.2.0 - nuxt: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + nuxt: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) vite: 4.5.0(@types/node@20.8.10) transitivePeerDependencies: - rollup @@ -1576,7 +1582,7 @@ packages: local-pkg: 0.5.0 magicast: 0.3.2 nitropack: 2.8.0 - nuxt: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + nuxt: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) nypm: 0.3.3 ofetch: 1.3.3 ohash: 1.1.3 @@ -1744,7 +1750,7 @@ packages: /@nuxt/ui-templates@1.3.1: resolution: {integrity: sha512-5gc02Pu1HycOVUWJ8aYsWeeXcSTPe8iX8+KIrhyEtEoOSkY0eMBuo0ssljB8wALuEmepv31DlYe5gpiRwkjESA==} - /@nuxt/vite-builder@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue@3.3.8): + /@nuxt/vite-builder@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue-tsc@1.8.22)(vue@3.3.8): resolution: {integrity: sha512-l/lzDDTbd3M89BpmWqjhVLgLVRqfkKp0tyYgV5seJQjj3SX+IeqI7k6k8+dMEifdeO34jUajVWptNpITXQryyg==} engines: {node: ^14.18.0 || >=16.10.0} peerDependencies: @@ -1781,7 +1787,7 @@ packages: unplugin: 1.5.1 vite: 4.5.0(@types/node@20.8.10) vite-node: 0.33.0(@types/node@20.8.10) - vite-plugin-checker: 0.6.2(eslint@8.54.0)(typescript@5.2.2)(vite@4.5.0) + vite-plugin-checker: 0.6.2(eslint@8.54.0)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22) vue: 3.3.8(typescript@5.2.2) vue-bundle-renderer: 2.0.0 transitivePeerDependencies: @@ -2447,6 +2453,14 @@ packages: pretty-format: 29.7.0 dev: true + /@types/jsdom@21.1.6: + resolution: {integrity: sha512-/7kkMsC+/kMs7gAYmmBR9P0vGTnOoLhQhyhQJSlXGI5bzTHp6xdo0TtKWQAsz6pmSAeVqKSbqeyP6hytqr9FDw==} + dependencies: + '@types/node': 20.8.10 + '@types/tough-cookie': 4.0.5 + parse5: 7.1.2 + dev: true + /@types/json-schema@7.0.14: resolution: {integrity: sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==} dev: true @@ -2475,6 +2489,10 @@ packages: resolution: {integrity: sha512-g7CK9nHdwjK2n0ymT2CW698FuWJRIx+RP6embAzZ2Qi8/ilIrA1Imt2LVSeHUzKvpoi7BhmmQcXz95eS0f2JXw==} dev: true + /@types/tough-cookie@4.0.5: + resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} + dev: true + /@types/yargs-parser@21.0.2: resolution: {integrity: sha512-5qcvofLPbfjmBfKaLfj/+f+Sbd6pN4zl7w7VSVI5uz7m9QZTuB2aZAa2uo1wHFBNN2x6g/SoTkXmd8mQnQF2Cw==} dev: true @@ -2736,6 +2754,22 @@ packages: pretty-format: 29.7.0 dev: true + /@volar/language-core@1.10.10: + resolution: {integrity: sha512-nsV1o3AZ5n5jaEAObrS3MWLBWaGwUj/vAsc15FVNIv+DbpizQRISg9wzygsHBr56ELRH8r4K75vkYNMtsSNNWw==} + dependencies: + '@volar/source-map': 1.10.10 + + /@volar/source-map@1.10.10: + resolution: {integrity: sha512-GVKjLnifV4voJ9F0vhP56p4+F3WGf+gXlRtjFZsv6v3WxBTWU3ZVeaRaEHJmWrcv5LXmoYYpk/SC25BKemPRkg==} + dependencies: + muggle-string: 0.3.1 + + /@volar/typescript@1.10.10: + resolution: {integrity: sha512-4a2r5bdUub2m+mYVnLu2wt59fuoYWe7nf0uXtGHU8QQ5LDNfzAR0wK7NgDiQ9rcl2WT3fxT2AA9AylAwFtj50A==} + dependencies: + '@volar/language-core': 1.10.10 + path-browserify: 1.0.1 + /@vue-macros/common@1.8.0(rollup@3.29.4)(vue@3.3.8): resolution: {integrity: sha512-auDJJzE0z3uRe3867e0DsqcseKImktNf5ojCZgUKqiVxb2yTlwlgOVAYCgoep9oITqxkXQymSvFeKhedi8PhaA==} engines: {node: '>=16.14.0'} @@ -2813,6 +2847,24 @@ packages: /@vue/devtools-api@6.5.1: resolution: {integrity: sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==} + /@vue/language-core@1.8.22(typescript@5.2.2): + resolution: {integrity: sha512-bsMoJzCrXZqGsxawtUea1cLjUT9dZnDsy5TuZ+l1fxRMzUGQUG9+Ypq4w//CqpWmrx7nIAJpw2JVF/t258miRw==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@volar/language-core': 1.10.10 + '@volar/source-map': 1.10.10 + '@vue/compiler-dom': 3.3.8 + '@vue/shared': 3.3.8 + computeds: 0.0.1 + minimatch: 9.0.3 + muggle-string: 0.3.1 + typescript: 5.2.2 + vue-template-compiler: 2.7.15 + /@vue/reactivity-transform@3.3.8: resolution: {integrity: sha512-49CvBzmZNtcHua0XJ7GdGifM8GOXoUMOX4dD40Y5DxI3R8OUhMlvf2nvgUAcPxaXiV5MQQ1Nwy09ADpnLQUqRw==} dependencies: @@ -3601,6 +3653,9 @@ packages: normalize-path: 3.0.0 readable-stream: 3.6.2 + /computeds@0.0.1: + resolution: {integrity: sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==} + /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -3794,6 +3849,9 @@ packages: whatwg-mimetype: 3.0.0 whatwg-url: 12.0.1 + /de-indent@1.0.2: + resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} + /debug@2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} peerDependencies: @@ -5019,6 +5077,10 @@ packages: dependencies: function-bind: 1.1.2 + /he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + /hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} @@ -6464,6 +6526,9 @@ packages: /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + /muggle-string@0.3.1: + resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==} + /nanoid@3.3.7: resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -6757,7 +6822,7 @@ packages: optionalDependencies: fsevents: 2.3.3 - /nuxt@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0): + /nuxt@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22): resolution: {integrity: sha512-HUAyifmqTs2zcQBGvcby3KNs2pBAk+l7ZbLjD1oCNqQQ+wBuZ1qgLC4Ebu++y4g3o3Y8WAWSvpafbKRLQZziPw==} engines: {node: ^14.18.0 || >=16.10.0} hasBin: true @@ -6776,7 +6841,7 @@ packages: '@nuxt/schema': 3.8.2(rollup@3.29.4) '@nuxt/telemetry': 2.5.2(rollup@3.29.4) '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue@3.3.8) + '@nuxt/vite-builder': 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue-tsc@1.8.22)(vue@3.3.8) '@types/node': 20.8.10 '@unhead/dom': 1.8.5 '@unhead/ssr': 1.8.5 @@ -7118,6 +7183,9 @@ packages: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} + /path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -8902,7 +8970,7 @@ packages: - supports-color - terser - /vite-plugin-checker@0.6.2(eslint@8.54.0)(typescript@5.2.2)(vite@4.5.0): + /vite-plugin-checker@0.6.2(eslint@8.54.0)(typescript@5.2.2)(vite@4.5.0)(vue-tsc@1.8.22): resolution: {integrity: sha512-YvvvQ+IjY09BX7Ab+1pjxkELQsBd4rPhWNw8WLBeFVxu/E7O+n6VYAqNsKdK/a2luFlX/sMpoWdGFfg4HvwdJQ==} engines: {node: '>=14.16'} peerDependencies: @@ -8953,6 +9021,7 @@ packages: vscode-languageserver: 7.0.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 + vue-tsc: 1.8.22(typescript@5.2.2) /vite-plugin-inspect@0.7.42(@nuxt/kit@3.8.2)(rollup@3.29.4)(vite@4.5.0): resolution: {integrity: sha512-JCyX86wr3siQc+p9Kd0t8VkFHAJag0RaQVIpdFGSv5FEaePEVB6+V/RGtz2dQkkGSXQzRWrPs4cU3dRKg32bXw==} @@ -9169,6 +9238,23 @@ packages: '@vue/devtools-api': 6.5.1 vue: 3.3.8(typescript@5.2.2) + /vue-template-compiler@2.7.15: + resolution: {integrity: sha512-yQxjxMptBL7UAog00O8sANud99C6wJF+7kgbcwqkvA38vCGF7HWE66w0ZFnS/kX5gSoJr/PQ4/oS3Ne2pW37Og==} + dependencies: + de-indent: 1.0.2 + he: 1.2.0 + + /vue-tsc@1.8.22(typescript@5.2.2): + resolution: {integrity: sha512-j9P4kHtW6eEE08aS5McFZE/ivmipXy0JzrnTgbomfABMaVKx37kNBw//irL3+LlE3kOo63XpnRigyPC3w7+z+A==} + hasBin: true + peerDependencies: + typescript: '*' + dependencies: + '@volar/typescript': 1.10.10 + '@vue/language-core': 1.8.22(typescript@5.2.2) + semver: 7.5.4 + typescript: 5.2.2 + /vue@3.3.8(typescript@5.2.2): resolution: {integrity: sha512-5VSX/3DabBikOXMsxzlW8JyfeLKlG9mzqnWgLQLty88vdZL7ZJgrdgBOmrArwxiLtmS+lNNpPcBYqrhE6TQW5w==} peerDependencies: diff --git a/tsconfig.json b/tsconfig.json index 365a84c72..65c71a701 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,8 @@ "moduleResolution": "Bundler", }, "exclude": [ - "**/dist/**" + "**/dist/**", + "examples/*", + "test/fixtures/*" ] }