Skip to content

Commit

Permalink
fix: type RollupOptions.plugins as array
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 28, 2024
1 parent e314665 commit 62fa930
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/builder/rollup.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { writeFile, mkdir } from "node:fs/promises";
import { promises as fsp } from "node:fs";
import { pathToFileURL } from "node:url";
import type {
RollupOptions,
OutputOptions,
OutputChunk,
PreRenderedChunk,
} from "rollup";
import type { OutputOptions, OutputChunk, PreRenderedChunk } from "rollup";
import { rollup } from "rollup";
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
Expand All @@ -24,7 +19,7 @@ import {
import { resolvePath, resolveModuleExportNames } from "mlly";
import { watch as rollupWatch } from "rollup";
import { arrayIncludes, getpkg, tryResolve, warn } from "../utils";
import type { BuildContext } from "../types";
import type { BuildContext, RollupOptions } from "../types";
import { esbuild } from "./plugins/esbuild";
import { JSONPlugin } from "./plugins/json";
import { rawPlugin } from "./plugins/raw";
Expand Down Expand Up @@ -265,7 +260,7 @@ export async function rollupBuild(ctx: BuildContext) {
// Types
if (ctx.options.declaration) {
rollupOptions.plugins = [
rollupOptions.plugins,
...rollupOptions.plugins,
dts(ctx.options.rollup.dts),
removeShebangPlugin(),
];
Expand Down
7 changes: 6 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { PackageJson } from "pkg-types";
import type { Hookable } from "hookable";
import type {
RollupOptions,
RollupOptions as _RollupOptions,
RollupBuild,
OutputOptions,
WatcherOptions,
InputPluginOption,
} from "rollup";
import type { MkdistOptions } from "mkdist";
import type { Schema } from "untyped";
Expand Down Expand Up @@ -297,6 +298,10 @@ export interface UntypedOutputs {
declaration?: UntypedOutput;
}

export interface RollupOptions extends _RollupOptions {
plugins: InputPluginOption[];
}

export interface BuildHooks {
"build:prepare": (ctx: BuildContext) => void | Promise<void>;
"build:before": (ctx: BuildContext) => void | Promise<void>;
Expand Down

0 comments on commit 62fa930

Please sign in to comment.