Skip to content

Commit

Permalink
refactor: generate dts by vite plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Nov 19, 2023
1 parent 6b7d9b7 commit df1a0fc
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 98 deletions.
56 changes: 0 additions & 56 deletions api-extractor.json

This file was deleted.

21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,41 @@
"files": [
"dist"
],
"types": "dist/repl.d.ts",
"types": "dist/vue-repl.d.ts",
"exports": {
".": {
"types": "./dist/repl.d.ts",
"types": "./dist/vue-repl.d.ts",
"import": "./dist/vue-repl.js",
"require": "./dist/ssr-stub.js"
},
"./monaco-editor": {
"types": "./dist/editor-types.d.ts",
"types": "./dist/monaco-editor.d.ts",
"import": "./dist/monaco-editor.js",
"require": null
},
"./codemirror-editor": {
"types": "./dist/editor-types.d.ts",
"types": "./dist/codemirror-editor.d.ts",
"import": "./dist/codemirror-editor.js",
"require": null
},
"./style.css": "./dist/style.css",
"./dist/style.css": "./dist/style.css"
},
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"scripts": {
"dev": "vite",
"build": "vite build",
"build-types": "vue-tsc -p tsconfig.build.json && api-extractor run -c api-extractor.json && node scripts/cleanup.js",
"build-preview": "vite build -c vite.preview.config.ts",
"format": "prettier --write .",
"release": "bumpp -r",
"prepublishOnly": "npm run build && npm run build-types"
"prepublishOnly": "npm run build"
},
"simple-git-hooks": {
"pre-commit": "pnpm exec lint-staged --concurrent false"
Expand All @@ -58,7 +65,6 @@
"homepage": "https://github.com/vuejs/repl#readme",
"devDependencies": {
"@babel/types": "^7.23.3",
"@microsoft/api-extractor": "^7.38.3",
"@rollup/plugin-replace": "^5.0.5",
"@types/codemirror": "^5.60.13",
"@types/node": "^20.9.0",
Expand All @@ -82,6 +88,7 @@
"sucrase": "^3.34.0",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite-plugin-dts": "^3.6.3",
"vue": "^3.3.8",
"vue-tsc": "1.9.0-alpha.3"
}
Expand Down
84 changes: 81 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions scripts/cleanup.js

This file was deleted.

25 changes: 0 additions & 25 deletions tsconfig.build.json

This file was deleted.

8 changes: 7 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Plugin, mergeConfig } from 'vite'
import dts from 'vite-plugin-dts'
import base from './vite.preview.config'

const genStub: Plugin = {
Expand All @@ -14,7 +15,12 @@ const genStub: Plugin = {
}

export default mergeConfig(base, {
plugins: [genStub],
plugins: [
dts({
rollupTypes: true,
}),
genStub,
],
optimizeDeps: {
// avoid late discovered deps
include: [
Expand Down

0 comments on commit df1a0fc

Please sign in to comment.