tsdown 0.11.3 → 0.11.5

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 "./options-DTjUBBGw.js";
1
+ import { UserConfig, UserConfigFn } from "./options-BPeORY5t.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 "./options-DTjUBBGw.js";
2
- import { defineConfig$1 as defineConfig } from "./config-CTSjQDga.js";
1
+ import { UserConfig, UserConfigFn } from "./options-BPeORY5t.js";
2
+ import { defineConfig$1 as defineConfig } from "./config-DQE4wDWb.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 "./options-DTjUBBGw.js";
2
- import { defineConfig$1 as defineConfig } from "./config-CTSjQDga.js";
1
+ import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./options-BPeORY5t.js";
2
+ import { defineConfig$1 as defineConfig } from "./config-DQE4wDWb.js";
3
3
 
4
4
  //#region src/utils/logger.d.ts
5
5
  declare class Logger {
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineConfig } from "./config-yiJy1jd0.js";
2
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson } from "./plugins-BPU33dye.js";
2
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson } from "./plugins-CPt-D0Cs.js";
3
3
  import { debounce, resolveComma, slash, toArray } from "./general-CPYs4M61.js";
4
4
  import { logger } from "./logger-DYeY_1KP.js";
5
5
  import path from "node:path";
@@ -620,8 +620,9 @@ async function buildSingle(config, clean) {
620
620
  }
621
621
  }
622
622
  async function getBuildOptions(config, format, cjsDts) {
623
- const { entry, external, plugins: userPlugins, outDir, platform, alias, treeshake, sourcemap, dts, minify, unused, target, define, shims, tsconfig, cwd, report, env, removeNodeProtocol } = config;
623
+ const { entry, external, plugins: userPlugins, outDir, platform, alias, treeshake, sourcemap, dts, minify, unused, target, define, shims, tsconfig, cwd, report, env, removeNodeProtocol, loader } = config;
624
624
  const plugins = [];
625
+ if (removeNodeProtocol) plugins.push(NodeProtocolPlugin());
625
626
  if (config.pkg || config.skipNodeModulesBundle) plugins.push(ExternalPlugin(config));
626
627
  if (dts) {
627
628
  const { dts: dtsPlugin } = await import("rolldown-plugin-dts");
@@ -654,7 +655,6 @@ async function getBuildOptions(config, format, cjsDts) {
654
655
  await LightningCSSPlugin({ target })
655
656
  );
656
657
  plugins.push(userPlugins);
657
- if (removeNodeProtocol) plugins.push(NodeProtocolPlugin());
658
658
  const inputOptions = await mergeUserOptions({
659
659
  input: entry,
660
660
  cwd,
@@ -675,7 +675,8 @@ async function getBuildOptions(config, format, cjsDts) {
675
675
  }, Object.create(null))
676
676
  },
677
677
  plugins,
678
- inject: { ...shims && !cjsDts && getShimsInject(format, platform) }
678
+ inject: { ...shims && !cjsDts && getShimsInject(format, platform) },
679
+ moduleTypes: loader
679
680
  }, config.inputOptions, [format]);
680
681
  const [entryFileNames, chunkFileNames] = resolveChunkFilename(config, inputOptions, format);
681
682
  const outputOptions = await mergeUserOptions({
@@ -1,5 +1,5 @@
1
1
  import { logger } from "./logger-DYeY_1KP.js";
2
- import { version } from "./package-CSh-i54i.js";
2
+ import { version } from "./package-B9R2bt2m.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";
@@ -93,6 +93,7 @@ declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: bool
93
93
  type Sourcemap = boolean | "inline" | "hidden";
94
94
  type Format = Exclude<ModuleFormat, "experimental-app">;
95
95
  type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
96
+ type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
96
97
  /**
97
98
  * Options for tsdown.
98
99
  */
@@ -129,7 +130,7 @@ interface Options$3 {
129
130
  *
130
131
  * Accepts a single target (e.g., `'es2020'`, `'node18'`) or an array of targets.
131
132
  *
132
- * @see {@link https://tsdown.dev/guide/target#supported-targets} for a list of valid targets and more details.
133
+ * @see {@link https://tsdown.dev/options/target#supported-targets} for a list of valid targets and more details.
133
134
  *
134
135
  * @example
135
136
  * ```jsonc
@@ -257,13 +258,23 @@ interface Options$3 {
257
258
  * @default process.cwd()
258
259
  */
259
260
  cwd?: string;
261
+ /**
262
+ * Sets how input files are processed.
263
+ * For example, use 'js' to treat files as JavaScript or 'base64' for images.
264
+ * Lets you import or require files like images or fonts.
265
+ * @example
266
+ * ```json
267
+ * { '.jpg': 'asset', '.png': 'base64' }
268
+ * ```
269
+ */
270
+ loader?: ModuleTypes;
260
271
  }
261
272
  /**
262
273
  * Options without specifying config file path.
263
274
  */
264
275
  type UserConfig = Arrayable<Omit<Options$3, "config">>;
265
276
  type UserConfigFn = (cliOptions: Options$3) => Awaitable<UserConfig>;
266
- type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy">, {
277
+ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader">, {
267
278
  format: NormalizedFormat[];
268
279
  target?: string[];
269
280
  clean: string[];
@@ -0,0 +1,5 @@
1
+ //#region package.json
2
+ var version = "0.11.5";
3
+
4
+ //#endregion
5
+ export { version };
@@ -95,6 +95,7 @@ function NodeProtocolPlugin() {
95
95
  return {
96
96
  name: "tsdown:node-protocol",
97
97
  resolveId: {
98
+ order: "pre",
98
99
  filter: { id: /^node:/ },
99
100
  handler(id) {
100
101
  return {
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./options-DTjUBBGw.js";
1
+ import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./options-BPeORY5t.js";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
package/dist/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-BPU33dye.js";
1
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-CPt-D0Cs.js";
2
2
  import "./general-CPYs4M61.js";
3
3
  import "./logger-DYeY_1KP.js";
4
4
 
package/dist/run.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { resolveComma, toArray } from "./general-CPYs4M61.js";
3
3
  import { logger } from "./logger-DYeY_1KP.js";
4
- import { version } from "./package-CSh-i54i.js";
4
+ import { version } from "./package-B9R2bt2m.js";
5
5
  import module from "node:module";
6
6
  import process from "node:process";
7
7
  import { dim } from "ansis";
@@ -20,7 +20,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
20
20
  await build$1(flags);
21
21
  });
22
22
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
23
- const { migrate } = await import("./migrate-D_oMCa9B.js");
23
+ const { migrate } = await import("./migrate-BtPH5ywH.js");
24
24
  await migrate(args);
25
25
  });
26
26
  async function runCLI() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -65,8 +65,8 @@
65
65
  "diff": "^7.0.0",
66
66
  "empathic": "^1.1.0",
67
67
  "hookable": "^5.5.3",
68
- "rolldown": "1.0.0-beta.8-commit.05b3e10",
69
- "rolldown-plugin-dts": "^0.11.4",
68
+ "rolldown": "1.0.0-beta.8-commit.2a5c6a6",
69
+ "rolldown-plugin-dts": "^0.12.0",
70
70
  "semver": "^7.7.1",
71
71
  "tinyexec": "^1.0.1",
72
72
  "tinyglobby": "^0.2.13",
@@ -84,7 +84,7 @@
84
84
  "@unocss/eslint-plugin": "^66.1.1",
85
85
  "bumpp": "^10.1.0",
86
86
  "eslint": "^9.26.0",
87
- "lightningcss": "^1.29.3",
87
+ "lightningcss": "^1.30.0",
88
88
  "pkg-types": "^2.1.0",
89
89
  "prettier": "^3.5.3",
90
90
  "publint": "^0.3.12",
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.11.3";
3
-
4
- //#endregion
5
- export { version };