tsdown 0.19.0-beta.1 → 0.19.0-beta.2

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 { f as UserConfig, i as InlineConfig, m as UserConfigFn, p as UserConfigExport } from "./index-CIxE8YXE.mjs";
1
+ import { f as UserConfig, i as InlineConfig, m as UserConfigFn, p as UserConfigExport } from "./index-CMl71wtM.mjs";
2
2
 
3
3
  //#region src/config/options.d.ts
4
4
  declare function mergeConfig(defaults: UserConfig, overrides: UserConfig): UserConfig;
@@ -305,13 +305,14 @@ async function generateExports(pkg, chunks, options) {
305
305
  legacy ??= !isPureESM;
306
306
  for (const [format, chunksByFormat] of Object.entries(chunks)) {
307
307
  if (format !== "es" && format !== "cjs") continue;
308
- const filteredChunks = chunksByFormat.filter((chunk) => chunk.type === "chunk" && chunk.isEntry && !shouldExclude(chunk.fileName, exclude));
308
+ const filteredChunks = chunksByFormat.filter((chunk) => {
309
+ if (chunk.type !== "chunk" || !chunk.isEntry) return false;
310
+ const [name] = getExportName(chunk);
311
+ return !shouldExclude(name, exclude);
312
+ });
309
313
  const onlyOneEntry = filteredChunks.filter((chunk) => !RE_DTS.test(chunk.fileName)).length === 1;
310
314
  for (const chunk of filteredChunks) {
311
- const normalizedName = slash(chunk.fileName);
312
- let name = stripExtname(normalizedName);
313
- const isDts = name.endsWith(".d");
314
- if (isDts) name = name.slice(0, -2);
315
+ let [name, normalizedName, isDts] = getExportName(chunk);
315
316
  const isIndex = onlyOneEntry || name === "index";
316
317
  const distFile = join$1(pkgRoot, chunk.outDir, normalizedName);
317
318
  if (isIndex) {
@@ -359,7 +360,7 @@ async function generateExports(pkg, chunks, options) {
359
360
  return {
360
361
  main: legacy ? main || module || pkg.main : void 0,
361
362
  module: legacy ? module || pkg.module : void 0,
362
- types: cjsTypes || esmTypes || pkg.types,
363
+ types: legacy ? cjsTypes || esmTypes || pkg.types : pkg.types,
363
364
  exports,
364
365
  publishExports
365
366
  };
@@ -401,6 +402,17 @@ function hasExportsTypes(pkg) {
401
402
  }
402
403
  return false;
403
404
  }
405
+ function getExportName(chunk) {
406
+ const normalizedName = slash(chunk.fileName);
407
+ let name = stripExtname(normalizedName);
408
+ const isDts = name.endsWith(".d");
409
+ if (isDts) name = name.slice(0, -2);
410
+ return [
411
+ name,
412
+ normalizedName,
413
+ isDts
414
+ ];
415
+ }
404
416
  function join$1(pkgRoot, outDir, fileName) {
405
417
  const outDirRelative = slash(path.relative(pkgRoot, outDir));
406
418
  return `${outDirRelative ? `./${outDirRelative}` : "."}/${fileName}`;
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-CIxE8YXE.mjs";
2
- import { n as mergeConfig, t as defineConfig } from "./config-FSGZ1pUf.mjs";
1
+ import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-CMl71wtM.mjs";
2
+ import { n as mergeConfig, t as defineConfig } from "./config-C2C2OcsY.mjs";
3
3
  export { UserConfig, UserConfigExport, UserConfigFn, defineConfig, mergeConfig };
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./logger-D_2uXZBG.mjs";
2
- import { n as mergeConfig, t as defineConfig } from "./config-qNEP9juZ.mjs";
2
+ import { n as mergeConfig, t as defineConfig } from "./config-CQ0WjrHu.mjs";
3
3
 
4
4
  export { defineConfig, mergeConfig };
@@ -516,14 +516,13 @@ interface ExportsOptions {
516
516
  */
517
517
  all?: boolean;
518
518
  /**
519
- * Define globs or RegExp patterns to exclude files from exports.
520
- * This is useful for excluding files that should not be part of the package exports,
521
- * such as bin files or internal utilities.
519
+ * Specifies file patterns (as glob patterns or regular expressions) to exclude from package exports.
520
+ * Use this to prevent certain files from being included in the exported package, such as test files, binaries, or internal utilities.
521
+ *
522
+ * **Note:** Do not include file extensions, and paths should be relative to the dist directory.
522
523
  *
523
524
  * @example
524
- * ```js
525
- * exclude: ['**\/*.test.ts', '**\/*.spec.ts', /internal/]
526
- * ```
525
+ * exclude: ['cli', '**\/*.test', /internal/]
527
526
  */
528
527
  exclude?: (RegExp | string)[];
529
528
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as OutExtensionFactory, B as CopyOptions, C as RolldownChunk, D as ChunkAddonFunction, E as ChunkAddon, F as RolldownContext, I as TsdownHooks, L as DevtoolsOptions, M as PackageJsonWithPath, N as PackageType, O as ChunkAddonObject, P as BuildContext, R as CssOptions, S as ExportsOptions, T as AttwOptions, V as CopyOptionsFn, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as Sourcemap, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as OutExtensionObject, k as OutExtensionContext, l as TreeshakingOptions, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as ResolvedConfig, t as CIOption, u as TsdownInputOption, w as TsdownBundle, x as PublintOptions, y as Logger, z as CopyEntry } from "./index-CIxE8YXE.mjs";
2
- import { n as mergeConfig, t as defineConfig } from "./config-FSGZ1pUf.mjs";
1
+ import { A as OutExtensionFactory, B as CopyOptions, C as RolldownChunk, D as ChunkAddonFunction, E as ChunkAddon, F as RolldownContext, I as TsdownHooks, L as DevtoolsOptions, M as PackageJsonWithPath, N as PackageType, O as ChunkAddonObject, P as BuildContext, R as CssOptions, S as ExportsOptions, T as AttwOptions, V as CopyOptionsFn, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as Sourcemap, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as OutExtensionObject, k as OutExtensionContext, l as TreeshakingOptions, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as ResolvedConfig, t as CIOption, u as TsdownInputOption, w as TsdownBundle, x as PublintOptions, y as Logger, z as CopyEntry } from "./index-CMl71wtM.mjs";
2
+ import { n as mergeConfig, t as defineConfig } from "./config-C2C2OcsY.mjs";
3
3
  import * as Rolldown from "rolldown";
4
4
 
5
5
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as globalLogger } from "./logger-D_2uXZBG.mjs";
2
- import { n as mergeConfig, t as defineConfig } from "./config-qNEP9juZ.mjs";
3
- import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-BjKgxr08.mjs";
2
+ import { n as mergeConfig, t as defineConfig } from "./config-CQ0WjrHu.mjs";
3
+ import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-DhBpfeQw.mjs";
4
4
 
5
5
  export { Rolldown, build, buildSingle, defineConfig, globalLogger, mergeConfig, shimFile };
@@ -0,0 +1,5 @@
1
+ //#region package.json
2
+ var version = "0.19.0-beta.2";
3
+
4
+ //#endregion
5
+ export { version as t };
@@ -1,4 +1,4 @@
1
- import { s as ResolvedConfig, v as ReportPlugin, w as TsdownBundle, y as Logger } from "./index-CIxE8YXE.mjs";
1
+ import { s as ResolvedConfig, v as ReportPlugin, w as TsdownBundle, y as Logger } from "./index-CMl71wtM.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
 
4
4
  //#region src/features/external.d.ts
package/dist/plugins.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./logger-D_2uXZBG.mjs";
2
- import "./config-qNEP9juZ.mjs";
3
- import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-BjKgxr08.mjs";
2
+ import "./config-CQ0WjrHu.mjs";
3
+ import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-DhBpfeQw.mjs";
4
4
 
5
5
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
package/dist/run.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as globalLogger, f as resolveComma, h as toArray } from "./logger-D_2uXZBG.mjs";
3
- import { t as version } from "./package-qmfxt6gc.mjs";
3
+ import { t as version } from "./package-PFFWH-Jh.mjs";
4
4
  import module from "node:module";
5
5
  import process from "node:process";
6
6
  import { dim } from "ansis";
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __cjs_createRequire } from "node:module";
2
2
  const __cjs_require = __cjs_createRequire(import.meta.url);
3
3
  import { a as globalLogger, c as matchPattern, d as promiseWithResolvers, f as resolveComma, h as toArray, l as noop, m as slash, o as prettyFormat, s as importWithError, t as LogLevels } from "./logger-D_2uXZBG.mjs";
4
- import { a as loadConfigFile, c as formatBytes, d as cleanOutDir, f as fsCopy, h as lowestCommonAncestor, i as resolveUserConfig, l as CssCodeSplitPlugin, m as fsRemove, o as getPackageType, p as fsExists, r as mergeUserOptions, s as writeExports, u as cleanChunks } from "./config-qNEP9juZ.mjs";
5
- import { t as version } from "./package-qmfxt6gc.mjs";
4
+ import { a as loadConfigFile, c as formatBytes, d as cleanOutDir, f as fsCopy, h as lowestCommonAncestor, i as resolveUserConfig, l as CssCodeSplitPlugin, m as fsRemove, o as getPackageType, p as fsExists, r as mergeUserOptions, s as writeExports, u as cleanChunks } from "./config-CQ0WjrHu.mjs";
5
+ import { t as version } from "./package-PFFWH-Jh.mjs";
6
6
  import { builtinModules, isBuiltin } from "node:module";
7
7
  import { chmod, mkdtemp, readFile, writeFile } from "node:fs/promises";
8
8
  import path, { join } from "node:path";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tsdown",
3
3
  "type": "module",
4
- "version": "0.19.0-beta.1",
4
+ "version": "0.19.0-beta.2",
5
5
  "description": "The Elegant Bundler for Libraries",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.19.0-beta.1";
3
-
4
- //#endregion
5
- export { version as t };