tsdown 0.16.4 → 0.16.6

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as defineConfig } from "./config-DLSWqKoz.mjs";
2
- import { n as buildSingle, r as shimFile, t as build } from "./src-DoHg27jj.mjs";
3
- import { a as globalLogger } from "./package-2depcwF3.mjs";
2
+ import { n as buildSingle, r as shimFile, t as build } from "./src-DWFMRAyU.mjs";
3
+ import { a as globalLogger } from "./package-Cu3WIzIc.mjs";
4
4
 
5
5
  export { build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -1,4 +1,4 @@
1
- import { a as globalLogger, t as version } from "./package-2depcwF3.mjs";
1
+ import { a as globalLogger, t as version } from "./package-Cu3WIzIc.mjs";
2
2
  import process from "node:process";
3
3
  import { bold, green, underline } from "ansis";
4
4
  import { readFile, unlink, writeFile } from "node:fs/promises";
@@ -160,7 +160,7 @@ function hue2rgb(p, q, t) {
160
160
 
161
161
  //#endregion
162
162
  //#region package.json
163
- var version = "0.16.4";
163
+ var version = "0.16.6";
164
164
 
165
165
  //#endregion
166
166
  export { globalLogger as a, debounce as c, noop as d, pkgExists as f, toArray as g, slash as h, generateColor as i, importWithError as l, resolveRegex as m, LogLevels as n, prettyFormat as o, resolveComma as p, createLogger as r, prettyName as s, version as t, matchPattern as u };
package/dist/plugins.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./config-DLSWqKoz.mjs";
2
- import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, s as ExternalPlugin } from "./src-DoHg27jj.mjs";
3
- import "./package-2depcwF3.mjs";
2
+ import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, s as ExternalPlugin } from "./src-DWFMRAyU.mjs";
3
+ import "./package-Cu3WIzIc.mjs";
4
4
 
5
5
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/run.mjs CHANGED
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
- import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-2depcwF3.mjs";
2
+ import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-Cu3WIzIc.mjs";
3
3
  import module from "node:module";
4
4
  import process from "node:process";
5
5
  import { dim } from "ansis";
6
6
  import { VERSION } from "rolldown";
7
- import Debug from "obug";
7
+ import { createDebug, enable, namespaces } from "obug";
8
8
  import { cac } from "cac";
9
9
 
10
10
  //#region src/features/debug.ts
11
- const debug = Debug("tsdown:debug");
11
+ const debug = createDebug("tsdown:debug");
12
12
  function enableDebugLog(cliOptions) {
13
13
  const { debugLogs } = cliOptions;
14
14
  if (!debugLogs) return;
15
15
  let namespace;
16
16
  if (debugLogs === true) namespace = "tsdown:*";
17
17
  else namespace = resolveComma(toArray(debugLogs)).map((v) => `tsdown:${v}`).join(",");
18
- const enabled = Debug.disable();
19
- if (enabled) namespace += `,${enabled}`;
20
- Debug.enable(namespace);
18
+ const ns = namespaces();
19
+ if (ns) namespace += `,${ns}`;
20
+ enable(namespace);
21
21
  debug("Debugging enabled", namespace);
22
22
  }
23
23
 
@@ -36,7 +36,7 @@ cli.command("[...files]", "Bundle files", {
36
36
  await build$1(flags);
37
37
  });
38
38
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
39
- const { migrate } = await import("./migrate-Cxbt-lPD.mjs");
39
+ const { migrate } = await import("./migrate-CFJaLDyD.mjs");
40
40
  await migrate(args);
41
41
  });
42
42
  async function runCLI() {
@@ -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 debounce, d as noop, f as pkgExists, g as toArray, h as slash, i as generateColor, l as importWithError, m as resolveRegex, n as LogLevels, o as prettyFormat, p as resolveComma, r as createLogger, s as prettyName, t as version, u as matchPattern } from "./package-2depcwF3.mjs";
3
+ import { a as globalLogger, c as debounce, d as noop, f as pkgExists, g as toArray, h as slash, i as generateColor, l as importWithError, m as resolveRegex, n as LogLevels, o as prettyFormat, p as resolveComma, r as createLogger, s as prettyName, t as version, u as matchPattern } from "./package-Cu3WIzIc.mjs";
4
4
  import { builtinModules, isBuiltin } from "node:module";
5
5
  import path, { dirname, join, normalize, sep } from "node:path";
6
6
  import process from "node:process";
@@ -10,7 +10,7 @@ import { VERSION, build } from "rolldown";
10
10
  import { exec } from "tinyexec";
11
11
  const treeKill = __cjs_require("tree-kill");
12
12
  import { access, chmod, cp, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
13
- import Debug from "obug";
13
+ import { createDebug } from "obug";
14
14
  import { createConfigCoreLoader } from "unconfig-core";
15
15
  import { glob, isDynamicPattern } from "tinyglobby";
16
16
  import { RE_CSS, RE_DTS, RE_JS, RE_NODE_MODULES } from "rolldown-plugin-dts/filename";
@@ -68,7 +68,7 @@ function lowestCommonAncestor(...filepaths) {
68
68
 
69
69
  //#endregion
70
70
  //#region src/config/config.ts
71
- const debug$8 = Debug("tsdown:config");
71
+ const debug$8 = createDebug("tsdown:config");
72
72
  async function loadViteConfig(prefix, cwd, configLoader) {
73
73
  const loader = resolveConfigLoader(configLoader);
74
74
  debug$8("Loading Vite config via loader: ", loader);
@@ -198,7 +198,7 @@ async function unrunImport(id) {
198
198
 
199
199
  //#endregion
200
200
  //#region src/features/clean.ts
201
- const debug$7 = Debug("tsdown:clean");
201
+ const debug$7 = createDebug("tsdown:clean");
202
202
  const RE_LAST_SLASH = /[/\\]$/;
203
203
  async function cleanOutDir(configs) {
204
204
  const removes = /* @__PURE__ */ new Set();
@@ -278,10 +278,20 @@ async function writeExports(options, chunks) {
278
278
  updatedPkg.publishConfig.exports = publishExports;
279
279
  }
280
280
  const original = await readFile(pkg.packageJsonPath, "utf8");
281
- let contents = JSON.stringify(updatedPkg, null, original.includes(" ") ? " " : 2);
281
+ let contents = JSON.stringify(updatedPkg, null, detectIndent(original));
282
282
  if (original.endsWith("\n")) contents += "\n";
283
283
  if (contents !== original) await writeFile(pkg.packageJsonPath, contents, "utf8");
284
284
  }
285
+ function detectIndent(jsonText) {
286
+ const lines = jsonText.split(/\r?\n/);
287
+ for (const line of lines) {
288
+ const match = line.match(/^(\s+)\S/);
289
+ if (!match) continue;
290
+ if (match[1].includes(" ")) return " ";
291
+ return match[1].length;
292
+ }
293
+ return 2;
294
+ }
285
295
  async function generateExports(pkg, outDir, chunks, { devExports, all, customExports }) {
286
296
  const pkgJsonPath = pkg.packageJsonPath;
287
297
  const pkgRoot$1 = path.dirname(pkgJsonPath);
@@ -433,7 +443,7 @@ async function resolveTsconfig(logger, tsconfig, cwd, name) {
433
443
 
434
444
  //#endregion
435
445
  //#region src/utils/package.ts
436
- const debug$6 = Debug("tsdown:package");
446
+ const debug$6 = createDebug("tsdown:package");
437
447
  async function readPackageJson(dir) {
438
448
  const packageJsonPath = up$1({ cwd: dir });
439
449
  if (!packageJsonPath) return;
@@ -465,7 +475,7 @@ function normalizeFormat(format) {
465
475
 
466
476
  //#endregion
467
477
  //#region src/config/index.ts
468
- const debug$5 = Debug("tsdown:options");
478
+ const debug$5 = createDebug("tsdown:options");
469
479
  const DEFAULT_EXCLUDE_WORKSPACE = [
470
480
  "**/node_modules/**",
471
481
  "**/dist/**",
@@ -649,7 +659,7 @@ async function mergeUserOptions(defaults, user, args) {
649
659
 
650
660
  //#endregion
651
661
  //#region src/features/attw.ts
652
- const debug$4 = Debug("tsdown:attw");
662
+ const debug$4 = createDebug("tsdown:attw");
653
663
  /**
654
664
  * ATTW profiles.
655
665
  * Defines the resolution modes to ignore for each profile.
@@ -776,7 +786,7 @@ async function createHooks$1(options) {
776
786
 
777
787
  //#endregion
778
788
  //#region src/features/publint.ts
779
- const debug$3 = Debug("tsdown:publint");
789
+ const debug$3 = createDebug("tsdown:publint");
780
790
  async function publint(options) {
781
791
  if (!options.publint) return;
782
792
  if (!options.pkg) {
@@ -815,7 +825,7 @@ async function publint(options) {
815
825
 
816
826
  //#endregion
817
827
  //#region src/features/external.ts
818
- const debug$2 = Debug("tsdown:external");
828
+ const debug$2 = createDebug("tsdown:external");
819
829
  function ExternalPlugin({ pkg, noExternal, inlineOnly, skipNodeModulesBundle }) {
820
830
  const deps = pkg && Array.from(getProductionDeps(pkg));
821
831
  return {
@@ -1010,7 +1020,7 @@ function formatBytes(bytes) {
1010
1020
 
1011
1021
  //#endregion
1012
1022
  //#region src/features/report.ts
1013
- const debug$1 = Debug("tsdown:report");
1023
+ const debug$1 = createDebug("tsdown:report");
1014
1024
  const brotliCompressAsync = promisify(brotliCompress);
1015
1025
  const gzipAsync = promisify(gzip);
1016
1026
  const defaultOptions = {
@@ -1121,7 +1131,7 @@ function getShimsInject(format, platform) {
1121
1131
 
1122
1132
  //#endregion
1123
1133
  //#region src/features/rolldown.ts
1124
- const debug = Debug("tsdown:rolldown");
1134
+ const debug = createDebug("tsdown:rolldown");
1125
1135
  async function getBuildOptions(config, format, isMultiFormat, cjsDts = false) {
1126
1136
  const inputOptions = await resolveInputOptions(config, format, cjsDts, isMultiFormat);
1127
1137
  const outputOptions = await resolveOutputOptions(inputOptions, config, format, cjsDts);
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "homepage": "https://github.com/rolldown/tsdown#readme",
7
+ "homepage": "http://tsdown.dev/",
8
8
  "bugs": {
9
9
  "url": "https://github.com/rolldown/tsdown/issues"
10
10
  },
@@ -79,20 +79,20 @@
79
79
  "diff": "^8.0.2",
80
80
  "empathic": "^2.0.0",
81
81
  "hookable": "^5.5.3",
82
- "obug": "^1.0.0",
83
- "rolldown": "1.0.0-beta.50",
84
- "rolldown-plugin-dts": "^0.17.7",
82
+ "obug": "^2.1.0",
83
+ "rolldown": "1.0.0-beta.51",
84
+ "rolldown-plugin-dts": "^0.18.0",
85
85
  "semver": "^7.7.3",
86
86
  "tinyexec": "^1.0.2",
87
87
  "tinyglobby": "^0.2.15",
88
88
  "tree-kill": "^1.2.2",
89
89
  "unconfig-core": "^7.4.1",
90
- "unrun": "^0.2.9"
90
+ "unrun": "^0.2.11"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@arethetypeswrong/core": "^0.18.2",
94
- "@sxzz/eslint-config": "^7.2.10",
95
- "@sxzz/prettier-config": "^2.2.4",
94
+ "@sxzz/eslint-config": "^7.3.0",
95
+ "@sxzz/prettier-config": "^2.2.5",
96
96
  "@sxzz/test-utils": "^0.5.12",
97
97
  "@types/node": "^24.10.1",
98
98
  "@types/semver": "^7.7.1",
@@ -107,11 +107,11 @@
107
107
  "publint": "^0.3.15",
108
108
  "rolldown-plugin-require-cjs": "^0.3.1",
109
109
  "typescript": "~5.9.3",
110
- "unocss": "^66.5.6",
110
+ "unocss": "^66.5.7",
111
111
  "unplugin-lightningcss": "^0.4.3",
112
112
  "unplugin-unused": "^0.5.6",
113
- "vite": "npm:rolldown-vite@^7.2.5",
114
- "vitest": "^4.0.8"
113
+ "vite": "npm:rolldown-vite@^7.2.6",
114
+ "vitest": "^4.0.10"
115
115
  },
116
116
  "engines": {
117
117
  "node": ">=20.19.0"