tsdown 0.17.0-beta.6 → 0.17.1

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.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { A as OutExtensionObject, C as TsdownBundle, D as ChunkAddonObject, E as ChunkAddonFunction, F as TsdownHooks, I as DebugOptions, L as CopyEntry, M as PackageType, N as BuildContext, O as OutExtensionContext, P as RolldownContext, R as CopyOptions, S as RolldownChunk, T as ChunkAddon, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as ResolvedConfig, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as PackageJsonWithPath, k as OutExtensionFactory, l as Sourcemap, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as PublintOptions, t as CIOption, u as TreeshakingOptions, w as AttwOptions, x as ExportsOptions, y as Logger, z as CopyOptionsFn } from "./index-BQZ2CZuJ.mjs";
2
2
  import { t as defineConfig } from "./config-DPU-roRC.mjs";
3
+ import * as Rolldown from "rolldown";
3
4
 
4
5
  //#region src/index.d.ts
5
-
6
6
  /**
7
7
  * Build with tsdown.
8
8
  */
@@ -19,4 +19,4 @@ declare function buildSingle(config: ResolvedConfig, configFiles: string[], isDu
19
19
  /** @internal */
20
20
  declare const shimFile: string;
21
21
  //#endregion
22
- export { AttwOptions, BuildContext, CIOption, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DebugOptions, DtsOptions, ExportsOptions, Format, InlineConfig, type Logger, NoExternalFn, NormalizedFormat, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageJsonWithPath, PackageType, PublintOptions, ReportOptions, ResolvedConfig, RolldownChunk, RolldownContext, Sourcemap, TreeshakingOptions, TsdownBundle, TsdownHooks, UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, WithEnabled, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
22
+ export { AttwOptions, BuildContext, CIOption, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DebugOptions, DtsOptions, ExportsOptions, Format, InlineConfig, type Logger, NoExternalFn, NormalizedFormat, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageJsonWithPath, PackageType, PublintOptions, ReportOptions, ResolvedConfig, Rolldown, RolldownChunk, RolldownContext, Sourcemap, TreeshakingOptions, TsdownBundle, TsdownHooks, UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, WithEnabled, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
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-9i07TsDd.mjs";
3
- import { a as globalLogger } from "./package-ByEiRv2l.mjs";
2
+ import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-78jOn3e-.mjs";
3
+ import { a as globalLogger } from "./package-Bc4LTP6j.mjs";
4
4
 
5
- export { build, buildSingle, defineConfig, globalLogger, shimFile };
5
+ export { Rolldown, build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -161,7 +161,7 @@ function hue2rgb(p, q, t) {
161
161
 
162
162
  //#endregion
163
163
  //#region package.json
164
- var version = "0.17.0-beta.6";
164
+ var version = "0.17.1";
165
165
 
166
166
  //#endregion
167
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 };
package/dist/plugins.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ShebangPlugin, c as ExternalPlugin, i as WatchPlugin, o as ReportPlugin, s as NodeProtocolPlugin } from "./src-9i07TsDd.mjs";
2
- import "./package-ByEiRv2l.mjs";
1
+ import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-78jOn3e-.mjs";
2
+ import "./package-Bc4LTP6j.mjs";
3
3
 
4
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-ByEiRv2l.mjs";
2
+ import { a as globalLogger, g as toArray, p as resolveComma, t as version } from "./package-Bc4LTP6j.mjs";
3
3
  import module from "node:module";
4
4
  import { dim } from "ansis";
5
5
  import { VERSION } from "rolldown";
@@ -1,11 +1,12 @@
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-ByEiRv2l.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-Bc4LTP6j.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";
7
7
  import { blue, bold, dim, green, underline } from "ansis";
8
8
  import { clearRequireCache, init, isSupported } from "import-without-cache";
9
+ import * as Rolldown from "rolldown";
9
10
  import { VERSION, build, watch } from "rolldown";
10
11
  import { createDebug } from "obug";
11
12
  import { access, chmod, cp, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
@@ -238,7 +239,7 @@ function resolveClean(clean, outDir, cwd) {
238
239
  if (clean.some((item) => path.resolve(item) === cwd)) throw new Error("Cannot clean the current working directory. Please specify a different path to clean option.");
239
240
  return clean;
240
241
  }
241
- async function cleanupChunks(outDir, chunks) {
242
+ async function cleanChunks(outDir, chunks) {
242
243
  await Promise.all(chunks.map(async (chunk) => {
243
244
  const filePath = path.resolve(outDir, chunk.fileName);
244
245
  debug$8("Removing chunk file", filePath);
@@ -739,16 +740,16 @@ function warnLegacyCJS(config) {
739
740
  //#region src/features/copy.ts
740
741
  async function copy(options) {
741
742
  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);
743
+ const resolved = toArray(typeof options.copy === "function" ? await options.copy(options) : options.copy).map((dir) => {
744
+ const from = path.resolve(options.cwd, typeof dir === "string" ? dir : dir.from);
745
+ return [from, typeof dir === "string" ? path.resolve(options.outDir, path.basename(from)) : path.resolve(options.cwd, dir.to)];
746
+ });
747
+ const name = prettyName(options.name);
748
+ await Promise.all(resolved.map(([from, to]) => {
749
+ options.logger.info(name, `Copying files from ${path.relative(options.cwd, from)} to ${path.relative(options.cwd, to)}`);
750
+ return fsCopy(from, to);
747
751
  }));
748
752
  }
749
- function cp$1(cwd, from, to) {
750
- return fsCopy(path.resolve(cwd, from), path.resolve(cwd, to));
751
- }
752
753
 
753
754
  //#endregion
754
755
  //#region src/features/hooks.ts
@@ -1336,7 +1337,7 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
1336
1337
  }
1337
1338
  if (target) plugins.push(await LightningCSSPlugin({ target }));
1338
1339
  plugins.push(ShebangPlugin(logger, cwd, name, isDualFormat));
1339
- if (globImport) plugins.push(importGlobPlugin());
1340
+ if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
1340
1341
  }
1341
1342
  if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(report, logger, cwd, cjsDts, name, isDualFormat));
1342
1343
  if (watch$1) plugins.push(WatchPlugin(configFiles, bundle));
@@ -1576,7 +1577,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
1576
1577
  watcher$1.on("event", async (event) => {
1577
1578
  switch (event.code) {
1578
1579
  case "START":
1579
- await cleanupChunks(config.outDir, chunks);
1580
+ if (config.clean) await cleanChunks(config.outDir, chunks);
1580
1581
  chunks.length = 0;
1581
1582
  hasError = false;
1582
1583
  break;
@@ -1614,8 +1615,8 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
1614
1615
  return configs$1;
1615
1616
  }
1616
1617
  async function postBuild() {
1617
- if (updated) await copy(config);
1618
- else await done(bundle);
1618
+ await copy(config);
1619
+ if (!updated) await done(bundle);
1619
1620
  await hooks.callHook("build:done", {
1620
1621
  ...context,
1621
1622
  chunks
@@ -1631,4 +1632,4 @@ const pkgRoot = path.resolve(dirname$1, "..");
1631
1632
  const shimFile = path.resolve(pkgRoot, "esm-shims.js");
1632
1633
 
1633
1634
  //#endregion
1634
- export { ShebangPlugin as a, ExternalPlugin as c, WatchPlugin as i, buildSingle as n, ReportPlugin as o, shimFile as r, NodeProtocolPlugin as s, build$1 as t };
1635
+ export { WatchPlugin as a, NodeProtocolPlugin as c, shimFile as i, ExternalPlugin as l, build$1 as n, ShebangPlugin as o, buildSingle as r, ReportPlugin as s, Rolldown as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tsdown",
3
3
  "type": "module",
4
- "version": "0.17.0-beta.6",
4
+ "version": "0.17.1",
5
5
  "description": "The Elegant Bundler for Libraries",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@arethetypeswrong/core": "^0.18.1",
52
- "@vitejs/devtools": "^0.0.0-alpha.18",
52
+ "@vitejs/devtools": "^0.0.0-alpha.19",
53
53
  "publint": "^0.3.0",
54
54
  "typescript": "^5.0.0",
55
55
  "unplugin-lightningcss": "^0.4.0",
@@ -83,13 +83,13 @@
83
83
  "import-without-cache": "^0.2.2",
84
84
  "obug": "^2.1.1",
85
85
  "rolldown": "1.0.0-beta.53",
86
- "rolldown-plugin-dts": "^0.18.1",
86
+ "rolldown-plugin-dts": "^0.18.3",
87
87
  "semver": "^7.7.3",
88
88
  "tinyexec": "^1.0.2",
89
89
  "tinyglobby": "^0.2.15",
90
90
  "tree-kill": "^1.2.2",
91
- "unconfig-core": "^7.4.1",
92
- "unrun": "^0.2.16"
91
+ "unconfig-core": "^7.4.2",
92
+ "unrun": "^0.2.17"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@arethetypeswrong/core": "^0.18.2",
@@ -98,9 +98,9 @@
98
98
  "@sxzz/test-utils": "^0.5.13",
99
99
  "@types/node": "^24.10.1",
100
100
  "@types/semver": "^7.7.1",
101
- "@typescript/native-preview": "7.0.0-dev.20251203.1",
101
+ "@typescript/native-preview": "7.0.0-dev.20251207.1",
102
102
  "@unocss/eslint-plugin": "^66.5.10",
103
- "@vitejs/devtools": "^0.0.0-alpha.18",
103
+ "@vitejs/devtools": "^0.0.0-alpha.19",
104
104
  "@vitest/coverage-v8": "4.0.15",
105
105
  "@vueuse/core": "^14.1.0",
106
106
  "bumpp": "^10.3.2",
@@ -111,7 +111,7 @@
111
111
  "pkg-types": "^2.3.0",
112
112
  "prettier": "^3.7.4",
113
113
  "publint": "^0.3.15",
114
- "rolldown-plugin-require-cjs": "^0.3.2",
114
+ "rolldown-plugin-require-cjs": "^0.3.3",
115
115
  "typescript": "~5.9.3",
116
116
  "unocss": "^66.5.10",
117
117
  "unplugin-lightningcss": "^0.4.3",