From 05881dfd7deb5c4fad6e22853c25937378907603 Mon Sep 17 00:00:00 2001 From: zjxxxxxxxxx <43126836+zjxxxxxxxxx@users.noreply.github.com> Date: Sun, 17 Sep 2023 21:44:36 +0800 Subject: [PATCH] chore: a few minor changes (#4) --- .DS_Store | Bin 6148 -> 0 bytes .github/FUNDING.yml | 1 + README.md | 14 +- examples/.DS_Store | Bin 6148 -> 0 bytes package.json | 1 + pnpm-lock.yaml | 284 ++++++++++++++++++++++++++++++++++++++ src/.DS_Store | Bin 6148 -> 0 bytes src/core/constants.ts | 2 +- src/core/index.ts | 3 +- src/core/transform_SFC.ts | 29 ++-- 10 files changed, 310 insertions(+), 24 deletions(-) delete mode 100644 .DS_Store create mode 100644 .github/FUNDING.yml delete mode 100644 examples/.DS_Store delete mode 100644 src/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a4e7cd5f4db87404521f9f5168811264126732d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHLJxc>Y5PcgX#1Al)2#TCwCyGH!i&J8wjbfpl8Wa2=@q!w#Jh1Q|h^2)#g1x08 z`WyTMmWrj7II}yNT`vYJQQ3jrcegXM^YU`Hn+*UpRV(IzEPxC(#&kP%4UGNV5|)yY z9zw-)l-F|$Yf+_|i1Y(q0k6PsRDj>zG)AzFP3$@EZ|Zs8_En;MzEF+|G?sbFJx=y7 z-A=mxVpD&0!&)2KPAHWY6{(92)KEa+)JJN(QH;&wW%(d;v8Z_@=Bh+>KF#7BUV0rQ zJ&L5p?k7DkbWMCdd^V5ki<_;1cReK6uHVS-)J=^VJxbWeDk`X=j1qPoJ%*QhwH}{h zY#trw*@x42JrZ$sJ(|Tiyv9zLS0}a+ktQW96F0u9CHeK;?VL4>wRz5T&&|s7^X1&O ze&30=c?Snq%)5oY!yT+SDq`@m?y)&dyms9SC&{xJ9Jd}F%9AEuyB_e&_5PaCp3Ro& zFz9=)fLFjP@Sy;&4*@mCP%t*Amk#Rm5r8mF!`kSY&k~#y2!?{OLGq9(lS*h(l^ijY zNvH8Z;zGgLph<_4!-tZ}N=_(BSEu;{9S#*5^u1TWE8r^7Vs5j%|4)B?{&$o7omaps z@UIk5>HI=|iawI;t%(oEdu>2%g&G^j#Rhc>b+R4n3*L(Pe+6yi3;2RC6pRhh2$}yO Npk?r#SKvn#cms}o%W(hz diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..e4b102a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [zjxxxxxxxxx] \ No newline at end of file diff --git a/README.md b/README.md index c2e3514..d02ef31 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,14 @@ Add a \_\_source prop to all Elements. - ✨ JSX support in `.vue`, `.jsx`, `.tsx`. - 😃 Supports `Vite`, `Webpack`, `Rspack`, `Vue CLI`, `Rollup`, `esbuild`. +> For development only + --- sfc without ```html - + @@ -21,7 +23,7 @@ sfc without with ```html - + @@ -32,8 +34,8 @@ with jsx without ```tsx -// /src/App.vue -export default App() { +// src/App.vue +export default function App() { return
hello word
} ``` @@ -41,8 +43,8 @@ export default App() { with ```tsx -// /src/App.vue -export default App() { +// src/App.vue +export default function App() { return
hello word
} ``` diff --git a/examples/.DS_Store b/examples/.DS_Store deleted file mode 100644 index 4a39421664c93fe59f7cb3fc246309f65c3ab3fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5Iwu5PcgQ2!bLK4Ha^MfRdC@naG?V1vE&Ij{uR#79!BP;s)vIC}_9@*FZ=) z0XN{y?h@=c5fuobnP~Q{XJ>ZS&z2_xz%+;522cl3qY74*Im{4Q7cEJ}TULq2?lDB# zKX0@;$sjFxtKly)AkS_Q*GSOkZ~FNKqqXVvK@!L9e$uABw*T}#dOUhLDEoB3^+_*s z?@9H6TOhzKE^ⅈT_uEe9f=r^PdEby^Uj=e-b-LzH-l6FXY{Mle|l~Ll14FI70_l zh3w{jtL%|K!}xjk^9)n_uEW9E=66yrjPF4XuI!?clegq+Yw6~s u)`rwms)+by4ksa;*iuYiDaGqlE3}6)Ax0iEhqO@ikAS5?2W8+_8TbHFuV~8v diff --git a/package.json b/package.json index e7192eb..603ed5b 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,7 @@ "@typescript-eslint/parser": "^6.6.0", "@vue/compiler-dom": "^3.3.4", "bumpp": "^9.2.0", + "changelogithub": "^0.13.0", "tsup": "^7.2.0", "typescript": "^5.2.2" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ffe9e2d..2ab5c29 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ importers: bumpp: specifier: ^9.2.0 version: 9.2.0 + changelogithub: + specifier: ^0.13.0 + version: 0.13.0 tsup: specifier: ^7.2.0 version: 7.2.0(typescript@5.2.2) @@ -178,6 +181,10 @@ packages: '@jridgewell/trace-mapping': 0.3.19 dev: true + /@antfu/utils@0.7.6: + resolution: {integrity: sha512-pvFiLP2BeOKA/ZOS6jxx4XhKzdVLHDhGlFEaZ2flWWYf2xOqVniqpk38I04DFRyz+L0ASggl7SkItTc+ZLju4w==} + dev: true + /@babel/code-frame@7.22.13: resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} engines: {node: '>=6.9.0'} @@ -4297,6 +4304,11 @@ packages: resolution: {integrity: sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==} dev: true + /big-integer@1.6.51: + resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==} + engines: {node: '>=0.6'} + dev: true + /big.js@5.2.2: resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} dev: true @@ -4363,6 +4375,13 @@ packages: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} dev: true + /bplist-parser@0.2.0: + resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==} + engines: {node: '>= 5.10.0'} + dependencies: + big-integer: 1.6.51 + dev: true + /brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} dependencies: @@ -4442,6 +4461,13 @@ packages: - supports-color dev: true + /bundle-name@3.0.0: + resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==} + engines: {node: '>=12'} + dependencies: + run-applescript: 5.0.0 + dev: true + /bundle-require@4.0.1(esbuild@0.18.20): resolution: {integrity: sha512-9NQkRHlNdNpDBGmLpngF3EFDcwodhMUuLz9PaWYciVcQF9SE4LFjM2DB/xV1Li5JiuDMv7ZUWuC3rGbqR0MAXQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -4452,6 +4478,13 @@ packages: load-tsconfig: 0.2.5 dev: true + /busboy@1.6.0: + resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} + engines: {node: '>=10.16.0'} + dependencies: + streamsearch: 1.1.0 + dev: true + /bytes@3.0.0: resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} engines: {node: '>= 0.8'} @@ -4576,6 +4609,46 @@ packages: supports-color: 7.2.0 dev: true + /changelogen@0.5.5: + resolution: {integrity: sha512-IzgToIJ/R9NhVKmL+PW33ozYkv53bXvufDNUSH3GTKXq1iCHGgkbgbtqEWbo8tnWNnt7nPDpjL8PwSG2iS8RVw==} + hasBin: true + dependencies: + c12: 1.4.2 + colorette: 2.0.20 + consola: 3.2.3 + convert-gitmoji: 0.1.3 + execa: 8.0.1 + mri: 1.2.0 + node-fetch-native: 1.4.0 + ofetch: 1.3.3 + open: 9.1.0 + pathe: 1.1.1 + pkg-types: 1.0.3 + scule: 1.0.0 + semver: 7.5.4 + std-env: 3.4.3 + yaml: 2.3.2 + transitivePeerDependencies: + - supports-color + dev: true + + /changelogithub@0.13.0: + resolution: {integrity: sha512-n7+hdHJAg1+HqPERbnd9kYEBb3AGw1bzWi1Jksvas4Jk+0Q9ePULURQi67rsM6YMiiI344+snun0f7EV/ZqCdQ==} + engines: {node: '>=12.0.0'} + hasBin: true + dependencies: + '@antfu/utils': 0.7.6 + c12: 1.4.2 + cac: 6.7.14 + changelogen: 0.5.5 + convert-gitmoji: 0.1.3 + execa: 8.0.1 + kolorist: 1.8.0 + ohmyfetch: 0.4.21 + transitivePeerDependencies: + - supports-color + dev: true + /chokidar@2.1.8: resolution: {integrity: sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==} deprecated: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies @@ -4823,6 +4896,11 @@ packages: - supports-color dev: true + /consola@3.2.3: + resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} + engines: {node: ^14.18.0 || >=16.10.0} + dev: true + /consolidate@0.15.1: resolution: {integrity: sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==} engines: {node: '>= 0.10.0'} @@ -5004,6 +5082,10 @@ packages: engines: {node: '>= 0.6'} dev: true + /convert-gitmoji@0.1.3: + resolution: {integrity: sha512-t5yxPyI8h8KPvRwrS/sRrfIpT2gJbmBAY0TFokyUBy3PM44RuFRpZwHdACz+GTSPLRLo3s4qsscOMLjHiXBwzw==} + dev: true + /convert-source-map@1.9.0: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} dev: true @@ -5317,6 +5399,24 @@ packages: engines: {node: '>=0.10.0'} dev: true + /default-browser-id@3.0.0: + resolution: {integrity: sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==} + engines: {node: '>=12'} + dependencies: + bplist-parser: 0.2.0 + untildify: 4.0.0 + dev: true + + /default-browser@4.0.0: + resolution: {integrity: sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==} + engines: {node: '>=14.16'} + dependencies: + bundle-name: 3.0.0 + default-browser-id: 3.0.0 + execa: 7.2.0 + titleize: 3.0.0 + dev: true + /default-gateway@6.0.3: resolution: {integrity: sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==} engines: {node: '>= 10'} @@ -5335,6 +5435,11 @@ packages: engines: {node: '>=8'} dev: true + /define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + dev: true + /define-properties@1.2.0: resolution: {integrity: sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==} engines: {node: '>= 0.4'} @@ -5379,6 +5484,10 @@ packages: engines: {node: '>= 0.8'} dev: true + /destr@1.2.2: + resolution: {integrity: sha512-lrbCJwD9saUQrqUfXvl6qoM+QN3W7tLV5pAOs+OqOmopCCz/JkE05MHedJR1xfk4IAnZuJXPVuN5+7jNA2ZCiA==} + dev: true + /destr@2.0.1: resolution: {integrity: sha512-M1Ob1zPSIvlARiJUkKqvAZ3VAqQY6Jcuth/pBKQ2b1dX/Qx0OnJ8Vux6J2H5PTMQeRzWrrbTu70VxBfv/OPDJA==} dev: true @@ -5773,6 +5882,36 @@ packages: strip-final-newline: 2.0.0 dev: true + /execa@7.2.0: + resolution: {integrity: sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==} + engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 4.3.1 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 3.0.7 + strip-final-newline: 3.0.0 + dev: true + + /execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + dev: true + /expand-brackets@2.1.4: resolution: {integrity: sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA==} engines: {node: '>=0.10.0'} @@ -6167,6 +6306,11 @@ packages: engines: {node: '>=10'} dev: true + /get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + dev: true + /get-value@2.0.6: resolution: {integrity: sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==} engines: {node: '>=0.10.0'} @@ -6505,6 +6649,16 @@ packages: engines: {node: '>=10.17.0'} dev: true + /human-signals@4.3.1: + resolution: {integrity: sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==} + engines: {node: '>=14.18.0'} + dev: true + + /human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -6679,6 +6833,12 @@ packages: hasBin: true dev: true + /is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + dev: true + /is-extendable@0.1.1: resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==} engines: {node: '>=0.10.0'} @@ -6724,6 +6884,14 @@ packages: dependencies: is-extglob: 2.1.1 + /is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + dependencies: + is-docker: 3.0.0 + dev: true + /is-interactive@1.0.0: resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} engines: {node: '>=8'} @@ -6782,6 +6950,11 @@ packages: engines: {node: '>=8'} dev: true + /is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /is-unicode-supported@0.1.0: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} @@ -6973,6 +7146,10 @@ packages: engines: {node: '>= 8'} dev: true + /kolorist@1.8.0: + resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + dev: true + /launch-editor-middleware@2.6.0: resolution: {integrity: sha512-K2yxgljj5TdCeRN1lBtO3/J26+AIDDDw+04y6VAiZbWcTdBwsYN6RrZBnW5DN/QiSIdKNjKdATLUUluWWFYTIA==} dependencies: @@ -7313,6 +7490,11 @@ packages: engines: {node: '>=6'} dev: true + /mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + /mini-css-extract-plugin@2.7.6(webpack@5.88.2): resolution: {integrity: sha512-Qk7HcgaPkGG6eD77mLvZS1nmxlao3j+9PkrT9Uc7HAE1id3F41+DdBRYRYkbyfNRGzm8/YWtzhw7nVPmwhqTQw==} engines: {node: '>= 12.13.0'} @@ -7504,6 +7686,10 @@ packages: tslib: 2.6.2 dev: true + /node-fetch-native@0.1.8: + resolution: {integrity: sha512-ZNaury9r0NxaT2oL65GvdGDy+5PlSaHTovT6JV5tOW07k1TQmgC0olZETa4C9KZg0+6zBr99ctTYa3Utqj9P/Q==} + dev: true + /node-fetch-native@1.4.0: resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==} dev: true @@ -7578,6 +7764,13 @@ packages: path-key: 3.1.1 dev: true + /npm-run-path@5.1.0: + resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + dev: true + /nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} dependencies: @@ -7635,10 +7828,28 @@ packages: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} dev: true + /ofetch@1.3.3: + resolution: {integrity: sha512-s1ZCMmQWXy4b5K/TW9i/DtiN8Ku+xCiHcjQ6/J/nDdssirrQNOoB165Zu8EqLMA2lln1JUth9a0aW9Ap2ctrUg==} + dependencies: + destr: 2.0.1 + node-fetch-native: 1.4.0 + ufo: 1.3.0 + dev: true + /ohash@1.1.3: resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==} dev: true + /ohmyfetch@0.4.21: + resolution: {integrity: sha512-VG7f/JRvqvBOYvL0tHyEIEG7XHWm7OqIfAs6/HqwWwDfjiJ1g0huIpe5sFEmyb+7hpFa1EGNH2aERWR72tlClw==} + deprecated: Package renamed to https://github.com/unjs/ofetch + dependencies: + destr: 1.2.2 + node-fetch-native: 0.1.8 + ufo: 0.8.6 + undici: 5.24.0 + dev: true + /on-finished@2.3.0: resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} engines: {node: '>= 0.8'} @@ -7678,6 +7889,13 @@ packages: mimic-fn: 2.1.0 dev: true + /onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + dependencies: + mimic-fn: 4.0.0 + dev: true + /open@8.4.2: resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} engines: {node: '>=12'} @@ -7687,6 +7905,16 @@ packages: is-wsl: 2.2.0 dev: true + /open@9.1.0: + resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==} + engines: {node: '>=14.16'} + dependencies: + default-browser: 4.0.0 + define-lazy-prop: 3.0.0 + is-inside-container: 1.0.0 + is-wsl: 2.2.0 + dev: true + /opener@1.5.2: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true @@ -7867,6 +8095,11 @@ packages: engines: {node: '>=8'} dev: true + /path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + dev: true + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -8748,6 +8981,13 @@ packages: fsevents: 2.3.3 dev: true + /run-applescript@5.0.0: + resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} + engines: {node: '>=12'} + dependencies: + execa: 5.1.1 + dev: true + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -8813,6 +9053,10 @@ packages: ajv-keywords: 5.1.0(ajv@8.12.0) dev: true + /scule@1.0.0: + resolution: {integrity: sha512-4AsO/FrViE/iDNEPaAQlb77tf0csuq27EsVpy6ett584EcRTp6pTDLoGWVxCD77y5iU5FauOvhsI4o1APwPoSQ==} + dev: true + /select-hose@2.0.0: resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} dev: true @@ -8961,6 +9205,11 @@ packages: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true + /signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + dev: true + /sirv@2.0.3: resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} engines: {node: '>= 10'} @@ -9158,12 +9407,21 @@ packages: engines: {node: '>= 0.8'} dev: true + /std-env@3.4.3: + resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} + dev: true + /stream-combiner@0.0.4: resolution: {integrity: sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==} dependencies: duplexer: 0.1.2 dev: true + /streamsearch@1.1.0: + resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} + engines: {node: '>=10.0.0'} + dev: true + /string-argv@0.3.2: resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} engines: {node: '>=0.6.19'} @@ -9226,6 +9484,11 @@ packages: engines: {node: '>=6'} dev: true + /strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + dev: true + /strip-indent@2.0.0: resolution: {integrity: sha512-RsSNPLpq6YUL7QYy44RnPVTn/lcVZtb48Uof3X5JLbF4zD/Gs7ZFDv2HWol+leoQN2mT86LAzSshGfkTlSOpsA==} engines: {node: '>=4'} @@ -9406,6 +9669,11 @@ packages: resolution: {integrity: sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==} dev: true + /titleize@3.0.0: + resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==} + engines: {node: '>=12'} + dev: true + /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -9587,10 +9855,21 @@ packages: hasBin: true dev: true + /ufo@0.8.6: + resolution: {integrity: sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==} + dev: true + /ufo@1.3.0: resolution: {integrity: sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==} dev: true + /undici@5.24.0: + resolution: {integrity: sha512-OKlckxBjFl0oXxcj9FU6oB8fDAaiRUq+D8jrFWGmOfI/gIyjk/IeS75LMzgYKUaeHzLUcYvf9bbJGSrUwTfwwQ==} + engines: {node: '>=14.0'} + dependencies: + busboy: 1.6.0 + dev: true + /unicode-canonical-property-names-ecmascript@2.0.0: resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==} engines: {node: '>=4'} @@ -9706,6 +9985,11 @@ packages: isobject: 3.0.1 dev: true + /untildify@4.0.0: + resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==} + engines: {node: '>=8'} + dev: true + /upath@1.2.0: resolution: {integrity: sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==} engines: {node: '>=4'} diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index db743822a9109895b3d1baa4903c626a38a60233..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJx{|>474Fb5KBkK_ZK>{g(~bwT^LbY1VgJ-mDsbfGx3MmS@}1dKR}71GBUtf z^1D3SmzUfS$0DMOr_EesCL%T5P@Zj>n&r(Wc9M|_sCJL-!+g2!cKb=?@qlqFSxYAe zxgYb-K8Cqn*S4!|w?eFbdA)qEZr`rP`OS~{{p0Z2Za}3`0V+TRr~noCmkOX~o7Lxm zT&VyRpaS0t*!Q8p4V%P1&_5kmd;|d6Z@e3>eU<ujh!-yxZ34Mc0V*(7;54=~>;KpABlG{5#2po&0)I*Yt=eU~ zz$;~MoxGg&+5*3We;I1M9E-PNptoXdtQB7j>WW<>-z4^dPDkA7K>i4rE;K6e8wz{^ DmgXrk diff --git a/src/core/constants.ts b/src/core/constants.ts index db59882..18403e8 100644 --- a/src/core/constants.ts +++ b/src/core/constants.ts @@ -9,4 +9,4 @@ export const ElementTypes = { COMPONENT: 1, }; -export const TagTypes = [ElementTypes.ELEMENT, ElementTypes.COMPONENT]; +export const TagTypes = [ElementTypes.ELEMENT, ElementTypes.COMPONENT]; diff --git a/src/core/index.ts b/src/core/index.ts index c5d6ba8..6f37232 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -26,8 +26,7 @@ export const unpluginFactory: UnpluginFactory = (options = {}) => { const parsed = parse_ID(id, root); if (parsed.isSfc) { transform_SFC(code, s, parsed); - } - if (parsed.isJsx) { + } else if (parsed.isJsx) { transform_JSX(code, s, parsed); } diff --git a/src/core/transform_SFC.ts b/src/core/transform_SFC.ts index 3c7e271..48b3554 100644 --- a/src/core/transform_SFC.ts +++ b/src/core/transform_SFC.ts @@ -1,17 +1,14 @@ +import type { AttributeNode, RootNode, TextNode } from "@vue/compiler-dom"; import { ElementNode, parse, transform } from "@vue/compiler-dom"; -import { NodeTypes, TRACE_ID, TagTypes } from "./constants"; import MagicString from "magic-string"; +import { NodeTypes, TRACE_ID, TagTypes } from "./constants"; import { transform_JSX } from "./transform_JSX"; -import { AttributeNode } from "@vue/compiler-dom"; -import { RootNode } from "@vue/compiler-dom"; -import { TextNode } from "@vue/compiler-dom"; export function transform_SFC( code: string, s: MagicString, options: { file: string; - query: any; } ) { const { file } = options; @@ -22,7 +19,7 @@ export function transform_SFC( (node) => { if ( node.type === NodeTypes.ELEMENT && - TagTypes.includes(node.tagType as any) + TagTypes.includes(node.tagType) ) { const { line, column, offset } = node.loc.start; const prependIndex = offset + node.tag.length + 1; @@ -37,7 +34,7 @@ export function transform_SFC( const jsxOpts = resolveJsxOptions(ast); if (jsxOpts) { - transform_JSX(jsxOpts.content, s, { + transform_JSX(jsxOpts.code, s, { ...jsxOpts, file, }); @@ -45,28 +42,30 @@ export function transform_SFC( } function resolveJsxOptions(ast: RootNode) { - const script = (ast.children as ElementNode[]).find( + const scriptNode = (ast.children as ElementNode[]).find( (node) => node.tag === "script" ); - if (!script) return; + if (!scriptNode) return; - const code = script?.children[0] as TextNode | undefined; - if (!code) return; + const codeNode = scriptNode.children[0] as TextNode | undefined; + if (!codeNode) return; - const langProp = script!.props.find( + const langProp = scriptNode.props.find( (prop) => prop.name === "lang" ) as AttributeNode; - const lang = langProp?.value?.content; + if (!langProp) return; + + const lang = langProp.value?.content; const isTsx = lang === "tsx"; const isJsx = isTsx || lang === "jsx"; if (isJsx) { - const { offset, line, column } = code.loc.start; + const { offset, line, column } = codeNode.loc.start; return { isTsx, startIndex: offset, startLine: line, startColumn: column, - content: code.content, + code: codeNode.content, }; } }