Skip to content

Commit b7d7da7

Browse files
authored
Merge pull request #186 from AeonFr/merge-dts-files
Modify output of dist folder to merge all .d.ts files
2 parents 5d41c5b + 4599e1b commit b7d7da7

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

packages/mdx/package.json

+1
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

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ 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"
@@ -72,6 +73,12 @@ export default function makeConfig(commandOptions) {
7273
}),
7374
],
7475
},
76+
{
77+
input: `src/index.tsx`,
78+
output: [{ file: `./dist/index.d.ts`, format: "es" }],
79+
external: [...remarkExternal, "shiki"],
80+
plugins: [dts()],
81+
},
7582
// for the browser esm we need to replace shiki with shiki/dist/index.browser.mjs
7683
// https://github.com/shikijs/shiki/issues/131#issuecomment-1094281851
7784
{
@@ -125,5 +132,13 @@ export default function makeConfig(commandOptions) {
125132
}),
126133
],
127134
},
135+
{
136+
input: `src/components.tsx`,
137+
output: [
138+
{ file: `./dist/components.d.ts`, format: "es" },
139+
],
140+
external: clientExternal,
141+
plugins: [dts()],
142+
},
128143
]
129144
}

packages/mdx/src/mdx-client/code.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
EditorProps,
66
EditorStep,
77
} from "../mini-editor"
8-
import { CodeHikeConfig } from "remark/config"
8+
import { CodeHikeConfig } from "../remark/config"
99

1010
export function Code(
1111
props: EditorProps & Partial<CodeHikeConfig>

packages/mdx/tsconfig.json

+3-2
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"

yarn.lock

+16
Original file line numberDiff line numberDiff line change
@@ -10399,6 +10399,13 @@ magic-string@^0.25.3, magic-string@^0.25.7:
1039910399
dependencies:
1040010400
sourcemap-codec "^1.4.8"
1040110401

10402+
magic-string@^0.26.1:
10403+
version "0.26.2"
10404+
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.2.tgz#5331700e4158cd6befda738bb6b0c7b93c0d4432"
10405+
integrity sha512-NzzlXpclt5zAbmo6h6jNc8zl2gNRGHvmsZW4IvZhTC4W7k4OlLP+S5YLussa/r3ixNT66KOQfNORlXHSOy/X4A==
10406+
dependencies:
10407+
sourcemap-codec "^1.4.8"
10408+
1040210409
make-dir@^1.0.0:
1040310410
version "1.3.0"
1040410411
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
@@ -14303,6 +14310,15 @@ rollup-plugin-delete@^2.0.0:
1430314310
dependencies:
1430414311
del "^5.1.0"
1430514312

14313+
rollup-plugin-dts@^4.2.1:
14314+
version "4.2.1"
14315+
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-4.2.1.tgz#c17968a0f7c5ae70a9e0ab37e715f3ef63da01c7"
14316+
integrity sha512-eaxQZNUJ5iQcxNGlpJ1CUgG4OSVqWjDZ3nNSWBIoGrpcote2aNphSe1RJOaSYkb8dwn3o+rYm1vvld/5z3EGSQ==
14317+
dependencies:
14318+
magic-string "^0.26.1"
14319+
optionalDependencies:
14320+
"@babel/code-frame" "^7.16.7"
14321+
1430614322
rollup-plugin-inject@^3.0.0:
1430714323
version "3.0.2"
1430814324
resolved "https://registry.yarnpkg.com/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4"

0 commit comments

Comments
 (0)