tsdown 0.12.3 → 0.12.5

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.
@@ -11,7 +11,6 @@ type Overwrite<T, U> = Omit<T, keyof U> & U;
11
11
  type Awaitable<T> = T | Promise<T>;
12
12
  type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
13
13
  type Arrayable<T> = T | T[];
14
-
15
14
  //#endregion
16
15
  //#region src/utils/logger.d.ts
17
16
  declare class Logger {
@@ -24,12 +23,10 @@ declare class Logger {
24
23
  success(...args: any[]): void;
25
24
  }
26
25
  declare const logger: Logger;
27
-
28
26
  //#endregion
29
27
  //#region src/features/hooks.d.ts
30
28
  interface BuildContext {
31
29
  options: ResolvedOptions;
32
- pkg?: PackageJson;
33
30
  hooks: Hookable<TsdownHooks>;
34
31
  }
35
32
  interface RolldownContext {
@@ -56,7 +53,6 @@ interface TsdownHooks {
56
53
  */
57
54
  "build:done": (ctx: BuildContext) => void | Promise<void>;
58
55
  }
59
-
60
56
  //#endregion
61
57
  //#region src/index.d.ts
62
58
  /**
@@ -74,7 +70,6 @@ type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputA
74
70
  * @param config Resolved options
75
71
  */
76
72
  declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
77
-
78
73
  //#endregion
79
74
  //#region src/features/copy.d.ts
80
75
  interface CopyEntry {
@@ -83,11 +78,9 @@ interface CopyEntry {
83
78
  }
84
79
  type CopyOptions = Arrayable<string | CopyEntry>;
85
80
  type CopyOptionsFn = (options: ResolvedOptions) => Awaitable<CopyOptions>;
86
-
87
81
  //#endregion
88
82
  //#region src/utils/package.d.ts
89
83
  type PackageType = "module" | "commonjs" | undefined;
90
-
91
84
  //#endregion
92
85
  //#region src/features/output.d.ts
93
86
  interface OutExtensionContext {
@@ -101,7 +94,6 @@ interface OutExtensionObject {
101
94
  dts?: string;
102
95
  }
103
96
  type OutExtensionFactory = (context: OutExtensionContext) => OutExtensionObject | undefined;
104
-
105
97
  //#endregion
106
98
  //#region src/features/report.d.ts
107
99
  interface ReportOptions {
@@ -119,7 +111,6 @@ interface ReportOptions {
119
111
  maxCompressSize?: number;
120
112
  }
121
113
  declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: boolean, name?: string, isMultiFormat?: boolean): Plugin;
122
-
123
114
  //#endregion
124
115
  //#region src/options/types.d.ts
125
116
  type Sourcemap = boolean | "inline" | "hidden";
@@ -166,12 +157,25 @@ interface ExportsOptions {
166
157
  */
167
158
  interface Options$3 {
168
159
  /// build options
160
+ /**
161
+ * Defaults to `'src/index.ts'` if it exists.
162
+ */
169
163
  entry?: InputOption;
170
164
  external?: ExternalOption;
171
165
  noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
172
166
  alias?: Record<string, string>;
173
167
  tsconfig?: string | boolean;
174
- /** @default 'node' */
168
+ /**
169
+ * Specifies the target runtime platform for the build.
170
+ *
171
+ * - `node`: Node.js and compatible runtimes (e.g., Deno, Bun).
172
+ * For CJS format, this is always set to `node` and cannot be changed.
173
+ * - `neutral`: A platform-agnostic target with no specific runtime assumptions.
174
+ * - `browser`: Web browsers.
175
+ *
176
+ * @default 'node'
177
+ * @see https://tsdown.dev/options/platform
178
+ */
175
179
  platform?: "node" | "neutral" | "browser";
176
180
  inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
177
181
  /// output options
@@ -266,7 +270,7 @@ interface Options$3 {
266
270
  /**
267
271
  * You can specify command to be executed after a successful build, specially useful for Watch mode
268
272
  */
269
- onSuccess?: string | ((config: ResolvedOptions) => void | Promise<void>);
273
+ onSuccess?: string | ((config: ResolvedOptions, signal: AbortSignal) => void | Promise<void>);
270
274
  /**
271
275
  * Skip bundling `node_modules`.
272
276
  * @default false
@@ -382,12 +386,12 @@ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" |
382
386
  tsconfig: string | false;
383
387
  pkg?: PackageJson;
384
388
  exports: false | ExportsOptions;
385
- }>, "config" | "fromVite">; //#endregion
389
+ }>, "config" | "fromVite">;
390
+ //#endregion
386
391
  //#region src/config.d.ts
387
392
  /**
388
393
  * Defines the configuration for tsdown.
389
394
  */
390
395
  declare function defineConfig(options: UserConfig | UserConfigFn): UserConfig | UserConfigFn;
391
-
392
396
  //#endregion
393
- export { BuildContext, Options$3 as Options, ReportPlugin as ReportPlugin$1, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build$1 as build, buildSingle, defineConfig as defineConfig$1, logger, pkgRoot };
397
+ export { BuildContext, Options$3 as Options, ReportPlugin, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build$1 as build, buildSingle, defineConfig, logger, pkgRoot };
package/dist/config.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { UserConfig, UserConfigFn, defineConfig$1 as defineConfig } from "./config-DQmC8Ss1.js";
1
+ import { UserConfig, UserConfigFn, defineConfig } from "./config-RMenra1a.js";
2
2
  export { UserConfig, UserConfigFn, defineConfig };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig$1 as defineConfig, logger, pkgRoot } from "./config-DQmC8Ss1.js";
1
+ import { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot } from "./config-RMenra1a.js";
2
2
  export { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { defineConfig } from "./config-yiJy1jd0.js";
2
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-D-fqvWYC.js";
3
- import { debounce, generateColor, logger$1 as logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-CS4H_tpu.js";
2
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsExists, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-BgxE5Awo.js";
3
+ import { debounce, generateColor, logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-BMB8Jggq.js";
4
4
  import path from "node:path";
5
5
  import process from "node:process";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import { blue, bold, dim, green, underline } from "ansis";
8
8
  import { build as build$1 } from "rolldown";
9
9
  import { exec } from "tinyexec";
10
- import debug from "debug";
10
+ import Debug from "debug";
11
11
  import { glob } from "tinyglobby";
12
12
  import { readFile, writeFile } from "node:fs/promises";
13
13
  import { RE_DTS } from "rolldown-plugin-dts";
@@ -19,10 +19,10 @@ import { up as up$1 } from "empathic/find";
19
19
  import { loadConfig } from "unconfig";
20
20
 
21
21
  //#region src/features/clean.ts
22
- const debug$4 = debug("tsdown:clean");
22
+ const debug$3 = Debug("tsdown:clean");
23
23
  const RE_LAST_SLASH = /[/\\]$/;
24
24
  async function cleanOutDir(configs) {
25
- const removes = new Set();
25
+ const removes = /* @__PURE__ */ new Set();
26
26
  for (const config of configs) {
27
27
  if (!config.clean.length) continue;
28
28
  const files = await glob(config.clean, {
@@ -39,10 +39,10 @@ async function cleanOutDir(configs) {
39
39
  if (!removes.size) return;
40
40
  logger.info(`Cleaning ${removes.size} files`);
41
41
  await Promise.all([...removes].map(async (file) => {
42
- debug$4("Removing", file);
42
+ debug$3("Removing", file);
43
43
  await fsRemove(file);
44
44
  }));
45
- debug$4("Removed %d files", removes.size);
45
+ debug$3("Removed %d files", removes.size);
46
46
  }
47
47
  function resolveClean(clean, outDir, cwd) {
48
48
  if (clean === true) clean = [slash(outDir)];
@@ -93,7 +93,7 @@ async function generateExports(pkg, outDir, chunks, { devExports, all, customExp
93
93
  const pkgRoot$1 = path.dirname(pkgJsonPath);
94
94
  const outDirRelative = slash(path.relative(pkgRoot$1, outDir));
95
95
  let main, module, cjsTypes, esmTypes;
96
- const exportsMap = new Map();
96
+ const exportsMap = /* @__PURE__ */ new Map();
97
97
  for (const [format, chunksByFormat] of Object.entries(chunks)) {
98
98
  if (format !== "es" && format !== "cjs") continue;
99
99
  const onlyOneEntry = chunksByFormat.filter((chunk) => chunk.type === "chunk" && chunk.isEntry && !RE_DTS.test(chunk.fileName)).length === 1;
@@ -174,13 +174,12 @@ function exportMeta(exports, all) {
174
174
 
175
175
  //#endregion
176
176
  //#region src/features/hooks.ts
177
- async function createHooks$1(options, pkg) {
177
+ async function createHooks$1(options) {
178
178
  const hooks = createHooks();
179
179
  if (typeof options.hooks === "object") hooks.addHooks(options.hooks);
180
180
  else if (typeof options.hooks === "function") await options.hooks(hooks);
181
181
  const context = {
182
182
  options,
183
- pkg,
184
183
  hooks
185
184
  };
186
185
  return {
@@ -242,11 +241,11 @@ async function LightningCSSPlugin(options) {
242
241
 
243
242
  //#endregion
244
243
  //#region src/utils/package.ts
245
- const debug$3 = debug("tsdown:package");
244
+ const debug$2 = Debug("tsdown:package");
246
245
  async function readPackageJson(dir) {
247
246
  const packageJsonPath = up({ cwd: dir });
248
247
  if (!packageJsonPath) return;
249
- debug$3("Reading package.json:", packageJsonPath);
248
+ debug$2("Reading package.json:", packageJsonPath);
250
249
  const contents = await readFile(packageJsonPath, "utf8");
251
250
  return {
252
251
  ...JSON.parse(contents),
@@ -307,7 +306,7 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
307
306
 
308
307
  //#endregion
309
308
  //#region src/features/publint.ts
310
- const debug$2 = debug("tsdown:publint");
309
+ const debug$1 = Debug("tsdown:publint");
311
310
  async function publint(options) {
312
311
  if (!options.publint) return;
313
312
  if (!options.pkg) {
@@ -315,11 +314,11 @@ async function publint(options) {
315
314
  return;
316
315
  }
317
316
  const t = performance.now();
318
- debug$2("Running publint");
317
+ debug$1("Running publint");
319
318
  const { publint: publint$1 } = await import("publint");
320
319
  const { formatMessage } = await import("publint/utils");
321
320
  const { messages } = await publint$1(options.publint === true ? {} : options.publint);
322
- debug$2("Found %d issues", messages.length);
321
+ debug$1("Found %d issues", messages.length);
323
322
  if (!messages.length) logger.success(`No publint issues found`, dim`(${Math.round(performance.now() - t)}ms)`);
324
323
  let hasError = false;
325
324
  for (const message of messages) {
@@ -333,7 +332,7 @@ async function publint(options) {
333
332
  logger[logType](formattedMessage);
334
333
  }
335
334
  if (hasError) {
336
- debug$2("Found errors, setting exit code to 1");
335
+ debug$1("Found errors, setting exit code to 1");
337
336
  process.exitCode = 1;
338
337
  }
339
338
  }
@@ -381,7 +380,7 @@ function shortcuts(restart) {
381
380
  }
382
381
  ];
383
382
  if (input === "h") {
384
- const loggedKeys = new Set();
383
+ const loggedKeys = /* @__PURE__ */ new Set();
385
384
  logger.info(" Shortcuts");
386
385
  for (const shortcut$1 of SHORTCUTS) {
387
386
  if (loggedKeys.has(shortcut$1.key)) continue;
@@ -484,7 +483,11 @@ async function watchBuild(options, configFiles, rebuild, restart) {
484
483
  //#region src/features/entry.ts
485
484
  async function resolveEntry(entry, cwd, name) {
486
485
  const nameLabel = name ? `[${name}] ` : "";
487
- if (!entry || Object.keys(entry).length === 0) throw new Error(`${nameLabel}No input files, try "tsdown <your-file>" instead`);
486
+ if (!entry || Object.keys(entry).length === 0) {
487
+ const defaultEntry = path.resolve(cwd, "src/index.ts");
488
+ if (await fsExists(defaultEntry)) entry = { index: defaultEntry };
489
+ else throw new Error(`${nameLabel}No input files, try "tsdown <your-file>" or create src/index.ts`);
490
+ }
488
491
  const entryMap = await toObjectEntry(entry, cwd);
489
492
  const entries = Object.values(entryMap);
490
493
  if (entries.length === 0) throw new Error(`${nameLabel}Cannot find entry: ${JSON.stringify(entry)}`);
@@ -620,7 +623,7 @@ async function loadConfigFile(options, workspace) {
620
623
 
621
624
  //#endregion
622
625
  //#region src/options/index.ts
623
- const debug$1 = debug("tsdown:options");
626
+ const debug = Debug("tsdown:options");
624
627
  const DEFAULT_EXCLUDE_WORKSPACE = [
625
628
  "**/node_modules/**",
626
629
  "**/dist/**",
@@ -629,20 +632,20 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
629
632
  ];
630
633
  async function resolveOptions(options) {
631
634
  const files = [];
632
- debug$1("options %O", options);
633
- debug$1("loading config file: %s", options.config);
635
+ debug("options %O", options);
636
+ debug("loading config file: %s", options.config);
634
637
  const { configs: rootConfigs, file } = await loadConfigFile(options);
635
638
  if (file) {
636
639
  files.push(file);
637
- debug$1("loaded root config file %s", file);
638
- debug$1("root configs %o", rootConfigs);
639
- } else debug$1("no root config file found");
640
+ debug("loaded root config file %s", file);
641
+ debug("root configs %o", rootConfigs);
642
+ } else debug("no root config file found");
640
643
  const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
641
644
  const { configs: workspaceConfigs, files: workspaceFiles } = await resolveWorkspace(rootConfig, options);
642
645
  if (workspaceFiles) files.push(...workspaceFiles);
643
646
  return Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveConfig(config)));
644
647
  }))).flat();
645
- debug$1("resolved configs %O", configs);
648
+ debug("resolved configs %O", configs);
646
649
  return {
647
650
  configs,
648
651
  files
@@ -684,16 +687,16 @@ async function resolveWorkspace(config, options) {
684
687
  }
685
688
  const files = [];
686
689
  const configs = (await Promise.all(packages.map(async (cwd) => {
687
- debug$1("loading workspace config %s", cwd);
690
+ debug("loading workspace config %s", cwd);
688
691
  const { configs: configs$1, file } = await loadConfigFile({
689
692
  ...options,
690
693
  config: workspaceConfig,
691
694
  cwd
692
695
  }, cwd);
693
696
  if (file) {
694
- debug$1("loaded workspace config file %s", file);
697
+ debug("loaded workspace config file %s", file);
695
698
  files.push(file);
696
- } else debug$1("no workspace config file found in %s", cwd);
699
+ } else debug("no workspace config file found in %s", cwd);
697
700
  return configs$1.map((config$1) => ({
698
701
  ...normalized,
699
702
  cwd,
@@ -812,14 +815,14 @@ const pkgRoot = path.resolve(dirname$1, "..");
812
815
  */
813
816
  async function buildSingle(config, clean) {
814
817
  const { format: formats, dts, watch, onSuccess } = config;
815
- let onSuccessCleanup;
818
+ let ab;
816
819
  const { hooks, context } = await createHooks$1(config);
817
820
  await rebuild(true);
818
821
  if (watch) return () => rebuild();
819
822
  async function rebuild(first) {
820
823
  const startTime = performance.now();
821
824
  await hooks.callHook("build:prepare", context);
822
- onSuccessCleanup?.();
825
+ ab?.abort();
823
826
  await clean();
824
827
  let hasErrors = false;
825
828
  const isMultiFormat = formats.length > 1;
@@ -852,16 +855,19 @@ async function buildSingle(config, clean) {
852
855
  await copy(config);
853
856
  await hooks.callHook("build:done", context);
854
857
  logger.success(prettyName(config.name), `${first ? "Build" : "Rebuild"} complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
858
+ ab = new AbortController();
855
859
  if (typeof onSuccess === "string") {
856
- const p = exec(onSuccess, [], { nodeOptions: {
857
- shell: true,
858
- stdio: "inherit"
859
- } });
860
+ const p = exec(onSuccess, [], {
861
+ nodeOptions: {
862
+ shell: true,
863
+ stdio: "inherit"
864
+ },
865
+ signal: ab.signal
866
+ });
860
867
  p.then(({ exitCode }) => {
861
868
  if (exitCode) process.exitCode = exitCode;
862
869
  });
863
- onSuccessCleanup = () => p.kill("SIGTERM");
864
- } else await onSuccess?.(config);
870
+ } else await onSuccess?.(config, ab.signal);
865
871
  }
866
872
  }
867
873
  async function getBuildOptions(config, format, isMultiFormat, cjsDts) {
@@ -900,7 +906,7 @@ async function getBuildOptions(config, format, isMultiFormat, cjsDts) {
900
906
  tsconfigFilename: tsconfig || void 0
901
907
  },
902
908
  treeshake,
903
- platform,
909
+ platform: cjsDts || format === "cjs" ? "node" : platform,
904
910
  define: {
905
911
  ...define,
906
912
  ...Object.keys(env).reduce((acc, key) => {
@@ -910,6 +916,7 @@ async function getBuildOptions(config, format, isMultiFormat, cjsDts) {
910
916
  return acc;
911
917
  }, Object.create(null))
912
918
  },
919
+ transform: { target },
913
920
  plugins,
914
921
  inject: { ...shims && !cjsDts && getShimsInject(format, platform) },
915
922
  moduleTypes: loader
@@ -920,7 +927,6 @@ async function getBuildOptions(config, format, isMultiFormat, cjsDts) {
920
927
  name: config.globalName,
921
928
  sourcemap,
922
929
  dir: outDir,
923
- target,
924
930
  minify: !cjsDts && minify,
925
931
  entryFileNames,
926
932
  chunkFileNames,
@@ -71,7 +71,7 @@ function prettyFormat(format) {
71
71
  }
72
72
  return formatColor(`[${formatText}]`);
73
73
  }
74
- const colors = new Map();
74
+ const colors = /* @__PURE__ */ new Map();
75
75
  function generateColor(name = "default") {
76
76
  if (colors.has(name)) return colors.get(name);
77
77
  let color;
@@ -117,4 +117,4 @@ function hue2rgb(p, q, t) {
117
117
  }
118
118
 
119
119
  //#endregion
120
- export { debounce, generateColor, logger as logger$1, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray };
120
+ export { debounce, generateColor, logger, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray };
@@ -1,5 +1,5 @@
1
- import { logger$1 as logger } from "./logger-CS4H_tpu.js";
2
- import { version } from "./package-CukXLRwS.js";
1
+ import { logger } from "./logger-BMB8Jggq.js";
2
+ import { version } from "./package-BQ8czGAY.js";
3
3
  import process from "node:process";
4
4
  import { bold, green, underline } from "ansis";
5
5
  import { readFile, unlink, writeFile } from "node:fs/promises";
@@ -0,0 +1,5 @@
1
+ //#region package.json
2
+ var version = "0.12.5";
3
+
4
+ //#endregion
5
+ export { version };
@@ -1,7 +1,8 @@
1
- import { logger$1 as logger, noop, prettyFormat, prettyName, toArray } from "./logger-CS4H_tpu.js";
1
+ import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-BMB8Jggq.js";
2
+ import { isBuiltin } from "node:module";
2
3
  import path, { dirname, normalize, sep } from "node:path";
3
4
  import { bold, dim, green, underline } from "ansis";
4
- import debug from "debug";
5
+ import Debug from "debug";
5
6
  import { access, chmod, cp, rm, stat } from "node:fs/promises";
6
7
  import { RE_DTS } from "rolldown-plugin-dts";
7
8
  import { Buffer } from "node:buffer";
@@ -48,7 +49,7 @@ function lowestCommonAncestor(...filepaths) {
48
49
 
49
50
  //#endregion
50
51
  //#region src/features/external.ts
51
- const debug$2 = debug("tsdown:external");
52
+ const debug$1 = Debug("tsdown:external");
52
53
  function ExternalPlugin(options) {
53
54
  const deps = options.pkg && Array.from(getProductionDeps(options.pkg));
54
55
  return {
@@ -71,10 +72,11 @@ function ExternalPlugin(options) {
71
72
  }
72
73
  if (deps) shouldExternal ||= deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
73
74
  if (shouldExternal) {
74
- debug$2("External dependency:", id);
75
+ debug$1("External dependency:", id);
75
76
  return {
76
77
  id,
77
- external: shouldExternal
78
+ external: shouldExternal,
79
+ moduleSideEffects: id.startsWith("node:") || isBuiltin(id) ? false : void 0
78
80
  };
79
81
  }
80
82
  }
@@ -120,7 +122,7 @@ function formatBytes(bytes) {
120
122
 
121
123
  //#endregion
122
124
  //#region src/features/report.ts
123
- const debug$1 = debug("tsdown:report");
125
+ const debug = Debug("tsdown:report");
124
126
  const brotliCompressAsync = promisify(brotliCompress);
125
127
  const gzipAsync = promisify(gzip);
126
128
  function ReportPlugin(options, cwd, cjsDts, name, isMultiFormat) {
@@ -161,19 +163,19 @@ function ReportPlugin(options, cwd, cjsDts, name, isMultiFormat) {
161
163
  };
162
164
  }
163
165
  async function calcSize(options, chunk) {
164
- debug$1(`Calculating size for`, chunk.fileName);
166
+ debug(`Calculating size for`, chunk.fileName);
165
167
  const content = chunk.type === "chunk" ? chunk.code : chunk.source;
166
168
  const raw = Buffer.byteLength(content, "utf8");
167
- debug$1("[size]", chunk.fileName, raw);
169
+ debug("[size]", chunk.fileName, raw);
168
170
  let gzip$1 = Infinity;
169
171
  let brotli = Infinity;
170
- if (raw > (options.maxCompressSize ?? 1e6)) debug$1(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
172
+ if (raw > (options.maxCompressSize ?? 1e6)) debug(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
171
173
  else {
172
174
  gzip$1 = (await gzipAsync(content)).length;
173
- debug$1("[gzip]", chunk.fileName, gzip$1);
175
+ debug("[gzip]", chunk.fileName, gzip$1);
174
176
  if (options.brotli) {
175
177
  brotli = (await brotliCompressAsync(content)).length;
176
- debug$1("[brotli]", chunk.fileName, brotli);
178
+ debug("[brotli]", chunk.fileName, brotli);
177
179
  }
178
180
  }
179
181
  return {
@@ -210,4 +212,4 @@ function ShebangPlugin(cwd, name, isMultiFormat) {
210
212
  }
211
213
 
212
214
  //#endregion
213
- export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor };
215
+ export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsExists, fsRemove, fsStat, lowestCommonAncestor };
package/dist/plugins.d.ts CHANGED
@@ -1,17 +1,15 @@
1
- import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./config-DQmC8Ss1.js";
1
+ import { ReportPlugin, ResolvedOptions } from "./config-RMenra1a.js";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
5
5
  //#region src/features/external.d.ts
6
6
  declare function ExternalPlugin(options: ResolvedOptions): Plugin;
7
-
8
- //#endregion
9
- //#region src/features/shebang.d.ts
10
7
  /*
11
8
  * Production deps should be excluded from the bundle
12
9
  */
10
+ //#endregion
11
+ //#region src/features/shebang.d.ts
13
12
  declare function ShebangPlugin(cwd: string, name?: string, isMultiFormat?: boolean): Plugin;
14
-
15
13
  //#endregion
16
14
  //#region src/features/node-protocol.d.ts
17
15
  /**
@@ -19,6 +17,5 @@ declare function ShebangPlugin(cwd: string, name?: string, isMultiFormat?: boole
19
17
  * @see https://nodejs.org/api/esm.html#node-imports
20
18
  */
21
19
  declare function NodeProtocolPlugin(): Plugin;
22
-
23
20
  //#endregion
24
21
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-D-fqvWYC.js";
2
- import "./logger-CS4H_tpu.js";
1
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-BgxE5Awo.js";
2
+ import "./logger-BMB8Jggq.js";
3
3
 
4
4
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/run.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { logger$1 as logger, resolveComma, toArray } from "./logger-CS4H_tpu.js";
3
- import { version } from "./package-CukXLRwS.js";
2
+ import { logger, resolveComma, toArray } from "./logger-BMB8Jggq.js";
3
+ import { version } from "./package-BQ8czGAY.js";
4
4
  import module from "node:module";
5
5
  import process from "node:process";
6
6
  import { dim } from "ansis";
7
7
  import { VERSION } from "rolldown";
8
- import debug from "debug";
8
+ import Debug from "debug";
9
9
  import { cac } from "cac";
10
10
 
11
11
  //#region src/cli.ts
@@ -22,7 +22,7 @@ cli.command("[...files]", "Bundle files", {
22
22
  await build$1(flags);
23
23
  });
24
24
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
25
- const { migrate } = await import("./migrate-Df0wndmk.js");
25
+ const { migrate } = await import("./migrate-nO5Up2ZS.js");
26
26
  await migrate(args);
27
27
  });
28
28
  async function runCLI() {
@@ -31,10 +31,10 @@ async function runCLI() {
31
31
  let namespace;
32
32
  if (cli.options.debug === true) namespace = "tsdown:*";
33
33
  else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
34
- const enabled = debug.disable();
34
+ const enabled = Debug.disable();
35
35
  if (enabled) namespace += `,${enabled}`;
36
- debug.enable(namespace);
37
- debug("tsdown:debug")("Debugging enabled", namespace);
36
+ Debug.enable(namespace);
37
+ Debug("tsdown:debug")("Debugging enabled", namespace);
38
38
  }
39
39
  try {
40
40
  await cli.runMatchedCommand();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.12.3",
3
+ "version": "0.12.5",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -63,18 +63,18 @@
63
63
  }
64
64
  },
65
65
  "dependencies": {
66
- "ansis": "^4.0.0",
66
+ "ansis": "^4.1.0",
67
67
  "cac": "^6.7.14",
68
68
  "chokidar": "^4.0.3",
69
69
  "debug": "^4.4.1",
70
70
  "diff": "^8.0.2",
71
71
  "empathic": "^1.1.0",
72
72
  "hookable": "^5.5.3",
73
- "rolldown": "1.0.0-beta.9-commit.d91dfb5",
74
- "rolldown-plugin-dts": "^0.13.4",
73
+ "rolldown": "1.0.0-beta.10-commit.87188ed",
74
+ "rolldown-plugin-dts": "^0.13.6",
75
75
  "semver": "^7.7.2",
76
76
  "tinyexec": "^1.0.1",
77
- "tinyglobby": "^0.2.13",
77
+ "tinyglobby": "^0.2.14",
78
78
  "unconfig": "^7.3.2"
79
79
  },
80
80
  "devDependencies": {
@@ -83,16 +83,17 @@
83
83
  "@sxzz/prettier-config": "^2.2.1",
84
84
  "@sxzz/test-utils": "^0.5.6",
85
85
  "@types/debug": "^4.1.12",
86
- "@types/node": "^22.15.21",
86
+ "@types/node": "^22.15.27",
87
87
  "@types/semver": "^7.7.0",
88
88
  "@unocss/eslint-plugin": "^66.1.2",
89
+ "@vueuse/core": "^13.3.0",
89
90
  "bumpp": "^10.1.1",
90
91
  "eslint": "^9.27.0",
91
92
  "lightningcss": "^1.30.1",
92
93
  "pkg-types": "^2.1.0",
93
94
  "prettier": "^3.5.3",
94
95
  "publint": "^0.3.12",
95
- "typedoc": "^0.28.4",
96
+ "typedoc": "^0.28.5",
96
97
  "typedoc-plugin-markdown": "^4.6.3",
97
98
  "typescript": "~5.8.3",
98
99
  "unocss": "^66.1.2",
@@ -101,9 +102,9 @@
101
102
  "vite": "^6.3.5",
102
103
  "vitepress": "^1.6.3",
103
104
  "vitepress-plugin-group-icons": "^1.5.5",
104
- "vitepress-plugin-llms": "^1.3.3",
105
+ "vitepress-plugin-llms": "^1.3.4",
105
106
  "vitest": "^3.1.4",
106
- "vue": "^3.5.14"
107
+ "vue": "^3.5.16"
107
108
  },
108
109
  "engines": {
109
110
  "node": ">=18.0.0"
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.12.3";
3
-
4
- //#endregion
5
- export { version };