tsdown 0.13.3 → 0.13.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.
@@ -185,6 +185,11 @@ interface Options {
185
185
  entry?: InputOption;
186
186
  external?: ExternalOption;
187
187
  noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
188
+ /**
189
+ * Skip bundling `node_modules`.
190
+ * @default false
191
+ */
192
+ skipNodeModulesBundle?: boolean;
188
193
  alias?: Record<string, string>;
189
194
  tsconfig?: string | boolean;
190
195
  /**
@@ -199,25 +204,6 @@ interface Options {
199
204
  * @see https://tsdown.dev/options/platform
200
205
  */
201
206
  platform?: "node" | "neutral" | "browser";
202
- inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat, context: {
203
- cjsDts: boolean;
204
- }) => Awaitable<InputOptions | void | null>);
205
- /** @default ['es'] */
206
- format?: Format | Format[];
207
- globalName?: string;
208
- /** @default 'dist' */
209
- outDir?: string;
210
- /** @default false */
211
- sourcemap?: Sourcemap;
212
- /**
213
- * Clean directories before build.
214
- *
215
- * Default to output directory.
216
- * @default true
217
- */
218
- clean?: boolean | string[];
219
- /** @default false */
220
- minify?: boolean | "dce-only" | MinifyOptions;
221
207
  /**
222
208
  * Specifies the compilation target environment(s).
223
209
  *
@@ -242,6 +228,86 @@ interface Options {
242
228
  */
243
229
  target?: string | string[] | false;
244
230
  /**
231
+ * Compile-time env variables.
232
+ * @example
233
+ * ```json
234
+ * {
235
+ * "DEBUG": true,
236
+ * "NODE_ENV": "production"
237
+ * }
238
+ * ```
239
+ */
240
+ env?: Record<string, any>;
241
+ define?: Record<string, string>;
242
+ /** @default false */
243
+ shims?: boolean;
244
+ /**
245
+ * @default true
246
+ */
247
+ treeshake?: boolean;
248
+ loader?: ModuleTypes;
249
+ /**
250
+ * If enabled, strips the `node:` protocol prefix from import source.
251
+ *
252
+ * @default false
253
+ * @deprecated Use `nodeProtocol: 'strip'` instead.
254
+ *
255
+ * @example
256
+ * // With removeNodeProtocol enabled:
257
+ * import('node:fs'); // becomes import('fs')
258
+ */
259
+ removeNodeProtocol?: boolean;
260
+ /**
261
+ * - If true, add `node:` prefix to built-in modules.
262
+ * - If 'strip', strips the `node:` protocol prefix from import source.
263
+ * - If false, does not modify the import source.
264
+ *
265
+ * @default false
266
+ *
267
+ * @example
268
+ * // With nodeProtocol enabled:
269
+ * import('fs'); // becomes import('node:fs')
270
+ * // With nodeProtocol set to 'strip':
271
+ * import('node:fs'); // becomes import('fs')
272
+ * // With nodeProtocol set to false:
273
+ * import('node:fs'); // remains import('node:fs')
274
+ *
275
+ */
276
+ nodeProtocol?: "strip" | boolean;
277
+ plugins?: InputOptions["plugins"];
278
+ /**
279
+ * Sets how input files are processed.
280
+ * For example, use 'js' to treat files as JavaScript or 'base64' for images.
281
+ * Lets you import or require files like images or fonts.
282
+ * @example
283
+ * ```json
284
+ * { '.jpg': 'asset', '.png': 'base64' }
285
+ * ```
286
+ */
287
+ inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat, context: {
288
+ cjsDts: boolean;
289
+ }) => Awaitable<InputOptions | void | null>);
290
+ /** @default ['es'] */
291
+ format?: Format | Format[];
292
+ globalName?: string;
293
+ /** @default 'dist' */
294
+ outDir?: string;
295
+ /** @default false */
296
+ sourcemap?: Sourcemap;
297
+ /**
298
+ * Clean directories before build.
299
+ *
300
+ * Default to output directory.
301
+ * @default true
302
+ */
303
+ clean?: boolean | string[];
304
+ /**
305
+ * @default false
306
+ */
307
+ minify?: boolean | "dce-only" | MinifyOptions;
308
+ footer?: ChunkAddon;
309
+ banner?: ChunkAddon;
310
+ /**
245
311
  * Determines whether unbundle mode is enabled.
246
312
  * When set to true, the output files will mirror the input file structure.
247
313
  * @default false
@@ -252,15 +318,6 @@ interface Options {
252
318
  * @default true
253
319
  */
254
320
  bundle?: boolean;
255
- define?: Record<string, string>;
256
- /** @default false */
257
- shims?: boolean;
258
- /**
259
- * The name to show in CLI output. This is useful for monorepos or workspaces.
260
- * When using workspace mode, this option defaults to the package name from package.json.
261
- * In non-workspace mode, this option must be set explicitly for the name to show in the CLI output.
262
- */
263
- name?: string;
264
321
  /**
265
322
  * Use a fixed extension for output files.
266
323
  * The extension will always be `.cjs` or `.mjs`.
@@ -273,22 +330,30 @@ interface Options {
273
330
  * `fixedExtension` will be overridden by this option.
274
331
  */
275
332
  outExtensions?: OutExtensionFactory;
333
+ /**
334
+ * If enabled, appends hash to chunk filenames.
335
+ * @default true
336
+ */
337
+ hash?: boolean;
338
+ /**
339
+ * @default true
340
+ */
341
+ cjsDefault?: boolean;
276
342
  outputOptions?: OutputOptions | ((options: OutputOptions, format: NormalizedFormat, context: {
277
343
  cjsDts: boolean;
278
344
  }) => Awaitable<OutputOptions | void | null>);
279
- /** @default true */
280
- treeshake?: boolean;
281
- plugins?: InputOptions["plugins"];
282
345
  /**
283
- * Sets how input files are processed.
284
- * For example, use 'js' to treat files as JavaScript or 'base64' for images.
285
- * Lets you import or require files like images or fonts.
286
- * @example
287
- * ```json
288
- * { '.jpg': 'asset', '.png': 'base64' }
289
- * ```
346
+ * The working directory of the config file.
347
+ * - Defaults to `process.cwd()` for root config.
348
+ * - Defaults to the package directory for workspace config.
290
349
  */
291
- loader?: ModuleTypes;
350
+ cwd?: string;
351
+ /**
352
+ * The name to show in CLI output. This is useful for monorepos or workspaces.
353
+ * When using workspace mode, this option defaults to the package name from package.json.
354
+ * In non-workspace mode, this option must be set explicitly for the name to show in the CLI output.
355
+ */
356
+ name?: string;
292
357
  /**
293
358
  * @default false
294
359
  * @deprecated Use `logLevel` instead.
@@ -300,6 +365,11 @@ interface Options {
300
365
  */
301
366
  logLevel?: LogLevel;
302
367
  /**
368
+ * If true, fails the build on warnings.
369
+ * @default false
370
+ */
371
+ failOnWarn?: boolean;
372
+ /**
303
373
  * Custom logger.
304
374
  */
305
375
  customLogger?: Logger;
@@ -307,23 +377,20 @@ interface Options {
307
377
  * Config file path
308
378
  */
309
379
  config?: boolean | string;
310
- /** @default false */
311
- watch?: boolean | Arrayable<string>;
312
- ignoreWatch?: Arrayable<string | RegExp>;
313
380
  /**
314
- * You can specify command to be executed after a successful build, specially useful for Watch mode
381
+ * Reuse config from Vite or Vitest (experimental)
382
+ * @default false
315
383
  */
316
- onSuccess?: string | ((config: ResolvedOptions, signal: AbortSignal) => void | Promise<void>);
384
+ fromVite?: boolean | "vitest";
317
385
  /**
318
- * Skip bundling `node_modules`.
319
386
  * @default false
320
387
  */
321
- skipNodeModulesBundle?: boolean;
388
+ watch?: boolean | Arrayable<string>;
389
+ ignoreWatch?: Arrayable<string | RegExp>;
322
390
  /**
323
- * Reuse config from Vite or Vitest (experimental)
324
- * @default false
391
+ * You can specify command to be executed after a successful build, specially useful for Watch mode
325
392
  */
326
- fromVite?: boolean | "vitest";
393
+ onSuccess?: string | ((config: ResolvedOptions, signal: AbortSignal) => void | Promise<void>);
327
394
  /**
328
395
  * Emit TypeScript declaration files (.d.ts).
329
396
  *
@@ -365,17 +432,6 @@ interface Options {
365
432
  */
366
433
  exports?: boolean | ExportsOptions;
367
434
  /**
368
- * Compile-time env variables.
369
- * @example
370
- * ```json
371
- * {
372
- * "DEBUG": true,
373
- * "NODE_ENV": "production"
374
- * }
375
- * ```
376
- */
377
- env?: Record<string, any>;
378
- /**
379
435
  * @deprecated Alias for `copy`, will be removed in the future.
380
436
  */
381
437
  publicDir?: CopyOptions | CopyOptionsFn;
@@ -392,45 +448,6 @@ interface Options {
392
448
  copy?: CopyOptions | CopyOptionsFn;
393
449
  hooks?: Partial<TsdownHooks> | ((hooks: Hookable<TsdownHooks>) => Awaitable<void>);
394
450
  /**
395
- * If enabled, strips the `node:` protocol prefix from import source.
396
- *
397
- * @default false
398
- * @deprecated Use `nodeProtocol: 'strip'` instead.
399
- *
400
- * @example
401
- * // With removeNodeProtocol enabled:
402
- * import('node:fs'); // becomes import('fs')
403
- */
404
- removeNodeProtocol?: boolean;
405
- /**
406
- * - If true, add `node:` prefix to built-in modules.
407
- * - If 'strip', strips the `node:` protocol prefix from import source.
408
- * - If false, does not modify the import source.
409
- *
410
- * @default false
411
- *
412
- * @example
413
- * // With nodeProtocol enabled:
414
- * import('fs'); // becomes import('node:fs')
415
- * // With nodeProtocol set to 'strip':
416
- * import('node:fs'); // becomes import('fs')
417
- * // With nodeProtocol set to false:
418
- * import('node:fs'); // remains import('node:fs')
419
- *
420
- */
421
- nodeProtocol?: "strip" | boolean;
422
- /**
423
- * If enabled, appends hash to chunk filenames.
424
- * @default true
425
- */
426
- hash?: boolean;
427
- /**
428
- * The working directory of the config file.
429
- * - Defaults to `process.cwd()` for root config.
430
- * - Defaults to the package directory for workspace config.
431
- */
432
- cwd?: string;
433
- /**
434
451
  * **[experimental]** Enable workspace mode.
435
452
  * This allows you to build multiple packages in a monorepo.
436
453
  */
@@ -439,8 +456,6 @@ interface Options {
439
456
  * Filter workspace packages. This option is only available in workspace mode.
440
457
  */
441
458
  filter?: RegExp | string | string[];
442
- footer?: ChunkAddon;
443
- banner?: ChunkAddon;
444
459
  }
445
460
  /**
446
461
  * Options without specifying config file path.
@@ -448,7 +463,7 @@ interface Options {
448
463
  type UserConfig = Arrayable<Omit<Options, "config" | "filter">>;
449
464
  type UserConfigFn = (cliOptions: Options) => Awaitable<UserConfig>;
450
465
  type NormalizedUserConfig = Exclude<UserConfig, any[]>;
451
- type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options, "publicDir" | "workspace" | "filter" | "silent" | "logLevel" | "customLogger">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name" | "bundle" | "banner" | "footer">, {
466
+ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options, "publicDir" | "workspace" | "filter" | "silent" | "logLevel" | "failOnWarn" | "customLogger">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name" | "bundle" | "banner" | "footer">, {
452
467
  format: NormalizedFormat[];
453
468
  target?: string[];
454
469
  clean: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.13.3",
3
+ "version": "0.13.5",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -74,8 +74,8 @@
74
74
  "diff": "^8.0.2",
75
75
  "empathic": "^2.0.0",
76
76
  "hookable": "^5.5.3",
77
- "rolldown": "^1.0.0-beta.31",
78
- "rolldown-plugin-dts": "^0.15.3",
77
+ "rolldown": "latest",
78
+ "rolldown-plugin-dts": "^0.15.6",
79
79
  "semver": "^7.7.2",
80
80
  "tinyexec": "^1.0.1",
81
81
  "tinyglobby": "^0.2.14",
@@ -88,14 +88,14 @@
88
88
  "@sxzz/prettier-config": "^2.2.3",
89
89
  "@sxzz/test-utils": "^0.5.9",
90
90
  "@types/debug": "^4.1.12",
91
- "@types/node": "^24.2.0",
91
+ "@types/node": "^24.2.1",
92
92
  "@types/semver": "^7.7.0",
93
- "@unocss/eslint-plugin": "^66.4.1",
93
+ "@unocss/eslint-plugin": "^66.4.2",
94
94
  "@vueuse/core": "^13.6.0",
95
95
  "bumpp": "^10.2.2",
96
- "eslint": "^9.32.0",
96
+ "eslint": "^9.33.0",
97
97
  "lightningcss": "^1.30.1",
98
- "oxc-minify": "^0.80.0",
98
+ "oxc-minify": "^0.81.0",
99
99
  "pkg-types": "^2.2.0",
100
100
  "prettier": "^3.6.2",
101
101
  "publint": "^0.3.12",
@@ -104,12 +104,12 @@
104
104
  "typedoc-plugin-markdown": "^4.8.0",
105
105
  "typedoc-vitepress-theme": "^1.1.2",
106
106
  "typescript": "~5.9.2",
107
- "unocss": "^66.4.1",
107
+ "unocss": "^66.4.2",
108
108
  "unplugin-lightningcss": "^0.4.1",
109
109
  "unplugin-unused": "^0.5.1",
110
110
  "vite": "npm:rolldown-vite@latest",
111
111
  "vitepress": "^2.0.0-alpha.7",
112
- "vitepress-plugin-group-icons": "^1.6.1",
112
+ "vitepress-plugin-group-icons": "^1.6.2",
113
113
  "vitepress-plugin-llms": "^1.7.2",
114
114
  "vitest": "^3.2.4",
115
115
  "vue": "^3.5.18"
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.13.3";
3
-
4
- //#endregion
5
- export { version };