From bbddc1236da20468c270d09be0043beea4b384ec Mon Sep 17 00:00:00 2001 From: Damian Glowala Date: Thu, 4 Jun 2026 20:56:52 +0200 Subject: [PATCH 1/8] feat: migrate from unbuild to rolldown --- build.config.ts | 9 - package.json | 14 +- pnpm-lock.yaml | 372 ++++++++++++++++++++--- rolldown.config.ts | 18 ++ src/commands/build.ts | 381 +++++++++++++++--------- test/__snapshots__/JsxComponent.d.ts | 5 +- test/__snapshots__/JsxComponent.js | 7 +- test/__snapshots__/TestMe.vue | 12 +- test/__snapshots__/TestMe.vue.d.ts | 6 +- test/__snapshots__/TestMeSetup.d.vue.ts | 2 +- test/__snapshots__/TestMeSetup.vue | 7 +- test/__snapshots__/TestMeSetup.vue.d.ts | 2 +- test/build.spec.ts | 51 ++-- 13 files changed, 651 insertions(+), 235 deletions(-) delete mode 100644 build.config.ts create mode 100644 rolldown.config.ts diff --git a/build.config.ts b/build.config.ts deleted file mode 100644 index 4c4cd2ce..00000000 --- a/build.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineBuildConfig } from 'unbuild' - -export default defineBuildConfig({ - declaration: true, - entries: [ - './src/cli', - './src/index', - ], -}) diff --git a/package.json b/package.json index 8653a5c4..5be7db77 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,9 @@ "dist" ], "scripts": { - "build": "unbuild", - "dev:prepare": "unbuild --stub && pnpm -r dev:prepare", + "build": "rolldown -c", + "build:watch": "pnpm build -w", + "dev:prepare": "pnpm -r dev:prepare", "example:build": "pnpm nuxt-module-build build ./example", "example:stub": "pnpm nuxt-module-build build --stub ./example", "lint": "eslint .", @@ -48,13 +49,13 @@ "consola": "^3.4.2", "defu": "^6.1.7", "jiti": "^2.7.0", - "magic-regexp": "^0.11.0", - "mkdist": "^2.4.1", "mlly": "^1.8.2", "pathe": "^2.0.3", "pkg-types": "^2.3.1", + "rolldown": "^1.1.0", + "rolldown-plugin-dts": "^0.25.2", + "tinyglobby": "^0.2.17", "tsconfck": "^3.1.6", - "unbuild": "^3.6.1", "vue-sfc-transformer": "^0.2.3" }, "peerDependencies": { @@ -65,6 +66,7 @@ "@arethetypeswrong/cli": "^0.18.3", "@nuxt/cli": "^3.35.2", "@nuxt/eslint-config": "^1.15.2", + "unbuild": "^3.6.1", "@nuxt/schema": "~4.4.6", "@types/node": "^24.12.4", "@types/semver": "^7.7.1", @@ -85,6 +87,6 @@ "vue-tsc": "^3.3.3" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^22.18.0 || >=24.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4515d9c8..08865a8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,12 +29,6 @@ importers: jiti: specifier: ^2.7.0 version: 2.7.0 - magic-regexp: - specifier: ^0.11.0 - version: 0.11.0 - mkdist: - specifier: ^2.4.1 - version: 2.4.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)) mlly: specifier: ^1.8.2 version: 1.8.2 @@ -44,15 +38,21 @@ importers: pkg-types: specifier: ^2.3.1 version: 2.3.1 + rolldown: + specifier: ^1.1.0 + version: 1.1.0 + rolldown-plugin-dts: + specifier: ^0.25.2 + version: 0.25.2(oxc-resolver@11.20.0)(rolldown@1.1.0)(typescript@5.9.3)(vue-tsc@3.3.3(typescript@5.9.3)) + tinyglobby: + specifier: ^0.2.17 + version: 0.2.17 tsconfck: specifier: ^3.1.6 version: 3.1.6(typescript@5.9.3) - unbuild: - specifier: ^3.6.1 - version: 3.6.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)) vue-sfc-transformer: specifier: ^0.2.3 - version: 0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)) + version: 0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)) devDependencies: '@arethetypeswrong/cli': specifier: ^0.18.3 @@ -89,7 +89,7 @@ importers: version: 6.15.0 nuxt: specifier: ~4.4.6 - version: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) + version: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) ofetch: specifier: ^1.5.1 version: 1.5.1 @@ -108,6 +108,9 @@ importers: typescript: specifier: ~5.9.3 version: 5.9.3 + unbuild: + specifier: ^3.6.1 + version: 3.6.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)) vitest: specifier: ^4.1.7 version: 4.1.7(@types/node@24.12.4)(@vitest/coverage-v8@4.1.7)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0)) @@ -129,7 +132,7 @@ importers: version: link:.. nuxt: specifier: ~4.4.6 - version: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) + version: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) example/playground: dependencies: @@ -138,7 +141,7 @@ importers: version: link:.. nuxt: specifier: ~4.4.6 - version: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) + version: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) devDependencies: typescript: specifier: ~5.9.3 @@ -184,6 +187,10 @@ packages: resolution: {integrity: sha512-nFZPWz3FHIS7y6rMIVoa/WBwjdutfIaRJIBQjzn+t3RnecZoRNlGmGcyR2wb0T/IgSd50Kz/6dG8/LvMCRunjg==} engines: {node: ^22.18.0 || >=24.11.0} + '@babel/generator@8.0.0-rc.6': + resolution: {integrity: sha512-6mIzgVK8DgEzvIapoQwhXTMnnkuE4STQmVv9H03i/tZ2ml8oev3TRvZJgTenK2Bsq0YWNtzOrFdTyNzCMFtjJQ==} + engines: {node: ^22.18.0 || >=24.11.0} + '@babel/helper-annotate-as-pure@7.27.3': resolution: {integrity: sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==} engines: {node: '>=6.9.0'} @@ -242,6 +249,10 @@ packages: resolution: {integrity: sha512-sN7R8rBvDurfaziNfDEIjIntlazmlkCDGO4SNl2RJ3wRCn+QxspLV7hzYAE8WWVd2joVuT8sUxeePdLp2idI1A==} engines: {node: ^22.18.0 || >=24.11.0} + '@babel/helper-string-parser@8.0.0-rc.6': + resolution: {integrity: sha512-BCkFy+zN6kXQed3YOT7aJl93NfDSzQc3pBfsvTVPs9gU9X3V0aefEF5kwBT0E+mDWH9QgKaZstYUQN9VdQZT4g==} + engines: {node: ^22.18.0 || >=24.11.0} + '@babel/helper-validator-identifier@7.28.5': resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==} engines: {node: '>=6.9.0'} @@ -250,6 +261,10 @@ packages: resolution: {integrity: sha512-ehJDxHvtbZ85RtX/L2fi0h9AGsBNqB5Euv1EB8RMAvGYvD+2X+QbpzzOpbklnNXO+WSZJNOaetw2BBj27xsWVg==} engines: {node: ^22.18.0 || >=24.11.0} + '@babel/helper-validator-identifier@8.0.0-rc.6': + resolution: {integrity: sha512-nVJ+1JcCgntv8d78rRo++o2wuODT0Irknx2BF8Np4Ft2CRgjLqIs4qzSZ8b66yGbBdMWGmZBO9WEZv1hhNiSpg==} + engines: {node: ^22.18.0 || >=24.11.0} + '@babel/helper-validator-option@7.27.1': resolution: {integrity: sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==} engines: {node: '>=6.9.0'} @@ -268,6 +283,11 @@ packages: engines: {node: ^22.18.0 || >=24.11.0} hasBin: true + '@babel/parser@8.0.0-rc.6': + resolution: {integrity: sha512-rOS8IpdO7mQELkTPlCsTgPejO0bFuZdEDCGQJouYbYf9e1FLTym7Fei2pEjq8q7MWbX0ravcd7QQYKs1TxOuog==} + engines: {node: ^22.18.0 || >=24.11.0} + hasBin: true + '@babel/plugin-syntax-jsx@7.28.6': resolution: {integrity: sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==} engines: {node: '>=6.9.0'} @@ -302,6 +322,10 @@ packages: resolution: {integrity: sha512-JeSVu/m8x/zpp4CLjYHVNXuhEyOkhPXuxM8YOXjh6L4LlvQNKuUNOTo5KdBuKAcTDHw8DquToTaEkhsBqPXOaA==} engines: {node: ^22.18.0 || >=24.11.0} + '@babel/types@8.0.0-rc.6': + resolution: {integrity: sha512-p7/ABylAYlexb31wtRdIfH9L9A0Z2T/9H6zAqzqndkY2PLkvNNc580wGhp/gGKN4Sp9sQvSkhc6Oga8/O+wTyw==} + engines: {node: ^22.18.0 || >=24.11.0} + '@bcoe/v8-coverage@1.0.2': resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} @@ -1463,6 +1487,9 @@ packages: '@oxc-project/types@0.133.0': resolution: {integrity: sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==} + '@oxc-project/types@0.134.0': + resolution: {integrity: sha512-T0xuRRKrQFmocH8y+jGfpmSkGcheaJExY9lEihmR1Gm2aH+75B8CzgU2rABRQSzzDxLjZ15Sc0bRVLj5lVeNXQ==} + '@oxc-resolver/binding-android-arm-eabi@11.20.0': resolution: {integrity: sha512-IjfWOXRgJFNdORDl+Uf1aibNgZY2guOD3zmOhx1BGVb/MIiqlFTdmjpQNplSN58lhWehnX4UNqC3QwpUo8pjJg==} cpu: [arm] @@ -1822,6 +1849,101 @@ packages: resolution: {integrity: sha512-HDVTWq3H0uTXiU0eeSQntcVUTPP3GamzeXI41+x7uU9J65JgWQh3qWZHblR1i0npXfFtF+mxBiU2nJH8znxWnQ==} engines: {node: '>=18'} + '@rolldown/binding-android-arm64@1.1.0': + resolution: {integrity: sha512-gCYzGOSkYY6Z034suzd20euvds7lPzMEEla62DJGE/ZAlR4OMBnNbvnBSsIGUCAr52gaWMsloGxP4tVGtN5aCA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@rolldown/binding-darwin-arm64@1.1.0': + resolution: {integrity: sha512-JQBD77MNgu+4Z6RAyg69acugdrhhVoWesr3l47zohYZ2YV2fwkWMArkN/2p4l6Ei+Sno7W5q+UsKdVWq5Ens0w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@1.1.0': + resolution: {integrity: sha512-p/8cXUTK4Sob604e+xxPhVSbDFf29E6J0l/xESM9rdCfn3aDai3nEs6TnMHUsdD5aNlFz0+gDbiGlozLKGa2YA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@1.1.0': + resolution: {integrity: sha512-KbtOSlVv6fElujiZWMcC3aQYhEwLVVf073RcwlSmpGQvIsKZFUqc0ef4sjUuurRwfbiI6JJXji9DQn+86hawmQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@1.1.0': + resolution: {integrity: sha512-9fZ9i0o0/MQaw7om6Z6TsT7tfCk0jtbEFtC+aPqZL5RNsGWNcHvn6EHgL3dAprjq+AZzPTAQjg2JtpJaMt+6pg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@1.1.0': + resolution: {integrity: sha512-+tog7T66i+yFyIuuAnjL6xmW182W/qTBOUt6BtQ6lBIM1Eikh/fSMz4HGgvuCp5uU0zuIVWng7kDYthjCMOHcg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-arm64-musl@1.1.0': + resolution: {integrity: sha512-4b7yruLIIj/oZ3GpcLOvxcLCLDMraohn3IhQfN2hBP4w9UekG0DTIajWguJosRGfySf/+h/NwRUiMKoCpxCrqQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rolldown/binding-linux-ppc64-gnu@1.1.0': + resolution: {integrity: sha512-QRDOVZd0bhQ5jLsUsCC3dUxDWdTSVY9WMznowZgCGOrZfLLgctWpelhUASEiBwsXfat/JwYnVd1EaxMhqyT+UQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-s390x-gnu@1.1.0': + resolution: {integrity: sha512-ypxT+Hq76NFG7woFbNbySnGEajFuYuIXeKz/jfCU+lXUoxfi3zLE6OG/ZQNeK3RpZSYJlAe2bokpsQ046CaieQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-x64-gnu@1.1.0': + resolution: {integrity: sha512-IdovCmfROFmpTLahdecTDFL74aLERVYN68F/mLZjfVh6LfoplPfI6deyHNMTcVujbokDV5k05XrFO22zfv+qjg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-x64-musl@1.1.0': + resolution: {integrity: sha512-pcA8xlFp2tyk9T2R6Fi/rPe3bQ1MA+sSMDNUU5Ogu80GHOatkE4P8YCreGAvZErm5Ho2YRXnyvNrWiRncfVysQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rolldown/binding-openharmony-arm64@1.1.0': + resolution: {integrity: sha512-4+fexHayrLCWpriPh4c6dNvL4an34DEZCG7zOM/FD5QNF6h8DT+bDXzyB/kfC8lDJbaFb7jKShtnjDQFXVQEjg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-wasm32-wasi@1.1.0': + resolution: {integrity: sha512-SbL++MNmOw6QamrwIGDMSSfM4ceTzFr+RjbOExJSLLBinScU4WI5OdA413h1qwPw2yH7lVF1+H4svQ+6mSXKTQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [wasm32] + + '@rolldown/binding-win32-arm64-msvc@1.1.0': + resolution: {integrity: sha512-+xTE6XC7wBgk0VKRXGG+QAnyW5S9b8vfsFpiMjf0waQTmSQSU8onsH/beyZ8X4aXVveJnotiy7VDjLOaW8bTrg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@1.1.0': + resolution: {integrity: sha512-Ogji1TQNqH3ACLnYr+1Ns1nyrJ0CO2P585u9Hsh02pXvtFiFpgtgT2b3P4PnCOU86VVCvqtAeCN4OftMT8KU4w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@rolldown/pluginutils@1.0.1': resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} @@ -2523,6 +2645,10 @@ packages: resolution: {integrity: sha512-m1Q/RaVOnTp9JxPX+F+Zn7IcLYMzM8kZofDImfsKZd8MbR+ikdOzTeztStWqfrqIxZnYWryyI9ePm3NGjnZgGw==} engines: {node: '>=20.19.0'} + ast-kit@3.0.0-beta.1: + resolution: {integrity: sha512-trmleAnZ2PxN/loHWVhhx1qeOHSRXq4TDsBBxq3GqeJitfk3+jTQ+v/C1km/KYq9M7wKqCewMh+/NAvVH7m+bw==} + engines: {node: '>=20.19.0'} + ast-v8-to-istanbul@1.0.0: resolution: {integrity: sha512-1fSfIwuDICFA4LKkCzRPO7F0hzFf0B7+Xqrl27ynQaa+Rh0e1Es0v6kWHPott3lU10AyAr7oKHa65OppjLn3Rg==} @@ -3004,6 +3130,15 @@ packages: resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==} engines: {node: '>=12'} + dts-resolver@3.0.0: + resolution: {integrity: sha512-1T1f+z+4tl9XD+m+0HBgWoL/nm0bOIffyWaUuUSBlFg/86IWvfx+wjNaO/ybU0AJzG9/Mi5hBUgGV6zCmWEN7Q==} + engines: {node: ^22.18.0 || >=24.0.0} + peerDependencies: + oxc-resolver: '>=11.0.0' + peerDependenciesMeta: + oxc-resolver: + optional: true + duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} @@ -3381,6 +3516,10 @@ packages: get-tsconfig@4.14.0: resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==} + get-tsconfig@5.0.0-beta.5: + resolution: {integrity: sha512-/6gFNr0N04nob252sTQxyFLi3eKFRqIg1I87YcqAMT1i6SQrSF6KujUEQrtrjMV0H/eejTCltLdDSTEMzHbnsQ==} + engines: {node: '>=20.20.0'} + giget@3.2.0: resolution: {integrity: sha512-GvHTWcykIR/fP8cj8dMpuMMkvaeJfPvYnhq0oW+chSeIr+ldX21ifU2Ms6KBoyKZQZmVaUAAhQ2EZ68KJF8a7A==} hasBin: true @@ -4621,6 +4760,30 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rolldown-plugin-dts@0.25.2: + resolution: {integrity: sha512-nMhN/R+vmR8GM45ZW1FWMSjRTSDDn/6w4GTf8RNrEFCBdl8B1kySWrU1ixPtbwzXoRlcO+R/S88VgXuJQwfdDg==} + engines: {node: ^22.18.0 || >=24.0.0} + peerDependencies: + '@ts-macro/tsc': ^0.3.6 + '@typescript/native-preview': '>=7.0.0-dev.20260325.1' + rolldown: ^1.0.0 + typescript: ~5.9.3 + vue-tsc: ^3.3.3 + peerDependenciesMeta: + '@ts-macro/tsc': + optional: true + '@typescript/native-preview': + optional: true + typescript: + optional: true + vue-tsc: + optional: true + + rolldown@1.1.0: + resolution: {integrity: sha512-zpMvlJhs5PkXRTtKc0CaLBVI9AR/VDiJFpM+kx//hgToEca7FgMlGjaRIisXBcb19T76LswgmKECSQ96hjWr5A==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + rollup-plugin-dts@6.4.1: resolution: {integrity: sha512-l//F3Zf7ID5GoOfLfD8kroBjQKEKpy1qfhtAdnpibFZMffPaylrg1CoDC2vGkPeTeyxUe4bVFCln2EFuL7IGGg==} engines: {node: '>=20'} @@ -4942,6 +5105,10 @@ packages: resolution: {integrity: sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==} engines: {node: '>=12.0.0'} + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + tinyrainbow@3.1.0: resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} engines: {node: '>=14.0.0'} @@ -5589,6 +5756,15 @@ snapshots: '@types/jsesc': 2.5.1 jsesc: 3.1.0 + '@babel/generator@8.0.0-rc.6': + dependencies: + '@babel/parser': 8.0.0-rc.6 + '@babel/types': 8.0.0-rc.6 + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + '@types/jsesc': 2.5.1 + jsesc: 3.1.0 + '@babel/helper-annotate-as-pure@7.27.3': dependencies: '@babel/types': 7.29.0 @@ -5665,10 +5841,14 @@ snapshots: '@babel/helper-string-parser@8.0.0-rc.5': {} + '@babel/helper-string-parser@8.0.0-rc.6': {} + '@babel/helper-validator-identifier@7.28.5': {} '@babel/helper-validator-identifier@8.0.0-rc.5': {} + '@babel/helper-validator-identifier@8.0.0-rc.6': {} + '@babel/helper-validator-option@7.27.1': {} '@babel/helpers@7.29.2': @@ -5684,6 +5864,10 @@ snapshots: dependencies: '@babel/types': 8.0.0-rc.5 + '@babel/parser@8.0.0-rc.6': + dependencies: + '@babel/types': 8.0.0-rc.6 + '@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 @@ -5733,6 +5917,11 @@ snapshots: '@babel/helper-string-parser': 8.0.0-rc.5 '@babel/helper-validator-identifier': 8.0.0-rc.5 + '@babel/types@8.0.0-rc.6': + dependencies: + '@babel/helper-string-parser': 8.0.0-rc.6 + '@babel/helper-validator-identifier': 8.0.0-rc.6 + '@bcoe/v8-coverage@1.0.2': {} '@bomb.sh/tab@0.0.15(cac@6.7.14)(citty@0.2.2)': @@ -6357,7 +6546,7 @@ snapshots: transitivePeerDependencies: - magicast - '@nuxt/nitro-server@4.4.6(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(db0@0.3.4)(ioredis@5.10.1)(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(oxc-parser@0.131.0)(srvx@0.11.15)(typescript@5.9.3)': + '@nuxt/nitro-server@4.4.6(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(db0@0.3.4)(ioredis@5.10.1)(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(oxc-parser@0.131.0)(rolldown@1.1.0)(srvx@0.11.15)(typescript@5.9.3)': dependencies: '@nuxt/devalue': 2.0.2 '@nuxt/kit': 4.4.6(magicast@0.5.2) @@ -6374,8 +6563,8 @@ snapshots: impound: 1.1.5 klona: 2.0.6 mocked-exports: 0.1.1 - nitropack: 2.13.4(oxc-parser@0.131.0)(srvx@0.11.15) - nuxt: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) + nitropack: 2.13.4(oxc-parser@0.131.0)(rolldown@1.1.0)(srvx@0.11.15) + nuxt: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) nypm: 0.6.6 ohash: 2.0.11 pathe: 2.0.3 @@ -6444,7 +6633,7 @@ snapshots: rc9: 3.0.1 std-env: 4.1.0 - '@nuxt/vite-builder@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@types/node@24.12.4)(eslint@10.4.1(jiti@2.7.0))(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(terser@5.46.2)(typescript@5.9.3)(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3))(yaml@2.9.0)': + '@nuxt/vite-builder@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@types/node@24.12.4)(eslint@10.4.1(jiti@2.7.0))(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(terser@5.46.2)(typescript@5.9.3)(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3))(yaml@2.9.0)': dependencies: '@nuxt/kit': 4.4.6(magicast@0.5.2) '@rollup/plugin-replace': 6.0.3(rollup@4.60.2) @@ -6462,7 +6651,7 @@ snapshots: magic-string: 0.30.21 mlly: 1.8.2 mocked-exports: 0.1.1 - nuxt: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) + nuxt: 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0) nypm: 0.6.6 pathe: 2.0.3 pkg-types: 2.3.1 @@ -6478,7 +6667,8 @@ snapshots: vue-bundle-renderer: 2.2.0 optionalDependencies: '@babel/plugin-syntax-jsx': 7.28.6(@babel/core@7.29.0) - rollup-plugin-visualizer: 7.0.1(rollup@4.60.2) + rolldown: 1.1.0 + rollup-plugin-visualizer: 7.0.1(rolldown@1.1.0)(rollup@4.60.2) transitivePeerDependencies: - '@biomejs/biome' - '@types/node' @@ -6700,6 +6890,8 @@ snapshots: '@oxc-project/types@0.133.0': {} + '@oxc-project/types@0.134.0': {} + '@oxc-resolver/binding-android-arm-eabi@11.20.0': optional: true @@ -6923,6 +7115,55 @@ snapshots: '@publint/pack@0.1.4': {} + '@rolldown/binding-android-arm64@1.1.0': + optional: true + + '@rolldown/binding-darwin-arm64@1.1.0': + optional: true + + '@rolldown/binding-darwin-x64@1.1.0': + optional: true + + '@rolldown/binding-freebsd-x64@1.1.0': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.1.0': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.1.0': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.1.0': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.1.0': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.1.0': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.1.0': + optional: true + + '@rolldown/binding-linux-x64-musl@1.1.0': + optional: true + + '@rolldown/binding-openharmony-arm64@1.1.0': + optional: true + + '@rolldown/binding-wasm32-wasi@1.1.0': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@napi-rs/wasm-runtime': 1.1.4(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.1.0': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.1.0': + optional: true + '@rolldown/pluginutils@1.0.1': {} '@rollup/plugin-alias@5.1.1(rollup@4.60.2)': @@ -7614,6 +7855,12 @@ snapshots: '@babel/parser': 7.29.3 pathe: 2.0.3 + ast-kit@3.0.0-beta.1: + dependencies: + '@babel/parser': 8.0.0-rc.5 + estree-walker: 3.0.3 + pathe: 2.0.3 + ast-v8-to-istanbul@1.0.0: dependencies: '@jridgewell/trace-mapping': 0.3.31 @@ -8086,6 +8333,10 @@ snapshots: dotenv@17.4.2: {} + dts-resolver@3.0.0(oxc-resolver@11.20.0): + optionalDependencies: + oxc-resolver: 11.20.0 + duplexer@0.1.2: {} eastasianwidth@0.2.0: {} @@ -8544,6 +8795,10 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + get-tsconfig@5.0.0-beta.5: + dependencies: + resolve-pkg-maps: 1.0.0 + giget@3.2.0: {} glob-parent@5.1.2: @@ -8987,7 +9242,7 @@ snapshots: dependencies: minipass: 7.1.3 - mkdist@2.4.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)): + mkdist@2.4.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)): dependencies: autoprefixer: 10.5.0(postcss@8.5.15) citty: 0.1.6 @@ -9005,7 +9260,7 @@ snapshots: optionalDependencies: typescript: 5.9.3 vue: 3.5.35(typescript@5.9.3) - vue-sfc-transformer: 0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)) + vue-sfc-transformer: 0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)) vue-tsc: 3.3.3(typescript@5.9.3) mlly@1.8.2: @@ -9039,7 +9294,7 @@ snapshots: natural-compare@1.4.0: {} - nitropack@2.13.4(oxc-parser@0.131.0)(srvx@0.11.15): + nitropack@2.13.4(oxc-parser@0.131.0)(rolldown@1.1.0)(srvx@0.11.15): dependencies: '@cloudflare/kv-asset-handler': 0.4.2 '@rollup/plugin-alias': 6.0.0(rollup@4.60.2) @@ -9092,7 +9347,7 @@ snapshots: pretty-bytes: 7.1.0 radix3: 1.1.2 rollup: 4.60.2 - rollup-plugin-visualizer: 7.0.1(rollup@4.60.2) + rollup-plugin-visualizer: 7.0.1(rolldown@1.1.0)(rollup@4.60.2) scule: 1.3.0 semver: 7.8.1 serve-placeholder: 2.0.2 @@ -9104,7 +9359,7 @@ snapshots: uncrypto: 0.1.3 unctx: 2.5.0 unenv: 2.0.0-rc.24 - unimport: 6.3.0(oxc-parser@0.131.0) + unimport: 6.3.0(oxc-parser@0.131.0)(rolldown@1.1.0) unplugin-utils: 0.3.1 unstorage: 1.17.5(db0@0.3.4)(ioredis@5.10.1) untyped: 2.0.0 @@ -9194,16 +9449,16 @@ snapshots: dependencies: boolbase: 1.0.0 - nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0): + nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0): dependencies: '@dxup/nuxt': 0.4.1(magicast@0.5.2)(typescript@5.9.3) '@nuxt/cli': 3.35.2(@nuxt/schema@4.4.6)(cac@6.7.14)(magicast@0.5.2) '@nuxt/devtools': 3.2.4(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue@3.5.35(typescript@5.9.3)) '@nuxt/kit': 4.4.6(magicast@0.5.2) - '@nuxt/nitro-server': 4.4.6(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(db0@0.3.4)(ioredis@5.10.1)(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(oxc-parser@0.131.0)(srvx@0.11.15)(typescript@5.9.3) + '@nuxt/nitro-server': 4.4.6(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(db0@0.3.4)(ioredis@5.10.1)(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(oxc-parser@0.131.0)(rolldown@1.1.0)(srvx@0.11.15)(typescript@5.9.3) '@nuxt/schema': 4.4.6 '@nuxt/telemetry': 2.8.0(@nuxt/kit@4.4.6(magicast@0.5.2)) - '@nuxt/vite-builder': 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@types/node@24.12.4)(eslint@10.4.1(jiti@2.7.0))(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.2))(rollup@4.60.2)(terser@5.46.2)(typescript@5.9.3)(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3))(yaml@2.9.0) + '@nuxt/vite-builder': 4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@types/node@24.12.4)(eslint@10.4.1(jiti@2.7.0))(magicast@0.5.2)(nuxt@4.4.6(@babel/plugin-syntax-jsx@7.28.6(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@parcel/watcher@2.5.6)(@types/node@24.12.4)(@vue/compiler-sfc@3.5.35)(cac@6.7.14)(db0@0.3.4)(eslint@10.4.1(jiti@2.7.0))(ioredis@5.10.1)(magicast@0.5.2)(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(srvx@0.11.15)(terser@5.46.2)(typescript@5.9.3)(vite@7.3.3(@types/node@24.12.4)(jiti@2.7.0)(terser@5.46.2)(yaml@2.9.0))(vue-tsc@3.3.3(typescript@5.9.3))(yaml@2.9.0))(optionator@0.9.4)(rolldown@1.1.0)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2))(rollup@4.60.2)(terser@5.46.2)(typescript@5.9.3)(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3))(yaml@2.9.0) '@unhead/vue': 2.1.15(vue@3.5.35(typescript@5.9.3)) '@vue/shared': 3.5.35 chokidar: 5.0.0 @@ -9231,7 +9486,7 @@ snapshots: oxc-minify: 0.131.0 oxc-parser: 0.131.0 oxc-transform: 0.131.0 - oxc-walker: 1.0.0(oxc-parser@0.131.0) + oxc-walker: 1.0.0(oxc-parser@0.131.0)(rolldown@1.1.0) pathe: 2.0.3 perfect-debounce: 2.1.0 picomatch: 4.0.4 @@ -9245,7 +9500,7 @@ snapshots: ultrahtml: 1.6.0 uncrypto: 0.1.3 unctx: 2.5.0 - unimport: 6.3.0(oxc-parser@0.131.0) + unimport: 6.3.0(oxc-parser@0.131.0)(rolldown@1.1.0) unplugin: 3.0.0 unrouting: 0.1.7 untyped: 2.0.0 @@ -9499,11 +9754,12 @@ snapshots: '@oxc-transform/binding-win32-ia32-msvc': 0.131.0 '@oxc-transform/binding-win32-x64-msvc': 0.131.0 - oxc-walker@1.0.0(oxc-parser@0.131.0): + oxc-walker@1.0.0(oxc-parser@0.131.0)(rolldown@1.1.0): dependencies: magic-regexp: 0.11.0 optionalDependencies: oxc-parser: 0.131.0 + rolldown: 1.1.0 p-limit@3.1.0: dependencies: @@ -10035,6 +10291,44 @@ snapshots: reusify@1.1.0: {} + rolldown-plugin-dts@0.25.2(oxc-resolver@11.20.0)(rolldown@1.1.0)(typescript@5.9.3)(vue-tsc@3.3.3(typescript@5.9.3)): + dependencies: + '@babel/generator': 8.0.0-rc.6 + '@babel/helper-validator-identifier': 8.0.0-rc.6 + '@babel/parser': 8.0.0-rc.6 + ast-kit: 3.0.0-beta.1 + birpc: 4.0.0 + dts-resolver: 3.0.0(oxc-resolver@11.20.0) + get-tsconfig: 5.0.0-beta.5 + obug: 2.1.1 + rolldown: 1.1.0 + optionalDependencies: + typescript: 5.9.3 + vue-tsc: 3.3.3(typescript@5.9.3) + transitivePeerDependencies: + - oxc-resolver + + rolldown@1.1.0: + dependencies: + '@oxc-project/types': 0.134.0 + '@rolldown/pluginutils': 1.0.1 + optionalDependencies: + '@rolldown/binding-android-arm64': 1.1.0 + '@rolldown/binding-darwin-arm64': 1.1.0 + '@rolldown/binding-darwin-x64': 1.1.0 + '@rolldown/binding-freebsd-x64': 1.1.0 + '@rolldown/binding-linux-arm-gnueabihf': 1.1.0 + '@rolldown/binding-linux-arm64-gnu': 1.1.0 + '@rolldown/binding-linux-arm64-musl': 1.1.0 + '@rolldown/binding-linux-ppc64-gnu': 1.1.0 + '@rolldown/binding-linux-s390x-gnu': 1.1.0 + '@rolldown/binding-linux-x64-gnu': 1.1.0 + '@rolldown/binding-linux-x64-musl': 1.1.0 + '@rolldown/binding-openharmony-arm64': 1.1.0 + '@rolldown/binding-wasm32-wasi': 1.1.0 + '@rolldown/binding-win32-arm64-msvc': 1.1.0 + '@rolldown/binding-win32-x64-msvc': 1.1.0 + rollup-plugin-dts@6.4.1(rollup@4.60.2)(typescript@5.9.3): dependencies: '@jridgewell/remapping': 2.3.5 @@ -10046,13 +10340,14 @@ snapshots: optionalDependencies: '@babel/code-frame': 7.29.0 - rollup-plugin-visualizer@7.0.1(rollup@4.60.2): + rollup-plugin-visualizer@7.0.1(rolldown@1.1.0)(rollup@4.60.2): dependencies: open: 11.0.0 picomatch: 4.0.4 source-map: 0.7.6 yargs: 18.0.0 optionalDependencies: + rolldown: 1.1.0 rollup: 4.60.2 rollup@4.60.2: @@ -10391,6 +10686,11 @@ snapshots: fdir: 6.5.0(picomatch@4.0.4) picomatch: 4.0.4 + tinyglobby@0.2.17: + dependencies: + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 + tinyrainbow@3.1.0: {} to-regex-range@5.0.1: @@ -10439,7 +10739,7 @@ snapshots: unbash@3.0.0: {} - unbuild@3.6.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)): + unbuild@3.6.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)): dependencies: '@rollup/plugin-alias': 5.1.1(rollup@4.60.2) '@rollup/plugin-commonjs': 28.0.9(rollup@4.60.2) @@ -10455,7 +10755,7 @@ snapshots: hookable: 5.5.3 jiti: 2.7.0 magic-string: 0.30.21 - mkdist: 2.4.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)) + mkdist: 2.4.1(typescript@5.9.3)(vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)))(vue-tsc@3.3.3(typescript@5.9.3))(vue@3.5.35(typescript@5.9.3)) mlly: 1.8.2 pathe: 2.0.3 pkg-types: 2.3.1 @@ -10500,7 +10800,7 @@ snapshots: unicorn-magic@0.4.0: {} - unimport@6.3.0(oxc-parser@0.131.0): + unimport@6.3.0(oxc-parser@0.131.0)(rolldown@1.1.0): dependencies: acorn: 8.16.0 escape-string-regexp: 5.0.0 @@ -10518,6 +10818,7 @@ snapshots: unplugin-utils: 0.3.1 optionalDependencies: oxc-parser: 0.131.0 + rolldown: 1.1.0 unplugin-utils@0.3.1: dependencies: @@ -10787,7 +11088,7 @@ snapshots: optionalDependencies: '@vue/compiler-sfc': 3.5.35 - vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)): + vue-sfc-transformer@0.2.3(@volar/typescript@2.4.28)(@vue/compiler-core@3.5.35)(@vue/language-core@3.3.3)(esbuild@0.28.0)(rolldown@1.1.0)(typescript@5.9.3)(vue@3.5.35(typescript@5.9.3)): dependencies: '@babel/parser': 7.29.3 '@vue/compiler-core': 3.5.35 @@ -10798,6 +11099,7 @@ snapshots: optionalDependencies: '@volar/typescript': 2.4.28 '@vue/language-core': 3.3.3 + rolldown: 1.1.0 typescript: 5.9.3 vue-tsc@3.3.3(typescript@5.9.3): diff --git a/rolldown.config.ts b/rolldown.config.ts new file mode 100644 index 00000000..41a4ad10 --- /dev/null +++ b/rolldown.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from 'rolldown' +import { dts } from 'rolldown-plugin-dts' + +export default defineConfig({ + input: [ + './src/cli.ts', + './src/index.ts', + ], + platform: 'node', + external: /^(?!\.|\/|[a-z]:[\\/])/i, + plugins: [ + dts(), + ], + output: { + entryFileNames: '[name].mjs', + chunkFileNames: '[name].mjs', + }, +}) diff --git a/src/commands/build.ts b/src/commands/build.ts index 6ef49ff8..207bd7c4 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -1,22 +1,21 @@ import { existsSync, promises as fsp } from 'node:fs' import { pathToFileURL } from 'node:url' -import { basename, dirname, extname, join, normalize, resolve } from 'pathe' +import { basename, dirname, extname, isAbsolute, normalize, relative, resolve } from 'pathe' import { filename } from 'pathe/utils' import { readPackageJSON } from 'pkg-types' import { parse } from 'tsconfck' -import type { TSConfig } from 'pkg-types' import { defu } from 'defu' import { createJiti } from 'jiti' -import { anyOf, createRegExp } from 'magic-regexp' import { consola } from 'consola' import type { NuxtModule } from '@nuxt/schema' -import { findExports, resolvePath, findTypeExports } from 'mlly' +import { findExports, resolvePath, findTypeExports, resolveModuleExportNames } from 'mlly' import type { ESMExport } from 'mlly' import { defineCommand } from 'citty' -import { convertCompilerOptionsFromJson } from 'typescript' import { name, version } from '../../package.json' import { resolveCwdArg, sharedArgs } from './_shared' +import type { CompilerOptions } from 'typescript' +import type { Plugin } from 'rolldown' export default defineCommand({ meta: { @@ -42,45 +41,80 @@ export default defineCommand({ }, }, async run(context) { - const { build } = await import('unbuild') - const cwd = resolveCwdArg(context.args) - const jiti = createJiti(cwd) + const outDir = context.args.outDir + const distDir = resolve(cwd, outDir) + const srcRuntimeDir = resolve(cwd, 'src/runtime') + const distRuntimeDir = resolve(distDir, 'runtime') - await build(cwd, false, { - declaration: 'node16', - sourcemap: context.args.sourcemap, - stub: context.args.stub, - stubOptions: { absoluteJitiPath: true }, - outDir: context.args.outDir, - entries: [ - 'src/module', - { - input: 'src/runtime/', - outDir: `${context.args.outDir}/runtime`, - addRelativeDeclarationExtensions: true, - ext: 'js', - pattern: [ - '**', - '!**/*.stories.{js,cts,mts,ts,jsx,tsx}', // ignore storybook files - '!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}', // ignore tests + // Detect entry points from package.json exports + const moduleEntries = await inferModuleEntries(cwd) + + if (context.args.stub) { + await buildStub(cwd, distDir, moduleEntries) + return + } + + const { build } = await import('rolldown') + const { dts } = await import('rolldown-plugin-dts') + const { vueSfcPlugin } = await import('vue-sfc-transformer/rolldown') + const { glob } = await import('tinyglobby') + + // Clean dist directory before building + await fsp.rm(distDir, { recursive: true, force: true }) + await fsp.mkdir(distDir, { recursive: true }) + + // Load TypeScript compiler options (raw JSON for rolldown-plugin-dts) + const tsOptions = await loadTSCompilerOptions(moduleEntries[0] || resolve(cwd, 'src/module.ts')) + const compilerOptions = defu({ + noEmit: false, + paths: { + '#app/nuxt': ['./node_modules/nuxt/dist/app/nuxt'], + }, + }, tsOptions) + + // Step 1: Build runtime JS (Vue SFCs handled as assets + TS/TSX files) + if (existsSync(srcRuntimeDir)) { + const runtimeTsFiles = await glob('**/*.{ts,tsx}', { + cwd: srcRuntimeDir, + absolute: true, + ignore: ['**/*.stories.{ts,tsx}', '**/*.{spec,test}.{ts,tsx}'], + }) + if (runtimeTsFiles.length > 0) { + await build({ + cwd, + input: Object.fromEntries( + runtimeTsFiles.map(f => [relative(srcRuntimeDir, f).replace(/\.[cm]?tsx?$/, ''), f]), + ), + external: (id: string) => !id.startsWith('.') && !isAbsolute(id), + preserveEntrySignatures: 'strict', + plugins: [ + vueSfcPlugin({ srcDir: srcRuntimeDir, emitLegacyDeclarationAlias: true }), + dts({ compilerOptions, cwd }), ], - esbuild: { - jsxImportSource: 'vue', - jsx: 'automatic', - jsxFactory: 'h', + transform: { + jsx: { runtime: 'automatic', importSource: 'vue' }, }, - }, - ], - rollup: { - esbuild: { - target: 'esnext', - }, - emitCJS: false, - cjsBridge: false, - }, - externals: [ + output: { + format: 'esm', + dir: distRuntimeDir, + entryFileNames: '[name].js', + chunkFileNames: '[name].js', + }, + }) + } + } + + // Step 2: Build module JS + DTS entries + const moduleInput = Object.fromEntries( + moduleEntries.map(e => [filename(e) || basename(e, extname(e)), e]), + ) + const runtimeExternalsPlugin = createRuntimeExternalsPlugin(srcRuntimeDir) + await build({ + cwd, + input: moduleInput, + external: [ /dist[\\/]runtime[\\/]/, '@nuxt/schema', '@nuxt/schema-nightly', @@ -97,115 +131,174 @@ export default defineCommand({ 'vue', 'vue-demi', ], - hooks: { - async 'mkdist:entry:options'(_ctx, entry, options) { - options.typescript = defu(options.typescript, { - compilerOptions: await loadTSCompilerOptions(entry.input), - }) - }, - async 'rollup:options'(ctx, options) { - const [entry] = ctx.buildEntries - const mergedCompilerOptions = defu({ - noEmit: false, - paths: { - '#app/nuxt': ['./node_modules/nuxt/dist/app/nuxt'], - }, - }, ctx.options.rollup.dts.compilerOptions, await loadTSCompilerOptions(entry!.path)) - ctx.options.rollup.dts.compilerOptions = convertCompilerOptionsFromJson(mergedCompilerOptions, entry!.path).options - options.plugins ||= [] - if (!Array.isArray(options.plugins)) - options.plugins = [options.plugins] - - const runtimeEntries = ctx.options.entries.filter(entry => entry.builder === 'mkdist') - - const runtimeDirs = runtimeEntries.map(entry => basename(entry.input)) - const RUNTIME_RE = createRegExp(anyOf(...runtimeDirs).and(anyOf('/', '\\'))) - - // Add extension for imports of runtime files in build - options.plugins.unshift({ - name: 'nuxt-module-builder:runtime-externals', - async resolveId(id, importer) { - if (!RUNTIME_RE.test(id)) - return - - const resolved = await this.resolve(id, importer, { skipSelf: true }) - if (!resolved) - return - - const normalizedId = normalize(resolved.id) - for (const entry of runtimeEntries) { - if (!entry.outDir || !normalizedId.includes(entry.input)) - continue - - const name = filename(normalizedId) || basename(normalizedId, extname(normalizedId)) - const distFile = await resolvePath(join(dirname(pathToFileURL(normalizedId).href.replace(entry.input, entry.outDir)), name)) - if (distFile) { - return { - external: true, - id: distFile, - } - } - } - }, - }) - }, - async 'rollup:done'(ctx) { - // Load module meta - const moduleEntryPath = resolve(ctx.options.outDir, 'module.mjs') - const moduleFn = await jiti.import>>(pathToFileURL(moduleEntryPath).toString(), { default: true }).catch((err) => { - consola.error(err) - consola.error('Cannot load module. Please check dist:', moduleEntryPath) - return null - }) - - if (!moduleFn) { - return - } - const moduleMeta = await moduleFn.getMeta?.() || {} - - // Enhance meta using package.json - if (ctx.pkg) { - if (!moduleMeta.name) { - moduleMeta.name = ctx.pkg.name - } - if (!moduleMeta.version) { - moduleMeta.version = ctx.pkg.version - } - } - - // Add module builder metadata - moduleMeta.builder = { - [name]: version, - unbuild: await readPackageJSON('unbuild').then(r => r.version).catch(() => 'unknown'), - } - - // Write meta - const metaFile = resolve(ctx.options.outDir, 'module.json') - await fsp.writeFile(metaFile, JSON.stringify(moduleMeta, null, 2), 'utf8') - - // Generate types - await writeTypes(ctx.options.outDir, ctx.options.stub) - }, - async 'build:done'(ctx) { - const logs = [...ctx.warnings].filter(l => l.startsWith('Potential missing package.json files:')) - if (logs.filter(l => l.match(/\.d\.ts/)).length > 0) { - consola.warn(`\`@nuxt/module-builder\` will no longer generate \`.d.ts\` declaration files. You can update these paths to use the \`.d.mts\` extension instead.`) - } - - if (logs.filter(l => l.match(/module\.cjs/)).length > 0) { - consola.warn(`\`@nuxt/module-builder\` will no longer generate \`module.cjs\` as this is not required for Nuxt v3+. You can safely remove replace this with \`module.mjs\` in your \`package.json\`.`) - } - - const pkg = await readPackageJSON(cwd) - if (pkg?.types && !existsSync(resolve(cwd, pkg.types))) { - consola.warn(`Please remove the \`types\` field from package.json as it is no longer required for Bundler TypeScript module resolution. Instead, you can use \`typesVersions\` to support subpath export types for Node10, if required.`) - } - }, + preserveEntrySignatures: 'strict', + plugins: [ + runtimeExternalsPlugin, + dts({ compilerOptions, cwd }), + ], + output: { + format: 'esm', + dir: distDir, + entryFileNames: '[name].mjs', + chunkFileNames: '[name].mjs', + sourcemap: context.args.sourcemap, }, }) + + // Step 3: Generate module metadata + const moduleEntryPath = resolve(distDir, 'module.mjs') + const moduleFn = await jiti.import>>( + pathToFileURL(moduleEntryPath).toString(), + { default: true }, + ).catch((err) => { + consola.error(err) + consola.error('Cannot load module. Please check dist:', moduleEntryPath) + return null + }) + + if (!moduleFn) { + return + } + const moduleMeta = await moduleFn.getMeta?.() || {} + + const pkg = await readPackageJSON(cwd) + if (pkg) { + if (!moduleMeta.name) { + moduleMeta.name = pkg.name + } + if (!moduleMeta.version) { + moduleMeta.version = pkg.version + } + } + + moduleMeta.builder = { + [name]: version, + rolldown: await readPackageJSON('rolldown').then(r => r.version).catch(() => 'unknown'), + } + + await fsp.writeFile(resolve(distDir, 'module.json'), JSON.stringify(moduleMeta, null, 2), 'utf8') + + // Step 6: Generate types.d.mts + await writeTypes(distDir, false) + + // Step 7: Build warnings + const builtPkg = await readPackageJSON(cwd) + if (builtPkg?.types && !existsSync(resolve(cwd, builtPkg.types))) { + consola.warn(`Please remove the \`types\` field from package.json as it is no longer required for Bundler TypeScript module resolution. Instead, you can use \`typesVersions\` to support subpath export types for Node10, if required.`) + } }, }) +function createRuntimeExternalsPlugin(srcRuntimeDir: string): Plugin { + const RUNTIME_RE = /[\\/]runtime[\\/]/ + const normalizedSrcDir = normalize(srcRuntimeDir) + + return { + name: 'nuxt-module-builder:runtime-externals', + async resolveId(this, id, importer) { + if (!RUNTIME_RE.test(id)) + return + + const resolved = await this.resolve(id, importer, { skipSelf: true }) + if (!resolved) + return + + const normalizedId = normalize(resolved.id) + if (!normalizedId.startsWith(normalizedSrcDir)) + return + + // Map source file to its output .js path relative to dist dir + const relInRuntime = relative(normalizedSrcDir, normalizedId).replace(/\.[cm]?tsx?$/, '') + const distRelativePath = './runtime/' + relInRuntime.replace(/\\/g, '/') + '.js' + + return { + external: true, + id: distRelativePath, + } + }, + } +} + +async function inferModuleEntries(cwd: string): Promise { + const entries: string[] = [] + + // Always include src/module + for (const ext of ['.ts', '.tsx', '.mts']) { + const candidate = resolve(cwd, 'src/module' + ext) + if (existsSync(candidate)) { + entries.push(candidate) + break + } + } + + const pkg = await readPackageJSON(cwd).catch(() => null) + if (!pkg?.exports) return entries + + // Collect .mjs paths from package.json exports + function collectMjs(obj: unknown): string[] { + if (typeof obj === 'string') return obj.endsWith('.mjs') ? [obj] : [] + if (typeof obj === 'object' && obj !== null) { + return Object.values(obj as Record).flatMap(collectMjs) + } + return [] + } + + for (const mjsPath of collectMjs(pkg.exports)) { + // './dist/utils.mjs' → 'src/utils' + const match = mjsPath.match(/^\.\/dist\/(.+)\.mjs$/) + if (!match) continue + const srcBase = resolve(cwd, 'src', match[1]!) + for (const ext of ['.ts', '.tsx', '.mts']) { + const candidate = srcBase + ext + if (existsSync(candidate) && !entries.includes(candidate)) { + entries.push(candidate) + break + } + } + } + + return entries +} + +async function buildStub(cwd: string, distDir: string, entries: string[]) { + await fsp.mkdir(distDir, { recursive: true }) + + const jitiPath = pathToFileURL( + await resolvePath('jiti', { url: import.meta.url, conditions: ['node', 'import'] }), + ).toString() + + for (const resolvedEntry of entries) { + const entryName = filename(resolvedEntry) || basename(resolvedEntry, extname(resolvedEntry)) + const outBase = resolve(distDir, entryName) + const srcUrl = pathToFileURL(resolvedEntry).toString() + + const exports = await resolveModuleExportNames(resolvedEntry, { + extensions: ['.ts', '.tsx', '.mts'], + }).catch(() => [] as string[]) + const hasDefaultExport = exports.includes('default') + + const mjsContent = [ + `import { createJiti } from ${JSON.stringify(jitiPath)};`, + ``, + `const jiti = createJiti(import.meta.url);`, + ``, + `/** @type {import(${JSON.stringify(srcUrl)})} */`, + `const _module = await jiti.import(${JSON.stringify(srcUrl)});`, + hasDefaultExport ? `export default _module?.default ?? _module;` : '', + ...exports.filter(n => n !== 'default').map(n => `export const ${n} = _module.${n};`), + ].filter(Boolean).join('\n') + '\n' + + await fsp.writeFile(outBase + '.mjs', mjsContent, 'utf8') + + const dtsContent = [ + `export * from ${JSON.stringify(srcUrl)};`, + hasDefaultExport ? `export { default } from ${JSON.stringify(srcUrl)};` : '', + ].filter(Boolean).join('\n') + '\n' + + await fsp.writeFile(outBase + '.d.mts', dtsContent, 'utf8') + } +} + async function writeTypes(distDir: string, isStub: boolean) { const dtsFile = resolve(distDir, 'types.d.mts') if (existsSync(dtsFile)) { @@ -277,7 +370,7 @@ ${moduleReExports.filter(e => e.type === 'star').map(e => `\nexport * from '${e. await fsp.writeFile(dtsFile, dtsContents, 'utf8') } -async function loadTSCompilerOptions(path: string): Promise> { +async function loadTSCompilerOptions(path: string): Promise { const config = await parse(path) const resolvedCompilerOptions = config?.tsconfig.compilerOptions || {} diff --git a/test/__snapshots__/JsxComponent.d.ts b/test/__snapshots__/JsxComponent.d.ts index 41c9cc7c..7c0c8161 100644 --- a/test/__snapshots__/JsxComponent.d.ts +++ b/test/__snapshots__/JsxComponent.d.ts @@ -1 +1,4 @@ -export default function MyJSXComponent(): import("vue/jsx-runtime").JSX.Element; +//#region src/runtime/components/JsxComponent.d.ts +declare function MyJSXComponent(): import("vue/jsx-runtime").JSX.Element; +//#endregion +export { MyJSXComponent as default }; \ No newline at end of file diff --git a/test/__snapshots__/JsxComponent.js b/test/__snapshots__/JsxComponent.js index ea56e413..efe8c5a4 100644 --- a/test/__snapshots__/JsxComponent.js +++ b/test/__snapshots__/JsxComponent.js @@ -1,4 +1,7 @@ import { jsx } from "vue/jsx-runtime"; -export default function MyJSXComponent() { - return /* @__PURE__ */ jsx("div", { children: "My JSX Component" }); +//#region src/runtime/components/JsxComponent.tsx +function MyJSXComponent() { + return /* @__PURE__ */ jsx("div", { children: "My JSX Component" }); } +//#endregion +export { MyJSXComponent as default }; diff --git a/test/__snapshots__/TestMe.vue b/test/__snapshots__/TestMe.vue index 974b9562..cb9da314 100644 --- a/test/__snapshots__/TestMe.vue +++ b/test/__snapshots__/TestMe.vue @@ -1,13 +1,9 @@