From 5e8b4a1eae81c8941b62b40cff33a534a2106d72 Mon Sep 17 00:00:00 2001 From: motea927 Date: Sun, 18 Jun 2023 18:37:21 +0800 Subject: [PATCH 1/4] build: move vue, vue-i18n to devDependencies --- package.json | 8 +++--- pnpm-lock.yaml | 76 +++++++++++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 330bb8d..832bf80 100644 --- a/package.json +++ b/package.json @@ -35,14 +35,12 @@ }, "types": "./dist/main.d.ts", "dependencies": { - "@types/dompurify": "^3.0.2", - "dompurify": "^3.0.3", - "vue": "^3.3.2", - "vue-i18n": "9.3.0-beta.19" + "dompurify": "^3.0.3" }, "devDependencies": { "@rushstack/eslint-patch": "^1.2.0", "@tsconfig/node18": "^2.0.1", + "@types/dompurify": "^3.0.2", "@types/jsdom": "^21.1.1", "@types/node": "^18.16.8", "@vitejs/plugin-vue": "^4.2.3", @@ -64,6 +62,8 @@ "vite": "^4.3.5", "vite-plugin-dts": "^2.3.0", "vitest": "^0.31.0", + "vue": "^3.3.2", + "vue-i18n": "9.3.0-beta.19", "vue-tsc": "^1.6.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ccbf05d..f5bc72c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,18 +4,9 @@ importers: .: dependencies: - '@types/dompurify': - specifier: ^3.0.2 - version: 3.0.2 dompurify: specifier: ^3.0.3 version: 3.0.3 - vue: - specifier: ^3.3.2 - version: 3.3.2 - vue-i18n: - specifier: 9.3.0-beta.19 - version: 9.3.0-beta.19(vue@3.3.2) devDependencies: '@rushstack/eslint-patch': specifier: ^1.2.0 @@ -23,6 +14,9 @@ importers: '@tsconfig/node18': specifier: ^2.0.1 version: 2.0.1 + '@types/dompurify': + specifier: ^3.0.2 + version: 3.0.2 '@types/jsdom': specifier: ^21.1.1 version: 21.1.1 @@ -86,6 +80,12 @@ importers: vitest: specifier: ^0.31.0 version: 0.31.0(jsdom@22.0.0)(sass@1.63.3) + vue: + specifier: ^3.3.2 + version: 3.3.2 + vue-i18n: + specifier: 9.3.0-beta.19 + version: 9.3.0-beta.19(vue@3.3.2) vue-tsc: specifier: ^1.6.4 version: 1.6.4(typescript@5.0.4) @@ -315,6 +315,7 @@ packages: /@babel/helper-string-parser@7.21.5: resolution: {integrity: sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==} engines: {node: '>=6.9.0'} + dev: true /@babel/helper-string-parser@7.22.5: resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} @@ -324,6 +325,7 @@ packages: /@babel/helper-validator-identifier@7.19.1: resolution: {integrity: sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==} engines: {node: '>=6.9.0'} + dev: true /@babel/helper-validator-identifier@7.22.5: resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==} @@ -370,6 +372,7 @@ packages: hasBin: true dependencies: '@babel/types': 7.22.4 + dev: true /@babel/parser@7.22.5: resolution: {integrity: sha512-DFZMC9LJUG9PLOclRC32G63UXwzqS2koQC8dkx+PLdmt1xSePYpbT/NbsrJy8Q/muXz7o/h/d4A7Fuyixm559Q==} @@ -462,6 +465,7 @@ packages: '@babel/helper-string-parser': 7.21.5 '@babel/helper-validator-identifier': 7.19.1 to-fast-properties: 2.0.0 + dev: true /@babel/types@7.22.5: resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==} @@ -825,14 +829,14 @@ packages: '@intlify/message-compiler': 9.3.0-beta.19 '@intlify/shared': 9.3.0-beta.19 '@intlify/vue-devtools': 9.3.0-beta.19 - dev: false + dev: true /@intlify/devtools-if@9.3.0-beta.19: resolution: {integrity: sha512-L4NyqMcuQURejKy9XX0m/2kb37f56NAUvbiXKRx96pahSBclY6T+E0TrKXup0Hx6T0qY55QYGRwyVLeHXIHAMA==} engines: {node: '>= 16'} dependencies: '@intlify/shared': 9.3.0-beta.19 - dev: false + dev: true /@intlify/message-compiler@9.3.0-beta.19: resolution: {integrity: sha512-5RBn5tMOsWh5FqM65IfEJvfpRS8R0lHEUVNDa2rNc9Y7oGEI7swezlbFqU9Kc5FyHy5Kx2jHtdgFIipDwnIYFQ==} @@ -840,12 +844,12 @@ packages: dependencies: '@intlify/shared': 9.3.0-beta.19 source-map: 0.6.1 - dev: false + dev: true /@intlify/shared@9.3.0-beta.19: resolution: {integrity: sha512-+lhQggrLvlQ/O5OmIYAc9gadcYXMoaDi0Doef+X/f6TLZFr9PTMjOpBWmpwNNHi026e54jckntUn6GzqDtIN4w==} engines: {node: '>= 16'} - dev: false + dev: true /@intlify/vue-devtools@9.3.0-beta.19: resolution: {integrity: sha512-7yz8sUbovPUIf8sCX3+sMdw/xEyeHKBCc7Agxcxv54PiQz3zwsVl0hC1X+JXUy46FiPsMEoFfY8O27xOFLupaw==} @@ -853,7 +857,7 @@ packages: dependencies: '@intlify/core-base': 9.3.0-beta.19 '@intlify/shared': 9.3.0-beta.19 - dev: false + dev: true /@ioredis/commands@1.2.0: resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==} @@ -908,6 +912,7 @@ packages: /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true /@jridgewell/trace-mapping@0.3.18: resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} @@ -1817,20 +1822,6 @@ packages: picomatch: 2.3.1 dev: true - /@rollup/pluginutils@5.0.2: - resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0 - peerDependenciesMeta: - rollup: - optional: true - dependencies: - '@types/estree': 1.0.1 - estree-walker: 2.0.2 - picomatch: 2.3.1 - dev: true - /@rollup/pluginutils@5.0.2(rollup@3.24.0): resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} @@ -2073,7 +2064,7 @@ packages: resolution: {integrity: sha512-YBL4ziFebbbfQfH5mlC+QTJsvh0oJUrWbmxKMyEdL7emlHJqGR2Qb34TEFKj+VCayBvjKy3xczMFNhugThUsfQ==} dependencies: '@types/trusted-types': 2.0.3 - dev: false + dev: true /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} @@ -2151,7 +2142,7 @@ packages: /@types/trusted-types@2.0.3: resolution: {integrity: sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g==} - dev: false + dev: true /@types/unist@2.0.6: resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} @@ -2665,6 +2656,7 @@ packages: '@vue/shared': 3.3.2 estree-walker: 2.0.2 source-map-js: 1.0.2 + dev: true /@vue/compiler-core@3.3.4: resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==} @@ -2680,6 +2672,7 @@ packages: dependencies: '@vue/compiler-core': 3.3.2 '@vue/shared': 3.3.2 + dev: true /@vue/compiler-dom@3.3.4: resolution: {integrity: sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==} @@ -2701,6 +2694,7 @@ packages: magic-string: 0.30.0 postcss: 8.4.24 source-map-js: 1.0.2 + dev: true /@vue/compiler-sfc@3.3.4: resolution: {integrity: sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==} @@ -2722,6 +2716,7 @@ packages: dependencies: '@vue/compiler-dom': 3.3.2 '@vue/shared': 3.3.2 + dev: true /@vue/compiler-ssr@3.3.4: resolution: {integrity: sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==} @@ -2732,6 +2727,7 @@ packages: /@vue/devtools-api@6.5.0: resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==} + dev: true /@vue/eslint-config-prettier@7.1.0(eslint@8.39.0)(prettier@2.8.8): resolution: {integrity: sha512-Pv/lVr0bAzSIHLd9iz0KnvAr4GKyCEl+h52bc4e5yWuDVtLgFwycF7nrbWTAQAS+FU6q1geVd07lc6EWfJiWKQ==} @@ -2774,6 +2770,7 @@ packages: '@vue/shared': 3.3.2 estree-walker: 2.0.2 magic-string: 0.30.0 + dev: true /@vue/reactivity-transform@3.3.4: resolution: {integrity: sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==} @@ -2789,6 +2786,7 @@ packages: resolution: {integrity: sha512-yX8C4uTgg2Tdj+512EEMnMKbLveoITl7YdQX35AYgx8vBvQGszKiiCN46g4RY6/deeo/5DLbeUUGxCq1qWMf5g==} dependencies: '@vue/shared': 3.3.2 + dev: true /@vue/reactivity@3.3.4: resolution: {integrity: sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==} @@ -2801,6 +2799,7 @@ packages: dependencies: '@vue/reactivity': 3.3.2 '@vue/shared': 3.3.2 + dev: true /@vue/runtime-core@3.3.4: resolution: {integrity: sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==} @@ -2815,6 +2814,7 @@ packages: '@vue/runtime-core': 3.3.2 '@vue/shared': 3.3.2 csstype: 3.1.2 + dev: true /@vue/runtime-dom@3.3.4: resolution: {integrity: sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==} @@ -2832,6 +2832,7 @@ packages: '@vue/compiler-ssr': 3.3.2 '@vue/shared': 3.3.2 vue: 3.3.2 + dev: true /@vue/server-renderer@3.3.4(vue@3.3.2): resolution: {integrity: sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==} @@ -2856,6 +2857,7 @@ packages: /@vue/shared@3.3.2: resolution: {integrity: sha512-0rFu3h8JbclbnvvKrs7Fe5FNGV9/5X2rPD7KmOzhLSUAiQH5//Hq437Gv0fR5Mev3u/nbtvmLl8XgwCU20/ZfQ==} + dev: true /@vue/shared@3.3.4: resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==} @@ -4194,6 +4196,7 @@ packages: /csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + dev: true /cuint@0.2.2: resolution: {integrity: sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==} @@ -5173,6 +5176,7 @@ packages: /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + dev: true /estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} @@ -7100,6 +7104,7 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + dev: true /magicast@0.2.9: resolution: {integrity: sha512-S1WBXLSVKa34X+Bv7pfA8Umqc1BoglsqzWaQcyuexDc0cjgnERaFTSHbne2OfT27lXYxt/B/sV/2Kh0HaSQkfg==} @@ -7910,6 +7915,7 @@ packages: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + dev: true /nanoid@4.0.2: resolution: {integrity: sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==} @@ -8958,6 +8964,7 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -9399,6 +9406,7 @@ packages: nanoid: 3.3.6 picocolors: 1.0.0 source-map-js: 1.0.2 + dev: true /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} @@ -10348,6 +10356,7 @@ packages: /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} + dev: true /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} @@ -10359,6 +10368,7 @@ packages: /source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + dev: true /source-map@0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} @@ -10814,6 +10824,7 @@ packages: /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} + dev: true /to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} @@ -11579,7 +11590,7 @@ packages: dependencies: '@babel/parser': 7.22.4 '@microsoft/api-extractor': 7.35.2(@types/node@18.16.8) - '@rollup/pluginutils': 5.0.2 + '@rollup/pluginutils': 5.0.2(rollup@3.24.0) '@rushstack/node-core-library': 3.59.3(@types/node@18.16.8) debug: 4.3.4 fast-glob: 3.2.12 @@ -11876,7 +11887,7 @@ packages: '@intlify/vue-devtools': 9.3.0-beta.19 '@vue/devtools-api': 6.5.0 vue: 3.3.2 - dev: false + dev: true /vue-router@4.2.2(vue@3.3.4): resolution: {integrity: sha512-cChBPPmAflgBGmy3tBsjeoe3f3VOSG6naKyY5pjtrqLGbNEXdzCigFUHgBvp9e3ysAtFtEx7OLqcSDh/1Cq2TQ==} @@ -11914,6 +11925,7 @@ packages: '@vue/runtime-dom': 3.3.2 '@vue/server-renderer': 3.3.2(vue@3.3.2) '@vue/shared': 3.3.2 + dev: true /vue@3.3.4: resolution: {integrity: sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==} From 0d6889517fb47e36e3a9ab2b9d9329bc9a17f8c8 Mon Sep 17 00:00:00 2001 From: motea927 Date: Mon, 19 Jun 2023 10:33:51 +0800 Subject: [PATCH 2/4] chore: split playgrounds test components --- packages/docs/content/0.index.md | 2 +- playgrounds/App.vue | 59 +++++--------------------------- playgrounds/DataSet.vue | 14 ++++++++ playgrounds/NotMatchTest.vue | 21 ++++++++++++ playgrounds/ValidTest.vue | 30 ++++++++++++++++ playgrounds/main.ts | 1 + 6 files changed, 75 insertions(+), 52 deletions(-) create mode 100644 playgrounds/DataSet.vue create mode 100644 playgrounds/NotMatchTest.vue create mode 100644 playgrounds/ValidTest.vue diff --git a/packages/docs/content/0.index.md b/packages/docs/content/0.index.md index 0e8afdc..3eeaa54 100644 --- a/packages/docs/content/0.index.md +++ b/packages/docs/content/0.index.md @@ -20,7 +20,7 @@ snippet: pnpm add mt-v-safe-html --- #title -A good alternative for v-html. +A good guard method before using v-html. #description A lightweight, flexible, and robust XSS sanitizer's Vue directive based on DOMPurify. diff --git a/playgrounds/App.vue b/playgrounds/App.vue index abf583c..10dbe7a 100644 --- a/playgrounds/App.vue +++ b/playgrounds/App.vue @@ -1,67 +1,24 @@ diff --git a/playgrounds/NotMatchTest.vue b/playgrounds/NotMatchTest.vue new file mode 100644 index 0000000..eb18609 --- /dev/null +++ b/playgrounds/NotMatchTest.vue @@ -0,0 +1,21 @@ + + + diff --git a/playgrounds/ValidTest.vue b/playgrounds/ValidTest.vue new file mode 100644 index 0000000..94b9576 --- /dev/null +++ b/playgrounds/ValidTest.vue @@ -0,0 +1,30 @@ + + + diff --git a/playgrounds/main.ts b/playgrounds/main.ts index df34297..3481e61 100644 --- a/playgrounds/main.ts +++ b/playgrounds/main.ts @@ -17,4 +17,5 @@ const i18n = createI18n({ createApp(App) .use(i18n) .use(createSafeHtml, { defaultString: 'globalDefaultString' }) + .use(createI18nHtml) .mount('#app') From 6a13f21296fbd094fd2985130b66664104139a24 Mon Sep 17 00:00:00 2001 From: motea927 Date: Mon, 19 Jun 2023 10:42:05 +0800 Subject: [PATCH 3/4] fix: fix @vue/runtime-core types error --- packages/core/main.ts | 2 ++ packages/core/{index.d.ts => types.ts} | 0 vite.config.ts | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) rename packages/core/{index.d.ts => types.ts} (100%) diff --git a/packages/core/main.ts b/packages/core/main.ts index ef32db9..4908dd1 100644 --- a/packages/core/main.ts +++ b/packages/core/main.ts @@ -1,2 +1,4 @@ +import './types' + export { setGlobalOptions } from './shared' export { createI18nHtml, createSafeHtml } from './plugins' diff --git a/packages/core/index.d.ts b/packages/core/types.ts similarity index 100% rename from packages/core/index.d.ts rename to packages/core/types.ts diff --git a/vite.config.ts b/vite.config.ts index 72a3a5f..b1c6085 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ dts({ include: ['packages/core/*.ts'], insertTypesEntry: true, - copyDtsFiles: true, + copyDtsFiles: false, tsConfigFilePath: './tsconfig.app.json' }) ], From 11c781eab75128b62949b46af1efcc8b01c82f1a Mon Sep 17 00:00:00 2001 From: motea927 Date: Mon, 19 Jun 2023 11:16:44 +0800 Subject: [PATCH 4/4] fix: move ComponentCustomProperties to main --- packages/core/main.ts | 9 ++++++++- packages/core/types.ts | 7 ------- 2 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 packages/core/types.ts diff --git a/packages/core/main.ts b/packages/core/main.ts index 4908dd1..0a367f6 100644 --- a/packages/core/main.ts +++ b/packages/core/main.ts @@ -1,4 +1,11 @@ -import './types' +import type { BindingObj, BindingI18nObj } from './shared' + +declare module '@vue/runtime-core' { + export interface ComponentCustomProperties { + $i18nHtml: (binding: string | BindingI18nObj) => string + $safeHtml: (binding: string | BindingObj) => string + } +} export { setGlobalOptions } from './shared' export { createI18nHtml, createSafeHtml } from './plugins' diff --git a/packages/core/types.ts b/packages/core/types.ts deleted file mode 100644 index 65b4d08..0000000 --- a/packages/core/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BindingObj, BindingI18nObj } from './shared' -declare module '@vue/runtime-core' { - export interface ComponentCustomProperties { - $i18nHtml: (binding: string | BindingI18nObj) => string - $safeHtml: (binding: string | BindingObj) => string - } -}