tsdown 0.12.9 → 0.13.0-beta.2

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.
@@ -94,7 +94,7 @@ interface TsdownHooks {
94
94
  * Build with tsdown.
95
95
  */
96
96
  declare function build$1(userOptions?: Options$3): Promise<void>;
97
- declare const pkgRoot: string;
97
+ declare const shimFile: string;
98
98
  type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputAsset>>>;
99
99
  /**
100
100
  * Build a single configuration, without watch and shortcuts features.
@@ -141,6 +141,15 @@ interface OutExtensionObject {
141
141
  dts?: string;
142
142
  }
143
143
  type OutExtensionFactory = (context: OutExtensionContext) => OutExtensionObject | undefined;
144
+ interface ChunkAddonObject {
145
+ js?: string;
146
+ css?: string;
147
+ dts?: string;
148
+ }
149
+ type ChunkAddonFunction = (ctx: {
150
+ format: Format;
151
+ }) => ChunkAddonObject | undefined;
152
+ type ChunkAddon = ChunkAddonObject | ChunkAddonFunction;
144
153
  //#endregion
145
154
  //#region src/features/report.d.ts
146
155
  interface ReportOptions {
@@ -185,7 +194,6 @@ interface Workspace {
185
194
  * Options for tsdown.
186
195
  */
187
196
  interface Options$3 {
188
- /// build options
189
197
  /**
190
198
  * Defaults to `'src/index.ts'` if it exists.
191
199
  */
@@ -206,8 +214,9 @@ interface Options$3 {
206
214
  * @see https://tsdown.dev/options/platform
207
215
  */
208
216
  platform?: "node" | "neutral" | "browser";
209
- inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
210
- /// output options
217
+ inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat, context: {
218
+ cjsDts: boolean;
219
+ }) => Awaitable<InputOptions | void | null>);
211
220
  /** @default ['es'] */
212
221
  format?: Format | Format[];
213
222
  globalName?: string;
@@ -278,7 +287,9 @@ interface Options$3 {
278
287
  * `fixedExtension` will be overridden by this option.
279
288
  */
280
289
  outExtensions?: OutExtensionFactory;
281
- outputOptions?: OutputOptions | ((options: OutputOptions, format: NormalizedFormat) => Awaitable<OutputOptions | void | null>);
290
+ outputOptions?: OutputOptions | ((options: OutputOptions, format: NormalizedFormat, context: {
291
+ cjsDts: boolean;
292
+ }) => Awaitable<OutputOptions | void | null>);
282
293
  /** @default true */
283
294
  treeshake?: boolean;
284
295
  plugins?: InputOptions["plugins"];
@@ -315,7 +326,6 @@ interface Options$3 {
315
326
  * @default false
316
327
  */
317
328
  fromVite?: boolean | "vitest";
318
- /// addons
319
329
  /**
320
330
  * Emit TypeScript declaration files (.d.ts).
321
331
  *
@@ -431,13 +441,15 @@ interface Options$3 {
431
441
  * Filter workspace packages. This option is only available in workspace mode.
432
442
  */
433
443
  filter?: RegExp | string | string[];
444
+ footer?: ChunkAddon;
445
+ banner?: ChunkAddon;
434
446
  }
435
447
  /**
436
448
  * Options without specifying config file path.
437
449
  */
438
450
  type UserConfig = Arrayable<Omit<Options$3, "config" | "filter">>;
439
451
  type UserConfigFn = (cliOptions: Options$3) => Awaitable<UserConfig>;
440
- type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" | "workspace" | "filter">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name" | "bundle">, {
452
+ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" | "workspace" | "filter">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name" | "bundle" | "banner" | "footer">, {
441
453
  format: NormalizedFormat[];
442
454
  target?: string[];
443
455
  clean: string[];
@@ -453,6 +465,6 @@ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" |
453
465
  /**
454
466
  * Defines the configuration for tsdown.
455
467
  */
456
- declare function defineConfig(options: UserConfig | UserConfigFn): UserConfig | UserConfigFn;
468
+ declare function defineConfig<const T extends UserConfig | UserConfigFn>(options: T): T;
457
469
  //#endregion
458
- export { BuildContext, Options$3 as Options, ReportPlugin, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build$1 as build, buildSingle, defineConfig, logger, pkgRoot };
470
+ export { type BuildContext, type Options$3 as Options, ReportPlugin, type ResolvedOptions, TsdownChunks, type TsdownHooks, type UserConfig, type UserConfigFn, build$1 as build, buildSingle, defineConfig, logger, shimFile };
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { UserConfig, UserConfigFn, defineConfig } from "./config-DL8S79AB.mjs";
1
+ import { UserConfig, UserConfigFn, defineConfig } from "./config--Vetp6NA.mjs";
2
2
  export { UserConfig, UserConfigFn, defineConfig };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { BuildContext, Options, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot } from "./config-DL8S79AB.mjs";
2
- export { BuildContext, Options, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
1
+ import { BuildContext, Options, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, shimFile } from "./config--Vetp6NA.mjs";
2
+ export { BuildContext, Options, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, shimFile };