From edcc0a18f79bf7b7b52cf57b656f3fc88e01feea Mon Sep 17 00:00:00 2001 From: Gugustinette <63470020+Gugustinette@users.noreply.github.com> Date: Sun, 20 Apr 2025 00:55:12 +0300 Subject: [PATCH 01/24] docs: init documentation (#112) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Triumph-light <2495685883@qq.com> Co-authored-by: 三咲智子 Kevin Deng --- .gitignore | 3 + README.md | 2 +- assets/logo.svg | 1 - docs/.vitepress/config/index.ts | 69 + docs/.vitepress/config/theme.ts | 137 ++ docs/.vitepress/i18n/composable.ts | 7 + docs/.vitepress/i18n/translate-map.ts | 27 + docs/.vitepress/i18n/utils.ts | 9 + docs/.vitepress/scripts/docs-generate.sh | 35 + docs/.vitepress/theme/custom.css | 19 + docs/.vitepress/theme/index.ts | 5 + docs/_redirects | 1 - docs/api-examples.md | 55 + docs/guide/cleaning.md | 14 + docs/guide/config-file.md | 49 + docs/guide/getting-started.md | 126 ++ docs/guide/index.md | 13 + docs/guide/migrate-from-tsup.md | 28 + docs/guide/minification.md | 47 + docs/guide/output-directory.md | 22 + docs/guide/output-format.md | 29 + docs/guide/platform.md | 33 + docs/guide/silent-mode.md | 9 + docs/guide/sourcemap.md | 13 + docs/guide/target.md | 36 + docs/guide/tree-shaking.md | 73 + docs/guide/watch-mode.md | 35 + docs/index.md | 63 + docs/public/lightning-down.svg | 19 + .../public/og-image.svg | 0 docs/public/tsdown.svg | 22 + docs/reference/cli.md | 1 + docs/reference/config-options.md | 316 ++++ docs/reference/type-aliases/Sourcemap.md | 5 + docs/zh-CN/guide/cleaning.md | 14 + docs/zh-CN/guide/config-file.md | 49 + docs/zh-CN/guide/getting-started.md | 126 ++ docs/zh-CN/guide/index.md | 13 + docs/zh-CN/guide/migrate-from-tsup.md | 28 + docs/zh-CN/guide/minification.md | 47 + docs/zh-CN/guide/output-directory.md | 22 + docs/zh-CN/guide/output-format.md | 29 + docs/zh-CN/guide/platform.md | 33 + docs/zh-CN/guide/silent-mode.md | 9 + docs/zh-CN/guide/sourcemap.md | 13 + docs/zh-CN/guide/target.md | 36 + docs/zh-CN/guide/tree-shaking.md | 73 + docs/zh-CN/guide/watch-mode.md | 35 + docs/zh-CN/index.md | 64 + docs/zh-CN/reference/cli.md | 1 + docs/zh-CN/reference/config-options.md | 1 + package.json | 11 +- pnpm-lock.yaml | 1627 ++++++++++++++++- typedoc.json | 6 + 54 files changed, 3546 insertions(+), 14 deletions(-) delete mode 100644 assets/logo.svg create mode 100644 docs/.vitepress/config/index.ts create mode 100644 docs/.vitepress/config/theme.ts create mode 100644 docs/.vitepress/i18n/composable.ts create mode 100644 docs/.vitepress/i18n/translate-map.ts create mode 100644 docs/.vitepress/i18n/utils.ts create mode 100755 docs/.vitepress/scripts/docs-generate.sh create mode 100644 docs/.vitepress/theme/custom.css create mode 100644 docs/.vitepress/theme/index.ts delete mode 100644 docs/_redirects create mode 100644 docs/api-examples.md create mode 100644 docs/guide/cleaning.md create mode 100644 docs/guide/config-file.md create mode 100644 docs/guide/getting-started.md create mode 100644 docs/guide/index.md create mode 100644 docs/guide/migrate-from-tsup.md create mode 100644 docs/guide/minification.md create mode 100644 docs/guide/output-directory.md create mode 100644 docs/guide/output-format.md create mode 100644 docs/guide/platform.md create mode 100644 docs/guide/silent-mode.md create mode 100644 docs/guide/sourcemap.md create mode 100644 docs/guide/target.md create mode 100644 docs/guide/tree-shaking.md create mode 100644 docs/guide/watch-mode.md create mode 100644 docs/index.md create mode 100644 docs/public/lightning-down.svg rename assets/header-illustration.svg => docs/public/og-image.svg (100%) create mode 100644 docs/public/tsdown.svg create mode 100644 docs/reference/cli.md create mode 100644 docs/reference/config-options.md create mode 100644 docs/reference/type-aliases/Sourcemap.md create mode 100644 docs/zh-CN/guide/cleaning.md create mode 100644 docs/zh-CN/guide/config-file.md create mode 100644 docs/zh-CN/guide/getting-started.md create mode 100644 docs/zh-CN/guide/index.md create mode 100644 docs/zh-CN/guide/migrate-from-tsup.md create mode 100644 docs/zh-CN/guide/minification.md create mode 100644 docs/zh-CN/guide/output-directory.md create mode 100644 docs/zh-CN/guide/output-format.md create mode 100644 docs/zh-CN/guide/platform.md create mode 100644 docs/zh-CN/guide/silent-mode.md create mode 100644 docs/zh-CN/guide/sourcemap.md create mode 100644 docs/zh-CN/guide/target.md create mode 100644 docs/zh-CN/guide/tree-shaking.md create mode 100644 docs/zh-CN/guide/watch-mode.md create mode 100644 docs/zh-CN/index.md create mode 100644 docs/zh-CN/reference/cli.md create mode 100644 docs/zh-CN/reference/config-options.md create mode 100644 typedoc.json diff --git a/.gitignore b/.gitignore index 628c2d1ad..127e37222 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ dist .eslintcache temp + +docs/.vitepress/dist +docs/.vitepress/cache diff --git a/README.md b/README.md index cbeea9614..704fa2237 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -tsdown
+tsdown
# tsdown [![npm](https://img.shields.io/npm/v/tsdown.svg)](https://npmjs.com/package/tsdown) [![Unit Test](https://github.com/rolldown/tsdown/actions/workflows/tests.yml/badge.svg)](https://github.com/rolldown/tsdown/actions/workflows/tests.yml) [![JSR](https://jsr.io/badges/@sxzz/tsdown)](https://jsr.io/@sxzz/tsdown) diff --git a/assets/logo.svg b/assets/logo.svg deleted file mode 100644 index 3d0db8248..000000000 --- a/assets/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts new file mode 100644 index 000000000..efdfd1b4a --- /dev/null +++ b/docs/.vitepress/config/index.ts @@ -0,0 +1,69 @@ +import { defineConfig } from 'vitepress' +import { + groupIconMdPlugin, + groupIconVitePlugin, + localIconLoader, +} from 'vitepress-plugin-group-icons' +import llmstxt from 'vitepress-plugin-llms' +import { getLocaleConfig } from './theme' + +// https://vitepress.dev/reference/site-config +export default defineConfig({ + locales: { + root: getLocaleConfig('en'), + 'zh-CN': getLocaleConfig('zh-CN'), + }, + + lastUpdated: true, + cleanUrls: true, + themeConfig: { + search: { + provider: 'local', + options: { + locales: { + 'zh-CN': { + translations: { + button: { + buttonText: '搜索文档', + buttonAriaLabel: '搜索文档', + }, + modal: { + noResultsText: '无法找到相关结果', + resetButtonTitle: '清除查询条件', + footer: { + selectText: '选择', + navigateText: '切换', + closeText: '关闭', + }, + }, + }, + }, + }, + }, + }, + }, + + vite: { + plugins: [ + groupIconVitePlugin({ + customIcon: { + rolldown: localIconLoader( + import.meta.url, + '../../public/lightning-down.svg', + ), + }, + }) as any, + llmstxt({ + ignoreFiles: ['index.md', 'README.md'], + description: 'tsdown is an even faster bundler powered by Rolldown.', + details: '', + }), + ], + }, + + markdown: { + config(md) { + md.use(groupIconMdPlugin) + }, + }, +}) diff --git a/docs/.vitepress/config/theme.ts b/docs/.vitepress/config/theme.ts new file mode 100644 index 000000000..5d262baf1 --- /dev/null +++ b/docs/.vitepress/config/theme.ts @@ -0,0 +1,137 @@ +import { createTranslate } from '../i18n/utils' +import type { DefaultTheme, HeadConfig, LocaleConfig } from 'vitepress' + +export function getLocaleConfig(lang: string) { + const t = createTranslate(lang) + + const urlPrefix = lang && lang !== 'en' ? (`/${lang}` as const) : '' + const title = t('tsdown') + const titleTemplate = ':title - The Elegant Bundler for Libraries' + const description = t('The Elegant Bundler for Libraries.') + + const head: HeadConfig[] = [ + [ + 'link', + { + rel: 'icon', + type: 'image/svg+xml', + href: '/tsdown.svg', + }, + ], + ['meta', { name: 'theme-color', content: '#ff7e17' }], + ['meta', { property: 'og:type', content: 'website' }], + ['meta', { property: 'og:locale', content: 'en' }], + [ + 'meta', + { + property: 'og:title', + content: `tsdown | ${description}`, + }, + ], + [ + 'meta', + { + property: 'og:image', + content: 'https://tsdown.dev/og-image.png', + }, + ], + ['meta', { property: 'og:site_name', content: 'Rolldown' }], + ['meta', { property: 'og:url', content: 'https://rolldown.rs/' }], + ['meta', { name: 'twitter:card', content: 'summary_large_image' }], + ['meta', { name: 'twitter:site', content: '@rolldown_rs' }], + ] + + const nav: DefaultTheme.NavItem[] = [ + { text: t('Home'), link: `${urlPrefix}/` }, + { text: t('Guide'), link: `${urlPrefix}/guide/` }, + { + text: t('API Reference'), + link: `${urlPrefix}/reference/config-options.md`, + }, + ] + + const sidebar: DefaultTheme.SidebarItem[] = [ + { + base: `${urlPrefix}/guide`, + items: [ + { + text: t('Guide'), + items: [ + { text: t('Introduction'), link: '/index.md' }, + { text: t('Getting Started'), link: '/getting-started.md' }, + { text: t('Migrate from tsup'), link: '/migrate-from-tsup.md' }, + ], + }, + { + text: t('Recipes'), + items: [ + { text: t('Cleaning'), link: '/cleaning.md' }, + { text: t('Config file'), link: '/config-file.md' }, + { text: t('Minification'), link: '/minification.md' }, + { text: t('Output directory'), link: '/output-directory.md' }, + { text: t('Output format'), link: '/output-format.md' }, + { text: t('Platform'), link: '/platform.md' }, + { text: t('Silent mode'), link: '/silent-mode.md' }, + { text: t('Sourcemap'), link: '/sourcemap.md' }, + { text: t('Target'), link: '/target.md' }, + { text: t('Tree shaking'), link: '/tree-shaking.md' }, + { text: t('Watch Mode'), link: '/watch-mode.md' }, + ], + }, + ], + }, + { + text: t('API Reference'), + base: `${urlPrefix}/reference`, + items: [ + { text: t('Config Options'), link: '/config-options.md' }, + { text: t('Command Line Interface'), link: '/cli.md' }, + ], + }, + ] + + const themeConfig: DefaultTheme.Config = { + logo: { src: '/tsdown.svg', width: 24, height: 24 }, + nav, + sidebar, + outline: 'deep', + socialLinks: [ + { icon: 'github', link: 'https://github.com/rolldown/tsdown' }, + { icon: 'npm', link: 'https://npmjs.com/package/tsdown' }, + { icon: 'jsr', link: 'https://jsr.io/@sxzz/tsdown' }, + ], + footer: { + message: 'Released under the MIT License.', + copyright: 'Copyright © 2025-present VoidZero Inc.', + }, + } + + if (lang === 'zh-CN') { + Object.assign(themeConfig, { + outline: { + label: '页面导航', + }, + lastUpdatedText: '最后更新于', + darkModeSwitchLabel: '外观', + sidebarMenuLabel: '目录', + returnToTopLabel: '返回顶部', + langMenuLabel: '选择语言', + docFooter: { + prev: '上一页', + next: '下一页', + }, + } satisfies DefaultTheme.Config) + } + + const localeConfig: LocaleConfig[string] = { + label: t('English'), + lang: t('en'), + title, + titleTemplate, + description, + head, + themeConfig, + } + + return localeConfig +} diff --git a/docs/.vitepress/i18n/composable.ts b/docs/.vitepress/i18n/composable.ts new file mode 100644 index 000000000..f1b50e649 --- /dev/null +++ b/docs/.vitepress/i18n/composable.ts @@ -0,0 +1,7 @@ +import { useData } from 'vitepress' +import { t } from './utils' + +export function useTranslate(lang?: string) { + const { lang: vpLang } = useData() + return (key: string) => t(key, lang || vpLang.value) +} diff --git a/docs/.vitepress/i18n/translate-map.ts b/docs/.vitepress/i18n/translate-map.ts new file mode 100644 index 000000000..b1faf151a --- /dev/null +++ b/docs/.vitepress/i18n/translate-map.ts @@ -0,0 +1,27 @@ +export const zhCN = { + Home: '首页', + Guide: '指南', + 'API Reference': 'API 参考', + Introduction: '介绍', + 'Getting Started': '快速上手', + 'Multiple builds': '多构建', + 'Config Options': '配置选项', + 'Command Line Interface': '命令行接口', + + Author: '作者', + 'Kevin Deng': '三咲智子 Kevin Deng', + 'Team member': '团队成员', + 'Logo Designer': 'Logo 设计者', + 'Sponsored by': '赞助者', + 'Thanks to all the contributors!': '感谢所有的贡献者!', + + 'An even faster bundler powered by Rolldown.': + '由 RollDown 赋能的更快打包工具。', + + English: '简体中文', + en: 'zh-CN', +} + +export const translateMap: Record> = { + 'zh-CN': zhCN, +} diff --git a/docs/.vitepress/i18n/utils.ts b/docs/.vitepress/i18n/utils.ts new file mode 100644 index 000000000..4b4381731 --- /dev/null +++ b/docs/.vitepress/i18n/utils.ts @@ -0,0 +1,9 @@ +import { translateMap } from './translate-map' + +export function t(key: string, lang: string) { + return translateMap[lang]?.[key] || key +} + +export function createTranslate(lang: string) { + return (key: string) => t(key, lang) +} diff --git a/docs/.vitepress/scripts/docs-generate.sh b/docs/.vitepress/scripts/docs-generate.sh new file mode 100755 index 000000000..d3615d484 --- /dev/null +++ b/docs/.vitepress/scripts/docs-generate.sh @@ -0,0 +1,35 @@ +# docs:generate + +echo "📚 Generating reference..." + +# Generate API documentation +./node_modules/.bin/typedoc --tsconfig tsconfig.json > /dev/null 2>&1 + +echo "✅ Reference generated successfully!" + +echo "📚 Beautifying reference structure..." + +# Move Options.md to ./docs/reference +mv ./docs/reference/api/interfaces/Options.md ./docs/reference/config-options.md + +# Remove the type-aliases folder if it exists +if [ -d "./docs/reference/type-aliases" ]; then + rm -rf ./docs/reference/type-aliases +fi +# Create the type-aliases folder +mkdir -p ./docs/reference/type-aliases +# Move types-aliases/Sourcemap.md to ./docs/reference/type-aliases +mv ./docs/reference/api/type-aliases/Sourcemap.md ./docs/reference/type-aliases/Sourcemap.md + +# Remove the api folder +rm -rf ./docs/reference/api + +# In config-options.md, remove 6 first lines +sed -i '' '1,6d' ./docs/reference/config-options.md +# In config-options.md, replace "../type-aliases" with "./type-aliases" +sed -i '' 's/..\/type-aliases/.\/type-aliases/g' ./docs/reference/config-options.md + +# In type-aliases files, remove 6 first lines +sed -i '' '1,6d' ./docs/reference/type-aliases/*.md + +echo "✅ Reference structure beautified successfully!" diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css new file mode 100644 index 000000000..7772f158e --- /dev/null +++ b/docs/.vitepress/theme/custom.css @@ -0,0 +1,19 @@ +:root { + --vp-c-brand-1: #ff7e17; + --vp-c-brand-2: #ff8700; + --vp-c-brand-3: #e37800; + --vp-code-color: #333; + --vp-button-brand-bg: #ff7e17; + + /* Hero Background Image */ + --vp-home-hero-image-background-image: linear-gradient( + -45deg, + rgba(255, 149, 0, 0.4) 40%, + rgba(48, 115, 122, 0.2) 50% + ); + --vp-home-hero-image-filter: blur(44px); +} + +.dark { + --vp-code-color: #fff; +} diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts new file mode 100644 index 000000000..095f1ef7c --- /dev/null +++ b/docs/.vitepress/theme/index.ts @@ -0,0 +1,5 @@ +import DefaultTheme from 'vitepress/theme' +import './custom.css' +import 'virtual:group-icons.css' + +export default DefaultTheme diff --git a/docs/_redirects b/docs/_redirects deleted file mode 100644 index 68b6ba0ca..000000000 --- a/docs/_redirects +++ /dev/null @@ -1 +0,0 @@ -/* https://github.com/rolldown/tsdown diff --git a/docs/api-examples.md b/docs/api-examples.md new file mode 100644 index 000000000..691df9cc7 --- /dev/null +++ b/docs/api-examples.md @@ -0,0 +1,55 @@ +--- +outline: deep +--- + +# Runtime API Examples + +This page demonstrates usage of some of the runtime APIs provided by VitePress. + +The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: + +```md + + +## Results + +### Theme Data + +
{{ theme }}
+ +### Page Data + +
{{ page }}
+ +### Page Frontmatter + +
{{ frontmatter }}
+``` + + + +## Results + +### Theme Data + +
{{ theme }}
+ +### Page Data + +
{{ page }}
+ +### Page Frontmatter + +
{{ frontmatter }}
+ +## More + +Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/docs/guide/cleaning.md b/docs/guide/cleaning.md new file mode 100644 index 000000000..293875373 --- /dev/null +++ b/docs/guide/cleaning.md @@ -0,0 +1,14 @@ +# Cleaning + + + +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. + +To ensure the output directory is cleaned before building, you can use the `--clean` option: + +```bash +tsdown --clean +``` + +> [!NOTE] +> 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. diff --git a/docs/guide/config-file.md b/docs/guide/config-file.md new file mode 100644 index 000000000..579e8ca62 --- /dev/null +++ b/docs/guide/config-file.md @@ -0,0 +1,49 @@ +# Config File + +By default, `tsdown` will search for a configuration file by looking in the current working directory and traversing upward through parent directories until it finds one. It supports the following file names: + +- `tsdown.config.ts` +- `tsdown.config.mts` +- `tsdown.config.cts` +- `tsdown.config.js` +- `tsdown.config.mjs` +- `tsdown.config.cjs` +- `tsdown.config.json` +- `tsdown.config` + +Additionally, you can define your configuration directly in the `tsdown` field of your `package.json` file. + +### Specifying a Custom Config File + +If your configuration file is located elsewhere or has a different name, you can specify its path using the `--config` (or `-c`) option: + +```bash +tsdown --config ./path/to/config +``` + +### Disabling the Config File + +To disable loading a configuration file entirely, use the `--no-config` option: + +```bash +tsdown --no-config +``` + +This is useful if you want to rely solely on command-line options or default settings. + +### Extending Vite or Vitest Config (Experimental) + +`tsdown` provides an **experimental** feature to extend your existing Vite or Vitest configuration files. This allows you to reuse specific configuration options, such as `resolve` and `plugins`, while ignoring others that are not relevant to `tsdown`. + +To enable this feature, use the `--from-vite` option: + +```bash +tsdown --from-vite # Load vite.config.* +tsdown --from-vite vitest # Load vitest.config.* +``` + +> [!WARNING] +> This feature is **experimental** and may not support all Vite or Vitest configuration options. Only specific options, such as `resolve` and `plugins`, are reused. Use with caution and test thoroughly in your project. + +> [!TIP] +> Extending Vite or Vitest configurations can save time and effort if your project already uses these tools, allowing you to build upon your existing setup without duplicating configuration. diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md new file mode 100644 index 000000000..c03652bcb --- /dev/null +++ b/docs/guide/getting-started.md @@ -0,0 +1,126 @@ +# Getting Started + +:::warning 🚧 Beta Software +[Rolldown](https://rolldown.rs) is currently in beta status. While it can already handle most production use cases, there may still be bugs and rough edges. Most notably, the built-in minification feature is still a work in progress. +::: + +## Installation + +Install `tsdown` as a development dependency using your preferred package manager: + +::: code-group + +```sh [npm] +npm install -D tsdown +``` + +```sh [pnpm] +pnpm add -D tsdown +``` + +```sh [yarn] +yarn add -D tsdown +``` + +```sh [bun] +bun add -D tsdown +``` + +::: + +## Using the CLI + +To verify that `tsdown` is installed correctly, run the following command in your project directory: + +```sh +./node_modules/.bin/tsdown --version +``` + +You can also explore the available CLI options and examples with: + +```sh +./node_modules/.bin/tsdown --help +``` + +### Your First Bundle + +Let's create two source TypeScript files: + +```ts [src/index.ts] +import { hello } from './hello.ts' + +hello() +``` + +```ts [src/hello.ts] +export function hello() { + console.log('Hello tsdown!') +} +``` + +Next, initialize the `tsdown` configuration file: + +```ts [tsdown.config.ts] +import { defineConfig } from 'tsdown' + +export default defineConfig({ + entry: ['./src'], +}) +``` + +Now, run the following command to bundle your code: + +```sh +./node_modules/.bin/tsdown +``` + +You should see the bundled output written to `dist/index.mjs`. To verify it works, run the output file: + +```sh +node dist/index.mjs +``` + +You should see the message `Hello tsdown!` printed to the console. + +### Using the CLI in npm Scripts + +To simplify the command, you can add it to your `package.json` scripts: + +```json{5} [package.json] +{ + "name": "my-tsdown-project", + "type": "module", + "scripts": { + "build": "tsdown" + }, + "devDependencies": { + "tsdown": "^0.6.10" + } +} +``` + +Now, you can build your project with: + +```sh +npm run build +``` + +## Using the Config File + +While you can use the CLI directly, it's recommended to use a configuration file for more complex projects. This allows you to define and manage your build settings in a centralized and reusable way. + +For more details, refer to the [Config File](./config-file.md) documentation. + +## Using Plugins (TODO) + +TODO link to another page + +## Using Watch Mode + +You can enable watch mode to automatically rebuild your project whenever files change. This is particularly useful during development to streamline your workflow. Use the `--watch` (or `-w`) option: + +```bash +tsdown --watch +``` + +For more details, refer to the [Watch Mode](./watch-mode.md) documentation. diff --git a/docs/guide/index.md b/docs/guide/index.md new file mode 100644 index 000000000..7e6c66376 --- /dev/null +++ b/docs/guide/index.md @@ -0,0 +1,13 @@ +# Introduction + +## Why tsdown + +Rolldown is... + +tsdown aims to... + +More in-depth information about Rolldown, the bundler that powers tsdown : https://rolldown.rs/guide/ + +## tsdown's Feature Scope + +## Credits diff --git a/docs/guide/migrate-from-tsup.md b/docs/guide/migrate-from-tsup.md new file mode 100644 index 000000000..300cb2880 --- /dev/null +++ b/docs/guide/migrate-from-tsup.md @@ -0,0 +1,28 @@ +# Migrate from tsup + +[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. + +If you're currently using `tsup` and want to migrate to `tsdown`, the process is straightforward thanks to the dedicated `migrate` command: + +```bash +npx tsdown migrate +``` + +> [!WARNING] +> Please save your changes before migration. The migration process may modify your configuration files, so it's important to ensure all your changes are committed or backed up beforehand. + +### Migration Options + +The `migrate` command supports the following options to customize the migration process: + +- `--cwd ` (or `-c`): Specify the working directory for the migration. +- `--dry-run` (or `-d`): Perform a dry run to preview the migration without making any changes. + +With these options, you can easily tailor the migration process to fit your specific project setup. + +## Acknowledgements + +`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: + +- **[tsup](https://tsup.egoist.dev/)**: `tsdown` was heavily inspired by `tsup`, and even incorporates parts of its codebase. The simplicity and efficiency of `tsup` served as a guiding light during the development of `tsdown`. +- **[@egoist](https://github.com/egoist)**: The creator of `tsup`, whose work has significantly influenced the JavaScript and TypeScript tooling ecosystem. Thank you for your dedication and contributions to the community. diff --git a/docs/guide/minification.md b/docs/guide/minification.md new file mode 100644 index 000000000..037932d35 --- /dev/null +++ b/docs/guide/minification.md @@ -0,0 +1,47 @@ +# Minification + +Minification is the process of compressing your code to reduce its size and improve performance by removing unnecessary characters, such as whitespace, comments, and unused code. + +You can enable minification in `tsdown` using the `--minify` option: + +```bash +tsdown --minify +``` + +### Example + +Given the following input code: + +```ts [src/index.ts] +const x = 1 + +function hello(x: number) { + console.log('Hello World') + console.log(x) +} + +hello(x) +``` + +Here are the two possible outputs, depending on whether minification is enabled: + +::: code-group + +```js [dist/index.mjs (without --minify)] +//#region src/index.ts +const x = 1 +function hello(x$1) { + console.log('Hello World') + console.log(x$1) +} +hello(x) + +//#endregion +``` + + +```js [dist/index.mjs (with --minify)] +const e=1;function t(e){console.log(`Hello World`),console.log(e)}t(e); +``` + +::: diff --git a/docs/guide/output-directory.md b/docs/guide/output-directory.md new file mode 100644 index 000000000..edcb3ba4e --- /dev/null +++ b/docs/guide/output-directory.md @@ -0,0 +1,22 @@ +# Output Directory + +By default, `tsdown` bundles your code into the `dist` directory located in the current working folder. + +If you want to customize the output directory, you can use the `--out-dir` (or `-d`) option: + +```bash +tsdown -d ./custom-output +``` + +### Example + +```bash +# Default behavior: outputs to ./dist +tsdown + +# Custom output directory: outputs to ./build +tsdown -d ./build +``` + +> [!NOTE] +> The specified output directory will be created if it does not already exist. Ensure the directory path aligns with your project structure to avoid overwriting unintended files. diff --git a/docs/guide/output-format.md b/docs/guide/output-format.md new file mode 100644 index 000000000..9a719ba90 --- /dev/null +++ b/docs/guide/output-format.md @@ -0,0 +1,29 @@ +# Output Format + +By default, `tsdown` generates JavaScript code in the [ESM](https://nodejs.org/api/esm.html) (ECMAScript Module) format. However, you can specify the desired output format using the `--format` option: + +```bash +tsdown --format esm # default +``` + +### Available Formats + +- [`esm`](https://nodejs.org/api/esm.html): ECMAScript Module format, ideal for modern JavaScript environments, including browsers and Node.js. +- [`cjs`](https://nodejs.org/api/modules.html): CommonJS format, commonly used in Node.js projects. +- [`iife`](https://developer.mozilla.org/en-US/docs/Glossary/IIFE): Immediately Invoked Function Expression, suitable for embedding in ` - -## Results - -### Theme Data - -
{{ theme }}
- -### Page Data - -
{{ page }}
- -### Page Frontmatter - -
{{ frontmatter }}
-``` - - - -## Results - -### Theme Data - -
{{ theme }}
- -### Page Data - -
{{ page }}
- -### Page Frontmatter - -
{{ frontmatter }}
- -## More - -Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/docs/reference/config-options.md b/docs/reference/config-options.md index 1883d895f..a60ce7b82 100644 --- a/docs/reference/config-options.md +++ b/docs/reference/config-options.md @@ -1,6 +1,6 @@ # Interface: Options -Defined in: [options.ts:38](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L38) +Defined in: [options.ts:38](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L38) Options for tsdown. @@ -10,7 +10,7 @@ Options for tsdown. > `optional` **alias**: `Record`\<`string`, `string`\> -Defined in: [options.ts:48](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L48) +Defined in: [options.ts:48](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L48) *** @@ -18,7 +18,7 @@ Defined in: [options.ts:48](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **clean**: `boolean` \| `string`[] -Defined in: [options.ts:66](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L66) +Defined in: [options.ts:66](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L66) *** @@ -26,7 +26,7 @@ Defined in: [options.ts:66](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **config**: `string` \| `boolean` -Defined in: [options.ts:102](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L102) +Defined in: [options.ts:102](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L102) Config file path @@ -36,7 +36,7 @@ Config file path > `optional` **define**: `Record`\<`string`, `string`\> -Defined in: [options.ts:70](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L70) +Defined in: [options.ts:70](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L70) *** @@ -44,7 +44,7 @@ Defined in: [options.ts:70](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **dts**: `boolean` \| `Options` -Defined in: [options.ts:125](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L125) +Defined in: [options.ts:125](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L125) Emit declaration files @@ -54,7 +54,7 @@ Emit declaration files > `optional` **entry**: `InputOption` -Defined in: [options.ts:40](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L40) +Defined in: [options.ts:40](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L40) *** @@ -62,7 +62,7 @@ Defined in: [options.ts:40](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **external**: `ExternalOption` -Defined in: [options.ts:41](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L41) +Defined in: [options.ts:41](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L41) *** @@ -70,7 +70,7 @@ Defined in: [options.ts:41](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **fixedExtension**: `boolean` -Defined in: [options.ts:80](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L80) +Defined in: [options.ts:80](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L80) Use a fixed extension for output files. The extension will always be `.cjs` or `.mjs`. @@ -88,7 +88,7 @@ false > `optional` **format**: `ModuleFormat` \| `ModuleFormat`[] -Defined in: [options.ts:61](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L61) +Defined in: [options.ts:61](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L61) #### Default @@ -102,7 +102,7 @@ Defined in: [options.ts:61](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **fromVite**: `boolean` \| `"vitest"` -Defined in: [options.ts:119](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L119) +Defined in: [options.ts:119](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L119) Reuse config from Vite or Vitest (experimental) @@ -118,7 +118,7 @@ false > `optional` **globalName**: `string` -Defined in: [options.ts:62](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L62) +Defined in: [options.ts:62](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L62) *** @@ -126,7 +126,7 @@ Defined in: [options.ts:62](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **inputOptions**: `InputOptions` \| (`options`, `format`) => `Awaitable`\<`null` \| `void` \| `InputOptions`\> -Defined in: [options.ts:52](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L52) +Defined in: [options.ts:52](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L52) *** @@ -134,7 +134,7 @@ Defined in: [options.ts:52](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **minify**: `boolean` -Defined in: [options.ts:68](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L68) +Defined in: [options.ts:68](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L68) #### Default @@ -148,7 +148,7 @@ false > `optional` **noExternal**: `Arrayable`\<`string` \| `RegExp`\> \| (`id`, `importer`) => `undefined` \| `null` \| `boolean` \| `void` -Defined in: [options.ts:42](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L42) +Defined in: [options.ts:42](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L42) *** @@ -156,7 +156,7 @@ Defined in: [options.ts:42](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **onSuccess**: `string` \| (`config`) => `void` \| `Promise`\<`void`\> -Defined in: [options.ts:108](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L108) +Defined in: [options.ts:108](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L108) You can specify command to be executed after a successful build, specially useful for Watch mode @@ -166,7 +166,7 @@ You can specify command to be executed after a successful build, specially usefu > `optional` **outDir**: `string` -Defined in: [options.ts:64](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L64) +Defined in: [options.ts:64](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L64) #### Default @@ -180,7 +180,7 @@ Defined in: [options.ts:64](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **outExtensions**: `OutExtensionFactory` -Defined in: [options.ts:85](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L85) +Defined in: [options.ts:85](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L85) Custom extensions for output files. `fixedExtension` will be overridden by this option. @@ -191,7 +191,7 @@ Custom extensions for output files. > `optional` **outputOptions**: `OutputOptions` \| (`options`, `format`) => `Awaitable`\<`null` \| `void` \| `OutputOptions`\> -Defined in: [options.ts:87](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L87) +Defined in: [options.ts:87](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L87) *** @@ -199,7 +199,7 @@ Defined in: [options.ts:87](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **platform**: `"node"` \| `"neutral"` \| `"browser"` -Defined in: [options.ts:51](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L51) +Defined in: [options.ts:51](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L51) #### Default @@ -213,7 +213,7 @@ Defined in: [options.ts:51](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **plugins**: `RolldownPluginOption` -Defined in: [options.ts:96](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L96) +Defined in: [options.ts:96](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L96) *** @@ -221,7 +221,7 @@ Defined in: [options.ts:96](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **publint**: `boolean` \| `Options` -Defined in: [options.ts:137](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L137) +Defined in: [options.ts:137](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L137) Run publint after bundling. Requires `publint` to be installed. @@ -232,7 +232,7 @@ Requires `publint` to be installed. > `optional` **shims**: `boolean` -Defined in: [options.ts:72](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L72) +Defined in: [options.ts:72](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L72) #### Default @@ -246,7 +246,7 @@ false > `optional` **silent**: `boolean` -Defined in: [options.ts:98](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L98) +Defined in: [options.ts:98](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L98) *** @@ -254,7 +254,7 @@ Defined in: [options.ts:98](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **skipNodeModulesBundle**: `boolean` -Defined in: [options.ts:113](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L113) +Defined in: [options.ts:113](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L113) Skip bundling node_modules. @@ -264,7 +264,7 @@ Skip bundling node_modules. > `optional` **sourcemap**: [`Sourcemap`](./type-aliases/Sourcemap.md) -Defined in: [options.ts:65](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L65) +Defined in: [options.ts:65](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L65) *** @@ -272,7 +272,7 @@ Defined in: [options.ts:65](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **target**: `string` \| `string`[] -Defined in: [options.ts:69](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L69) +Defined in: [options.ts:69](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L69) *** @@ -280,7 +280,7 @@ Defined in: [options.ts:69](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **treeshake**: `boolean` -Defined in: [options.ts:95](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L95) +Defined in: [options.ts:95](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L95) #### Default @@ -294,7 +294,7 @@ true > `optional` **tsconfig**: `string` \| `boolean` -Defined in: [options.ts:49](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L49) +Defined in: [options.ts:49](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L49) *** @@ -302,7 +302,7 @@ Defined in: [options.ts:49](https://github.com/Gugustinette/tsdown/blob/2ce523f8 > `optional` **unused**: `boolean` \| `Options` -Defined in: [options.ts:131](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L131) +Defined in: [options.ts:131](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L131) Enable unused dependencies check with `unplugin-unused` Requires `unplugin-unused` to be installed. @@ -313,4 +313,4 @@ Requires `unplugin-unused` to be installed. > `optional` **watch**: `string` \| `boolean` \| `string`[] -Defined in: [options.ts:103](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L103) +Defined in: [options.ts:103](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L103) diff --git a/docs/reference/type-aliases/Sourcemap.md b/docs/reference/type-aliases/Sourcemap.md index 399f6ba43..94214e874 100644 --- a/docs/reference/type-aliases/Sourcemap.md +++ b/docs/reference/type-aliases/Sourcemap.md @@ -2,4 +2,4 @@ > **Sourcemap** = `boolean` \| `"inline"` \| `"hidden"` -Defined in: [options.ts:33](https://github.com/Gugustinette/tsdown/blob/2ce523f833303854aa7798ff7bd0a1b8fe201394/src/options.ts#L33) +Defined in: [options.ts:33](https://github.com/rolldown/tsdown/blob/150ab92d4d55f0eb5013f6af9e6e741b481d1447/src/options.ts#L33) From 3d2693a16f73640eb3181c263378f78958dd99d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 20 Apr 2025 06:30:07 +0800 Subject: [PATCH 03/24] fix style --- docs/.vitepress/config/theme.ts | 16 +++---- docs/.vitepress/i18n/translate-map.ts | 29 +++++++---- docs/.vitepress/theme/custom.css | 22 +++++++++ docs/index.md | 27 ++--------- docs/zh-CN/index.md | 69 +++++++++++---------------- 5 files changed, 81 insertions(+), 82 deletions(-) diff --git a/docs/.vitepress/config/theme.ts b/docs/.vitepress/config/theme.ts index 5d262baf1..fedb4ea3b 100644 --- a/docs/.vitepress/config/theme.ts +++ b/docs/.vitepress/config/theme.ts @@ -6,8 +6,8 @@ export function getLocaleConfig(lang: string) { const urlPrefix = lang && lang !== 'en' ? (`/${lang}` as const) : '' const title = t('tsdown') - const titleTemplate = ':title - The Elegant Bundler for Libraries' - const description = t('The Elegant Bundler for Libraries.') + const description = t('The Elegant Bundler for Libraries') + const titleTemplate = `:title - ${description}` const head: HeadConfig[] = [ [ @@ -66,15 +66,15 @@ export function getLocaleConfig(lang: string) { text: t('Recipes'), items: [ { text: t('Cleaning'), link: '/cleaning.md' }, - { text: t('Config file'), link: '/config-file.md' }, + { text: t('Config File'), link: '/config-file.md' }, { text: t('Minification'), link: '/minification.md' }, - { text: t('Output directory'), link: '/output-directory.md' }, - { text: t('Output format'), link: '/output-format.md' }, + { text: t('Output Directory'), link: '/output-directory.md' }, + { text: t('Output Format'), link: '/output-format.md' }, { text: t('Platform'), link: '/platform.md' }, - { text: t('Silent mode'), link: '/silent-mode.md' }, - { text: t('Sourcemap'), link: '/sourcemap.md' }, + { text: t('Silent Mode'), link: '/silent-mode.md' }, + { text: t('Source Map'), link: '/sourcemap.md' }, { text: t('Target'), link: '/target.md' }, - { text: t('Tree shaking'), link: '/tree-shaking.md' }, + { text: t('Tree-shaking'), link: '/tree-shaking.md' }, { text: t('Watch Mode'), link: '/watch-mode.md' }, ], }, diff --git a/docs/.vitepress/i18n/translate-map.ts b/docs/.vitepress/i18n/translate-map.ts index b1faf151a..539944e52 100644 --- a/docs/.vitepress/i18n/translate-map.ts +++ b/docs/.vitepress/i18n/translate-map.ts @@ -1,22 +1,31 @@ export const zhCN = { + // nav Home: '首页', Guide: '指南', 'API Reference': 'API 参考', + + // sidebar Introduction: '介绍', 'Getting Started': '快速上手', - 'Multiple builds': '多构建', + 'Migrate from tsup': ' 从 tsup 迁移', + + Recipes: 'Recipes', // TODO + Cleaning: '清理', + 'Config File': '配置文件', + Minification: '压缩', + 'Output Directory': '输出目录', + 'Output Format': '输出格式', + Platform: '运行平台(Platform)', + 'Silent Mode': '静默模式', + 'Source Map': '源映射(Source Map)', + Target: '构建目标(Target)', + 'Tree-shaking': '除屑优化(Tree-shaking)', + 'Watch Mode': '监听模式(Watch Mode)', + 'Config Options': '配置选项', 'Command Line Interface': '命令行接口', - Author: '作者', - 'Kevin Deng': '三咲智子 Kevin Deng', - 'Team member': '团队成员', - 'Logo Designer': 'Logo 设计者', - 'Sponsored by': '赞助者', - 'Thanks to all the contributors!': '感谢所有的贡献者!', - - 'An even faster bundler powered by Rolldown.': - '由 RollDown 赋能的更快打包工具。', + 'The Elegant Bundler for Libraries': '优雅的库打包器', English: '简体中文', en: 'zh-CN', diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 7772f158e..010ea33bb 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -12,8 +12,30 @@ rgba(48, 115, 122, 0.2) 50% ); --vp-home-hero-image-filter: blur(44px); + + --vp-home-hero-name-color: transparent; + --vp-home-hero-name-background: -webkit-linear-gradient( + 90deg, + #ff7e17, + rgb(84, 218, 233) + ); } .dark { --vp-code-color: #fff; } + +.voidzero-img { + display: block; + width: 300px; + height: 74px; + margin: 30px auto -20px; + background-image: url(https://voidzero.dev/logo.svg); + background-repeat: no-repeat; + background-size: auto 74px; + background-position: center; +} + +.dark .voidzero-img { + background-image: url(https://voidzero.dev/logo-white.svg); +} diff --git a/docs/index.md b/docs/index.md index ed13fa938..b894f7f13 100644 --- a/docs/index.md +++ b/docs/index.md @@ -28,32 +28,13 @@ features:

Brought to you by

- + - From e9642b3deaec697a4948e5709c1e2f1aa346a4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 20 Apr 2025 06:39:06 +0800 Subject: [PATCH 04/24] fix logo size --- docs/index.md | 9 ++------- docs/public/og-image.svg | 2 +- docs/public/tsdown.svg | 23 +---------------------- docs/zh-CN/index.md | 17 ++++++----------- 4 files changed, 10 insertions(+), 41 deletions(-) diff --git a/docs/index.md b/docs/index.md index b894f7f13..7517a10ce 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,7 +5,7 @@ layout: home hero: name: 'tsdown' text: 'The Elegant
Library bundler' - tagline: powered on Rolldown + tagline: Powered by Rolldown image: src: /tsdown.svg alt: tsdown @@ -14,7 +14,7 @@ hero: text: Get Started link: /guide/ - theme: alt - text: Reference + text: API Reference link: /reference/config-options.md features: @@ -36,9 +36,4 @@ features: padding-top: 60px; border: none; } - -.VPImage { - height: 80%; - width: 80%; -} diff --git a/docs/public/og-image.svg b/docs/public/og-image.svg index 2d81158db..4a36071bf 100644 --- a/docs/public/og-image.svg +++ b/docs/public/og-image.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/docs/public/tsdown.svg b/docs/public/tsdown.svg index ae7c43632..1e1feb4e1 100644 --- a/docs/public/tsdown.svg +++ b/docs/public/tsdown.svg @@ -1,22 +1 @@ - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/docs/zh-CN/index.md b/docs/zh-CN/index.md index 0958f36eb..c1df96d10 100644 --- a/docs/zh-CN/index.md +++ b/docs/zh-CN/index.md @@ -4,18 +4,18 @@ layout: home hero: name: 'tsdown' - text: 'The Elegant
Library bundler' - tagline: powered on Rolldown + text: 优雅的
库打包工具 + tagline: 由 Rolldown 驱动 image: src: /tsdown.svg alt: tsdown actions: - theme: brand - text: Get Started - link: /guide/ + text: 开始使用 + link: /zh-CN/guide/ - theme: alt - text: Reference - link: /reference/config-options.md + text: API 参考 + link: /zh-CN/reference/config-options.md features: - title: Speed of Rust @@ -43,9 +43,4 @@ features: font-size: 24px; font-weight: 600; } - -.VPImage { - height: 80%; - width: 80%; -} From 32cc3973c51e5994872d5ff4c441dc124caf5a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 20 Apr 2025 06:52:51 +0800 Subject: [PATCH 05/24] zh-CN translate --- docs/.vitepress/i18n/translate-map.ts | 4 +- docs/index.md | 2 +- docs/zh-CN/guide/cleaning.md | 8 +- docs/zh-CN/guide/config-file.md | 30 +- docs/zh-CN/guide/getting-started.md | 50 +-- docs/zh-CN/guide/migrate-from-tsup.md | 26 +- docs/zh-CN/guide/minification.md | 16 +- docs/zh-CN/guide/output-directory.md | 14 +- docs/zh-CN/guide/output-format.md | 24 +- docs/zh-CN/guide/platform.md | 26 +- docs/zh-CN/guide/silent-mode.md | 6 +- docs/zh-CN/guide/sourcemap.md | 10 +- docs/zh-CN/guide/target.md | 28 +- docs/zh-CN/guide/tree-shaking.md | 24 +- docs/zh-CN/guide/watch-mode.md | 22 +- docs/zh-CN/reference/cli.md | 2 +- docs/zh-CN/reference/config-options.md | 317 +++++++++++++++++- .../zh-CN/reference/type-aliases/Sourcemap.md | 5 + 18 files changed, 467 insertions(+), 147 deletions(-) create mode 100644 docs/zh-CN/reference/type-aliases/Sourcemap.md diff --git a/docs/.vitepress/i18n/translate-map.ts b/docs/.vitepress/i18n/translate-map.ts index 539944e52..d291c3da2 100644 --- a/docs/.vitepress/i18n/translate-map.ts +++ b/docs/.vitepress/i18n/translate-map.ts @@ -9,7 +9,7 @@ export const zhCN = { 'Getting Started': '快速上手', 'Migrate from tsup': ' 从 tsup 迁移', - Recipes: 'Recipes', // TODO + Recipes: '实践指南', Cleaning: '清理', 'Config File': '配置文件', Minification: '压缩', @@ -20,7 +20,7 @@ export const zhCN = { 'Source Map': '源映射(Source Map)', Target: '构建目标(Target)', 'Tree-shaking': '除屑优化(Tree-shaking)', - 'Watch Mode': '监听模式(Watch Mode)', + 'Watch Mode': '监听模式', 'Config Options': '配置选项', 'Command Line Interface': '命令行接口', diff --git a/docs/index.md b/docs/index.md index 7517a10ce..98e3bb64f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ layout: home hero: name: 'tsdown' - text: 'The Elegant
Library bundler' + text: 'The Elegant
Library Bundler' tagline: Powered by Rolldown image: src: /tsdown.svg diff --git a/docs/zh-CN/guide/cleaning.md b/docs/zh-CN/guide/cleaning.md index 293875373..967f3afce 100644 --- a/docs/zh-CN/guide/cleaning.md +++ b/docs/zh-CN/guide/cleaning.md @@ -1,14 +1,14 @@ -# Cleaning +# 清理 -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. +默认情况下,`tsdown` 不会自动清理输出文件夹。这意味着,如果您的打包过程生成的文件名与之前的构建不同,旧的文件将会保留在输出目录中。 -To ensure the output directory is cleaned before building, you can use the `--clean` option: +为了在构建之前清理输出目录,您可以使用 `--clean` 选项: ```bash tsdown --clean ``` > [!NOTE] -> 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. +> 使用 `--clean` 选项会在构建过程开始之前删除输出目录中的所有文件。请确保此行为符合您的项目需求,以避免意外删除重要文件。 diff --git a/docs/zh-CN/guide/config-file.md b/docs/zh-CN/guide/config-file.md index 579e8ca62..d90ea545a 100644 --- a/docs/zh-CN/guide/config-file.md +++ b/docs/zh-CN/guide/config-file.md @@ -1,6 +1,6 @@ -# Config File +# 配置文件 -By default, `tsdown` will search for a configuration file by looking in the current working directory and traversing upward through parent directories until it finds one. It supports the following file names: +默认情况下,`tsdown` 会在当前工作目录中查找配置文件,并向上遍历父目录直到找到一个配置文件。它支持以下文件名: - `tsdown.config.ts` - `tsdown.config.mts` @@ -11,39 +11,39 @@ By default, `tsdown` will search for a configuration file by looking in the curr - `tsdown.config.json` - `tsdown.config` -Additionally, you can define your configuration directly in the `tsdown` field of your `package.json` file. +此外,您还可以直接在 `package.json` 文件的 `tsdown` 字段中定义配置。 -### Specifying a Custom Config File +### 指定自定义配置文件 -If your configuration file is located elsewhere or has a different name, you can specify its path using the `--config` (or `-c`) option: +如果您的配置文件位于其他位置或具有不同的名称,可以使用 `--config`(或 `-c`)选项指定其路径: ```bash tsdown --config ./path/to/config ``` -### Disabling the Config File +### 禁用配置文件 -To disable loading a configuration file entirely, use the `--no-config` option: +如果您希望完全禁用加载配置文件,可以使用 `--no-config` 选项: ```bash tsdown --no-config ``` -This is useful if you want to rely solely on command-line options or default settings. +这在您希望仅依赖命令行选项或默认设置时非常有用。 -### Extending Vite or Vitest Config (Experimental) +### 扩展 Vite 或 Vitest 配置(实验性功能) -`tsdown` provides an **experimental** feature to extend your existing Vite or Vitest configuration files. This allows you to reuse specific configuration options, such as `resolve` and `plugins`, while ignoring others that are not relevant to `tsdown`. +`tsdown` 提供了一个**实验性**功能,允许您扩展现有的 Vite 或 Vitest 配置文件。通过此功能,您可以重用特定的配置选项(如 `resolve` 和 `plugins`),同时忽略与 `tsdown` 无关的其他选项。 -To enable this feature, use the `--from-vite` option: +要启用此功能,请使用 `--from-vite` 选项: ```bash -tsdown --from-vite # Load vite.config.* -tsdown --from-vite vitest # Load vitest.config.* +tsdown --from-vite # 加载 vite.config.* +tsdown --from-vite vitest # 加载 vitest.config.* ``` > [!WARNING] -> This feature is **experimental** and may not support all Vite or Vitest configuration options. Only specific options, such as `resolve` and `plugins`, are reused. Use with caution and test thoroughly in your project. +> 此功能为 **实验性功能**,可能并不支持所有 Vite 或 Vitest 的配置选项。仅特定选项(如 `resolve` 和 `plugins`)会被重用。请谨慎使用,并在您的项目中充分测试。 > [!TIP] -> Extending Vite or Vitest configurations can save time and effort if your project already uses these tools, allowing you to build upon your existing setup without duplicating configuration. +> 如果您的项目已经使用了 Vite 或 Vitest,扩展其配置可以节省时间和精力,让您在现有设置的基础上构建,而无需重复配置。 diff --git a/docs/zh-CN/guide/getting-started.md b/docs/zh-CN/guide/getting-started.md index c03652bcb..baff3c336 100644 --- a/docs/zh-CN/guide/getting-started.md +++ b/docs/zh-CN/guide/getting-started.md @@ -1,12 +1,12 @@ -# Getting Started +# 快速上手 -:::warning 🚧 Beta Software -[Rolldown](https://rolldown.rs) is currently in beta status. While it can already handle most production use cases, there may still be bugs and rough edges. Most notably, the built-in minification feature is still a work in progress. +:::warning 🚧 Beta 软件 +[Rolldown](https://rolldown.rs) 当前处于测试版状态。虽然它已经可以处理大多数生产环境的使用场景,但可能仍然存在一些漏洞和不完善之处。特别是,内置的压缩功能仍在开发中。 ::: -## Installation +## 安装 -Install `tsdown` as a development dependency using your preferred package manager: +使用您喜欢的包管理器将 `tsdown` 安装为开发依赖: ::: code-group @@ -28,23 +28,23 @@ bun add -D tsdown ::: -## Using the CLI +## 使用 CLI -To verify that `tsdown` is installed correctly, run the following command in your project directory: +要验证 `tsdown` 是否正确安装,请在项目目录中运行以下命令: ```sh ./node_modules/.bin/tsdown --version ``` -You can also explore the available CLI options and examples with: +您还可以通过以下命令查看可用的 CLI 选项和示例: ```sh ./node_modules/.bin/tsdown --help ``` -### Your First Bundle +### 创建您的第一个打包 -Let's create two source TypeScript files: +首先,创建两个源 TypeScript 文件: ```ts [src/index.ts] import { hello } from './hello.ts' @@ -58,7 +58,7 @@ export function hello() { } ``` -Next, initialize the `tsdown` configuration file: +接下来,初始化 `tsdown` 配置文件: ```ts [tsdown.config.ts] import { defineConfig } from 'tsdown' @@ -68,23 +68,23 @@ export default defineConfig({ }) ``` -Now, run the following command to bundle your code: +现在,运行以下命令来打包您的代码: ```sh ./node_modules/.bin/tsdown ``` -You should see the bundled output written to `dist/index.mjs`. To verify it works, run the output file: +您应该会看到打包后的输出文件写入到 `dist/index.mjs`。为了验证它是否正常工作,运行输出文件: ```sh node dist/index.mjs ``` -You should see the message `Hello tsdown!` printed to the console. +您应该会在控制台中看到消息 `Hello tsdown!`。 -### Using the CLI in npm Scripts +### 在 npm 脚本中使用 CLI -To simplify the command, you can add it to your `package.json` scripts: +为了简化命令,您可以将其添加到 `package.json` 的脚本中: ```json{5} [package.json] { @@ -99,28 +99,28 @@ To simplify the command, you can add it to your `package.json` scripts: } ``` -Now, you can build your project with: +现在,您可以通过以下命令构建项目: ```sh npm run build ``` -## Using the Config File +## 使用配置文件 -While you can use the CLI directly, it's recommended to use a configuration file for more complex projects. This allows you to define and manage your build settings in a centralized and reusable way. +虽然可以直接使用 CLI,但对于更复杂的项目,推荐使用配置文件。这可以让您以集中且可复用的方式定义和管理构建设置。 -For more details, refer to the [Config File](./config-file.md) documentation. +有关更多详细信息,请参阅 [配置文件](./config-file.md) 文档。 -## Using Plugins (TODO) +## 使用插件(TODO) -TODO link to another page +TODO 链接到其他页面 -## Using Watch Mode +## 使用监听模式 -You can enable watch mode to automatically rebuild your project whenever files change. This is particularly useful during development to streamline your workflow. Use the `--watch` (or `-w`) option: +您可以启用监听模式,在文件更改时自动重新构建项目。这在开发过程中非常有用,可以简化您的工作流程。使用 `--watch`(或 `-w`)选项: ```bash tsdown --watch ``` -For more details, refer to the [Watch Mode](./watch-mode.md) documentation. +有关更多详细信息,请参阅 [监听模式](./watch-mode.md) 文档。 diff --git a/docs/zh-CN/guide/migrate-from-tsup.md b/docs/zh-CN/guide/migrate-from-tsup.md index 300cb2880..568c35fe3 100644 --- a/docs/zh-CN/guide/migrate-from-tsup.md +++ b/docs/zh-CN/guide/migrate-from-tsup.md @@ -1,28 +1,28 @@ -# Migrate from tsup +# 从 tsup 迁移 -[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. +[tsup](https://tsup.egoist.dev/) 是一个功能强大且广泛使用的打包器,与 `tsdown` 有许多相似之处。虽然 `tsup` 构建于 [esbuild](https://esbuild.github.io/) 之上,`tsdown` 则利用了 [Rolldown](https://rolldown.rs/) 的强大功能,提供了更**快速**且更**强大**的打包体验。 -If you're currently using `tsup` and want to migrate to `tsdown`, the process is straightforward thanks to the dedicated `migrate` command: +如果您当前正在使用 `tsup` 并希望迁移到 `tsdown`,迁移过程非常简单,因为 `tsdown` 提供了专门的 `migrate` 命令: ```bash npx tsdown migrate ``` > [!WARNING] -> Please save your changes before migration. The migration process may modify your configuration files, so it's important to ensure all your changes are committed or backed up beforehand. +> 在迁移之前,请保存您的更改。迁移过程可能会修改您的配置文件,因此请确保所有更改已提交或备份。 -### Migration Options +### 迁移选项 -The `migrate` command supports the following options to customize the migration process: +`migrate` 命令支持以下选项,用于自定义迁移过程: -- `--cwd ` (or `-c`): Specify the working directory for the migration. -- `--dry-run` (or `-d`): Perform a dry run to preview the migration without making any changes. +- `--cwd `(或 `-c`):指定迁移的工作目录。 +- `--dry-run`(或 `-d`):执行预览迁移(dry run),不会进行任何实际更改。 -With these options, you can easily tailor the migration process to fit your specific project setup. +通过这些选项,您可以轻松调整迁移过程以适应您的特定项目设置。 -## Acknowledgements +## 致谢 -`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: +`tsdown` 的诞生离不开开源社区的启发和贡献。我们衷心感谢以下项目和个人: -- **[tsup](https://tsup.egoist.dev/)**: `tsdown` was heavily inspired by `tsup`, and even incorporates parts of its codebase. The simplicity and efficiency of `tsup` served as a guiding light during the development of `tsdown`. -- **[@egoist](https://github.com/egoist)**: The creator of `tsup`, whose work has significantly influenced the JavaScript and TypeScript tooling ecosystem. Thank you for your dedication and contributions to the community. +- **[tsup](https://tsup.egoist.dev/)**:`tsdown` 深受 `tsup` 的启发,甚至部分代码直接来源于 `tsup`。`tsup` 的简洁性和高效性在 `tsdown` 的开发过程中起到了重要的指导作用。 +- **[@egoist](https://github.com/egoist)**:`tsup` 的作者,其工作对 JavaScript 和 TypeScript 工具生态系统产生了深远的影响。感谢您对社区的奉献和贡献! diff --git a/docs/zh-CN/guide/minification.md b/docs/zh-CN/guide/minification.md index 037932d35..c3fab5988 100644 --- a/docs/zh-CN/guide/minification.md +++ b/docs/zh-CN/guide/minification.md @@ -1,16 +1,16 @@ -# Minification +# 压缩 -Minification is the process of compressing your code to reduce its size and improve performance by removing unnecessary characters, such as whitespace, comments, and unused code. +压缩是通过移除不必要的字符(如空格、注释和未使用的代码)来减少代码体积并提升性能的过程。 -You can enable minification in `tsdown` using the `--minify` option: +您可以通过在 `tsdown` 中使用 `--minify` 选项来启用代码压缩: ```bash tsdown --minify ``` -### Example +### 示例 -Given the following input code: +以下是输入代码: ```ts [src/index.ts] const x = 1 @@ -23,11 +23,11 @@ function hello(x: number) { hello(x) ``` -Here are the two possible outputs, depending on whether minification is enabled: +根据是否启用了压缩,输出代码可能如下: ::: code-group -```js [dist/index.mjs (without --minify)] +```js [dist/index.mjs (未使用 --minify)] //#region src/index.ts const x = 1 function hello(x$1) { @@ -40,7 +40,7 @@ hello(x) ``` -```js [dist/index.mjs (with --minify)] +```js [dist/index.mjs (使用 --minify)] const e=1;function t(e){console.log(`Hello World`),console.log(e)}t(e); ``` diff --git a/docs/zh-CN/guide/output-directory.md b/docs/zh-CN/guide/output-directory.md index edcb3ba4e..6f186764a 100644 --- a/docs/zh-CN/guide/output-directory.md +++ b/docs/zh-CN/guide/output-directory.md @@ -1,22 +1,22 @@ -# Output Directory +# 输出目录 -By default, `tsdown` bundles your code into the `dist` directory located in the current working folder. +默认情况下,`tsdown` 会将打包后的代码输出到当前工作目录下的 `dist` 文件夹中。 -If you want to customize the output directory, you can use the `--out-dir` (or `-d`) option: +如果您想自定义输出目录,可以使用 `--out-dir`(或 `-d`)选项: ```bash tsdown -d ./custom-output ``` -### Example +### 示例 ```bash -# Default behavior: outputs to ./dist +# 默认行为:输出到 ./dist tsdown -# Custom output directory: outputs to ./build +# 自定义输出目录:输出到 ./build tsdown -d ./build ``` > [!NOTE] -> The specified output directory will be created if it does not already exist. Ensure the directory path aligns with your project structure to avoid overwriting unintended files. +> 如果指定的输出目录不存在,将会自动创建。请确保目录路径与您的项目结构一致,以避免意外覆盖其他文件。 diff --git a/docs/zh-CN/guide/output-format.md b/docs/zh-CN/guide/output-format.md index 9a719ba90..206b0b1ca 100644 --- a/docs/zh-CN/guide/output-format.md +++ b/docs/zh-CN/guide/output-format.md @@ -1,29 +1,29 @@ -# Output Format +# 输出格式 -By default, `tsdown` generates JavaScript code in the [ESM](https://nodejs.org/api/esm.html) (ECMAScript Module) format. However, you can specify the desired output format using the `--format` option: +默认情况下,`tsdown` 会生成 [ESM](https://nodejs.org/api/esm.html)(ECMAScript 模块)格式的 JavaScript 代码。不过,您可以通过 `--format` 选项指定所需的输出格式: ```bash -tsdown --format esm # default +tsdown --format esm # 默认 ``` -### Available Formats +### 可用格式 -- [`esm`](https://nodejs.org/api/esm.html): ECMAScript Module format, ideal for modern JavaScript environments, including browsers and Node.js. -- [`cjs`](https://nodejs.org/api/modules.html): CommonJS format, commonly used in Node.js projects. -- [`iife`](https://developer.mozilla.org/en-US/docs/Glossary/IIFE): Immediately Invoked Function Expression, suitable for embedding in ` + + + + diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts index efdfd1b4a..b8190b073 100644 --- a/docs/.vitepress/config/index.ts +++ b/docs/.vitepress/config/index.ts @@ -1,10 +1,5 @@ import { defineConfig } from 'vitepress' -import { - groupIconMdPlugin, - groupIconVitePlugin, - localIconLoader, -} from 'vitepress-plugin-group-icons' -import llmstxt from 'vitepress-plugin-llms' +import { groupIconMdPlugin } from 'vitepress-plugin-group-icons' import { getLocaleConfig } from './theme' // https://vitepress.dev/reference/site-config @@ -43,24 +38,6 @@ export default defineConfig({ }, }, - vite: { - plugins: [ - groupIconVitePlugin({ - customIcon: { - rolldown: localIconLoader( - import.meta.url, - '../../public/lightning-down.svg', - ), - }, - }) as any, - llmstxt({ - ignoreFiles: ['index.md', 'README.md'], - description: 'tsdown is an even faster bundler powered by Rolldown.', - details: '', - }), - ], - }, - markdown: { config(md) { md.use(groupIconMdPlugin) diff --git a/docs/.vitepress/theme/Layout.vue b/docs/.vitepress/theme/Layout.vue new file mode 100644 index 000000000..1bfd218dc --- /dev/null +++ b/docs/.vitepress/theme/Layout.vue @@ -0,0 +1,12 @@ + + + diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 010ea33bb..6a9a9acd4 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -24,18 +24,3 @@ .dark { --vp-code-color: #fff; } - -.voidzero-img { - display: block; - width: 300px; - height: 74px; - margin: 30px auto -20px; - background-image: url(https://voidzero.dev/logo.svg); - background-repeat: no-repeat; - background-size: auto 74px; - background-position: center; -} - -.dark .voidzero-img { - background-image: url(https://voidzero.dev/logo-white.svg); -} diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 095f1ef7c..688e935ca 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,5 +1,11 @@ import DefaultTheme from 'vitepress/theme' +import Layout from './Layout.vue' + import './custom.css' import 'virtual:group-icons.css' +import 'uno.css' -export default DefaultTheme +export default { + ...DefaultTheme, + Layout, +} diff --git a/docs/index.md b/docs/index.md index 98e3bb64f..cae89d220 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,22 +18,22 @@ hero: link: /reference/config-options.md features: - - title: Speed of Rust + - icon: 🚀 + title: Blazing fast details: | - tsdown is powered on Rolldown, which handles tens of thousands of modules without breaking a sweat - - title: Easy to use - details: | - tsdown preconfigures everything you need to get started, so you can focus on writing code ---- + Build and generate .d.ts powered by Oxc and Rolldown, incredibly fast! -

Brought to you by

+ - icon: ♻️ + title: Powerful ecosystem + details: Support Rollup, Rolldown, unplugin plugins, and some Vite plugins. - + - icon: ️🛠️ + title: Easy to use + details: | + tsdown preconfigures everything you need to get started, so you can focus on writing code. - + - icon: 🔄 + title: Seamless migration + details: | + Compatible with tsup's main options and features, ensuring a smooth transition. +--- diff --git a/docs/uno.config.ts b/docs/uno.config.ts new file mode 100644 index 000000000..72b41613e --- /dev/null +++ b/docs/uno.config.ts @@ -0,0 +1,10 @@ +import { + defineConfig, + presetAttributify, + presetIcons, + presetWind3, +} from 'unocss' + +export default defineConfig({ + presets: [presetWind3(), presetAttributify(), presetIcons()], +}) diff --git a/docs/vite.config.ts b/docs/vite.config.ts new file mode 100644 index 000000000..860fbde5f --- /dev/null +++ b/docs/vite.config.ts @@ -0,0 +1,23 @@ +import UnoCSS from 'unocss/vite' +import { defineConfig } from 'vite' +import { + groupIconVitePlugin, + localIconLoader, +} from 'vitepress-plugin-group-icons' +import llmstxt from 'vitepress-plugin-llms' + +export default defineConfig({ + plugins: [ + UnoCSS(), + groupIconVitePlugin({ + customIcon: { + rolldown: localIconLoader(import.meta.url, 'public/lightning-down.svg'), + }, + }), + llmstxt({ + ignoreFiles: ['index.md', 'README.md'], + description: 'tsdown is an even faster bundler powered by Rolldown.', + details: '', + }) as any, + ], +}) diff --git a/docs/zh-CN/index.md b/docs/zh-CN/index.md index c1df96d10..4d8d29915 100644 --- a/docs/zh-CN/index.md +++ b/docs/zh-CN/index.md @@ -18,29 +18,19 @@ hero: link: /zh-CN/reference/config-options.md features: - - title: Speed of Rust - details: | - tsdown is powered on Rolldown, which handles tens of thousands of modules without breaking a sweat - - title: Easy to use - details: | - tsdown preconfigures everything you need to get started, so you can focus on writing code ---- + - icon: 🚀 + title: 极速构建 + details: 基于 Oxc 和 Rolldown 构建和生成 .d.ts,速度极快! -
- -
由 VoidZero 隆重推出
-
+ - icon: ♻️ + title: 强大的生态系统 + details: 支持 Rollup、Rolldown、unplugin 插件以及部分 Vite 插件。 - + - icon: 🔄 + title: 无缝迁移 + details: 兼容 tsup 的主要选项和功能,确保平滑过渡。 +--- diff --git a/package.json b/package.json index 2690e3e1a..7a8c89e65 100644 --- a/package.json +++ b/package.json @@ -100,13 +100,15 @@ "typedoc": "^0.28.2", "typedoc-plugin-markdown": "^4.6.2", "typescript": "~5.8.3", + "unocss": "^66.1.0-beta.12", "unplugin-ast": "^0.14.6", "unplugin-unused": "^0.4.4", "vite": "^6.3.2", "vitepress": "^1.6.3", "vitepress-plugin-group-icons": "^1.5.2", "vitepress-plugin-llms": "^1.1.0", - "vitest": "^3.1.1" + "vitest": "^3.1.1", + "vue": "^3.5.13" }, "engines": { "node": ">=18.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b6ff25c5..e7530b716 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,6 +93,9 @@ importers: typescript: specifier: ~5.8.3 version: 5.8.3 + unocss: + specifier: ^66.1.0-beta.12 + version: 66.1.0-beta.12(postcss@8.5.3)(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) unplugin-ast: specifier: ^0.14.6 version: 0.14.6 @@ -114,6 +117,9 @@ importers: vitest: specifier: ^3.1.1 version: 3.1.1(@types/debug@4.1.12)(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1) + vue: + specifier: ^3.5.13 + version: 3.5.13(typescript@5.8.3) packages: @@ -189,6 +195,10 @@ packages: resolution: {integrity: sha512-jXGzGBRUS0oywQwnaCA6mMDJO7LoC3dYSLsyNfIqxDR4SNGLhtg3je0Y31lc24OA4nYyKAYgVLtjfrpcpsWShg==} engines: {node: '>= 14.0.0'} + '@ampproject/remapping@2.3.0': + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} + '@antfu/install-pkg@1.0.0': resolution: {integrity: sha512-xvX6P/lo1B3ej0OsaErAjqgFYzYVcJpamjLAFLYh9vRJngBrMoUG7aVnrGTeqM7yxbyTD5p3F2+0/QUEh8Vzhw==} @@ -885,6 +895,9 @@ packages: resolution: {integrity: sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + '@publint/pack@0.1.2': resolution: {integrity: sha512-S+9ANAvUmjutrshV4jZjaiG8XQyuJIZ8a4utWmN/vW1sgQ9IfBnPndwkmQYw53QmouOIytT874u65HEmu6H5jw==} engines: {node: '>=18'} @@ -1219,6 +1232,92 @@ packages: '@ungap/structured-clone@1.3.0': resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} + '@unocss/astro@66.1.0-beta.12': + resolution: {integrity: sha512-zYvevDDmhNlMAxP4isyAK+byGoVfVqnbZPHJnbb7Hoj7+8uaz+D/byUKyRynynVZl3T13S+UesjNAcRyAQoXEg==} + peerDependencies: + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 + peerDependenciesMeta: + vite: + optional: true + + '@unocss/cli@66.1.0-beta.12': + resolution: {integrity: sha512-WWtuYPk/nZSn6j6p/2pLZodV4UaieefVaKtTFYnz+sRPJCErrG41UMkwvgyDBzuQNYn7xbbQ+Mnzbs+TeHGGIA==} + engines: {node: '>=14'} + hasBin: true + + '@unocss/config@66.1.0-beta.12': + resolution: {integrity: sha512-u0dcWKFK+DZQ6Z3Qim2qzj6I6tsdCwl8O86NRRNN4Yt0H9C7IHzYLykfo6jgFFxay47aUKCZevl+mNLPUktk9w==} + engines: {node: '>=14'} + + '@unocss/core@66.1.0-beta.12': + resolution: {integrity: sha512-8+KJAoqA7eHC5cBJtod1AqWqQbYKfhTvQEgVQzZJ2sTYNTuQz4qdzPhUgKF83wURUhznGkdDL1Jxc6YITB1KPg==} + + '@unocss/extractor-arbitrary-variants@66.1.0-beta.12': + resolution: {integrity: sha512-DOl0bWJzgNAkiteQJluRsEnEfkKX1MFg1xn8vpTrbmSPOFCEUGcmavR6d4aCrQuJ6eaZaAvmhT/WxyTJngBuJw==} + + '@unocss/inspector@66.1.0-beta.12': + resolution: {integrity: sha512-J/xD22Q2hISMMKP4UB/V4rgnP0mbRDxFmPkst2PivI9YvCLAUy8Us+0/RYuI9VT8P5G/QcdRTnLidmLKAq3XMw==} + + '@unocss/postcss@66.1.0-beta.12': + resolution: {integrity: sha512-CMF5Z2YwvyqEO3DPYJWm+E4fI98CIgUDDiRuh3OBZmmHoJw6JSFAEgajW+BRRDKXz2zJMmf/87hD6cOXbeMonA==} + engines: {node: '>=14'} + peerDependencies: + postcss: ^8.4.21 + + '@unocss/preset-attributify@66.1.0-beta.12': + resolution: {integrity: sha512-0UDWmXgiHyrirEA1aHaoZrLUPEijetfLfZMgeM4k3F1vio6M3DgmkV82S+fZLk28XqFT5kWFkPRbmji/T+hUlg==} + + '@unocss/preset-icons@66.1.0-beta.12': + resolution: {integrity: sha512-eiqHooDnubGtcx0b49uSNZu0BOX5hOLH7mJngfqb0w8ExMRkgG9iZIKkQw25TB3V9jUGfLHewfeH2J+H5LiIcg==} + + '@unocss/preset-mini@66.1.0-beta.12': + resolution: {integrity: sha512-acnKtLmUX+imhc5RXS7z4InMbt0p1nShU/Lxr5yz4FtL8YaDMNk8SNTE4oCk1P7OQJVNsGdDCFtrhYWi9qAa1A==} + + '@unocss/preset-tagify@66.1.0-beta.12': + resolution: {integrity: sha512-dhhiT8rpf8a5hrRYoIfV8X4KOs0Nugz15LIxJrv87zUZcWhMXA0Flla1IfgZ937ULIcqBBqZdQEYfVG0vc3FIw==} + + '@unocss/preset-typography@66.1.0-beta.12': + resolution: {integrity: sha512-6qpDfPGxH/ComRMhVc+oZMUcbV+2tFFFVtNkIRFTDBlfDUMMtUc6xDcj6w/DeuIZpl67zSetvQSSWUBH2k1kuA==} + + '@unocss/preset-uno@66.1.0-beta.12': + resolution: {integrity: sha512-GoRZUaVUdx/fJ88F19htObouYb7HhKTJn8Ab8jK6rdvt913K90xXJ7XxSMalRk2DUy01fXbHEWEw/ObdxTgtHA==} + + '@unocss/preset-web-fonts@66.1.0-beta.12': + resolution: {integrity: sha512-nVwSl3TO2n1H2e3RY9z0igUaGXMgedk+ByLZJYDLWj+a7nVlsFm6EOFbmKwdVQS+oruZXyrXN9rSnZt7yBBcuQ==} + + '@unocss/preset-wind3@66.1.0-beta.12': + resolution: {integrity: sha512-vjSH7K3mHrcfOarzhnRu4oz6MjtvKYCMNnvufhpntq+lQ6IyeAfFP/zuBhGxKQZg0Amwt+peChF3AysbJHxQOQ==} + + '@unocss/preset-wind4@66.1.0-beta.12': + resolution: {integrity: sha512-n/0ohR52bQkfFLYd9+wRSvvxmKHqsvivn6tYVWdiyiv2FV+UMz2zwB6gv7meJzILVOfmXUGfwbTFTh1S6lClVg==} + + '@unocss/preset-wind@66.1.0-beta.12': + resolution: {integrity: sha512-5vQp50poCHsexs2dbxi0/eWCwpvyPXHDE6serNr0JMY/5nNPuzEYGeqroN+/Mo6nofNu154gPs5TLdYESbnKRA==} + + '@unocss/reset@66.1.0-beta.12': + resolution: {integrity: sha512-a8sqnzf1EFFqYmnc31B1owiQV3CKD0J7FAFFxsYYwshxSI2v0hDDVsDpfxvpWXX+ZI6khZccnsMR7uXzk/bImw==} + + '@unocss/rule-utils@66.1.0-beta.12': + resolution: {integrity: sha512-txhJO8pqut5FjGxhFC/OzqvLkeyeSaXgvZLaPaCTnpmuzt78ZTmqpszAHSchr9qCEXtBbK9dKHH78Zh10SRDLg==} + engines: {node: '>=14'} + + '@unocss/transformer-attributify-jsx@66.1.0-beta.12': + resolution: {integrity: sha512-nT+Zc7uteMlpRXGUKmJuypa4M44ImTwQhKw4sJNOcXckbliYlGjsOzAHR6khKF0eTWmaYLQ/VU+pqLQwls4m6Q==} + + '@unocss/transformer-compile-class@66.1.0-beta.12': + resolution: {integrity: sha512-hlZ75IsXFOMcsPAQCLdtv2K9CFzR6ZNeB/hJ1Hx4easiWpCPkk9IiAcwQqSKpcEgX/vQkOkyc5LqqptcMJZsNg==} + + '@unocss/transformer-directives@66.1.0-beta.12': + resolution: {integrity: sha512-2usowxuis00BJ6YHU5MFl484o3nXi4TSHs9ohiRIPurGMOz6puuR/e1mxqX/y1E7ziR+TR5TH4CzmNW8X0zm1w==} + + '@unocss/transformer-variant-group@66.1.0-beta.12': + resolution: {integrity: sha512-MWMJ2zMOdZm2yQptttzh8HoPwzmdk2BgShuoCE6B5jeTVhDpU52QSAZEewl2AAgv0VSz68X0QxxOC2j7GZ+90w==} + + '@unocss/vite@66.1.0-beta.12': + resolution: {integrity: sha512-ZIz8+LedpZSZwfCizFrZMcHRkjzTo+iVscL9oBfvzi7Sg37/zqRDY5XdyHUQsOI79Mu0527Mtu0lvyYGinS8zg==} + peerDependencies: + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 + '@unrs/resolver-binding-darwin-arm64@1.5.0': resolution: {integrity: sha512-YmocNlEcX/AgJv8gI41bhjMOTcKcea4D2nRIbZj+MhRtSH5+vEU8r/pFuTuoF+JjVplLsBueU+CILfBPVISyGQ==} cpu: [arm64] @@ -1468,6 +1567,10 @@ packages: any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + are-docs-informative@0.0.2: resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} engines: {node: '>=14'} @@ -1495,6 +1598,10 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + birpc@2.3.0: resolution: {integrity: sha512-ijbtkn/F3Pvzb6jHypHRyve2QApOCZDR25D/VnkY2G/lBNcXCTsnsCxgY4k4PkVB7zfwzYbY3O9Lcqe3xufS5g==} @@ -1583,6 +1690,10 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + chokidar@4.0.3: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} @@ -1609,6 +1720,9 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} @@ -1644,6 +1758,10 @@ packages: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} + css-tree@3.1.0: + resolution: {integrity: sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} + cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} @@ -1708,6 +1826,9 @@ packages: resolution: {integrity: sha512-BTW78HXK66TvRHBRkU91a7CGoD5/PWi8ovMXbKVHjhR5xCqt1dgwl6CVk3wxWLzhNVIGXDbGWPBlRKrgSHMzfw==} engines: {node: '>=20.18.0'} + duplexer@0.1.2: + resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -2099,6 +2220,10 @@ packages: resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} engines: {node: '>=6.0'} + gzip-size@6.0.0: + resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} + engines: {node: '>=10'} + has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -2143,6 +2268,10 @@ packages: resolution: {integrity: sha512-XPdx9Dq4t9Qk1mTMbWONJqU7boCoumEH7fRET37HX5+khDUl3J2W6PdALxhILYlIYx2amlwYcRPp28p0tSiojg==} engines: {node: '>=18'} + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + is-builtin-module@5.0.0: resolution: {integrity: sha512-f4RqJKBUe5rQkJ2eJEJBXSticB3hGbN9j0yxxMQFqIW89Jp9WYFtzfTcRlstDKVUTRzSOTLKRfO9vIztenwtxA==} engines: {node: '>=18.20'} @@ -2354,6 +2483,9 @@ packages: mdast-util-to-string@4.0.0: resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==} + mdn-data@2.12.2: + resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==} + mdurl@2.0.0: resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} @@ -2488,6 +2620,10 @@ packages: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -2516,6 +2652,10 @@ packages: resolution: {integrity: sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==} engines: {node: ^16.14.0 || >=18.0.0} + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} @@ -2528,6 +2668,9 @@ packages: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} + ofetch@1.4.1: + resolution: {integrity: sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==} + ohash@2.0.11: resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==} @@ -2706,6 +2849,10 @@ packages: resolution: {integrity: sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==} engines: {node: '>=18'} + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + readdirp@4.1.2: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} @@ -2839,6 +2986,10 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} + sirv@3.0.1: + resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==} + engines: {node: '>=18'} + slashes@3.0.12: resolution: {integrity: sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==} @@ -2990,6 +3141,10 @@ packages: tokenx@0.4.1: resolution: {integrity: sha512-LCMniis0WsHel07xh3K9OIt5c9Xla1awtOoWBmUHZBQR7pvTvgGFuYpLiCZWohXPC1YuZORnN0+fCVYI/ie8Jg==} + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + tr46@1.0.1: resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} @@ -3109,6 +3264,18 @@ packages: unist-util-visit@5.0.0: resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} + unocss@66.1.0-beta.12: + resolution: {integrity: sha512-BcOL+K97CYV9GC9OlHTI8pPBVSELloKQGAvLYKi2P/aNgHpH6PzJ+5OTNk39jQeOp+25tu/Q6VQIEmK3I0+nww==} + engines: {node: '>=14'} + peerDependencies: + '@unocss/webpack': 66.1.0-beta.12 + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 + peerDependenciesMeta: + '@unocss/webpack': + optional: true + vite: + optional: true + unplugin-ast@0.14.6: resolution: {integrity: sha512-HdntpxAN8fWyJ28n8iRkRrez9UrxTPda27XzdEkI8tz0Cn0+fLrnN+8qHqHlzRWXxSPVP7M9eEJ5MeMwbbhy4g==} engines: {node: '>=18.12.0'} @@ -3285,6 +3452,11 @@ packages: peerDependencies: eslint: ^8.57.0 || ^9.0.0 + vue-flow-layout@0.1.1: + resolution: {integrity: sha512-JdgRRUVrN0Y2GosA0M68DEbKlXMqJ7FQgsK8CjQD2vxvNSqAU6PZEpi4cfcTVtfM2GVOMjHo7GKKLbXxOBqDqA==} + peerDependencies: + vue: ^3.4.37 + vue@3.5.13: resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==} peerDependencies: @@ -3463,6 +3635,11 @@ snapshots: dependencies: '@algolia/client-common': 5.23.4 + '@ampproject/remapping@2.3.0': + dependencies: + '@jridgewell/gen-mapping': 0.3.8 + '@jridgewell/trace-mapping': 0.3.25 + '@antfu/install-pkg@1.0.0': dependencies: package-manager-detector: 0.2.11 @@ -3975,6 +4152,8 @@ snapshots: '@pkgr/core@0.2.4': {} + '@polka/url@1.0.0-next.29': {} + '@publint/pack@0.1.2': {} '@quansync/fs@0.1.2': @@ -4318,6 +4497,158 @@ snapshots: '@ungap/structured-clone@1.3.0': {} + '@unocss/astro@66.1.0-beta.12(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/reset': 66.1.0-beta.12 + '@unocss/vite': 66.1.0-beta.12(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + optionalDependencies: + vite: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1) + transitivePeerDependencies: + - vue + + '@unocss/cli@66.1.0-beta.12': + dependencies: + '@ampproject/remapping': 2.3.0 + '@unocss/config': 66.1.0-beta.12 + '@unocss/core': 66.1.0-beta.12 + '@unocss/preset-uno': 66.1.0-beta.12 + cac: 6.7.14 + chokidar: 3.6.0 + colorette: 2.0.20 + consola: 3.4.2 + magic-string: 0.30.17 + pathe: 2.0.3 + perfect-debounce: 1.0.0 + tinyglobby: 0.2.12 + unplugin-utils: 0.2.4 + + '@unocss/config@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + unconfig: 7.3.1 + + '@unocss/core@66.1.0-beta.12': {} + + '@unocss/extractor-arbitrary-variants@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + + '@unocss/inspector@66.1.0-beta.12(vue@3.5.13(typescript@5.8.3))': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + colorette: 2.0.20 + gzip-size: 6.0.0 + sirv: 3.0.1 + vue-flow-layout: 0.1.1(vue@3.5.13(typescript@5.8.3)) + transitivePeerDependencies: + - vue + + '@unocss/postcss@66.1.0-beta.12(postcss@8.5.3)': + dependencies: + '@unocss/config': 66.1.0-beta.12 + '@unocss/core': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + css-tree: 3.1.0 + postcss: 8.5.3 + tinyglobby: 0.2.12 + + '@unocss/preset-attributify@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + + '@unocss/preset-icons@66.1.0-beta.12': + dependencies: + '@iconify/utils': 2.3.0 + '@unocss/core': 66.1.0-beta.12 + ofetch: 1.4.1 + transitivePeerDependencies: + - supports-color + + '@unocss/preset-mini@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/extractor-arbitrary-variants': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + + '@unocss/preset-tagify@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + + '@unocss/preset-typography@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/preset-mini': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + + '@unocss/preset-uno@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/preset-wind3': 66.1.0-beta.12 + + '@unocss/preset-web-fonts@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + ofetch: 1.4.1 + + '@unocss/preset-wind3@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/preset-mini': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + + '@unocss/preset-wind4@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/extractor-arbitrary-variants': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + + '@unocss/preset-wind@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/preset-wind3': 66.1.0-beta.12 + + '@unocss/reset@66.1.0-beta.12': {} + + '@unocss/rule-utils@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + magic-string: 0.30.17 + + '@unocss/transformer-attributify-jsx@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + + '@unocss/transformer-compile-class@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + + '@unocss/transformer-directives@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + '@unocss/rule-utils': 66.1.0-beta.12 + css-tree: 3.1.0 + + '@unocss/transformer-variant-group@66.1.0-beta.12': + dependencies: + '@unocss/core': 66.1.0-beta.12 + + '@unocss/vite@66.1.0-beta.12(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': + dependencies: + '@ampproject/remapping': 2.3.0 + '@unocss/config': 66.1.0-beta.12 + '@unocss/core': 66.1.0-beta.12 + '@unocss/inspector': 66.1.0-beta.12(vue@3.5.13(typescript@5.8.3)) + chokidar: 3.6.0 + magic-string: 0.30.17 + pathe: 2.0.3 + tinyglobby: 0.2.12 + unplugin-utils: 0.2.4 + vite: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1) + transitivePeerDependencies: + - vue + '@unrs/resolver-binding-darwin-arm64@1.5.0': optional: true @@ -4559,6 +4890,11 @@ snapshots: any-promise@1.3.0: {} + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + are-docs-informative@0.0.2: {} argparse@1.0.10: @@ -4580,6 +4916,8 @@ snapshots: balanced-match@1.0.2: {} + binary-extensions@2.3.0: {} + birpc@2.3.0: {} boolbase@1.0.0: {} @@ -4673,6 +5011,18 @@ snapshots: check-error@2.1.1: {} + chokidar@3.6.0: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + chokidar@4.0.3: dependencies: readdirp: 4.1.2 @@ -4699,6 +5049,8 @@ snapshots: color-name@1.1.4: {} + colorette@2.0.20: {} + comma-separated-tokens@2.0.3: {} commander@4.1.1: {} @@ -4727,6 +5079,11 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + css-tree@3.1.0: + dependencies: + mdn-data: 2.12.2 + source-map-js: 1.2.1 + cssesc@3.0.0: {} csstype@3.1.3: {} @@ -4770,6 +5127,8 @@ snapshots: oxc-resolver: 5.3.0 pathe: 2.0.3 + duplexer@0.1.2: {} + eastasianwidth@0.2.0: {} electron-to-chromium@1.5.139: {} @@ -5273,6 +5632,10 @@ snapshots: section-matter: 1.0.0 strip-bom-string: 1.0.0 + gzip-size@6.0.0: + dependencies: + duplexer: 0.1.2 + has-flag@4.0.0: {} hasown@2.0.2: @@ -5318,6 +5681,10 @@ snapshots: index-to-position@1.1.0: {} + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + is-builtin-module@5.0.0: dependencies: builtin-modules: 5.0.0 @@ -5583,6 +5950,8 @@ snapshots: dependencies: '@types/mdast': 4.0.4 + mdn-data@2.12.2: {} + mdurl@2.0.0: {} merge2@1.4.1: {} @@ -5823,6 +6192,8 @@ snapshots: mri@1.2.0: {} + mrmime@2.0.1: {} + ms@2.1.3: {} mz@2.7.0: @@ -5847,6 +6218,8 @@ snapshots: semver: 7.7.1 validate-npm-package-license: 3.0.4 + normalize-path@3.0.0: {} + nth-check@2.1.1: dependencies: boolbase: 1.0.0 @@ -5861,6 +6234,12 @@ snapshots: object-assign@4.1.1: {} + ofetch@1.4.1: + dependencies: + destr: 2.0.5 + node-fetch-native: 1.6.6 + ufo: 1.6.1 + ohash@2.0.11: {} oniguruma-to-es@3.1.1: @@ -6062,6 +6441,10 @@ snapshots: type-fest: 4.40.0 unicorn-magic: 0.1.0 + readdirp@3.6.0: + dependencies: + picomatch: 2.3.1 + readdirp@4.1.2: {} refa@0.12.1: @@ -6245,6 +6628,12 @@ snapshots: signal-exit@4.1.0: {} + sirv@3.0.1: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + slashes@3.0.12: {} source-map-js@1.2.1: {} @@ -6387,6 +6776,8 @@ snapshots: tokenx@0.4.1: {} + totalist@3.0.1: {} + tr46@1.0.1: dependencies: punycode: 2.3.1 @@ -6524,6 +6915,34 @@ snapshots: unist-util-is: 6.0.0 unist-util-visit-parents: 6.0.1 + unocss@66.1.0-beta.12(postcss@8.5.3)(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)): + dependencies: + '@unocss/astro': 66.1.0-beta.12(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + '@unocss/cli': 66.1.0-beta.12 + '@unocss/core': 66.1.0-beta.12 + '@unocss/postcss': 66.1.0-beta.12(postcss@8.5.3) + '@unocss/preset-attributify': 66.1.0-beta.12 + '@unocss/preset-icons': 66.1.0-beta.12 + '@unocss/preset-mini': 66.1.0-beta.12 + '@unocss/preset-tagify': 66.1.0-beta.12 + '@unocss/preset-typography': 66.1.0-beta.12 + '@unocss/preset-uno': 66.1.0-beta.12 + '@unocss/preset-web-fonts': 66.1.0-beta.12 + '@unocss/preset-wind': 66.1.0-beta.12 + '@unocss/preset-wind3': 66.1.0-beta.12 + '@unocss/preset-wind4': 66.1.0-beta.12 + '@unocss/transformer-attributify-jsx': 66.1.0-beta.12 + '@unocss/transformer-compile-class': 66.1.0-beta.12 + '@unocss/transformer-directives': 66.1.0-beta.12 + '@unocss/transformer-variant-group': 66.1.0-beta.12 + '@unocss/vite': 66.1.0-beta.12(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + optionalDependencies: + vite: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.1) + transitivePeerDependencies: + - postcss + - supports-color + - vue + unplugin-ast@0.14.6: dependencies: '@babel/generator': 7.27.0 @@ -6770,6 +7189,10 @@ snapshots: transitivePeerDependencies: - supports-color + vue-flow-layout@0.1.1(vue@3.5.13(typescript@5.8.3)): + dependencies: + vue: 3.5.13(typescript@5.8.3) + vue@3.5.13(typescript@5.8.3): dependencies: '@vue/compiler-dom': 3.5.13 From bd5b2c61f46ff9dba5af15a2feaa254feecfafd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 20 Apr 2025 08:10:02 +0800 Subject: [PATCH 09/24] fix lint --- docs/.vitepress/components/HomePage.vue | 6 ++---- docs/zh-CN/index.md | 2 +- package.json | 1 + pnpm-lock.yaml | 26 +++++++++++++++++++++++-- docs/uno.config.ts => uno.config.ts | 0 5 files changed, 28 insertions(+), 7 deletions(-) rename docs/uno.config.ts => uno.config.ts (100%) diff --git a/docs/.vitepress/components/HomePage.vue b/docs/.vitepress/components/HomePage.vue index b21c871d6..fee472089 100644 --- a/docs/.vitepress/components/HomePage.vue +++ b/docs/.vitepress/components/HomePage.vue @@ -1,10 +1,8 @@