tsdown 0.11.12 → 0.11.13

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineConfig } from "./config-yiJy1jd0.js";
2
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-G7Z0rtO5.js";
3
- import { debounce, generateColor, logger, prettyName, resolveComma, slash, toArray } from "./logger-BdIBA2vO.js";
2
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-BV3QPDFO.js";
3
+ import { debounce, generateColor, logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-DcIo21Wv.js";
4
4
  import path from "node:path";
5
5
  import process from "node:process";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -599,7 +599,7 @@ async function resolveWorkspace(config, options) {
599
599
  };
600
600
  }
601
601
  async function resolveConfig(userConfig) {
602
- let { entry, format = ["es"], plugins = [], clean = true, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch = [], shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd(), name, workspace } = userConfig;
602
+ let { entry, format = ["es"], plugins = [], clean = true, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch = [], shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd(), name, workspace, external, noExternal } = userConfig;
603
603
  outDir = path.resolve(cwd, outDir);
604
604
  clean = resolveClean(clean, outDir, cwd);
605
605
  const pkg = await readPackageJson(cwd);
@@ -608,6 +608,8 @@ async function resolveConfig(userConfig) {
608
608
  if (dts == null) dts = !!(pkg?.types || pkg?.typings);
609
609
  target = resolveTarget(target, pkg, name);
610
610
  tsconfig = await resolveTsconfig(tsconfig, cwd, name);
611
+ if (typeof external === "string") external = resolveRegex(external);
612
+ if (typeof noExternal === "string") noExternal = resolveRegex(noExternal);
611
613
  if (publint$1 === true) publint$1 = {};
612
614
  if (publicDir) if (copy$1) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
613
615
  else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
@@ -647,7 +649,9 @@ async function resolveConfig(userConfig) {
647
649
  pkg,
648
650
  copy: publicDir || copy$1,
649
651
  hash: hash ?? true,
650
- name
652
+ name,
653
+ external,
654
+ noExternal
651
655
  };
652
656
  return config;
653
657
  }
@@ -767,12 +771,11 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
767
771
  const { Unused } = await import("unplugin-unused");
768
772
  plugins.push(Unused.rolldown(unused === true ? {} : unused));
769
773
  }
770
- if (target) plugins.push(RuntimeHelperCheckPlugin(target));
774
+ if (target) plugins.push(RuntimeHelperCheckPlugin(target), await LightningCSSPlugin({ target }));
771
775
  plugins.push(ShebangPlugin(cwd, name, isMultiFormat));
772
776
  }
773
777
  if (report && !logger.silent) plugins.push(ReportPlugin(report, cwd, cjsDts, name, isMultiFormat));
774
- if (target) plugins.push(await LightningCSSPlugin({ target }));
775
- plugins.push(userPlugins);
778
+ if (!cjsDts) plugins.push(userPlugins);
776
779
  const inputOptions = await mergeUserOptions({
777
780
  input: entry,
778
781
  cwd,
@@ -11,6 +11,10 @@ function toArray(val, defaultValue) {
11
11
  function resolveComma(arr) {
12
12
  return arr.flatMap((format) => format.split(","));
13
13
  }
14
+ function resolveRegex(str) {
15
+ if (str.length > 2 && str[0] === "/" && str.at(-1) === "/") return new RegExp(str.slice(1, -1));
16
+ return str;
17
+ }
14
18
  function debounce(fn, wait) {
15
19
  let timeout;
16
20
  return function(...args) {
@@ -113,4 +117,4 @@ function hue2rgb(p, q, t) {
113
117
  }
114
118
 
115
119
  //#endregion
116
- export { debounce, generateColor, logger, noop, prettyFormat, prettyName, resolveComma, slash, toArray };
120
+ export { debounce, generateColor, logger, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray };
@@ -1,5 +1,5 @@
1
- import { logger } from "./logger-BdIBA2vO.js";
2
- import { version } from "./package-DQpXq2zc.js";
1
+ import { logger } from "./logger-DcIo21Wv.js";
2
+ import { version } from "./package-BjscpG31.js";
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.11.13";
3
+
4
+ //#endregion
5
+ export { version };
@@ -1,4 +1,4 @@
1
- import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-BdIBA2vO.js";
1
+ import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-DcIo21Wv.js";
2
2
  import path, { dirname, normalize, sep } from "node:path";
3
3
  import { bold, dim, green, underline } from "ansis";
4
4
  import Debug from "debug";
package/dist/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-G7Z0rtO5.js";
2
- import "./logger-BdIBA2vO.js";
1
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-BV3QPDFO.js";
2
+ import "./logger-DcIo21Wv.js";
3
3
 
4
4
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/run.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { logger, resolveComma, toArray } from "./logger-BdIBA2vO.js";
3
- import { version } from "./package-DQpXq2zc.js";
2
+ import { logger, resolveComma, toArray } from "./logger-DcIo21Wv.js";
3
+ import { version } from "./package-BjscpG31.js";
4
4
  import module from "node:module";
5
5
  import process from "node:process";
6
6
  import { dim } from "ansis";
@@ -14,7 +14,7 @@ cli.help().version(version);
14
14
  cli.command("[...files]", "Bundle files", {
15
15
  ignoreOptionDefaultValue: true,
16
16
  allowUnknownOptions: true
17
- }).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("-W, --workspace [dir]", "Enable workspace mode").option("-f, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").action(async (input, flags) => {
17
+ }).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("-W, --workspace [dir]", "Enable workspace mode").option("-f, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").action(async (input, flags) => {
18
18
  logger.setSilent(!!flags.silent);
19
19
  logger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
20
20
  const { build: build$1 } = await import("./index.js");
@@ -22,7 +22,7 @@ cli.command("[...files]", "Bundle files", {
22
22
  await build$1(flags);
23
23
  });
24
24
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
25
- const { migrate } = await import("./migrate-DFC9EXfl.js");
25
+ const { migrate } = await import("./migrate-hgmWgN5I.js");
26
26
  await migrate(args);
27
27
  });
28
28
  async function runCLI() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.11.12",
3
+ "version": "0.11.13",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -70,7 +70,7 @@
70
70
  "empathic": "^1.1.0",
71
71
  "hookable": "^5.5.3",
72
72
  "rolldown": "1.0.0-beta.9",
73
- "rolldown-plugin-dts": "^0.13.2",
73
+ "rolldown-plugin-dts": "^0.13.3",
74
74
  "semver": "^7.7.2",
75
75
  "tinyexec": "^1.0.1",
76
76
  "tinyglobby": "^0.2.13",
@@ -82,7 +82,7 @@
82
82
  "@sxzz/prettier-config": "^2.2.1",
83
83
  "@sxzz/test-utils": "^0.5.6",
84
84
  "@types/debug": "^4.1.12",
85
- "@types/node": "^22.15.19",
85
+ "@types/node": "^22.15.21",
86
86
  "@types/semver": "^7.7.0",
87
87
  "@unocss/eslint-plugin": "^66.1.2",
88
88
  "bumpp": "^10.1.1",
@@ -91,7 +91,6 @@
91
91
  "pkg-types": "^2.1.0",
92
92
  "prettier": "^3.5.3",
93
93
  "publint": "^0.3.12",
94
- "tsup": "^8.5.0",
95
94
  "typedoc": "^0.28.4",
96
95
  "typedoc-plugin-markdown": "^4.6.3",
97
96
  "typescript": "~5.8.3",
@@ -101,8 +100,8 @@
101
100
  "vite": "^6.3.5",
102
101
  "vitepress": "^1.6.3",
103
102
  "vitepress-plugin-group-icons": "^1.5.5",
104
- "vitepress-plugin-llms": "^1.2.0",
105
- "vitest": "^3.1.3",
103
+ "vitepress-plugin-llms": "^1.3.2",
104
+ "vitest": "^3.1.4",
106
105
  "vue": "^3.5.14"
107
106
  },
108
107
  "engines": {
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.11.12";
3
-
4
- //#endregion
5
- export { version };