tsdown 0.17.2 → 0.17.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.
@@ -1,4 +1,4 @@
1
- import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-BQZ2CZuJ.mjs";
1
+ import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-By1cRKOf.mjs";
2
2
 
3
3
  //#region src/config.d.ts
4
4
 
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-BQZ2CZuJ.mjs";
2
- import { t as defineConfig } from "./config-DPU-roRC.mjs";
1
+ import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-By1cRKOf.mjs";
2
+ import { t as defineConfig } from "./config-AyGupPUp.mjs";
3
3
  export { UserConfig, UserConfigExport, UserConfigFn, defineConfig };
@@ -16,8 +16,21 @@ type Arrayable<T> = T | T[];
16
16
  //#endregion
17
17
  //#region src/features/copy.d.ts
18
18
  interface CopyEntry {
19
- from: string;
20
- to: string;
19
+ /**
20
+ * Source path or glob pattern.
21
+ */
22
+ from: string | string[];
23
+ /**
24
+ * Destination path.
25
+ * If not specified, defaults to the output directory ("outDir").
26
+ */
27
+ to?: string;
28
+ /**
29
+ * Whether to flatten the copied files (not preserving directory structure).
30
+ *
31
+ * @default false
32
+ */
33
+ flatten?: boolean;
21
34
  }
22
35
  type CopyOptions = Arrayable<string | CopyEntry>;
23
36
  type CopyOptionsFn = (options: ResolvedConfig) => Awaitable<CopyOptions>;
@@ -189,7 +202,7 @@ interface ReportOptions {
189
202
  */
190
203
  maxCompressSize?: number;
191
204
  }
192
- declare function ReportPlugin(userOptions: ReportOptions, logger: Logger, cwd: string, cjsDts?: boolean, name?: string, isDualFormat?: boolean): Plugin;
205
+ declare function ReportPlugin(userOptions: ReportOptions, logger: Logger, cwd: string, cjsDts?: boolean, nameLabel?: string, isDualFormat?: boolean): Plugin;
193
206
  //#endregion
194
207
  //#region src/config/types.d.ts
195
208
  type Sourcemap = boolean | "inline" | "hidden";
@@ -535,7 +548,10 @@ interface UserConfig {
535
548
  * ```ts
536
549
  * [
537
550
  * 'src/assets',
551
+ * 'src/env.d.ts',
552
+ * 'src/styles/**\/*.css',
538
553
  * { from: 'src/assets', to: 'dist/assets' },
554
+ * { from: 'src/styles/**\/*.css', to: 'dist', flatten: true },
539
555
  * ]
540
556
  * ```
541
557
  */
@@ -567,6 +583,7 @@ type UserConfigFn = (inlineConfig: InlineConfig, context: {
567
583
  }) => Awaitable<Arrayable<UserConfig>>;
568
584
  type UserConfigExport = Awaitable<Arrayable<UserConfig> | UserConfigFn>;
569
585
  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">, {
586
+ nameLabel: string | undefined;
570
587
  format: NormalizedFormat;
571
588
  target?: string[];
572
589
  clean: string[];
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as OutExtensionObject, C as TsdownBundle, D as ChunkAddonObject, E as ChunkAddonFunction, F as TsdownHooks, I as DebugOptions, L as CopyEntry, M as PackageType, N as BuildContext, O as OutExtensionContext, P as RolldownContext, R as CopyOptions, S as RolldownChunk, T as ChunkAddon, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as ResolvedConfig, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as PackageJsonWithPath, k as OutExtensionFactory, l as Sourcemap, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as PublintOptions, t as CIOption, u as TreeshakingOptions, w as AttwOptions, x as ExportsOptions, y as Logger, z as CopyOptionsFn } from "./index-BQZ2CZuJ.mjs";
2
- import { t as defineConfig } from "./config-DPU-roRC.mjs";
1
+ import { A as OutExtensionObject, C as TsdownBundle, D as ChunkAddonObject, E as ChunkAddonFunction, F as TsdownHooks, I as DebugOptions, L as CopyEntry, M as PackageType, N as BuildContext, O as OutExtensionContext, P as RolldownContext, R as CopyOptions, S as RolldownChunk, T as ChunkAddon, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as ResolvedConfig, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as PackageJsonWithPath, k as OutExtensionFactory, l as Sourcemap, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as PublintOptions, t as CIOption, u as TreeshakingOptions, w as AttwOptions, x as ExportsOptions, y as Logger, z as CopyOptionsFn } from "./index-By1cRKOf.mjs";
2
+ import { t as defineConfig } from "./config-AyGupPUp.mjs";
3
3
  import * as Rolldown from "rolldown";
4
4
 
5
5
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as defineConfig } from "./config-DLSWqKoz.mjs";
2
- import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-CrG1HehQ.mjs";
3
- import { a as globalLogger } from "./package-Dh6dU6y0.mjs";
2
+ import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-CrcPAzch.mjs";
3
+ import { o as globalLogger } from "./package-C_J1HjlZ.mjs";
4
4
 
5
5
  export { Rolldown, build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -100,9 +100,9 @@ function createLogger(level = "info", { customLogger, console = globalThis.conso
100
100
  return logger;
101
101
  }
102
102
  const globalLogger = createLogger();
103
- function prettyName(name) {
103
+ function getNameLabel(ansis, name) {
104
104
  if (!name) return void 0;
105
- return generateColor(name)(`[${name}]`);
105
+ return ansis(`[${name}]`);
106
106
  }
107
107
  function prettyFormat(format$1) {
108
108
  const formatColor = format$1 === "es" ? blue : format$1 === "cjs" ? yellow : noop;
@@ -161,7 +161,7 @@ function hue2rgb(p, q, t) {
161
161
 
162
162
  //#endregion
163
163
  //#region package.json
164
- var version = "0.17.2";
164
+ var version = "0.17.3";
165
165
 
166
166
  //#endregion
167
- export { globalLogger as a, importWithError as c, pkgExists as d, promiseWithResolvers as f, toArray as g, slash as h, generateColor as i, matchPattern as l, resolveRegex as m, LogLevels as n, prettyFormat as o, resolveComma as p, createLogger as r, prettyName as s, version as t, noop as u };
167
+ export { getNameLabel as a, importWithError as c, pkgExists as d, promiseWithResolvers as f, toArray as g, slash as h, generateColor as i, matchPattern as l, resolveRegex as m, LogLevels as n, globalLogger as o, resolveComma as p, createLogger as r, prettyFormat as s, version as t, noop as u };
@@ -1,4 +1,4 @@
1
- import { C as TsdownBundle, c as ResolvedConfig, v as ReportPlugin, y as Logger } from "./index-BQZ2CZuJ.mjs";
1
+ import { C as TsdownBundle, c as ResolvedConfig, v as ReportPlugin, y as Logger } from "./index-By1cRKOf.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
 
4
4
  //#region src/features/external.d.ts
@@ -17,7 +17,7 @@ declare function ExternalPlugin({
17
17
  declare function NodeProtocolPlugin(nodeProtocolOption: "strip" | true): Plugin;
18
18
  //#endregion
19
19
  //#region src/features/shebang.d.ts
20
- declare function ShebangPlugin(logger: Logger, cwd: string, name?: string, isDualFormat?: boolean): Plugin;
20
+ declare function ShebangPlugin(logger: Logger, cwd: string, nameLabel?: string, isDualFormat?: boolean): Plugin;
21
21
  //#endregion
22
22
  //#region src/features/watch.d.ts
23
23
  declare function WatchPlugin(configFiles: string[], {
package/dist/plugins.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-CrG1HehQ.mjs";
2
- import "./package-Dh6dU6y0.mjs";
1
+ import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-CrcPAzch.mjs";
2
+ import "./package-C_J1HjlZ.mjs";
3
3
 
4
4
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
package/dist/run.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-Dh6dU6y0.mjs";
2
+ import { g as toArray, o as globalLogger, p as resolveComma, t as version } from "./package-C_J1HjlZ.mjs";
3
3
  import module from "node:module";
4
4
  import { dim } from "ansis";
5
5
  import { VERSION } from "rolldown";
@@ -60,7 +60,7 @@ async function runCLI() {
60
60
  try {
61
61
  await cli.runMatchedCommand();
62
62
  } catch (error) {
63
- globalLogger.error(error);
63
+ globalLogger.error(String(error.stack || error.message));
64
64
  process.exit(1);
65
65
  }
66
66
  }
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __cjs_createRequire } from "node:module";
2
2
  const __cjs_require = __cjs_createRequire(import.meta.url);
3
- import { a as globalLogger, c as importWithError, d as pkgExists, f as promiseWithResolvers, g as toArray, h as slash, i as generateColor, l as matchPattern, m as resolveRegex, n as LogLevels, o as prettyFormat, p as resolveComma, r as createLogger, s as prettyName, t as version, u as noop } from "./package-Dh6dU6y0.mjs";
3
+ import { a as getNameLabel, c as importWithError, d as pkgExists, f as promiseWithResolvers, g as toArray, h as slash, i as generateColor, l as matchPattern, m as resolveRegex, n as LogLevels, o as globalLogger, p as resolveComma, r as createLogger, s as prettyFormat, t as version, u as noop } from "./package-C_J1HjlZ.mjs";
4
4
  import { builtinModules, isBuiltin } from "node:module";
5
5
  import path, { dirname, join, normalize, sep } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -12,6 +12,7 @@ import { createDebug } from "obug";
12
12
  import { access, chmod, cp, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
13
13
  import process, { env } from "node:process";
14
14
  import { createConfigCoreLoader } from "unconfig-core";
15
+ import { createDefu } from "defu";
15
16
  import { glob, isDynamicPattern } from "tinyglobby";
16
17
  import { RE_CSS, RE_DTS, RE_JS, RE_NODE_MODULES } from "rolldown-plugin-dts/filename";
17
18
  const minVersion = __cjs_require("semver/ranges/min-version.js");
@@ -249,17 +250,16 @@ async function cleanChunks(outDir, chunks) {
249
250
 
250
251
  //#endregion
251
252
  //#region src/features/entry.ts
252
- async function resolveEntry(logger, entry, cwd, name) {
253
- const nameLabel = name ? `[${name}] ` : "";
253
+ async function resolveEntry(logger, entry, cwd, color, nameLabel) {
254
254
  if (!entry || Object.keys(entry).length === 0) {
255
255
  const defaultEntry = path.resolve(cwd, "src/index.ts");
256
256
  if (await fsExists(defaultEntry)) entry = { index: defaultEntry };
257
- else throw new Error(`${nameLabel}No input files, try "tsdown <your-file>" or create src/index.ts`);
257
+ else throw new Error(`${nameLabel} No input files, try "tsdown <your-file>" or create src/index.ts`);
258
258
  }
259
259
  const entryMap = await toObjectEntry(entry, cwd);
260
260
  const entries = Object.values(entryMap);
261
- if (entries.length === 0) throw new Error(`${nameLabel}Cannot find entry: ${JSON.stringify(entry)}`);
262
- logger.info(prettyName(name), `entry: ${generateColor(name)(entries.map((entry$1) => path.relative(cwd, entry$1)).join(", "))}`);
261
+ if (entries.length === 0) throw new Error(`${nameLabel} Cannot find entry: ${JSON.stringify(entry)}`);
262
+ logger.info(nameLabel, `entry: ${color(entries.map((entry$1) => path.relative(cwd, entry$1)).join(", "))}`);
263
263
  return entryMap;
264
264
  }
265
265
  async function toObjectEntry(entry, cwd) {
@@ -414,7 +414,7 @@ function hasExportsTypes(pkg) {
414
414
 
415
415
  //#endregion
416
416
  //#region src/features/target.ts
417
- function resolveTarget(logger, target, pkg, name) {
417
+ function resolveTarget(logger, target, color, pkg, nameLabel) {
418
418
  if (target === false) return;
419
419
  if (target == null) {
420
420
  const pkgTarget = resolvePackageTarget(pkg);
@@ -423,7 +423,7 @@ function resolveTarget(logger, target, pkg, name) {
423
423
  }
424
424
  if (typeof target === "number") throw new TypeError(`Invalid target: ${target}`);
425
425
  const targets = resolveComma(toArray(target));
426
- if (targets.length) logger.info(prettyName(name), `target${targets.length > 1 ? "s" : ""}: ${generateColor(name)(targets.join(", "))}`);
426
+ if (targets.length) logger.info(nameLabel, `target${targets.length > 1 ? "s" : ""}: ${color(targets.join(", "))}`);
427
427
  return targets;
428
428
  }
429
429
  function resolvePackageTarget(pkg) {
@@ -440,7 +440,7 @@ function resolvePackageTarget(pkg) {
440
440
  function findTsconfig(cwd, name = "tsconfig.json") {
441
441
  return up(name, { cwd }) || false;
442
442
  }
443
- async function resolveTsconfig(logger, tsconfig, cwd, name) {
443
+ async function resolveTsconfig(logger, tsconfig, cwd, color, nameLabel) {
444
444
  const original = tsconfig;
445
445
  if (tsconfig !== false) {
446
446
  if (tsconfig === true || tsconfig == null) {
@@ -458,7 +458,7 @@ async function resolveTsconfig(logger, tsconfig, cwd, name) {
458
458
  if (!tsconfig) logger.warn(`tsconfig ${blue(original)} doesn't exist`);
459
459
  }
460
460
  }
461
- if (tsconfig) logger.info(prettyName(name), `tsconfig: ${generateColor(name)(path.relative(cwd, tsconfig))}`);
461
+ if (tsconfig) logger.info(nameLabel, `tsconfig: ${color(path.relative(cwd, tsconfig))}`);
462
462
  }
463
463
  return tsconfig;
464
464
  }
@@ -500,6 +500,8 @@ async function resolveUserConfig(userConfig, inlineConfig) {
500
500
  let { entry, format = ["es"], plugins = [], clean = true, silent = false, logLevel = silent ? "silent" : "info", failOnWarn = "ci-only", customLogger, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch: watch$1 = false, ignoreWatch, shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, attw: attw$1 = false, fromVite, alias, tsconfig, report = true, target, env: env$1 = {}, copy: copy$1, publicDir, hash = true, cwd = process.cwd(), name, workspace, external, noExternal, exports = false, bundle, unbundle = typeof bundle === "boolean" ? !bundle : false, removeNodeProtocol, nodeProtocol, cjsDefault = true, globImport = true, inlineOnly, fixedExtension = platform === "node", debug: debug$10 = false, write = true } = userConfig;
501
501
  const pkg = await readPackageJson(cwd);
502
502
  if (workspace) name ||= pkg?.name;
503
+ const color = generateColor(name);
504
+ const nameLabel = getNameLabel(color, name);
503
505
  if (!filterConfig(inlineConfig.filter, cwd, name)) {
504
506
  debugLog("[filter] skipping config %s", cwd);
505
507
  return [];
@@ -513,10 +515,10 @@ async function resolveUserConfig(userConfig, inlineConfig) {
513
515
  nodeProtocol = nodeProtocol ?? (removeNodeProtocol ? "strip" : false);
514
516
  outDir = path.resolve(cwd, outDir);
515
517
  clean = resolveClean(clean, outDir, cwd);
516
- entry = await resolveEntry(logger, entry, cwd, name);
518
+ entry = await resolveEntry(logger, entry, cwd, color, nameLabel);
517
519
  if (dts == null) dts = !!(pkg?.types || pkg?.typings || hasExportsTypes(pkg));
518
- target = resolveTarget(logger, target, pkg, name);
519
- tsconfig = await resolveTsconfig(logger, tsconfig, cwd, name);
520
+ target = resolveTarget(logger, target, color, pkg, nameLabel);
521
+ tsconfig = await resolveTsconfig(logger, tsconfig, cwd, color, nameLabel);
520
522
  if (typeof external === "string") external = resolveRegex(external);
521
523
  if (typeof noExternal === "string") noExternal = resolveRegex(noExternal);
522
524
  publint$1 = resolveFeatureOption(publint$1, {});
@@ -527,8 +529,8 @@ async function resolveUserConfig(userConfig, inlineConfig) {
527
529
  dts = resolveFeatureOption(dts, {});
528
530
  if (!pkg) {
529
531
  if (exports) throw new Error("`package.json` not found, cannot write exports");
530
- if (publint$1) logger.warn(prettyName(name), "publint is enabled but package.json is not found");
531
- if (attw$1) logger.warn(prettyName(name), "attw is enabled but package.json is not found");
532
+ if (publint$1) logger.warn(nameLabel, "publint is enabled but package.json is not found");
533
+ if (attw$1) logger.warn(nameLabel, "attw is enabled but package.json is not found");
532
534
  }
533
535
  if (publicDir) if (copy$1) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
534
536
  else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
@@ -580,6 +582,7 @@ async function resolveUserConfig(userConfig, inlineConfig) {
580
582
  inlineOnly,
581
583
  logger,
582
584
  name,
585
+ nameLabel,
583
586
  nodeProtocol,
584
587
  noExternal,
585
588
  outDir,
@@ -606,19 +609,22 @@ async function resolveUserConfig(userConfig, inlineConfig) {
606
609
  return {
607
610
  ...config,
608
611
  copy: once ? config.copy : void 0,
609
- hooks: once ? config.hooks : void 0,
610
612
  onSuccess: once ? config.onSuccess : void 0,
611
613
  format: normalizeFormat(fmt),
612
614
  ...overrides
613
615
  };
614
616
  });
615
617
  }
618
+ const defu = createDefu((obj, key, value) => {
619
+ if (Array.isArray(obj[key]) && Array.isArray(value)) {
620
+ obj[key] = value;
621
+ return true;
622
+ }
623
+ });
616
624
  async function mergeUserOptions(defaults, user, args) {
617
625
  const userOutputOptions = typeof user === "function" ? await user(defaults, ...args) : user;
618
- return {
619
- ...defaults,
620
- ...userOutputOptions
621
- };
626
+ if (!userOutputOptions) return defaults;
627
+ return defu(userOutputOptions, defaults);
622
628
  }
623
629
  function resolveFeatureOption(value, defaults) {
624
630
  if (typeof value === "object" && value !== null) return resolveCIOption(value.enabled ?? true) ? value : false;
@@ -740,15 +746,31 @@ function warnLegacyCJS(config) {
740
746
  //#region src/features/copy.ts
741
747
  async function copy(options) {
742
748
  if (!options.copy) return;
743
- const resolved = toArray(typeof options.copy === "function" ? await options.copy(options) : options.copy).map((dir) => {
744
- const from = path.resolve(options.cwd, typeof dir === "string" ? dir : dir.from);
745
- return [from, typeof dir === "string" ? path.resolve(options.outDir, path.basename(from)) : path.resolve(options.cwd, dir.to)];
746
- });
747
- const name = prettyName(options.name);
749
+ const copy$1 = typeof options.copy === "function" ? await options.copy(options) : options.copy;
750
+ const resolved = (await Promise.all(toArray(copy$1).map(async (entry) => {
751
+ if (typeof entry === "string") entry = { from: [entry] };
752
+ let from = toArray(entry.from);
753
+ if (from.some((f) => isDynamicPattern(f))) from = await glob(from, {
754
+ cwd: options.cwd,
755
+ onlyFiles: true,
756
+ expandDirectories: false
757
+ });
758
+ return Promise.all(from.map((file) => resolveCopyEntry({
759
+ ...entry,
760
+ from: file
761
+ })));
762
+ }))).flat();
748
763
  await Promise.all(resolved.map(([from, to]) => {
749
- options.logger.info(name, `Copying files from ${path.relative(options.cwd, from)} to ${path.relative(options.cwd, to)}`);
764
+ options.logger.info(options.nameLabel, `Copying files from ${path.relative(options.cwd, from)} to ${path.relative(options.cwd, to)}`);
750
765
  return fsCopy(from, to);
751
766
  }));
767
+ async function resolveCopyEntry(entry) {
768
+ const from = path.resolve(options.cwd, entry.from);
769
+ const parsedFrom = path.parse(path.relative(options.cwd, from));
770
+ const dest = entry.to ? path.resolve(options.cwd, entry.to) : options.outDir;
771
+ if (entry.flatten || !parsedFrom.dir) return [from, (await fsStat(from))?.isFile() ? path.join(dest, parsedFrom.base) : dest];
772
+ return [from, path.join(dest, parsedFrom.dir.replace(parsedFrom.dir.split(path.sep)[0], ""), parsedFrom.base)];
773
+ }
752
774
  }
753
775
 
754
776
  //#endregion
@@ -836,8 +858,8 @@ async function attw(options) {
836
858
  });
837
859
  if (problems.length) errorMessage = `problems found:\n${problems.map(formatProblem).join("\n")}`;
838
860
  } else errorMessage = `Package has no types`;
839
- if (errorMessage) options.logger[level](prettyName(options.name), label$1, errorMessage);
840
- else options.logger.success(prettyName(options.name), label$1, "No problems found", dim`(${Math.round(performance.now() - t)}ms)`);
861
+ if (errorMessage) options.logger[level](options.nameLabel, label$1, errorMessage);
862
+ else options.logger.success(options.nameLabel, label$1, "No problems found", dim`(${Math.round(performance.now() - t)}ms)`);
841
863
  }
842
864
  /**
843
865
  * Format an ATTW problem for display
@@ -872,7 +894,7 @@ const label = dim`[publint]`;
872
894
  async function publint(options) {
873
895
  if (!options.publint) return;
874
896
  if (!options.pkg) {
875
- options.logger.warn(prettyName(options.name), "publint is enabled but package.json is not found");
897
+ options.logger.warn(options.nameLabel, "publint is enabled but package.json is not found");
876
898
  return;
877
899
  }
878
900
  const t = performance.now();
@@ -885,7 +907,7 @@ async function publint(options) {
885
907
  });
886
908
  debug$3("Found %d issues", messages.length);
887
909
  if (!messages.length) {
888
- options.logger.success(prettyName(options.name), label, "No issues found", dim`(${Math.round(performance.now() - t)}ms)`);
910
+ options.logger.success(options.nameLabel, label, "No issues found", dim`(${Math.round(performance.now() - t)}ms)`);
889
911
  return;
890
912
  }
891
913
  for (const message of messages) {
@@ -895,7 +917,7 @@ async function publint(options) {
895
917
  warning: "warn",
896
918
  suggestion: "info"
897
919
  }[message.type];
898
- options.logger[logType](prettyName(options.name), label, formattedMessage);
920
+ options.logger[logType](options.nameLabel, label, formattedMessage);
899
921
  }
900
922
  }
901
923
 
@@ -1157,7 +1179,7 @@ const defaultOptions = {
1157
1179
  brotli: false,
1158
1180
  maxCompressSize: 1e6
1159
1181
  };
1160
- function ReportPlugin(userOptions, logger, cwd, cjsDts, name, isDualFormat) {
1182
+ function ReportPlugin(userOptions, logger, cwd, cjsDts, nameLabel, isDualFormat) {
1161
1183
  const options = {
1162
1184
  ...defaultOptions,
1163
1185
  ...userOptions
@@ -1187,7 +1209,6 @@ function ReportPlugin(userOptions, logger, cwd, cjsDts, name, isDualFormat) {
1187
1209
  if (a.isEntry !== b.isEntry) return a.isEntry ? -1 : 1;
1188
1210
  return b.raw - a.raw;
1189
1211
  });
1190
- const nameLabel = prettyName(name);
1191
1212
  const formatLabel = isDualFormat && prettyFormat(cjsDts ? "cjs" : outputOptions.format);
1192
1213
  for (const size of sizes) {
1193
1214
  const filenameColor = size.dts ? green : noop;
@@ -1232,7 +1253,7 @@ async function calcSize(options, chunk) {
1232
1253
  //#endregion
1233
1254
  //#region src/features/shebang.ts
1234
1255
  const RE_SHEBANG = /^#!.*/;
1235
- function ShebangPlugin(logger, cwd, name, isDualFormat) {
1256
+ function ShebangPlugin(logger, cwd, nameLabel, isDualFormat) {
1236
1257
  return {
1237
1258
  name: "tsdown:shebang",
1238
1259
  async writeBundle(options, bundle) {
@@ -1241,7 +1262,7 @@ function ShebangPlugin(logger, cwd, name, isDualFormat) {
1241
1262
  if (!RE_SHEBANG.test(chunk.code)) continue;
1242
1263
  const filepath = path.resolve(cwd, options.file || path.join(options.dir, chunk.fileName));
1243
1264
  if (await fsExists(filepath)) {
1244
- logger.info(prettyName(name), isDualFormat && prettyFormat(options.format), `Granting execute permission to ${underline(path.relative(cwd, filepath))}`);
1265
+ logger.info(nameLabel, isDualFormat && prettyFormat(options.format), `Granting execute permission to ${underline(path.relative(cwd, filepath))}`);
1245
1266
  await chmod(filepath, 493);
1246
1267
  }
1247
1268
  }
@@ -1308,7 +1329,7 @@ async function getBuildOptions(config, format, configFiles, bundle, cjsDts = fal
1308
1329
  return rolldownConfig;
1309
1330
  }
1310
1331
  async function resolveInputOptions(config, format, configFiles, bundle, cjsDts, isDualFormat) {
1311
- const { alias, banner, cjsDefault, cwd, debug: debug$10, dts, entry, env: env$1, external, footer, globImport, loader, logger, name, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch: watch$1 } = config;
1332
+ const { alias, banner, cjsDefault, cwd, debug: debug$10, dts, entry, env: env$1, external, footer, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch: watch$1 } = config;
1312
1333
  const plugins = [];
1313
1334
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
1314
1335
  if (config.pkg || config.skipNodeModulesBundle) plugins.push(ExternalPlugin(config));
@@ -1336,10 +1357,10 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
1336
1357
  }));
1337
1358
  }
1338
1359
  if (target) plugins.push(await LightningCSSPlugin({ target }));
1339
- plugins.push(ShebangPlugin(logger, cwd, name, isDualFormat));
1360
+ plugins.push(ShebangPlugin(logger, cwd, nameLabel, isDualFormat));
1340
1361
  if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
1341
1362
  }
1342
- if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(report, logger, cwd, cjsDts, name, isDualFormat));
1363
+ if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(report, logger, cwd, cjsDts, nameLabel, isDualFormat));
1343
1364
  if (watch$1) plugins.push(WatchPlugin(configFiles, bundle));
1344
1365
  if (!cjsDts) plugins.push(userPlugins);
1345
1366
  const define = {
@@ -1560,7 +1581,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
1560
1581
  for (const { output } of outputs) chunks.push(...addOutDirToChunks(output, outDir));
1561
1582
  }
1562
1583
  if (!watch$1) {
1563
- logger.success(prettyName(config.name), `Build complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
1584
+ logger.success(config.nameLabel, `Build complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
1564
1585
  await postBuild();
1565
1586
  }
1566
1587
  return bundle;
@@ -1593,7 +1614,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
1593
1614
  break;
1594
1615
  case "BUNDLE_END":
1595
1616
  await event.result.close();
1596
- logger.success(`Rebuilt in ${event.duration}ms.`);
1617
+ logger.success(config.nameLabel, `Rebuilt in ${event.duration}ms.`);
1597
1618
  break;
1598
1619
  case "ERROR":
1599
1620
  await event.result.close();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tsdown",
3
3
  "type": "module",
4
- "version": "0.17.2",
4
+ "version": "0.17.3",
5
5
  "description": "The Elegant Bundler for Libraries",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -78,9 +78,10 @@
78
78
  "dependencies": {
79
79
  "ansis": "^4.2.0",
80
80
  "cac": "^6.7.14",
81
+ "defu": "^6.1.4",
81
82
  "empathic": "^2.0.0",
82
83
  "hookable": "^5.5.3",
83
- "import-without-cache": "^0.2.2",
84
+ "import-without-cache": "^0.2.3",
84
85
  "obug": "^2.1.1",
85
86
  "rolldown": "1.0.0-beta.53",
86
87
  "rolldown-plugin-dts": "^0.18.3",
@@ -96,9 +97,9 @@
96
97
  "@sxzz/eslint-config": "^7.4.1",
97
98
  "@sxzz/prettier-config": "^2.2.6",
98
99
  "@sxzz/test-utils": "^0.5.13",
99
- "@types/node": "^24.10.1",
100
+ "@types/node": "^24.10.2",
100
101
  "@types/semver": "^7.7.1",
101
- "@typescript/native-preview": "7.0.0-dev.20251208.1",
102
+ "@typescript/native-preview": "7.0.0-dev.20251210.1",
102
103
  "@unocss/eslint-plugin": "^66.5.10",
103
104
  "@vitejs/devtools": "^0.0.0-alpha.19",
104
105
  "@vitest/coverage-v8": "4.0.15",
@@ -110,7 +111,7 @@
110
111
  "lightningcss": "^1.30.2",
111
112
  "pkg-types": "^2.3.0",
112
113
  "prettier": "^3.7.4",
113
- "publint": "^0.3.15",
114
+ "publint": "^0.3.16",
114
115
  "rolldown-plugin-require-cjs": "^0.3.3",
115
116
  "typescript": "~5.9.3",
116
117
  "unocss": "^66.5.10",