mvp-ai's picture
|
download
raw
2.39 kB

@zuke/tsup

Typed tsup CLI task wrapper for Zuke builds — bundle TypeScript/JavaScript with formats, declarations, minification, and more.

import { TsupTasks } from "@zuke/tsup";

await TsupTasks.build((s) =>
  s.entry("src/index.ts").format("esm", "cjs").dts().minify().clean()
);

API

Full typed API — generated from deno doc
`@zuke/tsup` — a typed `TsupTasks` wrapper for the
tsup (https://tsup.egoist.dev) bundler, for use in Zuke builds.

```ts
import { TsupTasks } from "@zuke/tsup";

await TsupTasks.build((s) =>
  s.entry("src/index.ts").format("esm", "cjs").dts().minify().clean()
);
```
@module

const TsupTasks: TsupTasksApi
  Typed task functions for the `tsup` bundler.

class TsupBuildSettings extends ToolSettings
  Settings for a `tsup` bundle run.

  override protected defaultTool(): string
    The executable this settings object runs: `tsup`.
  override protected defaultResolution(): ToolResolution
    Resolve the binary from `node_modules/.bin` by default — tsup is an npm-distributed tool.
  entry(...paths: PathLike[]): this
    Entry point(s) to bundle (positional); repeatable.
  format(...formats: TsupFormat[]): this
    Output format(s), joined into `--format` (e.g. `esm,cjs`).
  dts(): this
    Emit TypeScript declaration files (`--dts`).
  minify(): this
    Minify the output (`--minify`).
  sourcemap(): this
    Emit source maps (`--sourcemap`).
  clean(): this
    Clean the output directory before building (`--clean`).
  watch(): this
    Rebuild on change (`--watch`).
  outDir(path: PathLike): this
    Output directory (`--out-dir`).
  target(value: string): this
    Compilation target, e.g. `es2022` or `node18` (`--target`).
  tsconfig(path: PathLike): this
    Path to a tsconfig file (`--tsconfig`).
  config(path: PathLike): this
    Path to a tsup config file (`--config`).
  override protected buildArgs(): string[]
    Assemble the `tsup <entries> <flags>` argv.

interface TsupTasksApi
  The shape of {@link TsupTasks}.

  build(configure?: Configure<TsupBuildSettings>): Promise<CommandOutput>
    Bundle the entry points: `tsup`.

type TsupFormat = "esm" | "cjs" | "iife"
  An output format accepted by tsup's `--format`.

Xet Storage Details

Size:
2.39 kB
·
Xet hash:
4b7cb65bc16ab476f296b56203d34573ca5e22e87c003a8c09ad4a1fc1e40055

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.