tsdown 0.21.0-beta.5 → 0.21.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.
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __cjs_createRequire } from "node:module";
2
2
  const __cjs_require = __cjs_createRequire(import.meta.url);
3
- import { l as slash, n as importWithError, o as promiseWithResolvers, t as debounce, u as toArray } from "./general-1LELSDyN.mjs";
4
- import { a as getPackageType, c as isGlobEntry, d as cleanOutDir, i as loadConfigFile, l as toObjectEntry, n as mergeUserOptions, o as writeExports, r as resolveUserConfig, s as buildExe, u as cleanChunks } from "./options-0OT_k09H.mjs";
5
- import { a as getShimsInject, c as fsRemove, o as fsCopy, r as DepPlugin, u as lowestCommonAncestor } from "./format-DlhdOGIw.mjs";
6
- import { a as globalLogger, t as LogLevels } from "./logger-C4Xhh0rW.mjs";
7
- import { t as CssPlugin } from "./plugin-DbgcY9Q9.mjs";
8
- import { t as version } from "./package-yo2Hto7o.mjs";
9
- import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, t as WatchPlugin } from "./watch-DoBIgnx3.mjs";
3
+ import { l as slash, n as importWithError, o as promiseWithResolvers, t as debounce, u as toArray } from "./general-CRszZCrY.mjs";
4
+ import { a as getPackageType, c as isGlobEntry, d as cleanOutDir, i as loadConfigFile, l as toObjectEntry, n as mergeUserOptions, o as writeExports, r as resolveUserConfig, s as buildExe, u as cleanChunks } from "./options-DpJJmGDp.mjs";
5
+ import { a as getShimsInject, c as fsRemove, o as fsCopy, r as DepPlugin, u as lowestCommonAncestor } from "./format-CM79ZE77.mjs";
6
+ import { a as globalLogger, t as LogLevels } from "./logger-BU0v7CAk.mjs";
7
+ import { t as CssPlugin } from "./plugin-BQv869Ce.mjs";
8
+ import { t as version } from "./package-BzvC5Wbf.mjs";
9
+ import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, t as WatchPlugin } from "./watch-BAbxxJcJ.mjs";
10
10
  import { mkdtemp, readFile, writeFile } from "node:fs/promises";
11
11
  import path from "node:path";
12
12
  import process from "node:process";
@@ -25,7 +25,6 @@ import { Hookable } from "hookable";
25
25
  const treeKill = __cjs_require("tree-kill");
26
26
  import { formatWithOptions, inspect } from "node:util";
27
27
  import { importGlobPlugin } from "rolldown/experimental";
28
-
29
28
  //#region src/config/workspace.ts
30
29
  const debug$4 = createDebug("tsdown:config:workspace");
31
30
  const DEFAULT_EXCLUDE_WORKSPACE = [
@@ -82,7 +81,6 @@ async function resolveWorkspace(config, inlineConfig) {
82
81
  files
83
82
  };
84
83
  }
85
-
86
84
  //#endregion
87
85
  //#region src/config/index.ts
88
86
  const debug$3 = createDebug("tsdown:config");
@@ -109,7 +107,6 @@ async function resolveConfig(inlineConfig) {
109
107
  files
110
108
  };
111
109
  }
112
-
113
110
  //#endregion
114
111
  //#region src/features/cjs.ts
115
112
  function warnLegacyCJS(config) {
@@ -119,7 +116,6 @@ function warnLegacyCJS(config) {
119
116
  return version && satisfies(version, "^20.19.0 || >=22.12.0");
120
117
  })) config.logger.warnOnce("We recommend using the ESM format instead of CommonJS.\nThe ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.\nLearn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here");
121
118
  }
122
-
123
119
  //#endregion
124
120
  //#region src/features/copy.ts
125
121
  async function copy(options) {
@@ -165,7 +161,6 @@ function renameTarget(target, rename, src) {
165
161
  const parsedPath = path.parse(target);
166
162
  return typeof rename === "string" ? rename : rename(parsedPath.name, parsedPath.ext.replace(".", ""), src);
167
163
  }
168
-
169
164
  //#endregion
170
165
  //#region src/features/devtools.ts
171
166
  async function startDevtoolsUI(config) {
@@ -176,7 +171,6 @@ async function startDevtoolsUI(config) {
176
171
  ...typeof config.ui === "object" ? config.ui : {}
177
172
  });
178
173
  }
179
-
180
174
  //#endregion
181
175
  //#region src/features/hooks.ts
182
176
  async function createHooks(options) {
@@ -209,7 +203,6 @@ function executeOnSuccess(config) {
209
203
  } else config.onSuccess(config, ab.signal);
210
204
  return ab;
211
205
  }
212
-
213
206
  //#endregion
214
207
  //#region src/features/pkg/attw.ts
215
208
  const debug$2 = createDebug("tsdown:attw");
@@ -290,7 +283,6 @@ function formatProblem(packageName, problem) {
290
283
  default: return ` ❓ Unknown problem: ${JSON.stringify(problem)}`;
291
284
  }
292
285
  }
293
-
294
286
  //#endregion
295
287
  //#region src/features/pkg/publint.ts
296
288
  const debug$1 = createDebug("tsdown:publint");
@@ -324,7 +316,6 @@ async function publint(options, tarball) {
324
316
  options.logger[logType](options.nameLabel, label, formattedMessage);
325
317
  }
326
318
  }
327
-
328
319
  //#endregion
329
320
  //#region src/features/pkg/index.ts
330
321
  function initBundleByPkg(configs) {
@@ -382,7 +373,7 @@ async function bundleDone(bundleByPkg, bundle) {
382
373
  async function packTarball(packageJsonPath) {
383
374
  const pkgDir = path.dirname(packageJsonPath);
384
375
  const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
385
- const [{ detect }, { pack }] = await Promise.all([import("./detect-CeWQMhKA.mjs"), import("./index-node-CDF8A25m.mjs")]);
376
+ const [{ detect }, { pack }] = await Promise.all([import("./detect-DK-FDZQ9.mjs"), import("./index-node-Djp92Gzb.mjs")]);
386
377
  try {
387
378
  const detected = await detect({ cwd: pkgDir });
388
379
  if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
@@ -419,7 +410,6 @@ function mergeInlinedDeps(bundles) {
419
410
  for (const [pkgName, versions] of merged) result[pkgName] = versions.size === 1 ? [...versions][0] : [...versions].toSorted();
420
411
  return result;
421
412
  }
422
-
423
413
  //#endregion
424
414
  //#region src/features/output.ts
425
415
  function resolveJsOutputExtension(packageType, format, fixedExtension) {
@@ -468,7 +458,6 @@ function resolveChunkAddon(chunkAddon, format) {
468
458
  }
469
459
  };
470
460
  }
471
-
472
461
  //#endregion
473
462
  //#region src/features/rolldown.ts
474
463
  const debug = createDebug("tsdown:rolldown");
@@ -546,7 +535,10 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
546
535
  inject
547
536
  },
548
537
  plugins,
549
- moduleTypes: loader,
538
+ moduleTypes: {
539
+ ".node": "copy",
540
+ ...loader
541
+ },
550
542
  logLevel: logger.level === "error" ? "silent" : logger.level,
551
543
  onLog(level, log, defaultHandler) {
552
544
  if (cjsDefault && log.code === "MIXED_EXPORT") return;
@@ -608,7 +600,6 @@ function handlePluginInspect(plugins) {
608
600
  else return `"rolldown plugin: ${plugins.name}"`;
609
601
  };
610
602
  }
611
-
612
603
  //#endregion
613
604
  //#region src/features/shortcuts.ts
614
605
  function shortcuts(restart) {
@@ -660,7 +651,6 @@ function shortcuts(restart) {
660
651
  rl.on("line", onInput);
661
652
  return () => rl.close();
662
653
  }
663
-
664
654
  //#endregion
665
655
  //#region src/build.ts
666
656
  const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
@@ -825,6 +815,5 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
825
815
  ab = executeOnSuccess(config);
826
816
  }
827
817
  }
828
-
829
818
  //#endregion
830
- export { buildWithConfigs as n, build$1 as t };
819
+ export { buildWithConfigs as n, build$1 as t };
@@ -0,0 +1,2 @@
1
+ import { t as build } from "./build-TmLngPCw.mjs";
2
+ export { build };
package/dist/config.mjs CHANGED
@@ -1,9 +1,7 @@
1
- import { t as mergeConfig } from "./options-0OT_k09H.mjs";
2
-
1
+ import { t as mergeConfig } from "./options-DpJJmGDp.mjs";
3
2
  //#region src/config.ts
4
3
  function defineConfig(options) {
5
4
  return options;
6
5
  }
7
-
8
6
  //#endregion
9
- export { defineConfig, mergeConfig };
7
+ export { defineConfig, mergeConfig };
@@ -1,5 +1,4 @@
1
- import { s as resolveComma, u as toArray } from "./general-1LELSDyN.mjs";
2
-
1
+ import { s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
3
2
  //#region src/features/css/index.ts
4
3
  const defaultCssBundleName = "style.css";
5
4
  function resolveCssOptions(options = {}, topLevelTarget) {
@@ -10,7 +9,7 @@ function resolveCssOptions(options = {}, topLevelTarget) {
10
9
  return {
11
10
  transformer: options.transformer ?? "lightningcss",
12
11
  splitting: options.splitting ?? false,
13
- fileName: options.fileName ?? defaultCssBundleName,
12
+ fileName: options.fileName ?? "style.css",
14
13
  minify: options.minify ?? false,
15
14
  target: cssTarget,
16
15
  preprocessorOptions: options.preprocessorOptions,
@@ -18,6 +17,5 @@ function resolveCssOptions(options = {}, topLevelTarget) {
18
17
  postcss: options.postcss
19
18
  };
20
19
  }
21
-
22
20
  //#endregion
23
- export { resolveCssOptions as n, defaultCssBundleName as t };
21
+ export { resolveCssOptions as n, defaultCssBundleName as t };
package/dist/css.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { n as resolveCssOptions, t as defaultCssBundleName } from "./css-CXFxHD51.mjs";
2
- import { a as removePureCssChunks, i as getEmptyChunkReplacer, n as RE_CSS, r as createCssPostHooks } from "./plugin-DbgcY9Q9.mjs";
3
-
4
- export { RE_CSS, createCssPostHooks, defaultCssBundleName, getEmptyChunkReplacer, removePureCssChunks, resolveCssOptions };
1
+ import { n as resolveCssOptions, t as defaultCssBundleName } from "./css-CzF_A79W.mjs";
2
+ import { a as removePureCssChunks, i as getEmptyChunkReplacer, n as RE_CSS, r as createCssPostHooks } from "./plugin-BQv869Ce.mjs";
3
+ export { RE_CSS, createCssPostHooks, defaultCssBundleName, getEmptyChunkReplacer, removePureCssChunks, resolveCssOptions };
@@ -1,6 +1,5 @@
1
- import { s as resolveComma, u as toArray } from "./general-1LELSDyN.mjs";
1
+ import { s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
2
2
  import { createDebug, enable, namespaces } from "obug";
3
-
4
3
  //#region src/features/debug.ts
5
4
  const debugLog = createDebug("tsdown:debug");
6
5
  function enableDebug(debug) {
@@ -13,6 +12,5 @@ function enableDebug(debug) {
13
12
  enable(namespace);
14
13
  debugLog("Debugging enabled", namespace);
15
14
  }
16
-
17
15
  //#endregion
18
- export { enableDebug as t };
16
+ export { enableDebug as t };
@@ -1,7 +1,6 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
-
5
4
  //#region node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/constants.mjs
6
5
  const AGENTS = [
7
6
  "npm",
@@ -33,7 +32,6 @@ const INSTALL_METADATA = {
33
32
  "bun.lock": "bun",
34
33
  "bun.lockb": "bun"
35
34
  };
36
-
37
35
  //#endregion
38
36
  //#region node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/detect.mjs
39
37
  async function pathExists(path2, type) {
@@ -163,6 +161,5 @@ async function handlePackageManager(filepath, options) {
163
161
  function isMetadataYarnClassic(metadataPath) {
164
162
  return metadataPath.endsWith(".yarn_integrity");
165
163
  }
166
-
167
164
  //#endregion
168
- export { detect, getUserAgent };
165
+ export { detect, getUserAgent };
@@ -1,4 +1,4 @@
1
- import { c as resolveRegex, l as slash, r as matchPattern, u as toArray } from "./general-1LELSDyN.mjs";
1
+ import { c as resolveRegex, l as slash, r as matchPattern, u as toArray } from "./general-CRszZCrY.mjs";
2
2
  import { isBuiltin } from "node:module";
3
3
  import { access, cp, readFile, rm, stat } from "node:fs/promises";
4
4
  import path from "node:path";
@@ -6,7 +6,6 @@ import { blue, underline, yellow } from "ansis";
6
6
  import { createDebug } from "obug";
7
7
  import { RE_DTS, RE_NODE_MODULES } from "rolldown-plugin-dts/filename";
8
8
  import { and, id, importerId, include } from "rolldown/filter";
9
-
10
9
  //#region src/utils/fs.ts
11
10
  function fsExists(path) {
12
11
  return access(path).then(() => true, () => false);
@@ -49,7 +48,6 @@ function stripExtname(filePath) {
49
48
  if (!ext.length) return filePath;
50
49
  return filePath.slice(0, -ext.length);
51
50
  }
52
-
53
51
  //#endregion
54
52
  //#region src/features/shims.ts
55
53
  const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
@@ -59,7 +57,6 @@ function getShimsInject(format, platform) {
59
57
  __filename: [shimFile, "__filename"]
60
58
  };
61
59
  }
62
-
63
60
  //#endregion
64
61
  //#region src/features/deps.ts
65
62
  const debug = createDebug("tsdown:dep");
@@ -189,7 +186,6 @@ function DepPlugin({ pkg, deps: { alwaysBundle, onlyAllowBundle, skipNodeModules
189
186
  function getProductionDeps(pkg) {
190
187
  return new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]);
191
188
  }
192
-
193
189
  //#endregion
194
190
  //#region src/utils/format.ts
195
191
  function formatBytes(bytes) {
@@ -207,6 +203,5 @@ function detectIndentation(jsonText) {
207
203
  }
208
204
  return 2;
209
205
  }
210
-
211
206
  //#endregion
212
- export { getShimsInject as a, fsRemove as c, stripExtname as d, resolveDepsConfig as i, fsStat as l, formatBytes as n, fsCopy as o, DepPlugin as r, fsExists as s, detectIndentation as t, lowestCommonAncestor as u };
207
+ export { getShimsInject as a, fsRemove as c, stripExtname as d, resolveDepsConfig as i, fsStat as l, formatBytes as n, fsCopy as o, DepPlugin as r, fsExists as s, detectIndentation as t, lowestCommonAncestor as u };
@@ -3,10 +3,8 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
3
3
  import { createRequire } from "node:module";
4
4
  import { pathToFileURL } from "node:url";
5
5
  const picomatch = __cjs_require("picomatch");
6
-
7
6
  //#region \0rolldown/runtime.js
8
7
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
9
-
10
8
  //#endregion
11
9
  //#region src/utils/general.ts
12
10
  function toArray(val, defaultValue) {
@@ -70,6 +68,5 @@ function debounce(fn, delay) {
70
68
  debounced.cancel = () => clearTimeout(timer);
71
69
  return debounced;
72
70
  }
73
-
74
71
  //#endregion
75
- export { pkgExists as a, resolveRegex as c, noop as i, slash as l, importWithError as n, promiseWithResolvers as o, matchPattern as r, resolveComma as s, debounce as t, toArray as u };
72
+ export { pkgExists as a, resolveRegex as c, noop as i, slash as l, importWithError as n, promiseWithResolvers as o, matchPattern as r, resolveComma as s, debounce as t, toArray as u };
@@ -4,7 +4,6 @@ import os from "node:os";
4
4
  import util from "node:util";
5
5
  import zlib from "node:zlib";
6
6
  import cp$1 from "node:child_process";
7
-
8
7
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/pack.js
9
8
  /** @type {import('../index.d.ts').pack} */
10
9
  async function pack(dir, opts) {
@@ -40,7 +39,6 @@ async function pack(dir, opts) {
40
39
  else throw new Error(`Failed to find packed tarball file in ${packDestination}. Command output:\n${JSON.stringify(output, null, 2)}`);
41
40
  return path.join(packDestination, tarballFile);
42
41
  }
43
-
44
42
  //#endregion
45
43
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/utils.js
46
44
  async function getTempPackDir() {
@@ -48,7 +46,6 @@ async function getTempPackDir() {
48
46
  const tempPackDir = await fs.mkdtemp(tempDir + "publint-pack-");
49
47
  return await fs.realpath(tempPackDir);
50
48
  }
51
-
52
49
  //#endregion
53
50
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/pack-as-json.js
54
51
  /** @type {import('../index.d.ts').packAsJson} */
@@ -105,7 +102,6 @@ function fixYarnStdout(stdout) {
105
102
  fixedStdout += "]";
106
103
  return fixedStdout;
107
104
  }
108
-
109
105
  //#endregion
110
106
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/shared/buffer-stream.js
111
107
  /**
@@ -115,7 +111,6 @@ function fixYarnStdout(stdout) {
115
111
  async function readableStreamToArrayBuffer(readableStream) {
116
112
  return await new Response(readableStream).arrayBuffer();
117
113
  }
118
-
119
114
  //#endregion
120
115
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/shared/parse-tar.js
121
116
  /**
@@ -159,7 +154,6 @@ function read(buffer, decoder, offset, length) {
159
154
  function getFilesRootDir(files) {
160
155
  return files.length ? files[0].name.split("/")[0] : "package";
161
156
  }
162
-
163
157
  //#endregion
164
158
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/unpack.js
165
159
  /** @type {import('../index.d.ts').unpack} */
@@ -177,7 +171,6 @@ async function unpack(tarball) {
177
171
  rootDir: getFilesRootDir(files)
178
172
  };
179
173
  }
180
-
181
174
  //#endregion
182
175
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/pack-as-list.js
183
176
  /** @type {import('../index.d.ts').packAsList} */
@@ -255,7 +248,6 @@ function parseYarnPackJson(stdoutJson) {
255
248
  function parsePnpmPackJson(stdoutJson) {
256
249
  return stdoutJson.files.map((file) => file.path);
257
250
  }
258
-
259
251
  //#endregion
260
252
  //#region node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/get-pack-directory.js
261
253
  /** @type {import('../index.d.ts').getPackDirectory} */
@@ -267,6 +259,5 @@ async function getPackDirectory(dir, packageManager) {
267
259
  } catch {}
268
260
  return dir;
269
261
  }
270
-
271
262
  //#endregion
272
- export { getPackDirectory, pack, packAsJson, packAsList, unpack };
263
+ export { getPackDirectory, pack, packAsJson, packAsList, unpack };
package/dist/index.mjs CHANGED
@@ -1,8 +1,7 @@
1
- import { r as resolveUserConfig, t as mergeConfig } from "./options-0OT_k09H.mjs";
2
- import { a as globalLogger } from "./logger-C4Xhh0rW.mjs";
1
+ import { r as resolveUserConfig, t as mergeConfig } from "./options-DpJJmGDp.mjs";
2
+ import { a as globalLogger } from "./logger-BU0v7CAk.mjs";
3
3
  import { defineConfig } from "./config.mjs";
4
- import { n as buildWithConfigs, t as build } from "./build-BTCN8l3e.mjs";
5
- import { t as enableDebug } from "./debug-DtUr55Vs.mjs";
4
+ import { n as buildWithConfigs, t as build } from "./build-TmLngPCw.mjs";
5
+ import { t as enableDebug } from "./debug-tOJ_PtrM.mjs";
6
6
  import * as Rolldown from "rolldown";
7
-
8
- export { Rolldown, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig };
7
+ export { Rolldown, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig };
@@ -1,8 +1,7 @@
1
- import { i as noop } from "./general-1LELSDyN.mjs";
1
+ import { i as noop } from "./general-CRszZCrY.mjs";
2
2
  import process from "node:process";
3
3
  import { bgRed, bgYellow, blue, green, rgb, yellow } from "ansis";
4
4
  import readline from "node:readline";
5
-
6
5
  //#region src/utils/logger.ts
7
6
  const LogLevels = {
8
7
  silent: 0,
@@ -126,6 +125,5 @@ function hue2rgb(p, q, t) {
126
125
  if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
127
126
  return p;
128
127
  }
129
-
130
128
  //#endregion
131
- export { globalLogger as a, getNameLabel as i, createLogger as n, prettyFormat as o, generateColor as r, LogLevels as t };
129
+ export { globalLogger as a, getNameLabel as i, createLogger as n, prettyFormat as o, generateColor as r, LogLevels as t };
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __cjs_createRequire } from "node:module";
2
2
  const __cjs_require = __cjs_createRequire(import.meta.url);
3
- import { a as pkgExists, c as resolveRegex, l as slash, n as importWithError, r as matchPattern, s as resolveComma, u as toArray } from "./general-1LELSDyN.mjs";
4
- import { c as fsRemove, d as stripExtname, i as resolveDepsConfig, l as fsStat, n as formatBytes, s as fsExists, t as detectIndentation, u as lowestCommonAncestor } from "./format-DlhdOGIw.mjs";
5
- import { a as globalLogger, i as getNameLabel, n as createLogger, r as generateColor } from "./logger-C4Xhh0rW.mjs";
6
- import { n as resolveCssOptions } from "./css-CXFxHD51.mjs";
3
+ import { a as pkgExists, c as resolveRegex, l as slash, n as importWithError, r as matchPattern, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
4
+ import { c as fsRemove, d as stripExtname, i as resolveDepsConfig, l as fsStat, n as formatBytes, s as fsExists, t as detectIndentation, u as lowestCommonAncestor } from "./format-CM79ZE77.mjs";
5
+ import { a as globalLogger, i as getNameLabel, n as createLogger, r as generateColor } from "./logger-BU0v7CAk.mjs";
6
+ import { n as resolveCssOptions } from "./css-CzF_A79W.mjs";
7
7
  import { mkdtemp, readFile, writeFile } from "node:fs/promises";
8
8
  import path from "node:path";
9
9
  import process, { env } from "node:process";
@@ -23,11 +23,9 @@ import { up } from "empathic/find";
23
23
  import { up as up$1 } from "empathic/package";
24
24
  import { init, isSupported } from "import-without-cache";
25
25
  import { createConfigCoreLoader } from "unconfig-core";
26
-
27
26
  //#region node_modules/.pnpm/is-in-ci@2.0.0/node_modules/is-in-ci/index.js
28
27
  const check = (key) => key in env && env[key] !== "0" && env[key] !== "false";
29
28
  const isInCi = check("CI") || check("CONTINUOUS_INTEGRATION");
30
-
31
29
  //#endregion
32
30
  //#region src/features/clean.ts
33
31
  const debug$4 = createDebug("tsdown:clean");
@@ -67,7 +65,6 @@ async function cleanChunks(outDir, chunks) {
67
65
  await fsRemove(filePath);
68
66
  }));
69
67
  }
70
-
71
68
  //#endregion
72
69
  //#region src/features/entry.ts
73
70
  async function resolveEntry(logger, entry, cwd, color, nameLabel) {
@@ -135,7 +132,6 @@ async function resolveArrayEntry(entries, cwd) {
135
132
  }));
136
133
  return Object.assign({}, arrayEntryMap, ...await Promise.all(objectEntries.map((entry) => resolveObjectEntry(entry, cwd))));
137
134
  }
138
-
139
135
  //#endregion
140
136
  //#region src/features/exe.ts
141
137
  const debug$3 = createDebug("tsdown:exe");
@@ -222,7 +218,6 @@ async function buildSingleExe(config, bundledFile, outputFile, executable, targe
222
218
  }
223
219
  config.logger.success(config.nameLabel, `Built executable: ${red(path.relative(config.cwd, outputPath))}`, dim`(${Math.round(performance.now() - t)}ms)`);
224
220
  }
225
-
226
221
  //#endregion
227
222
  //#region src/features/pkg/exports.ts
228
223
  async function writeExports(options, chunks, inlinedDeps) {
@@ -382,7 +377,6 @@ function join(pkgRoot, outDir, fileName) {
382
377
  const outDirRelative = slash(path.relative(pkgRoot, outDir));
383
378
  return `${outDirRelative ? `./${outDirRelative}` : "."}/${fileName}`;
384
379
  }
385
-
386
380
  //#endregion
387
381
  //#region src/features/target.ts
388
382
  function resolveTarget(logger, target, color, pkg, nameLabel) {
@@ -405,7 +399,6 @@ function resolvePackageTarget(pkg) {
405
399
  if (nodeMinVersion.version === "0.0.0") return;
406
400
  return `node${nodeMinVersion.version}`;
407
401
  }
408
-
409
402
  //#endregion
410
403
  //#region src/features/tsconfig.ts
411
404
  function findTsconfig(cwd, name = "tsconfig.json") {
@@ -433,7 +426,6 @@ async function resolveTsconfig(logger, tsconfig, cwd, color, nameLabel) {
433
426
  }
434
427
  return tsconfig;
435
428
  }
436
-
437
429
  //#endregion
438
430
  //#region src/utils/package.ts
439
431
  const debug$2 = createDebug("tsdown:package");
@@ -463,7 +455,6 @@ function normalizeFormat(format) {
463
455
  default: return format;
464
456
  }
465
457
  }
466
-
467
458
  //#endregion
468
459
  //#region src/config/file.ts
469
460
  const debug$1 = createDebug("tsdown:config:file");
@@ -599,7 +590,6 @@ async function unrunImport(id) {
599
590
  const { module } = await unrun({ path: pathToFileURL(id).href });
600
591
  return module;
601
592
  }
602
-
603
593
  //#endregion
604
594
  //#region src/config/options.ts
605
595
  const debug = createDebug("tsdown:config:options");
@@ -782,6 +772,5 @@ function filterConfig(filter, configCwd, name) {
782
772
  if (filter instanceof RegExp) return name && filter.test(name) || filter.test(cwd);
783
773
  return toArray(filter).some((value) => name && name === value || cwd === value);
784
774
  }
785
-
786
775
  //#endregion
787
- export { getPackageType as a, isGlobEntry as c, cleanOutDir as d, loadConfigFile as i, toObjectEntry as l, mergeUserOptions as n, writeExports as o, resolveUserConfig as r, buildExe as s, mergeConfig as t, cleanChunks as u };
776
+ export { getPackageType as a, isGlobEntry as c, cleanOutDir as d, loadConfigFile as i, toObjectEntry as l, mergeUserOptions as n, writeExports as o, resolveUserConfig as r, buildExe as s, mergeConfig as t, cleanChunks as u };
@@ -0,0 +1,4 @@
1
+ //#region package.json
2
+ var version = "0.21.0";
3
+ //#endregion
4
+ export { version as t };
@@ -1,7 +1,6 @@
1
- import { t as defaultCssBundleName } from "./css-CXFxHD51.mjs";
1
+ import { t as defaultCssBundleName } from "./css-CzF_A79W.mjs";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
-
5
4
  //#region src/features/css/pure-chunk.ts
6
5
  /**
7
6
  * Detect and remove "pure CSS chunks" — JS chunks that exist only because
@@ -12,7 +11,6 @@ function removePureCssChunks(bundle, styles) {
12
11
  const pureCssChunkNames = [];
13
12
  for (const [fileName, chunk] of Object.entries(bundle)) {
14
13
  if (chunk.type !== "chunk") continue;
15
- if (chunk.isEntry) continue;
16
14
  if (chunk.exports.length > 0) continue;
17
15
  const moduleIds = Object.keys(chunk.modules);
18
16
  if (moduleIds.length === 0) continue;
@@ -53,7 +51,6 @@ function getEmptyChunkReplacer(pureCssChunkNames) {
53
51
  function escapeRegex(str) {
54
52
  return str.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
55
53
  }
56
-
57
54
  //#endregion
58
55
  //#region src/features/css/post.ts
59
56
  function createCssPostHooks(config, styles) {
@@ -91,7 +88,6 @@ function createCssPostHooks(config, styles) {
91
88
  }
92
89
  };
93
90
  }
94
-
95
91
  //#endregion
96
92
  //#region src/features/css/plugin.ts
97
93
  const RE_CSS = /\.css(?:$|\?)/;
@@ -119,6 +115,5 @@ function CssPlugin(config) {
119
115
  ...postHooks
120
116
  };
121
117
  }
122
-
123
118
  //#endregion
124
- export { removePureCssChunks as a, getEmptyChunkReplacer as i, RE_CSS as n, createCssPostHooks as r, CssPlugin as t };
119
+ export { removePureCssChunks as a, getEmptyChunkReplacer as i, RE_CSS as n, createCssPostHooks as r, CssPlugin as t };
package/dist/plugins.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { r as DepPlugin } from "./format-DlhdOGIw.mjs";
2
- import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-DoBIgnx3.mjs";
3
-
4
- export { DepPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
1
+ import { r as DepPlugin } from "./format-CM79ZE77.mjs";
2
+ import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-BAbxxJcJ.mjs";
3
+ export { DepPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
package/dist/run.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cjs_createRequire } from "node:module";
3
3
  const __cjs_require = __cjs_createRequire(import.meta.url);
4
- import { a as globalLogger } from "./logger-C4Xhh0rW.mjs";
5
- import { t as version } from "./package-yo2Hto7o.mjs";
6
- import { t as enableDebug } from "./debug-DtUr55Vs.mjs";
4
+ import { a as globalLogger } from "./logger-BU0v7CAk.mjs";
5
+ import { t as version } from "./package-BzvC5Wbf.mjs";
6
+ import { t as enableDebug } from "./debug-tOJ_PtrM.mjs";
7
7
  import module from "node:module";
8
8
  import process from "node:process";
9
9
  import { dim, yellow } from "ansis";
@@ -11,7 +11,6 @@ import { x } from "tinyexec";
11
11
  import { VERSION } from "rolldown";
12
12
  const lt = __cjs_require("semver/functions/lt.js");
13
13
  import { cac } from "cac";
14
-
15
14
  //#region src/cli.ts
16
15
  const cli = cac("tsdown");
17
16
  cli.help().version(version);
@@ -21,7 +20,7 @@ cli.command("[...files]", "Bundle files", {
21
20
  }).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--deps.never-bundle <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--devtools", "Enable devtools integration").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).option("--no-write", "Disable writing files to disk, incompatible with watch mode").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("--attw", "Enable Are the types wrong integration", { 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("--env-file <file>", "Load environment variables from a file, when used together with --env, variables in --env take precedence").option("--env-prefix <prefix>", "Prefix for env variables to inject into the bundle", { default: "TSDOWN_" }).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("--unbundle", "Unbundle mode").option("--exe", "Bundle as executable").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter configs (cwd or name), e.g. /pkg-name$/ or pkg-name").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
22
21
  globalLogger.level = flags.logLevel || "info";
23
22
  globalLogger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
24
- const { build } = await import("./build-B0_dhbwq.mjs");
23
+ const { build } = await import("./build-gOkJM1H9.mjs");
25
24
  if (input.length > 0) flags.entry = input;
26
25
  await build(flags);
27
26
  });
@@ -53,7 +52,6 @@ async function runCLI() {
53
52
  process.exit(1);
54
53
  }
55
54
  }
56
-
57
55
  //#endregion
58
56
  //#region src/run.ts
59
57
  if (lt(process.version, "22.18.0")) console.warn(yellow`[tsdown] Node.js ${process.version} is deprecated. Support will be removed in the next minor release. Please upgrade to Node.js 22.18.0 or later.`);
@@ -61,6 +59,5 @@ try {
61
59
  module.enableCompileCache?.();
62
60
  } catch {}
63
61
  runCLI();
64
-
65
62
  //#endregion
66
- export { };
63
+ export {};
@@ -1,6 +1,6 @@
1
- import { i as noop, s as resolveComma, u as toArray } from "./general-1LELSDyN.mjs";
2
- import { n as formatBytes, s as fsExists } from "./format-DlhdOGIw.mjs";
3
- import { o as prettyFormat } from "./logger-C4Xhh0rW.mjs";
1
+ import { i as noop, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
2
+ import { n as formatBytes, s as fsExists } from "./format-CM79ZE77.mjs";
3
+ import { o as prettyFormat } from "./logger-BU0v7CAk.mjs";
4
4
  import { builtinModules } from "node:module";
5
5
  import { chmod } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -10,7 +10,6 @@ import { RE_DTS } from "rolldown-plugin-dts/filename";
10
10
  import { promisify } from "node:util";
11
11
  import { Buffer } from "node:buffer";
12
12
  import { brotliCompress, gzip } from "node:zlib";
13
-
14
13
  //#region src/features/node-protocol.ts
15
14
  /**
16
15
  * The `node:` protocol was added in Node.js v14.18.0.
@@ -42,7 +41,6 @@ function NodeProtocolPlugin(nodeProtocolOption) {
42
41
  }
43
42
  };
44
43
  }
45
-
46
44
  //#endregion
47
45
  //#region src/features/report.ts
48
46
  const debug = createDebug("tsdown:report");
@@ -128,7 +126,6 @@ async function calcSize(options, chunk) {
128
126
  brotliText: formatBytes(brotli)
129
127
  };
130
128
  }
131
-
132
129
  //#endregion
133
130
  //#region src/features/shebang.ts
134
131
  const RE_SHEBANG = /^#!.*/;
@@ -148,7 +145,6 @@ function ShebangPlugin(logger, cwd, nameLabel, isDualFormat) {
148
145
  }
149
146
  };
150
147
  }
151
-
152
148
  //#endregion
153
149
  //#region src/utils/chunks.ts
154
150
  function addOutDirToChunks(chunks, outDir) {
@@ -157,7 +153,6 @@ function addOutDirToChunks(chunks, outDir) {
157
153
  return chunk;
158
154
  });
159
155
  }
160
-
161
156
  //#endregion
162
157
  //#region src/features/watch.ts
163
158
  const endsWithConfig = /[\\/](?:tsdown\.config.*|package\.json|tsconfig\.json)$/;
@@ -183,6 +178,5 @@ function WatchPlugin(configFiles, { config, chunks }) {
183
178
  }
184
179
  };
185
180
  }
186
-
187
181
  //#endregion
188
- export { ReportPlugin as a, ShebangPlugin as i, endsWithConfig as n, NodeProtocolPlugin as o, addOutDirToChunks as r, WatchPlugin as t };
182
+ export { ReportPlugin as a, ShebangPlugin as i, endsWithConfig as n, NodeProtocolPlugin as o, addOutDirToChunks as r, WatchPlugin as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tsdown",
3
3
  "type": "module",
4
- "version": "0.21.0-beta.5",
4
+ "version": "0.21.0",
5
5
  "description": "The Elegant Bundler for Libraries",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -52,8 +52,8 @@
52
52
  "publint": "^0.3.0",
53
53
  "typescript": "^5.0.0",
54
54
  "unplugin-unused": "^0.5.0",
55
- "@tsdown/css": "0.21.0-beta.5",
56
- "@tsdown/exe": "0.21.0-beta.5"
55
+ "@tsdown/exe": "0.21.0",
56
+ "@tsdown/css": "0.21.0"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@arethetypeswrong/core": {
@@ -87,7 +87,7 @@
87
87
  "import-without-cache": "^0.2.5",
88
88
  "obug": "^2.1.1",
89
89
  "picomatch": "^4.0.3",
90
- "rolldown": "1.0.0-rc.6",
90
+ "rolldown": "1.0.0-rc.7",
91
91
  "rolldown-plugin-dts": "^0.22.3",
92
92
  "semver": "^7.7.4",
93
93
  "tinyexec": "^1.0.2",
@@ -121,7 +121,7 @@
121
121
  "dedent": "^1.7.2",
122
122
  "eslint": "^10.0.2",
123
123
  "is-in-ci": "^2.0.0",
124
- "memfs": "^4.56.10",
124
+ "memfs": "^4.56.11",
125
125
  "package-manager-detector": "^1.6.0",
126
126
  "pkg-types": "^2.3.0",
127
127
  "postcss": "^8.5.8",
@@ -136,8 +136,8 @@
136
136
  "unplugin-unused": "^0.5.7",
137
137
  "vite": "^8.0.0-beta.15",
138
138
  "vitest": "^4.0.18",
139
- "@tsdown/css": "0.21.0-beta.5",
140
- "@tsdown/exe": "0.21.0-beta.5"
139
+ "@tsdown/css": "0.21.0",
140
+ "@tsdown/exe": "0.21.0"
141
141
  },
142
142
  "prettier": "@sxzz/prettier-config",
143
143
  "scripts": {
@@ -1,3 +0,0 @@
1
- import { n as buildWithConfigs, t as build } from "./build-BTCN8l3e.mjs";
2
-
3
- export { build };
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.21.0-beta.5";
3
-
4
- //#endregion
5
- export { version as t };