tsdown 0.2.11 → 0.2.13

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
@@ -56,14 +56,18 @@ function getPackageType(pkg) {
56
56
  //#endregion
57
57
  //#region src/features/output.ts
58
58
  function resolveOutputExtension(pkg, format) {
59
- const type = getPackageType(pkg);
60
- const isEsmFormat = ["es", "esm", "module"].includes(format);
61
- if (type === "module") {
62
- if (isEsmFormat) return "js";
63
- else return "cjs";
64
- } else {
65
- if (isEsmFormat) return "mjs";
66
- return "js";
59
+ const moduleType = getPackageType(pkg);
60
+ switch (format) {
61
+ case "iife": return "js";
62
+ case "es":
63
+ case "esm":
64
+ case "module": {
65
+ return moduleType === "module" ? "js" : "mjs";
66
+ }
67
+ case "cjs":
68
+ case "commonjs": {
69
+ return moduleType === "module" ? "cjs" : "js";
70
+ }
67
71
  }
68
72
  }
69
73
 
@@ -218,6 +222,7 @@ async function build(userOptions = {}) {
218
222
  external,
219
223
  resolve: { alias },
220
224
  treeshake,
225
+ platform,
221
226
  plugins: [ExternalPlugin(pkg, platform), dts && IsolatedDecl.rolldown(dts === true ? {} : dts), ...plugins,].filter((plugin) => !!plugin),
222
227
  ...resolved.inputOptions
223
228
  };
package/dist/options.d.ts CHANGED
@@ -2,7 +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
- export type Format = "es" | "esm" | "module" | "cjs" | "commonjs";
5
+ export type Format = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife";
6
6
  export type Sourcemap = boolean | "inline" | "hidden";
7
7
  export interface Options {
8
8
  entry?: InputOptions["input"];
@@ -17,7 +17,7 @@ export interface Options {
17
17
  alias?: Record<string, string>;
18
18
  treeshake?: boolean;
19
19
  minify?: boolean;
20
- platform?: "node" | "neutral";
20
+ platform?: "node" | "neutral" | "browser";
21
21
  dts?: boolean | IsolatedDeclOptions;
22
22
  watch?: boolean | string | string[];
23
23
  inputOptions?: InputOptions;
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.11";
8
+ const version = "0.2.13";
9
9
 
10
10
  //#endregion
11
11
  //#region src/cli.ts
@@ -1,3 +1,3 @@
1
- export type Overwrite<T, U> = { [P in Exclude<keyof T, keyof U>] : T[P]} & U;
1
+ export type Overwrite<T, U> = Omit<T, keyof U> & U;
2
2
  export type MaybePromise<T> = T | Promise<T>;
3
3
  export type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "An even faster bundler powered by Rolldown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,23 +44,24 @@
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@c2e77b5",
47
+ "rolldown": "https://pkg.pr.new/rolldown@04deb7f",
48
48
  "tinyglobby": "^0.2.5",
49
49
  "unconfig": "^0.5.5",
50
50
  "unplugin-isolated-decl": "^0.4.7"
51
51
  },
52
52
  "devDependencies": {
53
- "@sxzz/eslint-config": "^4.1.4",
53
+ "@sxzz/eslint-config": "^4.1.5",
54
54
  "@sxzz/prettier-config": "^2.0.2",
55
- "@types/node": "^22.5.3",
55
+ "@types/node": "^22.5.4",
56
56
  "bumpp": "^9.5.2",
57
- "eslint": "^9.9.1",
57
+ "eslint": "^9.10.0",
58
58
  "execa": "^9.3.1",
59
59
  "fdir": "^6.3.0",
60
60
  "prettier": "^3.3.3",
61
61
  "tsup": "^8.2.4",
62
62
  "tsx": "^4.19.0",
63
63
  "typescript": "~5.5.4",
64
+ "unplugin-unused": "^0.1.7",
64
65
  "vitest": "^2.0.5"
65
66
  },
66
67
  "engines": {