tsdown 0.2.13 → 0.2.15

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.js CHANGED
@@ -3,6 +3,7 @@ import { ExternalPlugin } from "./external-NHKSS1J8.js";
3
3
  import { default as process, default as process$1, default as process$2 } from "node:process";
4
4
  import { rolldown } from "rolldown";
5
5
  import { IsolatedDecl } from "unplugin-isolated-decl";
6
+ import { Unused } from "unplugin-unused";
6
7
  import { access, readdir, rm, stat } from "node:fs/promises";
7
8
  import { default as path, default as path$1, default as path$2, default as path$3 } from "node:path";
8
9
  import { glob, glob as glob$1 } from "tinyglobby";
@@ -149,7 +150,7 @@ async function normalizeOptions(options) {
149
150
  ...await loadConfigFile(options),
150
151
  ...options
151
152
  };
152
- let { entry, format = ["es"], plugins = [], external, clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, minify, alias, watch = false, inputOptions, outputOptions } = options;
153
+ let { entry, format = ["es"], plugins = [], external, clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, unused = false, minify, alias, watch = false, inputOptions, outputOptions } = options;
153
154
  entry = await resolveEntry(entry);
154
155
  format = toArray(format, "es");
155
156
  if (clean === true) clean = [];
@@ -166,6 +167,7 @@ async function normalizeOptions(options) {
166
167
  platform,
167
168
  sourcemap,
168
169
  dts,
170
+ unused,
169
171
  minify,
170
172
  watch,
171
173
  inputOptions,
@@ -213,7 +215,7 @@ async function loadConfigFile(options) {
213
215
  //#region src/index.ts
214
216
  async function build(userOptions = {}) {
215
217
  const resolved = await normalizeOptions(userOptions);
216
- const { entry, external, plugins, outDir, format, clean, platform, alias, treeshake, sourcemap, dts, minify, watch } = resolved;
218
+ const { entry, external, plugins, outDir, format, clean, platform, alias, treeshake, sourcemap, dts, minify, watch, unused } = resolved;
217
219
  if (clean) await cleanOutDir(outDir, clean);
218
220
  const pkg = await readPackageJson(process.cwd());
219
221
  let startTime = performance.now();
@@ -223,7 +225,7 @@ async function build(userOptions = {}) {
223
225
  resolve: { alias },
224
226
  treeshake,
225
227
  platform,
226
- plugins: [ExternalPlugin(pkg, platform), dts && IsolatedDecl.rolldown(dts === true ? {} : dts), ...plugins,].filter((plugin) => !!plugin),
228
+ plugins: [ExternalPlugin(pkg, platform), dts && IsolatedDecl.rolldown(dts === true ? {} : dts), unused && Unused.rolldown(unused === true ? {} : unused), ...plugins,].filter((plugin) => !!plugin),
227
229
  ...resolved.inputOptions
228
230
  };
229
231
  const build$1 = await rolldown(inputOptions);
@@ -231,7 +233,7 @@ async function build(userOptions = {}) {
231
233
  if (watch) {
232
234
  await watchBuild(resolved, writeBundle);
233
235
  } else {
234
- await build$1.destroy();
236
+ await build$1.close();
235
237
  }
236
238
  async function writeBundle(first) {
237
239
  if (!first) startTime = performance.now();
package/dist/options.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { External } from "./features/external";
2
2
  import type { MarkPartial, MaybePromise, Overwrite } from "./utils/types";
3
3
  import type { InputOptions, OutputOptions } from "rolldown";
4
4
  import type { Options as IsolatedDeclOptions } from "unplugin-isolated-decl";
5
+ import type { Options as UnusedOptions } from "unplugin-unused";
5
6
  export type Format = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife";
6
7
  export type Sourcemap = boolean | "inline" | "hidden";
7
8
  export interface Options {
@@ -19,6 +20,7 @@ export interface Options {
19
20
  minify?: boolean;
20
21
  platform?: "node" | "neutral" | "browser";
21
22
  dts?: boolean | IsolatedDeclOptions;
23
+ unused?: boolean | UnusedOptions;
22
24
  watch?: boolean | string | string[];
23
25
  inputOptions?: InputOptions;
24
26
  outputOptions?: OutputOptions | ((options: OutputOptions, format: Format) => MaybePromise<OutputOptions | void | null>);
package/dist/run.js CHANGED
@@ -5,7 +5,7 @@ import { default as pc } from "picocolors";
5
5
  import { cac } from "cac";
6
6
 
7
7
  //#region package.json
8
- const version = "0.2.13";
8
+ const version = "0.2.15";
9
9
 
10
10
  //#endregion
11
11
  //#region src/cli.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "An even faster bundler powered by Rolldown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,13 +44,14 @@
44
44
  "consola": "^3.2.3",
45
45
  "picocolors": "^1.1.0",
46
46
  "pkg-types": "^1.2.0",
47
- "rolldown": "https://pkg.pr.new/rolldown@04deb7f",
48
- "tinyglobby": "^0.2.5",
47
+ "rolldown": "nightly",
48
+ "tinyglobby": "^0.2.6",
49
49
  "unconfig": "^0.5.5",
50
- "unplugin-isolated-decl": "^0.4.7"
50
+ "unplugin-isolated-decl": "^0.4.7",
51
+ "unplugin-unused": "^0.2.3"
51
52
  },
52
53
  "devDependencies": {
53
- "@sxzz/eslint-config": "^4.1.5",
54
+ "@sxzz/eslint-config": "^4.2.0",
54
55
  "@sxzz/prettier-config": "^2.0.2",
55
56
  "@types/node": "^22.5.4",
56
57
  "bumpp": "^9.5.2",
@@ -61,7 +62,6 @@
61
62
  "tsup": "^8.2.4",
62
63
  "tsx": "^4.19.0",
63
64
  "typescript": "~5.5.4",
64
- "unplugin-unused": "^0.1.7",
65
65
  "vitest": "^2.0.5"
66
66
  },
67
67
  "engines": {