tsdown 0.11.11 → 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.
@@ -1,4 +1,4 @@
1
- import { UserConfig, UserConfigFn } from "./types-DnZA5gez.js";
1
+ import { UserConfig, UserConfigFn } from "./types-CsOn0For.js";
2
2
 
3
3
  //#region src/config.d.ts
4
4
  /**
package/dist/config.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { UserConfig, UserConfigFn } from "./types-DnZA5gez.js";
2
- import { defineConfig$1 as defineConfig } from "./config-BMza8hkb.js";
1
+ import { UserConfig, UserConfigFn } from "./types-CsOn0For.js";
2
+ import { defineConfig$1 as defineConfig } from "./config-GQTSGL72.js";
3
3
  export { UserConfig, UserConfigFn, defineConfig };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./types-DnZA5gez.js";
2
- import { defineConfig$1 as defineConfig } from "./config-BMza8hkb.js";
1
+ import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./types-CsOn0For.js";
2
+ import { defineConfig$1 as defineConfig } from "./config-GQTSGL72.js";
3
3
  import "ansis";
4
4
  import { InternalModuleFormat } from "rolldown";
5
5
 
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
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";
7
7
  import { blue, bold, dim, green, underline } from "ansis";
8
8
  import { build as build$1 } from "rolldown";
9
- import { transformPlugin } from "rolldown/experimental";
10
9
  import { exec } from "tinyexec";
11
10
  import Debug from "debug";
12
11
  import { glob } from "tinyglobby";
@@ -600,7 +599,7 @@ async function resolveWorkspace(config, options) {
600
599
  };
601
600
  }
602
601
  async function resolveConfig(userConfig) {
603
- 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;
604
603
  outDir = path.resolve(cwd, outDir);
605
604
  clean = resolveClean(clean, outDir, cwd);
606
605
  const pkg = await readPackageJson(cwd);
@@ -609,6 +608,8 @@ async function resolveConfig(userConfig) {
609
608
  if (dts == null) dts = !!(pkg?.types || pkg?.typings);
610
609
  target = resolveTarget(target, pkg, name);
611
610
  tsconfig = await resolveTsconfig(tsconfig, cwd, name);
611
+ if (typeof external === "string") external = resolveRegex(external);
612
+ if (typeof noExternal === "string") noExternal = resolveRegex(noExternal);
612
613
  if (publint$1 === true) publint$1 = {};
613
614
  if (publicDir) if (copy$1) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
614
615
  else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
@@ -648,7 +649,9 @@ async function resolveConfig(userConfig) {
648
649
  pkg,
649
650
  copy: publicDir || copy$1,
650
651
  hash: hash ?? true,
651
- name
652
+ name,
653
+ external,
654
+ noExternal
652
655
  };
653
656
  return config;
654
657
  }
@@ -768,20 +771,11 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
768
771
  const { Unused } = await import("unplugin-unused");
769
772
  plugins.push(Unused.rolldown(unused === true ? {} : unused));
770
773
  }
771
- if (target) plugins.push(transformPlugin({
772
- include: /\.[cm]?[jt]sx?$/,
773
- exclude: /\.d\.[cm]?ts$/,
774
- transformOptions: { target }
775
- }), RuntimeHelperCheckPlugin(target));
774
+ if (target) plugins.push(RuntimeHelperCheckPlugin(target), await LightningCSSPlugin({ target }));
776
775
  plugins.push(ShebangPlugin(cwd, name, isMultiFormat));
777
776
  }
778
777
  if (report && !logger.silent) plugins.push(ReportPlugin(report, cwd, cjsDts, name, isMultiFormat));
779
- if (target) plugins.push(
780
- // Use Lightning CSS to handle CSS input. This is a temporary solution
781
- // until Rolldown supports CSS syntax lowering natively.
782
- await LightningCSSPlugin({ target })
783
- );
784
- plugins.push(userPlugins);
778
+ if (!cjsDts) plugins.push(userPlugins);
785
779
  const inputOptions = await mergeUserOptions({
786
780
  input: entry,
787
781
  cwd,
@@ -811,6 +805,7 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
811
805
  name: config.globalName,
812
806
  sourcemap,
813
807
  dir: outDir,
808
+ target,
814
809
  minify,
815
810
  entryFileNames,
816
811
  chunkFileNames
@@ -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-bNkOwuDn.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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./types-DnZA5gez.js";
1
+ import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./types-CsOn0For.js";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
@@ -7,6 +7,9 @@ declare function ExternalPlugin(options: ResolvedOptions): Plugin;
7
7
 
8
8
  //#endregion
9
9
  //#region src/features/shebang.d.ts
10
+ /*
11
+ * Production deps should be excluded from the bundle
12
+ */
10
13
  declare function ShebangPlugin(cwd: string, name?: string, isMultiFormat?: boolean): Plugin;
11
14
 
12
15
  //#endregion
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-bNkOwuDn.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-BsizCuv-.js");
25
+ const { migrate } = await import("./migrate-hgmWgN5I.js");
26
26
  await migrate(args);
27
27
  });
28
28
  async function runCLI() {
@@ -115,6 +115,7 @@ interface Workspace {
115
115
  * Options for tsdown.
116
116
  */
117
117
  interface Options$3 {
118
+ /// build options
118
119
  entry?: InputOption;
119
120
  external?: ExternalOption;
120
121
  noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
@@ -123,6 +124,7 @@ interface Options$3 {
123
124
  /** @default 'node' */
124
125
  platform?: "node" | "neutral" | "browser";
125
126
  inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
127
+ /// output options
126
128
  /** @default ['es'] */
127
129
  format?: Format | Format[];
128
130
  globalName?: string;
@@ -219,6 +221,7 @@ interface Options$3 {
219
221
  * @default false
220
222
  */
221
223
  fromVite?: boolean | "vitest";
224
+ /// addons
222
225
  /**
223
226
  * Emit TypeScript declaration files (.d.ts).
224
227
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.11.11",
3
+ "version": "0.11.13",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -69,8 +69,8 @@
69
69
  "diff": "^8.0.1",
70
70
  "empathic": "^1.1.0",
71
71
  "hookable": "^5.5.3",
72
- "rolldown": "1.0.0-beta.8-commit.d95f99e",
73
- "rolldown-plugin-dts": "^0.13.1",
72
+ "rolldown": "1.0.0-beta.9",
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.18",
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.1.4",
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": {
@@ -121,6 +120,6 @@
121
120
  "docs:dev": "vitepress dev docs",
122
121
  "docs:build": "vitepress build docs",
123
122
  "docs:preview": "vitepress preview docs",
124
- "docs:generate": "./docs/.vitepress/scripts/docs-generate.sh"
123
+ "docs:generate": "node --import @oxc-node/core/register ./docs/.vitepress/scripts/docs-generate.ts"
125
124
  }
126
125
  }
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.11.11";
3
-
4
- //#endregion
5
- export { version };