tsdown 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # tsdown [![npm](https://img.shields.io/npm/v/tsdown.svg)](https://npmjs.com/package/tsdown) [![Unit Test](https://github.com/sxzz/tsdown/actions/workflows/unit-test.yml/badge.svg)](https://github.com/sxzz/tsdown/actions/workflows/unit-test.yml) [![JSR](https://jsr.io/badges/@sxzz/tsdown)](https://jsr.io/@sxzz/tsdown)
2
2
 
3
- An even faster bundler powered by [Rolldown](https://github.com/rolldown/rolldown).
3
+ ⚡️ An even faster bundler powered by [Rolldown](https://github.com/rolldown/rolldown).
4
4
 
5
- > [!NOTE]
6
- > 🚧 **Work in Progress**
7
- >
8
- > Both Rolldown and tsdown are currently under active development and not yet ready for production use.
5
+ ## Features
6
+
7
+ - 🚀 **Blazing fast**: Build and generate `.d.ts` powered by Oxc and Rolldown, incredibly fast!
8
+ - ♻️ **Powerful ecosystem**: Support Rollup / Rolldown / Vite / unplugin plugins.
9
+ - 📦 **Out-of-box**: Support reusing configurations from Vite or Vitest.
10
+ - 🔄 **Seamless migration**: Compatible with tsup's main options and features, ensuring a smooth transition.
9
11
 
10
12
  ## Install
11
13
 
@@ -13,6 +15,18 @@ An even faster bundler powered by [Rolldown](https://github.com/rolldown/rolldow
13
15
  npm i tsdown
14
16
  ```
15
17
 
18
+ ## Configuration
19
+
20
+ ```ts
21
+ // tsdown.config.ts
22
+ import { defineConfig } from 'tsdown'
23
+
24
+ export default defineConfig({
25
+ entry: ['./src'],
26
+ // ...
27
+ })
28
+ ```
29
+
16
30
  ## Credits
17
31
 
18
32
  This project also partially contains code derived or copied from [tsup](https://github.com/egoist/tsup).
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { U as UserConfig } from './options.d-DY0J98cF.js';
1
+ import { U as UserConfig } from './options.d-B6hAHDaA.js';
2
2
  import 'publint';
3
3
  import 'rolldown';
4
4
  import 'unplugin-isolated-decl';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as Options, R as ResolvedOptions } from './options.d-DY0J98cF.js';
2
- export { U as UserConfig } from './options.d-DY0J98cF.js';
1
+ import { O as Options, R as ResolvedOptions } from './options.d-B6hAHDaA.js';
2
+ export { U as UserConfig } from './options.d-B6hAHDaA.js';
3
3
  import { ConsolaInstance } from 'consola';
4
4
  export { defineConfig } from './config.js';
5
5
  import 'publint';
package/dist/index.js CHANGED
@@ -232,10 +232,11 @@ async function watchBuild(options, configFile, rebuild, restart) {
232
232
  const watcher = watch(files, {
233
233
  ignoreInitial: true,
234
234
  ignorePermissionErrors: true,
235
- ignored: (id) => {
236
- if (id.includes("/.git/") || id.includes("/node_modules/")) return true;
237
- return id.startsWith(options.outDir);
238
- }
235
+ ignored: [
236
+ /[\\/]\.git[\\/]/,
237
+ /[\\/]node_modules[\\/]/,
238
+ options.outDir
239
+ ]
239
240
  });
240
241
  watcher.on("all", (type, file) => {
241
242
  if (endsWithPackageJson.test(file) || configFile === file) {
@@ -285,7 +286,7 @@ async function resolveOptions(options) {
285
286
  if (clean === true) clean = [];
286
287
  if (publint$1 === true) publint$1 = {};
287
288
  if (fromVite) {
288
- const viteUserConfig = await loadViteConfig(cwd);
289
+ const viteUserConfig = await loadViteConfig(fromVite === true ? "vite" : fromVite, cwd);
289
290
  if (viteUserConfig) {
290
291
  if (Array.isArray(alias)) throw new TypeError("Unsupported resolve.alias in Vite config. Use object instead of array");
291
292
  if (viteUserConfig.plugins) plugins = [viteUserConfig.plugins, plugins];
@@ -371,10 +372,10 @@ async function loadConfigFile(options) {
371
372
  cwd
372
373
  };
373
374
  }
374
- async function loadViteConfig(cwd) {
375
+ async function loadViteConfig(prefix, cwd) {
375
376
  const { config, sources: [source] } = await loadConfig({
376
377
  sources: [{
377
- files: "vite.config",
378
+ files: `${prefix}.config`,
378
379
  extensions: [
379
380
  "ts",
380
381
  "mts",
@@ -1,4 +1,4 @@
1
- import { version } from "./package-CsxLeVcz.js";
1
+ import { version } from "./package-COmVwFsw.js";
2
2
  import process from "node:process";
3
3
  import { readFile, unlink, writeFile } from "node:fs/promises";
4
4
  import consola from "consola";
@@ -59,7 +59,7 @@ interface Options {
59
59
  * Reuse config from Vite or Vitest (experimental)
60
60
  * @default false
61
61
  */
62
- fromVite?: boolean;
62
+ fromVite?: boolean | "vitest";
63
63
  /**
64
64
  * Enable dts generation with `isolatedDeclarations` (experimental)
65
65
  */
@@ -0,0 +1,6 @@
1
+
2
+ //#region package.json
3
+ var version = "0.6.3";
4
+
5
+ //#endregion
6
+ export { version };
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as ResolvedOptions } from './options.d-DY0J98cF.js';
1
+ import { R as ResolvedOptions } from './options.d-B6hAHDaA.js';
2
2
  import { PackageJson } from 'pkg-types';
3
3
  import { Plugin } from 'rolldown';
4
4
  import 'publint';
package/dist/run.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { logger, setSilent } from "./logger-4bmpqibt.js";
2
- import { version } from "./package-CsxLeVcz.js";
2
+ import { version } from "./package-COmVwFsw.js";
3
3
  import process from "node:process";
4
4
  import { VERSION } from "rolldown";
5
5
  import { dim } from "ansis";
@@ -8,7 +8,7 @@ import { cac } from "cac";
8
8
  //#region src/cli.ts
9
9
  const cli = cac("tsdown");
10
10
  cli.help().version(version);
11
- cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory").option("--minify", "Minify output").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("-w, --watch [path]", "Watch mode").action(async (input, flags) => {
11
+ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory").option("--minify", "Minify output").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("-w, --watch [path]", "Watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").action(async (input, flags) => {
12
12
  setSilent(!!flags.silent);
13
13
  logger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
14
14
  const { build: build$1 } = await import("./index.js");
@@ -16,7 +16,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
16
16
  await build$1(flags);
17
17
  });
18
18
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
19
- const { migrate } = await import("./migrate-StuSmFYP.js");
19
+ const { migrate } = await import("./migrate-DjS7871z.js");
20
20
  await migrate(args);
21
21
  });
22
22
  async function runCLI() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "An even faster bundler powered by Rolldown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -59,13 +59,13 @@
59
59
  "consola": "^3.4.0",
60
60
  "debug": "^4.4.0",
61
61
  "diff": "^7.0.0",
62
- "pkg-types": "^2.0.1",
62
+ "pkg-types": "^2.1.0",
63
63
  "rolldown": "^1.0.0-beta.3",
64
64
  "rollup": "^4.34.9",
65
65
  "rollup-plugin-dts": "^6.1.1",
66
66
  "tinyglobby": "^0.2.12",
67
- "unconfig": "^7.2.0",
68
- "unplugin-isolated-decl": "^0.12.0"
67
+ "unconfig": "^7.3.0",
68
+ "unplugin-isolated-decl": "^0.13.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@sxzz/eslint-config": "^5.2.0",
@@ -73,18 +73,18 @@
73
73
  "@sxzz/test-utils": "^0.5.1",
74
74
  "@types/debug": "^4.1.12",
75
75
  "@types/diff": "^7.0.1",
76
- "@types/node": "^22.13.8",
76
+ "@types/node": "^22.13.9",
77
77
  "bumpp": "^10.0.3",
78
78
  "eslint": "^9.21.0",
79
- "oxc-transform": "^0.53.0",
79
+ "oxc-transform": "^0.55.0",
80
80
  "prettier": "^3.5.3",
81
- "publint": "^0.3.7",
81
+ "publint": "^0.3.8",
82
82
  "tinyexec": "^0.3.2",
83
83
  "tsup": "^8.4.0",
84
84
  "tsx": "^4.19.3",
85
85
  "typescript": "~5.8.2",
86
- "unplugin-ast": "^0.14.0",
87
- "unplugin-unused": "^0.4.2",
86
+ "unplugin-ast": "^0.14.1",
87
+ "unplugin-unused": "^0.4.3",
88
88
  "vite": "^6.2.0",
89
89
  "vitest": "^3.0.7"
90
90
  },
@@ -1,6 +0,0 @@
1
-
2
- //#region package.json
3
- var version = "0.6.2";
4
-
5
- //#endregion
6
- export { version };