Compare commits

...

4 Commits

14 changed files with 998 additions and 17 deletions

View File

@ -1,5 +1,23 @@
# Changelog
## 2025-06-19 - 2.4.0 - feat(bundler)
Introduce rspack bundler support and update multi-bundler workflow
- Added full support for rspack with its own implementation in ts/mod_rspack
- Updated package.json: new dependency on @rspack/core and revised description
- Refactored bundler types and switch statement to remove deprecated rollup and parcel options
- Modified test suite to include tests for esbuild, rolldown, and rspack with bundle size comparisons
- Adjusted output configuration for esbuild and rolldown for dynamic naming and inline dynamic imports
## 2025-06-19 - 2.3.0 - feat(bundler)
Integrate rolldown bundler support and update bundler selection logic
- Added rolldown dependency to package.json
- Extended ICliOptions to include 'rolldown' as a valid bundler option
- Created ts/mod_rolldown module with buildTest and buildProduction implementations
- Updated getBundlerPath in tsbundle.class.tsbundle.ts to route to new rolldown module
- Revised readme and hints documentation for rolldown usage
## 2025-01-29 - 2.2.5 - fix(mod_assets)
Fix async handling in asset processing

View File

@ -1,15 +1,15 @@
{
"name": "@git.zone/tsbundle",
"version": "2.2.8",
"version": "2.4.0",
"private": false,
"description": "a bundler using rollup for painless bundling of web projects",
"description": "a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "npm run build && (tstest test/) && (cd test && node ../cli.js --production)",
"test": "npm run build && (tstest test/ --verbose)",
"build": "(tsbuild --web --allowimplicitany)"
},
"bin": {
@ -35,6 +35,8 @@
"@types/html-minifier": "^4.0.5",
"esbuild": "^0.25.5",
"html-minifier": "^4.0.0",
"rolldown": "^1.0.0-beta.18",
"@rspack/core": "^1.1.8",
"typescript": "5.8.3"
},
"files": [

344
pnpm-lock.yaml generated
View File

@ -35,6 +35,9 @@ importers:
'@push.rocks/smartspawn':
specifier: ^3.0.3
version: 3.0.3
'@rspack/core':
specifier: ^1.1.8
version: 1.3.15
'@types/html-minifier':
specifier: ^4.0.5
version: 4.0.5
@ -44,6 +47,9 @@ importers:
html-minifier:
specifier: ^4.0.0
version: 4.0.0
rolldown:
specifier: ^1.0.0-beta.18
version: 1.0.0-beta.18
typescript:
specifier: 5.8.3
version: 5.8.3
@ -278,6 +284,15 @@ packages:
'@design.estate/dees-element@2.0.42':
resolution: {integrity: sha512-1PzHP6q/PtSiu4P0nCxjSeHtRHn62zoSouMy8JFW2h29FT/CSDVaTUAUqYqnvwE/U98aLNivWTmerZitDF7kBQ==}
'@emnapi/core@1.4.3':
resolution: {integrity: sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==}
'@emnapi/runtime@1.4.3':
resolution: {integrity: sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==}
'@emnapi/wasi-threads@1.0.2':
resolution: {integrity: sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==}
'@esbuild/aix-ppc64@0.23.1':
resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==}
engines: {node: '>=18'}
@ -792,9 +807,30 @@ packages:
'@mixmark-io/domino@2.2.0':
resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==}
'@module-federation/error-codes@0.14.3':
resolution: {integrity: sha512-sBJ3XKU9g5Up31jFeXPFsD8AgORV7TLO/cCSMuRewSfgYbG/3vSKLJmfHrO6+PvjZSb9VyV2UaF02ojktW65vw==}
'@module-federation/runtime-core@0.14.3':
resolution: {integrity: sha512-xMFQXflLVW/AJTWb4soAFP+LB4XuhE7ryiLIX8oTyUoBBgV6U2OPghnFljPjeXbud72O08NYlQ1qsHw1kN/V8Q==}
'@module-federation/runtime-tools@0.14.3':
resolution: {integrity: sha512-QBETX7iMYXdSa3JtqFlYU+YkpymxETZqyIIRiqg0gW+XGpH3jgU68yjrme2NBJp7URQi/CFZG8KWtfClk0Pjgw==}
'@module-federation/runtime@0.14.3':
resolution: {integrity: sha512-7ZHpa3teUDVhraYdxQGkfGHzPbjna4LtwbpudgzAxSLLFxLDNanaxCuSeIgSM9c+8sVUNC9kvzUgJEZB0krPJw==}
'@module-federation/sdk@0.14.3':
resolution: {integrity: sha512-THJZMfbXpqjQOLblCQ8jjcBFFXsGRJwUWE9l/Q4SmuCSKMgAwie7yLT0qSGrHmyBYrsUjAuy+xNB4nfKP0pnGw==}
'@module-federation/webpack-bundler-runtime@0.14.3':
resolution: {integrity: sha512-hIyJFu34P7bY2NeMIUHAS/mYUHEY71VTAsN0A0AqEJFSVPszheopu9VdXq0VDLrP9KQfuXT8SDxeYeJXyj0mgA==}
'@mongodb-js/saslprep@1.3.0':
resolution: {integrity: sha512-zlayKCsIjYb7/IdfqxorK5+xUMyi4vOKcFy10wKJYc63NSdKI8mNME+uJqfatkPmOSMMUiojrL58IePKBm3gvQ==}
'@napi-rs/wasm-runtime@0.2.11':
resolution: {integrity: sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA==}
'@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@ -838,6 +874,13 @@ packages:
'@open-wc/testing@4.0.0':
resolution: {integrity: sha512-KI70O0CJEpBWs3jrTju4BFCy7V/d4tFfYWkg8pMzncsDhD7TYNHLw5cy+s1FHXIgVFetnMDhPpwlKIPvtTQW7w==}
'@oxc-project/runtime@0.73.2':
resolution: {integrity: sha512-wbUN3K3zjMRHxAsNm1nKHebSnDY800b3LxQFTr9wSZpdQdhiQQAZpRIFsYjh0sAotoyqahN576sB1DmpPUhl5Q==}
engines: {node: '>=6.9.0'}
'@oxc-project/types@0.73.2':
resolution: {integrity: sha512-kU2FjfCb9VTNg/KbOTKVi2sYrKTkNQYq1Fi1v1jCKjbUGA9wqkNDqijNBLeDwagFtDuK2EIWvTzNDYU4k/918g==}
'@pdf-lib/standard-fonts@1.0.0':
resolution: {integrity: sha512-hU30BK9IUN/su0Mn9VdlVKsWBS6GyhVfqjwl1FjZN4TxP6cCw0jP2w7V3Hf5uX7M0AZJ16vey9yE0ny7Sa59ZA==}
@ -1208,6 +1251,130 @@ packages:
resolution: {integrity: sha512-6KGnf2vHR7hW4mQpAD7gkDVL3QVML3jb/No/Uw+qCqvs0TaQr60Yjm+CXoLxJNCKwmrL+I1yx8mhAHBHfYJiJA==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smarturl
'@rolldown/binding-darwin-arm64@1.0.0-beta.18':
resolution: {integrity: sha512-F1kqKxIuh9XM6ViC3/Ltz6ARpyUo6b1b2Lo1BhMwR5KwQ06OdOAOY9fmVW5XJ9hHYzABGgvH4hfjtYad0KshAA==}
cpu: [arm64]
os: [darwin]
'@rolldown/binding-darwin-x64@1.0.0-beta.18':
resolution: {integrity: sha512-yTBBCYbjFJSekFqv+JL6NEIvvbCZ00Z+GPT/PfgOy+jv+4nOh6Aq8pfzjtt8unSydiAihDdYwBEynXqcCTy5+g==}
cpu: [x64]
os: [darwin]
'@rolldown/binding-freebsd-x64@1.0.0-beta.18':
resolution: {integrity: sha512-chPkl0kricdSUXI/BgQmTpWppXT0tAv9gqLR7dNEHjdmYC1Dc/I8BEqiNXPkVNY4g2mtprxH3kcKTDiOqTT0Ag==}
cpu: [x64]
os: [freebsd]
'@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.18':
resolution: {integrity: sha512-jxiVMjr4jtoGirq5WW27RtcctLTXTelNEOSkWEf4m++6Mz1wOaaszSwP7X2MbUts/oaiSAqxdznovkL9Pb6fKg==}
cpu: [arm]
os: [linux]
'@rolldown/binding-linux-arm64-gnu@1.0.0-beta.18':
resolution: {integrity: sha512-1sPHSN70R2tAc0/YTzpWfRwz5v+GtA+sfI3qS37dO5esWqWSWYPTX75I2H6CSjJlSxe08K40NuSB7gPaVBtUjg==}
cpu: [arm64]
os: [linux]
'@rolldown/binding-linux-arm64-musl@1.0.0-beta.18':
resolution: {integrity: sha512-3dEGJz4GkZeUofdN1rmeep7tab0/ZR/bwkx2zoIpbEJ/k01IwR3U/Ee141+uiF9cOB3afFYaRGAHkbYwWY/hPg==}
cpu: [arm64]
os: [linux]
'@rolldown/binding-linux-x64-gnu@1.0.0-beta.18':
resolution: {integrity: sha512-e7ey7JguX3mseJdIsxLPR4x6ERGlN1AmulQqX6xWHOoEMQqU7nmHd2GZfJVBPQNUg4Vpw15bryPZnVdMljCdUQ==}
cpu: [x64]
os: [linux]
'@rolldown/binding-linux-x64-musl@1.0.0-beta.18':
resolution: {integrity: sha512-GsEWnxn1locPdsiiQ6pvAkzcAI+nXcjsEfgUqA9oy4FDSKhLJUXvh/m/6bnTJn80aDFBlrkn2+pAWBtkMcA19g==}
cpu: [x64]
os: [linux]
'@rolldown/binding-wasm32-wasi@1.0.0-beta.18':
resolution: {integrity: sha512-BO3zogNUQpQARwnZP8DXlfghoD7mn6QfeY8EJhVsZS/hRZIUXJJqGJ4gdMHa5OJgwt64/Dc5mM0g1cI7gLHeCw==}
engines: {node: '>=14.21.3'}
cpu: [wasm32]
'@rolldown/binding-win32-arm64-msvc@1.0.0-beta.18':
resolution: {integrity: sha512-52GjiZ7xF0VcU9OpieR9bYDLAikFHxUC8mHWisF3RjTcfjMIvRjx9NfBeyqAGBMwTnIEg1KbJr/KEsd3R9I5Yw==}
cpu: [arm64]
os: [win32]
'@rolldown/binding-win32-ia32-msvc@1.0.0-beta.18':
resolution: {integrity: sha512-aTT1PV/aYYVc8VbXcHxf6swiYq8SylvkOMi16K/mJJTDA1W8rL2VL5eei5W8W5KDs9qHBMK0lqFFiY7y9JcdLw==}
cpu: [ia32]
os: [win32]
'@rolldown/binding-win32-x64-msvc@1.0.0-beta.18':
resolution: {integrity: sha512-JDrmS5t/51D5q3+ZZEvj6cjDxXrB5/x7ijaSaMImaTqnbxt7B4R+Nnis95OfTSwuy3gybBWVNEO9O0Aw4DasWg==}
cpu: [x64]
os: [win32]
'@rolldown/pluginutils@1.0.0-beta.18':
resolution: {integrity: sha512-sHG++r1AOeQrzp0Lm3w9TBuaMHty3rU4yCZ4Vd/s428dvv3eTIhuRqHPHJCBlVpZjOJ5b4ZcBPTyRCsDKFt2+w==}
'@rspack/binding-darwin-arm64@1.3.15':
resolution: {integrity: sha512-f+DnVRENRdVe+ufpZeqTtWAUDSTnP48jVo7x9KWsXf8XyJHUi+eHKEPrFoy1HvL1/k5yJ3HVnFBh1Hb9cNIwSg==}
cpu: [arm64]
os: [darwin]
'@rspack/binding-darwin-x64@1.3.15':
resolution: {integrity: sha512-TfUvEIBqYUT2OK01BYXb2MNcZeZIhAnJy/5aj0qV0uy4KlvwW63HYcKWa1sFd4Ac7bnGShDkanvP3YEuHOFOyg==}
cpu: [x64]
os: [darwin]
'@rspack/binding-linux-arm64-gnu@1.3.15':
resolution: {integrity: sha512-D/YjYk9snKvYm1Elotq8/GsEipB4ZJWVv/V8cZ+ohhFNOPzygENi6JfyI06TryBTQiN0/JDZqt/S9RaWBWnMqw==}
cpu: [arm64]
os: [linux]
'@rspack/binding-linux-arm64-musl@1.3.15':
resolution: {integrity: sha512-lJbBsPMOiR0hYPCSM42yp7QiZjfo0ALtX7ws2wURpsQp3BMfRVAmXU3Ixpo2XCRtG1zj8crHaCmAWOJTS0smsA==}
cpu: [arm64]
os: [linux]
'@rspack/binding-linux-x64-gnu@1.3.15':
resolution: {integrity: sha512-qGB8ucHklrzNg6lsAS36VrBsCbOw0acgpQNqTE5cuHWrp1Pu3GFTRiFEogenxEmzoRbohMZt0Ev5grivrcgKBQ==}
cpu: [x64]
os: [linux]
'@rspack/binding-linux-x64-musl@1.3.15':
resolution: {integrity: sha512-qRn6e40fLQP+N2rQD8GAj/h4DakeTIho32VxTIaHRVuzw68ZD7VmKkwn55ssN370ejmey35ZdoNFNE12RBrMZA==}
cpu: [x64]
os: [linux]
'@rspack/binding-win32-arm64-msvc@1.3.15':
resolution: {integrity: sha512-7uJ7dWhO1nWXJiCss6Rslz8hoAxAhFpwpbWja3eHgRb7O4NPHg6MWw63AQSI2aFVakreenfu9yXQqYfpVWJ2dA==}
cpu: [arm64]
os: [win32]
'@rspack/binding-win32-ia32-msvc@1.3.15':
resolution: {integrity: sha512-UsaWTYCjDiSCB0A0qETgZk4QvhwfG8gCrO4SJvA+QSEWOmgSai1YV70prFtLLIiyT9mDt1eU3tPWl1UWPRU/EQ==}
cpu: [ia32]
os: [win32]
'@rspack/binding-win32-x64-msvc@1.3.15':
resolution: {integrity: sha512-ZnDIc9Es8EF94MirPDN+hOMt7tkb8nMEbRJFKLMmNd0ElNPgsql+1cY5SqyGRH1hsKB87KfSUQlhFiKZvzbfIg==}
cpu: [x64]
os: [win32]
'@rspack/binding@1.3.15':
resolution: {integrity: sha512-utNPuJglLO5lW9XbwIqjB7+2ilMo6JkuVLTVdnNVKU94FW7asn9F/qV+d+MgjUVqU1QPCGm0NuGO9xhbgeJ7pg==}
'@rspack/core@1.3.15':
resolution: {integrity: sha512-QuElIC8jXSKWAp0LSx18pmbhA7NiA5HGoVYesmai90UVxz98tud0KpMxTVCg+0lrLrnKZfCWN9kwjCxM5pGnrA==}
engines: {node: '>=16.0.0'}
peerDependencies:
'@swc/helpers': '>=0.5.1'
peerDependenciesMeta:
'@swc/helpers':
optional: true
'@rspack/lite-tapable@1.0.1':
resolution: {integrity: sha512-VynGOEsVw2s8TAlLf/uESfrgfrq2+rcXB1muPJYBWbsm1Oa6r5qVQhjA5ggM6z/coYPrsVMgovl3Ff7Q7OCp1w==}
engines: {node: '>=16.0.0'}
'@sec-ant/readable-stream@0.4.1':
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
@ -1464,6 +1631,9 @@ packages:
'@tsclass/tsclass@9.2.0':
resolution: {integrity: sha512-A6ULEkQfYgOnCKQVQRt26O7PRzFo4PE2EoD25RAtnuFuVrNwGynYC20Vee2c8KAOyI7nQ/LaREki9KAX4AHOHQ==}
'@tybys/wasm-util@0.9.0':
resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==}
'@types/accepts@1.3.7':
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
@ -1779,6 +1949,10 @@ packages:
resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
engines: {node: '>=12'}
ansis@4.1.0:
resolution: {integrity: sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w==}
engines: {node: '>=14'}
argparse@1.0.10:
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
@ -3865,6 +4039,10 @@ packages:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
hasBin: true
rolldown@1.0.0-beta.18:
resolution: {integrity: sha512-8svdqTMfF/LJ9ZS8NVT4pXAQDFXRrZFVyh9h+qbBprQ4Bge2dj1HkMl3b5LTJdvQY2ioWIBYsMBPw5TJ86j72Q==}
hasBin: true
rss-parser@3.13.0:
resolution: {integrity: sha512-7jWUBV5yGN3rqMMj7CZufl/291QAhvrrGpDNE4k/02ZchL0npisiYYqULF71jCEKoIiHvK/Q2e6IkDwPziT7+w==}
@ -5151,6 +5329,22 @@ snapshots:
- supports-color
- vue
'@emnapi/core@1.4.3':
dependencies:
'@emnapi/wasi-threads': 1.0.2
tslib: 2.8.1
optional: true
'@emnapi/runtime@1.4.3':
dependencies:
tslib: 2.8.1
optional: true
'@emnapi/wasi-threads@1.0.2':
dependencies:
tslib: 2.8.1
optional: true
'@esbuild/aix-ppc64@0.23.1':
optional: true
@ -5530,10 +5724,42 @@ snapshots:
'@mixmark-io/domino@2.2.0': {}
'@module-federation/error-codes@0.14.3': {}
'@module-federation/runtime-core@0.14.3':
dependencies:
'@module-federation/error-codes': 0.14.3
'@module-federation/sdk': 0.14.3
'@module-federation/runtime-tools@0.14.3':
dependencies:
'@module-federation/runtime': 0.14.3
'@module-federation/webpack-bundler-runtime': 0.14.3
'@module-federation/runtime@0.14.3':
dependencies:
'@module-federation/error-codes': 0.14.3
'@module-federation/runtime-core': 0.14.3
'@module-federation/sdk': 0.14.3
'@module-federation/sdk@0.14.3': {}
'@module-federation/webpack-bundler-runtime@0.14.3':
dependencies:
'@module-federation/runtime': 0.14.3
'@module-federation/sdk': 0.14.3
'@mongodb-js/saslprep@1.3.0':
dependencies:
sparse-bitfield: 3.0.3
'@napi-rs/wasm-runtime@0.2.11':
dependencies:
'@emnapi/core': 1.4.3
'@emnapi/runtime': 1.4.3
'@tybys/wasm-util': 0.9.0
optional: true
'@nodelib/fs.scandir@2.1.5':
dependencies:
'@nodelib/fs.stat': 2.0.5
@ -5598,6 +5824,10 @@ snapshots:
- supports-color
- utf-8-validate
'@oxc-project/runtime@0.73.2': {}
'@oxc-project/types@0.73.2': {}
'@pdf-lib/standard-fonts@1.0.0':
dependencies:
pako: 1.0.11
@ -6488,6 +6718,93 @@ snapshots:
'@pushrocks/smarturl@2.0.1': {}
'@rolldown/binding-darwin-arm64@1.0.0-beta.18':
optional: true
'@rolldown/binding-darwin-x64@1.0.0-beta.18':
optional: true
'@rolldown/binding-freebsd-x64@1.0.0-beta.18':
optional: true
'@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.18':
optional: true
'@rolldown/binding-linux-arm64-gnu@1.0.0-beta.18':
optional: true
'@rolldown/binding-linux-arm64-musl@1.0.0-beta.18':
optional: true
'@rolldown/binding-linux-x64-gnu@1.0.0-beta.18':
optional: true
'@rolldown/binding-linux-x64-musl@1.0.0-beta.18':
optional: true
'@rolldown/binding-wasm32-wasi@1.0.0-beta.18':
dependencies:
'@napi-rs/wasm-runtime': 0.2.11
optional: true
'@rolldown/binding-win32-arm64-msvc@1.0.0-beta.18':
optional: true
'@rolldown/binding-win32-ia32-msvc@1.0.0-beta.18':
optional: true
'@rolldown/binding-win32-x64-msvc@1.0.0-beta.18':
optional: true
'@rolldown/pluginutils@1.0.0-beta.18': {}
'@rspack/binding-darwin-arm64@1.3.15':
optional: true
'@rspack/binding-darwin-x64@1.3.15':
optional: true
'@rspack/binding-linux-arm64-gnu@1.3.15':
optional: true
'@rspack/binding-linux-arm64-musl@1.3.15':
optional: true
'@rspack/binding-linux-x64-gnu@1.3.15':
optional: true
'@rspack/binding-linux-x64-musl@1.3.15':
optional: true
'@rspack/binding-win32-arm64-msvc@1.3.15':
optional: true
'@rspack/binding-win32-ia32-msvc@1.3.15':
optional: true
'@rspack/binding-win32-x64-msvc@1.3.15':
optional: true
'@rspack/binding@1.3.15':
optionalDependencies:
'@rspack/binding-darwin-arm64': 1.3.15
'@rspack/binding-darwin-x64': 1.3.15
'@rspack/binding-linux-arm64-gnu': 1.3.15
'@rspack/binding-linux-arm64-musl': 1.3.15
'@rspack/binding-linux-x64-gnu': 1.3.15
'@rspack/binding-linux-x64-musl': 1.3.15
'@rspack/binding-win32-arm64-msvc': 1.3.15
'@rspack/binding-win32-ia32-msvc': 1.3.15
'@rspack/binding-win32-x64-msvc': 1.3.15
'@rspack/core@1.3.15':
dependencies:
'@module-federation/runtime-tools': 0.14.3
'@rspack/binding': 1.3.15
'@rspack/lite-tapable': 1.0.1
'@rspack/lite-tapable@1.0.1': {}
'@sec-ant/readable-stream@0.4.1': {}
'@sinclair/typebox@0.27.8': {}
@ -6863,6 +7180,11 @@ snapshots:
dependencies:
type-fest: 4.41.0
'@tybys/wasm-util@0.9.0':
dependencies:
tslib: 2.8.1
optional: true
'@types/accepts@1.3.7':
dependencies:
'@types/node': 22.12.0
@ -7256,6 +7578,8 @@ snapshots:
ansi-styles@6.2.1: {}
ansis@4.1.0: {}
argparse@1.0.10:
dependencies:
sprintf-js: 1.0.3
@ -9702,6 +10026,26 @@ snapshots:
dependencies:
glob: 7.2.3
rolldown@1.0.0-beta.18:
dependencies:
'@oxc-project/runtime': 0.73.2
'@oxc-project/types': 0.73.2
'@rolldown/pluginutils': 1.0.0-beta.18
ansis: 4.1.0
optionalDependencies:
'@rolldown/binding-darwin-arm64': 1.0.0-beta.18
'@rolldown/binding-darwin-x64': 1.0.0-beta.18
'@rolldown/binding-freebsd-x64': 1.0.0-beta.18
'@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.18
'@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.18
'@rolldown/binding-linux-arm64-musl': 1.0.0-beta.18
'@rolldown/binding-linux-x64-gnu': 1.0.0-beta.18
'@rolldown/binding-linux-x64-musl': 1.0.0-beta.18
'@rolldown/binding-wasm32-wasi': 1.0.0-beta.18
'@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.18
'@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.18
'@rolldown/binding-win32-x64-msvc': 1.0.0-beta.18
rss-parser@3.13.0:
dependencies:
entities: 2.2.0

View File

@ -0,0 +1,49 @@
# tsbundle Hints and Findings
## Bundler Architecture
- tsbundle uses a child process architecture where each bundler runs in a separate process
- Configuration is passed via environment variables as JSON (IEnvTransportOptions)
- The main class `TsBundle` spawns child processes using `smartspawn.ThreadSimple`
## Bundler Implementations
- **esbuild** (default): Fully implemented, production ready, 2.2K minified
- **rolldown**: Implemented and working (beta), produces smallest bundles (1.5K minified)
- **rspack**: Implemented and working, webpack-compatible API, 6.1K minified
- **rollup**: Removed (was never implemented)
- **parcel**: Removed (was never implemented)
## Adding New Bundlers
To add a new bundler, you need:
1. Update `ICliOptions` interface to include the bundler name
2. Add case in `getBundlerPath()` switch statement
3. Create `mod_<bundler>/` directory with:
- `plugins.ts`: Import and re-export the bundler
- `index.child.ts`: Implement TsBundleProcess class with buildTest() and buildProduction()
4. Add bundler to package.json dependencies
## Rolldown Specific Notes
- Rolldown is in beta (v1.0.0-beta.18) but working well
- API: Use `rolldown()` function directly, not `rolldown.rolldown()`
- Output options go in the `write()` method, not the initial config
- Uses `dir` and `entryFileNames` instead of `file` for output (handles dynamic imports)
- Includes `inlineDynamicImports: true` to avoid chunk splitting issues
- Produces smaller minified bundles than esbuild (1.5K vs 2.2K in tests)
- Supports TypeScript via `resolve.tsconfigFilename`
## Rspack Specific Notes
- Rspack v1.3.15 - stable and production ready
- Uses webpack-compatible API (callback-based)
- Built-in SWC loader for TypeScript transpilation
- Produces larger bundles than esbuild/rolldown due to webpack runtime overhead
- Best choice if you need webpack compatibility or advanced features
- Supports ES modules output via `experiments.outputModule: true`
## CLI Usage
- Default bundler: `tsbundle` (uses esbuild)
- Specify bundler: `tsbundle --bundler=rolldown` or `tsbundle --bundler=rspack`
- Production mode: `tsbundle --production`
- Combined: `tsbundle --bundler=rolldown --production`
## Known Issues
- esbuild recently had splitting and tree-shaking disabled due to issues
- The README still mentions "a bundler using rollup" but uses esbuild by default

112
readme.plan.md Normal file
View File

@ -0,0 +1,112 @@
# tsbundle Rolldown Integration Plan
**Command to reread CLAUDE.md**: `cat ~/.claude/CLAUDE.md`
## Objective
Add Rolldown as an optional bundler to tsbundle while keeping esbuild as the default bundler. This allows users to experiment with Rolldown using `--bundler=rolldown` flag.
## Current State
- tsbundle currently only uses esbuild despite having interfaces for multiple bundlers
- The bundler selection logic exists but always returns esbuild
- mod_rollup and mod_parcel directories exist but are empty
- Recent commits disabled splitting and tree-shaking in esbuild due to issues
## Implementation Tasks
### Phase 1: Core Infrastructure
- [x] Update `ts/interfaces/index.ts` to include 'rolldown' in bundler union type
- [x] Fix `getBundlerPath()` in `ts/tsbundle.class.tsbundle.ts` to properly route bundlers
- [x] Remove hardcoded `bundler: 'esbuild'` from transportOptions (line 26)
- [x] Add rolldown dependency to package.json: `"rolldown": "^1.0.0-beta.18"`
### Phase 2: CLI Support
- [x] Check if `ts/tsbundle.cli.ts` already parses --bundler option
- [x] Ensure default bundler is 'esbuild' when not specified
- [x] Verify CLI passes bundler option correctly to TsBundle class
### Phase 3: Rolldown Module Implementation
- [x] Create `ts/mod_rolldown/` directory
- [x] Create `ts/mod_rolldown/plugins.ts`:
```typescript
export * from '../plugins.js';
import { rolldown } from 'rolldown';
export { rolldown }
```
- [x] Create `ts/mod_rolldown/index.child.ts` with:
- TsBundleProcess class
- getAliases() method for tsconfig path resolution
- buildTest() method (sourcemaps, no minification)
- buildProduction() method (minified output)
- run() function to read transportOptions and execute
### Phase 4: Feature Parity
- [x] Implement TypeScript compilation via rolldown
- [x] Ensure source map generation works
- [x] Support tsconfig path aliases
- [x] Match esbuild's ESM output format
- [x] Implement minification for production builds
- [x] Handle bundle: true behavior
### Phase 5: Testing
- [x] Test default behavior (should use esbuild)
- [x] Test `--bundler=esbuild` explicit selection
- [x] Test `--bundler=rolldown` selection
- [x] Compare output between esbuild and rolldown
- [ ] Verify all existing tests pass with both bundlers
## Technical Specifications
### Rolldown Configuration Mapping
| esbuild option | rolldown equivalent |
|----------------|-------------------|
| bundle: true | bundle: true |
| sourcemap: true | sourcemap: true |
| format: 'esm' | format: 'es' |
| target: 'es2022' | (use default, no direct equivalent) |
| minify: true | minify: true |
| entryPoints | input |
| outfile | output.file |
| tsconfig | resolve.tsconfigFilename |
| alias | resolve.alias |
### CLI Usage
```bash
# Default (uses esbuild)
tsbundle
# Use rolldown
tsbundle --bundler=rolldown
# Production build with rolldown
tsbundle --production --bundler=rolldown
```
## Risks and Mitigation
1. **Rolldown is beta** - Keep esbuild as default, mark rolldown as experimental
2. **API differences** - Abstract common interface, handle bundler-specific logic
3. **Missing features** - Document any limitations in README
4. **Breaking changes** - None, as esbuild remains default
## Success Criteria
- [x] Can build with esbuild (default behavior unchanged)
- [x] Can build with rolldown via --bundler flag
- [x] Both bundlers produce working ESM output
- [x] Source maps work with both bundlers
- [x] TypeScript compilation works with both
- [ ] All existing tests pass
## Implementation Status
**COMPLETED** - Rolldown has been successfully integrated as an optional bundler.
### Test Results:
- esbuild (default): Working correctly, 2.2K minified
- rolldown: Working correctly, 1.5K minified (better compression!)
- Both bundlers support all required features
- CLI properly routes to selected bundler
- Production and test modes work for both
## Future Considerations
- Once Rolldown reaches v1.0.0 stable, consider making it default
- Implement rollup and parcel modules using same pattern
- Add performance benchmarks comparing bundlers
- Consider adding --watch mode support

View File

@ -1,17 +1,108 @@
import { expect, tap } from '@push.rocks/tapbundle';
import * as tsbundle from '../ts/index.js';
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as tsbundle from '../dist_ts/index.js';
import * as path from 'path';
import * as fs from 'fs';
const testBundler = async (bundlerName: 'esbuild' | 'rolldown' | 'rspack', mode: 'test' | 'production') => {
const outputFile = `./dist_manual/${bundlerName}-${mode}.js`;
const testDir = path.join(process.cwd(), 'test');
// Clean up output directory
const outputDir = path.join(testDir, 'dist_manual');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
// Clean up output file if exists
const outputPath = path.join(testDir, outputFile);
if (fs.existsSync(outputPath)) {
fs.rmSync(outputPath, { force: true });
}
tap.test('should bundle with esbuild', async () => {
const tsbundleInstance = new tsbundle.TsBundle();
await tsbundleInstance.build(
process.cwd() + '/test',
testDir,
'./ts_web/index.ts',
'./dist_manual/test.js',
outputFile,
{
bundler: 'esbuild'
bundler: bundlerName,
production: mode === 'production'
}
);
// Verify output file was created
expect(fs.existsSync(outputPath)).toBeTrue();
console.log(`${bundlerName} ${mode} mode: success`);
};
// Test esbuild
tap.test('should bundle with esbuild in test mode', async () => {
await testBundler('esbuild', 'test');
});
tap.test('should bundle with esbuild in production mode', async () => {
await testBundler('esbuild', 'production');
});
// Test rolldown
tap.test('should bundle with rolldown in test mode', async () => {
await testBundler('rolldown', 'test');
});
tap.test('should bundle with rolldown in production mode', async () => {
await testBundler('rolldown', 'production');
});
// Test rspack
tap.test('should bundle with rspack in test mode', async () => {
await testBundler('rspack', 'test');
});
tap.test('should bundle with rspack in production mode', async () => {
await testBundler('rspack', 'production');
});
// Test size comparison
tap.test('should show bundle size comparison', async () => {
const testDir = path.join(process.cwd(), 'test');
const sizes: Record<string, { test: number; production: number }> = {
esbuild: { test: 0, production: 0 },
rolldown: { test: 0, production: 0 },
rspack: { test: 0, production: 0 }
};
for (const bundler of ['esbuild', 'rolldown', 'rspack'] as const) {
for (const mode of ['test', 'production'] as const) {
const filePath = path.join(testDir, `dist_manual/${bundler}-${mode}.js`);
if (fs.existsSync(filePath)) {
const stats = fs.statSync(filePath);
sizes[bundler][mode] = stats.size;
}
}
}
console.log('\n📊 Bundle Size Comparison:');
console.log('┌─────────────┬────────────┬──────────────┐');
console.log('│ Bundler │ Test Mode │ Production │');
console.log('├─────────────┼────────────┼──────────────┤');
for (const bundler of ['esbuild', 'rolldown', 'rspack'] as const) {
const testSize = (sizes[bundler].test / 1024).toFixed(1) + ' KB';
const prodSize = (sizes[bundler].production / 1024).toFixed(1) + ' KB';
console.log(`${bundler.padEnd(11)}${testSize.padEnd(10)}${prodSize.padEnd(12)}`);
}
console.log('└─────────────┴────────────┴──────────────┘');
// Verify all sizes are reasonable
for (const bundler of ['esbuild', 'rolldown', 'rspack'] as const) {
expect(sizes[bundler].test).toBeGreaterThan(0);
expect(sizes[bundler].production).toBeGreaterThan(0);
// Production bundles should generally be smaller due to minification
// but rspack might be larger due to runtime overhead
if (bundler !== 'rspack') {
expect(sizes[bundler].production).toBeLessThan(sizes[bundler].test);
}
}
});
tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tsbundle',
version: '2.2.5',
description: 'a bundler using rollup for painless bundling of web projects'
version: '2.4.0',
description: 'a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects'
}

View File

@ -2,7 +2,7 @@ export interface ICliOptions {
commonjs?: boolean;
skiplibcheck?: boolean;
production?: boolean;
bundler: 'parcel' | 'esbuild' | 'rollup'
bundler: 'esbuild' | 'rolldown' | 'rspack'
}
export interface IEnvTransportOptions {

View File

@ -61,7 +61,7 @@ export class TsBundleProcess {
format: 'esm',
target: 'es2022',
minify: true,
entryNames: 'bundle',
entryNames: plugins.path.parse(toArg).name,
outdir: plugins.path.parse(toArg).dir,
tsconfig: paths.tsconfigPath,
splitting: false,

View File

@ -0,0 +1,115 @@
import * as plugins from './plugins.js';
import * as paths from '../paths.js';
import * as interfaces from '../interfaces/index.js';
import { logger } from '../tsbundle.logging.js';
export class TsBundleProcess {
constructor() {
// Nothing here
}
public async getAliases() {
try {
const aliasObject: Record<string, string> = {};
const localTsConfig = plugins.smartfile.fs.toObjectSync(
plugins.path.join(paths.cwd, 'tsconfig.json')
);
if (localTsConfig.compilerOptions && localTsConfig.compilerOptions.paths) {
for (const alias of Object.keys(localTsConfig.compilerOptions.paths)) {
const aliasPath = localTsConfig.compilerOptions.paths[alias][0];
aliasObject[alias] = aliasPath;
}
}
return aliasObject;
} catch (error) {
return {};
}
}
/**
* creates a bundle for the test enviroment
*/
public async buildTest(fromArg: string, toArg: string, argvArg: any) {
// create a bundle
const result = await plugins.rolldown({
input: fromArg,
resolve: {
alias: await this.getAliases(),
tsconfigFilename: paths.tsconfigPath,
},
});
const outputDir = plugins.path.dirname(toArg);
const outputFilename = plugins.path.basename(toArg);
await result.write({
dir: outputDir,
entryFileNames: outputFilename,
format: 'es',
sourcemap: true,
inlineDynamicImports: true,
});
}
/**
* creates a bundle for the production environment
*/
public async buildProduction(fromArg: string, toArg: string, argvArg: any) {
// create a bundle
console.log('rolldown specific:');
console.log(`from: ${fromArg}`);
console.log(`to: ${toArg}`);
const result = await plugins.rolldown({
input: fromArg,
resolve: {
alias: await this.getAliases(),
tsconfigFilename: paths.tsconfigPath,
},
experimental: {
enableComposingJsPlugins: true,
},
});
const outputDir = plugins.path.dirname(toArg);
const outputFilename = plugins.path.basename(toArg);
await result.write({
dir: outputDir,
entryFileNames: outputFilename,
format: 'es',
sourcemap: true,
minify: true,
inlineDynamicImports: true,
});
}
}
const run = async () => {
console.log('running spawned compilation process');
const transportOptions: interfaces.IEnvTransportOptions = JSON.parse(
process.env.transportOptions
);
console.log('=======> ROLLDOWN');
console.log(transportOptions);
process.chdir(transportOptions.cwd);
console.log(`switched to ${process.cwd()}`);
const tsbundleProcessInstance = new TsBundleProcess();
if (transportOptions.mode === 'test') {
console.log('building for test:');
await tsbundleProcessInstance.buildTest(
plugins.smartpath.transform.makeAbsolute(transportOptions.from, process.cwd()),
plugins.smartpath.transform.makeAbsolute(transportOptions.to, process.cwd()),
transportOptions.argv
);
} else {
console.log('building for production:');
await tsbundleProcessInstance.buildProduction(
plugins.smartpath.transform.makeAbsolute(transportOptions.from, process.cwd()),
plugins.smartpath.transform.makeAbsolute(transportOptions.to, process.cwd()),
transportOptions.argv
);
}
};
run();

View File

@ -0,0 +1,5 @@
export * from '../plugins.js';
import { rolldown } from 'rolldown';
export { rolldown }

View File

@ -0,0 +1,236 @@
import * as plugins from './plugins.js';
import * as paths from '../paths.js';
import * as interfaces from '../interfaces/index.js';
import { logger } from '../tsbundle.logging.js';
export class TsBundleProcess {
constructor() {
// Nothing here
}
public async getAliases() {
try {
const aliasObject: Record<string, string> = {};
const localTsConfig = plugins.smartfile.fs.toObjectSync(
plugins.path.join(paths.cwd, 'tsconfig.json')
);
if (localTsConfig.compilerOptions && localTsConfig.compilerOptions.paths) {
for (const alias of Object.keys(localTsConfig.compilerOptions.paths)) {
const aliasPath = localTsConfig.compilerOptions.paths[alias][0];
// Convert TypeScript path to absolute path for rspack
aliasObject[alias.replace('/*', '')] = plugins.path.resolve(paths.cwd, aliasPath.replace('/*', ''));
}
}
return aliasObject;
} catch (error) {
return {};
}
}
/**
* creates a bundle for the test enviroment
*/
public async buildTest(fromArg: string, toArg: string, argvArg: any) {
const aliases = await this.getAliases();
const outputDir = plugins.path.dirname(toArg);
const outputFilename = plugins.path.basename(toArg);
const config = {
mode: 'development' as const,
entry: {
main: fromArg,
},
output: {
path: outputDir,
filename: outputFilename,
library: {
type: 'module' as const,
},
},
devtool: 'source-map' as const,
resolve: {
alias: aliases,
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: true,
},
target: 'es2022',
transform: {
decoratorVersion: '2022-03',
},
},
},
},
type: 'javascript/auto',
},
],
},
experiments: {
outputModule: true,
},
};
return new Promise((resolve, reject) => {
plugins.rspack(config, (err, stats) => {
if (err) {
console.error(err.stack || err);
reject(err);
return;
}
if (stats.hasErrors()) {
console.error(stats.toString());
reject(new Error('Build failed with errors'));
return;
}
console.log(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false,
}));
resolve(undefined);
});
});
}
/**
* creates a bundle for the production environment
*/
public async buildProduction(fromArg: string, toArg: string, argvArg: any) {
console.log('rspack specific:');
console.log(`from: ${fromArg}`);
console.log(`to: ${toArg}`);
const aliases = await this.getAliases();
const outputDir = plugins.path.dirname(toArg);
const outputFilename = plugins.path.basename(toArg);
const config = {
mode: 'production' as const,
entry: {
main: fromArg,
},
output: {
path: outputDir,
filename: outputFilename,
library: {
type: 'module' as const,
},
},
devtool: 'source-map' as const,
resolve: {
alias: aliases,
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: true,
},
target: 'es2022',
transform: {
decoratorVersion: '2022-03',
},
minify: {
compress: true,
mangle: true,
},
},
},
},
type: 'javascript/auto',
},
],
},
optimization: {
minimize: true,
concatenateModules: true,
usedExports: true,
sideEffects: true,
},
experiments: {
outputModule: true,
},
};
return new Promise((resolve, reject) => {
plugins.rspack(config, (err, stats) => {
if (err) {
console.error(err.stack || err);
reject(err);
return;
}
if (stats.hasErrors()) {
console.error(stats.toString());
reject(new Error('Build failed with errors'));
return;
}
console.log(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false,
}));
resolve(undefined);
});
});
}
}
const run = async () => {
console.log('running spawned compilation process');
const transportOptions: interfaces.IEnvTransportOptions = JSON.parse(
process.env.transportOptions
);
console.log('=======> RSPACK');
console.log(transportOptions);
process.chdir(transportOptions.cwd);
console.log(`switched to ${process.cwd()}`);
const tsbundleProcessInstance = new TsBundleProcess();
if (transportOptions.mode === 'test') {
console.log('building for test:');
await tsbundleProcessInstance.buildTest(
plugins.smartpath.transform.makeAbsolute(transportOptions.from, process.cwd()),
plugins.smartpath.transform.makeAbsolute(transportOptions.to, process.cwd()),
transportOptions.argv
);
} else {
console.log('building for production:');
await tsbundleProcessInstance.buildProduction(
plugins.smartpath.transform.makeAbsolute(transportOptions.from, process.cwd()),
plugins.smartpath.transform.makeAbsolute(transportOptions.to, process.cwd()),
transportOptions.argv
);
}
};
run();

5
ts/mod_rspack/plugins.ts Normal file
View File

@ -0,0 +1,5 @@
export * from '../plugins.js';
import { rspack } from '@rspack/core';
export { rspack }

View File

@ -12,10 +12,15 @@ export class TsBundle {
) {
const done = plugins.smartpromise.defer();
const getBundlerPath = () => {
if (argvArg.bundler === 'esbuild') {
return './mod_esbuild/index.child.js'
switch (argvArg.bundler) {
case 'rolldown':
return './mod_rolldown/index.child.js';
case 'rspack':
return './mod_rspack/index.child.js';
case 'esbuild':
default:
return './mod_esbuild/index.child.js';
}
return './mod_esbuild/index.child.js'
}
const transportOptions: interfaces.IEnvTransportOptions = {
cwd: cwdArg,
@ -23,7 +28,6 @@ export class TsBundle {
to: toArg,
mode: argvArg && argvArg.production ? 'production' : 'test',
argv: {
bundler: 'esbuild',
...argvArg
}
}