@@ -3,8 +3,10 @@ import { rollupBundle, RollupBundleOptions } from "./bundle";
33import { rollupNode , RollupNodeOptions } from "./node" ;
44import { rollupDts , RollupDtsOptions } from "./dts" ;
55import { getEntryFiles , MatchFilesPatterns } from "./entry" ;
6+ import { isTruthy } from "../util/func" ;
7+ import { CommonPluginsOptions } from "./common-plugins" ;
68
7- export interface GenRollupOptions {
9+ export interface GenRollupOptions extends CommonPluginsOptions {
810 inputBaseDir ?: string ;
911 inputPatterns ?: MatchFilesPatterns ;
1012 outputBaseDir ?: string ;
@@ -20,9 +22,22 @@ export async function rollupOptions({
2022 bundle,
2123 node,
2224 dts,
25+ copyMeta,
2326} : GenRollupOptions = { } ) : Promise < RollupOptions [ ] > {
27+ // take copyMeta options so that it can only be used once
28+ const takeCopyMeta = ( ) => {
29+ const v = copyMeta ;
30+ copyMeta = undefined ;
31+ return v ;
32+ } ;
33+
2434 const bundleOptions : RollupBundleOptions | null = bundle
25- ? { outputBaseDir, inputBaseDir, ...( bundle === true ? null : bundle ) }
35+ ? {
36+ outputBaseDir,
37+ inputBaseDir,
38+ copyMeta : takeCopyMeta ( ) ,
39+ ...( bundle === true ? null : bundle ) ,
40+ }
2641 : null ;
2742
2843 let cachedInput : Promise < InputOption > | null = null ;
@@ -42,6 +57,7 @@ export async function rollupOptions({
4257 inputBaseDir,
4358 inputPatterns,
4459 outputBaseDir,
60+ copyMeta : takeCopyMeta ( ) ,
4561 ...( node === true ? null : node ) ,
4662 }
4763 : null ;
@@ -51,6 +67,7 @@ export async function rollupOptions({
5167 input,
5268 inputBaseDir,
5369 outputBaseDir,
70+ copyMeta : takeCopyMeta ( ) ,
5471 ...( dts === true ? null : dts ) ,
5572 }
5673 : null ;
0 commit comments