From 6467707d44bf2bc55bcf023964099afc76bcc8b9 Mon Sep 17 00:00:00 2001 From: Eugene Olonov Date: Fri, 13 Nov 2026 02:43:26 -0800 Subject: [PATCH 01/37] Add the tsdown build configuration - tsdown 0.23.7 (rolldown 1.3.0, rolldown-plugin-dts 0.30.0), next to tsup. - tsdown.base.config.mts: port of tsup.base.config.ts with createDualFormatConfigs(), iifeOptions() and packagePattern(). - rolldownPlugins.mjs: cssPlugin (CSS modules with the same Lightning CSS options, bundled per entry, lowered for the targets, with a source map) and istanbulPlugin (NODE_ENV=test). - injectCSSRolldownPlugin: rolldown flavor of injectCSSPlugin, next to it. --- package-lock.json | 814 +++++++++++++++++- package.json | 1 + packages/api-graph/tsup.config.ts | 23 - packages/api-middleware/tsup.config.ts | 24 - packages/base/tsup.config.ts | 25 - packages/component-better-link/tsup.config.ts | 23 - packages/core-debug-api/tsup.config.ts | 23 - packages/core-graph/tsup.config.ts | 24 - packages/core-json-ld/tsup.config.ts | 23 - packages/core/tsup.config.ts | 37 - packages/directlinespeech/tsup.config.ts | 82 -- packages/react-hooks/tsup.config.ts | 23 - packages/react-valibot/tsup.config.ts | 23 - packages/redux-store/tsup.config.ts | 23 - packages/styles/src/build/index.ts | 1 + .../src/build/private/injectCSSPlugin.ts | 2 + .../build/private/injectCSSRolldownPlugin.ts | 130 +++ packages/styles/tsup.config.ts | 25 - packages/test/web-server/tsup.config.ts | 13 - rolldownPlugins.mjs | 212 +++++ tsdown.base.config.mts | 124 +++ 21 files changed, 1267 insertions(+), 408 deletions(-) delete mode 100644 packages/api-graph/tsup.config.ts delete mode 100644 packages/api-middleware/tsup.config.ts delete mode 100644 packages/base/tsup.config.ts delete mode 100644 packages/component-better-link/tsup.config.ts delete mode 100644 packages/core-debug-api/tsup.config.ts delete mode 100644 packages/core-graph/tsup.config.ts delete mode 100644 packages/core-json-ld/tsup.config.ts delete mode 100644 packages/core/tsup.config.ts delete mode 100644 packages/directlinespeech/tsup.config.ts delete mode 100644 packages/react-hooks/tsup.config.ts delete mode 100644 packages/react-valibot/tsup.config.ts delete mode 100644 packages/redux-store/tsup.config.ts create mode 100644 packages/styles/src/build/private/injectCSSRolldownPlugin.ts delete mode 100644 packages/styles/tsup.config.ts delete mode 100644 packages/test/web-server/tsup.config.ts create mode 100644 rolldownPlugins.mjs create mode 100644 tsdown.base.config.mts diff --git a/package-lock.json b/package-lock.json index 80570536fd..f77b6de6b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -106,6 +106,7 @@ "read-pkg": "^10.1.0", "selenium-webdriver": "^4.44.0", "strip-ansi": "^6.0.1", + "tsdown": "^0.23.7", "tsup": "^9.0.0", "typescript": "^6.0.3", "unplugin-lightningcss": "^0.4.5" @@ -2430,6 +2431,40 @@ "node": ">=14.17.0" } }, + "node_modules/@emnapi/core": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@emotion/babel-plugin": { "version": "11.13.5", "license": "MIT", @@ -4134,6 +4169,28 @@ "node": "^22.20 || ^24.12 || >=25" } }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + } + }, "node_modules/@nicolo-ribaudo/chokidar-2": { "version": "2.1.8-no-fsevents.3", "dev": true, @@ -4183,6 +4240,16 @@ "node": ">= 8" } }, + "node_modules/@oxc-project/types": { + "version": "0.157.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.157.0.tgz", + "integrity": "sha512-95iTox1qdt6WGWce3xwNOVayByOfLaYAq+qGPpub6NWbBh9sv0GG3+zyfh9ZBCO/jVu5A0EWI+qQI7g6fevjxg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, "node_modules/@parcel/watcher": { "version": "2.5.1", "dev": true, @@ -4647,6 +4714,19 @@ "url": "https://opencollective.com/pkgr" } }, + "node_modules/@quansync/fs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@quansync/fs/-/fs-1.1.0.tgz", + "integrity": "sha512-qAPG/t3HqML1TlN7sY/pTbEjzFVAKsMjNNMGheyDosro+kT4iw2KCUoHcVdmliwWjorm4elZbgNQyU2eD97eDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "quansync": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + } + }, "node_modules/@redux-saga/core": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@redux-saga/core/-/core-1.5.0.tgz", @@ -4690,16 +4770,315 @@ "@redux-saga/types": "^1.3.1" } }, - "node_modules/@redux-saga/symbols": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@redux-saga/symbols/-/symbols-1.2.1.tgz", - "integrity": "sha512-3dh+uDvpBXi7EUp/eO+N7eFM4xKaU4yuGBXc50KnZGzIrR/vlvkTFQsX13zsY8PB6sCFYAgROfPSRUj8331QSA==", - "license": "MIT" - }, - "node_modules/@redux-saga/types": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@redux-saga/types/-/types-1.4.0.tgz", - "integrity": "sha512-fq3Vy0TRl0mEb+1CyTx5wPBY3jxDi7yD4GL1Kz4S6ud7/leGEgRq1NYJDIiVbHMRBJd5rU/BB0Z+akrXSR0DJg==", + "node_modules/@redux-saga/symbols": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@redux-saga/symbols/-/symbols-1.2.1.tgz", + "integrity": "sha512-3dh+uDvpBXi7EUp/eO+N7eFM4xKaU4yuGBXc50KnZGzIrR/vlvkTFQsX13zsY8PB6sCFYAgROfPSRUj8331QSA==", + "license": "MIT" + }, + "node_modules/@redux-saga/types": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@redux-saga/types/-/types-1.4.0.tgz", + "integrity": "sha512-fq3Vy0TRl0mEb+1CyTx5wPBY3jxDi7yD4GL1Kz4S6ud7/leGEgRq1NYJDIiVbHMRBJd5rU/BB0Z+akrXSR0DJg==", + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.3.0.tgz", + "integrity": "sha512-zjq+pUSE36RJG9nJXqrRfMCOxekzVhlaYMtFELHaOcRH4UqTnkWhbTbEixKEawsb0ZTVMRbn8RLYcuU4DYk8qg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.3.0.tgz", + "integrity": "sha512-HdnCiSmMGgEILGVLU1o4dcOblLGj8sMnqEFrDY/S7KRti1nTQHAqGGs2AniPspbK90AFS3pM23K/R0J3hPQXYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.3.0.tgz", + "integrity": "sha512-TkQ2JGC8/9UxoCeH5dSJj1gxuFhzw200QTJJd2YNPRXznSSM4XvpKV2Cs+RM2BcM8sa6xa4rmXNuiJ64+1993g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.3.0.tgz", + "integrity": "sha512-Gr+iZW50RJZo4BPUazaDh/Azx7W0Rl04sy2MkXD+H4RkxzUX5hIrjaVw1BK+XHsccKExQAmCy6DhvRLlUzaYUg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.3.0.tgz", + "integrity": "sha512-RwAtx8peSqUoBf8pxE0L62xKXBNnA3BtdFV+07t13t0TQoASCtV9tnU67aKKMRZSiD06SU07chB5B8fWFdW3gQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.3.0.tgz", + "integrity": "sha512-ow8fq6kYaIx75D0EVT5GeF4DcawcEYYXJ2CvEaOzyygW1jtVDQU/9o5YYidctHBRDUgPzGaTNB6n/VMTmd1ymw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.3.0.tgz", + "integrity": "sha512-PLOWuiz+rdqSgiLgN7bxvy6DjXLj8gnJxzRS243LNnLi96VeyB7VFsC3eblcKv3Xwd3jQqJfbCWRhLijTIZyvQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.3.0.tgz", + "integrity": "sha512-CQ/k85cc342j5SnZ/gT9p132NXZRGTgLRhfItdYqUg+jpvL5HYFve0GB+zQDCYGwDjtDWIoqKSOitkmZMZc/tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.3.0.tgz", + "integrity": "sha512-wk+ZG7xDP2px3cQRFoNoNp52/w1O5hTTtciHxuastreMOp8isYUTCpcG/rEYnSQBI+nycN+B9d9pBGua+qvV7w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.3.0.tgz", + "integrity": "sha512-sEgyZt72Rj7V5q6OZ7A4U2I5v4EMGEv3Fp5QmoncmKbUMTrGmpyH7MwENfERGbfUYjxdBmktw4JJLys5I1aQNQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.3.0.tgz", + "integrity": "sha512-PvL0BoBUwVugK1pFd+zyVk1L9F6ucmQ7oF2dpy8zKPHNlbW2zrU9Jst3fWYfG7z3owjxqhwAvi5G4o0AikrJMw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.3.0.tgz", + "integrity": "sha512-5N4DdzAmLtnyuh027H6ViC99BeoA4T0RwKS6qUrl6zY70AKRsNDrnEZeWnqrKmDRFxXmv8zf9yhF2DxN/SfyGQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.3.0.tgz", + "integrity": "sha512-Tz+2b+yF5eVRGX3DWebn2JIvZkNYI1gkafI+nF2fau2zeQDOpBAS8w1PxHi4ke//NIOE6+2DNYyq1veIjzAXqQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.3.0.tgz", + "integrity": "sha512-ntK6OFor3nQtS1TenZP5wX59oPpkKEmour3AipGHB32u+Z8QXxjVdG+7vNSvgerRWIj6vjg4XpKu42slb0vlXQ==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.3.0.tgz", + "integrity": "sha512-ldH38lBlOpS+b4fbSG9euQjhYXLE18PIz5hyvf6gvFfyVLodRE/Tsu4jV8UmPqjjce6lotmUUwscxPuer4lczQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.3.0.tgz", + "integrity": "sha512-HglhUzUPuXNTGFt5ZwJalSEvavhFSl+nxpQM9urkzkt+2oGI1ZSwgyytk9aGw15/0kk1TCHPc57nv3DdiG8/yQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, "license": "MIT" }, "node_modules/@rollup/plugin-node-resolve": { @@ -5360,6 +5739,17 @@ "node": ">=14.17" } }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz", + "integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@types/aria-query": { "version": "5.0.4", "dev": true, @@ -6123,6 +6513,90 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/@yuku-toolchain/darwin-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@yuku-toolchain/darwin-arm64/-/darwin-arm64-0.27.0.tgz", + "integrity": "sha512-A3v83rNyHWlnJeeMBsWggZ+RZDP2BEMHIiMk+j23LqtVch24MXwg8veflkQgZ2GtCtZOxcG+NkztnsSUS4rWEQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@yuku-toolchain/darwin-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@yuku-toolchain/darwin-x64/-/darwin-x64-0.27.0.tgz", + "integrity": "sha512-u+fcqQw0uRj5irtO5f0xu5nGazYRxfBVBNIuhiONWX6Mh2izRONSNXhCwFDaYRqHunublzw2l2aQMB0n5n1t0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@yuku-toolchain/linux-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@yuku-toolchain/linux-arm64/-/linux-arm64-0.27.0.tgz", + "integrity": "sha512-IPB+9LSC/sf8Sa8DtqapUgU4uTL/U94Vr5mgUsfRx59u8/4BT38cze+e5b96AlQynsdtuF4tgC0FW0TmJ2B75g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@yuku-toolchain/linux-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@yuku-toolchain/linux-x64/-/linux-x64-0.27.0.tgz", + "integrity": "sha512-fe1kN04JPBODrkRZOuI06jIqKyzcyn0ykx+tpiERDwqAh9ALWOtkgfhFjVaOQSu+guhakzY/89xjQdmfY7EJ7w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@yuku-toolchain/win32-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@yuku-toolchain/win32-arm64/-/win32-arm64-0.27.0.tgz", + "integrity": "sha512-NZmiFTF7ee45Fhnsa0BGMCpElJGg8iGYt4N3UoKj/n1vNmACcgY6NI4najNr9Jc1ulIVVvtPbo934RMlZQakrA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@yuku-toolchain/win32-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@yuku-toolchain/win32-x64/-/win32-x64-0.27.0.tgz", + "integrity": "sha512-7LSviI8HtHga0g7G2oT7C/SP2IoLmrg8LYPeWZkp4ljFtaWKJoTRF0Iv0cVt0dR4rehoN/+TjN4r8SoArCKvlg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/abbrev": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-5.0.0.tgz", @@ -8424,6 +8898,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/defu": { + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", + "dev": true, + "license": "MIT" + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -8608,6 +9089,27 @@ "url": "https://dotenvx.com" } }, + "node_modules/dts-resolver": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/dts-resolver/-/dts-resolver-3.0.0.tgz", + "integrity": "sha512-1T1f+z+4tl9XD+m+0HBgWoL/nm0bOIffyWaUuUSBlFg/86IWvfx+wjNaO/ybU0AJzG9/Mi5hBUgGV6zCmWEN7Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^22.18.0 || >=24.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + }, + "peerDependencies": { + "oxc-resolver": ">=11.0.0" + }, + "peerDependenciesMeta": { + "oxc-resolver": { + "optional": true + } + } + }, "node_modules/dtsroll": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/dtsroll/-/dtsroll-1.8.2.tgz", @@ -8703,10 +9205,11 @@ "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==" }, "node_modules/empathic": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.0.tgz", - "integrity": "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.1.0.tgz", + "integrity": "sha512-AnfC1ATldl49/cvZdLPDjBfrRNwbDO05aibiOtzQu3qtlbJtomNLhF30HEtn/7iBz50dlMECqATo3fG0LrdEgw==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" } @@ -10477,6 +10980,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.6.tgz", + "integrity": "sha512-X6fBC0pmImC70gvX2zm56go9hx0MyoGVdG0tUCkg/D+Xnh5TJsOZ7iDbOdI3PvmtrDxnu1YdDufpK2QJX1Meqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "engines": { + "node": ">=20.20.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "dev": true, @@ -11027,6 +11546,13 @@ "hermes-estree": "0.25.1" } }, + "node_modules/hookable": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/hookable/-/hookable-6.1.2.tgz", + "integrity": "sha512-+abwxtiEA52GCVIsQqut3S/uKTbUwYIp4Pe/vv+6py5XiXBCqMZHg6pA6Y5qhgLSEys0/cYuPbO0z1QFj5ZCmg==", + "dev": true, + "license": "MIT" + }, "node_modules/hosted-git-info": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.3.tgz", @@ -11397,6 +11923,19 @@ "node": ">=8" } }, + "node_modules/import-without-cache": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/import-without-cache/-/import-without-cache-0.4.1.tgz", + "integrity": "sha512-vXoV9PjKHEednCUu01e98TkImxy67e3BJXbTIOmIq4Hyzw3IAwYRcuPkfeTzJzwyyts4kjuA73x+pWJLc4f86A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^22.18.0 || >=24.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "dev": true, @@ -16753,6 +17292,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/quansync": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/quansync/-/quansync-1.0.0.tgz", + "integrity": "sha512-5xZacEEufv3HSTPQuchrvV6soaiACMFnq1H8wkVioctoH3TRha9Sz66lOxRwPK/qZj7HPiSveih9yAyh98gvqA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/antfu" + }, + { + "type": "individual", + "url": "https://github.com/sponsors/sxzz" + } + ], + "license": "MIT" + }, "node_modules/queue-microtask": { "version": "1.2.3", "dev": true, @@ -17575,6 +18131,85 @@ "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", "dev": true }, + "node_modules/rolldown": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.3.0.tgz", + "integrity": "sha512-7j1jdVlzWzbRat9EDMsB/QmyMcc6hOO0vbcma8LGjBTmKlpS5Hem+5fpntc/HoRV5tLrG+Qo6I1ZHV/ZuL5S8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.157.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.3.0", + "@rolldown/binding-android-arm64": "1.3.0", + "@rolldown/binding-darwin-arm64": "1.3.0", + "@rolldown/binding-darwin-x64": "1.3.0", + "@rolldown/binding-freebsd-x64": "1.3.0", + "@rolldown/binding-linux-arm-gnueabihf": "1.3.0", + "@rolldown/binding-linux-arm64-gnu": "1.3.0", + "@rolldown/binding-linux-arm64-musl": "1.3.0", + "@rolldown/binding-linux-ppc64-gnu": "1.3.0", + "@rolldown/binding-linux-s390x-gnu": "1.3.0", + "@rolldown/binding-linux-x64-gnu": "1.3.0", + "@rolldown/binding-linux-x64-musl": "1.3.0", + "@rolldown/binding-openharmony-arm64": "1.3.0", + "@rolldown/binding-wasm32-wasi": "1.3.0", + "@rolldown/binding-win32-arm64-msvc": "1.3.0", + "@rolldown/binding-win32-x64-msvc": "1.3.0" + } + }, + "node_modules/rolldown-plugin-dts": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/rolldown-plugin-dts/-/rolldown-plugin-dts-0.30.0.tgz", + "integrity": "sha512-5FNezfYv5alHvrYw5Xoj4RNqbZ9F+/1jETFSohhYfRiama8tUN4mcVURmBqbZQba45t5hRdW7aSOnV6WYIj0MA==", + "dev": true, + "license": "MIT", + "dependencies": { + "dts-resolver": "^3.0.0", + "get-tsconfig": "5.0.0-beta.6", + "obug": "^3.0.0", + "yuku": "^0.27.0" + }, + "engines": { + "node": "^22.18.0 || ^24.11.0 || >=26.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + }, + "peerDependencies": { + "@volar/typescript": "~2.4.0", + "@vue/language-core": "~3.2.0 || ~3.3.0", + "rolldown": "^1.2.0", + "tsrs": "*", + "typescript": "^5.0.0 || ^6.0.0 || ~7.0.0 || ~7.1.0-0", + "vue-tsc": "~3.2.0 || ~3.3.0" + }, + "peerDependenciesMeta": { + "@volar/typescript": { + "optional": true + }, + "@vue/language-core": { + "optional": true + }, + "tsrs": { + "optional": true + }, + "typescript": { + "optional": true + }, + "vue-tsc": { + "optional": true + } + } + }, "node_modules/rollup": { "version": "4.66.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.66.0.tgz", @@ -19268,6 +19903,13 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/tinyps": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/tinyps/-/tinyps-0.5.1.tgz", + "integrity": "sha512-B6Ykif5HflC3AdDkS4Zst/2muYVfeXoVMy+KorqH80s/1x4vunIORpNySH681X7fjj+dFM9MDKD6/Hsccjb87Q==", + "dev": true, + "license": "MIT" + }, "node_modules/tmp": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz", @@ -19402,6 +20044,91 @@ "node": ">=14.16" } }, + "node_modules/tsdown": { + "version": "0.23.7", + "resolved": "https://registry.npmjs.org/tsdown/-/tsdown-0.23.7.tgz", + "integrity": "sha512-w9nmWyEimfqQ7/HpVeKTldAeBvWGXiaWyNP7xaxSrr0GhKxsngEyTWqk1nOruRqvqRSkdpMMkpV2BcoWfLB4Uw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^7.1.0", + "defu": "^6.1.7", + "empathic": "^2.1.0", + "hookable": "^6.1.2", + "import-without-cache": "^0.4.1", + "obug": "^3.0.0", + "picomatch": "^4.0.7", + "rolldown": "~1.3.0", + "rolldown-plugin-dts": "^0.30.0", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "tinyps": "^0.5.1", + "unconfig-core": "^7.5.0", + "verkit": "^0.5.0" + }, + "bin": { + "tsdown": "dist/run.mjs" + }, + "engines": { + "node": "^22.18.0 || ^24.11.0 || >=26.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + }, + "peerDependencies": { + "@arethetypeswrong/core": "^0.18.1", + "@tsdown/css": "0.23.7", + "@tsdown/exe": "0.23.7", + "@vitejs/devtools": "*", + "publint": "^0.3.8", + "tsx": "*", + "typescript": "^5.0.0 || ^6.0.0 || ^7.0.0", + "unplugin-unused": ">=0.5.0", + "unrun": "*" + }, + "peerDependenciesMeta": { + "@arethetypeswrong/core": { + "optional": true + }, + "@tsdown/css": { + "optional": true + }, + "@tsdown/exe": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "publint": { + "optional": true + }, + "tsx": { + "optional": true + }, + "typescript": { + "optional": true + }, + "unplugin-unused": { + "optional": true + }, + "unrun": { + "optional": true + } + } + }, + "node_modules/tsdown/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tslib": { "version": "2.8.1", "license": "0BSD" @@ -19816,6 +20543,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/unconfig-core": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/unconfig-core/-/unconfig-core-7.5.0.tgz", + "integrity": "sha512-Su3FauozOGP44ZmKdHy2oE6LPjk51M/TRRjHv2HNCWiDvfvCoxC2lno6jevMA91MYAdCdwP05QnWdWpSbncX/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@quansync/fs": "^1.0.0", + "quansync": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/undefsafe": { "version": "2.0.5", "dev": true, @@ -20164,6 +20905,19 @@ "node": ">= 0.8" } }, + "node_modules/verkit": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/verkit/-/verkit-0.5.0.tgz", + "integrity": "sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + } + }, "node_modules/vfile": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", @@ -20766,6 +21520,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/yuku": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/yuku/-/yuku-0.27.0.tgz", + "integrity": "sha512-YmSD4xYlESRi8egxzC4guegQdMhAcz1G9NUsMNrTABAIV9dQxoBzDC7ZyAG/dSG18o1Oxt4xDok2irvPy9FSJQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.4.0" + }, + "optionalDependencies": { + "@yuku-toolchain/darwin-arm64": "0.27.0", + "@yuku-toolchain/darwin-x64": "0.27.0", + "@yuku-toolchain/linux-arm64": "0.27.0", + "@yuku-toolchain/linux-x64": "0.27.0", + "@yuku-toolchain/win32-arm64": "0.27.0", + "@yuku-toolchain/win32-x64": "0.27.0" + }, + "peerDependencies": { + "@yuku-toolchain/wasm": "0.27.0" + }, + "peerDependenciesMeta": { + "@yuku-toolchain/wasm": { + "optional": true + } + } + }, "node_modules/zod": { "version": "4.6.7", "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", @@ -21590,7 +22370,7 @@ "@msinternal/botframework-webchat-tsconfig": "0.0.0-0", "@types/jest": "^29.5.14", "@types/react": "^16.14.70", - "tsup": "^9.0.0", + "tsdown": "^0.23.7", "typescript": "^6.0.3" }, "peerDependencies": { @@ -21611,7 +22391,7 @@ "@msinternal/botframework-webchat-react-valibot": "0.0.0-0", "@msinternal/botframework-webchat-tsconfig": "0.0.0-0", "@types/react": "^16.14.70", - "tsup": "^9.0.0", + "tsdown": "^0.23.7", "typescript": "^6.0.3" }, "peerDependencies": { @@ -21984,7 +22764,7 @@ "@types/node": "^25.9.1", "cross-env": "^10.1.0", "esbuild": "^0.28.1", - "tsup": "^9.0.0", + "tsdown": "^0.23.7", "type-fest": "^5.6.0", "typescript": "^6.0.3" }, @@ -22570,7 +23350,7 @@ "selfsigned": "5.5.0" }, "devDependencies": { - "tsup": "^9.0.0", + "tsdown": "^0.23.7", "typescript": "^6.0.3" } }, diff --git a/package.json b/package.json index beb94f81a3..2281e916c3 100644 --- a/package.json +++ b/package.json @@ -285,6 +285,7 @@ "read-pkg": "^10.1.0", "selenium-webdriver": "^4.44.0", "strip-ansi": "^6.0.1", + "tsdown": "^0.23.7", "tsup": "^9.0.0", "typescript": "^6.0.3", "unplugin-lightningcss": "^0.4.5" diff --git a/packages/api-graph/tsup.config.ts b/packages/api-graph/tsup.config.ts deleted file mode 100644 index 4353e7f9a0..0000000000 --- a/packages/api-graph/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-api-graph': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/api-middleware/tsup.config.ts b/packages/api-middleware/tsup.config.ts deleted file mode 100644 index fbfa7926c2..0000000000 --- a/packages/api-middleware/tsup.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-api-middleware': './src/index.ts', - 'botframework-webchat-api-middleware.legacy': './src/legacy.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/base/tsup.config.ts b/packages/base/tsup.config.ts deleted file mode 100644 index e0c7723ac4..0000000000 --- a/packages/base/tsup.config.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-base': './src/index.ts', - 'botframework-webchat-base.utils': './src/utils/index.ts', - 'botframework-webchat-base.valibot': './src/valibot/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/component-better-link/tsup.config.ts b/packages/component-better-link/tsup.config.ts deleted file mode 100644 index 82ff4fb6a3..0000000000 --- a/packages/component-better-link/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-component-better-link': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/core-debug-api/tsup.config.ts b/packages/core-debug-api/tsup.config.ts deleted file mode 100644 index 2304bb323b..0000000000 --- a/packages/core-debug-api/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-core-debug-api': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/core-graph/tsup.config.ts b/packages/core-graph/tsup.config.ts deleted file mode 100644 index 8190914e75..0000000000 --- a/packages/core-graph/tsup.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-core-graph': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - noExternal: ['uuid'], - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/core-json-ld/tsup.config.ts b/packages/core-json-ld/tsup.config.ts deleted file mode 100644 index 30a6091afe..0000000000 --- a/packages/core-json-ld/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-core-json-ld': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.ts deleted file mode 100644 index 3a9fd2cc7f..0000000000 --- a/packages/core/tsup.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-core': './src/index.ts', - 'botframework-webchat-core.activity': './src/boot/activity.ts', - 'botframework-webchat-core.graph': './src/boot/graph.ts', - 'botframework-webchat-core.internal': './src/boot/internal.ts', - 'botframework-webchat-core.json-ld': './src/boot/json-ld.ts', - 'botframework-webchat-core.org-schema': './src/boot/org-schema.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - define: { - ...commonConfig.define, - 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"' - }, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - define: { - ...commonConfig.define, - 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"commonjs"' - }, - format: 'cjs', - noExternal: ['uuid'], - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/directlinespeech/tsup.config.ts b/packages/directlinespeech/tsup.config.ts deleted file mode 100644 index 5c7987de02..0000000000 --- a/packages/directlinespeech/tsup.config.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const config = applyConfig(config => ({ - ...config, - // The entry point is JavaScript, its types are written by hand. - dts: { - entry: { - 'botframework-directlinespeech-sdk': './src/index.d.ts' - } - }, - entry: { - 'botframework-directlinespeech-sdk': './src/index.js' - }, - env: { - ...config.env, - build_tool: 'tsup' - }, - // We need to internalize event-target-shim because it appear as transient packages with a different version. - noExternal: [...(config.noExternal ?? []), 'event-target-shim'] -})); - -// Browser scripts exposing `window.DirectLineSpeech`, with every dependency bundled. -const iifeConfig = { - ...config, - dts: false, - format: 'iife', - outExtension() { - return { js: '.js' }; - }, - target: [...config.target, 'es2019'] -} satisfies typeof config; - -export default defineConfig([ - { - ...config, - env: { - ...config.env, - module_format: 'esmodules' - }, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...config, - env: { - ...config.env, - module_format: 'commonjs' - }, - format: 'cjs', - target: [...config.target, 'es2019'] - }, - { - ...iifeConfig, - entry: { - 'directlinespeech.development': './src/bundle.js' - }, - env: { - ...iifeConfig.env, - module_format: 'global', - node_env: 'development', - NODE_ENV: 'development' - }, - // Both browser scripts would write the same metafile-iife.json, keep the production one. - metafile: false, - minify: false - }, - { - ...iifeConfig, - entry: { - 'directlinespeech.production.min': './src/bundle.js' - }, - env: { - ...iifeConfig.env, - module_format: 'global', - node_env: 'production', - NODE_ENV: 'production' - }, - minify: true - } -]); diff --git a/packages/react-hooks/tsup.config.ts b/packages/react-hooks/tsup.config.ts deleted file mode 100644 index f7b5e83bce..0000000000 --- a/packages/react-hooks/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-react-hooks': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/react-valibot/tsup.config.ts b/packages/react-valibot/tsup.config.ts deleted file mode 100644 index 9526b6e770..0000000000 --- a/packages/react-valibot/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-react-valibot': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/redux-store/tsup.config.ts b/packages/redux-store/tsup.config.ts deleted file mode 100644 index 6901da8420..0000000000 --- a/packages/redux-store/tsup.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-redux-store': './src/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/styles/src/build/index.ts b/packages/styles/src/build/index.ts index 02cb4c85ce..bf1e045f14 100644 --- a/packages/styles/src/build/index.ts +++ b/packages/styles/src/build/index.ts @@ -1 +1,2 @@ export { default as injectCSSPlugin, type InjectCSSPluginOptions } from './private/injectCSSPlugin'; +export { default as injectCSSRolldownPlugin } from './private/injectCSSRolldownPlugin'; diff --git a/packages/styles/src/build/private/injectCSSPlugin.ts b/packages/styles/src/build/private/injectCSSPlugin.ts index 57ce736de8..43accdca39 100644 --- a/packages/styles/src/build/private/injectCSSPlugin.ts +++ b/packages/styles/src/build/private/injectCSSPlugin.ts @@ -232,3 +232,5 @@ export default function injectCSSPlugin({ ignoreCSSEntries, stylesPlaceholder }: } }; } + +export { mapOutputsToRootOutputs, updateMappings, type Metafile }; diff --git a/packages/styles/src/build/private/injectCSSRolldownPlugin.ts b/packages/styles/src/build/private/injectCSSRolldownPlugin.ts new file mode 100644 index 0000000000..4c449b6c54 --- /dev/null +++ b/packages/styles/src/build/private/injectCSSRolldownPlugin.ts @@ -0,0 +1,130 @@ +import path from 'node:path'; +import type { Rolldown } from 'tsdown'; + +import { mapOutputsToRootOutputs, updateMappings, type InjectCSSPluginOptions, type Metafile } from './injectCSSPlugin'; + +// Rolldown flavor of injectCSSPlugin (esbuild), with the same options and logic. rolldown has no metafile: the same graph +// is built from `chunk.imports`. It expects `.css` in the bundle, emitted by cssPlugin (/rolldownPlugins.mjs). +export default function injectCSSRolldownPlugin({ + ignoreCSSEntries, + stylesPlaceholder +}: InjectCSSPluginOptions): Rolldown.Plugin { + if (!stylesPlaceholder) { + throw new Error('inject-css-plugin: no placeholder for styles provided'); + } + + // Unlike esbuild, the rolldown (oxc) minifier prints strings as template literals: `@--STYLES--@`. + const stylesPlaceholderQuotes = Object.freeze(['"', "'", '`'].map(quote => `${quote}${stylesPlaceholder}${quote}`)); + const ignoreCSSEntriesSet = new Set(ignoreCSSEntries); + + return { + name: `inject-css-plugin(${stylesPlaceholder})`, + generateBundle: { + // After cssPlugin emitted the CSS files. + order: 'post', + handler({ dir = 'dist' }, bundle) { + // Same keys as esbuild's metafile (e.g. "dist/botframework-webchat-component.css"), for the same ignoreCSSEntries. + const toKey = (fileName: string) => + path.posix.join(path.relative(process.cwd(), dir).replaceAll('\\', '/'), fileName); + const chunks = Object.values(bundle).filter((file): file is Rolldown.OutputChunk => file.type === 'chunk'); + + const metafile: Metafile = { + outputs: Object.fromEntries( + chunks.map(chunk => [ + toKey(chunk.fileName), + { + ...(chunk.isEntry && chunk.facadeModuleId ? { entryPoint: chunk.facadeModuleId } : {}), + imports: chunk.imports.map(fileName => ({ path: toKey(fileName) })) + } + ]) + ) + }; + + const { outputToRoots } = mapOutputsToRootOutputs(metafile); + + for (const chunk of chunks) { + const jsText = chunk.code; + const stylesPlaceholderQuoted = stylesPlaceholderQuotes.find(quoted => jsText.includes(quoted)); + + if (!stylesPlaceholderQuoted) { + continue; + } + + const outKey = toKey(chunk.fileName); + const cssFilesMap = new Map( + (outputToRoots.get(outKey) || []).flatMap(owner => { + const cssKey = owner.replace(/\.[cm]?js$/u, '.css'); + const cssFile = bundle[path.posix.relative(toKey(''), cssKey)]; + + return cssFile?.type === 'asset' ? [[cssKey, cssFile] as const] : []; + }) + ); + + const cssCandidateKeys = new Set(cssFilesMap.keys()).difference(ignoreCSSEntriesSet); + + if (cssCandidateKeys.size !== 1) { + throw new Error( + `inject-css-plugin: unable to uniquely determine CSS for ${outKey}. Found CSS entries: \n[\n${[ + ...cssCandidateKeys + ] + .map(entry => ` '${entry}'`) + .join(',\n')}\n]\n Add the appropriate CSS file to ignoreCSSEntries to fix this issue.` + ); + } + + const cssSource = cssFilesMap.get(Array.from(cssCandidateKeys).at(0)!)?.source; + // Like esbuild's in-memory CSS output, without the source map comment. + const cssText = (typeof cssSource === 'string' ? cssSource : new TextDecoder().decode(cssSource)).replace( + /\/\*# sourceMappingURL=\S+ \*\/\n?$/u, + '' + ); + + if (!cssText) { + throw new Error( + `inject-css-plugin: unable to find CSS text for ${outKey}.${ignoreCSSEntries ? '\n The following entries were ignored:\n' + ignoreCSSEntries.map(entry => ` '${entry}'`).join('\n') : ''}` + ); + } + + const index = jsText.indexOf(stylesPlaceholderQuoted); + const cssTextQuoted = JSON.stringify(cssText); + const updatedJsText = [ + jsText.slice(0, index), + cssTextQuoted, + jsText.slice(index + stylesPlaceholderQuoted.length) + ].join(''); + + if (updatedJsText.includes(stylesPlaceholder)) { + throw new Error( + `Duplicate placeholders are not supported.\nFound ${stylesPlaceholder} in ${chunk.fileName}.` + ); + } + + chunk.code = updatedJsText; + + const textBefore = jsText.slice(0, index); + const shift = (mappings: string) => + updateMappings( + mappings, + textBefore.split('\n').length - 1, + index - textBefore.lastIndexOf('\n') - 1, + cssTextQuoted.length - stylesPlaceholderQuoted.length + ); + + // The map is in the bundle as an asset (".map") when written to a file, and on the chunk. + const mapFile = bundle[chunk.sourcemapFileName ?? `${chunk.fileName}.map`]; + + if (mapFile?.type === 'asset' && typeof mapFile.source === 'string') { + const parsed = JSON.parse(mapFile.source); + + parsed.mappings = shift(parsed.mappings); + mapFile.source = JSON.stringify(parsed); + } + + if (chunk.map) { + chunk.map.mappings = shift(chunk.map.mappings); + } + } + } + } + }; +} diff --git a/packages/styles/tsup.config.ts b/packages/styles/tsup.config.ts deleted file mode 100644 index f6f428b43f..0000000000 --- a/packages/styles/tsup.config.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { defineConfig } from 'tsup'; - -import { applyConfig } from '../../tsup.base.config'; - -const commonConfig = applyConfig(config => ({ - ...config, - entry: { - 'botframework-webchat-styles': './src/index.ts', - 'botframework-webchat-styles.build': './src/build/index.ts', - 'botframework-webchat-styles.react': './src/react/index.ts' - } -})); - -export default defineConfig([ - { - ...commonConfig, - format: 'esm', - onSuccess: 'touch ./package.json' - }, - { - ...commonConfig, - format: 'cjs', - target: [...commonConfig.target, 'es2019'] - } -]); diff --git a/packages/test/web-server/tsup.config.ts b/packages/test/web-server/tsup.config.ts deleted file mode 100644 index 09c940d93c..0000000000 --- a/packages/test/web-server/tsup.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'tsup'; - -export default defineConfig({ - entry: { - createStaticHandler: './src/createStaticHandler.ts', - index: './src/index.ts' - }, - format: 'cjs', - platform: 'node', - // The test container runs dist/index.js without node_modules. - noExternal: ['compression', 'express', 'selfsigned'], - onSuccess: 'touch ./package.json' -}); diff --git a/rolldownPlugins.mjs b/rolldownPlugins.mjs new file mode 100644 index 0000000000..50bfda7f70 --- /dev/null +++ b/rolldownPlugins.mjs @@ -0,0 +1,212 @@ +// Rolldown flavor of esbuildPlugins.mjs and esbuildBabelPluginIstanbul.ts, for tsdown.base.config.mts. +import { transformAsync } from '@babel/core'; +import { decode, encode } from '@jridgewell/sourcemap-codec'; +import { Features, transform } from 'lightningcss'; +import { Buffer } from 'node:buffer'; +import { join, relative } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import lightningCssPlugin from 'unplugin-lightningcss/rolldown'; + +import { lightningCSSPluginOptions, removePreserveReason } from './lightningCSSOptions.mjs'; + +const BUILT_CSS_PATTERN = /\.module_built\.css$/u; +const CSS_MODULE_ID_PATTERN = /(?:\.module\.css\?css_module|\.module_built\.css)$/u; +const TARGET_PATTERN = /^(chrome|edge|firefox|ios|opera|safari)(\d+)(?:\.(\d+))?$/u; + +// esbuild keeps :dir()/:lang() and logical properties for our targets, Lightning CSS would rewrite them +// (e.g. :dir(rtl) becomes a list of :lang(), which breaks RTL set with the dir attribute). +const EXCLUDED_FEATURES = Features.DirSelector | Features.LangSelectorList | Features.LogicalProperties; + +/** + * Lightning CSS targets from esbuild/rolldown targets, e.g. ["chrome100", "safari15", "es2019"] (others are ignored). + * Lightning CSS versions are `(major << 16) | (minor << 8)`. + * + * @param {readonly string[]} target + * @returns {import('lightningcss').Targets} + */ +function toLightningCSSTargets(target) { + return Object.fromEntries( + target.flatMap(value => { + const match = TARGET_PATTERN.exec(value); + + return match ? [[match[1] === 'ios' ? 'ios_saf' : match[1], (+match[2] << 16) | (+(match[3] || 0) << 8)]] : []; + }) + ); +} + +/** + * The CSS modules of an entry in esbuild's order: depth-first in import order, a module after the modules it imports. + * + * @param {import('rolldown').PluginContext} context + * @param {string} entryId + * @returns {string[]} + */ +function getEntryModuleIds(context, entryId) { + const result = []; + const visited = new Set(); + + const visit = id => { + if (!visited.has(id)) { + visited.add(id); + context.getModuleInfo(id)?.importedIds.forEach(visit); + result.push(id); + } + }; + + visit(entryId); + + return result; +} + +/** + * Concatenates the compiled CSS modules of an entry into one CSS file and one source map, like esbuild. + * + * @param {readonly { code: string; map: import('rolldown').SourceMapInput }[]} modules + * @param {(source: string) => string} toSourcePath + */ +function concatCSS(modules, toSourcePath) { + const mappings = []; + const sources = []; + const sourcesContent = []; + + for (const { code, map } of modules) { + const sourceOffset = sources.length; + + sources.push(...map.sources.map(toSourcePath)); + sourcesContent.push(...(map.sourcesContent ?? map.sources.map(() => null))); + + // Every module starts on a new line: a module of N lines takes N lines of mappings. + const lines = decode(map.mappings); + const numLines = code.split('\n').length - 1; + + for (let index = 0; index < numLines; index++) { + mappings.push( + (lines[+index] || []).map(([column, source, originalLine, originalColumn]) => + typeof source === 'number' ? [column, source + sourceOffset, originalLine, originalColumn] : [column] + ) + ); + } + } + + return { + code: modules.map(({ code }) => code).join(''), + map: { mappings: encode(mappings), names: [], sources, sourcesContent, version: 3 } + }; +} + +/** + * Compiles CSS modules (`*.module.css`) with Lightning CSS and emits `.css` (and `.css.map`) for every entry with + * CSS. esbuild bundles CSS itself; rolldown does not. + * + * The CSS of each module is lowered for `target` with Lightning CSS, as esbuild lowers the bundled CSS (e.g. CSS nesting for + * safari15). Lightning CSS also adds the `-webkit-` prefixes that the targets need, a few more than esbuild does. + * + * The plugin instance keeps the compiled CSS of the build: use one instance per build (format). + * + * @param {{ minify: boolean; target: readonly string[] }} options + * @returns {import('rolldown').Plugin[]} + */ +function cssPlugin({ minify, target }) { + /** @type {Map} */ + const cssById = new Map(); + const targets = toLightningCSSTargets(target); + + return [ + // Resolves `*.module.css` to `*.module.css?css_module` (class map, JavaScript) which imports `*.module_built.css` (CSS). + lightningCssPlugin(lightningCSSPluginOptions), + { + name: 'webchat:css-modules', + transform: { + filter: { id: CSS_MODULE_ID_PATTERN }, + handler(code, id) { + // unplugin-lightningcss reads `*.module.css` itself: without this, `tsdown --watch` misses changes to it. + this.addWatchFile(id.replace(CSS_MODULE_ID_PATTERN, '.module.css')); + + if (!BUILT_CSS_PATTERN.test(id)) { + return; + } + + const result = transform({ + code: Buffer.from(removePreserveReason(code, id)), + exclude: EXCLUDED_FEATURES, + filename: id, + minify, + sourceMap: true, + targets + }); + + const css = result.code.toString(); + + cssById.set(id, { + code: css.endsWith('\n') ? css : `${css}\n`, + // Lightning CSS writes the file name relative to its project root ("/"), keep the absolute one. + map: { ...JSON.parse(result.map?.toString() ?? '{"mappings":"","version":3}'), sources: [id] } + }); + + // The CSS module becomes an empty JavaScript module (as with @tsdown/css), its CSS is in cssById. + return { code: '', map: null, moduleSideEffects: 'no-treeshake', moduleType: 'js' }; + } + }, + generateBundle({ dir = 'dist', sourcemap }, bundle) { + for (const chunk of Object.values(bundle)) { + if (chunk.type === 'chunk' && chunk.isEntry && chunk.facadeModuleId) { + const modules = getEntryModuleIds(this, chunk.facadeModuleId).flatMap(id => cssById.get(id) ?? []); + + if (modules.length) { + const fileName = chunk.fileName.replace(/\.[cm]?js$/u, '.css'); + const { code, map } = concatCSS(modules, source => relative(dir, source).replaceAll('\\', '/')); + + this.emitFile({ + fileName, + source: sourcemap ? `${code}/*# sourceMappingURL=${fileName}.map */\n` : code, + type: 'asset' + }); + + sourcemap && this.emitFile({ fileName: `${fileName}.map`, source: JSON.stringify(map), type: 'asset' }); + } + } + } + } + } + ]; +} + +/** + * Adds istanbul coverage counters to our sources (`NODE_ENV=test`), like esbuildBabelPluginIstanbul.ts. + * + * @returns {import('rolldown').Plugin} + */ +function istanbulPlugin() { + return { + name: 'webchat:babel-plugin-istanbul', + transform: { + filter: { + id: { + // Virtual modules (`\0…`) are skipped: an instrumented rolldown runtime ends up in the `.d.mts` chunks. + exclude: [/^\0/u, /\/node_modules\//u, /\.worker\.[cm]?[jt]s$/u, /\.d\.[cm]?ts$/u], + include: /\.[cm]?[jt]sx?$/u + } + }, + // Before rolldown removes types and JSX, like esbuild onLoad. + order: 'pre', + async handler(code, id) { + const result = await transformAsync(code, { + configFile: join(fileURLToPath(import.meta.url), '../esbuildBabelPluginIstanbul.babel.config.json'), + filename: id, + rootMode: 'root', + sourceFileName: id, + sourceMaps: true + }); + + if (!result?.code) { + throw new Error(`Failed to add instrumentation code to ${id}.`); + } + + // Babel already removed types and JSX (preset-typescript, preset-react). + return { code: result.code, map: result.map, moduleType: 'js' }; + } + } + }; +} + +export { cssPlugin, istanbulPlugin }; diff --git a/tsdown.base.config.mts b/tsdown.base.config.mts new file mode 100644 index 0000000000..2cf06feedb --- /dev/null +++ b/tsdown.base.config.mts @@ -0,0 +1,124 @@ +import { type UserConfig } from 'tsdown'; + +import { cssPlugin, istanbulPlugin } from './rolldownPlugins.mjs'; + +const env = process.env.NODE_ENV || 'development'; +const { npm_package_version } = process.env; +const minify = env === 'production' || env === 'test'; +const TARGET = Object.freeze(['chrome100', 'firefox100', 'safari15']); + +// When minified, esbuild drops annotations (`/* @__PURE__ */`) and JSDoc comments, rolldown keeps them by default. +const MINIFIED_COMMENTS = Object.freeze({ annotation: false, jsdoc: false, legal: true }); + +type Config = UserConfig & { + define: Record; + plugins: NonNullable[]; + target: string[]; +}; + +// Port of tsup.base.config.ts. +function applyConfig(overrideOptions: (options: Omit) => Config): Config { + return overrideOptions({ + // CSS modules are compiled by our cssPlugin (rolldownPlugins.mjs), not by @tsdown/css. + css: false, + define: { + // TSD does not support define, thus we need to use `globalThis.*` instead. + 'globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL': '"tsdown"', + 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"unknown"', + 'globalThis.WEB_CHAT_BUILD_INFO_VERSION': JSON.stringify(npm_package_version || '0.0.0-unknown'), + // Removes AMD glue code (anonymous `define()` conflicts with RequireJS), see /__tests__/html2/hosting/requirejs.html. + define: 'undefined' + }, + deps: { + // Like tsup (rollup-plugin-dts), `.d.ts` import the types of every package instead of inlining them, even with + // `deps.alwaysBundle` (tsup `noExternal`). Packages that need them inlined run dtsroll after the build. + dts: { alwaysBundle: [], neverBundle: true }, + // devDependencies are bundled on purpose, like tsup. + onlyBundle: false + }, + // tsup does not emit declaration maps. + dts: { sourcemap: false }, + env: { + node_env: env, + NODE_ENV: env, + ...(npm_package_version ? { npm_package_version } : {}) + }, + format: 'esm', + ignoreWatch: ['./dist/'], + inputOptions: (options, format) => ({ + ...options, + // unplugin-lightningcss exports dashed class names as `export { _x as "a-b" }`: rolldown warns for each of them. + // rolldown also warns when JavaScript plugins (Lightning CSS, istanbul) take most of the build time. + checks: { ...options.checks, pluginTimings: false, toleratedTransform: false }, + // tsdown builds CommonJS for Node.js, ours is for browsers too (uses the "browser" conditions of dependencies). + ...(format === 'cjs' ? { platform: 'browser' } : {}) + }), + loader: { '.js': 'jsx' }, + minify, + outputOptions: options => ({ + ...options, + ...(options.minify ? { comments: MINIFIED_COMMENTS } : {}), + // Like esbuild: `__esModule` in every CommonJS entry (rolldown adds it only with a default export). + esModule: true, + exports: 'named', + // Like esbuild: CommonJS and IIFE output start with "use strict". + strict: true + }), + platform: 'browser', + plugins: [...(env === 'test' ? [istanbulPlugin()] : []), cssPlugin({ minify, target: TARGET })], + report: false, + sourcemap: true, + target: [...TARGET], + // Our tsconfig.json are in src/, tsdown looks for one in the package folder. + tsconfig: './src/tsconfig.json' + }); +} + +/** ESM and CommonJS builds of a package, CommonJS also targets ES2019. */ +function createDualFormatConfigs( + entry: Record, + overrides: Partial Partial>> = {} +): Config[] { + return (['esm', 'cjs'] as const).map(format => + applyConfig(config => { + const formatConfig: Config = { + ...config, + entry, + format, + ...(format === 'esm' ? { onSuccess: 'touch ./package.json' } : { target: [...config.target, 'es2019'] }) + }; + + return { ...formatConfig, ...overrides[format]?.(formatConfig) }; + }) + ); +} + +/** + * Options of an IIFE build, like tsup `format: 'iife'`. rolldown cannot split an IIFE: one entry per config. + */ +function iifeOptions(config: Config): Partial { + return { + // tsup bundles every dependency into an IIFE. + deps: { ...config.deps, alwaysBundle: () => true }, + dts: false, + format: 'iife', + outputOptions: options => ({ + ...options, + // No bundler reads an IIFE: drop annotations, keep JSDoc unless minified. + comments: options.minify ? MINIFIED_COMMENTS : { annotation: false, jsdoc: true, legal: true }, + // tsdown names it `.iife.js`. + entryFileNames: '[name].js', + // `exports` does not exist in a classic script. + esModule: false, + strict: true + }), + target: [...config.target, 'es2019'] + }; +} + +/** tsup `noExternal: ['x']` also bundles "x/y", tsdown `deps.alwaysBundle: ['x']` does not. */ +function packagePattern(name: string): RegExp { + return new RegExp(`^${name.replace(/[.*+?^${}()|[\]\\/]/gu, '\\$&')}(?:/|$)`, 'u'); +} + +export { applyConfig, createDualFormatConfigs, iifeOptions, packagePattern, type Config }; From fb681a965e463047d5e1154e0e9d919c19bfce2e Mon Sep 17 00:00:00 2001 From: Eugene Olonov Date: Fri, 13 Nov 2026 02:43:27 -0800 Subject: [PATCH 02/37] Build the plain packages and the test web server with tsdown api-graph, api-middleware, base, component-better-link, core, core-debug-api, core-graph, core-json-ld, directlinespeech, react-hooks, react-valibot, redux-store, styles and test/web-server. --- docs/BUILD_SCRIPTS.md | 2 +- packages/api-graph/.gitignore | 1 - packages/api-graph/package.json | 2 +- packages/api-graph/tsdown.config.mts | 5 ++ packages/api-middleware/.gitignore | 1 - packages/api-middleware/package.json | 2 +- packages/api-middleware/tsdown.config.mts | 10 ++++ packages/base/.gitignore | 1 - packages/base/package.json | 2 +- packages/base/tsdown.config.mts | 11 +++++ packages/component-better-link/.gitignore | 1 - packages/component-better-link/package.json | 2 +- .../component-better-link/tsdown.config.mts | 7 +++ packages/core-debug-api/.gitignore | 1 - packages/core-debug-api/package.json | 2 +- packages/core-debug-api/tsdown.config.mts | 5 ++ packages/core-graph/.gitignore | 1 - packages/core-graph/package.json | 2 +- packages/core-graph/tsdown.config.mts | 10 ++++ packages/core-json-ld/.gitignore | 1 - packages/core-json-ld/package.json | 2 +- packages/core-json-ld/tsdown.config.mts | 5 ++ packages/core/.gitignore | 1 - packages/core/package.json | 2 +- .../core/src/__tests__/addMetaTag.spec.js | 2 +- .../core/src/__tests__/addMetaTag.spec.mjs | 2 +- packages/core/tsdown.config.mts | 23 +++++++++ packages/directlinespeech/.gitignore | 1 - packages/directlinespeech/package.json | 2 +- .../src/__tests__/addMetaTag.iife.spec.js | 2 +- .../src/__tests__/addMetaTag.spec.js | 2 +- .../src/__tests__/addMetaTag.spec.mjs | 2 +- packages/directlinespeech/tsdown.config.mts | 48 +++++++++++++++++++ packages/react-hooks/.gitignore | 1 - packages/react-hooks/package.json | 2 +- packages/react-hooks/tsdown.config.mts | 5 ++ packages/react-valibot/.gitignore | 1 - packages/react-valibot/package.json | 4 +- packages/react-valibot/tsdown.config.mts | 5 ++ packages/redux-store/.gitignore | 1 - packages/redux-store/package.json | 4 +- packages/redux-store/tsdown.config.mts | 5 ++ packages/styles/.gitignore | 1 - packages/styles/package.json | 4 +- packages/styles/tsdown.config.mts | 17 +++++++ packages/test/web-server/package.json | 4 +- packages/test/web-server/tsdown.config.mts | 20 ++++++++ 47 files changed, 200 insertions(+), 37 deletions(-) create mode 100644 packages/api-graph/tsdown.config.mts create mode 100644 packages/api-middleware/tsdown.config.mts create mode 100644 packages/base/tsdown.config.mts create mode 100644 packages/component-better-link/tsdown.config.mts create mode 100644 packages/core-debug-api/tsdown.config.mts create mode 100644 packages/core-graph/tsdown.config.mts create mode 100644 packages/core-json-ld/tsdown.config.mts create mode 100644 packages/core/tsdown.config.mts create mode 100644 packages/directlinespeech/tsdown.config.mts create mode 100644 packages/react-hooks/tsdown.config.mts create mode 100644 packages/react-valibot/tsdown.config.mts create mode 100644 packages/redux-store/tsdown.config.mts create mode 100644 packages/styles/tsdown.config.mts create mode 100644 packages/test/web-server/tsdown.config.mts diff --git a/docs/BUILD_SCRIPTS.md b/docs/BUILD_SCRIPTS.md index 7477b4e824..8b5b865517 100644 --- a/docs/BUILD_SCRIPTS.md +++ b/docs/BUILD_SCRIPTS.md @@ -100,7 +100,7 @@ This section lists verification steps to validate the implementation against the - No instrumentation code (smaller than test builds) - Direct Line Speech SDK - This is tested separately as Direct Line Speech SDK is designed not to live in our monorepo structure - - One `tsup` build produces every output in `dist/` + - One `tsdown` build produces every output in `dist/` - `import` loads `botframework-directlinespeech-sdk.mjs`, `require()` loads `botframework-directlinespeech-sdk.js`, with types in `.d.mts` and `.d.ts` - `