@@ -181,7 +181,8 @@ function compression(
181
181
let root : string = process . cwd ( )
182
182
183
183
const zlibs = algorithms . map ( ( [ algorithm , options ] ) => ( {
184
- algorithm : typeof algorithm === 'string' ? ensureAlgorithm ( algorithm ) . algorithm : algorithm ,
184
+ algorithm,
185
+ algorithmFunction : typeof algorithm === 'string' ? ensureAlgorithm ( algorithm ) . algorithm : algorithm ,
185
186
options,
186
187
filename : filename ??
187
188
( algorithm === 'brotliCompress' ? '[path][base].br' : algorithm === 'zstd' ? '[path][base].zst' : '[path][base].gz' )
@@ -201,7 +202,7 @@ function compression(
201
202
const z = zlibs [ i ]
202
203
const flag = i === zlibs . length - 1
203
204
const name = replaceFileName ( fileName , z . filename , { options : z . options , algorithm : z . algorithm } )
204
- const compressed = await compress ( source , z . algorithm , z . options )
205
+ const compressed = await compress ( source , z . algorithmFunction , z . options )
205
206
if ( skipIfLargerOrEqual && len ( compressed ) >= size ) { return }
206
207
// #issue 30 31
207
208
// https://rollupjs.org/plugin-development/#this-emitfile
@@ -270,7 +271,7 @@ function compression(
270
271
for ( let i = 0 ; i < zlibs . length ; i ++ ) {
271
272
const z = zlibs [ i ]
272
273
const flag = i === zlibs . length - 1
273
- const compressed = await compress ( buf , z . algorithm , z . options )
274
+ const compressed = await compress ( buf , z . algorithmFunction , z . options )
274
275
if ( skipIfLargerOrEqual && len ( compressed ) >= len ( buf ) ) {
275
276
if ( ! pluginContext . staticOutputs . has ( file ) ) { pluginContext . staticOutputs . add ( file ) }
276
277
return
0 commit comments