Skip to content

Commit 5c51303

Browse files
committed
docs: add umd format
1 parent eb4fb78 commit 5c51303

File tree

7 files changed

+7
-3
lines changed

7 files changed

+7
-3
lines changed

docs/guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For more details, refer to the [Plugins](../advanced/plugins.md) documentation.
2424

2525
- **TypeScript and JavaScript**: Seamlessly bundle `.ts` and `.js` files with support for modern syntax and features.
2626
- **TypeScript Declarations**: Automatically generate declaration files (`.d.ts`) for your library.
27-
- **Multiple Output Formats**: Generate `esm`, `cjs`, and `iife` bundles to ensure compatibility across different environments.
27+
- **Multiple Output Formats**: Generate `esm`, `cjs`, `iife`, and `umd` bundles to ensure compatibility across different environments.
2828
- **Assets**: Include and process non-code assets like `.json` or `.wasm` files.
2929

3030
With its built-in support for [tree shaking](../options/tree-shaking.md), [minification](../options/minification.md), and [source maps](../options/sourcemap.md), `tsdown` ensures your library is optimized for production.

docs/options/output-format.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tsdown --format esm # default
1111
- [`esm`](https://nodejs.org/api/esm.html): ECMAScript Module format, ideal for modern JavaScript environments, including browsers and Node.js.
1212
- [`cjs`](https://nodejs.org/api/modules.html): CommonJS format, commonly used in Node.js projects.
1313
- [`iife`](https://developer.mozilla.org/en-US/docs/Glossary/IIFE): Immediately Invoked Function Expression, suitable for embedding in `<script>` tags or standalone browser usage.
14+
- [`umd`](https://github.com/umdjs/umd): Universal Module Definition, a format that works on AMD, CommonJS, and global variables.
1415

1516
### Example
1617

docs/reference/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Define the bundle format. Supported formats include:
3939
- `esm` (ECMAScript Modules)
4040
- `cjs` (CommonJS)
4141
- `iife` (Immediately Invoked Function Expression)
42+
- `umd` (Universal Module Definition)
4243

4344
See also [Output Format](../options/output-format.md).
4445

docs/zh-CN/guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
- **TypeScript 和 JavaScript**:无缝打包 `.ts``.js` 文件,支持现代语法和特性。
2626
- **TypeScript 声明文件**:自动为您的库生成声明文件(`.d.ts`)。
27-
- **多种输出格式**:生成 `esm``cjs``iife` 格式的包,确保兼容不同的运行环境。
27+
- **多种输出格式**:生成 `esm``cjs``iife``umd` 格式的包,确保兼容不同的运行环境。
2828
- **资源文件**:支持包含和处理非代码资源文件,如 `.json``.wasm`
2929

3030
通过内置的除屑优化、压缩和源映射支持,`tsdown` 确保您的库为生产环境做好了充分优化。

docs/zh-CN/options/output-format.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tsdown --format esm # 默认
1111
- [`esm`](https://nodejs.org/api/esm.html):ECMAScript 模块格式,适用于包括浏览器和 Node.js 在内的现代 JavaScript 环境。
1212
- [`cjs`](https://nodejs.org/api/modules.html):CommonJS 格式,常用于 Node.js 项目。
1313
- [`iife`](https://developer.mozilla.org/zh-CN/docs/Glossary/IIFE):立即调用函数表达式,适合嵌入 `<script>` 标签或独立的浏览器使用场景。
14+
- [`umd`](https://github.com/umdjs/umd):通用模块定义(Universal Module Definition),一种兼容 AMD、CommonJS 以及全局变量的模块格式。
1415

1516
### 示例
1617

docs/zh-CN/reference/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ tsdown --tsconfig tsconfig.build.json
3939
- `esm`(ECMAScript 模块)
4040
- `cjs`(CommonJS)
4141
- `iife`(立即调用函数表达式)
42+
- `umd`(通用模块定义)
4243

4344
另请参阅 [输出格式](../options/output-format.md)
4445

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cli
1818
})
1919
.option('-c, --config <filename>', 'Use a custom config file')
2020
.option('--no-config', 'Disable config file')
21-
.option('-f, --format <format>', 'Bundle format: esm, cjs, iife', {
21+
.option('-f, --format <format>', 'Bundle format: esm, cjs, iife, umd', {
2222
default: 'esm',
2323
})
2424
.option('--clean', 'Clean output directory, --no-clean to disable')

0 commit comments

Comments
 (0)