Skip to content

Commit ea64b82

Browse files
authored
fix: remove rollup-plugin-dts dependency (#1288)
<!-- CURSOR_SUMMARY --> > [!NOTE] > **Medium Risk** > Changes the build pipeline and TypeScript declaration output paths; risk is mainly around consumers resolving `.d.ts` correctly and the published package layout changing. > > **Overview** > Updates the Cloudflare SDK packaging to **stop using `rollup-plugin-dts`/`rollup-plugin-esbuild`** and instead generate type declarations during the ESM Rollup build via `@rollup/plugin-typescript`. > > As part of this, the package’s `types` entrypoints are repointed from `dist/index.d.ts` to `dist/esm/src/index.d.ts`, and the Rollup config now emits declarations only for the ESM build while disabling them for CJS. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit de95959. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 5561e9d commit ea64b82

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

packages/sdk/cloudflare/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
],
1818
"type": "module",
1919
"exports": {
20-
"types": "./dist/index.d.ts",
20+
"types": "./dist/esm/src/index.d.ts",
2121
"import": "./dist/esm/index.js",
2222
"require": "./dist/cjs/index.js"
2323
},
2424
"main": "./dist/cjs/index.js",
25-
"types": "./dist/index.d.ts",
25+
"types": "./dist/esm/src/index.d.ts",
2626
"files": [
2727
"dist"
2828
],
@@ -69,8 +69,6 @@
6969
"prettier": "^3.0.0",
7070
"rimraf": "^5.0.1",
7171
"rollup": "^3.29.2",
72-
"rollup-plugin-dts": "^6.0.2",
73-
"rollup-plugin-esbuild": "^5.0.0",
7472
"rollup-plugin-filesize": "^10.0.0",
7573
"rollup-plugin-generate-package-json": "^3.2.0",
7674
"ts-jest": "^29.1.0",

packages/sdk/cloudflare/rollup.config.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ import commonjs from '@rollup/plugin-commonjs';
22
import json from '@rollup/plugin-json';
33
import resolve from '@rollup/plugin-node-resolve';
44
import terser from '@rollup/plugin-terser';
5-
import dts from 'rollup-plugin-dts';
6-
import esbuild from 'rollup-plugin-esbuild';
5+
import typescript from '@rollup/plugin-typescript';
76
import filesize from 'rollup-plugin-filesize';
87

98
const inputPath = 'src/index.ts';
109
const cjsPath = 'dist/cjs/index.js';
1110
const esmPath = 'dist/esm/index.js';
12-
const typingsPath = 'dist/index.d.ts';
13-
14-
const plugins = [resolve(), commonjs(), esbuild(), json(), terser(), filesize()];
1511

1612
// the second array item is a function to include all js-core packages in the bundle so they
1713
// are not imported or required as separate npm packages
@@ -27,7 +23,14 @@ export default [
2723
sourcemap: true,
2824
},
2925
],
30-
plugins,
26+
plugins: [
27+
resolve(),
28+
commonjs(),
29+
typescript({ declaration: false, declarationMap: false }),
30+
json(),
31+
terser(),
32+
filesize(),
33+
],
3134
external,
3235
},
3336
{
@@ -39,15 +42,14 @@ export default [
3942
sourcemap: true,
4043
},
4144
],
42-
plugins,
45+
plugins: [
46+
resolve(),
47+
commonjs(),
48+
typescript({ declaration: true, declarationDir: 'dist/esm' }),
49+
json(),
50+
terser(),
51+
filesize(),
52+
],
4353
external,
4454
},
45-
{
46-
input: inputPath,
47-
plugins: [dts(), json()],
48-
output: {
49-
file: typingsPath,
50-
format: 'esm',
51-
},
52-
},
5355
];

0 commit comments

Comments
 (0)