@@ -10,13 +10,14 @@ import type {
10
10
Optimizer ,
11
11
} from '../types' ;
12
12
import {
13
- createPlugin ,
13
+ createQwikPlugin ,
14
14
type NormalizedQwikPluginOptions ,
15
15
type QwikBuildMode ,
16
16
type QwikBuildTarget ,
17
17
type QwikPluginOptions ,
18
18
Q_MANIFEST_FILENAME ,
19
19
type ExperimentalFeatures ,
20
+ type QwikPlugin ,
20
21
} from './plugin' ;
21
22
import { versions } from '../versions' ;
22
23
@@ -27,7 +28,7 @@ type QwikRollupPluginApi = {
27
28
28
29
/** @public */
29
30
export function qwikRollup ( qwikRollupOpts : QwikRollupPluginOptions = { } ) : any {
30
- const qwikPlugin = createPlugin ( qwikRollupOpts . optimizerOptions ) ;
31
+ const qwikPlugin = createQwikPlugin ( qwikRollupOpts . optimizerOptions ) ;
31
32
32
33
const rollupPlugin : QwikRollupPlugin = {
33
34
name : 'rollup-plugin-qwik' ,
@@ -77,13 +78,7 @@ export function qwikRollup(qwikRollupOpts: QwikRollupPluginOptions = {}): any {
77
78
} ,
78
79
79
80
outputOptions ( rollupOutputOpts ) {
80
- return normalizeRollupOutputOptionsObject (
81
- qwikPlugin . getOptimizer ( ) ,
82
- qwikPlugin . getOptions ( ) ,
83
- rollupOutputOpts ,
84
- false ,
85
- qwikPlugin . manualChunks
86
- ) ;
81
+ return normalizeRollupOutputOptionsObject ( qwikPlugin , rollupOutputOpts , false ) ;
87
82
} ,
88
83
89
84
async buildStart ( ) {
@@ -161,11 +156,9 @@ export function qwikRollup(qwikRollupOpts: QwikRollupPluginOptions = {}): any {
161
156
}
162
157
163
158
export function normalizeRollupOutputOptions (
164
- optimizer : Optimizer ,
165
- opts : NormalizedQwikPluginOptions ,
159
+ qwikPlugin : QwikPlugin ,
166
160
rollupOutputOpts : Rollup . OutputOptions | Rollup . OutputOptions [ ] | undefined ,
167
161
useAssetsDir : boolean ,
168
- manualChunks : Rollup . GetManualChunk ,
169
162
outDir ?: string
170
163
) : Rollup . OutputOptions | Rollup . OutputOptions [ ] {
171
164
if ( Array . isArray ( rollupOutputOpts ) ) {
@@ -175,38 +168,26 @@ export function normalizeRollupOutputOptions(
175
168
}
176
169
177
170
return rollupOutputOpts . map ( ( outputOptsObj ) => ( {
178
- ...normalizeRollupOutputOptionsObject (
179
- optimizer ,
180
- opts ,
181
- outputOptsObj ,
182
- useAssetsDir ,
183
- manualChunks
184
- ) ,
171
+ ...normalizeRollupOutputOptionsObject ( qwikPlugin , outputOptsObj , useAssetsDir ) ,
185
172
dir : outDir || outputOptsObj . dir ,
186
173
} ) ) ;
187
174
}
188
175
189
176
return {
190
- ...normalizeRollupOutputOptionsObject (
191
- optimizer ,
192
- opts ,
193
- rollupOutputOpts ,
194
- useAssetsDir ,
195
- manualChunks
196
- ) ,
177
+ ...normalizeRollupOutputOptionsObject ( qwikPlugin , rollupOutputOpts , useAssetsDir ) ,
197
178
dir : outDir || rollupOutputOpts ?. dir ,
198
179
} ;
199
180
}
200
181
201
182
export function normalizeRollupOutputOptionsObject (
202
- optimizer : Optimizer ,
203
- opts : NormalizedQwikPluginOptions ,
183
+ qwikPlugin : QwikPlugin ,
204
184
rollupOutputOptsObj : Rollup . OutputOptions | undefined ,
205
- useAssetsDir : boolean ,
206
- manualChunks : Rollup . GetManualChunk
185
+ useAssetsDir : boolean
207
186
) : Rollup . OutputOptions {
208
187
const outputOpts : Rollup . OutputOptions = { ...rollupOutputOptsObj } ;
209
-
188
+ const opts = qwikPlugin . getOptions ( ) ;
189
+ const optimizer = qwikPlugin . getOptimizer ( ) ;
190
+ const manualChunks = qwikPlugin . manualChunks ;
210
191
if ( opts . target === 'client' ) {
211
192
// client output
212
193
if ( ! outputOpts . assetFileNames ) {
0 commit comments