tsdown 0.15.5 → 0.15.7

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 { UserConfig, UserConfigFn } from "./types-DMJKFE0E.mjs";
1
+ import { UserConfig, UserConfigFn } from "./types-BBYDPehL.mjs";
2
2
 
3
3
  //#region src/config.d.ts
4
4
 
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { UserConfig, UserConfigFn } from "./types-DMJKFE0E.mjs";
2
- import { defineConfig } from "./config-oNMlaVK7.mjs";
1
+ import { UserConfig, UserConfigFn } from "./types-BBYDPehL.mjs";
2
+ import { defineConfig } from "./config-BkpjlM2q.mjs";
3
3
  export { UserConfig, UserConfigFn, defineConfig };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, Logger, NoExternalFn, NormalizedFormat, NormalizedUserConfig, Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigFn, Workspace, globalLogger } from "./types-DMJKFE0E.mjs";
2
- import { defineConfig } from "./config-oNMlaVK7.mjs";
1
+ import { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, Logger, NoExternalFn, NormalizedFormat, NormalizedUserConfig, Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigFn, Workspace, globalLogger } from "./types-BBYDPehL.mjs";
2
+ import { defineConfig } from "./config-BkpjlM2q.mjs";
3
3
 
4
4
  //#region src/index.d.ts
5
5
 
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineConfig } from "./config-CCGWF4al.mjs";
2
- import { build, buildSingle, shimFile } from "./src-BwhXafj8.mjs";
3
- import { globalLogger } from "./logger-BjPuONhe.mjs";
2
+ import { build, buildSingle, shimFile } from "./src-C51C732j.mjs";
3
+ import { globalLogger } from "./logger-BdsX4_1k.mjs";
4
4
 
5
5
  export { build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -110,8 +110,7 @@ function generateColor(name = "default") {
110
110
  else {
111
111
  let hash = 0;
112
112
  for (let i = 0; i < name.length; i++) hash = name.charCodeAt(i) + ((hash << 5) - hash);
113
- const hue = hash % 360;
114
- color = rgb(...hslToRgb(hue, 35, 55));
113
+ color = rgb(...hslToRgb(hash % 360, 35, 55));
115
114
  }
116
115
  colors.set(name, color);
117
116
  return color;
@@ -1,5 +1,5 @@
1
- import { globalLogger } from "./logger-BjPuONhe.mjs";
2
- import { version } from "./package-D65FBThx.mjs";
1
+ import { globalLogger } from "./logger-BdsX4_1k.mjs";
2
+ import { version } from "./package-BbXTWj2q.mjs";
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.15.7";
3
+
4
+ //#endregion
5
+ export { version };
@@ -1,4 +1,4 @@
1
- import { Logger, ReportPlugin, ResolvedOptions } from "./types-DMJKFE0E.mjs";
1
+ import { Logger, ReportPlugin, ResolvedOptions } from "./types-BBYDPehL.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
package/dist/plugins.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./config-CCGWF4al.mjs";
2
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./src-BwhXafj8.mjs";
3
- import "./logger-BjPuONhe.mjs";
2
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./src-C51C732j.mjs";
3
+ import "./logger-BdsX4_1k.mjs";
4
4
 
5
5
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/run.mjs CHANGED
@@ -1,8 +1,8 @@
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 { globalLogger, resolveComma, toArray } from "./logger-BjPuONhe.mjs";
5
- import { version } from "./package-D65FBThx.mjs";
4
+ import { globalLogger, resolveComma, toArray } from "./logger-BdsX4_1k.mjs";
5
+ import { version } from "./package-BbXTWj2q.mjs";
6
6
  import module from "node:module";
7
7
  import process from "node:process";
8
8
  import { dim } from "ansis";
@@ -24,7 +24,7 @@ cli.command("[...files]", "Bundle files", {
24
24
  await build$1(flags);
25
25
  });
26
26
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
27
- const { migrate } = await import("./migrate-BMP9puR2.mjs");
27
+ const { migrate } = await import("./migrate-DrxQXJvd.mjs");
28
28
  await migrate(args);
29
29
  });
30
30
  async function runCLI() {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __cjs_createRequire } from "node:module";
2
2
  const __cjs_require = __cjs_createRequire(import.meta.url);
3
- import { LogLevels, createLogger, debounce, generateColor, globalLogger, matchPattern, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-BjPuONhe.mjs";
4
- import { builtinModules } from "node:module";
3
+ import { LogLevels, createLogger, debounce, generateColor, globalLogger, matchPattern, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-BdsX4_1k.mjs";
4
+ import { builtinModules, isBuiltin } from "node:module";
5
5
  import path, { dirname, normalize, sep } from "node:path";
6
6
  import process from "node:process";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -131,8 +131,7 @@ async function attw(options) {
131
131
  });
132
132
  const parsed = JSON.parse(tarballInfo);
133
133
  if (!Array.isArray(parsed) || !parsed[0]?.filename) throw new Error("Invalid npm pack output format");
134
- const tarballPath = path.join(tempDir, parsed[0].filename);
135
- const tarball = await readFile(tarballPath);
134
+ const tarball = await readFile(path.join(tempDir, parsed[0].filename));
136
135
  const pkg = attwCore.createPackageFromTarballData(tarball);
137
136
  const checkResult = await attwCore.checkPackage(pkg, attwOptions);
138
137
  if (checkResult.types !== false && checkResult.problems.length) {
@@ -354,16 +353,19 @@ const debug$6 = debug("tsdown:publint");
354
353
  async function publint(options) {
355
354
  if (!options.publint) return;
356
355
  if (!options.pkg) {
357
- options.logger.warn("publint is enabled but package.json is not found");
356
+ options.logger.warn(prettyName(options.name), "publint is enabled but package.json is not found");
358
357
  return;
359
358
  }
360
359
  const t = performance.now();
361
360
  debug$6("Running publint");
362
361
  const { publint: publint$1 } = await import("publint");
363
362
  const { formatMessage } = await import("publint/utils");
364
- const { messages } = await publint$1(options.publint === true ? {} : options.publint);
363
+ const { messages } = await publint$1({
364
+ ...options.publint === true ? {} : options.publint,
365
+ pkgDir: path.dirname(options.pkg.packageJsonPath)
366
+ });
365
367
  debug$6("Found %d issues", messages.length);
366
- if (!messages.length) options.logger.success(`No publint issues found`, dim`(${Math.round(performance.now() - t)}ms)`);
368
+ if (!messages.length) options.logger.success(prettyName(options.name), `No publint issues found`, dim`(${Math.round(performance.now() - t)}ms)`);
367
369
  let hasError = false;
368
370
  for (const message of messages) {
369
371
  hasError ||= message.type === "error";
@@ -373,7 +375,7 @@ async function publint(options) {
373
375
  warning: "warn",
374
376
  suggestion: "info"
375
377
  }[message.type];
376
- options.logger[logType](formattedMessage);
378
+ options.logger[logType](prettyName(options.name), formattedMessage);
377
379
  }
378
380
  if (hasError) {
379
381
  debug$6("Found errors, setting exit code to 1");
@@ -778,7 +780,7 @@ function ExternalPlugin({ pkg, noExternal, inlineOnly, skipNodeModulesBundle })
778
780
  async resolveId(id, importer, extraOptions) {
779
781
  if (extraOptions.isEntry || !importer) return;
780
782
  const shouldExternal = await externalStrategy(this, id, importer, extraOptions);
781
- const nodeBuiltinModule = id.startsWith("node:") || builtinModules.includes(id);
783
+ const nodeBuiltinModule = isBuiltin(id);
782
784
  debug$3("shouldExternal: %s = %s", id, shouldExternal);
783
785
  if (shouldExternal === true || shouldExternal === "absolute") return {
784
786
  id,
@@ -832,8 +834,7 @@ function esbuildTargetToLightningCSS(target) {
832
834
  let targets;
833
835
  const matches = [...target.join(" ").toLowerCase().matchAll(TARGET_REGEX)];
834
836
  for (const match of matches) {
835
- const name = match[1];
836
- const browser = ESBUILD_LIGHTNINGCSS_MAPPING[name];
837
+ const browser = ESBUILD_LIGHTNINGCSS_MAPPING[match[1]];
837
838
  if (!browser) continue;
838
839
  const version = match[2];
839
840
  const versionInt = parseVersion(version);
@@ -1228,6 +1229,7 @@ async function watchBuild(options, configFiles, rebuild, restart) {
1228
1229
  const { watch } = await import("chokidar");
1229
1230
  const debouncedOnChange = debounce(onChange, 100);
1230
1231
  const watcher = watch(files, {
1232
+ cwd: options.cwd,
1231
1233
  ignoreInitial: true,
1232
1234
  ignorePermissionErrors: true,
1233
1235
  ignored: [
@@ -1240,7 +1242,7 @@ async function watchBuild(options, configFiles, rebuild, restart) {
1240
1242
  let pending = [];
1241
1243
  let pendingPromise;
1242
1244
  watcher.on("all", (type, file) => {
1243
- pending.push(file);
1245
+ pending.push(path.resolve(options.cwd, file));
1244
1246
  debouncedOnChange();
1245
1247
  });
1246
1248
  return watcher;
@@ -316,7 +316,15 @@ interface Options {
316
316
  globalName?: string;
317
317
  /** @default 'dist' */
318
318
  outDir?: string;
319
- /** @default false */
319
+ /**
320
+ * Whether to generate source map files.
321
+ *
322
+ * Note that this option will always be `true` if you have
323
+ * [`declarationMap`](https://www.typescriptlang.org/tsconfig/#declarationMap)
324
+ * option enabled in your `tsconfig.json`.
325
+ *
326
+ * @default false
327
+ */
320
328
  sourcemap?: Sourcemap;
321
329
  /**
322
330
  * Clean directories before build.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.15.5",
3
+ "version": "0.15.7",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -69,7 +69,7 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "ansis": "^4.1.0",
72
+ "ansis": "^4.2.0",
73
73
  "cac": "^6.7.14",
74
74
  "chokidar": "^4.0.3",
75
75
  "debug": "^4.4.3",
@@ -77,8 +77,8 @@
77
77
  "empathic": "^2.0.0",
78
78
  "hookable": "^5.5.3",
79
79
  "rolldown": "latest",
80
- "rolldown-plugin-dts": "^0.16.8",
81
- "semver": "^7.7.2",
80
+ "rolldown-plugin-dts": "^0.16.11",
81
+ "semver": "^7.7.3",
82
82
  "tinyexec": "^1.0.1",
83
83
  "tinyglobby": "^0.2.15",
84
84
  "tree-kill": "^1.2.2",
@@ -86,26 +86,26 @@
86
86
  },
87
87
  "devDependencies": {
88
88
  "@arethetypeswrong/core": "^0.18.2",
89
- "@sxzz/eslint-config": "^7.2.5",
89
+ "@sxzz/eslint-config": "^7.2.7",
90
90
  "@sxzz/prettier-config": "^2.2.4",
91
91
  "@sxzz/test-utils": "^0.5.11",
92
92
  "@types/debug": "^4.1.12",
93
- "@types/node": "^24.5.2",
93
+ "@types/node": "^24.7.2",
94
94
  "@types/semver": "^7.7.1",
95
- "@unocss/eslint-plugin": "^66.5.2",
95
+ "@unocss/eslint-plugin": "^66.5.3",
96
96
  "@vueuse/core": "^13.9.0",
97
- "bumpp": "^10.2.3",
98
- "eslint": "^9.36.0",
99
- "lightningcss": "^1.30.1",
97
+ "bumpp": "^10.3.1",
98
+ "eslint": "^9.37.0",
99
+ "lightningcss": "^1.30.2",
100
100
  "pkg-types": "^2.3.0",
101
101
  "prettier": "^3.6.2",
102
- "publint": "^0.3.13",
103
- "rolldown-plugin-require-cjs": "^0.3.0",
102
+ "publint": "^0.3.14",
103
+ "rolldown-plugin-require-cjs": "^0.3.1",
104
104
  "tsx": "^4.20.6",
105
- "typescript": "~5.9.2",
106
- "unocss": "^66.5.2",
105
+ "typescript": "~5.9.3",
106
+ "unocss": "^66.5.3",
107
107
  "unplugin-lightningcss": "^0.4.3",
108
- "unplugin-unused": "^0.5.3",
108
+ "unplugin-unused": "^0.5.4",
109
109
  "vite": "npm:rolldown-vite@latest",
110
110
  "vitest": "^3.2.4"
111
111
  },
@@ -121,7 +121,7 @@
121
121
  "test": "vitest",
122
122
  "typecheck": "tsc --noEmit",
123
123
  "format": "prettier --cache --write .",
124
- "release": "bumpp",
124
+ "release": "bumpp -r",
125
125
  "docs:dev": "pnpm -C docs run dev",
126
126
  "docs:build": "pnpm -C docs run build",
127
127
  "docs:preview": "pnpm -C docs run preview",
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.15.5";
3
-
4
- //#endregion
5
- export { version };