这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: add experimental dts rollup using @microsoft/api-extractor #983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ If you have multiple entry files, each entry will get a corresponding `.d.ts` fi

Note that `--dts` does not resolve external (aka in `node_modules`) types used in the `.d.ts` file, if that's somehow a requirement, try the experimental `--dts-resolve` flag instead.

Since tsup version 7.4.0, you can also use `--experimental-dts` flag to generate declaration files. This flag use [@microsoft/api-extractor](https://www.npmjs.com/package/@microsoft/api-extractor) to generate declaration files, which is more reliable than the previous `--dts` flag. It's still experimental and we are looking for feedbacks.

To use `--experimental-dts`, you would need to install `@microsoft/api-extractor`, as it's a peer dependency of tsup:

```bash
npm i @microsoft/api-extractor -D
# Or Yarn
yarn add @microsoft/api-extractor --dev
```

#### Emit declaration file only

The `--dts-only` flag is the equivalent of the `emitDeclarationOnly` option in `tsc`. Using this flag will only emit the declaration file, without the JavaScript files.
Expand Down Expand Up @@ -500,6 +510,8 @@ esbuild has [experimental CSS support](https://esbuild.github.io/content-types/#
To use PostCSS, you need to install PostCSS:

```bash
npm i postcss -D
# Or Yarn
yarn add postcss --dev
```

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"tree-kill": "^1.2.2"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.38.3",
"@rollup/plugin-json": "6.0.1",
"@swc/core": "1.2.218",
"@types/debug": "4.1.7",
Expand Down Expand Up @@ -74,6 +75,7 @@
},
"peerDependencies": {
"@swc/core": "^1",
"@microsoft/api-extractor": "^7.36.0",
"postcss": "^8.4.12",
"typescript": ">=4.5.0"
},
Expand All @@ -86,6 +88,9 @@
},
"@swc/core": {
"optional": true
},
"@microsoft/api-extractor": {
"optional": true
}
},
"engines": {
Expand Down
Loading