Skip to content

Commit e02e93e

Browse files
committed
Modify output of dist folder to merge all .d.ts files
1 parent 5d41c5b commit e02e93e

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

packages/mdx/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"react-json-view": "^1.21.3",
7272
"rollup": "^2.41.2",
7373
"rollup-plugin-delete": "^2.0.0",
74+
"rollup-plugin-dts": "^4.2.1",
7475
"rollup-plugin-postcss": "^4.0.0",
7576
"rollup-plugin-typescript2": "^0.27.1",
7677
"sass": "^1.49.9",

packages/mdx/rollup.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import path from "path"
88
import json from "@rollup/plugin-json"
99
import del from "rollup-plugin-delete"
1010
import replace from "@rollup/plugin-replace"
11+
import dts from "rollup-plugin-dts";
1112
import { nodeResolve } from "@rollup/plugin-node-resolve"
1213
// import { terser } from "rollup-plugin-terser"
1314
import commonjs from "@rollup/plugin-commonjs"
1415

1516
const clientExternal = [
1617
"react",
1718
"react-dom",
19+
"remark/config",
1820
// "@codesandbox/sandpack-client",
1921
// "use-spring",
2022
// "diff",
@@ -72,6 +74,12 @@ export default function makeConfig(commandOptions) {
7274
}),
7375
],
7476
},
77+
{
78+
input: `src/index.tsx`,
79+
output: [{ file: `./dist/index.d.ts`, format: "es" }],
80+
external: [...remarkExternal, "shiki"],
81+
plugins: [dts()],
82+
},
7583
// for the browser esm we need to replace shiki with shiki/dist/index.browser.mjs
7684
// https://github.com/shikijs/shiki/issues/131#issuecomment-1094281851
7785
{
@@ -125,5 +133,11 @@ export default function makeConfig(commandOptions) {
125133
}),
126134
],
127135
},
136+
{
137+
input: `src/components.tsx`,
138+
output: [{ file: `./dist/components.d.ts`, format: "es" }],
139+
external: clientExternal,
140+
plugins: [dts()],
141+
},
128142
]
129143
}

packages/mdx/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"esnext"
1313
],
1414
"importHelpers": true,
15-
"declaration": true,
15+
"declaration": false,
1616
"sourceMap": true,
1717
"strict": false,
1818
"noUnusedLocals": false,
@@ -39,7 +39,8 @@
3939
"forceConsistentCasingInFileNames": true,
4040
"noEmit": true,
4141
"isolatedModules": true,
42-
"incremental": true
42+
"incremental": true,
43+
"tsBuildInfoFile": "./dist/tsbuildinfo.json"
4344
},
4445
"exclude": [
4546
"node_modules"

0 commit comments

Comments
 (0)