Skip to content

Commit bf18e08

Browse files
committed
refactor: generate dts by vite plugin
1 parent 6b7d9b7 commit bf18e08

File tree

6 files changed

+106
-100
lines changed

6 files changed

+106
-100
lines changed

Diff for: api-extractor.json

-56
This file was deleted.

Diff for: package.json

+18-9
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,43 @@
99
"files": [
1010
"dist"
1111
],
12-
"types": "dist/repl.d.ts",
12+
"types": "dist/vue-repl.d.ts",
1313
"exports": {
1414
".": {
15-
"types": "./dist/repl.d.ts",
15+
"types": "./dist/vue-repl.d.ts",
1616
"import": "./dist/vue-repl.js",
1717
"require": "./dist/ssr-stub.js"
1818
},
1919
"./monaco-editor": {
20-
"types": "./dist/editor-types.d.ts",
20+
"types": "./dist/monaco-editor.d.ts",
2121
"import": "./dist/monaco-editor.js",
2222
"require": null
2323
},
2424
"./codemirror-editor": {
25-
"types": "./dist/editor-types.d.ts",
25+
"types": "./dist/codemirror-editor.d.ts",
2626
"import": "./dist/codemirror-editor.js",
2727
"require": null
2828
},
29-
"./style.css": "./dist/style.css",
30-
"./dist/style.css": "./dist/style.css"
29+
"./*": [
30+
"./*",
31+
"./*.d.ts"
32+
]
33+
},
34+
"typesVersions": {
35+
"*": {
36+
"*": [
37+
"./dist/*",
38+
"./*"
39+
]
40+
}
3141
},
3242
"scripts": {
3343
"dev": "vite",
3444
"build": "vite build",
35-
"build-types": "vue-tsc -p tsconfig.build.json && api-extractor run -c api-extractor.json && node scripts/cleanup.js",
3645
"build-preview": "vite build -c vite.preview.config.ts",
3746
"format": "prettier --write .",
3847
"release": "bumpp -r",
39-
"prepublishOnly": "npm run build && npm run build-types"
48+
"prepublishOnly": "npm run build"
4049
},
4150
"simple-git-hooks": {
4251
"pre-commit": "pnpm exec lint-staged --concurrent false"
@@ -58,7 +67,6 @@
5867
"homepage": "https://github.com/vuejs/repl#readme",
5968
"devDependencies": {
6069
"@babel/types": "^7.23.3",
61-
"@microsoft/api-extractor": "^7.38.3",
6270
"@rollup/plugin-replace": "^5.0.5",
6371
"@types/codemirror": "^5.60.13",
6472
"@types/node": "^20.9.0",
@@ -82,6 +90,7 @@
8290
"sucrase": "^3.34.0",
8391
"typescript": "^5.2.2",
8492
"vite": "^4.5.0",
93+
"vite-plugin-dts": "^3.6.3",
8594
"vue": "^3.3.8",
8695
"vue-tsc": "1.9.0-alpha.3"
8796
}

Diff for: pnpm-lock.yaml

+81-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: scripts/cleanup.js

-6
This file was deleted.

Diff for: tsconfig.build.json

-25
This file was deleted.

Diff for: vite.config.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Plugin, mergeConfig } from 'vite'
2+
import dts from 'vite-plugin-dts'
23
import base from './vite.preview.config'
34

45
const genStub: Plugin = {
@@ -14,7 +15,12 @@ const genStub: Plugin = {
1415
}
1516

1617
export default mergeConfig(base, {
17-
plugins: [genStub],
18+
plugins: [
19+
dts({
20+
rollupTypes: true,
21+
}),
22+
genStub,
23+
],
1824
optimizeDeps: {
1925
// avoid late discovered deps
2026
include: [

0 commit comments

Comments
 (0)