tsdown 0.17.0-beta.5 → 0.17.0

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-ipppZiPk.mjs";
3
- import { a as globalLogger } from "./package-CxZ5olT1.mjs";
2
+ import { n as buildSingle, r as shimFile, t as build } from "./src-v58M1R6D.mjs";
3
+ import { a as globalLogger } from "./package-D-MHLh9E.mjs";
4
4
 
5
5
  export { build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -1,4 +1,5 @@
1
1
  import { bgRed, bgYellow, blue, green, rgb, yellow } from "ansis";
2
+ import process from "node:process";
2
3
 
3
4
  //#region src/utils/general.ts
4
5
  function toArray(val, defaultValue) {
@@ -76,20 +77,21 @@ function createLogger(level = "info", { customLogger, console = globalThis.conso
76
77
  output("info", `${blue`ℹ`} ${format(msgs)}`);
77
78
  },
78
79
  warn(...msgs) {
80
+ if (failOnWarn) return this.error(...msgs);
79
81
  const message = format(msgs);
80
- if (failOnWarn) throw new Error(message);
81
82
  warnedMessages.add(message);
82
83
  output("warn", `\n${bgYellow` WARN `} ${message}\n`);
83
84
  },
84
85
  warnOnce(...msgs) {
85
86
  const message = format(msgs);
86
87
  if (warnedMessages.has(message)) return;
87
- if (failOnWarn) throw new Error(message);
88
+ if (failOnWarn) return this.error(...msgs);
88
89
  warnedMessages.add(message);
89
90
  output("warn", `\n${bgYellow` WARN `} ${message}\n`);
90
91
  },
91
92
  error(...msgs) {
92
93
  output("error", `\n${bgRed` ERROR `} ${format(msgs)}\n`);
94
+ process.exitCode = 1;
93
95
  },
94
96
  success(...msgs) {
95
97
  output("info", `${green`✔`} ${format(msgs)}`);
@@ -159,7 +161,7 @@ function hue2rgb(p, q, t) {
159
161
 
160
162
  //#endregion
161
163
  //#region package.json
162
- var version = "0.17.0-beta.5";
164
+ var version = "0.17.0";
163
165
 
164
166
  //#endregion
165
167
  export { globalLogger as a, importWithError as c, pkgExists as d, promiseWithResolvers as f, toArray as g, slash as h, generateColor as i, matchPattern as l, resolveRegex as m, LogLevels as n, prettyFormat as o, resolveComma as p, createLogger as r, prettyName as s, version as t, noop as u };
@@ -9,9 +9,6 @@ declare function ExternalPlugin({
9
9
  skipNodeModulesBundle
10
10
  }: ResolvedConfig): Plugin;
11
11
  //#endregion
12
- //#region src/features/shebang.d.ts
13
- declare function ShebangPlugin(logger: Logger, cwd: string, name?: string, isDualFormat?: boolean): Plugin;
14
- //#endregion
15
12
  //#region src/features/node-protocol.d.ts
16
13
  /**
17
14
  * The `node:` protocol was added in Node.js v14.18.0.
@@ -19,6 +16,9 @@ declare function ShebangPlugin(logger: Logger, cwd: string, name?: string, isDua
19
16
  */
20
17
  declare function NodeProtocolPlugin(nodeProtocolOption: "strip" | true): Plugin;
21
18
  //#endregion
19
+ //#region src/features/shebang.d.ts
20
+ declare function ShebangPlugin(logger: Logger, cwd: string, name?: string, isDualFormat?: boolean): Plugin;
21
+ //#endregion
22
22
  //#region src/features/watch.d.ts
23
23
  declare function WatchPlugin(configFiles: string[], {
24
24
  config,
package/dist/plugins.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import "./config-DLSWqKoz.mjs";
2
- import { a as ShebangPlugin, c as ExternalPlugin, i as WatchPlugin, o as ReportPlugin, s as NodeProtocolPlugin } from "./src-ipppZiPk.mjs";
3
- import "./package-CxZ5olT1.mjs";
1
+ import { a as ShebangPlugin, c as ExternalPlugin, i as WatchPlugin, o as ReportPlugin, s as NodeProtocolPlugin } from "./src-v58M1R6D.mjs";
2
+ import "./package-D-MHLh9E.mjs";
4
3
 
5
4
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
package/dist/run.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-CxZ5olT1.mjs";
2
+ import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-D-MHLh9E.mjs";
3
3
  import module from "node:module";
4
4
  import { dim } from "ansis";
5
5
  import { VERSION } from "rolldown";
@@ -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 importWithError, d as pkgExists, f as promiseWithResolvers, g as toArray, h as slash, i as generateColor, l as matchPattern, m as resolveRegex, n as LogLevels, o as prettyFormat, p as resolveComma, r as createLogger, s as prettyName, t as version, u as noop } from "./package-CxZ5olT1.mjs";
3
+ import { a as globalLogger, c as importWithError, d as pkgExists, f as promiseWithResolvers, g as toArray, h as slash, i as generateColor, l as matchPattern, m as resolveRegex, n as LogLevels, o as prettyFormat, p as resolveComma, r as createLogger, s as prettyName, t as version, u as noop } from "./package-D-MHLh9E.mjs";
4
4
  import { builtinModules, isBuiltin } from "node:module";
5
5
  import path, { dirname, join, normalize, sep } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -739,16 +739,16 @@ function warnLegacyCJS(config) {
739
739
  //#region src/features/copy.ts
740
740
  async function copy(options) {
741
741
  if (!options.copy) return;
742
- const copy$1 = typeof options.copy === "function" ? await options.copy(options) : options.copy;
743
- await Promise.all(toArray(copy$1).map((dir) => {
744
- const from = typeof dir === "string" ? dir : dir.from;
745
- const to = typeof dir === "string" ? path.resolve(options.outDir, path.basename(from)) : dir.to;
746
- return cp$1(options.cwd, from, to);
742
+ const resolved = toArray(typeof options.copy === "function" ? await options.copy(options) : options.copy).map((dir) => {
743
+ const from = path.resolve(options.cwd, typeof dir === "string" ? dir : dir.from);
744
+ return [from, typeof dir === "string" ? path.resolve(options.outDir, path.basename(from)) : path.resolve(options.cwd, dir.to)];
745
+ });
746
+ const name = prettyName(options.name);
747
+ await Promise.all(resolved.map(([from, to]) => {
748
+ options.logger.info(name, `Copying files from ${path.relative(options.cwd, from)} to ${path.relative(options.cwd, to)}`);
749
+ return fsCopy(from, to);
747
750
  }));
748
751
  }
749
- function cp$1(cwd, from, to) {
750
- return fsCopy(path.resolve(cwd, from), path.resolve(cwd, to));
751
- }
752
752
 
753
753
  //#endregion
754
754
  //#region src/features/hooks.ts
@@ -823,8 +823,6 @@ async function attw(options) {
823
823
  checkResult = await attwCore.checkPackage(pkg, attwOptions);
824
824
  } catch (error) {
825
825
  options.logger.error("ATTW check failed:", error);
826
- debug$4("Found errors, setting exit code to 1");
827
- process.exitCode = 1;
828
826
  return;
829
827
  } finally {
830
828
  await fsRemove(tempDir);
@@ -837,13 +835,8 @@ async function attw(options) {
837
835
  });
838
836
  if (problems.length) errorMessage = `problems found:\n${problems.map(formatProblem).join("\n")}`;
839
837
  } else errorMessage = `Package has no types`;
840
- if (errorMessage) {
841
- options.logger[level](prettyName(options.name), label$1, errorMessage);
842
- if (level === "error") {
843
- process.exitCode = 1;
844
- debug$4("Found problems, setting exit code to 1");
845
- }
846
- } else options.logger.success(prettyName(options.name), label$1, "No problems found", dim`(${Math.round(performance.now() - t)}ms)`);
838
+ if (errorMessage) options.logger[level](prettyName(options.name), label$1, errorMessage);
839
+ else options.logger.success(prettyName(options.name), label$1, "No problems found", dim`(${Math.round(performance.now() - t)}ms)`);
847
840
  }
848
841
  /**
849
842
  * Format an ATTW problem for display
@@ -894,9 +887,7 @@ async function publint(options) {
894
887
  options.logger.success(prettyName(options.name), label, "No issues found", dim`(${Math.round(performance.now() - t)}ms)`);
895
888
  return;
896
889
  }
897
- let hasError = false;
898
890
  for (const message of messages) {
899
- hasError ||= message.type === "error";
900
891
  const formattedMessage = formatMessage(message, options.pkg);
901
892
  const logType = {
902
893
  error: "error",
@@ -905,10 +896,6 @@ async function publint(options) {
905
896
  }[message.type];
906
897
  options.logger[logType](prettyName(options.name), label, formattedMessage);
907
898
  }
908
- if (hasError) {
909
- debug$3("Found errors, setting exit code to 1");
910
- process.exitCode = 1;
911
- }
912
899
  }
913
900
 
914
901
  //#endregion
@@ -1349,7 +1336,7 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
1349
1336
  }
1350
1337
  if (target) plugins.push(await LightningCSSPlugin({ target }));
1351
1338
  plugins.push(ShebangPlugin(logger, cwd, name, isDualFormat));
1352
- if (globImport) plugins.push(importGlobPlugin());
1339
+ if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
1353
1340
  }
1354
1341
  if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(report, logger, cwd, cjsDts, name, isDualFormat));
1355
1342
  if (watch$1) plugins.push(WatchPlugin(configFiles, bundle));
@@ -1627,8 +1614,8 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
1627
1614
  return configs$1;
1628
1615
  }
1629
1616
  async function postBuild() {
1630
- if (updated) await copy(config);
1631
- else await done(bundle);
1617
+ await copy(config);
1618
+ if (!updated) await done(bundle);
1632
1619
  await hooks.callHook("build:done", {
1633
1620
  ...context,
1634
1621
  chunks
package/package.json CHANGED
@@ -1,27 +1,19 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.17.0-beta.5",
4
- "description": "The Elegant Bundler for Libraries",
5
3
  "type": "module",
4
+ "version": "0.17.0",
5
+ "description": "The Elegant Bundler for Libraries",
6
+ "author": "Kevin Deng <sxzz@sxzz.moe>",
6
7
  "license": "MIT",
8
+ "funding": "https://github.com/sponsors/sxzz",
7
9
  "homepage": "http://tsdown.dev/",
8
- "bugs": {
9
- "url": "https://github.com/rolldown/tsdown/issues"
10
- },
11
10
  "repository": {
12
11
  "type": "git",
13
12
  "url": "git+https://github.com/rolldown/tsdown.git"
14
13
  },
15
- "author": "Kevin Deng <sxzz@sxzz.moe>",
16
- "funding": "https://github.com/sponsors/sxzz",
17
- "files": [
18
- "client.d.ts",
19
- "dist",
20
- "esm-shims.js"
21
- ],
22
- "main": "./dist/index.mjs",
23
- "module": "./dist/index.mjs",
24
- "types": "./dist/index.d.mts",
14
+ "bugs": {
15
+ "url": "https://github.com/rolldown/tsdown/issues"
16
+ },
25
17
  "exports": {
26
18
  ".": "./dist/index.mjs",
27
19
  "./config": "./dist/config.mjs",
@@ -30,6 +22,9 @@
30
22
  "./package.json": "./package.json",
31
23
  "./client": "./client.d.ts"
32
24
  },
25
+ "main": "./dist/index.mjs",
26
+ "module": "./dist/index.mjs",
27
+ "types": "./dist/index.d.mts",
33
28
  "typesVersions": {
34
29
  "*": {
35
30
  "*": [
@@ -41,9 +36,17 @@
41
36
  "bin": {
42
37
  "tsdown": "./dist/run.mjs"
43
38
  },
39
+ "files": [
40
+ "client.d.ts",
41
+ "dist",
42
+ "esm-shims.js"
43
+ ],
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
+ "engines": {
48
+ "node": ">=20.19.0"
49
+ },
47
50
  "peerDependencies": {
48
51
  "@arethetypeswrong/core": "^0.18.1",
49
52
  "@vitejs/devtools": "^0.0.0-alpha.18",
@@ -77,45 +80,44 @@
77
80
  "cac": "^6.7.14",
78
81
  "empathic": "^2.0.0",
79
82
  "hookable": "^5.5.3",
80
- "import-without-cache": "^0.2.0",
83
+ "import-without-cache": "^0.2.2",
81
84
  "obug": "^2.1.1",
82
- "rolldown": "1.0.0-beta.52",
83
- "rolldown-plugin-dts": "^0.18.1",
85
+ "rolldown": "1.0.0-beta.53",
86
+ "rolldown-plugin-dts": "^0.18.2",
84
87
  "semver": "^7.7.3",
85
88
  "tinyexec": "^1.0.2",
86
89
  "tinyglobby": "^0.2.15",
87
90
  "tree-kill": "^1.2.2",
88
91
  "unconfig-core": "^7.4.1",
89
- "unrun": "^0.2.14"
92
+ "unrun": "^0.2.16"
90
93
  },
91
94
  "devDependencies": {
92
95
  "@arethetypeswrong/core": "^0.18.2",
93
- "@sxzz/eslint-config": "^7.4.0",
96
+ "@sxzz/eslint-config": "^7.4.1",
94
97
  "@sxzz/prettier-config": "^2.2.6",
95
98
  "@sxzz/test-utils": "^0.5.13",
96
99
  "@types/node": "^24.10.1",
97
100
  "@types/semver": "^7.7.1",
98
- "@unocss/eslint-plugin": "^66.5.9",
101
+ "@typescript/native-preview": "7.0.0-dev.20251204.1",
102
+ "@unocss/eslint-plugin": "^66.5.10",
99
103
  "@vitejs/devtools": "^0.0.0-alpha.18",
100
- "@vitest/coverage-v8": "4.0.14",
104
+ "@vitest/coverage-v8": "4.0.15",
101
105
  "@vueuse/core": "^14.1.0",
102
106
  "bumpp": "^10.3.2",
107
+ "dedent": "^1.7.0",
103
108
  "eslint": "^9.39.1",
104
109
  "is-in-ci": "^2.0.0",
105
110
  "lightningcss": "^1.30.2",
106
111
  "pkg-types": "^2.3.0",
107
- "prettier": "^3.7.1",
112
+ "prettier": "^3.7.4",
108
113
  "publint": "^0.3.15",
109
- "rolldown-plugin-require-cjs": "^0.3.2",
114
+ "rolldown-plugin-require-cjs": "^0.3.3",
110
115
  "typescript": "~5.9.3",
111
- "unocss": "^66.5.9",
116
+ "unocss": "^66.5.10",
112
117
  "unplugin-lightningcss": "^0.4.3",
113
118
  "unplugin-unused": "^0.5.6",
114
- "vite": "npm:rolldown-vite@^7.2.8",
115
- "vitest": "^4.0.14"
116
- },
117
- "engines": {
118
- "node": ">=20.19.0"
119
+ "vite": "npm:rolldown-vite@^7.2.10",
120
+ "vitest": "^4.0.15"
119
121
  },
120
122
  "prettier": "@sxzz/prettier-config",
121
123
  "scripts": {
@@ -124,7 +126,7 @@
124
126
  "build": "unrun ./src/run.ts",
125
127
  "dev": "node ./src/run.ts",
126
128
  "test": "vitest",
127
- "typecheck": "tsc --noEmit",
129
+ "typecheck": "tsgo --noEmit",
128
130
  "format": "prettier --cache --write .",
129
131
  "release": "bumpp -r",
130
132
  "docs:dev": "pnpm -C docs run dev",