tsdown 0.18.0 → 0.18.2

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/dist/config.d.mts CHANGED
@@ -1,3 +1,13 @@
1
- import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-JmTA8ZMA.mjs";
2
- import { t as defineConfig } from "./config-FoWTJggg.mjs";
3
- export { UserConfig, UserConfigExport, UserConfigFn, defineConfig };
1
+ import { h as UserConfigFn, m as UserConfigExport, p as UserConfig } from "./index-BJCpuL9t.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 { type UserConfig, type UserConfigExport, type UserConfigFn, defineConfig };
@@ -1,5 +1,5 @@
1
1
  import "ansis";
2
- import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin, TreeshakingOptions } from "rolldown";
2
+ import { BuildOptions, ExternalOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin, TreeshakingOptions } from "rolldown";
3
3
  import { Hookable } from "hookable";
4
4
  import { Options as DtsOptions } from "rolldown-plugin-dts";
5
5
  import { StartOptions } from "@vitejs/devtools/cli-commands";
@@ -170,13 +170,13 @@ interface ExportsOptions {
170
170
  */
171
171
  all?: boolean;
172
172
  /**
173
- * Define filenames or RegExp patterns to exclude files from exports.
173
+ * Define globs or RegExp patterns to exclude files from exports.
174
174
  * This is useful for excluding files that should not be part of the package exports,
175
175
  * such as bin files or internal utilities.
176
176
  *
177
177
  * @example
178
178
  * ```js
179
- * exclude: ['foo.ts', /\.spec\.ts$/, /internal/]
179
+ * exclude: ['**\/*.test.ts', '**\/*.spec.ts', /internal/]
180
180
  * ```
181
181
  */
182
182
  exclude?: (RegExp | string)[];
@@ -228,6 +228,24 @@ declare function ReportPlugin(userOptions: ReportOptions, logger: Logger, cwd: s
228
228
  type Sourcemap = boolean | "inline" | "hidden";
229
229
  type Format = ModuleFormat;
230
230
  type NormalizedFormat = InternalModuleFormat;
231
+ /**
232
+ * Extended input option that supports glob negation patterns.
233
+ *
234
+ * When using object form, values can be:
235
+ * - A single glob pattern string
236
+ * - An array of glob patterns, including negation patterns (prefixed with `!`)
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * entry: {
241
+ * // Single pattern
242
+ * "utils/*": "./src/utils/*.ts",
243
+ * // Array with negation pattern to exclude files
244
+ * "hooks/*": ["./src/hooks/*.ts", "!./src/hooks/index.ts"],
245
+ * }
246
+ * ```
247
+ */
248
+ type TsdownInputOption = string | string[] | Record<string, string | string[]>;
231
249
  interface Workspace {
232
250
  /**
233
251
  * Workspace directories. Glob patterns are supported.
@@ -257,8 +275,16 @@ type WithEnabled<T> = boolean | undefined | CIOption | (T & {
257
275
  interface UserConfig {
258
276
  /**
259
277
  * Defaults to `'src/index.ts'` if it exists.
278
+ *
279
+ * Supports glob patterns with negation to exclude files:
280
+ * @example
281
+ * ```ts
282
+ * entry: {
283
+ * "hooks/*": ["./src/hooks/*.ts", "!./src/hooks/index.ts"],
284
+ * }
285
+ * ```
260
286
  */
261
- entry?: InputOption;
287
+ entry?: TsdownInputOption;
262
288
  external?: ExternalOption;
263
289
  noExternal?: Arrayable<string | RegExp> | NoExternalFn;
264
290
  /**
@@ -552,7 +578,7 @@ interface UserConfig {
552
578
  */
553
579
  globImport?: boolean;
554
580
  /**
555
- * **[experimental]** Generate package exports for `package.json`.
581
+ * Generate package exports for `package.json`.
556
582
  *
557
583
  * This will set the `main`, `module`, `types`, `exports` fields in `package.json`
558
584
  * to point to the generated files.
@@ -603,6 +629,8 @@ type UserConfigFn = (inlineConfig: InlineConfig, context: {
603
629
  }) => Awaitable<Arrayable<UserConfig>>;
604
630
  type UserConfigExport = Awaitable<Arrayable<UserConfig> | UserConfigFn>;
605
631
  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">, {
632
+ /** Resolved entry map (after glob expansion) */
633
+ entry: Record<string, string>;
606
634
  nameLabel: string | undefined;
607
635
  format: NormalizedFormat;
608
636
  target?: string[];
@@ -623,4 +651,4 @@ type ResolvedConfig = Overwrite<MarkPartial<Omit<UserConfig, "workspace" | "from
623
651
  unused: false | UnusedOptions;
624
652
  }>;
625
653
  //#endregion
626
- export { OutExtensionObject as A, TsdownBundle as C, ChunkAddonObject as D, ChunkAddonFunction as E, TsdownHooks as F, DebugOptions as I, CopyEntry as L, PackageType as M, BuildContext as N, OutExtensionContext as O, RolldownContext as P, CopyOptions as R, RolldownChunk as S, ChunkAddon as T, ReportOptions as _, NoExternalFn as a, globalLogger as b, ResolvedConfig as c, UnusedOptions as d, UserConfig as f, Workspace as g, WithEnabled as h, InlineConfig as i, PackageJsonWithPath as j, OutExtensionFactory as k, Sourcemap as l, UserConfigFn as m, DtsOptions as n, NormalizedFormat as o, UserConfigExport as p, Format as r, PublintOptions as s, CIOption as t, TreeshakingOptions as u, ReportPlugin as v, AttwOptions as w, ExportsOptions as x, Logger as y, CopyOptionsFn as z };
654
+ export { OutExtensionFactory as A, CopyOptionsFn as B, RolldownChunk as C, ChunkAddonFunction as D, ChunkAddon as E, RolldownContext as F, TsdownHooks as I, DebugOptions as L, PackageJsonWithPath as M, PackageType as N, ChunkAddonObject as O, BuildContext as P, CopyEntry as R, ExportsOptions as S, AttwOptions as T, Workspace as _, NoExternalFn as a, Logger as b, ResolvedConfig as c, TsdownInputOption as d, UnusedOptions as f, WithEnabled as g, UserConfigFn as h, InlineConfig as i, OutExtensionObject as j, OutExtensionContext as k, Sourcemap as l, UserConfigExport as m, DtsOptions as n, NormalizedFormat as o, UserConfig as p, Format as r, PublintOptions as s, CIOption as t, TreeshakingOptions as u, ReportOptions as v, TsdownBundle as w, globalLogger as x, ReportPlugin as y, CopyOptions as z };
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-JmTA8ZMA.mjs";
2
- import { t as defineConfig } from "./config-FoWTJggg.mjs";
1
+ import { A as OutExtensionFactory, B as CopyOptionsFn, C as RolldownChunk, D as ChunkAddonFunction, E as ChunkAddon, F as RolldownContext, I as TsdownHooks, L as DebugOptions, M as PackageJsonWithPath, N as PackageType, O as ChunkAddonObject, P as BuildContext, R as CopyEntry, S as ExportsOptions, T as AttwOptions, _ as Workspace, a as NoExternalFn, b as Logger, c as ResolvedConfig, d as TsdownInputOption, f as UnusedOptions, g as WithEnabled, h as UserConfigFn, i as InlineConfig, j as OutExtensionObject, k as OutExtensionContext, l as Sourcemap, m as UserConfigExport, n as DtsOptions, o as NormalizedFormat, p as UserConfig, r as Format, s as PublintOptions, t as CIOption, u as TreeshakingOptions, v as ReportOptions, w as TsdownBundle, x as globalLogger, z as CopyOptions } from "./index-BJCpuL9t.mjs";
2
+ import { defineConfig } from "./config.mjs";
3
3
  import * as Rolldown from "rolldown";
4
4
 
5
5
  //#region src/index.d.ts
@@ -19,4 +19,4 @@ declare function buildSingle(config: ResolvedConfig, configFiles: string[], isDu
19
19
  /** @internal */
20
20
  declare const shimFile: string;
21
21
  //#endregion
22
- export { AttwOptions, BuildContext, CIOption, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DebugOptions, DtsOptions, ExportsOptions, Format, InlineConfig, type Logger, NoExternalFn, NormalizedFormat, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageJsonWithPath, PackageType, PublintOptions, ReportOptions, ResolvedConfig, Rolldown, RolldownChunk, RolldownContext, Sourcemap, TreeshakingOptions, TsdownBundle, TsdownHooks, UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, WithEnabled, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
22
+ export { AttwOptions, BuildContext, CIOption, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DebugOptions, DtsOptions, ExportsOptions, Format, InlineConfig, type Logger, NoExternalFn, NormalizedFormat, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageJsonWithPath, PackageType, PublintOptions, ReportOptions, ResolvedConfig, Rolldown, RolldownChunk, RolldownContext, Sourcemap, TreeshakingOptions, TsdownBundle, TsdownHooks, TsdownInputOption, UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, WithEnabled, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
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-gll494UH.mjs";
3
- import { o as globalLogger } from "./package-CE44tUXo.mjs";
2
+ import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-aipTTo-5.mjs";
3
+ import { o as globalLogger } from "./package-CpLZpKe2.mjs";
4
4
 
5
5
  export { Rolldown, build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -1,5 +1,8 @@
1
+ import { createRequire as __cjs_createRequire } from "node:module";
2
+ const __cjs_require = __cjs_createRequire(import.meta.url);
1
3
  import { bgRed, bgYellow, blue, green, rgb, yellow } from "ansis";
2
4
  import process from "node:process";
5
+ const picomatch = __cjs_require("picomatch");
3
6
 
4
7
  //#region src/utils/general.ts
5
8
  function toArray(val, defaultValue) {
@@ -26,7 +29,7 @@ function matchPattern(id, patterns) {
26
29
  pattern.lastIndex = 0;
27
30
  return pattern.test(id);
28
31
  }
29
- return id === pattern;
32
+ return id === pattern || picomatch(pattern)(id);
30
33
  });
31
34
  }
32
35
  function pkgExists(moduleName) {
@@ -161,7 +164,7 @@ function hue2rgb(p, q, t) {
161
164
 
162
165
  //#endregion
163
166
  //#region package.json
164
- var version = "0.18.0";
167
+ var version = "0.18.2";
165
168
 
166
169
  //#endregion
167
170
  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-JmTA8ZMA.mjs";
1
+ import { b as Logger, c as ResolvedConfig, w as TsdownBundle, y as ReportPlugin } from "./index-BJCpuL9t.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
 
4
4
  //#region src/features/external.d.ts
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-gll494UH.mjs";
2
- import "./package-CE44tUXo.mjs";
1
+ import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-aipTTo-5.mjs";
2
+ import "./package-CpLZpKe2.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 { g as toArray, o as globalLogger, p as resolveComma, t as version } from "./package-CE44tUXo.mjs";
2
+ import { g as toArray, o as globalLogger, p as resolveComma, t as version } from "./package-CpLZpKe2.mjs";
3
3
  import module from "node:module";
4
4
  import { dim } from "ansis";
5
5
  import { VERSION } from "rolldown";
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __cjs_createRequire } from "node:module";
2
2
  const __cjs_require = __cjs_createRequire(import.meta.url);
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-CE44tUXo.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-CpLZpKe2.mjs";
4
4
  import { builtinModules, isBuiltin } from "node:module";
5
- import path, { dirname, join, normalize, sep } from "node:path";
5
+ import path, { dirname, extname, join, normalize, sep } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import { blue, bold, dim, green, underline } from "ansis";
8
8
  import { clearRequireCache, init, isSupported } from "import-without-cache";
@@ -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
+ const picomatch = __cjs_require("picomatch");
15
16
  import { createDefu } from "defu";
16
17
  import { glob, isDynamicPattern } from "tinyglobby";
17
18
  import { RE_CSS, RE_DTS, RE_JS, RE_NODE_MODULES } from "rolldown-plugin-dts/filename";
@@ -20,7 +21,7 @@ import { up } from "empathic/find";
20
21
  import { up as up$1 } from "empathic/package";
21
22
  const coerce = __cjs_require("semver/functions/coerce.js");
22
23
  const satisfies = __cjs_require("semver/functions/satisfies.js");
23
- import { createHooks } from "hookable";
24
+ import { Hookable } from "hookable";
24
25
  import { exec } from "tinyexec";
25
26
  const treeKill = __cjs_require("tree-kill");
26
27
  import util, { formatWithOptions, promisify } from "node:util";
@@ -73,6 +74,11 @@ function lowestCommonAncestor(...filepaths) {
73
74
  }
74
75
  return ancestor.length <= 1 && ancestor[0] === "" ? sep + ancestor[0] : ancestor.join(sep);
75
76
  }
77
+ function stripExtname(filePath) {
78
+ const ext = extname(filePath);
79
+ if (!ext.length) return filePath;
80
+ return filePath.slice(0, -ext.length);
81
+ }
76
82
 
77
83
  //#endregion
78
84
  //#region src/config/file.ts
@@ -195,7 +201,7 @@ async function nativeImport(id) {
195
201
  const importAttributes = Object.create(null);
196
202
  if (isSupported) {
197
203
  importAttributes.cache = "no";
198
- init();
204
+ init({ skipNodeModules: true });
199
205
  } else if (!isBun) url.searchParams.set("no-cache", crypto.randomUUID());
200
206
  const mod = await import(url.href, { with: importAttributes }).catch((error) => {
201
207
  if (error?.message?.includes?.("Cannot find module")) throw new Error(`Failed to load the config file. Try setting the --config-loader CLI flag to \`unrun\`.\n\n${error.message}`, { cause: error });
@@ -221,7 +227,8 @@ async function cleanOutDir(configs) {
221
227
  const files = await glob(config.clean, {
222
228
  cwd: config.cwd,
223
229
  absolute: true,
224
- onlyFiles: false
230
+ onlyFiles: false,
231
+ dot: true
225
232
  });
226
233
  const normalizedOutDir = config.outDir.replace(RE_LAST_SLASH, "");
227
234
  for (const file of files) if (file.replace(RE_LAST_SLASH, "") !== normalizedOutDir) removes.add(file);
@@ -264,7 +271,21 @@ async function resolveEntry(logger, entry, cwd, color, nameLabel) {
264
271
  }
265
272
  async function toObjectEntry(entry, cwd) {
266
273
  if (typeof entry === "string") entry = [entry];
267
- if (!Array.isArray(entry)) return entry;
274
+ if (!Array.isArray(entry)) return Object.fromEntries((await Promise.all(Object.entries(entry).map(async ([key, value]) => {
275
+ if (!key.includes("*")) {
276
+ if (Array.isArray(value)) throw new TypeError(`Object entry "${key}" cannot have an array value when the key is not a glob pattern.`);
277
+ return [[key, value]];
278
+ }
279
+ const patterns = toArray(value);
280
+ const positivePatterns = patterns.filter((p) => !p.startsWith("!"));
281
+ if (positivePatterns.length === 0) throw new TypeError(`Object entry "${key}" has no positive pattern. At least one positive pattern is required.`);
282
+ if (positivePatterns.length > 1) throw new TypeError(`Object entry "${key}" has multiple positive patterns: ${positivePatterns.join(", ")}. Only one positive pattern is allowed. Use negation patterns (prefixed with "!") to exclude files.`);
283
+ const valueGlob = picomatch.scan(positivePatterns[0]);
284
+ return (await glob(patterns, {
285
+ cwd,
286
+ expandDirectories: false
287
+ })).map((file) => [slash(key.replaceAll("*", stripExtname(path.relative(valueGlob.base, file)))), path.resolve(cwd, file)]);
288
+ }))).flat());
268
289
  const isGlob = entry.some((e) => isDynamicPattern(e));
269
290
  let resolvedEntry;
270
291
  if (isGlob) resolvedEntry = (await glob(entry, {
@@ -275,8 +296,7 @@ async function toObjectEntry(entry, cwd) {
275
296
  else resolvedEntry = entry;
276
297
  const base = lowestCommonAncestor(...resolvedEntry);
277
298
  return Object.fromEntries(resolvedEntry.map((file) => {
278
- const relative = path.relative(base, file);
279
- return [slash(relative.slice(0, relative.length - path.extname(relative).length)), file];
299
+ return [slash(stripExtname(path.relative(base, file))), file];
280
300
  }));
281
301
  }
282
302
 
@@ -331,8 +351,7 @@ async function generateExports(pkg, chunks, { devExports, all, exclude, customEx
331
351
  const onlyOneEntry = filteredChunks.filter((chunk) => !RE_DTS.test(chunk.fileName)).length === 1;
332
352
  for (const chunk of filteredChunks) {
333
353
  const normalizedName = slash(chunk.fileName);
334
- const ext = path.extname(chunk.fileName);
335
- let name = normalizedName.slice(0, -ext.length);
354
+ let name = stripExtname(normalizedName);
336
355
  const isDts = name.endsWith(".d");
337
356
  if (isDts) name = name.slice(0, -2);
338
357
  const isIndex = onlyOneEntry || name === "index";
@@ -519,7 +538,7 @@ async function resolveUserConfig(userConfig, inlineConfig) {
519
538
  nodeProtocol = nodeProtocol ?? (removeNodeProtocol ? "strip" : false);
520
539
  outDir = path.resolve(cwd, outDir);
521
540
  clean = resolveClean(clean, outDir, cwd);
522
- entry = await resolveEntry(logger, entry, cwd, color, nameLabel);
541
+ const resolvedEntry = await resolveEntry(logger, entry, cwd, color, nameLabel);
523
542
  if (dts == null) dts = !!(pkg?.types || pkg?.typings || hasExportsTypes(pkg));
524
543
  target = resolveTarget(logger, target, color, pkg, nameLabel);
525
544
  tsconfig = await resolveTsconfig(logger, tsconfig, cwd, color, nameLabel);
@@ -575,7 +594,7 @@ async function resolveUserConfig(userConfig, inlineConfig) {
575
594
  cwd,
576
595
  debug: debug$10,
577
596
  dts,
578
- entry,
597
+ entry: resolvedEntry,
579
598
  env: env$1,
580
599
  exports,
581
600
  external,
@@ -794,8 +813,8 @@ function renameTarget(target, rename, src) {
794
813
 
795
814
  //#endregion
796
815
  //#region src/features/hooks.ts
797
- async function createHooks$1(options) {
798
- const hooks = createHooks();
816
+ async function createHooks(options) {
817
+ const hooks = new Hookable();
799
818
  if (typeof options.hooks === "object") hooks.addHooks(options.hooks);
800
819
  else if (typeof options.hooks === "function") await options.hooks(hooks);
801
820
  return {
@@ -875,7 +894,7 @@ async function attw(options) {
875
894
  if ("resolutionKind" in problem) return !profiles[profile]?.includes(problem.resolutionKind);
876
895
  return true;
877
896
  });
878
- if (problems.length) errorMessage = `problems found:\n${problems.map(formatProblem).join("\n")}`;
897
+ if (problems.length) errorMessage = `problems found:\n${problems.map((problem) => formatProblem(checkResult.packageName, problem)).join("\n")}`;
879
898
  } else errorMessage = `Package has no types`;
880
899
  if (errorMessage) options.logger[level](options.nameLabel, label$1, errorMessage);
881
900
  else options.logger.success(options.nameLabel, label$1, "No problems found", dim`(${Math.round(performance.now() - t)}ms)`);
@@ -883,9 +902,9 @@ async function attw(options) {
883
902
  /**
884
903
  * Format an ATTW problem for display
885
904
  */
886
- function formatProblem(problem) {
905
+ function formatProblem(packageName, problem) {
887
906
  const resolutionKind = "resolutionKind" in problem ? ` (${problem.resolutionKind})` : "";
888
- const entrypoint = "entrypoint" in problem ? ` at ${problem.entrypoint}` : "";
907
+ const entrypoint = "entrypoint" in problem ? ` at ${slash(path.join(packageName, problem.entrypoint))}` : "";
889
908
  switch (problem.kind) {
890
909
  case "NoResolution": return ` ❌ No resolution${resolutionKind}${entrypoint}`;
891
910
  case "UntypedResolution": return ` ⚠️ Untyped resolution${resolutionKind}${entrypoint}`;
@@ -1040,10 +1059,9 @@ Imported by ${underline(importer)}`);
1040
1059
  if (noExternal?.(id, importer)) return "no-external";
1041
1060
  if (skipNodeModulesBundle) {
1042
1061
  const resolved = await context.resolve(id, importer, extraOptions);
1043
- if (!resolved) return false;
1044
- return resolved.external || RE_NODE_MODULES.test(resolved.id);
1062
+ if (resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id))) return true;
1045
1063
  }
1046
- if (deps) return deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
1064
+ if (deps && deps.some((dep) => id === dep || id.startsWith(`${dep}/`))) return true;
1047
1065
  return false;
1048
1066
  }
1049
1067
  }
@@ -1170,10 +1188,9 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
1170
1188
  return `${basename}${chunk.name.endsWith(".d") ? dtsExtension : jsExtension}`;
1171
1189
  };
1172
1190
  }
1173
- function resolveChunkAddon(chunkAddon, format, dts) {
1191
+ function resolveChunkAddon(chunkAddon, format) {
1174
1192
  if (!chunkAddon) return;
1175
1193
  return (chunk) => {
1176
- if (!dts && RE_DTS.test(chunk.fileName)) return "";
1177
1194
  if (typeof chunkAddon === "function") chunkAddon = chunkAddon({
1178
1195
  format,
1179
1196
  fileName: chunk.fileName
@@ -1348,7 +1365,7 @@ async function getBuildOptions(config, format, configFiles, bundle, cjsDts = fal
1348
1365
  return rolldownConfig;
1349
1366
  }
1350
1367
  async function resolveInputOptions(config, format, configFiles, bundle, cjsDts, isDualFormat) {
1351
- 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;
1368
+ const { alias, cjsDefault, cwd, debug: debug$10, dts, entry, env: env$1, external, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch: watch$1 } = config;
1352
1369
  const plugins = [];
1353
1370
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
1354
1371
  if (config.pkg || config.skipNodeModulesBundle) plugins.push(ExternalPlugin(config));
@@ -1356,8 +1373,6 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
1356
1373
  const { dts: dtsPlugin } = await import("rolldown-plugin-dts");
1357
1374
  const options = {
1358
1375
  tsconfig,
1359
- banner: resolveChunkAddon(banner, format, true),
1360
- footer: resolveChunkAddon(footer, format, true),
1361
1376
  ...dts
1362
1377
  };
1363
1378
  if (format === "es") plugins.push(dtsPlugin(options));
@@ -1412,11 +1427,12 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
1412
1427
  if (log.code === "MIXED_EXPORT") return;
1413
1428
  defaultHandler(level, log);
1414
1429
  } : void 0,
1415
- debug: debug$10 || void 0
1430
+ debug: debug$10 || void 0,
1431
+ checks: { pluginTimings: false }
1416
1432
  }, config.inputOptions, [format, { cjsDts }]);
1417
1433
  }
1418
1434
  async function resolveOutputOptions(inputOptions, config, format, cjsDts) {
1419
- const { entry, outDir, sourcemap, minify, unbundle, banner, footer, cjsDefault } = config;
1435
+ const { banner, cjsDefault, entry, footer, minify, outDir, sourcemap, unbundle } = config;
1420
1436
  const [entryFileNames, chunkFileNames] = resolveChunkFilename(config, inputOptions, format);
1421
1437
  return await mergeUserOptions({
1422
1438
  format: cjsDts ? "es" : format,
@@ -1429,8 +1445,8 @@ async function resolveOutputOptions(inputOptions, config, format, cjsDts) {
1429
1445
  chunkFileNames,
1430
1446
  preserveModules: unbundle,
1431
1447
  preserveModulesRoot: unbundle ? lowestCommonAncestor(...Object.values(entry)) : void 0,
1432
- banner: resolveChunkAddon(banner, format),
1433
- footer: resolveChunkAddon(footer, format)
1448
+ postBanner: resolveChunkAddon(banner, format),
1449
+ postFooter: resolveChunkAddon(footer, format)
1434
1450
  }, config.outputOptions, [format, { cjsDts }]);
1435
1451
  }
1436
1452
  async function getDebugRolldownDir() {
@@ -1574,7 +1590,7 @@ async function build$1(userOptions = {}) {
1574
1590
  */
1575
1591
  async function buildSingle(config, configFiles, isDualFormat, clean, restart, done) {
1576
1592
  const { format, dts, watch: watch$1, logger, outDir } = config;
1577
- const { hooks, context } = await createHooks$1(config);
1593
+ const { hooks, context } = await createHooks(config);
1578
1594
  warnLegacyCJS(config);
1579
1595
  const startTime = performance.now();
1580
1596
  await hooks.callHook("build:prepare", context);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tsdown",
3
3
  "type": "module",
4
- "version": "0.18.0",
4
+ "version": "0.18.2",
5
5
  "description": "The Elegant Bundler for Libraries",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@arethetypeswrong/core": "^0.18.1",
52
- "@vitejs/devtools": "^0.0.0-alpha.19",
52
+ "@vitejs/devtools": "*",
53
53
  "publint": "^0.3.0",
54
54
  "typescript": "^5.0.0",
55
55
  "unplugin-lightningcss": "^0.4.0",
@@ -80,33 +80,35 @@
80
80
  "cac": "^6.7.14",
81
81
  "defu": "^6.1.4",
82
82
  "empathic": "^2.0.0",
83
- "hookable": "^5.5.3",
84
- "import-without-cache": "^0.2.3",
83
+ "hookable": "^6.0.1",
84
+ "import-without-cache": "^0.2.5",
85
85
  "obug": "^2.1.1",
86
- "rolldown": "1.0.0-beta.53",
87
- "rolldown-plugin-dts": "^0.18.3",
86
+ "picomatch": "^4.0.3",
87
+ "rolldown": "1.0.0-beta.55",
88
+ "rolldown-plugin-dts": "^0.19.1",
88
89
  "semver": "^7.7.3",
89
90
  "tinyexec": "^1.0.2",
90
91
  "tinyglobby": "^0.2.15",
91
92
  "tree-kill": "^1.2.2",
92
93
  "unconfig-core": "^7.4.2",
93
- "unrun": "^0.2.19"
94
+ "unrun": "^0.2.20"
94
95
  },
95
96
  "devDependencies": {
96
97
  "@arethetypeswrong/core": "^0.18.2",
97
98
  "@sxzz/eslint-config": "^7.4.3",
98
99
  "@sxzz/prettier-config": "^2.2.6",
99
- "@sxzz/test-utils": "^0.5.14",
100
- "@types/node": "^25.0.1",
100
+ "@sxzz/test-utils": "^0.5.15",
101
+ "@types/node": "^25.0.3",
102
+ "@types/picomatch": "^4.0.2",
101
103
  "@types/semver": "^7.7.1",
102
- "@typescript/native-preview": "7.0.0-dev.20251212.1",
104
+ "@typescript/native-preview": "7.0.0-dev.20251221.1",
103
105
  "@unocss/eslint-plugin": "^66.5.10",
104
- "@vitejs/devtools": "^0.0.0-alpha.19",
105
- "@vitest/coverage-v8": "4.0.15",
106
- "@vitest/ui": "^4.0.15",
106
+ "@vitejs/devtools": "^0.0.0-alpha.20",
107
+ "@vitest/coverage-v8": "4.0.16",
108
+ "@vitest/ui": "^4.0.16",
107
109
  "@vueuse/core": "^14.1.0",
108
110
  "bumpp": "^10.3.2",
109
- "dedent": "^1.7.0",
111
+ "dedent": "^1.7.1",
110
112
  "eslint": "^9.39.2",
111
113
  "is-in-ci": "^2.0.0",
112
114
  "lightningcss": "^1.30.2",
@@ -120,7 +122,7 @@
120
122
  "unplugin-lightningcss": "^0.4.3",
121
123
  "unplugin-unused": "^0.5.6",
122
124
  "vite": "^8.0.0-beta.2",
123
- "vitest": "^4.0.15"
125
+ "vitest": "^4.0.16"
124
126
  },
125
127
  "prettier": "@sxzz/prettier-config",
126
128
  "scripts": {
@@ -1,13 +0,0 @@
1
- import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-JmTA8ZMA.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 };