tsdown 0.9.7 → 0.9.9

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,7 +1,4 @@
1
1
  //#region src/config.ts
2
- /**
3
- * Defines the configuration for tsdown.
4
- */
5
2
  function defineConfig(options) {
6
3
  return options;
7
4
  }
@@ -0,0 +1,11 @@
1
+ import { UserConfig, UserConfigFn } from "./options.d-DF6uzkZt.js";
2
+
3
+ //#region src/config.d.ts
4
+ /**
5
+ * Defines the configuration for tsdown.
6
+ */
7
+ declare function defineConfig(options: UserConfig): UserConfig;
8
+ declare function defineConfig(options: UserConfigFn): UserConfigFn;
9
+
10
+ //#endregion
11
+ export { defineConfig as defineConfig$1 };
package/dist/config.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import "./options.d-DVjImwcI.js";
2
- import { defineConfig$1 as defineConfig } from "./config.d-jKttq4Nu.js";
3
-
4
- export { defineConfig };
1
+ import { UserConfig, UserConfigFn } from "./options.d-DF6uzkZt.js";
2
+ import { defineConfig$1 as defineConfig } from "./config.d-Ca2e571o.js";
3
+ export { UserConfig, UserConfigFn, defineConfig };
package/dist/config.js CHANGED
@@ -1,3 +1,3 @@
1
- import { defineConfig } from "./config-yiJy1jd0.js";
1
+ import { defineConfig } from "./config-CpIe1Ud_.js";
2
2
 
3
3
  export { defineConfig };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d-DVjImwcI.js";
2
- import { defineConfig$1 as defineConfig } from "./config.d-jKttq4Nu.js";
1
+ import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d-DF6uzkZt.js";
2
+ import { defineConfig$1 as defineConfig } from "./config.d-Ca2e571o.js";
3
3
  import { ConsolaInstance } from "consola";
4
4
 
5
5
  //#region src/utils/logger.d.ts
@@ -15,6 +15,7 @@ declare const logger: ConsolaInstance;
15
15
  */
16
16
  declare function build(userOptions?: Options): Promise<void>;
17
17
  declare const pkgRoot: string;
18
+
18
19
  /**
19
20
  * Build a single configuration, without watch and shortcuts features.
20
21
  *
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineConfig } from "./config-yiJy1jd0.js";
1
+ import { defineConfig } from "./config-CpIe1Ud_.js";
2
2
  import { ExternalPlugin, ReportPlugin, ShebangPlugin, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson } from "./plugins-BcuTSrGE.js";
3
3
  import { debounce, logger, resolveComma, setSilent, toArray } from "./general-C06aMSSY.js";
4
4
  import path from "node:path";
@@ -12,6 +12,7 @@ import { exec } from "tinyexec";
12
12
  import { readdir, stat } from "node:fs/promises";
13
13
  import { glob } from "tinyglobby";
14
14
  import { createHooks } from "hookable";
15
+ import LightningCSS from "unplugin-lightningcss/rolldown";
15
16
  import readline from "node:readline";
16
17
  import { loadConfig } from "unconfig";
17
18
  import { up } from "empathic/find";
@@ -49,6 +50,55 @@ async function createHooks$1(options, pkg) {
49
50
  };
50
51
  }
51
52
 
53
+ //#endregion
54
+ //#region src/utils/lightningcss.ts
55
+ /**
56
+ * Converts esbuild target [^1] (which is also used by Rolldown [^2]) to Lightning CSS targets [^3].
57
+ *
58
+ * [^1]: https://esbuild.github.io/api/#target
59
+ * [^2]: https://github.com/rolldown/rolldown/blob/v1.0.0-beta.8/packages/rolldown/src/binding.d.ts#L1429-L1431
60
+ * [^3]: https://lightningcss.dev/transpilation.html
61
+ */
62
+ function esbuildTargetToLightningCSS(target) {
63
+ let targets;
64
+ const targetString = target.join(" ").toLowerCase();
65
+ const matches = [...targetString.matchAll(TARGET_REGEX)];
66
+ for (const match of matches) {
67
+ const name = match[1];
68
+ const browser = ESBUILD_LIGHTNINGCSS_MAPPING[name];
69
+ if (!browser) continue;
70
+ const version = match[2];
71
+ const versionInt = parseVersion(version);
72
+ if (versionInt == null) continue;
73
+ targets = targets || {};
74
+ targets[browser] = versionInt;
75
+ }
76
+ return targets;
77
+ }
78
+ const TARGET_REGEX = /([a-z]+)(\d+(?:\.\d+)*)/g;
79
+ const ESBUILD_LIGHTNINGCSS_MAPPING = {
80
+ chrome: "chrome",
81
+ edge: "edge",
82
+ firefox: "firefox",
83
+ ie: "ie",
84
+ ios: "ios_saf",
85
+ opera: "opera",
86
+ safari: "safari"
87
+ };
88
+ function parseVersion(version) {
89
+ const [major, minor = 0, patch = 0] = version.split("-")[0].split(".").map((v) => Number.parseInt(v, 10));
90
+ if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) return null;
91
+ return major << 16 | minor << 8 | patch;
92
+ }
93
+
94
+ //#endregion
95
+ //#region src/features/lightningcss.ts
96
+ function LightningCSSPlugin(options) {
97
+ const targets = options.target && esbuildTargetToLightningCSS(options.target);
98
+ if (!targets) return;
99
+ return LightningCSS({ options: { targets } });
100
+ }
101
+
52
102
  //#endregion
53
103
  //#region src/features/output.ts
54
104
  function resolveJsOutputExtension(packageType, format, fixedExtension) {
@@ -323,7 +373,7 @@ async function loadConfigFile(options) {
323
373
  }
324
374
  }
325
375
  const nativeTS = process.features.typescript || process.versions.bun || process.versions.deno;
326
- const { config, sources } = await loadConfig.async({
376
+ let { config, sources } = await loadConfig.async({
327
377
  sources: overrideConfig ? [{
328
378
  files: filePath,
329
379
  extensions: []
@@ -352,8 +402,9 @@ async function loadConfigFile(options) {
352
402
  cwd,
353
403
  defaults: {}
354
404
  }).finally(() => loaded = true);
355
- if (sources.length > 0) logger.info(`Using tsdown config: ${underline(sources.join(", "))}`);
356
405
  const file = sources[0];
406
+ if (file) logger.info(`Using tsdown config: ${underline(file)}`);
407
+ if (typeof config === "function") config = await config(options);
357
408
  return {
358
409
  configs: toArray(config),
359
410
  file,
@@ -510,7 +561,12 @@ async function getBuildOptions(config, pkg, format, cjsDts) {
510
561
  }));
511
562
  plugins.push(ShebangPlugin(cwd));
512
563
  }
513
- if (report) plugins.push(ReportPlugin(report, cwd, cjsDts));
564
+ if (report && logger.level >= 3) plugins.push(ReportPlugin(report, cwd, cjsDts));
565
+ if (target) plugins.push(
566
+ // Use Lightning CSS to handle CSS input. This is a temporary solution
567
+ // until Rolldown supports CSS syntax lowering natively.
568
+ LightningCSSPlugin({ target })
569
+ );
514
570
  plugins.push(userPlugins);
515
571
  const inputOptions = await mergeUserOptions({
516
572
  input: entry,
@@ -1,4 +1,4 @@
1
- import { version } from "./package-B5RDOoPA.js";
1
+ import { version } from "./package-Cr6J7APF.js";
2
2
  import process from "node:process";
3
3
  import { readFile, unlink, writeFile } from "node:fs/promises";
4
4
  import consola$1 from "consola";
@@ -0,0 +1,201 @@
1
+ import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, ModuleFormat, OutputOptions, Plugin } from "rolldown";
2
+ import { Hookable } from "hookable";
3
+ import { Options } from "publint";
4
+ import { Options as Options$1 } from "rolldown-plugin-dts";
5
+ import { Options as Options$2 } from "unplugin-unused";
6
+ import { PackageJson } from "pkg-types";
7
+
8
+ //#region src/features/hooks.d.ts
9
+ interface BuildContext {
10
+ options: ResolvedOptions;
11
+ pkg?: PackageJson;
12
+ hooks: Hookable<TsdownHooks>;
13
+ }
14
+ interface RolldownContext {
15
+ buildOptions: BuildOptions;
16
+ }
17
+
18
+ /**
19
+ * Hooks for tsdown.
20
+ */
21
+ interface TsdownHooks {
22
+ /**
23
+ * Invoked before each tsdown build starts.
24
+ * Use this hook to perform setup or preparation tasks.
25
+ */
26
+ "build:prepare": (ctx: BuildContext) => void | Promise<void>;
27
+ /**
28
+ * Invoked before each Rolldown build.
29
+ * For dual-format builds, this hook is called for each format.
30
+ * Useful for configuring or modifying the build context before bundling.
31
+ */
32
+ "build:before": (ctx: BuildContext & RolldownContext) => void | Promise<void>;
33
+ /**
34
+ * Invoked after each tsdown build completes.
35
+ * Use this hook for cleanup or post-processing tasks.
36
+ */
37
+ "build:done": (ctx: BuildContext) => void | Promise<void>;
38
+ } //#endregion
39
+ //#region src/utils/package.d.ts
40
+ type PackageType = "module" | "commonjs" | undefined;
41
+
42
+ //#endregion
43
+ //#region src/features/output.d.ts
44
+ interface OutExtensionContext {
45
+ options: InputOptions;
46
+ format: NormalizedFormat;
47
+ /** "type" field in project's package.json */
48
+ pkgType?: PackageType;
49
+ }
50
+ interface OutExtensionObject {
51
+ js?: string;
52
+ dts?: string;
53
+ }
54
+ type OutExtensionFactory = (ctx: OutExtensionContext) => OutExtensionObject;
55
+
56
+ //#endregion
57
+ //#region src/features/report.d.ts
58
+ interface ReportOptions {
59
+ /**
60
+ * Enable/disable brotli-compressed size reporting.
61
+ * Compressing large output files can be slow, so disabling this may increase build performance for large projects.
62
+ *
63
+ * @default false
64
+ */
65
+ brotli?: boolean;
66
+ /**
67
+ * Skip reporting compressed size for files larger than this size.
68
+ * @default 1_000_000 // 1MB
69
+ */
70
+ maxCompressSize?: number;
71
+ }
72
+ declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: boolean): Plugin;
73
+
74
+ //#endregion
75
+ //#region src/utils/types.d.ts
76
+ type Overwrite<T, U> = Omit<T, keyof U> & U;
77
+ type Awaitable<T> = T | Promise<T>;
78
+ type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
79
+ type Arrayable<T> = T | T[];
80
+
81
+ //#endregion
82
+ //#region src/options.d.ts
83
+ type Sourcemap = boolean | "inline" | "hidden";
84
+ type Format = Exclude<ModuleFormat, "experimental-app">;
85
+ type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
86
+ interface MinifyOptions {
87
+ mangle?: boolean;
88
+ compress?: boolean;
89
+ removeWhitespace?: boolean;
90
+ }
91
+
92
+ /**
93
+ * Options for tsdown.
94
+ */
95
+ interface Options$3 {
96
+ entry?: InputOption;
97
+ external?: ExternalOption;
98
+ noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
99
+ alias?: Record<string, string>;
100
+ tsconfig?: string | boolean;
101
+ /** @default 'node' */
102
+ platform?: "node" | "neutral" | "browser";
103
+ inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
104
+ /** @default 'es' */
105
+ format?: Format | Format[];
106
+ globalName?: string;
107
+ /** @default 'dist' */
108
+ outDir?: string;
109
+ sourcemap?: Sourcemap;
110
+ clean?: boolean | string[];
111
+ /** @default false */
112
+ minify?: boolean | "dce-only" | MinifyOptions;
113
+ target?: string | string[];
114
+ define?: Record<string, string>;
115
+ /** @default false */
116
+ shims?: boolean;
117
+ /**
118
+ * Use a fixed extension for output files.
119
+ * The extension will always be `.cjs` or `.mjs`.
120
+ * Otherwise, it will depend on the package type.
121
+ * @default false
122
+ */
123
+ fixedExtension?: boolean;
124
+ /**
125
+ * Custom extensions for output files.
126
+ * `fixedExtension` will be overridden by this option.
127
+ */
128
+ outExtensions?: OutExtensionFactory;
129
+ outputOptions?: OutputOptions | ((options: OutputOptions, format: NormalizedFormat) => Awaitable<OutputOptions | void | null>);
130
+ /** @default true */
131
+ treeshake?: boolean;
132
+ plugins?: InputOptions["plugins"];
133
+ silent?: boolean;
134
+ /**
135
+ * Config file path
136
+ */
137
+ config?: boolean | string;
138
+ watch?: boolean | string | string[];
139
+ /**
140
+ * You can specify command to be executed after a successful build, specially useful for Watch mode
141
+ */
142
+ onSuccess?: string | ((config: ResolvedOptions) => void | Promise<void>);
143
+ /**
144
+ * Skip bundling node_modules.
145
+ */
146
+ skipNodeModulesBundle?: boolean;
147
+ /**
148
+ * Reuse config from Vite or Vitest (experimental)
149
+ * @default false
150
+ */
151
+ fromVite?: boolean | "vitest";
152
+ /**
153
+ * Emit declaration files
154
+ */
155
+ dts?: boolean | Options$1;
156
+ /**
157
+ * Enable unused dependencies check with `unplugin-unused`
158
+ * Requires `unplugin-unused` to be installed.
159
+ */
160
+ unused?: boolean | Options$2;
161
+ /**
162
+ * Run publint after bundling.
163
+ * Requires `publint` to be installed.
164
+ */
165
+ publint?: boolean | Options;
166
+ /**
167
+ * Enable size reporting after bundling.
168
+ * @default true
169
+ */
170
+ report?: boolean | ReportOptions;
171
+ /**
172
+ * Compile-time env variables.
173
+ * @example
174
+ * ```ts
175
+ * {
176
+ * "DEBUG": true,
177
+ * "NODE_ENV": "production"
178
+ * }
179
+ * ```
180
+ */
181
+ env?: Record<string, any>;
182
+ hooks?: Partial<TsdownHooks> | ((hooks: Hookable<TsdownHooks>) => Awaitable<void>);
183
+ }
184
+
185
+ /**
186
+ * Options without specifying config file path.
187
+ */
188
+ type UserConfig = Arrayable<Omit<Options$3, "config">>;
189
+ type UserConfigFn = (cliOptions: Options$3) => Awaitable<UserConfig>;
190
+ type ResolvedOptions = Omit<Overwrite<MarkPartial<Options$3, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks">, {
191
+ format: NormalizedFormat[];
192
+ target?: string[];
193
+ clean: string[] | false;
194
+ dts: false | Options$1;
195
+ report: false | ReportOptions;
196
+ tsconfig: string | false;
197
+ cwd: string;
198
+ }>, "config" | "fromVite">;
199
+
200
+ //#endregion
201
+ export { BuildContext, Options$3 as Options, ReportPlugin as ReportPlugin$1, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn };
@@ -0,0 +1,5 @@
1
+ //#region package.json
2
+ var version = "0.9.9";
3
+
4
+ //#endregion
5
+ export { version };
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./options.d-DVjImwcI.js";
1
+ import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./options.d-DF6uzkZt.js";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
package/dist/run.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { logger, resolveComma, setSilent, toArray } from "./general-C06aMSSY.js";
3
- import { version } from "./package-B5RDOoPA.js";
3
+ import { version } from "./package-Cr6J7APF.js";
4
4
  import process from "node:process";
5
5
  import { dim } from "ansis";
6
6
  import Debug from "debug";
@@ -19,7 +19,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
19
19
  await build$1(flags);
20
20
  });
21
21
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
22
- const { migrate } = await import("./migrate-Cr0H4OLK.js");
22
+ const { migrate } = await import("./migrate-CygdeFLJ.js");
23
23
  await migrate(args);
24
24
  });
25
25
  async function runCLI() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -62,11 +62,13 @@
62
62
  "diff": "^7.0.0",
63
63
  "empathic": "^1.0.0",
64
64
  "hookable": "^5.5.3",
65
- "rolldown": "1.0.0-beta.8-commit.2686eb1",
66
- "rolldown-plugin-dts": "^0.8.3",
65
+ "lightningcss": "^1.29.3",
66
+ "rolldown": "1.0.0-beta.8-commit.151352b",
67
+ "rolldown-plugin-dts": "^0.9.4",
67
68
  "tinyexec": "^1.0.1",
68
69
  "tinyglobby": "^0.2.13",
69
- "unconfig": "^7.3.2"
70
+ "unconfig": "^7.3.2",
71
+ "unplugin-lightningcss": "^0.3.3"
70
72
  },
71
73
  "devDependencies": {
72
74
  "@sxzz/eslint-config": "^6.1.2",
@@ -74,7 +76,7 @@
74
76
  "@sxzz/test-utils": "^0.5.5",
75
77
  "@types/debug": "^4.1.12",
76
78
  "@types/diff": "^7.0.2",
77
- "@types/node": "^22.14.1",
79
+ "@types/node": "^22.15.2",
78
80
  "@unocss/eslint-plugin": "^66.1.0-beta.12",
79
81
  "bumpp": "^10.1.0",
80
82
  "eslint": "^9.25.1",
@@ -84,11 +86,11 @@
84
86
  "tsup": "^8.4.0",
85
87
  "tsx": "^4.19.3",
86
88
  "typedoc": "^0.28.3",
87
- "typedoc-plugin-markdown": "^4.6.2",
89
+ "typedoc-plugin-markdown": "^4.6.3",
88
90
  "typescript": "~5.8.3",
89
91
  "unocss": "^66.1.0-beta.12",
90
92
  "unplugin-unused": "^0.4.4",
91
- "vite": "^6.3.2",
93
+ "vite": "^6.3.3",
92
94
  "vitepress": "^1.6.3",
93
95
  "vitepress-plugin-group-icons": "^1.5.2",
94
96
  "vitepress-plugin-llms": "^1.1.0",
@@ -1,10 +0,0 @@
1
- import { UserConfig } from "./options.d-DVjImwcI.js";
2
-
3
- //#region src/config.d.ts
4
- /**
5
- * Defines the configuration for tsdown.
6
- */
7
- declare function defineConfig(options: UserConfig): UserConfig;
8
-
9
- //#endregion
10
- export { defineConfig as defineConfig$1 };
@@ -1,200 +0,0 @@
1
- import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, ModuleFormat, OutputOptions, Plugin } from "rolldown";
2
- import { Hookable } from "hookable";
3
- import { Options } from "publint";
4
- import { Options as Options$1 } from "rolldown-plugin-dts";
5
- import { Options as Options$2 } from "unplugin-unused";
6
- import { PackageJson } from "pkg-types";
7
-
8
- //#region src/features/hooks.d.ts
9
- interface BuildContext {
10
- options: ResolvedOptions;
11
- pkg?: PackageJson;
12
- hooks: Hookable<TsdownHooks>;
13
- }
14
- interface RolldownContext {
15
- buildOptions: BuildOptions;
16
- }
17
- /**
18
- * Hooks for tsdown.
19
- */
20
- interface TsdownHooks {
21
- /**
22
- * Invoked before each tsdown build starts.
23
- * Use this hook to perform setup or preparation tasks.
24
- */
25
- "build:prepare": (ctx: BuildContext) => void | Promise<void>;
26
- /**
27
- * Invoked before each Rolldown build.
28
- * For dual-format builds, this hook is called for each format.
29
- * Useful for configuring or modifying the build context before bundling.
30
- */
31
- "build:before": (ctx: BuildContext & RolldownContext) => void | Promise<void>;
32
- /**
33
- * Invoked after each tsdown build completes.
34
- * Use this hook for cleanup or post-processing tasks.
35
- */
36
- "build:done": (ctx: BuildContext) => void | Promise<void>;
37
- }
38
-
39
- //#endregion
40
- //#region src/utils/package.d.ts
41
- type PackageType = "module" | "commonjs" | undefined;
42
-
43
- //#endregion
44
- //#region src/features/output.d.ts
45
- interface OutExtensionContext {
46
- options: InputOptions;
47
- format: NormalizedFormat;
48
- /** "type" field in project's package.json */
49
- pkgType?: PackageType;
50
- }
51
- interface OutExtensionObject {
52
- js?: string;
53
- dts?: string;
54
- }
55
- type OutExtensionFactory = (ctx: OutExtensionContext) => OutExtensionObject;
56
-
57
- //#endregion
58
- //#region src/features/report.d.ts
59
- interface ReportOptions {
60
- /**
61
- * Enable/disable brotli-compressed size reporting.
62
- * Compressing large output files can be slow, so disabling this may increase build performance for large projects.
63
- *
64
- * @default false
65
- */
66
- brotli?: boolean;
67
- /**
68
- * Skip reporting compressed size for files larger than this size.
69
- * @default 1_000_000 // 1MB
70
- */
71
- maxCompressSize?: number;
72
- }
73
- declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: boolean): Plugin;
74
-
75
- //#endregion
76
- //#region src/utils/types.d.ts
77
- type Overwrite<
78
- T,
79
- U
80
- > = Omit<T, keyof U> & U;
81
- type Awaitable<T> = T | Promise<T>;
82
- type MarkPartial<
83
- T,
84
- K extends keyof T
85
- > = Omit<Required<T>, K> & Partial<Pick<T, K>>;
86
- type Arrayable<T> = T | T[];
87
-
88
- //#endregion
89
- //#region src/options.d.ts
90
- type Sourcemap = boolean | "inline" | "hidden";
91
- type Format = Exclude<ModuleFormat, "experimental-app">;
92
- type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
93
- /**
94
- * Options for tsdown.
95
- */
96
- interface Options$3 {
97
- entry?: InputOption;
98
- external?: ExternalOption;
99
- noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
100
- alias?: Record<string, string>;
101
- tsconfig?: string | boolean;
102
- /** @default 'node' */
103
- platform?: "node" | "neutral" | "browser";
104
- inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
105
- /** @default 'es' */
106
- format?: Format | Format[];
107
- globalName?: string;
108
- /** @default 'dist' */
109
- outDir?: string;
110
- sourcemap?: Sourcemap;
111
- clean?: boolean | string[];
112
- /** @default false */
113
- minify?: boolean;
114
- target?: string | string[];
115
- define?: Record<string, string>;
116
- /** @default false */
117
- shims?: boolean;
118
- /**
119
- * Use a fixed extension for output files.
120
- * The extension will always be `.cjs` or `.mjs`.
121
- * Otherwise, it will depend on the package type.
122
- * @default false
123
- */
124
- fixedExtension?: boolean;
125
- /**
126
- * Custom extensions for output files.
127
- * `fixedExtension` will be overridden by this option.
128
- */
129
- outExtensions?: OutExtensionFactory;
130
- outputOptions?: OutputOptions | ((options: OutputOptions, format: NormalizedFormat) => Awaitable<OutputOptions | void | null>);
131
- /** @default true */
132
- treeshake?: boolean;
133
- plugins?: InputOptions["plugins"];
134
- silent?: boolean;
135
- /**
136
- * Config file path
137
- */
138
- config?: boolean | string;
139
- watch?: boolean | string | string[];
140
- /**
141
- * You can specify command to be executed after a successful build, specially useful for Watch mode
142
- */
143
- onSuccess?: string | ((config: ResolvedOptions) => void | Promise<void>);
144
- /**
145
- * Skip bundling node_modules.
146
- */
147
- skipNodeModulesBundle?: boolean;
148
- /**
149
- * Reuse config from Vite or Vitest (experimental)
150
- * @default false
151
- */
152
- fromVite?: boolean | "vitest";
153
- /**
154
- * Emit declaration files
155
- */
156
- dts?: boolean | Options$1;
157
- /**
158
- * Enable unused dependencies check with `unplugin-unused`
159
- * Requires `unplugin-unused` to be installed.
160
- */
161
- unused?: boolean | Options$2;
162
- /**
163
- * Run publint after bundling.
164
- * Requires `publint` to be installed.
165
- */
166
- publint?: boolean | Options;
167
- /**
168
- * Enable size reporting after bundling.
169
- * @default true
170
- */
171
- report?: boolean | ReportOptions;
172
- /**
173
- * Compile-time env variables.
174
- * @example
175
- * ```ts
176
- * {
177
- * "DEBUG": true,
178
- * "NODE_ENV": "production"
179
- * }
180
- * ```
181
- */
182
- env?: Record<string, any>;
183
- hooks?: Partial<TsdownHooks> | ((hooks: Hookable<TsdownHooks>) => Awaitable<void>);
184
- }
185
- /**
186
- * Options without specifying config file path.
187
- */
188
- type UserConfig = Arrayable<Omit<Options$3, "config">>;
189
- type ResolvedOptions = Omit<Overwrite<MarkPartial<Options$3, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks">, {
190
- format: NormalizedFormat[]
191
- target?: string[]
192
- clean: string[] | false
193
- dts: false | Options$1
194
- report: false | ReportOptions
195
- tsconfig: string | false
196
- cwd: string
197
- }>, "config" | "fromVite">;
198
-
199
- //#endregion
200
- export { BuildContext, Options$3 as Options, ReportPlugin as ReportPlugin$1, ResolvedOptions, TsdownHooks, UserConfig };
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.9.7";
3
-
4
- //#endregion
5
- export { version };