tsdown 0.15.12 → 0.16.1

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.
@@ -0,0 +1,13 @@
1
+ import { d as UserConfig, f as UserConfigExport, p as UserConfigFn } from "./index-CSOY_TcZ.mjs";
2
+
3
+ //#region src/config.d.ts
4
+
5
+ /**
6
+ * Defines the configuration for tsdown.
7
+ */
8
+ declare function defineConfig(options: UserConfig): UserConfig;
9
+ declare function defineConfig(options: UserConfig[]): UserConfig[];
10
+ declare function defineConfig(options: UserConfigFn): UserConfigFn;
11
+ declare function defineConfig(options: UserConfigExport): UserConfigExport;
12
+ //#endregion
13
+ export { defineConfig as t };
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { f as UserConfig, p as UserConfigFn } from "./types-XjcKkhrO.mjs";
2
- import { t as defineConfig } from "./config-Bl5kiN1A.mjs";
3
- export { UserConfig, UserConfigFn, defineConfig };
1
+ import { d as UserConfig, f as UserConfigExport, p as UserConfigFn } from "./index-CSOY_TcZ.mjs";
2
+ import { t as defineConfig } from "./config-8JTxhwDL.mjs";
3
+ export { UserConfig, UserConfigExport, UserConfigFn, defineConfig };
@@ -1,11 +1,12 @@
1
1
  import "ansis";
2
2
  import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin, TreeshakingOptions } from "rolldown";
3
3
  import { Hookable } from "hookable";
4
+ import { Options as DtsOptions } from "rolldown-plugin-dts";
4
5
  import { CheckPackageOptions } from "@arethetypeswrong/core";
6
+ import { StartOptions } from "@vitejs/devtools/cli-commands";
7
+ import { PackageJson } from "pkg-types";
5
8
  import { Options as PublintOptions } from "publint";
6
- import { Options as DtsOptions } from "rolldown-plugin-dts";
7
9
  import { Options as UnusedOptions } from "unplugin-unused";
8
- import { PackageJson } from "pkg-types";
9
10
 
10
11
  //#region src/utils/types.d.ts
11
12
  type Overwrite<T, U> = Omit<T, keyof U> & U;
@@ -45,7 +46,23 @@ interface CopyEntry {
45
46
  to: string;
46
47
  }
47
48
  type CopyOptions = Arrayable<string | CopyEntry>;
48
- type CopyOptionsFn = (options: ResolvedOptions) => Awaitable<CopyOptions>;
49
+ type CopyOptionsFn = (options: ResolvedConfig) => Awaitable<CopyOptions>;
50
+ //#endregion
51
+ //#region src/features/debug.d.ts
52
+ interface DebugOptions extends NonNullable<InputOptions["debug"]> {
53
+ /**
54
+ * **[experimental]** Enable devtools integration. `@vitejs/devtools` must be installed as a dependency.
55
+ *
56
+ * Defaults to true, if `@vitejs/devtools` is installed.
57
+ */
58
+ devtools?: boolean | Partial<StartOptions>;
59
+ /**
60
+ * Clean devtools stale sessions.
61
+ *
62
+ * @default true
63
+ */
64
+ clean?: boolean;
65
+ }
49
66
  //#endregion
50
67
  //#region src/features/exports.d.ts
51
68
  type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputAsset>>>;
@@ -70,7 +87,7 @@ interface ExportsOptions {
70
87
  //#endregion
71
88
  //#region src/features/hooks.d.ts
72
89
  interface BuildContext {
73
- options: ResolvedOptions;
90
+ options: ResolvedConfig;
74
91
  hooks: Hookable<TsdownHooks>;
75
92
  }
76
93
  interface RolldownContext {
@@ -161,7 +178,7 @@ interface ReportOptions {
161
178
  }
162
179
  declare function ReportPlugin(userOptions: ReportOptions, logger: Logger, cwd: string, cjsDts?: boolean, name?: string, isMultiFormat?: boolean): Plugin;
163
180
  //#endregion
164
- //#region src/options/types.d.ts
181
+ //#region src/config/types.d.ts
165
182
  type Sourcemap = boolean | "inline" | "hidden";
166
183
  type Format = ModuleFormat;
167
184
  type NormalizedFormat = InternalModuleFormat;
@@ -186,7 +203,7 @@ type NoExternalFn = (id: string, importer: string | undefined) => boolean | null
186
203
  /**
187
204
  * Options for tsdown.
188
205
  */
189
- interface Options {
206
+ interface UserConfig {
190
207
  /**
191
208
  * Defaults to `'src/index.ts'` if it exists.
192
209
  */
@@ -356,7 +373,8 @@ interface Options {
356
373
  * Use a fixed extension for output files.
357
374
  * The extension will always be `.cjs` or `.mjs`.
358
375
  * Otherwise, it will depend on the package type.
359
- * @default false
376
+ *
377
+ * Defaults to `true` if `platform` is set to `node`, `false` otherwise.
360
378
  */
361
379
  fixedExtension?: boolean;
362
380
  /**
@@ -411,15 +429,6 @@ interface Options {
411
429
  */
412
430
  customLogger?: Logger;
413
431
  /**
414
- * Config file path
415
- */
416
- config?: boolean | string;
417
- /**
418
- * Config loader to use. It can only be set via CLI or API.
419
- * @default 'auto'
420
- */
421
- configLoader?: "auto" | "native" | "unconfig" | "unrun";
422
- /**
423
432
  * Reuse config from Vite or Vitest (experimental)
424
433
  * @default false
425
434
  */
@@ -432,7 +441,17 @@ interface Options {
432
441
  /**
433
442
  * You can specify command to be executed after a successful build, specially useful for Watch mode
434
443
  */
435
- onSuccess?: string | ((config: ResolvedOptions, signal: AbortSignal) => void | Promise<void>);
444
+ onSuccess?: string | ((config: ResolvedConfig, signal: AbortSignal) => void | Promise<void>);
445
+ /**
446
+ * **[experimental]** Enable debug mode.
447
+ *
448
+ * Both debug mode and Vite DevTools are still under development, and this is for early testers only.
449
+ *
450
+ * This may slow down the build process significantly.
451
+ *
452
+ * @default false
453
+ */
454
+ debug?: boolean | DebugOptions;
436
455
  /**
437
456
  * Enables generation of TypeScript declaration files (`.d.ts`).
438
457
  *
@@ -500,24 +519,31 @@ interface Options {
500
519
  * This allows you to build multiple packages in a monorepo.
501
520
  */
502
521
  workspace?: Workspace | Arrayable<string> | true;
522
+ }
523
+ interface InlineConfig extends UserConfig {
524
+ /**
525
+ * Config file path
526
+ */
527
+ config?: boolean | string;
528
+ /**
529
+ * Config loader to use. It can only be set via CLI or API.
530
+ * @default 'auto'
531
+ */
532
+ configLoader?: "auto" | "native" | "unconfig" | "unrun";
503
533
  /**
504
534
  * Filter workspace packages. This option is only available in workspace mode.
505
535
  */
506
536
  filter?: RegExp | string | string[];
507
537
  }
508
- /**
509
- * Options without specifying config file path.
510
- */
511
- type UserConfig = Arrayable<Omit<Options, "config" | "filter" | "configLoader">>;
512
- type UserConfigFn = (cliOptions: Options) => Awaitable<UserConfig>;
513
- type NormalizedUserConfig = Exclude<UserConfig, any[]>;
514
- type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options, "publicDir" | "workspace" | "filter" | "silent" | "logLevel" | "failOnWarn" | "customLogger" | "configLoader">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name" | "bundle" | "banner" | "footer">, {
538
+ type UserConfigFn = (inlineConfig: InlineConfig) => Awaitable<Arrayable<UserConfig>>;
539
+ type UserConfigExport = Awaitable<Arrayable<UserConfig> | UserConfigFn>;
540
+ type ResolvedConfig = Overwrite<MarkPartial<Omit<UserConfig, "workspace" | "fromVite" | "publicDir" | "silent" | "bundle" | "removeNodeProtocol" | "logLevel" | "failOnWarn" | "customLogger">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "onSuccess" | "outExtensions" | "hooks" | "copy" | "loader" | "name" | "banner" | "footer">, {
515
541
  format: NormalizedFormat[];
516
542
  target?: string[];
517
543
  clean: string[];
518
544
  dts: false | DtsOptions;
519
545
  report: false | ReportOptions;
520
- tsconfig: string | false;
546
+ tsconfig: false | string;
521
547
  pkg?: PackageJson;
522
548
  exports: false | ExportsOptions;
523
549
  nodeProtocol: "strip" | boolean;
@@ -525,6 +551,7 @@ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options, "publicDir" | "w
525
551
  ignoreWatch: Array<string | RegExp>;
526
552
  noExternal?: NoExternalFn;
527
553
  inlineOnly?: Array<string | RegExp>;
528
- }>, "config" | "fromVite">;
554
+ debug: false | DebugOptions;
555
+ }>;
529
556
  //#endregion
530
- export { TsdownChunks as A, OutExtensionFactory as C, RolldownContext as D, BuildContext as E, CopyOptions as M, CopyOptionsFn as N, TsdownHooks as O, AttwOptions as P, OutExtensionContext as S, PackageType as T, Logger as _, NormalizedUserConfig as a, ChunkAddonFunction as b, ResolvedOptions as c, UnusedOptions as d, UserConfig as f, ReportPlugin as g, ReportOptions as h, NormalizedFormat as i, CopyEntry as j, ExportsOptions as k, Sourcemap as l, Workspace as m, Format as n, Options as o, UserConfigFn as p, NoExternalFn as r, PublintOptions as s, DtsOptions as t, TreeshakingOptions as u, globalLogger as v, OutExtensionObject as w, ChunkAddonObject as x, ChunkAddon as y };
557
+ export { TsdownChunks as A, OutExtensionFactory as C, RolldownContext as D, BuildContext as E, AttwOptions as F, CopyEntry as M, CopyOptions as N, TsdownHooks as O, CopyOptionsFn as P, OutExtensionContext as S, PackageType as T, Logger as _, NormalizedFormat as a, ChunkAddonFunction as b, Sourcemap as c, UserConfig as d, UserConfigExport as f, ReportPlugin as g, ReportOptions as h, NoExternalFn as i, DebugOptions as j, ExportsOptions as k, TreeshakingOptions as l, Workspace as m, Format as n, PublintOptions as o, UserConfigFn as p, InlineConfig as r, ResolvedConfig as s, DtsOptions as t, UnusedOptions as u, globalLogger as v, OutExtensionObject as w, ChunkAddonObject as x, ChunkAddon as y };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
- import { A as TsdownChunks, C as OutExtensionFactory, D as RolldownContext, E as BuildContext, M as CopyOptions, N as CopyOptionsFn, O as TsdownHooks, P as AttwOptions, S as OutExtensionContext, T as PackageType, _ as Logger, a as NormalizedUserConfig, b as ChunkAddonFunction, c as ResolvedOptions, d as UnusedOptions, f as UserConfig, h as ReportOptions, i as NormalizedFormat, j as CopyEntry, k as ExportsOptions, l as Sourcemap, m as Workspace, n as Format, o as Options, p as UserConfigFn, r as NoExternalFn, s as PublintOptions, t as DtsOptions, u as TreeshakingOptions, v as globalLogger, w as OutExtensionObject, x as ChunkAddonObject, y as ChunkAddon } from "./types-XjcKkhrO.mjs";
2
- import { t as defineConfig } from "./config-Bl5kiN1A.mjs";
1
+ import { A as TsdownChunks, C as OutExtensionFactory, D as RolldownContext, E as BuildContext, F as AttwOptions, M as CopyEntry, N as CopyOptions, O as TsdownHooks, P as CopyOptionsFn, S as OutExtensionContext, T as PackageType, _ as Logger, a as NormalizedFormat, b as ChunkAddonFunction, c as Sourcemap, d as UserConfig, f as UserConfigExport, h as ReportOptions, i as NoExternalFn, j as DebugOptions, k as ExportsOptions, l as TreeshakingOptions, m as Workspace, n as Format, o as PublintOptions, p as UserConfigFn, r as InlineConfig, s as ResolvedConfig, t as DtsOptions, u as UnusedOptions, v as globalLogger, w as OutExtensionObject, x as ChunkAddonObject, y as ChunkAddon } from "./index-CSOY_TcZ.mjs";
2
+ import { t as defineConfig } from "./config-8JTxhwDL.mjs";
3
3
 
4
4
  //#region src/index.d.ts
5
5
 
6
6
  /**
7
7
  * Build with tsdown.
8
8
  */
9
- declare function build(userOptions?: Options): Promise<void>;
9
+ declare function build(userOptions?: InlineConfig): Promise<void>;
10
10
  /** @internal */
11
11
  declare const shimFile: string;
12
12
  /**
@@ -17,6 +17,6 @@ declare const shimFile: string;
17
17
  * @private
18
18
  * @param config Resolved options
19
19
  */
20
- declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
20
+ declare function buildSingle(config: ResolvedConfig, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
21
21
  //#endregion
22
- export { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, type Logger, NoExternalFn, NormalizedFormat, NormalizedUserConfig, type Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, type ResolvedOptions, RolldownContext, Sourcemap, TreeshakingOptions, TsdownChunks, TsdownHooks, UnusedOptions, type UserConfig, type UserConfigFn, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
22
+ export { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DebugOptions, DtsOptions, ExportsOptions, Format, InlineConfig, type Logger, NoExternalFn, NormalizedFormat, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, ResolvedConfig, RolldownContext, Sourcemap, TreeshakingOptions, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as defineConfig } from "./config-BPLXnzPK.mjs";
2
- import { n as buildSingle, r as shimFile, t as build } from "./src-Cy1Bj4rU.mjs";
3
- import { a as globalLogger } from "./package-qYegZAPv.mjs";
2
+ import { n as buildSingle, r as shimFile, t as build } from "./src-BJnxnJLO.mjs";
3
+ import { a as globalLogger } from "./package-BEpC3UYZ.mjs";
4
4
 
5
5
  export { build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -1,4 +1,4 @@
1
- import { a as globalLogger, t as version } from "./package-qYegZAPv.mjs";
1
+ import { a as globalLogger, t as version } from "./package-BEpC3UYZ.mjs";
2
2
  import process from "node:process";
3
3
  import { bold, green, underline } from "ansis";
4
4
  import { readFile, unlink, writeFile } from "node:fs/promises";
@@ -38,6 +38,20 @@ function matchPattern(id, patterns) {
38
38
  return id === pattern;
39
39
  });
40
40
  }
41
+ function pkgExists(moduleName) {
42
+ try {
43
+ import.meta.resolve(moduleName);
44
+ return true;
45
+ } catch {}
46
+ return false;
47
+ }
48
+ async function importWithError(moduleName) {
49
+ try {
50
+ return await import(moduleName);
51
+ } catch (error) {
52
+ throw new Error(`Failed to import module "${moduleName}". Please ensure it is installed.`, { cause: error });
53
+ }
54
+ }
41
55
 
42
56
  //#endregion
43
57
  //#region src/utils/logger.ts
@@ -146,7 +160,7 @@ function hue2rgb(p, q, t) {
146
160
 
147
161
  //#endregion
148
162
  //#region package.json
149
- var version = "0.15.12";
163
+ var version = "0.16.1";
150
164
 
151
165
  //#endregion
152
- export { globalLogger as a, debounce as c, resolveComma as d, resolveRegex as f, generateColor as i, matchPattern as l, toArray as m, LogLevels as n, prettyFormat as o, slash as p, createLogger as r, prettyName as s, version as t, noop as u };
166
+ export { globalLogger as a, debounce as c, noop as d, pkgExists as f, toArray as g, slash as h, generateColor as i, importWithError as l, resolveRegex as m, LogLevels as n, prettyFormat as o, resolveComma as p, createLogger as r, prettyName as s, version as t, matchPattern as u };
@@ -1,4 +1,4 @@
1
- import { _ as Logger, c as ResolvedOptions, g as ReportPlugin } from "./types-XjcKkhrO.mjs";
1
+ import { _ as Logger, g as ReportPlugin, s as ResolvedConfig } from "./index-CSOY_TcZ.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
@@ -8,7 +8,7 @@ declare function ExternalPlugin({
8
8
  noExternal,
9
9
  inlineOnly,
10
10
  skipNodeModulesBundle
11
- }: ResolvedOptions): Plugin;
11
+ }: ResolvedConfig): Plugin;
12
12
  //#endregion
13
13
  //#region src/features/shebang.d.ts
14
14
  declare function ShebangPlugin(logger: Logger, cwd: string, name?: string, isMultiFormat?: boolean): Plugin;
package/dist/plugins.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./config-BPLXnzPK.mjs";
2
- import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, s as ExternalPlugin } from "./src-Cy1Bj4rU.mjs";
3
- import "./package-qYegZAPv.mjs";
2
+ import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, s as ExternalPlugin } from "./src-BJnxnJLO.mjs";
3
+ import "./package-BEpC3UYZ.mjs";
4
4
 
5
5
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/run.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cjs_createRequire } from "node:module";
3
3
  const __cjs_require = __cjs_createRequire(import.meta.url);
4
- import { a as globalLogger, d as resolveComma, m as toArray, t as version } from "./package-qYegZAPv.mjs";
4
+ import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-BEpC3UYZ.mjs";
5
5
  import module from "node:module";
6
6
  import process from "node:process";
7
7
  import { dim } from "ansis";
@@ -9,13 +9,28 @@ import { VERSION } from "rolldown";
9
9
  const Debug = __cjs_require("debug");
10
10
  import { cac } from "cac";
11
11
 
12
+ //#region src/features/debug.ts
13
+ const debug = Debug("tsdown:debug");
14
+ function enableDebugLog(cliOptions) {
15
+ const { debugLogs } = cliOptions;
16
+ if (!debugLogs) return;
17
+ let namespace;
18
+ if (debugLogs === true) namespace = "tsdown:*";
19
+ else namespace = resolveComma(toArray(debugLogs)).map((v) => `tsdown:${v}`).join(",");
20
+ const enabled = Debug.disable();
21
+ if (enabled) namespace += `,${enabled}`;
22
+ Debug.enable(namespace);
23
+ debug("Debugging enabled", namespace);
24
+ }
25
+
26
+ //#endregion
12
27
  //#region src/cli.ts
13
28
  const cli = cac("tsdown");
14
29
  cli.help().version(version);
15
30
  cli.command("[...files]", "Bundle files", {
16
31
  ignoreOptionDefaultValue: true,
17
32
  allowUnknownOptions: true
18
- }).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unconfig", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).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("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
33
+ }).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug", "Enable debug mode").option("--debug-logs [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).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("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
19
34
  globalLogger.level = flags.logLevel || (flags.silent ? "error" : "info");
20
35
  globalLogger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
21
36
  const { build: build$1 } = await import("./index.mjs");
@@ -23,20 +38,12 @@ cli.command("[...files]", "Bundle files", {
23
38
  await build$1(flags);
24
39
  });
25
40
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
26
- const { migrate } = await import("./migrate-GNvnRFv2.mjs");
41
+ const { migrate } = await import("./migrate-Dzz7E7av.mjs");
27
42
  await migrate(args);
28
43
  });
29
44
  async function runCLI() {
30
45
  cli.parse(process.argv, { run: false });
31
- if (cli.options.debug) {
32
- let namespace;
33
- if (cli.options.debug === true) namespace = "tsdown:*";
34
- else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
35
- const enabled = Debug.disable();
36
- if (enabled) namespace += `,${enabled}`;
37
- Debug.enable(namespace);
38
- Debug("tsdown:debug")("Debugging enabled", namespace);
39
- }
46
+ enableDebugLog(cli.options);
40
47
  try {
41
48
  await cli.runMatchedCommand();
42
49
  } catch (error) {