Skip to content

Commit c21ee10

Browse files
authored
Merge branch 'main' into unbuild-migration
2 parents b0b663b + e818037 commit c21ee10

File tree

21 files changed

+206
-118
lines changed

21 files changed

+206
-118
lines changed

docs/guide/cleaning.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Cleaning
22

3-
<!-- TODO enable clean by default -->
3+
By default, `tsdown` will **clean the output directory** (`outDir`) before each build. This ensures that any files from previous builds are removed, preventing outdated or unused files from remaining in your output.
44

5-
By default, `tsdown` does not clean the output folder for you. This means that if your bundling process generates files with different names compared to a previous build, the older files will remain in the output directory.
6-
7-
To ensure the output directory is cleaned before building, you can use the `--clean` option:
5+
If you want to disable this behavior and keep existing files in the output directory, you can use the `--no-clean` option:
86

97
```bash
10-
tsdown --clean
8+
tsdown --no-clean
119
```
1210

1311
> [!NOTE]
14-
> Using the `--clean` option will remove all files in the output directory before the build process begins. Make sure this behavior aligns with your project requirements to avoid accidentally deleting important files.
12+
> By default, all files in the output directory will be removed before the build process begins. Make sure this behavior aligns with your project requirements to avoid accidentally deleting important files.

docs/guide/dts.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ If you encounter any issues related to `.d.ts` generation, please report them di
1212

1313
## Enabling dts Generation
1414

15-
You can enable `.d.ts` generation using the `--dts` option in the CLI or by setting `dts: true` in your configuration file.
15+
If your `package.json` contains a `types` or `typings` field, declaration file generation will be **enabled by default** in `tsdown`.
16+
17+
You can also explicitly enable `.d.ts` generation using the `--dts` option in the CLI or by setting `dts: true` in your configuration file.
1618

1719
### CLI
1820

docs/guide/migrate-from-tsup.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[tsup](https://tsup.egoist.dev/) is a powerful and widely-used bundler that shares many similarities with `tsdown`. While `tsup` is built on top of [esbuild](https://esbuild.github.io/), `tsdown` leverages the power of [Rolldown](https://rolldown.rs/) to deliver a **faster** and more **powerful** bundling experience.
44

5+
## Migration Guide
6+
57
If you're currently using `tsup` and want to migrate to `tsdown`, the process is straightforward thanks to the dedicated `migrate` command:
68

79
```bash
@@ -20,6 +22,22 @@ The `migrate` command supports the following options to customize the migration
2022

2123
With these options, you can easily tailor the migration process to fit your specific project setup.
2224

25+
## Differences from tsup
26+
27+
While `tsdown` aims to be highly compatible with `tsup`, there are some differences to be aware of:
28+
29+
### Default Values
30+
31+
- **`format`**: Defaults to `esm`.
32+
- **`clean`**: Enabled by default and will clean the `outDir` before each build.
33+
- **`dts`**: Automatically enabled if your `package.json` contains a `typings` or `types` field.
34+
35+
### Feature Gaps
36+
37+
Some features available in `tsup` are not yet implemented in `tsdown`. If you find an option missing that you need, please [open an issue](https://github.com/rolldown/tsdown/issues) to let us know your requirements.
38+
39+
Please review your configuration after migration to ensure it matches your expectations.
40+
2341
## Acknowledgements
2442

2543
`tsdown` would not have been possible without the inspiration and contributions of the open-source community. We would like to express our heartfelt gratitude to the following:

docs/zh-CN/guide/cleaning.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# 清理
22

3-
<!-- TODO enable clean by default -->
3+
默认情况下,`tsdown` 会在每次构建之前**清理输出目录**`outDir`)。这可以确保移除之前构建中生成的文件,防止过时或未使用的文件留在输出目录中。
44

5-
默认情况下,`tsdown` 不会自动清理输出文件夹。这意味着,如果您的打包过程生成的文件名与之前的构建不同,旧的文件将会保留在输出目录中。
6-
7-
为了在构建之前清理输出目录,您可以使用 `--clean` 选项:
5+
如果您希望禁用此行为并保留输出目录中的现有文件,可以使用 `--no-clean` 选项:
86

97
```bash
10-
tsdown --clean
8+
tsdown --no-clean
119
```
1210

13-
> [!NOTE]
14-
> 使用 `--clean` 选项会在构建过程开始之前删除输出目录中的所有文件。请确保此行为符合您的项目需求,以避免意外删除重要文件。
11+
> [!NOTE]
12+
> 默认情况下,输出目录中的所有文件将在构建过程开始之前被删除。请确保此行为符合您的项目需求,以避免意外删除重要文件。

docs/zh-CN/guide/dts.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
## 启用 dts 生成
1414

15-
您可以通过 CLI 中的 `--dts` 选项或在配置文件中设置 `dts: true` 来启用 `.d.ts` 生成。
15+
如果您的 `package.json` 中包含 `types``typings` 字段,`tsdown`**默认启用**声明文件的生成。
16+
17+
您还可以通过 CLI 中的 `--dts` 选项或在配置文件中设置 `dts: true` 来显式启用 `.d.ts` 文件的生成。
1618

1719
### CLI
1820

docs/zh-CN/guide/migrate-from-tsup.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[tsup](https://tsup.egoist.dev/) 是一个功能强大且广泛使用的打包器,与 `tsdown` 有许多相似之处。虽然 `tsup` 构建于 [esbuild](https://esbuild.github.io/) 之上,`tsdown` 则利用了 [Rolldown](https://rolldown.rs/) 的强大功能,提供了更**快速**且更**强大**的打包体验。
44

5+
## 迁移指南
6+
57
如果您当前正在使用 `tsup` 并希望迁移到 `tsdown`,迁移过程非常简单,因为 `tsdown` 提供了专门的 `migrate` 命令:
68

79
```bash
@@ -20,6 +22,22 @@ npx tsdown migrate
2022

2123
通过这些选项,您可以轻松调整迁移过程以适应您的特定项目设置。
2224

25+
## 与 tsup 的区别
26+
27+
虽然 `tsdown` 旨在与 `tsup` 高度兼容,但仍有一些差异需要注意:
28+
29+
### 默认值
30+
31+
- **`format`**:默认值为 `esm`
32+
- **`clean`**:默认启用,每次构建前会清理 `outDir`
33+
- **`dts`**:如果您的 `package.json` 中包含 `typings``types` 字段,则会自动启用。
34+
35+
### 功能差距
36+
37+
`tsdown` 尚未实现 `tsup` 中的某些功能。如果您发现缺少某些您需要的选项,请 [提交问题](https://github.com/rolldown/tsdown/issues) 告诉我们您的需求。
38+
39+
迁移后,请仔细检查您的配置以确保其符合您的预期。
40+
2341
## 致谢
2442

2543
`tsdown` 的诞生离不开开源社区的启发和贡献。我们衷心感谢以下项目和个人:

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sxzz/tsdown",
3-
"version": "0.9.9",
3+
"version": "0.10.0",
44
"exports": "./src/index.ts",
55
"publish": {
66
"include": [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tsdown",
3-
"version": "0.9.9",
3+
"version": "0.10.0",
44
"packageManager": "[email protected]",
55
"description": "The Elegant Bundler for Libraries",
66
"type": "module",

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ catalogs:
3939
hookable: ^5.5.3
4040
lightningcss: ^1.29.3
4141
rolldown: 1.0.0-beta.8-commit.151352b
42-
rolldown-plugin-dts: ^0.9.4
42+
rolldown-plugin-dts: ^0.9.5
4343
tinyexec: ^1.0.1
4444
tinyglobby: ^0.2.13
4545
unconfig: ^7.3.2

0 commit comments

Comments
 (0)