diff --git a/package.json b/package.json index ea432180b..74d670b12 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "@rollup/plugin-typescript": "9.0.2", "@types/js-beautify": "1.13.3", "@types/node": "18.11.9", - "@typescript-eslint/eslint-plugin": "5.42.1", - "@typescript-eslint/parser": "5.42.1", + "@typescript-eslint/eslint-plugin": "5.43.0", + "@typescript-eslint/parser": "5.43.0", "@vitejs/plugin-vue": "3.2.0", "@vitejs/plugin-vue-jsx": "2.1.1", "@vitest/coverage-c8": "0.25.2", @@ -49,11 +49,11 @@ "lint-staged": "13.0.3", "prettier": "2.7.1", "reflect-metadata": "0.1.13", - "rollup": "3.2.5", + "rollup": "3.3.0", "tslib": "2.4.1", - "typescript": "4.8.4", + "typescript": "4.9.3", "unplugin-vue-components": "0.22.9", - "vite": "3.2.3", + "vite": "3.2.4", "vitepress": "0.22.4", "vitest": "0.25.2", "vue": "3.2.45", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4557ee62b..962bfda76 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,8 +8,8 @@ specifiers: '@rollup/plugin-typescript': 9.0.2 '@types/js-beautify': 1.13.3 '@types/node': 18.11.9 - '@typescript-eslint/eslint-plugin': 5.42.1 - '@typescript-eslint/parser': 5.42.1 + '@typescript-eslint/eslint-plugin': 5.43.0 + '@typescript-eslint/parser': 5.43.0 '@vitejs/plugin-vue': 3.2.0 '@vitejs/plugin-vue-jsx': 2.1.1 '@vitest/coverage-c8': 0.25.2 @@ -28,11 +28,11 @@ specifiers: lint-staged: 13.0.3 prettier: 2.7.1 reflect-metadata: 0.1.13 - rollup: 3.2.5 + rollup: 3.3.0 tslib: 2.4.1 - typescript: 4.8.4 + typescript: 4.9.3 unplugin-vue-components: 0.22.9 - vite: 3.2.3 + vite: 3.2.4 vitepress: 0.22.4 vitest: 0.25.2 vue: 3.2.45 @@ -42,17 +42,17 @@ specifiers: vuex: 4.1.0 devDependencies: - '@rollup/plugin-commonjs': 23.0.2_rollup@3.2.5 - '@rollup/plugin-json': 5.0.1_rollup@3.2.5 - '@rollup/plugin-node-resolve': 15.0.1_rollup@3.2.5 - '@rollup/plugin-replace': 5.0.1_rollup@3.2.5 - '@rollup/plugin-typescript': 9.0.2_skqhbvp355vci76ty3pdffvjrq + '@rollup/plugin-commonjs': 23.0.2_rollup@3.3.0 + '@rollup/plugin-json': 5.0.1_rollup@3.3.0 + '@rollup/plugin-node-resolve': 15.0.1_rollup@3.3.0 + '@rollup/plugin-replace': 5.0.1_rollup@3.3.0 + '@rollup/plugin-typescript': 9.0.2_anaopcb6zpom6gf4l2cmpvnrfm '@types/js-beautify': 1.13.3 '@types/node': 18.11.9 - '@typescript-eslint/eslint-plugin': 5.42.1_2udltptbznfmezdozpdoa2aemq - '@typescript-eslint/parser': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@vitejs/plugin-vue': 3.2.0_vite@3.2.3+vue@3.2.45 - '@vitejs/plugin-vue-jsx': 2.1.1_vite@3.2.3+vue@3.2.45 + '@typescript-eslint/eslint-plugin': 5.43.0_wze2rj5tow7zwqpgbdx2buoy3m + '@typescript-eslint/parser': 5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y + '@vitejs/plugin-vue': 3.2.0_vite@3.2.4+vue@3.2.45 + '@vitejs/plugin-vue-jsx': 2.1.1_vite@3.2.4+vue@3.2.45 '@vitest/coverage-c8': 0.25.2_jsdom@20.0.2 '@vue/compat': 3.2.45_vue@3.2.45 '@vue/compiler-dom': 3.2.45 @@ -69,17 +69,17 @@ devDependencies: lint-staged: 13.0.3 prettier: 2.7.1 reflect-metadata: 0.1.13 - rollup: 3.2.5 + rollup: 3.3.0 tslib: 2.4.1 - typescript: 4.8.4 - unplugin-vue-components: 0.22.9_rollup@3.2.5+vue@3.2.45 - vite: 3.2.3_@types+node@18.11.9 + typescript: 4.9.3 + unplugin-vue-components: 0.22.9_rollup@3.3.0+vue@3.2.45 + vite: 3.2.4_@types+node@18.11.9 vitepress: 0.22.4 vitest: 0.25.2_jsdom@20.0.2 vue: 3.2.45 vue-class-component: 8.0.0-rc.1_vue@3.2.45 vue-router: 4.1.6_vue@3.2.45 - vue-tsc: 1.0.9_typescript@4.8.4 + vue-tsc: 1.0.9_typescript@4.9.3 vuex: 4.1.0_vue@3.2.45 packages: @@ -654,7 +654,7 @@ packages: fastq: 1.13.0 dev: true - /@rollup/plugin-commonjs/23.0.2_rollup@3.2.5: + /@rollup/plugin-commonjs/23.0.2_rollup@3.3.0: resolution: {integrity: sha512-e9ThuiRf93YlVxc4qNIurvv+Hp9dnD+4PjOqQs5vAYfcZ3+AXSrcdzXnVjWxcGQOa6KGJFcRZyUI3ktWLavFjg==} engines: {node: '>=14.0.0'} peerDependencies: @@ -663,16 +663,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.2.5 + '@rollup/pluginutils': 5.0.2_rollup@3.3.0 commondir: 1.0.1 estree-walker: 2.0.2 glob: 8.0.3 is-reference: 1.2.1 magic-string: 0.26.7 - rollup: 3.2.5 + rollup: 3.3.0 dev: true - /@rollup/plugin-json/5.0.1_rollup@3.2.5: + /@rollup/plugin-json/5.0.1_rollup@3.3.0: resolution: {integrity: sha512-QCwhZZLvM8nRcTHyR1vOgyTMiAnjiNj1ebD/BMRvbO1oc/z14lZH6PfxXeegee2B6mky/u9fia4fxRM4TqrUaw==} engines: {node: '>=14.0.0'} peerDependencies: @@ -681,11 +681,11 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.2.5 - rollup: 3.2.5 + '@rollup/pluginutils': 5.0.2_rollup@3.3.0 + rollup: 3.3.0 dev: true - /@rollup/plugin-node-resolve/15.0.1_rollup@3.2.5: + /@rollup/plugin-node-resolve/15.0.1_rollup@3.3.0: resolution: {integrity: sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg==} engines: {node: '>=14.0.0'} peerDependencies: @@ -694,16 +694,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.2.5 + '@rollup/pluginutils': 5.0.2_rollup@3.3.0 '@types/resolve': 1.20.2 deepmerge: 4.2.2 is-builtin-module: 3.2.0 is-module: 1.0.0 resolve: 1.22.1 - rollup: 3.2.5 + rollup: 3.3.0 dev: true - /@rollup/plugin-replace/5.0.1_rollup@3.2.5: + /@rollup/plugin-replace/5.0.1_rollup@3.3.0: resolution: {integrity: sha512-Z3MfsJ4CK17BfGrZgvrcp/l6WXoKb0kokULO+zt/7bmcyayokDaQ2K3eDJcRLCTAlp5FPI4/gz9MHAsosz4Rag==} engines: {node: '>=14.0.0'} peerDependencies: @@ -712,12 +712,12 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.2.5 + '@rollup/pluginutils': 5.0.2_rollup@3.3.0 magic-string: 0.26.7 - rollup: 3.2.5 + rollup: 3.3.0 dev: true - /@rollup/plugin-typescript/9.0.2_skqhbvp355vci76ty3pdffvjrq: + /@rollup/plugin-typescript/9.0.2_anaopcb6zpom6gf4l2cmpvnrfm: resolution: {integrity: sha512-/sS93vmHUMjzDUsl5scNQr1mUlNE1QjBBvOhmRwJCH8k2RRhDIm3c977B3wdu3t3Ap17W6dDeXP3hj1P1Un1bA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -730,14 +730,14 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.2.5 + '@rollup/pluginutils': 5.0.2_rollup@3.3.0 resolve: 1.22.1 - rollup: 3.2.5 + rollup: 3.3.0 tslib: 2.4.1 - typescript: 4.8.4 + typescript: 4.9.3 dev: true - /@rollup/pluginutils/5.0.2_rollup@3.2.5: + /@rollup/pluginutils/5.0.2_rollup@3.3.0: resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -749,7 +749,7 @@ packages: '@types/estree': 1.0.0 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 3.2.5 + rollup: 3.3.0 dev: true /@tootallnate/once/2.0.0: @@ -795,8 +795,8 @@ packages: resolution: {integrity: sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==} dev: true - /@typescript-eslint/eslint-plugin/5.42.1_2udltptbznfmezdozpdoa2aemq: - resolution: {integrity: sha512-LyR6x784JCiJ1j6sH5Y0K6cdExqCCm8DJUTcwG5ThNXJj/G8o5E56u5EdG4SLy+bZAwZBswC+GYn3eGdttBVCg==} + /@typescript-eslint/eslint-plugin/5.43.0_wze2rj5tow7zwqpgbdx2buoy3m: + resolution: {integrity: sha512-wNPzG+eDR6+hhW4yobEmpR36jrqqQv1vxBq5LJO3fBAktjkvekfr4BRl+3Fn1CM/A+s8/EiGUbOMDoYqWdbtXA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -806,24 +806,24 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/type-utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/parser': 5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y + '@typescript-eslint/scope-manager': 5.43.0 + '@typescript-eslint/type-utils': 5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y + '@typescript-eslint/utils': 5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y debug: 4.3.4 eslint: 8.27.0 ignore: 5.2.0 natural-compare-lite: 1.4.0 regexpp: 3.2.0 semver: 7.3.7 - tsutils: 3.21.0_typescript@4.8.4 - typescript: 4.8.4 + tsutils: 3.21.0_typescript@4.9.3 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.42.1_rmayb2veg2btbq6mbmnyivgasy: - resolution: {integrity: sha512-kAV+NiNBWVQDY9gDJDToTE/NO8BHi4f6b7zTsVAJoTkmB/zlfOpiEVBzHOKtlgTndCKe8vj9F/PuolemZSh50Q==} + /@typescript-eslint/parser/5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y: + resolution: {integrity: sha512-2iHUK2Lh7PwNUlhFxxLI2haSDNyXvebBO9izhjhMoDC+S3XI9qt2DGFUsiJ89m2k7gGYch2aEpYqV5F/+nwZug==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -832,26 +832,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 + '@typescript-eslint/scope-manager': 5.43.0 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/typescript-estree': 5.43.0_typescript@4.9.3 debug: 4.3.4 eslint: 8.27.0 - typescript: 4.8.4 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.42.1: - resolution: {integrity: sha512-QAZY/CBP1Emx4rzxurgqj3rUinfsh/6mvuKbLNMfJMMKYLRBfweus8brgXF8f64ABkIZ3zdj2/rYYtF8eiuksQ==} + /@typescript-eslint/scope-manager/5.43.0: + resolution: {integrity: sha512-XNWnGaqAtTJsUiZaoiGIrdJYHsUOd3BZ3Qj5zKp9w6km6HsrjPk/TGZv0qMTWyWj0+1QOqpHQ2gZOLXaGA9Ekw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/visitor-keys': 5.42.1 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/visitor-keys': 5.43.0 dev: true - /@typescript-eslint/type-utils/5.42.1_rmayb2veg2btbq6mbmnyivgasy: - resolution: {integrity: sha512-WWiMChneex5w4xPIX56SSnQQo0tEOy5ZV2dqmj8Z371LJ0E+aymWD25JQ/l4FOuuX+Q49A7pzh/CGIQflxMVXg==} + /@typescript-eslint/type-utils/5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y: + resolution: {integrity: sha512-K21f+KY2/VvYggLf5Pk4tgBOPs2otTaIHy2zjclo7UZGLyFH86VfUOm5iq+OtDtxq/Zwu2I3ujDBykVW4Xtmtg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -860,23 +860,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/typescript-estree': 5.43.0_typescript@4.9.3 + '@typescript-eslint/utils': 5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y debug: 4.3.4 eslint: 8.27.0 - tsutils: 3.21.0_typescript@4.8.4 - typescript: 4.8.4 + tsutils: 3.21.0_typescript@4.9.3 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types/5.42.1: - resolution: {integrity: sha512-Qrco9dsFF5lhalz+lLFtxs3ui1/YfC6NdXu+RAGBa8uSfn01cjO7ssCsjIsUs484vny9Xm699FSKwpkCcqwWwA==} + /@typescript-eslint/types/5.43.0: + resolution: {integrity: sha512-jpsbcD0x6AUvV7tyOlyvon0aUsQpF8W+7TpJntfCUWU1qaIKu2K34pMwQKSzQH8ORgUrGYY6pVIh1Pi8TNeteg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.42.1_typescript@4.8.4: - resolution: {integrity: sha512-qElc0bDOuO0B8wDhhW4mYVgi/LZL+igPwXtV87n69/kYC/7NG3MES0jHxJNCr4EP7kY1XVsRy8C/u3DYeTKQmw==} + /@typescript-eslint/typescript-estree/5.43.0_typescript@4.9.3: + resolution: {integrity: sha512-BZ1WVe+QQ+igWal2tDbNg1j2HWUkAa+CVqdU79L4HP9izQY6CNhXfkNwd1SS4+sSZAP/EthI1uiCSY/+H0pROg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -884,29 +884,29 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/visitor-keys': 5.42.1 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/visitor-keys': 5.43.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.7 - tsutils: 3.21.0_typescript@4.8.4 - typescript: 4.8.4 + tsutils: 3.21.0_typescript@4.9.3 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.42.1_rmayb2veg2btbq6mbmnyivgasy: - resolution: {integrity: sha512-Gxvf12xSp3iYZd/fLqiQRD4uKZjDNR01bQ+j8zvhPjpsZ4HmvEFL/tC4amGNyxN9Rq+iqvpHLhlqx6KTxz9ZyQ==} + /@typescript-eslint/utils/5.43.0_e3uo4sehh4zr4i6m57mkkxxv7y: + resolution: {integrity: sha512-8nVpA6yX0sCjf7v/NDfeaOlyaIIqL7OaIGOWSPFqUKK59Gnumd3Wa+2l8oAaYO2lk0sO+SbWFWRSvhu8gLGv4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.11 '@types/semver': 7.3.12 - '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 + '@typescript-eslint/scope-manager': 5.43.0 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/typescript-estree': 5.43.0_typescript@4.9.3 eslint: 8.27.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.27.0 @@ -916,15 +916,15 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.42.1: - resolution: {integrity: sha512-LOQtSF4z+hejmpUvitPlc4hA7ERGoj2BVkesOcG91HCn8edLGUXbTrErmutmPbl8Bo9HjAvOO/zBKQHExXNA2A==} + /@typescript-eslint/visitor-keys/5.43.0: + resolution: {integrity: sha512-icl1jNH/d18OVHLfcwdL3bWUKsBeIiKYTGxMJCoGe7xFht+E4QgzOqoWYrU8XSLJWhVw8nTacbm03v23J/hFTg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.42.1 + '@typescript-eslint/types': 5.43.0 eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue-jsx/2.1.1_vite@3.2.3+vue@3.2.45: + /@vitejs/plugin-vue-jsx/2.1.1_vite@3.2.4+vue@3.2.45: resolution: {integrity: sha512-JgDhxstQlwnHBvZ1BSnU5mbmyQ14/t5JhREc6YH5kWyu2QdAAOsLF6xgHoIWarj8tddaiwFrNzLbWJPudpXKYA==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -934,7 +934,7 @@ packages: '@babel/core': 7.19.6 '@babel/plugin-transform-typescript': 7.20.2_@babel+core@7.19.6 '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.19.6 - vite: 3.2.3_@types+node@18.11.9 + vite: 3.2.4_@types+node@18.11.9 vue: 3.2.45 transitivePeerDependencies: - supports-color @@ -951,14 +951,14 @@ packages: vue: 3.2.45 dev: true - /@vitejs/plugin-vue/3.2.0_vite@3.2.3+vue@3.2.45: + /@vitejs/plugin-vue/3.2.0_vite@3.2.4+vue@3.2.45: resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^3.0.0 vue: ^3.2.25 dependencies: - vite: 3.2.3_@types+node@18.11.9 + vite: 3.2.4_@types+node@18.11.9 vue: 3.2.45 dev: true @@ -3251,8 +3251,8 @@ packages: fsevents: 2.3.2 dev: true - /rollup/3.2.5: - resolution: {integrity: sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==} + /rollup/3.3.0: + resolution: {integrity: sha512-wqOV/vUJCYEbWsXvwCkgGWvgaEnsbn4jxBQWKpN816CqsmCimDmCNJI83c6if7QVD4v/zlyRzxN7U2yDT5rfoA==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: @@ -3517,14 +3517,14 @@ packages: resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} dev: true - /tsutils/3.21.0_typescript@4.8.4: + /tsutils/3.21.0_typescript@4.9.3: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.8.4 + typescript: 4.9.3 dev: true /type-check/0.3.2: @@ -3556,8 +3556,8 @@ packages: engines: {node: '>=10'} dev: true - /typescript/4.8.4: - resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} + /typescript/4.9.3: + resolution: {integrity: sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -3567,7 +3567,7 @@ packages: engines: {node: '>= 4.0.0'} dev: true - /unplugin-vue-components/0.22.9_rollup@3.2.5+vue@3.2.45: + /unplugin-vue-components/0.22.9_rollup@3.3.0+vue@3.2.45: resolution: {integrity: sha512-qBvooq3EgpjtYicxeccRUGUBBQCCw9rJ0kHPZPOSJd8TBZViSv86vuKLTRDHPyjWtclwOIkVStZJfPdJFhYUMw==} engines: {node: '>=14'} peerDependencies: @@ -3578,7 +3578,7 @@ packages: optional: true dependencies: '@antfu/utils': 0.6.0 - '@rollup/pluginutils': 5.0.2_rollup@3.2.5 + '@rollup/pluginutils': 5.0.2_rollup@3.3.0 chokidar: 3.5.3 debug: 4.3.4 fast-glob: 3.2.12 @@ -3659,8 +3659,8 @@ packages: fsevents: 2.3.2 dev: true - /vite/3.2.3_@types+node@18.11.9: - resolution: {integrity: sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==} + /vite/3.2.4_@types+node@18.11.9: + resolution: {integrity: sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -3750,7 +3750,7 @@ packages: tinybench: 2.3.1 tinypool: 0.3.0 tinyspy: 1.0.2 - vite: 3.2.3_@types+node@18.11.9 + vite: 3.2.4_@types+node@18.11.9 transitivePeerDependencies: - less - sass @@ -3784,7 +3784,7 @@ packages: he: 1.2.0 dev: true - /vue-tsc/1.0.9_typescript@4.8.4: + /vue-tsc/1.0.9_typescript@4.9.3: resolution: {integrity: sha512-vRmHD1K6DmBymNhoHjQy/aYKTRQNLGOu2/ESasChG9Vy113K6CdP0NlhR0bzgFJfv2eFB9Ez/9L5kIciUajBxQ==} hasBin: true peerDependencies: @@ -3792,7 +3792,7 @@ packages: dependencies: '@volar/vue-language-core': 1.0.9 '@volar/vue-typescript': 1.0.9 - typescript: 4.8.4 + typescript: 4.9.3 dev: true /vue/3.2.45: diff --git a/src/mount.ts b/src/mount.ts index a991814d6..27735767c 100644 --- a/src/mount.ts +++ b/src/mount.ts @@ -203,7 +203,7 @@ export function mount< > > // component declared by vue-tsc ScriptSetup -export function mount>( +export function mount>( component: T, options?: ComponentMountingOptions ): VueWrapper> @@ -478,16 +478,35 @@ export function mount( if (global?.mocks) { const mixin = defineComponent({ beforeCreate() { - for (const [k, v] of Object.entries( - global.mocks as { [key: string]: any } - )) { - // we need to differentiate components that are or not not `script setup` - // otherwise we run into a proxy set error - // due to https://github.com/vuejs/core/commit/f73925d76a76ee259749b8b48cb68895f539a00f#diff-ea4d1ddabb7e22e17e80ada458eef70679af4005df2a1a6b73418fec897603ceR404 - // introduced in Vue v3.2.45 - if (hasSetupState(this as any)) { - ;(this as any).$.setupState[k] = v - } else { + // we need to differentiate components that are or not not `script setup` + // otherwise we run into a proxy set error + // due to https://github.com/vuejs/core/commit/f73925d76a76ee259749b8b48cb68895f539a00f#diff-ea4d1ddabb7e22e17e80ada458eef70679af4005df2a1a6b73418fec897603ceR404 + // introduced in Vue v3.2.45 + if (hasSetupState(this)) { + // add the mocks to setupState + for (const [k, v] of Object.entries( + global.mocks as { [key: string]: any } + )) { + // we do this in a try/catch, as some properties might be read-only + try { + this.$.setupState[k] = v + // eslint-disable-next-line no-empty + } catch (e) {} + } + // also intercept the proxy calls to make the mocks available on the instance + // (useful when a template access a global function like $t and the developer wants to mock it) + ;(this.$ as any).proxy = new Proxy((this.$ as any).proxy, { + get(target, key) { + if (key in global.mocks) { + return global.mocks[key as string] + } + return target[key] + } + }) + } else { + for (const [k, v] of Object.entries( + global.mocks as { [key: string]: any } + )) { ;(this as any)[k] = v } } @@ -604,8 +623,10 @@ export function mount( const appRef = componentRef.value! as ComponentPublicInstance // we add `hasOwnProperty` so Jest can spy on the proxied vm without throwing // note that this is not necessary with Jest v27+ or Vitest, but is kept for compatibility with older Jest versions - appRef.hasOwnProperty = (property) => { - return Reflect.has(appRef, property) + if (!app.hasOwnProperty) { + appRef.hasOwnProperty = (property) => { + return Reflect.has(appRef, property) + } } const wrapper = createVueWrapper(app, appRef, setProps) trackInstance(wrapper) diff --git a/src/utils.ts b/src/utils.ts index e2780518f..be0cad37b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -80,7 +80,6 @@ export const mergeDeep = ( if (!isObject(target) || !isObject(source)) { return source } - Object.keys(source).forEach((key) => { const targetValue = target[key] const sourceValue = source[key] @@ -188,7 +187,9 @@ export function getDirectivesFromStubs( } export function hasSetupState( vm: ComponentPublicInstance -): vm is ComponentPublicInstance & { setupState: Record } { +): vm is ComponentPublicInstance & { + $: { setupState: Record } +} { return ( vm && (vm.$ as unknown as { devtoolsRawSetupState: any }).devtoolsRawSetupState diff --git a/src/vueWrapper.ts b/src/vueWrapper.ts index 356ae09d9..1d5fb40a0 100644 --- a/src/vueWrapper.ts +++ b/src/vueWrapper.ts @@ -108,7 +108,7 @@ export class VueWrapper< // or for components with a setup that returns a render function (as they have an empty proxy) // in both cases, we return `vm` directly instead if (hasSetupState(vm)) { - this.componentVM = createVMProxy(vm, (vm.$ as any).setupState) + this.componentVM = createVMProxy(vm, vm.$.setupState) } else { this.componentVM = vm } diff --git a/tests/components/ComponentWithI18n.vue b/tests/components/ComponentWithI18n.vue new file mode 100644 index 000000000..d955296a3 --- /dev/null +++ b/tests/components/ComponentWithI18n.vue @@ -0,0 +1,16 @@ + + + diff --git a/tests/components/HelloFromVitestPlayground.vue b/tests/components/HelloFromVitestPlayground.vue new file mode 100644 index 000000000..d1bf7f677 --- /dev/null +++ b/tests/components/HelloFromVitestPlayground.vue @@ -0,0 +1,17 @@ + + + diff --git a/tests/components/ScriptSetupWithI18n.vue b/tests/components/ScriptSetupWithI18n.vue new file mode 100644 index 000000000..2540d36c2 --- /dev/null +++ b/tests/components/ScriptSetupWithI18n.vue @@ -0,0 +1,11 @@ + + + diff --git a/tests/mount.spec.ts b/tests/mount.spec.ts index 74f5b1c10..7c77d66c4 100644 --- a/tests/mount.spec.ts +++ b/tests/mount.spec.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { defineComponent } from 'vue' import { mount } from '../src' +import HelloFromVitestPlayground from './components/HelloFromVitestPlayground.vue' describe('mount: general tests', () => { it('correctly handles component, throwing on mount', () => { @@ -23,4 +24,12 @@ describe('mount: general tests', () => { expect(wrapper.html()).toBe('
hello
') }) + + it('should not warn on readonly hasOwnProperty when mounting a component', () => { + const spy = vi.spyOn(console, 'warn').mockImplementation(() => {}) + + mount(HelloFromVitestPlayground, { props: { count: 2 } }) + + expect(spy).not.toHaveBeenCalled() + }) }) diff --git a/tests/mountingOptions/mocks.spec.ts b/tests/mountingOptions/mocks.spec.ts index a37412814..2d9d410b1 100644 --- a/tests/mountingOptions/mocks.spec.ts +++ b/tests/mountingOptions/mocks.spec.ts @@ -1,6 +1,8 @@ import { describe, expect, it, vi } from 'vitest' import { mount, RouterLinkStub } from '../../src' import { defineComponent } from 'vue' +import ScriptSetupWithI18n from '../components/ScriptSetupWithI18n.vue' +import ComponentWithI18n from '../components/ComponentWithI18n.vue' describe('mocks', () => { it('mocks a vuex store', async () => { @@ -75,4 +77,28 @@ describe('mocks', () => { await wrapper.find('button').trigger('click') expect($router.push).toHaveBeenCalledWith('/posts/1') }) + + it('mocks a global function in a script setup component', () => { + const wrapper = mount(ScriptSetupWithI18n, { + global: { + mocks: { + $t: () => 'mocked' + } + } + }) + expect(wrapper.text()).toContain('hello') + expect(wrapper.text()).toContain('mocked') + }) + + it('mocks a global function in an option component', () => { + const wrapper = mount(ComponentWithI18n, { + global: { + mocks: { + $t: () => 'mocked' + } + } + }) + expect(wrapper.text()).toContain('hello') + expect(wrapper.text()).toContain('mocked') + }) }) diff --git a/types/testing.d.ts b/types/testing.d.ts index 4aa77f8f2..e67dcaac7 100644 --- a/types/testing.d.ts +++ b/types/testing.d.ts @@ -3,5 +3,6 @@ import type { Router } from 'vue-router' declare module '@vue/runtime-core' { interface ComponentCustomProperties { $router: Router + $t: (key: string) => string } }