@@ -17,7 +17,7 @@ import { DEFAULT_EXTENSIONS, getChunkFilename, resolveAliases } from "./utils";
1717
1818export function getRollupOptions ( ctx : BuildContext ) : RollupOptions {
1919 const _aliases = resolveAliases ( ctx ) ;
20- return ( < RollupOptions > {
20+ return {
2121 input : Object . fromEntries (
2222 ctx . options . entries
2323 . filter ( ( entry ) => entry . builder === "rollup" )
@@ -29,7 +29,7 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
2929
3030 output : [
3131 ctx . options . rollup . emitCJS &&
32- < OutputOptions > {
32+ ( {
3333 dir : resolve ( ctx . options . rootDir , ctx . options . outDir ) ,
3434 entryFileNames : "[name].cjs" ,
3535 chunkFileNames : ( chunk : PreRenderedChunk ) =>
@@ -42,8 +42,8 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
4242 freeze : false ,
4343 sourcemap : ctx . options . sourcemap ,
4444 ...ctx . options . rollup . output ,
45- } ,
46- < OutputOptions > {
45+ } satisfies OutputOptions ) ,
46+ {
4747 dir : resolve ( ctx . options . rootDir , ctx . options . outDir ) ,
4848 entryFileNames : "[name].mjs" ,
4949 chunkFileNames : ( chunk : PreRenderedChunk ) =>
@@ -55,10 +55,10 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
5555 freeze : false ,
5656 sourcemap : ctx . options . sourcemap ,
5757 ...ctx . options . rollup . output ,
58- } ,
59- ] . filter ( Boolean ) ,
58+ } satisfies OutputOptions ,
59+ ] . filter ( Boolean ) as OutputOptions [ ] ,
6060
61- external ( originalId ) {
61+ external ( originalId ) : boolean {
6262 // Resolve aliases
6363 const resolvedId = resolveAlias ( originalId , _aliases ) ;
6464
@@ -105,7 +105,7 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
105105 return false ;
106106 } ,
107107
108- onwarn ( warning , rollupWarn ) {
108+ onwarn ( warning , rollupWarn ) : void {
109109 if ( ! warning . code || ! [ "CIRCULAR_DEPENDENCY" ] . includes ( warning . code ) ) {
110110 rollupWarn ( warning ) ;
111111 }
@@ -154,6 +154,7 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
154154 } ) ,
155155
156156 ctx . options . rollup . preserveDynamicImports && {
157+ name : "unbuild=preserve-dynamic-imports" ,
157158 renderDynamicImport ( ) : { left : string ; right : string } {
158159 return { left : "import(" , right : ")" } ;
159160 } ,
@@ -162,6 +163,6 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
162163 ctx . options . rollup . cjsBridge && cjsPlugin ( { } ) ,
163164
164165 rawPlugin ( ) ,
165- ] . filter ( Boolean ) ,
166- } ) as RollupOptions ;
166+ ] . filter ( ( p ) : p is NonNullable < Exclude < typeof p , false > > => ! ! p ) ,
167+ } satisfies RollupOptions ;
167168}
0 commit comments