From b818ddd0ef0ba6ab7726b7d7b1442c54293b7014 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 30 Nov 2024 18:11:22 +0900 Subject: [PATCH 01/11] chore(deps): use mini app format --- packages/vite/package.json | 2 +- pnpm-lock.yaml | 326 +------------------------------------ 2 files changed, 5 insertions(+), 323 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 87b34110c5b5ab..2f3cdfa90bd753 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -88,7 +88,7 @@ "esbuild": "^0.24.0", "postcss": "^8.4.49", "react-refresh": "^0.14.2", - "rolldown": "file:../../rolldown-0.14.0.tgz", + "rolldown": "link:../../../rolldown/packages/rolldown", "rollup": "^4.23.0" }, "optionalDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd41aaaef67b1d..536a4b7da71802 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -233,8 +233,8 @@ importers: specifier: ^0.14.2 version: 0.14.2 rolldown: - specifier: file:../../rolldown-0.14.0.tgz - version: file:rolldown-0.14.0.tgz(@babel/runtime@7.26.0) + specifier: link:../../../rolldown/packages/rolldown + version: link:../../../rolldown/packages/rolldown rollup: specifier: ^4.23.0 version: 4.24.4 @@ -2337,15 +2337,6 @@ packages: search-insights: optional: true - '@emnapi/core@1.3.1': - resolution: {integrity: sha512-pVGjBIt1Y6gg3EJN8jTcfpP/+uuRksIo055oE/OBkDNcjZqVbfkWCksG1Jp4yZnj3iKWyWX8fdG/j6UDYPbFog==} - - '@emnapi/runtime@1.3.1': - resolution: {integrity: sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==} - - '@emnapi/wasi-threads@1.0.1': - resolution: {integrity: sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw==} - '@esbuild/aix-ppc64@0.23.1': resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} engines: {node: '>=18'} @@ -2752,9 +2743,6 @@ packages: resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} hasBin: true - '@napi-rs/wasm-runtime@0.2.5': - resolution: {integrity: sha512-kwUxR7J9WLutBbulqg1dfOrMTwhMdXLdcGUhcbCcGwnPLt3gz19uHVdwH1syKVDbE022ZS2vZxOWflFLS0YTjw==} - '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -2767,60 +2755,30 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@parcel/watcher-android-arm64@2.4.1': - resolution: {integrity: sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==} - engines: {node: '>= 10.0.0'} - cpu: [arm64] - os: [android] - '@parcel/watcher-android-arm64@2.5.0': resolution: {integrity: sha512-qlX4eS28bUcQCdribHkg/herLe+0A9RyYC+mm2PXpncit8z5b3nSqGVzMNR3CmtAOgRutiZ02eIJJgP/b1iEFQ==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [android] - '@parcel/watcher-darwin-arm64@2.4.1': - resolution: {integrity: sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==} - engines: {node: '>= 10.0.0'} - cpu: [arm64] - os: [darwin] - '@parcel/watcher-darwin-arm64@2.5.0': resolution: {integrity: sha512-hyZ3TANnzGfLpRA2s/4U1kbw2ZI4qGxaRJbBH2DCSREFfubMswheh8TeiC1sGZ3z2jUf3s37P0BBlrD3sjVTUw==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [darwin] - '@parcel/watcher-darwin-x64@2.4.1': - resolution: {integrity: sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==} - engines: {node: '>= 10.0.0'} - cpu: [x64] - os: [darwin] - '@parcel/watcher-darwin-x64@2.5.0': resolution: {integrity: sha512-9rhlwd78saKf18fT869/poydQK8YqlU26TMiNg7AIu7eBp9adqbJZqmdFOsbZ5cnLp5XvRo9wcFmNHgHdWaGYA==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [darwin] - '@parcel/watcher-freebsd-x64@2.4.1': - resolution: {integrity: sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==} - engines: {node: '>= 10.0.0'} - cpu: [x64] - os: [freebsd] - '@parcel/watcher-freebsd-x64@2.5.0': resolution: {integrity: sha512-syvfhZzyM8kErg3VF0xpV8dixJ+RzbUaaGaeb7uDuz0D3FK97/mZ5AJQ3XNnDsXX7KkFNtyQyFrXZzQIcN49Tw==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [freebsd] - '@parcel/watcher-linux-arm-glibc@2.4.1': - resolution: {integrity: sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==} - engines: {node: '>= 10.0.0'} - cpu: [arm] - os: [linux] - '@parcel/watcher-linux-arm-glibc@2.5.0': resolution: {integrity: sha512-0VQY1K35DQET3dVYWpOaPFecqOT9dbuCfzjxoQyif1Wc574t3kOSkKevULddcR9znz1TcklCE7Ht6NIxjvTqLA==} engines: {node: '>= 10.0.0'} @@ -2833,94 +2791,48 @@ packages: cpu: [arm] os: [linux] - '@parcel/watcher-linux-arm64-glibc@2.4.1': - resolution: {integrity: sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==} - engines: {node: '>= 10.0.0'} - cpu: [arm64] - os: [linux] - '@parcel/watcher-linux-arm64-glibc@2.5.0': resolution: {integrity: sha512-BfNjXwZKxBy4WibDb/LDCriWSKLz+jJRL3cM/DllnHH5QUyoiUNEp3GmL80ZqxeumoADfCCP19+qiYiC8gUBjA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - '@parcel/watcher-linux-arm64-musl@2.4.1': - resolution: {integrity: sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==} - engines: {node: '>= 10.0.0'} - cpu: [arm64] - os: [linux] - '@parcel/watcher-linux-arm64-musl@2.5.0': resolution: {integrity: sha512-S1qARKOphxfiBEkwLUbHjCY9BWPdWnW9j7f7Hb2jPplu8UZ3nes7zpPOW9bkLbHRvWM0WDTsjdOTUgW0xLBN1Q==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - '@parcel/watcher-linux-x64-glibc@2.4.1': - resolution: {integrity: sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==} - engines: {node: '>= 10.0.0'} - cpu: [x64] - os: [linux] - '@parcel/watcher-linux-x64-glibc@2.5.0': resolution: {integrity: sha512-d9AOkusyXARkFD66S6zlGXyzx5RvY+chTP9Jp0ypSTC9d4lzyRs9ovGf/80VCxjKddcUvnsGwCHWuF2EoPgWjw==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - '@parcel/watcher-linux-x64-musl@2.4.1': - resolution: {integrity: sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==} - engines: {node: '>= 10.0.0'} - cpu: [x64] - os: [linux] - '@parcel/watcher-linux-x64-musl@2.5.0': resolution: {integrity: sha512-iqOC+GoTDoFyk/VYSFHwjHhYrk8bljW6zOhPuhi5t9ulqiYq1togGJB5e3PwYVFFfeVgc6pbz3JdQyDoBszVaA==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - '@parcel/watcher-win32-arm64@2.4.1': - resolution: {integrity: sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==} - engines: {node: '>= 10.0.0'} - cpu: [arm64] - os: [win32] - '@parcel/watcher-win32-arm64@2.5.0': resolution: {integrity: sha512-twtft1d+JRNkM5YbmexfcH/N4znDtjgysFaV9zvZmmJezQsKpkfLYJ+JFV3uygugK6AtIM2oADPkB2AdhBrNig==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [win32] - '@parcel/watcher-win32-ia32@2.4.1': - resolution: {integrity: sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==} - engines: {node: '>= 10.0.0'} - cpu: [ia32] - os: [win32] - '@parcel/watcher-win32-ia32@2.5.0': resolution: {integrity: sha512-+rgpsNRKwo8A53elqbbHXdOMtY/tAtTzManTWShB5Kk54N8Q9mzNWV7tV+IbGueCbcj826MfWGU3mprWtuf1TA==} engines: {node: '>= 10.0.0'} cpu: [ia32] os: [win32] - '@parcel/watcher-win32-x64@2.4.1': - resolution: {integrity: sha512-+DvS92F9ezicfswqrvIRM2njcYJbd5mb9CUgtrHCHmvn7pPPa+nMDRu1o1bYYz/l5IB2NVGNJWiH7h1E58IF2A==} - engines: {node: '>= 10.0.0'} - cpu: [x64] - os: [win32] - '@parcel/watcher-win32-x64@2.5.0': resolution: {integrity: sha512-lPrxve92zEHdgeff3aiu4gDOIt4u7sJYha6wbdEZDCDUhtjTsOMiaJzG5lMY4GkWH8p0fMmO2Ppq5G5XXG+DQw==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [win32] - '@parcel/watcher@2.4.1': - resolution: {integrity: sha512-HNjmfLQEVRZmHRET336f20H/8kOozUGwk7yajvsonjNxbj2wBTK1WsQuHkD5yYh9RxFGL2EyDHryOihOwUoKDA==} - engines: {node: '>= 10.0.0'} - '@parcel/watcher@2.5.0': resolution: {integrity: sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==} engines: {node: '>= 10.0.0'} @@ -2936,66 +2848,6 @@ packages: '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} - '@rolldown/binding-darwin-arm64@0.14.0': - resolution: {integrity: sha512-0GneNB1lW+k6VyBeKZAAyjoJ27r+gCDV+xI56aifQteaHAhFb0q8etJE5KpOOt65Hz0xXVjENilDKS+ibn1lcA==} - cpu: [arm64] - os: [darwin] - - '@rolldown/binding-darwin-x64@0.14.0': - resolution: {integrity: sha512-MG+pbDhufD2Fkua7J32XAkK6OoHzS/P1KFwDv+J7YvD6KZ/vEz8GklXtM4Woby+rbvbNmgoT4MV1BtHENONr3A==} - cpu: [x64] - os: [darwin] - - '@rolldown/binding-freebsd-x64@0.14.0': - resolution: {integrity: sha512-ojbJdM8f6+099WfFL/ggQ0F5o2/lHypQBj7WgIPL2Iqr3KleRVN57YTZPu0SJ/bK0OWrx2ZaWBLb6WpDsIx2zg==} - cpu: [x64] - os: [freebsd] - - '@rolldown/binding-linux-arm-gnueabihf@0.14.0': - resolution: {integrity: sha512-cI8UBQDS6xFWg6Pe5gPXZYXskt2BQ4nVEoGGaHZsav8PWC31cEZhSkUj814anbmGoi7wl23/T2gNuCNysdWHxg==} - cpu: [arm] - os: [linux] - - '@rolldown/binding-linux-arm64-gnu@0.14.0': - resolution: {integrity: sha512-vA2ewz6nun7mkW4lMwO3TzCuUi3mpcAo3xXhAwmIPT6yz7+ofJGLkq3N7oYfJQhH9ktHSEPA8JzPHvZ1ozAfgA==} - cpu: [arm64] - os: [linux] - - '@rolldown/binding-linux-arm64-musl@0.14.0': - resolution: {integrity: sha512-uEoG+tzi0JqCVhuWmaOLR7hjuyDQ+a9OudYDeArkeAD2tY8fNyd9gAOfjzyYhgBcYvOLCo+4w2C3GnoSKy88FA==} - cpu: [arm64] - os: [linux] - - '@rolldown/binding-linux-x64-gnu@0.14.0': - resolution: {integrity: sha512-WSeo4JfiXCTRJDT5VG5Ohp3nhZittMrRA42wZjcHRajsuG7YsikmkSbTI88TXVjMSdXJBQK1zsBVOIpYfzKltQ==} - cpu: [x64] - os: [linux] - - '@rolldown/binding-linux-x64-musl@0.14.0': - resolution: {integrity: sha512-gR9Xz+k2E5Xjd/6d+109Jpdwtaepa4Y0UvAA1hwMBM7LsDR0tMpryRYJlrKqaFvhFyzMfd45HunrX4dttQV5hQ==} - cpu: [x64] - os: [linux] - - '@rolldown/binding-wasm32-wasi@0.14.0': - resolution: {integrity: sha512-5tEWnRnWlxgn45Z/LGL0Ds/gZ/B8dY84PfKNq6S1elweLGgjlhDSRbNaZiX/umvELa9e1dbYNPCFZiEhHSUvkQ==} - engines: {node: '>=14.21.3'} - cpu: [wasm32] - - '@rolldown/binding-win32-arm64-msvc@0.14.0': - resolution: {integrity: sha512-VIdWQkE0vvaORRy0NXW+z+IuqTZ96/FbVKVFKlsOMcrhBOibzvy8LobKaxUIOPJ/WzPEyrmhnMRHJpWbtaPJmw==} - cpu: [arm64] - os: [win32] - - '@rolldown/binding-win32-ia32-msvc@0.14.0': - resolution: {integrity: sha512-0nOHZhjcX93FiY6SLk0iMTqFf3wzRXYsneGstfIlkob8tEncukMdS+iv9JfG9k15e5fRYcwfHu8wW55qmLYj/w==} - cpu: [ia32] - os: [win32] - - '@rolldown/binding-win32-x64-msvc@0.14.0': - resolution: {integrity: sha512-RKNpJKIG5J6dgR/0IpxHmZkYYnHJE8vDm3qL8Zq9EY7kxOsCNZbrj5leU7qbibqfHHR+9Ij4vhTL1YuLz/ch5Q==} - cpu: [x64] - os: [win32] - '@rollup/plugin-alias@5.1.1': resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} engines: {node: '>=14.0.0'} @@ -3196,9 +3048,6 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} - '@tybys/wasm-util@0.9.0': - resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==} - '@type-challenges/utils@0.1.1': resolution: {integrity: sha512-A7ljYfBM+FLw+NDyuYvGBJiCEV9c0lPWEAdzfOAkb3JFqfLl0Iv/WhWMMARHiRKlmmiD1g8gz/507yVvHdQUYA==} @@ -6494,16 +6343,6 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true - rolldown@file:rolldown-0.14.0.tgz: - resolution: {integrity: sha512-Q10owNKABGy+uo/Dl/OI3xTLX5ZpqKOOBeeVTgnu5xfZF0o/FgLGqzSsbcnuwZzXaO1ZgBg7qqxcX9227jG38w==, tarball: file:rolldown-0.14.0.tgz} - version: 0.14.0 - hasBin: true - peerDependencies: - '@babel/runtime': '>=7' - peerDependenciesMeta: - '@babel/runtime': - optional: true - rollup-plugin-dts@6.1.1: resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} engines: {node: '>=16'} @@ -7325,10 +7164,6 @@ packages: peerDependencies: vue: ^3.2.0 - watchpack@2.4.2: - resolution: {integrity: sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==} - engines: {node: '>=10.13.0'} - web-streams-polyfill@3.3.3: resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} engines: {node: '>= 8'} @@ -8271,22 +8106,6 @@ snapshots: transitivePeerDependencies: - '@algolia/client-search' - '@emnapi/core@1.3.1': - dependencies: - '@emnapi/wasi-threads': 1.0.1 - tslib: 2.8.1 - optional: true - - '@emnapi/runtime@1.3.1': - dependencies: - tslib: 2.8.1 - optional: true - - '@emnapi/wasi-threads@1.0.1': - dependencies: - tslib: 2.8.1 - optional: true - '@esbuild/aix-ppc64@0.23.1': optional: true @@ -8574,13 +8393,6 @@ snapshots: - encoding - supports-color - '@napi-rs/wasm-runtime@0.2.5': - dependencies: - '@emnapi/core': 1.3.1 - '@emnapi/runtime': 1.3.1 - '@tybys/wasm-util': 0.9.0 - optional: true - '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -8593,101 +8405,45 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@parcel/watcher-android-arm64@2.4.1': - optional: true - '@parcel/watcher-android-arm64@2.5.0': optional: true - '@parcel/watcher-darwin-arm64@2.4.1': - optional: true - '@parcel/watcher-darwin-arm64@2.5.0': optional: true - '@parcel/watcher-darwin-x64@2.4.1': - optional: true - '@parcel/watcher-darwin-x64@2.5.0': optional: true - '@parcel/watcher-freebsd-x64@2.4.1': - optional: true - '@parcel/watcher-freebsd-x64@2.5.0': optional: true - '@parcel/watcher-linux-arm-glibc@2.4.1': - optional: true - '@parcel/watcher-linux-arm-glibc@2.5.0': optional: true '@parcel/watcher-linux-arm-musl@2.5.0': optional: true - '@parcel/watcher-linux-arm64-glibc@2.4.1': - optional: true - '@parcel/watcher-linux-arm64-glibc@2.5.0': optional: true - '@parcel/watcher-linux-arm64-musl@2.4.1': - optional: true - '@parcel/watcher-linux-arm64-musl@2.5.0': optional: true - '@parcel/watcher-linux-x64-glibc@2.4.1': - optional: true - '@parcel/watcher-linux-x64-glibc@2.5.0': optional: true - '@parcel/watcher-linux-x64-musl@2.4.1': - optional: true - '@parcel/watcher-linux-x64-musl@2.5.0': optional: true - '@parcel/watcher-win32-arm64@2.4.1': - optional: true - '@parcel/watcher-win32-arm64@2.5.0': optional: true - '@parcel/watcher-win32-ia32@2.4.1': - optional: true - '@parcel/watcher-win32-ia32@2.5.0': optional: true - '@parcel/watcher-win32-x64@2.4.1': - optional: true - '@parcel/watcher-win32-x64@2.5.0': optional: true - '@parcel/watcher@2.4.1': - dependencies: - detect-libc: 1.0.3 - is-glob: 4.0.3 - micromatch: 4.0.8 - node-addon-api: 7.1.1 - optionalDependencies: - '@parcel/watcher-android-arm64': 2.4.1 - '@parcel/watcher-darwin-arm64': 2.4.1 - '@parcel/watcher-darwin-x64': 2.4.1 - '@parcel/watcher-freebsd-x64': 2.4.1 - '@parcel/watcher-linux-arm-glibc': 2.4.1 - '@parcel/watcher-linux-arm64-glibc': 2.4.1 - '@parcel/watcher-linux-arm64-musl': 2.4.1 - '@parcel/watcher-linux-x64-glibc': 2.4.1 - '@parcel/watcher-linux-x64-musl': 2.4.1 - '@parcel/watcher-win32-arm64': 2.4.1 - '@parcel/watcher-win32-ia32': 2.4.1 - '@parcel/watcher-win32-x64': 2.4.1 - '@parcel/watcher@2.5.0': dependencies: detect-libc: 1.0.3 @@ -8717,44 +8473,6 @@ snapshots: '@polka/url@1.0.0-next.28': {} - '@rolldown/binding-darwin-arm64@0.14.0': - optional: true - - '@rolldown/binding-darwin-x64@0.14.0': - optional: true - - '@rolldown/binding-freebsd-x64@0.14.0': - optional: true - - '@rolldown/binding-linux-arm-gnueabihf@0.14.0': - optional: true - - '@rolldown/binding-linux-arm64-gnu@0.14.0': - optional: true - - '@rolldown/binding-linux-arm64-musl@0.14.0': - optional: true - - '@rolldown/binding-linux-x64-gnu@0.14.0': - optional: true - - '@rolldown/binding-linux-x64-musl@0.14.0': - optional: true - - '@rolldown/binding-wasm32-wasi@0.14.0': - dependencies: - '@napi-rs/wasm-runtime': 0.2.5 - optional: true - - '@rolldown/binding-win32-arm64-msvc@0.14.0': - optional: true - - '@rolldown/binding-win32-ia32-msvc@0.14.0': - optional: true - - '@rolldown/binding-win32-x64-msvc@0.14.0': - optional: true - '@rollup/plugin-alias@5.1.1(rollup@4.24.4)': optionalDependencies: rollup: 4.24.4 @@ -8953,11 +8671,6 @@ snapshots: '@trysound/sax@0.2.0': {} - '@tybys/wasm-util@0.9.0': - dependencies: - tslib: 2.8.1 - optional: true - '@type-challenges/utils@0.1.1': {} '@types/babel__core@7.20.5': @@ -11800,7 +11513,8 @@ snapshots: node-addon-api@5.1.0: {} - node-addon-api@7.1.1: {} + node-addon-api@7.1.1: + optional: true node-domexception@1.0.0: {} @@ -12502,33 +12216,6 @@ snapshots: dependencies: glob: 7.2.3 - rolldown@file:rolldown-0.14.0.tgz(@babel/runtime@7.26.0): - dependencies: - '@parcel/watcher': 2.4.1 - chokidar: 3.6.0(patch_hash=r6f2jac4ef543toizf7sfnkaom) - connect: 3.7.0 - watchpack: 2.4.2 - ws: 8.18.0 - zod: 3.23.8 - optionalDependencies: - '@babel/runtime': 7.26.0 - '@rolldown/binding-darwin-arm64': 0.14.0 - '@rolldown/binding-darwin-x64': 0.14.0 - '@rolldown/binding-freebsd-x64': 0.14.0 - '@rolldown/binding-linux-arm-gnueabihf': 0.14.0 - '@rolldown/binding-linux-arm64-gnu': 0.14.0 - '@rolldown/binding-linux-arm64-musl': 0.14.0 - '@rolldown/binding-linux-x64-gnu': 0.14.0 - '@rolldown/binding-linux-x64-musl': 0.14.0 - '@rolldown/binding-wasm32-wasi': 0.14.0 - '@rolldown/binding-win32-arm64-msvc': 0.14.0 - '@rolldown/binding-win32-ia32-msvc': 0.14.0 - '@rolldown/binding-win32-x64-msvc': 0.14.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - rollup-plugin-dts@6.1.1(rollup@4.24.4)(typescript@5.6.3): dependencies: magic-string: 0.30.13 @@ -13443,11 +13130,6 @@ snapshots: '@vue/devtools-api': 6.6.4 vue: 3.5.13(typescript@5.6.3) - watchpack@2.4.2: - dependencies: - glob-to-regexp: 0.4.1 - graceful-fs: 4.2.11 - web-streams-polyfill@3.3.3: {} webidl-conversions@3.0.1: {} From 9db78bccfe8977d29998a53debb5623531bbde75 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 30 Nov 2024 18:27:13 +0900 Subject: [PATCH 02/11] chore: use simple app format --- eslint.config.js | 1 + packages/vite/misc/rolldown-runtime.js | 237 ++++++++++++++++++ .../src/node/server/environments/rolldown.ts | 160 +++++++----- 3 files changed, 342 insertions(+), 56 deletions(-) create mode 100644 packages/vite/misc/rolldown-runtime.js diff --git a/eslint.config.js b/eslint.config.js index 968a7a89b5e1a4..5822162be7bcb5 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -20,6 +20,7 @@ export default tseslint.config( { ignores: [ 'packages/create-vite/template-*', + 'packages/vite/misc/rolldown-runtime.js', '**/dist/**', '**/fixtures/**', '**/playground-temp/**', diff --git a/packages/vite/misc/rolldown-runtime.js b/packages/vite/misc/rolldown-runtime.js new file mode 100644 index 00000000000000..1a2ce4e5cb1b3c --- /dev/null +++ b/packages/vite/misc/rolldown-runtime.js @@ -0,0 +1,237 @@ +// based on +// https://github.com/rolldown/rolldown/blob/a29240168290e45b36fdc1a6d5c375281fb8dc3e/crates/rolldown/src/runtime/runtime-without-comments.js#L69 +// https://github.com/hi-ogawa/rolldown/blob/27d203a74d8dd95aed256bde29232d535bd294f4/crates/rolldown/src/runtime/runtime-app.js + +var __create = Object.create +var __defProp = Object.defineProperty +var __getOwnPropDesc = Object.getOwnPropertyDescriptor +var __getOwnPropNames = Object.getOwnPropertyNames +var __getProtoOf = Object.getPrototypeOf +var __hasOwnProp = Object.prototype.hasOwnProperty +var __esm = (fn, res) => + function () { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res + } +var __esmMin = (fn, res) => () => (fn && (res = fn((fn = 0))), res) +var __commonJS = (cb, mod) => + function () { + return ( + mod || + (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), + mod.exports + ) + } +var __commonJSMin = (cb, mod) => () => ( + mod || cb((mod = { exports: {} }).exports, mod), mod.exports +) +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }) +} +var __copyProps = (to, from, except, desc) => { + if ((from && typeof from === 'object') || typeof from === 'function') + for ( + var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; + i < n; + i++ + ) { + key = keys[i] + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { + get: ((k) => from[k]).bind(null, key), + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable, + }) + } + return to +} +var __reExport = (target, mod, secondTarget) => ( + __copyProps(target, mod, 'default'), + secondTarget && __copyProps(secondTarget, mod, 'default') +) +var __toESM = (mod, isNodeMode, target) => ( + (target = mod != null ? __create(__getProtoOf(mod)) : {}), + __copyProps( + isNodeMode || !mod || !mod.__esModule + ? __defProp(target, 'default', { value: mod, enumerable: true }) + : target, + mod, + ) +) +var __toCommonJS = (mod) => + __copyProps(__defProp({}, '__esModule', { value: true }), mod) +var __toBinaryNode = (base64) => new Uint8Array(Buffer.from(base64, 'base64')) +var __toBinary = /* @__PURE__ */ (() => { + var table = new Uint8Array(128) + for (var i = 0; i < 64; i++) + table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i + return (base64) => { + var n = base64.length, + bytes = new Uint8Array( + (((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3) / 4) | 0, + ) + for (var i = 0, j = 0; i < n; ) { + var c0 = table[base64.charCodeAt(i++)], + c1 = table[base64.charCodeAt(i++)] + var c2 = table[base64.charCodeAt(i++)], + c3 = table[base64.charCodeAt(i++)] + bytes[j++] = (c0 << 2) | (c1 >> 4) + bytes[j++] = (c1 << 4) | (c2 >> 2) + bytes[j++] = (c2 << 6) | c3 + } + return bytes + } +})() + +var rolldown_runtime = (self.rolldown_runtime = { + patching: false, + patchedModuleFactoryMap: {}, + executeModuleStack: [], + moduleCache: {}, + moduleFactoryMap: {}, + define: function (id, factory) { + if (self.patching) { + this.patchedModuleFactoryMap[id] = factory + } else { + this.moduleFactoryMap[id] = factory + } + }, + require: function (id) { + const parent = + this.executeModuleStack.length >= 1 + ? this.executeModuleStack[this.executeModuleStack.length - 1] + : null + if (this.moduleCache[id]) { + var module = this.moduleCache[id] + if (parent && module.parents.indexOf(parent) === -1) { + module.parents.push(parent) + } + return module.exports + } + var factory = this.moduleFactoryMap[id] + if (!factory) { + throw new Error('Module not found: ' + id) + } + var module = (this.moduleCache[id] = { + exports: {}, + parents: parent ? [parent] : [], + hot: { + selfAccept: false, + acceptCallbacks: [], + accept: function (callback) { + this.selfAccept = true + if (callback && typeof callback === 'function') { + this.acceptCallbacks.push({ + deps: [id], + callback, + }) + } + }, + }, + }) + this.executeModuleStack.push(id) + factory(this.require.bind(this), module, module.exports) + this.executeModuleStack.pop() + return module.exports + }, + patch: function (updateModuleIds, callback) { + self.patching = true + + callback() + + var boundaries = [] + var invalidModuleIds = [] + var acceptCallbacks = [] + + for (var i = 0; i < updateModuleIds.length; i++) { + foundBoundariesAndInvalidModuleIds( + updateModuleIds[i], + boundaries, + invalidModuleIds, + acceptCallbacks, + ) + } + + for (var i = 0; i < invalidModuleIds.length; i++) { + var id = invalidModuleIds[i] + delete this.moduleCache[id] + } + + for (var id in this.patchedModuleFactoryMap) { + this.moduleFactoryMap[id] = this.patchedModuleFactoryMap[id] + } + this.patchedModuleFactoryMap = {} + + for (var i = 0; i < boundaries.length; i++) { + this.require(boundaries[i]) + } + + for (var i = 0; i < acceptCallbacks.length; i++) { + var item = acceptCallbacks[i] + item.callback.apply( + null, + item.deps.map((dep) => this.moduleCache[dep].exports), + ) + } + + self.patching = false + + function foundBoundariesAndInvalidModuleIds( + updateModuleId, + boundaries, + invalidModuleIds, + acceptCallbacks, + ) { + var queue = [{ moduleId: updateModuleId, chain: [updateModuleId] }] + var visited = {} + + while (queue.length > 0) { + var item = queue.pop() + var moduleId = item.moduleId + var chain = item.chain + + if (visited[moduleId]) { + continue + } + + var module = rolldown_runtime.moduleCache[moduleId] + if (!module) { + continue + } + + if (module.hot.selfAccept) { + if (boundaries.indexOf(moduleId) === -1) { + boundaries.push(moduleId) + + for (var i = 0; i < module.hot.acceptCallbacks.length; i++) { + var item = module.hot.acceptCallbacks[i] + acceptCallbacks.push(item) + } + } + for (var i = 0; i < chain.length; i++) { + if (invalidModuleIds.indexOf(chain[i]) === -1) { + invalidModuleIds.push(chain[i]) + } + } + continue + } + + boundaries.push(moduleId) + invalidModuleIds.push(moduleId) + if (module.parents.length === 0) { + globalThis.window?.location.reload() + break + } + + for (var i = 0; i < module.parents.length; i++) { + var parent = module.parents[i] + queue.push({ + moduleId: parent, + chain: chain.concat([parent]), + }) + } + + visited[moduleId] = true + } + } + }, +}) diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index 6649375456a757..21f35c9624e801 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -16,7 +16,7 @@ import type { UserConfig, ViteDevServer, } from '../..' -import { CLIENT_ENTRY } from '../../constants' +import { CLIENT_ENTRY, VITE_PACKAGE_DIR } from '../../constants' import { injectEnvironmentToHooks } from '../../build' const require = createRequire(import.meta.url) @@ -106,17 +106,18 @@ function asRolldown(server: ViteDevServer): Omit< export function rolldownDevConfigureServer(server: ViteDevServer): void { const { environments } = asRolldown(server) - // rolldown server as middleware + // rolldown assets middleware + server.middlewares.use(async (_req, _res, next) => { + try { + await environments.client.buildPromise + next() + } catch (e) { + next(e) + } + }) server.middlewares.use( sirv(environments.client.outDir, { dev: true, extensions: ['html'] }), ) - - // full build on non self accepting entry - server.ws.on('rolldown:hmr-deadend', async (data) => { - logger.info(`hmr-deadend '${data.moduleId}'`, { timestamp: true }) - await environments.client.build() - server.ws.send({ type: 'full-reload' }) - }) } export async function rolldownDevHandleHotUpdate( @@ -138,6 +139,9 @@ class RolldownEnvironment extends DevEnvironment { buildTimestamp = Date.now() inputOptions!: rolldown.InputOptions outputOptions!: rolldown.OutputOptions + lastModules: Record = {} + newModules: Record = {} + buildPromise?: Promise static createFactory( rolldownDevOptioins: RolldownDevOptions, @@ -169,7 +173,11 @@ class RolldownEnvironment extends DevEnvironment { await this.instance?.close() } - async build(): Promise { + async build() { + return (this.buildPromise = this.buildImpl()) + } + + async buildImpl() { if (!this.config.build.rollupOptions.input) { return } @@ -205,7 +213,6 @@ class RolldownEnvironment extends DevEnvironment { console.time(`[rolldown:${this.name}:build]`) this.inputOptions = { - dev: this.rolldownDevOptions.hmr, input: this.config.build.rollupOptions.input, cwd: this.config.root, platform: this.name === 'client' ? 'browser' : 'node', @@ -219,6 +226,24 @@ class RolldownEnvironment extends DevEnvironment { patchRuntimePlugin(this), patchCssPlugin(), reactRefreshPlugin(), + { + name: 'vite:rolldown-extract-hmr-chunk', + renderChunk: (_code, chunk) => { + // cf. https://github.com/web-infra-dev/rspack/blob/5a967f7a10ec51171a304a1ce8d741bd09fa8ed5/crates/rspack_plugin_hmr/src/lib.rs#L60 + // TODO: assume single chunk for now + this.newModules = {} + const modules: Record = {} + for (const [id, mod] of Object.entries(chunk.modules)) { + const current = mod.code + const last = this.lastModules?.[id] + if (current !== last) { + this.newModules[id] = current + } + modules[id] = current + } + this.lastModules = modules + }, + }, ], moduleTypes: { '.css': 'js', @@ -249,6 +274,31 @@ class RolldownEnvironment extends DevEnvironment { console.timeEnd(`[rolldown:${this.name}:build]`) } + async buildHmr(file: string) { + logger.info(`hmr '${file}'`, { timestamp: true }) + await this.build() + const stableIds: string[] = [] + let innerCode = '' + for (const [id, code] of Object.entries(this.newModules)) { + const stableId = path.relative(this.config.root, id) + stableIds.push(stableId) + innerCode += `\ + rolldown_runtime.define(${JSON.stringify(stableId)},function(require, module, exports){ + ${code} + }); +` + } + const output = `\ +self.rolldown_runtime.patch(${JSON.stringify(stableIds)}, function(){ +${innerCode} +}); +` + // dump for debugging + const updatePath = path.join(this.outDir, `hmr-update-${Date.now()}.js`) + fs.writeFileSync(updatePath, output) + return [updatePath, output] + } + async handleUpdate(ctx: HmrContext): Promise { if (!this.result) { return @@ -261,9 +311,7 @@ class RolldownEnvironment extends DevEnvironment { this.rolldownDevOptions.hmr || this.rolldownDevOptions.ssrModuleRunner ) { - logger.info(`hmr '${ctx.file}'`, { timestamp: true }) - console.time(`[rolldown:${this.name}:hmr]`) - const result = await this.instance.experimental_hmr_rebuild([ctx.file]) + const result = await this.buildHmr(ctx.file) if (this.name === 'client') { ctx.server.ws.send('rolldown:hmr', result) } else { @@ -272,7 +320,6 @@ class RolldownEnvironment extends DevEnvironment { path.join(this.outDir, result[0]), ) } - console.timeEnd(`[rolldown:${this.name}:hmr]`) } else { await this.build() if (this.name === 'client') { @@ -379,46 +426,47 @@ function patchRuntimePlugin(environment: RolldownEnvironment): rolldown.Plugin { ) }, }, - renderChunk(code) { - // patch rolldown_runtime to workaround a few things - // TODO: is there a robust way to inject code specifically to entry or runtime? - if (code.includes('//#region rolldown:runtime')) { - // TODO: this magic string is heavy - const output = new MagicString(code) - output - // replace hard-coded WebSocket setup with custom client - .replace( - /const socket =.*?\n\};/s, - environment.name === 'client' ? getRolldownClientCode() : '', - ) - // fix rolldown_runtime.patch - .replace( - 'this.executeModuleStack.length > 1', - 'this.executeModuleStack.length > 0', - ) - .replace('parents: [parent],', 'parents: parent ? [parent] : [],') - .replace( - 'if (module.parents.indexOf(parent) === -1) {', - 'if (parent && module.parents.indexOf(parent) === -1) {', - ) - .replace( - 'for (var i = 0; i < module.parents.length; i++) {', - ` - boundaries.push(moduleId); - invalidModuleIds.push(moduleId); - if (module.parents.filter(Boolean).length === 0) { - __rolldown_hot.send("rolldown:hmr-deadend", { moduleId }); - break; - } - for (var i = 0; i < module.parents.length; i++) {`, - ) - if (environment.rolldownDevOptions.reactRefresh) { - output.prepend(getReactRefreshRuntimeCode()) - } - return { - code: output.toString(), - map: output.generateMap({ hires: 'boundary' }), - } + renderChunk(code, chunk) { + // silly but we can do `render_app` on our own for now + // https://github.com/rolldown/rolldown/blob/a29240168290e45b36fdc1a6d5c375281fb8dc3e/crates/rolldown/src/ecmascript/format/app.rs#L28-L55 + const output = new MagicString(code) + + // extract isolated module between #region and #endregion + const matches = code.matchAll(/^\/\/#region (.*)$/gm) + for (const match of matches) { + const stableId = match[1]! + const start = match.index! + const end = code.indexOf('//#endregion', match.index) + output.appendLeft( + start, + `rolldown_runtime.define(${JSON.stringify(stableId)},function(require, module, exports){\n\n`, + ) + output.appendRight(end, `\n\n});\n`) + } + assert(chunk.facadeModuleId) + const stableId = path.relative( + environment.config.root, + chunk.facadeModuleId, + ) + output.append( + `\nrolldown_runtime.require(${JSON.stringify(stableId)});\n`, + ) + + // inject runtime + const runtimeCode = fs.readFileSync( + path.join(VITE_PACKAGE_DIR, 'misc', 'rolldown-runtime.js'), + 'utf-8', + ) + output.prepend(runtimeCode) + if (environment.name === 'client') { + output.prepend(getRolldownClientCode()) + } + if (environment.rolldownDevOptions.reactRefresh) { + output.prepend(getReactRefreshRuntimeCode()) + } + return { + code: output.toString(), + map: output.generateMap({ hires: 'boundary' }), } }, } @@ -484,7 +532,7 @@ hot.on("rolldown:hmr", (data) => { self.__rolldown_hot = hot; self.__rolldown_updateStyle = updateStyle; ` - return `(() => {/*** @vite/client ***/\n${code}}\n)()` + return `;(() => {/*** @vite/client ***/\n${code}}\n)();` } function reactRefreshPlugin(): rolldown.Plugin { From fc49b91878aa66f9614757e7b51a72f1d68045c6 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 30 Nov 2024 18:34:20 +0900 Subject: [PATCH 03/11] test: fix test --- playground/rolldown-dev-react/__tests__/basic.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playground/rolldown-dev-react/__tests__/basic.spec.ts b/playground/rolldown-dev-react/__tests__/basic.spec.ts index 6e025c9d7cd7e1..1ba805d9d42037 100644 --- a/playground/rolldown-dev-react/__tests__/basic.spec.ts +++ b/playground/rolldown-dev-react/__tests__/basic.spec.ts @@ -35,8 +35,8 @@ test.runIf(!isBuild)('hmr js', async () => { editFile('./src/app.tsx', (s) => s.replace('Count:', 'Count-x:')) await page.getByRole('button', { name: 'Count-x: 1' }).click() - editFile('./src/app.tsx', (s) => s.replace('Count-x:', 'Count-x-y:')) - await page.getByRole('button', { name: 'Count-x-y: 2' }).click() + editFile('./src/app.tsx', (s) => s.replace('Count-x:', 'Count:')) + await page.getByRole('button', { name: 'Count: 2' }).click() }) test.runIf(!isBuild)('hmr css', async () => { From a5a4ab358237862d12edc1f9358d380822c91d1a Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 30 Nov 2024 19:06:36 +0900 Subject: [PATCH 04/11] refactor: extract hmr chunk from bundle --- .../src/node/server/environments/rolldown.ts | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index 21f35c9624e801..a0f47e3938269c 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -226,24 +226,6 @@ class RolldownEnvironment extends DevEnvironment { patchRuntimePlugin(this), patchCssPlugin(), reactRefreshPlugin(), - { - name: 'vite:rolldown-extract-hmr-chunk', - renderChunk: (_code, chunk) => { - // cf. https://github.com/web-infra-dev/rspack/blob/5a967f7a10ec51171a304a1ce8d741bd09fa8ed5/crates/rspack_plugin_hmr/src/lib.rs#L60 - // TODO: assume single chunk for now - this.newModules = {} - const modules: Record = {} - for (const [id, mod] of Object.entries(chunk.modules)) { - const current = mod.code - const last = this.lastModules?.[id] - if (current !== last) { - this.newModules[id] = current - } - modules[id] = current - } - this.lastModules = modules - }, - }, ], moduleTypes: { '.css': 'js', @@ -270,6 +252,21 @@ class RolldownEnvironment extends DevEnvironment { // `generate` should work but we use `write` so it's easier to see output and debug this.result = await this.instance.write(this.outputOptions) + // extract hmr chunk + // cf. https://github.com/web-infra-dev/rspack/blob/5a967f7a10ec51171a304a1ce8d741bd09fa8ed5/crates/rspack_plugin_hmr/src/lib.rs#L60 + const chunk = this.result.output[0] + this.newModules = {} + const modules: Record = {} + for (const [id, mod] of Object.entries(chunk.modules)) { + const current = mod.code + const last = this.lastModules?.[id] + if (current !== last) { + this.newModules[id] = current + } + modules[id] = current + } + this.lastModules = modules + this.buildTimestamp = Date.now() console.timeEnd(`[rolldown:${this.name}:build]`) } From 3ef80be7fe0f8394cf8ea33c4e73d15d574a4452 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 30 Nov 2024 19:17:14 +0900 Subject: [PATCH 05/11] chore: rename to "experimental-app" --- packages/vite/src/node/server/environments/rolldown.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index a0f47e3938269c..25485ce1de4aef 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -235,7 +235,7 @@ class RolldownEnvironment extends DevEnvironment { const format: rolldown.ModuleFormat = this.name === 'client' || this.rolldownDevOptions.ssrModuleRunner - ? 'app' + ? 'experimental-app' : 'esm' this.outputOptions = { dir: this.outDir, @@ -339,7 +339,7 @@ ${innerCode} } async import(input: string): Promise { - if (this.outputOptions.format === 'app') { + if (this.outputOptions.format === 'experimental-app') { return this.getRunner().import(input) } // input is no use From 8f0a9dcff112c866d9aa911647fd3cf9adc50bf1 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Mon, 2 Dec 2024 10:02:36 +0900 Subject: [PATCH 06/11] chore(deps): use nightly --- packages/vite/package.json | 2 +- pnpm-lock.yaml | 172 ++++++++++++++++++++++++++++++++++++- 2 files changed, 171 insertions(+), 3 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 2f3cdfa90bd753..dbcc25874af80e 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -88,7 +88,7 @@ "esbuild": "^0.24.0", "postcss": "^8.4.49", "react-refresh": "^0.14.2", - "rolldown": "link:../../../rolldown/packages/rolldown", + "rolldown": "0.14.0-snapshot-12d7e71-20241201004055", "rollup": "^4.23.0" }, "optionalDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 536a4b7da71802..04f12097e7d441 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -233,8 +233,8 @@ importers: specifier: ^0.14.2 version: 0.14.2 rolldown: - specifier: link:../../../rolldown/packages/rolldown - version: link:../../../rolldown/packages/rolldown + specifier: 0.14.0-snapshot-12d7e71-20241201004055 + version: 0.14.0-snapshot-12d7e71-20241201004055(@babel/runtime@7.26.0) rollup: specifier: ^4.23.0 version: 4.24.4 @@ -2337,6 +2337,15 @@ packages: search-insights: optional: true + '@emnapi/core@1.3.1': + resolution: {integrity: sha512-pVGjBIt1Y6gg3EJN8jTcfpP/+uuRksIo055oE/OBkDNcjZqVbfkWCksG1Jp4yZnj3iKWyWX8fdG/j6UDYPbFog==} + + '@emnapi/runtime@1.3.1': + resolution: {integrity: sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==} + + '@emnapi/wasi-threads@1.0.1': + resolution: {integrity: sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw==} + '@esbuild/aix-ppc64@0.23.1': resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} engines: {node: '>=18'} @@ -2743,6 +2752,9 @@ packages: resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} hasBin: true + '@napi-rs/wasm-runtime@0.2.5': + resolution: {integrity: sha512-kwUxR7J9WLutBbulqg1dfOrMTwhMdXLdcGUhcbCcGwnPLt3gz19uHVdwH1syKVDbE022ZS2vZxOWflFLS0YTjw==} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -2848,6 +2860,66 @@ packages: '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} + '@rolldown/binding-darwin-arm64@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-VnPsjtoJQaJlfFof/CW1Kh3miEtDkLi0J/IShaIhPrsmL4ZEcrITTp7/VThwlUsZpt/TvBx/VPmGPFQwe/xmQg==} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-K+b/a8cyrdDQ0H+wWgrgquHSQJ8l1EK/D0rbxv5mtdl8wUXQSP5CQwHSyNAvve2/zNDFLz4g/RGaqvaFVRtE+Q==} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-x01+jgHEcjBT50R0msJeDkIaYBaCWJAhpzhcNip79H+soF4zOaaKt/PgyVSC4N97gewdzClgmgUEHV3dfR0z/Q==} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-XwIgcHbrSdYg9okIYTznIS0dg0gNW76Wv6/Xt4gd2iSpwCk3RdAPJDDef4O2BtcSlk1sN+y5pHKlDXFFmME+WA==} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-AjU33kl38sca9gT9kfYI9nS8udOSIWK15bNdvZF7UZhNmBr2uB0KH3Fcib/HWafyEnL9XJ3pE48URAndJC+2WA==} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-arm64-musl@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-l8ZaLq5WQmQOz75iSC+8AcUasouD3o8NR0jWqggXdrHZHJ3QylKVRIXQV5iJzdy4UzVZMh608UKt9kMH1N5R7A==} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-x64-gnu@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-6JAJ9mT93Am6jXbirKufpOb3f9RDXE/K4jSIHFqukKmBvI1wBiQUHYhs/dT9XB1NNsadP3LMxEX329FMn323hw==} + cpu: [x64] + os: [linux] + + '@rolldown/binding-linux-x64-musl@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-sRaHk+a01vpxSUjxWioDmasDerR9lNTBQuoFuax+NY8z8lx2fiCwzoBoPm6a0zJHQa5ZuNvG6csLulfzg1F6JA==} + cpu: [x64] + os: [linux] + + '@rolldown/binding-wasm32-wasi@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-Itq/iYzbdoZdMh7qEGRD6Fw+IFOm3c18OzULjLNU0lD3mboEq3KF2YVthara0M92QRXes3rbGDjMTTb4w8AaMQ==} + engines: {node: '>=14.21.3'} + cpu: [wasm32] + + '@rolldown/binding-win32-arm64-msvc@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-1bKG8VlBmE93rdrfICtzjg/zdkkbMN/NM90pPGnmKnBegp/V1sJm4xm8QLkR+bUPN2JA8IwrtsOprE8J4vzf2g==} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-ia32-msvc@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-BHe345BoHH4mbwL2OCrXyZxKqaZ6Y0qlwhrQU4daomgD8cEDBxZxwYAeFikzzS79yhoQ/s4EfhPN/ruZbsBsPw==} + cpu: [ia32] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@0.14.0-snapshot-12d7e71-20241201004055': + resolution: {integrity: sha512-PA/cWPWeo9h9Pwc7qtKGcVqNj4khefmgyS5pWPcGqPkVn0msUzybq03KqkyRq18AkDsquZrYVrvUSQalUlm1mQ==} + cpu: [x64] + os: [win32] + '@rollup/plugin-alias@5.1.1': resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} engines: {node: '>=14.0.0'} @@ -3048,6 +3120,9 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} + '@tybys/wasm-util@0.9.0': + resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==} + '@type-challenges/utils@0.1.1': resolution: {integrity: sha512-A7ljYfBM+FLw+NDyuYvGBJiCEV9c0lPWEAdzfOAkb3JFqfLl0Iv/WhWMMARHiRKlmmiD1g8gz/507yVvHdQUYA==} @@ -6343,6 +6418,15 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true + rolldown@0.14.0-snapshot-12d7e71-20241201004055: + resolution: {integrity: sha512-p1F8yFTpVfNhczm/yGBIdDFZwJ0iX4jc1vG9dae761Zg5zh977RDj3+UIiPthsZSJ3NG/KdD88xNmBUUtyof0g==} + hasBin: true + peerDependencies: + '@babel/runtime': '>=7' + peerDependenciesMeta: + '@babel/runtime': + optional: true + rollup-plugin-dts@6.1.1: resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} engines: {node: '>=16'} @@ -8106,6 +8190,22 @@ snapshots: transitivePeerDependencies: - '@algolia/client-search' + '@emnapi/core@1.3.1': + dependencies: + '@emnapi/wasi-threads': 1.0.1 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.3.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.0.1': + dependencies: + tslib: 2.8.1 + optional: true + '@esbuild/aix-ppc64@0.23.1': optional: true @@ -8393,6 +8493,13 @@ snapshots: - encoding - supports-color + '@napi-rs/wasm-runtime@0.2.5': + dependencies: + '@emnapi/core': 1.3.1 + '@emnapi/runtime': 1.3.1 + '@tybys/wasm-util': 0.9.0 + optional: true + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -8473,6 +8580,44 @@ snapshots: '@polka/url@1.0.0-next.28': {} + '@rolldown/binding-darwin-arm64@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-darwin-x64@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-freebsd-x64@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-linux-arm64-gnu@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-linux-arm64-musl@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-linux-x64-gnu@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-linux-x64-musl@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-wasm32-wasi@0.14.0-snapshot-12d7e71-20241201004055': + dependencies: + '@napi-rs/wasm-runtime': 0.2.5 + optional: true + + '@rolldown/binding-win32-arm64-msvc@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-win32-ia32-msvc@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + + '@rolldown/binding-win32-x64-msvc@0.14.0-snapshot-12d7e71-20241201004055': + optional: true + '@rollup/plugin-alias@5.1.1(rollup@4.24.4)': optionalDependencies: rollup: 4.24.4 @@ -8671,6 +8816,11 @@ snapshots: '@trysound/sax@0.2.0': {} + '@tybys/wasm-util@0.9.0': + dependencies: + tslib: 2.8.1 + optional: true + '@type-challenges/utils@0.1.1': {} '@types/babel__core@7.20.5': @@ -12216,6 +12366,24 @@ snapshots: dependencies: glob: 7.2.3 + rolldown@0.14.0-snapshot-12d7e71-20241201004055(@babel/runtime@7.26.0): + dependencies: + zod: 3.23.8 + optionalDependencies: + '@babel/runtime': 7.26.0 + '@rolldown/binding-darwin-arm64': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-darwin-x64': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-freebsd-x64': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-linux-arm-gnueabihf': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-linux-arm64-gnu': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-linux-arm64-musl': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-linux-x64-gnu': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-linux-x64-musl': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-wasm32-wasi': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-win32-arm64-msvc': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-win32-ia32-msvc': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-win32-x64-msvc': 0.14.0-snapshot-12d7e71-20241201004055 + rollup-plugin-dts@6.1.1(rollup@4.24.4)(typescript@5.6.3): dependencies: magic-string: 0.30.13 From ea2a62959f639dbaa868279022f9dd75e65f1e04 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 3 Dec 2024 08:25:58 +0900 Subject: [PATCH 07/11] chore(deps): use rolldown 0.15.0 --- packages/vite/package.json | 2 +- pnpm-lock.yaml | 106 ++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index dbcc25874af80e..665032c1eeca5b 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -88,7 +88,7 @@ "esbuild": "^0.24.0", "postcss": "^8.4.49", "react-refresh": "^0.14.2", - "rolldown": "0.14.0-snapshot-12d7e71-20241201004055", + "rolldown": "0.15.0", "rollup": "^4.23.0" }, "optionalDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04f12097e7d441..0a42ee0c9ac21b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -233,8 +233,8 @@ importers: specifier: ^0.14.2 version: 0.14.2 rolldown: - specifier: 0.14.0-snapshot-12d7e71-20241201004055 - version: 0.14.0-snapshot-12d7e71-20241201004055(@babel/runtime@7.26.0) + specifier: 0.15.0 + version: 0.15.0(@babel/runtime@7.26.0) rollup: specifier: ^4.23.0 version: 4.24.4 @@ -2860,63 +2860,63 @@ packages: '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} - '@rolldown/binding-darwin-arm64@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-VnPsjtoJQaJlfFof/CW1Kh3miEtDkLi0J/IShaIhPrsmL4ZEcrITTp7/VThwlUsZpt/TvBx/VPmGPFQwe/xmQg==} + '@rolldown/binding-darwin-arm64@0.15.0': + resolution: {integrity: sha512-3Z0aZbYGfXC2gqh7rjC+PXzwIVqUR1SZJ5VDc970q/jm6Pc+uKd52zZMe8DCEAw2JZeEP7LjDgK1nYbm1+LfnA==} cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-K+b/a8cyrdDQ0H+wWgrgquHSQJ8l1EK/D0rbxv5mtdl8wUXQSP5CQwHSyNAvve2/zNDFLz4g/RGaqvaFVRtE+Q==} + '@rolldown/binding-darwin-x64@0.15.0': + resolution: {integrity: sha512-u5eFb9ELXxKz583pEopJYNQn4wfefBCSXrks0t3EwrEN3uGS96kTzdMLI/M2/FlODWh/KM3Ilu/o1m+CeFJbIw==} cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-x01+jgHEcjBT50R0msJeDkIaYBaCWJAhpzhcNip79H+soF4zOaaKt/PgyVSC4N97gewdzClgmgUEHV3dfR0z/Q==} + '@rolldown/binding-freebsd-x64@0.15.0': + resolution: {integrity: sha512-00aLb4gX9W4ILMOaEIfigjl+aZw7giwSwrdus/rqTuNf0JveDSeRSvxlvLmPzGf4q0ds8m6pvuzvrXor0bFIBA==} cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-XwIgcHbrSdYg9okIYTznIS0dg0gNW76Wv6/Xt4gd2iSpwCk3RdAPJDDef4O2BtcSlk1sN+y5pHKlDXFFmME+WA==} + '@rolldown/binding-linux-arm-gnueabihf@0.15.0': + resolution: {integrity: sha512-9cLQ4lhfC+SaqAI6tffc6fySFPu0z4TAddI+nFVqTGHj5k0FlA2XjAIQc75gJzWQLKXY0ABMAK5clR4BNutyOQ==} cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-AjU33kl38sca9gT9kfYI9nS8udOSIWK15bNdvZF7UZhNmBr2uB0KH3Fcib/HWafyEnL9XJ3pE48URAndJC+2WA==} + '@rolldown/binding-linux-arm64-gnu@0.15.0': + resolution: {integrity: sha512-iNKwZCCgWXJoclvOMWzZFO1OChcShWc/8NFM8X4vDH8OvSs+iFhXD0a1dkh0p6PuAv9Ik4wQ8kw04dJGX4GKEQ==} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-arm64-musl@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-l8ZaLq5WQmQOz75iSC+8AcUasouD3o8NR0jWqggXdrHZHJ3QylKVRIXQV5iJzdy4UzVZMh608UKt9kMH1N5R7A==} + '@rolldown/binding-linux-arm64-musl@0.15.0': + resolution: {integrity: sha512-DJYSyPq6Uqtwp2vmTPWjUm9CpJflPMGxYWcp6uIlFWpOo3xuNQcYBTHBz1edpAi1A7Y/mQLMNrvpMUSe9Wabmw==} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-x64-gnu@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-6JAJ9mT93Am6jXbirKufpOb3f9RDXE/K4jSIHFqukKmBvI1wBiQUHYhs/dT9XB1NNsadP3LMxEX329FMn323hw==} + '@rolldown/binding-linux-x64-gnu@0.15.0': + resolution: {integrity: sha512-JXwfBwxOy+6GgGLPMWzRrJgbB6c4vjwIDLSuzK0r1JymoFIWGCMVTywOtFIUxJkyKfujbUj1chjB/h0mFnci5w==} cpu: [x64] os: [linux] - '@rolldown/binding-linux-x64-musl@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-sRaHk+a01vpxSUjxWioDmasDerR9lNTBQuoFuax+NY8z8lx2fiCwzoBoPm6a0zJHQa5ZuNvG6csLulfzg1F6JA==} + '@rolldown/binding-linux-x64-musl@0.15.0': + resolution: {integrity: sha512-7XknATUDYY1/X3vI6+0fZNCCj6Qkqco7mjtp+gIlG75eWJD6gxaMksm5nCpFbnR9RWtt04dfy2c/SXUzNiZ/SA==} cpu: [x64] os: [linux] - '@rolldown/binding-wasm32-wasi@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-Itq/iYzbdoZdMh7qEGRD6Fw+IFOm3c18OzULjLNU0lD3mboEq3KF2YVthara0M92QRXes3rbGDjMTTb4w8AaMQ==} + '@rolldown/binding-wasm32-wasi@0.15.0': + resolution: {integrity: sha512-3D5d2XC3xrMjD/1J/3Ye4O+QjOgaZ31Ovg2Q/fE4VipmIyqt0V1M7pbqwZWB9Cgb7b2WlmY5cYkvmsmOWZbEpQ==} engines: {node: '>=14.21.3'} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-1bKG8VlBmE93rdrfICtzjg/zdkkbMN/NM90pPGnmKnBegp/V1sJm4xm8QLkR+bUPN2JA8IwrtsOprE8J4vzf2g==} + '@rolldown/binding-win32-arm64-msvc@0.15.0': + resolution: {integrity: sha512-52p+iB4nCaK8eDGb4TRF6GKSfzb4GG5fg864C0Pdq+ncdUAIN/lrTyIAkFQlTLiuGZbLhlZ+vDYcmZjs5nifbQ==} cpu: [arm64] os: [win32] - '@rolldown/binding-win32-ia32-msvc@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-BHe345BoHH4mbwL2OCrXyZxKqaZ6Y0qlwhrQU4daomgD8cEDBxZxwYAeFikzzS79yhoQ/s4EfhPN/ruZbsBsPw==} + '@rolldown/binding-win32-ia32-msvc@0.15.0': + resolution: {integrity: sha512-KJMBZVQu8uRpfJp/vBg6+7ipI9LoE2HWhhaKju8XcujcMJV/PmJWHD6I0M+l1WTYcvQLIRS7d83dsOhv56s3tg==} cpu: [ia32] os: [win32] - '@rolldown/binding-win32-x64-msvc@0.14.0-snapshot-12d7e71-20241201004055': - resolution: {integrity: sha512-PA/cWPWeo9h9Pwc7qtKGcVqNj4khefmgyS5pWPcGqPkVn0msUzybq03KqkyRq18AkDsquZrYVrvUSQalUlm1mQ==} + '@rolldown/binding-win32-x64-msvc@0.15.0': + resolution: {integrity: sha512-HlakXIO1Hi/eqqfYors4JxKsa8bH5upnWwbYO8IAduaqT7XLoMshagvA3+8Kf4mVWdKFIaqhJaO0E0vstEeM+g==} cpu: [x64] os: [win32] @@ -6418,8 +6418,8 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true - rolldown@0.14.0-snapshot-12d7e71-20241201004055: - resolution: {integrity: sha512-p1F8yFTpVfNhczm/yGBIdDFZwJ0iX4jc1vG9dae761Zg5zh977RDj3+UIiPthsZSJ3NG/KdD88xNmBUUtyof0g==} + rolldown@0.15.0: + resolution: {integrity: sha512-R+OnyuN+t91ZszrNmBRG/1rIPFEH4RuBGYX9lDnCNXvz74w9bxZxzpyUK0bOhxXiNeWPVoylrH/itJJAUDSTEw==} hasBin: true peerDependencies: '@babel/runtime': '>=7' @@ -8580,42 +8580,42 @@ snapshots: '@polka/url@1.0.0-next.28': {} - '@rolldown/binding-darwin-arm64@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-darwin-arm64@0.15.0': optional: true - '@rolldown/binding-darwin-x64@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-darwin-x64@0.15.0': optional: true - '@rolldown/binding-freebsd-x64@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-freebsd-x64@0.15.0': optional: true - '@rolldown/binding-linux-arm-gnueabihf@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-linux-arm-gnueabihf@0.15.0': optional: true - '@rolldown/binding-linux-arm64-gnu@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-linux-arm64-gnu@0.15.0': optional: true - '@rolldown/binding-linux-arm64-musl@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-linux-arm64-musl@0.15.0': optional: true - '@rolldown/binding-linux-x64-gnu@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-linux-x64-gnu@0.15.0': optional: true - '@rolldown/binding-linux-x64-musl@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-linux-x64-musl@0.15.0': optional: true - '@rolldown/binding-wasm32-wasi@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-wasm32-wasi@0.15.0': dependencies: '@napi-rs/wasm-runtime': 0.2.5 optional: true - '@rolldown/binding-win32-arm64-msvc@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-win32-arm64-msvc@0.15.0': optional: true - '@rolldown/binding-win32-ia32-msvc@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-win32-ia32-msvc@0.15.0': optional: true - '@rolldown/binding-win32-x64-msvc@0.14.0-snapshot-12d7e71-20241201004055': + '@rolldown/binding-win32-x64-msvc@0.15.0': optional: true '@rollup/plugin-alias@5.1.1(rollup@4.24.4)': @@ -12366,23 +12366,23 @@ snapshots: dependencies: glob: 7.2.3 - rolldown@0.14.0-snapshot-12d7e71-20241201004055(@babel/runtime@7.26.0): + rolldown@0.15.0(@babel/runtime@7.26.0): dependencies: zod: 3.23.8 optionalDependencies: '@babel/runtime': 7.26.0 - '@rolldown/binding-darwin-arm64': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-darwin-x64': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-freebsd-x64': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-linux-arm-gnueabihf': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-linux-arm64-gnu': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-linux-arm64-musl': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-linux-x64-gnu': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-linux-x64-musl': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-wasm32-wasi': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-win32-arm64-msvc': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-win32-ia32-msvc': 0.14.0-snapshot-12d7e71-20241201004055 - '@rolldown/binding-win32-x64-msvc': 0.14.0-snapshot-12d7e71-20241201004055 + '@rolldown/binding-darwin-arm64': 0.15.0 + '@rolldown/binding-darwin-x64': 0.15.0 + '@rolldown/binding-freebsd-x64': 0.15.0 + '@rolldown/binding-linux-arm-gnueabihf': 0.15.0 + '@rolldown/binding-linux-arm64-gnu': 0.15.0 + '@rolldown/binding-linux-arm64-musl': 0.15.0 + '@rolldown/binding-linux-x64-gnu': 0.15.0 + '@rolldown/binding-linux-x64-musl': 0.15.0 + '@rolldown/binding-wasm32-wasi': 0.15.0 + '@rolldown/binding-win32-arm64-msvc': 0.15.0 + '@rolldown/binding-win32-ia32-msvc': 0.15.0 + '@rolldown/binding-win32-x64-msvc': 0.15.0 rollup-plugin-dts@6.1.1(rollup@4.24.4)(typescript@5.6.3): dependencies: From 1df4042b30d42976d712565b0b1721a7ab239027 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 3 Dec 2024 16:46:50 +0900 Subject: [PATCH 08/11] fix: fix inline css hmr --- packages/vite/src/node/server/environments/rolldown.ts | 6 ++++-- playground/rolldown-dev-react/__tests__/basic.spec.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index 25485ce1de4aef..ec8a282df94e69 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -18,6 +18,7 @@ import type { } from '../..' import { CLIENT_ENTRY, VITE_PACKAGE_DIR } from '../../constants' import { injectEnvironmentToHooks } from '../../build' +import { cleanUrl } from '../../../shared/utils' const require = createRequire(import.meta.url) @@ -141,6 +142,7 @@ class RolldownEnvironment extends DevEnvironment { outputOptions!: rolldown.OutputOptions lastModules: Record = {} newModules: Record = {} + fileModuleIds = new Set() buildPromise?: Promise static createFactory( @@ -266,6 +268,7 @@ class RolldownEnvironment extends DevEnvironment { modules[id] = current } this.lastModules = modules + this.fileModuleIds = new Set(chunk.moduleIds.map((id) => cleanUrl(id))) this.buildTimestamp = Date.now() console.timeEnd(`[rolldown:${this.name}:build]`) @@ -300,8 +303,7 @@ ${innerCode} if (!this.result) { return } - const output = this.result.output[0] - if (!output.moduleIds.includes(ctx.file)) { + if (!this.fileModuleIds.has(ctx.file)) { return } if ( diff --git a/playground/rolldown-dev-react/__tests__/basic.spec.ts b/playground/rolldown-dev-react/__tests__/basic.spec.ts index 1ba805d9d42037..dfd0b816784921 100644 --- a/playground/rolldown-dev-react/__tests__/basic.spec.ts +++ b/playground/rolldown-dev-react/__tests__/basic.spec.ts @@ -57,10 +57,12 @@ test.runIf(!isBuild)('hmr css', async () => { .toBe('rgb(0, 0, 255)') await page.getByRole('button', { name: 'Count: 1' }).click() - editFile('./src/test-style.css', (s) => s.replace('blue', 'green')) + editFile('./src/test-style-inline.css', (s) => s.replace('orange', 'green')) await expect .poll(() => - page.locator('.test-style').evaluate((el) => getComputedStyle(el).color), + page + .locator('.test-style-inline') + .evaluate((el) => getComputedStyle(el).color), ) .toBe('rgb(0, 128, 0)') await page.getByRole('button', { name: 'Count: 2' }).click() From 729043660449ea9b17308ab0091b93f9118b7839 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 3 Dec 2024 16:49:49 +0900 Subject: [PATCH 09/11] chore: cleanup --- playground/rolldown-dev-react/src/app.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playground/rolldown-dev-react/src/app.tsx b/playground/rolldown-dev-react/src/app.tsx index 3a42a8bb853e2b..31ac12a5ed86a9 100644 --- a/playground/rolldown-dev-react/src/app.tsx +++ b/playground/rolldown-dev-react/src/app.tsx @@ -5,9 +5,9 @@ import virtualTest from 'virtual:test' import testAlias from 'test-alias' import { throwError } from './error' import './test-style.css' -// TODO: hmr for assets? -import testStyleUrl from './test-style-url.css?url' import testStyleInline from './test-style-inline.css?inline' +// TODO: hmr for url assets? +import testStyleUrl from './test-style-url.css?url' export function App() { const [count, setCount] = React.useState(0) From 8773916797f8c0f53f3d7eef0542f1c8ffbb9121 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 3 Dec 2024 18:17:31 +0900 Subject: [PATCH 10/11] wip: asset url hmr --- packages/vite/src/node/plugins/asset.ts | 5 ++- .../src/node/server/environments/rolldown.ts | 31 +++++++++++++++++++ playground/rolldown-dev-react/src/app.tsx | 4 +++ .../rolldown-dev-react/src/test-asset.txt | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 playground/rolldown-dev-react/src/test-asset.txt diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index 8c02f06d5fe006..c6b3839246c5a6 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -49,6 +49,7 @@ const assetCache = new WeakMap>() export interface GeneratedAssetMeta { originalFileName: string | undefined isEntry?: boolean + content?: Buffer } export const generatedAssetsMap = new WeakMap< Environment, @@ -421,7 +422,9 @@ async function fileToBuiltUrl( originalFileName, source: content, }) - generatedAssetsMap.get(environment)!.set(referenceId, { originalFileName }) + generatedAssetsMap + .get(environment)! + .set(referenceId, { originalFileName, content }) url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}` } diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index ec8a282df94e69..b571e3b3943d5e 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -19,6 +19,7 @@ import type { import { CLIENT_ENTRY, VITE_PACKAGE_DIR } from '../../constants' import { injectEnvironmentToHooks } from '../../build' import { cleanUrl } from '../../../shared/utils' +import { generatedAssetsMap } from '../../plugins/asset' const require = createRequire(import.meta.url) @@ -142,6 +143,7 @@ class RolldownEnvironment extends DevEnvironment { outputOptions!: rolldown.OutputOptions lastModules: Record = {} newModules: Record = {} + lastAssets: Record = {} fileModuleIds = new Set() buildPromise?: Promise @@ -232,6 +234,10 @@ class RolldownEnvironment extends DevEnvironment { moduleTypes: { '.css': 'js', }, + // TODO: isolating finalizer doesn't rewrite yet + // experimental: { + // resolveNewUrlToAsset: true, + // }, } this.instance = await rolldown.rolldown(this.inputOptions) @@ -254,6 +260,23 @@ class RolldownEnvironment extends DevEnvironment { // `generate` should work but we use `write` so it's easier to see output and debug this.result = await this.instance.write(this.outputOptions) + // find changed assets + const changedAssets: string[] = [] + for (const [id, { content }] of generatedAssetsMap.get(this) ?? []) { + if (content) { + const data = content.toString('utf8') + if (this.lastAssets[id] !== data) { + changedAssets.push(id) + } + this.lastAssets[id] = data + } + } + // detect change of content of assert url placeholder __VITE_ASSET__xxx + const changedAssetsRegex = new RegExp( + // eslint-disable-next-line + `__VITE_ASSET__(${changedAssets.join('|')})__`, + ) + // extract hmr chunk // cf. https://github.com/web-infra-dev/rspack/blob/5a967f7a10ec51171a304a1ce8d741bd09fa8ed5/crates/rspack_plugin_hmr/src/lib.rs#L60 const chunk = this.result.output[0] @@ -262,6 +285,12 @@ class RolldownEnvironment extends DevEnvironment { for (const [id, mod] of Object.entries(chunk.modules)) { const current = mod.code const last = this.lastModules?.[id] + if (current?.match(changedAssetsRegex)) { + // TODO: + // need to replace __VITE_ASSET__xxx + // we should property run `renderChunk` to hmr chunk too + this.newModules[id] = current + } if (current !== last) { this.newModules[id] = current } @@ -426,6 +455,8 @@ function patchRuntimePlugin(environment: RolldownEnvironment): rolldown.Plugin { }, }, renderChunk(code, chunk) { + // TODO: this magic string is heavy + // silly but we can do `render_app` on our own for now // https://github.com/rolldown/rolldown/blob/a29240168290e45b36fdc1a6d5c375281fb8dc3e/crates/rolldown/src/ecmascript/format/app.rs#L28-L55 const output = new MagicString(code) diff --git a/playground/rolldown-dev-react/src/app.tsx b/playground/rolldown-dev-react/src/app.tsx index 31ac12a5ed86a9..9ca7700eb6e75e 100644 --- a/playground/rolldown-dev-react/src/app.tsx +++ b/playground/rolldown-dev-react/src/app.tsx @@ -9,6 +9,10 @@ import testStyleInline from './test-style-inline.css?inline' // TODO: hmr for url assets? import testStyleUrl from './test-style-url.css?url' +// TODO: isolating finalizer doesn't rewrite yet +// const testAssetTxt = new URL('./test-asset.txt', import.meta.url).href; +// console.log(testAssetTxt); + export function App() { const [count, setCount] = React.useState(0) diff --git a/playground/rolldown-dev-react/src/test-asset.txt b/playground/rolldown-dev-react/src/test-asset.txt new file mode 100644 index 00000000000000..ce013625030ba8 --- /dev/null +++ b/playground/rolldown-dev-react/src/test-asset.txt @@ -0,0 +1 @@ +hello From d6c02ae9079995d4abc657070c172ba6386414da Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Thu, 5 Dec 2024 17:10:17 +0900 Subject: [PATCH 11/11] test: skip for now --- packages/vite/src/node/__tests__/build.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/__tests__/build.spec.ts b/packages/vite/src/node/__tests__/build.spec.ts index 915c2c5392d526..2f65df16d6a426 100644 --- a/packages/vite/src/node/__tests__/build.spec.ts +++ b/packages/vite/src/node/__tests__/build.spec.ts @@ -60,7 +60,8 @@ describe('build', () => { assertOutputHashContentChange(result[0], result[1]) }) - test('file hash should change when pure css chunk changes', async () => { + // https://github.com/rolldown/rolldown/issues/3049 + test.skip('file hash should change when pure css chunk changes', async () => { const buildProject = async (cssColor: string) => { return (await build({ root: resolve(__dirname, 'packages/build-project'),