tsdown 0.7.0 → 0.7.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.
@@ -63,13 +63,13 @@ function getTempDtsDir(format) {
63
63
  return `${TEMP_DTS_DIR}-${format}`;
64
64
  }
65
65
  async function bundleDts(options, jsExtension, format) {
66
+ debug$1("Bundle dts for %s", format);
66
67
  const { dts: dts$1, bundleDts: bundleDts$1 } = options;
67
68
  const ext = jsExtension.replace("j", "t");
68
69
  const dtsOutDir = path.resolve(options.outDir, getTempDtsDir(format));
69
70
  const dtsEntry = Object.fromEntries(Object.keys(options.entry).map((key) => [key, path.resolve(dtsOutDir, `${key}.d.${ext}`)]));
70
71
  let outDir = options.outDir;
71
- const extraOutdir = dts$1.extraOutdir;
72
- if (extraOutdir) outDir = path.resolve(outDir, extraOutdir);
72
+ if (dts$1.extraOutdir) outDir = path.resolve(outDir, dts$1.extraOutdir);
73
73
  await build({
74
74
  input: dtsEntry,
75
75
  onLog(level, log, defaultHandler) {
@@ -78,10 +78,12 @@ async function bundleDts(options, jsExtension, format) {
78
78
  plugins: [bundleDts$1.resolve && ResolveDtsPlugin(bundleDts$1.resolve !== true ? bundleDts$1.resolve : void 0), dts()],
79
79
  output: {
80
80
  dir: outDir,
81
- entryFileNames: `[name].d.${ext}`
81
+ entryFileNames: `[name].d.${ext}`,
82
+ chunkFileNames: `[name]-[hash].d.${ext}`
82
83
  }
83
84
  });
84
85
  await fsRemove(dtsOutDir);
86
+ debug$1("Bundle dts done for %s", format);
85
87
  }
86
88
  let resolver;
87
89
  function ResolveDtsPlugin(resolveOnly) {
@@ -96,7 +98,14 @@ function ResolveDtsPlugin(resolveOnly) {
96
98
  "import",
97
99
  "require"
98
100
  ],
99
- extensions: [".d.ts", ".ts"],
101
+ extensions: [
102
+ ".d.ts",
103
+ ".d.mts",
104
+ ".d.cts",
105
+ ".ts",
106
+ ".mts",
107
+ ".cts"
108
+ ],
100
109
  modules: ["node_modules", "node_modules/@types"]
101
110
  });
102
111
  },
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineConfig } from "./config-0LDjKwZ7.js";
2
- import { ExternalPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray } from "./external-UOzsEfbe.js";
2
+ import { ExternalPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray } from "./external-DZHHBSOL.js";
3
3
  import { debug, logger, setSilent } from "./logger-9p9U7Sx7.js";
4
4
  import path from "node:path";
5
5
  import process from "node:process";
@@ -387,6 +387,7 @@ async function buildSingle(config) {
387
387
  async function rebuild(first) {
388
388
  const startTime = performance.now();
389
389
  if (clean) await cleanOutDir(outDir, clean);
390
+ let hasErrors = false;
390
391
  await Promise.all(format.map(async (format$1) => {
391
392
  const inputOptions = await mergeUserOptions({
392
393
  input: entry,
@@ -417,12 +418,22 @@ async function buildSingle(config) {
417
418
  entryFileNames: `[name].${extension}`,
418
419
  chunkFileNames: `[name]-[hash].${extension}`
419
420
  }, config.outputOptions, [format$1]);
420
- await build$1({
421
- ...inputOptions,
422
- output: outputOptions
423
- });
424
- if (config.dts && config.bundleDts) await bundleDts(config, extension, format$1);
421
+ try {
422
+ await build$1({
423
+ ...inputOptions,
424
+ output: outputOptions
425
+ });
426
+ if (config.dts && config.bundleDts) await bundleDts(config, extension, format$1);
427
+ } catch (error) {
428
+ if (watch) {
429
+ logger.error(error);
430
+ hasErrors = true;
431
+ return;
432
+ }
433
+ throw error;
434
+ }
425
435
  }));
436
+ if (hasErrors) return;
426
437
  if (config.publint) if (pkg) await publint(pkg);
427
438
  else logger.warn("publint is enabled but package.json is not found");
428
439
  logger.success(`${first ? "Build" : "Rebuild"} complete in ${Math.round(performance.now() - startTime)}ms`);
@@ -1,4 +1,4 @@
1
- import { version } from "./package-D9ZwWI0B.js";
1
+ import { version } from "./package-B6NtTdMC.js";
2
2
  import process from "node:process";
3
3
  import { readFile, unlink, writeFile } from "node:fs/promises";
4
4
  import consola from "consola";
@@ -0,0 +1,6 @@
1
+
2
+ //#region package.json
3
+ var version = "0.7.2";
4
+
5
+ //#endregion
6
+ export { version };
package/dist/plugins.js CHANGED
@@ -1,3 +1,3 @@
1
- import { ExternalPlugin, ResolveDtsPlugin } from "./external-UOzsEfbe.js";
1
+ import { ExternalPlugin, ResolveDtsPlugin } from "./external-DZHHBSOL.js";
2
2
 
3
3
  export { ExternalPlugin, ResolveDtsPlugin };
package/dist/run.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { logger, setSilent } from "./logger-9p9U7Sx7.js";
2
- import { version } from "./package-D9ZwWI0B.js";
2
+ import { version } from "./package-B6NtTdMC.js";
3
3
  import process from "node:process";
4
4
  import { VERSION } from "rolldown";
5
5
  import { dim } from "ansis";
@@ -16,7 +16,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
16
16
  await build$1(flags);
17
17
  });
18
18
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
19
- const { migrate } = await import("./migrate-C215d2_a.js");
19
+ const { migrate } = await import("./migrate-Bstk6m9b.js");
20
20
  await migrate(args);
21
21
  });
22
22
  async function runCLI() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "An even faster bundler powered by Rolldown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -61,9 +61,9 @@
61
61
  "debug": "^4.4.0",
62
62
  "diff": "^7.0.0",
63
63
  "find-up-simple": "^1.0.1",
64
- "oxc-resolver": "^5.0.1",
64
+ "oxc-resolver": "^5.1.0",
65
65
  "rolldown": "^1.0.0-beta.7",
66
- "rolldown-plugin-dts": "https://pkg.pr.new/sxzz/rolldown-plugin-dts@eeb45e0",
66
+ "rolldown-plugin-dts": "https://pkg.pr.new/sxzz/rolldown-plugin-dts@7b446ed",
67
67
  "tinyglobby": "^0.2.12",
68
68
  "unconfig": "^7.3.1",
69
69
  "unplugin-isolated-decl": "^0.13.5"
@@ -74,10 +74,10 @@
74
74
  "@sxzz/test-utils": "^0.5.4",
75
75
  "@types/debug": "^4.1.12",
76
76
  "@types/diff": "^7.0.2",
77
- "@types/node": "^22.13.14",
77
+ "@types/node": "^22.13.17",
78
78
  "bumpp": "^10.1.0",
79
79
  "eslint": "^9.23.0",
80
- "oxc-transform": "^0.61.2",
80
+ "oxc-transform": "^0.62.0",
81
81
  "pkg-types": "^2.1.0",
82
82
  "prettier": "^3.5.3",
83
83
  "publint": "^0.3.9",
@@ -86,7 +86,7 @@
86
86
  "tsx": "^4.19.3",
87
87
  "typescript": "~5.8.2",
88
88
  "unplugin-ast": "^0.14.4",
89
- "unplugin-unused": "^0.4.3",
89
+ "unplugin-unused": "^0.4.4",
90
90
  "vite": "^6.2.4",
91
91
  "vitest": "^3.1.1"
92
92
  },
@@ -1,6 +0,0 @@
1
-
2
- //#region package.json
3
- var version = "0.7.0";
4
-
5
- //#endregion
6
- export { version };