diff --git a/.changeset/v1-tsdown-migration.md b/.changeset/v1-tsdown-migration.md new file mode 100644 index 00000000000..ec524c42429 --- /dev/null +++ b/.changeset/v1-tsdown-migration.md @@ -0,0 +1,7 @@ +--- +"@cloudflare/vite-plugin": patch +--- + +Update the plugin build and bundle shared declaration dependencies + +Use tsdown 0.22.14 for the plugin and retained remote bindings package, and keep shared SDK types bundled in the published plugin declarations. Validate the declarations from a consumer project without workspace development dependencies. diff --git a/.github/workflows/test-and-check.yml b/.github/workflows/test-and-check.yml index e2e5fbdec02..c658c7eda61 100644 --- a/.github/workflows/test-and-check.yml +++ b/.github/workflows/test-and-check.yml @@ -36,6 +36,9 @@ jobs: - run: pnpm check env: NODE_OPTIONS: --max_old_space_size=8192 + # The repository check above builds the plugin before this check runs. + - name: Check Vite plugin build output + run: node -r esbuild-register tools/test/check-built-entry-points.ts vite-plugin-cloudflare test: name: Tests (${{ matrix.description }}, ${{ matrix.suite }}) runs-on: ${{ matrix.os }} diff --git a/packages/remote-bindings/package.json b/packages/remote-bindings/package.json index bac5dbed708..244a72a01a7 100644 --- a/packages/remote-bindings/package.json +++ b/packages/remote-bindings/package.json @@ -46,7 +46,7 @@ "@types/ws": "^8.5.13", "capnweb": "catalog:default", "esbuild": "catalog:default", - "tsdown": "0.16.3", + "tsdown": "catalog:default", "typescript": "catalog:default", "vitest": "catalog:default" } diff --git a/packages/remote-bindings/tsdown.config.ts b/packages/remote-bindings/tsdown.config.ts index d11d1f8cd25..9dfb68a967e 100644 --- a/packages/remote-bindings/tsdown.config.ts +++ b/packages/remote-bindings/tsdown.config.ts @@ -10,13 +10,15 @@ export default defineConfig({ outDir: "dist", dts: true, tsconfig: "tsconfig.json", - external: (id) => { - const unprefixedId = id.charCodeAt(0) === 0 ? id.slice(1) : id; - return ( - !unprefixedId.startsWith("worker:") && - !unprefixedId.startsWith(".") && - !path.isAbsolute(unprefixedId) - ); + deps: { + neverBundle: (id) => { + const unprefixedId = id.charCodeAt(0) === 0 ? id.slice(1) : id; + return ( + !unprefixedId.startsWith("worker:") && + !unprefixedId.startsWith(".") && + !path.isAbsolute(unprefixedId) + ); + }, }, plugins: [embedWorkersPlugin()], }); diff --git a/packages/vite-plugin-cloudflare/package.json b/packages/vite-plugin-cloudflare/package.json index ccd40790e04..fac7d79b00e 100644 --- a/packages/vite-plugin-cloudflare/package.json +++ b/packages/vite-plugin-cloudflare/package.json @@ -74,7 +74,7 @@ "semver": "7.8.5", "tinyglobby": "0.2.16", "tree-kill": "1.2.2", - "tsdown": "0.16.3", + "tsdown": "catalog:default", "typescript": "5.8.3", "vite": "catalog:default", "vite-legacy": "npm:vite@7.1.12", diff --git a/packages/vite-plugin-cloudflare/tsdown.config.ts b/packages/vite-plugin-cloudflare/tsdown.config.ts index 848a1928a15..618eb0c1d07 100644 --- a/packages/vite-plugin-cloudflare/tsdown.config.ts +++ b/packages/vite-plugin-cloudflare/tsdown.config.ts @@ -13,7 +13,18 @@ export default defineConfig([ sourcemap, outDir: "dist", tsconfig: "tsconfig.plugin.json", + deps: { + dts: { + alwaysBundle: [ + /^@cloudflare\/(?!workers-types(?:\/|$))/, + /^cloudflare(?:\/.*)?$/, + "jsonc-parser", + "zod", + ], + }, + }, dts: { + resolver: "tsc", sourcemap, compilerOptions: { // workaround for https://github.com/rolldown/tsdown/issues/345 @@ -34,7 +45,7 @@ export default defineConfig([ "module-runner": "vite/module-runner", "module-runner-legacy": "vite-legacy/module-runner", }, - external: ["cloudflare:workers", "vite/module-runner"], + deps: { neverBundle: ["cloudflare:workers", "vite/module-runner"] }, }), worker("vite-proxy-worker"), ]); @@ -54,7 +65,7 @@ function worker(name: string, options: UserConfig = {}): UserConfig { }, }, dts: false, - external: ["cloudflare:workers"], + deps: { neverBundle: ["cloudflare:workers"] }, tsconfig: "tsconfig.worker.json", ignoreWatch, ...options, diff --git a/patches/rolldown-plugin-dts@0.27.14.patch b/patches/rolldown-plugin-dts@0.27.14.patch new file mode 100644 index 00000000000..b0a5b28ade6 --- /dev/null +++ b/patches/rolldown-plugin-dts@0.27.14.patch @@ -0,0 +1,13 @@ +diff --git a/dist/index.mjs b/dist/index.mjs +index 56fe487103a0cbb35b2657f184368111bc214ca9..6979fcde77321f656b13c1f1c698014d2fc1b658 100644 +--- a/dist/index.mjs ++++ b/dist/index.mjs +@@ -1023,7 +1023,7 @@ function isReferenceId(node) { + return is.oneOf(node, ["Identifier", "MemberExpression"]); + } + function isHelperImport(node) { +- return node.type === "ImportDeclaration" && node.specifiers.length && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport"].includes(spec.local.name)); ++ return node.type === "ImportDeclaration" && node.specifiers.length && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport", "__name"].includes(spec.local.name)); + } + /** + * patch `.d.ts` suffix in import source to `.js` diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 418ce7c4d04..dcc1f15eea9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,6 +36,9 @@ catalogs: tree-kill: specifier: 1.2.2 version: 1.2.2 + tsdown: + specifier: 0.22.14 + version: 0.22.14 typescript: specifier: 5.8.3 version: 5.8.3 @@ -65,6 +68,9 @@ patchedDependencies: buffer-equal-constant-time@1.0.1: hash: cc16d31ed54afc06e628965b2acc54f0dbcc6d079da331da5f14040ce4d62024 path: patches/buffer-equal-constant-time@1.0.1.patch + rolldown-plugin-dts@0.27.14: + hash: 4e06ea16bb5aac41283423e2e8277ba84cbc1a8105879006c86dc5f6e9d7b55a + path: patches/rolldown-plugin-dts@0.27.14.patch toucan-js@4.0.0: hash: 60bdb1dcdbde0a135bb56d6fa1a1027caba891b149e2cfcb48d6a5b3524e0a91 path: patches/toucan-js@4.0.0.patch @@ -291,8 +297,8 @@ importers: specifier: catalog:default version: 0.28.2 tsdown: - specifier: 0.16.3 - version: 0.16.3(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(ms@2.1.3)(synckit@0.11.12)(typescript@5.8.3) + specifier: catalog:default + version: 0.22.14(tsx@4.21.0)(typescript@5.8.3)(unrun@0.2.8(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(synckit@0.11.12)) typescript: specifier: catalog:default version: 5.8.3 @@ -385,8 +391,8 @@ importers: specifier: 1.2.2 version: 1.2.2 tsdown: - specifier: 0.16.3 - version: 0.16.3(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(ms@2.1.3)(synckit@0.11.12)(typescript@5.8.3) + specifier: catalog:default + version: 0.22.14(tsx@4.21.0)(typescript@5.8.3)(unrun@0.2.8(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(synckit@0.11.12)) typescript: specifier: 5.8.3 version: 5.8.3 @@ -4392,6 +4398,165 @@ packages: '@web3-storage/multipart-parser@1.0.0': resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==} + '@yuku-codegen/binding-android-arm64@0.8.7': + resolution: {integrity: sha512-C/0zV5IhgVdYhGJTwrY0v8dknxlhiKwtVJkMUaexu9/QvRmzlV4vfU3hZlUSgqc2BxQHntL1mCVbDq8j0FRFDw==} + cpu: [arm64] + os: [android] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-darwin-arm64@0.8.7': + resolution: {integrity: sha512-/u+REDMI4a0/lsJXTM4c53/w31OGZLOReZIyg62uhgLs0kc8NHsj/nOcxTdlQjq5gi0zhdkccD9LaLTXcdzPvw==} + cpu: [arm64] + os: [darwin] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-darwin-x64@0.8.7': + resolution: {integrity: sha512-sMMzFOwCo4WXR+/6zIBThOocSC50iIIZZdfiIDbaLvj0Ax/rWt/iavyfEAqajyvzydLyCqR/ZItdLWSRlu1umw==} + cpu: [x64] + os: [darwin] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-freebsd-x64@0.8.7': + resolution: {integrity: sha512-MpdpKXix9P+Y1rKgjvcNeNtGjXeL1CmttNhYINrWls8kRpm4xM/oBGTmn6w7to8lAlwj5jm8q03dQPl5mRv4Qw==} + cpu: [x64] + os: [freebsd] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-linux-arm-gnu@0.8.7': + resolution: {integrity: sha512-rr1srFLlPAmC1vtxfc9C1YLDe3iH09YjfSeeIidBqKhzx1MATjOAq4mjlRUOnhr/L27MotWIYOFKwVsd5JZFOg==} + cpu: [arm] + os: [linux] + libc: [glibc] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-linux-arm-musl@0.8.7': + resolution: {integrity: sha512-eAufXh8qBRpiSO6ueaMDL+yyoXIGLhpUce72YbcACtZU2qhExwBIJyEtQf5kH2Ki0X2aqkSjSfog4OPtKXan3Q==} + cpu: [arm] + os: [linux] + libc: [musl] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-linux-arm64-gnu@0.8.7': + resolution: {integrity: sha512-gw4w6wPoHObBrdIC4duVWLmJOvpdE25j5D7yrM5mACNlK4klRz/lv8hK+ssQk9EJHBgZjSaqZIJVFgqNYbfv7A==} + cpu: [arm64] + os: [linux] + libc: [glibc] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-linux-arm64-musl@0.8.7': + resolution: {integrity: sha512-L68N6Y4XkqcIaKo3Ra88JEvBEH4AHff44A4INcrxeVWZ8CZtu2tCpfVxe3hR8qQQMcvBSQlDn24KpkCKEhVvfA==} + cpu: [arm64] + os: [linux] + libc: [musl] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-linux-x64-gnu@0.8.7': + resolution: {integrity: sha512-dzyAbltJmf3Cqlb8HcFuYIf5Yn0fl1vTr3XJ9HiVNNvOlhqPSArOqtw9vI1p6/VTXTjrMLXlU+s+/kNHiIy/Cw==} + cpu: [x64] + os: [linux] + libc: [glibc] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-linux-x64-musl@0.8.7': + resolution: {integrity: sha512-Otw4MH3404q0Bbvl+YTdW9aoUV5vXmUw8260bWvt1XlaoIX/ceSgI4ygheRDMfBPoHt6FDayQaO9OLVUZAgkFA==} + cpu: [x64] + os: [linux] + libc: [musl] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-win32-arm64@0.8.7': + resolution: {integrity: sha512-qo/jyrzryiBuKEsFiuWaBCBe3tRMynQ0qFWFgOEjcCMQeZfBm+wKiVEUEFXXLc7bh8YezguAWp0Mtnhq4ARNyA==} + cpu: [arm64] + os: [win32] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-codegen/binding-win32-x64@0.8.7': + resolution: {integrity: sha512-D5lDsVDx6m00E6bWySlWdH72Ca4TPSaphDqB6QjU6MpuNLIJqoGoatYyq2rOmBE8Zv/kunot/o58KGL03P3eiA==} + cpu: [x64] + os: [win32] + deprecated: yuku-codegen is pure JavaScript since 0.14 + + '@yuku-parser/binding-android-arm64@0.8.7': + resolution: {integrity: sha512-eGKYiUDX7Y0V7tDTmg+JTVnXnjMqfXXsorZ+EDf5kxwchQ3Or1HS14MzI2fw+jFhHR85fCWt+mtX33Yao73hIQ==} + cpu: [arm64] + os: [android] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-darwin-arm64@0.8.7': + resolution: {integrity: sha512-Re0RHelKLnjEURulY2/KxW+Ngb8zuNA4BRZuMwgGQNzVumT6u4U2N2hc01oeYVNVof0i7GrXE4UCNBgbpRRnjQ==} + cpu: [arm64] + os: [darwin] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-darwin-x64@0.8.7': + resolution: {integrity: sha512-Hn8DROtQkjlA1ACbPgj4a7eP9IuVOI504oiTwpkWPbpaDWD9KdmnVYCqW+1LfenNK/g7O9NhWGpXEdaCNX7lIA==} + cpu: [x64] + os: [darwin] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-freebsd-x64@0.8.7': + resolution: {integrity: sha512-bAP2OV8wRuzplX/jYxv9+vvqQT8JxyNphI8fLfXGL054Xs+4/J5u33cIm3y4rxY8rdoLmmdiJs2Tq7r7lrDRfA==} + cpu: [x64] + os: [freebsd] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-linux-arm-gnu@0.8.7': + resolution: {integrity: sha512-kTYwJQQgmZeAWdDIWabiReIZMpmfLueIj1tCmjStUtFGhR1Z0qwxonKVfUC4N7h/VhGGzLZ//7O1kgt1QKqgCg==} + cpu: [arm] + os: [linux] + libc: [glibc] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-linux-arm-musl@0.8.7': + resolution: {integrity: sha512-uL4jE8HPT2BLlxAXyD10LqgPuXa9eDa0BKpCdSANmzIJghq/2eZo3/gQNtaxPZMupWoxjYzSad9IXrwu7aYPXQ==} + cpu: [arm] + os: [linux] + libc: [musl] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-linux-arm64-gnu@0.8.7': + resolution: {integrity: sha512-3gVN4pWSKZmXiNX7cU164dR9MPvesCHnlH6nPfpK+yQsCuYphjKKplcb4SnZBrhiqmXbgb2HR0c2TS0IZUPhgA==} + cpu: [arm64] + os: [linux] + libc: [glibc] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-linux-arm64-musl@0.8.7': + resolution: {integrity: sha512-S0mwfEjoLpxzXeZw802Wa4RaELsQiPtWqG6INcy8j4GtvNFtl4LCX3eGO1XLn9pyLAISLzTRyU3zUCBUPin8lg==} + cpu: [arm64] + os: [linux] + libc: [musl] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-linux-x64-gnu@0.8.7': + resolution: {integrity: sha512-lnbWdPmerE5D1uH1G4IEZKnPzCrWCStRGrtgpSIe1RibAo5bZIjDbbbPYXmMHCEh4F+x/JaJpElh26a3r+BPbg==} + cpu: [x64] + os: [linux] + libc: [glibc] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-linux-x64-musl@0.8.7': + resolution: {integrity: sha512-769uwndMvMzUvATWbAcEvyLHKA+DzhHSCl/obBUrRdYfRo26yxui6S8y3z7uJ+Naup7UKrDxrpK7OnQkxkl9KQ==} + cpu: [x64] + os: [linux] + libc: [musl] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-win32-arm64@0.8.7': + resolution: {integrity: sha512-mEB/9PlaAkisJ6KWGz0zvywXoU6+80dTlR2LwS7s/jcXXoU6fm2+sitBZXtqu3+Q4DcDgPxM45uWMCzPs0TSRw==} + cpu: [arm64] + os: [win32] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-parser/binding-win32-x64@0.8.7': + resolution: {integrity: sha512-8vNB2DP0ou61nGb8tc/qfi41gfyDXz1MHr2zqL3nR+cJ6CEbiuWV/l/a/vv151gCgiZLLAyGkQGENpozdg716w==} + cpu: [x64] + os: [win32] + deprecated: yuku-parser runs on yuku-core since 0.14 + + '@yuku-toolchain/types@0.8.7': + resolution: {integrity: sha512-2Z53dNxAJL6UvFoIrDZvYf3zlO8s4VJK4O2hhaB4mXVwwpX/7ajtss3cmfqKvamlNLWyt9FSWs4eoYdlbxpnHA==} + JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -4488,10 +4653,6 @@ packages: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} - ast-kit@2.2.0: - resolution: {integrity: sha512-m1Q/RaVOnTp9JxPX+F+Zn7IcLYMzM8kZofDImfsKZd8MbR+ikdOzTeztStWqfrqIxZnYWryyI9ePm3NGjnZgGw==} - engines: {node: '>=20.19.0'} - async@3.2.6: resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} @@ -4575,9 +4736,6 @@ packages: better-result@2.10.0: resolution: {integrity: sha512-oQhh0y1qo2/ZKdAAEvHZAqKKiHOFU5k/bW96fE2ScgQOVkJRiHwB+nOS1SgFsYqRlxMDWvefXi9Q3px7QvgNDw==} - birpc@2.8.0: - resolution: {integrity: sha512-Bz2a4qD/5GRhiHSwj30c/8kC8QGj12nNDwz3D4ErQ4Xhy35dsSDvF+RA/tWpjyU0pdGtSDiEk6B5fBGE1qNVhw==} - blake3-wasm@2.1.5: resolution: {integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==} @@ -4640,9 +4798,9 @@ packages: magicast: optional: true - cac@6.7.14: - resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} - engines: {node: '>=8'} + cac@7.1.0: + resolution: {integrity: sha512-LMDU/U2yA4IPIY8KT0NsNPWEYZvAMkbgyspxJ6btJaYV+WMDOHAZCmB0lsTObiHaRS1V/ztKAl7+TSkTqXyeoA==} + engines: {node: '>=20.19.0'} cacheable-lookup@7.0.0: resolution: {integrity: sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==} @@ -4688,10 +4846,6 @@ packages: chardet@2.1.1: resolution: {integrity: sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==} - chokidar@4.0.3: - resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} - engines: {node: '>= 14.16.0'} - chokidar@5.0.0: resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} engines: {node: '>= 20.19.0'} @@ -4985,10 +5139,6 @@ packages: devtools-protocol@0.0.1182435: resolution: {integrity: sha512-EmlkWb62wSbQNE1gRZZsi4KZYRaF5Skpp183LhRU7+sadKR06O1dHCjZmFSEG6Kv7P6S/UYLxcY3NlYwqKM99w==} - diff@8.0.4: - resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==} - engines: {node: '>=0.3.1'} - dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -5024,9 +5174,9 @@ packages: resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} engines: {node: '>=10'} - dts-resolver@2.1.3: - resolution: {integrity: sha512-bihc7jPC90VrosXNzK0LTE2cuLP6jr0Ro8jk+kMugHReJVLIpHz/xadeq3MhuwyO4TD4OA3L1Q8pBBFRc08Tsw==} - engines: {node: '>=20.19.0'} + dts-resolver@3.0.0: + resolution: {integrity: sha512-1T1f+z+4tl9XD+m+0HBgWoL/nm0bOIffyWaUuUSBlFg/86IWvfx+wjNaO/ybU0AJzG9/Mi5hBUgGV6zCmWEN7Q==} + engines: {node: ^22.18.0 || >=24.0.0} peerDependencies: oxc-resolver: '>=11.0.0' peerDependenciesMeta: @@ -5448,6 +5598,10 @@ packages: get-tsconfig@4.13.6: resolution: {integrity: sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==} + get-tsconfig@5.0.0-beta.5: + resolution: {integrity: sha512-/6gFNr0N04nob252sTQxyFLi3eKFRqIg1I87YcqAMT1i6SQrSF6KujUEQrtrjMV0H/eejTCltLdDSTEMzHbnsQ==} + engines: {node: '>=20.20.0'} + getpass@0.1.7: resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==} @@ -5523,8 +5677,8 @@ packages: headers-polyfill@5.0.1: resolution: {integrity: sha512-1TJ6Fih/b8h5TIcv+1+Hw0PDQWJTKDKzFZzcKOiW1wJza3XoAQlkCuXLbymPYB8+ZQyw8mHvdw560e8zVFIWyA==} - hookable@5.5.3: - resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} + hookable@6.1.2: + resolution: {integrity: sha512-+abwxtiEA52GCVIsQqut3S/uKTbUwYIp4Pe/vv+6py5XiXBCqMZHg6pA6Y5qhgLSEys0/cYuPbO0z1QFj5ZCmg==} http-cache-semantics@4.3.0: resolution: {integrity: sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA==} @@ -5586,6 +5740,10 @@ packages: resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} engines: {node: '>=6'} + import-without-cache@0.4.1: + resolution: {integrity: sha512-vXoV9PjKHEednCUu01e98TkImxy67e3BJXbTIOmIq4Hyzw3IAwYRcuPkfeTzJzwyyts4kjuA73x+pWJLc4f86A==} + engines: {node: ^22.18.0 || >=24.0.0} + imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} @@ -6220,13 +6378,9 @@ packages: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} - obug@0.1.3: - resolution: {integrity: sha512-9fwkQ1jsVEqi3I3so5QA4yLPW2QVtekrIpiVUWyw8c/BApPHYj0gohWby3qzK30X58lyksSqcbfvO0vOwKFWqQ==} - peerDependencies: - ms: ^2.0.0 - peerDependenciesMeta: - ms: - optional: true + obug@2.2.1: + resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} + engines: {node: '>=12.20.0'} obug@3.0.0: resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==} @@ -6672,10 +6826,6 @@ packages: resolution: {integrity: sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - readdirp@4.0.1: - resolution: {integrity: sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==} - engines: {node: '>= 14.16.0'} - readdirp@5.1.1: resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==} engines: {node: '>= 20.19.0'} @@ -6741,20 +6891,20 @@ packages: robust-predicates@3.0.3: resolution: {integrity: sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==} - rolldown-plugin-dts@0.17.6: - resolution: {integrity: sha512-yX7kDS7Pm9HyVdKKtgfLiRS4wwu+dA4c7KUmOTWKgheu3he4pcT6Wk0Ht59Xm+1pHuoWYv3DvFPqxeF1AyW82A==} - engines: {node: '>=20.18.0'} + rolldown-plugin-dts@0.27.14: + resolution: {integrity: sha512-ZvuDDwoIpRK9RPxDXratCpklFO9QZZWndf/sd0VBFb4LEj0jj07UcHK9OCh7V4XiFz2Z89ziyBC2K6tJiDjrbw==} + engines: {node: ^22.18.0 || >=24.11.0} peerDependencies: - '@ts-macro/tsc': ^0.3.6 - '@typescript/native-preview': '>=7.0.0-dev.20250601.1' - rolldown: ^1.0.0-beta.44 - typescript: ^5.0.0 - vue-tsc: ~3.1.0 + '@typescript/native-preview': '*' + '@volar/typescript': ~2.4.0 + rolldown: ^1.0.0 + typescript: ^5.0.0 || ^6.0.0 || ~7.0.0 + vue-tsc: ~3.2.0 || ~3.3.0 peerDependenciesMeta: - '@ts-macro/tsc': - optional: true '@typescript/native-preview': optional: true + '@volar/typescript': + optional: true typescript: optional: true vue-tsc: @@ -7082,10 +7232,6 @@ packages: resolution: {integrity: sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==} engines: {node: '>=20.0.0'} - tinyexec@1.2.4: - resolution: {integrity: sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==} - engines: {node: '>=18'} - tinyexec@1.3.1: resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==} engines: {node: '>=18'} @@ -7149,30 +7295,39 @@ packages: resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==} engines: {node: '>=6.10'} - tsdown@0.16.3: - resolution: {integrity: sha512-uciWbZs71/Yj5Mr++gk+Ry3cp4c4PGluLscJ8dbGLHyKFjo1Hrtn+Ix/BIulIKsrnECwwvDge24WKHzdJmCCQg==} - engines: {node: '>=20.19.0'} + tsdown@0.22.14: + resolution: {integrity: sha512-ule7Y+fsAN2iZbLDoo7C4KYljFJNJJ+fLshyn+9gozeTspVersWHxwdGB+Dm2hzA38s6muFnUTl0jK3vJm9ifQ==} + engines: {node: ^22.18.0 || >=24.11.0} hasBin: true peerDependencies: '@arethetypeswrong/core': ^0.18.1 - '@vitejs/devtools': ^0.0.0-alpha.17 - publint: ^0.3.0 - typescript: ^5.0.0 - unplugin-lightningcss: ^0.4.0 + '@tsdown/css': 0.22.14 + '@tsdown/exe': 0.22.14 + '@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 - typescript: + tsx: optional: true - unplugin-lightningcss: + typescript: optional: true unplugin-unused: optional: true + unrun: + optional: true tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -7366,6 +7521,10 @@ packages: engines: {node: '>=22'} hasBin: true + verkit@0.3.2: + resolution: {integrity: sha512-zj/ob3UsvJGN0whEAKFp53REA5X66hvffVqoCtVQAakJKnKlH+/PcOfMoFwIG/o4rElqLv/ycAFlx8ZlXUorCg==} + engines: {node: '>=18.12.0'} + verror@1.10.0: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} @@ -7624,6 +7783,15 @@ packages: youch@4.1.0-beta.10: resolution: {integrity: sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==} + yuku-ast@0.8.7: + resolution: {integrity: sha512-h6+4bDfyootiMB9vckk5uKo5r5j0GHrkr17FQTDNfEsFT3DWlN9uu1HJwQwc64pgmLCI945fWM3lbTIqxjT3GQ==} + + yuku-codegen@0.8.7: + resolution: {integrity: sha512-adwDZSh8oVDzhE6Du9PwVWxcOxeV0e2EVhUuMKWfhSY4wkrDq9eqixlxFF3l/XGUV1E7UFzhpz9393MUumkyNw==} + + yuku-parser@0.8.7: + resolution: {integrity: sha512-vRD9nwt4L3aYpxNqeSC4WqLv58xrXef0Ong1Mc45CTXTIpvLafx7JO05sczmQZwdLEZvywrLOGdNC5+Rp5N1BQ==} + zeptomatch@2.1.0: resolution: {integrity: sha512-KiGErG2J0G82LSpniV0CtIzjlJ10E04j02VOudJsPyPwNZgGnRKQy7I1R7GMyg/QswnE4l7ohSGrQbQbjXPPDA==} @@ -9216,11 +9384,13 @@ snapshots: '@opentelemetry/api@1.9.1': optional: true - '@oxc-project/runtime@0.96.0': {} + '@oxc-project/runtime@0.96.0': + optional: true '@oxc-project/types@0.154.0': {} - '@oxc-project/types@0.96.0': {} + '@oxc-project/types@0.96.0': + optional: true '@oxfmt/binding-android-arm-eabi@0.68.0': optional: true @@ -9662,7 +9832,8 @@ snapshots: '@rolldown/binding-win32-x64-msvc@1.2.14': optional: true - '@rolldown/pluginutils@1.0.0-beta.49': {} + '@rolldown/pluginutils@1.0.0-beta.49': + optional: true '@rolldown/pluginutils@1.0.0-rc.3': {} @@ -10656,6 +10827,80 @@ snapshots: '@web3-storage/multipart-parser@1.0.0': {} + '@yuku-codegen/binding-android-arm64@0.8.7': + optional: true + + '@yuku-codegen/binding-darwin-arm64@0.8.7': + optional: true + + '@yuku-codegen/binding-darwin-x64@0.8.7': + optional: true + + '@yuku-codegen/binding-freebsd-x64@0.8.7': + optional: true + + '@yuku-codegen/binding-linux-arm-gnu@0.8.7': + optional: true + + '@yuku-codegen/binding-linux-arm-musl@0.8.7': + optional: true + + '@yuku-codegen/binding-linux-arm64-gnu@0.8.7': + optional: true + + '@yuku-codegen/binding-linux-arm64-musl@0.8.7': + optional: true + + '@yuku-codegen/binding-linux-x64-gnu@0.8.7': + optional: true + + '@yuku-codegen/binding-linux-x64-musl@0.8.7': + optional: true + + '@yuku-codegen/binding-win32-arm64@0.8.7': + optional: true + + '@yuku-codegen/binding-win32-x64@0.8.7': + optional: true + + '@yuku-parser/binding-android-arm64@0.8.7': + optional: true + + '@yuku-parser/binding-darwin-arm64@0.8.7': + optional: true + + '@yuku-parser/binding-darwin-x64@0.8.7': + optional: true + + '@yuku-parser/binding-freebsd-x64@0.8.7': + optional: true + + '@yuku-parser/binding-linux-arm-gnu@0.8.7': + optional: true + + '@yuku-parser/binding-linux-arm-musl@0.8.7': + optional: true + + '@yuku-parser/binding-linux-arm64-gnu@0.8.7': + optional: true + + '@yuku-parser/binding-linux-arm64-musl@0.8.7': + optional: true + + '@yuku-parser/binding-linux-x64-gnu@0.8.7': + optional: true + + '@yuku-parser/binding-linux-x64-musl@0.8.7': + optional: true + + '@yuku-parser/binding-win32-arm64@0.8.7': + optional: true + + '@yuku-parser/binding-win32-x64@0.8.7': + optional: true + + '@yuku-toolchain/types@0.8.7': {} + JSONStream@1.3.5: dependencies: jsonparse: 1.3.1 @@ -10745,11 +10990,6 @@ snapshots: assert-plus@1.0.0: {} - ast-kit@2.2.0: - dependencies: - '@babel/parser': 7.29.0 - pathe: 2.0.3 - async@3.2.6: {} asynckit@0.4.0: {} @@ -10810,8 +11050,6 @@ snapshots: better-result@2.10.0: {} - birpc@2.8.0: {} - blake3-wasm@2.1.5: {} body-parser@1.20.8: @@ -10904,7 +11142,7 @@ snapshots: pkg-types: 2.3.0 rc9: 3.1.0 - cac@6.7.14: {} + cac@7.1.0: {} cacheable-lookup@7.0.0: {} @@ -10947,10 +11185,6 @@ snapshots: chardet@2.1.1: {} - chokidar@4.0.3: - dependencies: - readdirp: 4.0.1 - chokidar@5.0.0: dependencies: readdirp: 5.1.1 @@ -11203,8 +11437,6 @@ snapshots: devtools-protocol@0.0.1182435: {} - diff@8.0.4: {} - dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -11230,7 +11462,7 @@ snapshots: dotenv@8.6.0: {} - dts-resolver@2.1.3: {} + dts-resolver@3.0.0: {} dunder-proto@1.0.1: dependencies: @@ -11797,6 +12029,11 @@ snapshots: get-tsconfig@4.13.6: dependencies: resolve-pkg-maps: 1.0.0 + optional: true + + get-tsconfig@5.0.0-beta.5: + dependencies: + resolve-pkg-maps: 1.0.0 getpass@0.1.7: dependencies: @@ -11885,7 +12122,7 @@ snapshots: '@types/set-cookie-parser': 2.4.10 set-cookie-parser: 3.0.1 - hookable@5.5.3: {} + hookable@6.1.2: {} http-cache-semantics@4.3.0: {} @@ -11956,6 +12193,8 @@ snapshots: parent-module: 1.0.1 resolve-from: 4.0.0 + import-without-cache@0.4.1: {} + imurmurhash@0.1.4: {} inherits@2.0.4: {} @@ -12460,9 +12699,7 @@ snapshots: object-inspect@1.13.4: {} - obug@0.1.3(ms@2.1.3): - optionalDependencies: - ms: 2.1.3 + obug@2.2.1: {} obug@3.0.0: {} @@ -12912,8 +13149,6 @@ snapshots: process: 0.11.10 string_decoder: 1.3.0 - readdirp@4.0.1: {} - readdirp@5.1.1: {} real-require@0.2.0: {} @@ -12955,22 +13190,18 @@ snapshots: robust-predicates@3.0.3: {} - rolldown-plugin-dts@0.17.6(ms@2.1.3)(rolldown@1.0.0-beta.49(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3))(typescript@5.8.3): + rolldown-plugin-dts@0.27.14(patch_hash=4e06ea16bb5aac41283423e2e8277ba84cbc1a8105879006c86dc5f6e9d7b55a)(rolldown@1.2.14)(typescript@5.8.3): dependencies: - '@babel/generator': 7.29.1 - '@babel/parser': 7.29.0 - '@babel/types': 7.29.0 - ast-kit: 2.2.0 - birpc: 2.8.0 - dts-resolver: 2.1.3 - get-tsconfig: 4.13.6 - magic-string: 0.30.21 - obug: 0.1.3(ms@2.1.3) - rolldown: 1.0.0-beta.49(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3) + dts-resolver: 3.0.0 + get-tsconfig: 5.0.0-beta.5 + obug: 2.2.1 + rolldown: 1.2.14 + yuku-ast: 0.8.7 + yuku-codegen: 0.8.7 + yuku-parser: 0.8.7 optionalDependencies: typescript: 5.8.3 transitivePeerDependencies: - - ms - oxc-resolver rolldown@1.0.0-beta.49(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3): @@ -12995,6 +13226,7 @@ snapshots: transitivePeerDependencies: - '@emnapi/core' - '@emnapi/runtime' + optional: true rolldown@1.2.14: dependencies: @@ -13404,8 +13636,6 @@ snapshots: tinybench@6.2.2: {} - tinyexec@1.2.4: {} - tinyexec@1.3.1: {} tinyglobby@0.2.16: @@ -13462,33 +13692,31 @@ snapshots: ts-dedent@2.2.0: {} - tsdown@0.16.3(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(ms@2.1.3)(synckit@0.11.12)(typescript@5.8.3): + tsdown@0.22.14(tsx@4.21.0)(typescript@5.8.3)(unrun@0.2.8(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(synckit@0.11.12)): dependencies: ansis: 4.3.1 - cac: 6.7.14 - chokidar: 4.0.3 - diff: 8.0.4 + cac: 7.1.0 + defu: 6.1.7 empathic: 2.0.1 - hookable: 5.5.3 - obug: 0.1.3(ms@2.1.3) - rolldown: 1.0.0-beta.49(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3) - rolldown-plugin-dts: 0.17.6(ms@2.1.3)(rolldown@1.0.0-beta.49(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3))(typescript@5.8.3) - semver: 7.8.5 - tinyexec: 1.2.4 + hookable: 6.1.2 + import-without-cache: 0.4.1 + obug: 2.2.1 + picomatch: 4.0.7 + rolldown: 1.2.14 + rolldown-plugin-dts: 0.27.14(patch_hash=4e06ea16bb5aac41283423e2e8277ba84cbc1a8105879006c86dc5f6e9d7b55a)(rolldown@1.2.14)(typescript@5.8.3) + tinyexec: 1.3.1 tinyglobby: 0.2.17 tree-kill: 1.2.2 unconfig-core: 7.5.0 - unrun: 0.2.8(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(synckit@0.11.12) + verkit: 0.3.2 optionalDependencies: + tsx: 4.21.0 typescript: 5.8.3 + unrun: 0.2.8(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.3)(synckit@0.11.12) transitivePeerDependencies: - - '@emnapi/core' - - '@emnapi/runtime' - - '@ts-macro/tsc' - '@typescript/native-preview' - - ms + - '@volar/typescript' - oxc-resolver - - synckit - vue-tsc tslib@2.8.1: {} @@ -13604,6 +13832,7 @@ snapshots: transitivePeerDependencies: - '@emnapi/core' - '@emnapi/runtime' + optional: true until-async@3.0.2: {} @@ -13694,6 +13923,8 @@ snapshots: - supports-color - typanion + verkit@0.3.2: {} + verror@1.10.0: dependencies: assert-plus: 1.0.0 @@ -13891,6 +14122,45 @@ snapshots: cookie: 1.1.1 youch-core: 0.3.3 + yuku-ast@0.8.7: + dependencies: + '@yuku-toolchain/types': 0.8.7 + + yuku-codegen@0.8.7: + dependencies: + '@yuku-toolchain/types': 0.8.7 + optionalDependencies: + '@yuku-codegen/binding-android-arm64': 0.8.7 + '@yuku-codegen/binding-darwin-arm64': 0.8.7 + '@yuku-codegen/binding-darwin-x64': 0.8.7 + '@yuku-codegen/binding-freebsd-x64': 0.8.7 + '@yuku-codegen/binding-linux-arm-gnu': 0.8.7 + '@yuku-codegen/binding-linux-arm-musl': 0.8.7 + '@yuku-codegen/binding-linux-arm64-gnu': 0.8.7 + '@yuku-codegen/binding-linux-arm64-musl': 0.8.7 + '@yuku-codegen/binding-linux-x64-gnu': 0.8.7 + '@yuku-codegen/binding-linux-x64-musl': 0.8.7 + '@yuku-codegen/binding-win32-arm64': 0.8.7 + '@yuku-codegen/binding-win32-x64': 0.8.7 + + yuku-parser@0.8.7: + dependencies: + '@yuku-toolchain/types': 0.8.7 + yuku-ast: 0.8.7 + optionalDependencies: + '@yuku-parser/binding-android-arm64': 0.8.7 + '@yuku-parser/binding-darwin-arm64': 0.8.7 + '@yuku-parser/binding-darwin-x64': 0.8.7 + '@yuku-parser/binding-freebsd-x64': 0.8.7 + '@yuku-parser/binding-linux-arm-gnu': 0.8.7 + '@yuku-parser/binding-linux-arm-musl': 0.8.7 + '@yuku-parser/binding-linux-arm64-gnu': 0.8.7 + '@yuku-parser/binding-linux-arm64-musl': 0.8.7 + '@yuku-parser/binding-linux-x64-gnu': 0.8.7 + '@yuku-parser/binding-linux-x64-musl': 0.8.7 + '@yuku-parser/binding-win32-arm64': 0.8.7 + '@yuku-parser/binding-win32-x64': 0.8.7 + zeptomatch@2.1.0: dependencies: grammex: 3.1.11 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 62a7dbb6a9f..ea0612a2d45 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -29,10 +29,14 @@ overrides: # Verdaccio pins 4.17.21 in the retained mock npm registry. "lodash@<4.18.1": "^4.18.1" patchedDependencies: + # Remove the unused name-preservation helper import from declaration output. + # See https://github.com/sxzz/rolldown-plugin-dts/issues/369 + "rolldown-plugin-dts@0.27.14": "patches/rolldown-plugin-dts@0.27.14.patch" toucan-js@4.0.0: patches/toucan-js@4.0.0.patch youch@4.1.0-beta.10: patches/youch@4.1.0-beta.10.patch buffer-equal-constant-time@1.0.1: patches/buffer-equal-constant-time@1.0.1.patch catalog: + tsdown: "0.22.14" "@types/node": 22.15.17 typescript: 5.8.3 undici: 7.30.1 diff --git a/tools/test/check-built-entry-points.ts b/tools/test/check-built-entry-points.ts new file mode 100644 index 00000000000..13f05d55283 --- /dev/null +++ b/tools/test/check-built-entry-points.ts @@ -0,0 +1,35 @@ +import assert from "node:assert/strict"; +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { checkPublishedTypes } from "./published-types"; + +if (require.main === module) { + const target = process.argv[2]; + assert( + target === "vite-plugin-cloudflare", + "Usage: node -r esbuild-register tools/test/check-built-entry-points.ts vite-plugin-cloudflare" + ); + const packageRoot = path.resolve(__dirname, "../../packages", target); + const consumerRoot = mkdtempSync( + path.join(tmpdir(), "workers-sdk-consumer-") + ); + try { + const diagnostics = checkPublishedTypes( + consumerRoot, + packageRoot, + "dist", + `import { cloudflare } from "@cloudflare/vite-plugin"; +cloudflare();` + ); + assert.equal( + diagnostics.length, + 0, + `${target} declarations failed to type-check:\n${diagnostics.join("\n")}` + ); + console.log(`${target} build output checks passed.`); + } finally { + // eslint-disable-next-line workers-sdk/no-direct-recursive-rm -- clean up the temporary consumer project without depending on a workspace build + rmSync(consumerRoot, { recursive: true, force: true, maxRetries: 3 }); + } +} diff --git a/tools/test/published-types.ts b/tools/test/published-types.ts new file mode 100644 index 00000000000..c2e975973cc --- /dev/null +++ b/tools/test/published-types.ts @@ -0,0 +1,105 @@ +import { + cpSync, + mkdirSync, + readFileSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import path from "node:path"; +import ts from "typescript"; + +/** + * Type-check a Worker project using a package's published declarations and + * installed dependencies. + * + * @param consumerRoot - Absolute path to an empty temporary directory. + * @param packageRoot - Absolute path to the workspace package. + * @param buildDirectory - Directory containing the package's built output. + * @param source - TypeScript source importing the package's public API. + * @returns Diagnostics in the consumer, package, and workspace dependencies. + */ +export function checkPublishedTypes( + consumerRoot: string, + packageRoot: string, + buildDirectory: string, + source: string +): string[] { + const manifest = JSON.parse( + readFileSync(path.join(packageRoot, "package.json"), "utf8") + ) as { + name: string; + dependencies?: Record; + peerDependencies?: Record; + }; + const consumerPackage = path.join( + consumerRoot, + "node_modules", + manifest.name + ); + const diagnosticDirectories = [consumerRoot, path.dirname(packageRoot)]; + mkdirSync(consumerPackage, { recursive: true }); + cpSync( + path.join(packageRoot, buildDirectory), + path.join(consumerPackage, buildDirectory), + { recursive: true } + ); + cpSync( + path.join(packageRoot, "package.json"), + path.join(consumerPackage, "package.json") + ); + for (const name of new Set([ + ...Object.keys(manifest.dependencies ?? {}), + ...Object.keys(manifest.peerDependencies ?? {}), + "@types/node", + "@cloudflare/workers-types", + ])) { + const destination = path.join(consumerRoot, "node_modules", name); + mkdirSync(path.dirname(destination), { recursive: true }); + symlinkSync( + path.join(packageRoot, "node_modules", name), + destination, + "junction" + ); + } + writeFileSync( + path.join(consumerRoot, "package.json"), + JSON.stringify({ type: "module" }) + ); + const consumer = path.join(consumerRoot, "consumer.ts"); + writeFileSync(consumer, source); + const options: ts.CompilerOptions = { + module: ts.ModuleKind.NodeNext, + target: ts.ScriptTarget.ES2022, + strict: true, + skipLibCheck: false, + noEmit: true, + types: ["node", "@cloudflare/workers-types/experimental"], + }; + const host = ts.createCompilerHost(options); + host.getCurrentDirectory = () => consumerRoot; + const program = ts.createProgram([consumer], options, host); + return ts + .getPreEmitDiagnostics(program) + .filter( + ({ file }) => + !file || + diagnosticDirectories.some((directory) => + isInsideDirectory(directory, file.fileName) + ) + ) + .map((diagnostic) => { + const file = diagnostic.file + ? path.relative(packageRoot, diagnostic.file.fileName) + : "consumer.ts"; + return `${file}: ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`; + }); +} + +function isInsideDirectory(directory: string, filename: string): boolean { + const relative = path.relative(directory, filename); + return ( + relative !== ".." && + !relative.startsWith(`..${path.sep}`) && + !path.isAbsolute(relative) + ); +}