1
+ import type { Rollup } from 'vite' ;
1
2
import type {
2
3
Diagnostic ,
3
4
EntryStrategy ,
@@ -16,7 +17,6 @@ import {
16
17
type QwikPlugin ,
17
18
type QwikPluginOptions ,
18
19
} from './plugin' ;
19
- import type { OutputOptions , Plugin , PreRenderedChunk , RollupError } from 'rollup' ;
20
20
21
21
type QwikRollupPluginApi = {
22
22
getOptimizer : ( ) => Optimizer ;
@@ -128,10 +128,10 @@ export function qwikRollup(qwikRollupOpts: QwikRollupPluginOptions = {}): any {
128
128
129
129
export function normalizeRollupOutputOptions (
130
130
qwikPlugin : QwikPlugin ,
131
- rollupOutputOpts : OutputOptions | OutputOptions [ ] | undefined ,
131
+ rollupOutputOpts : Rollup . OutputOptions | Rollup . OutputOptions [ ] | undefined ,
132
132
useAssetsDir : boolean ,
133
133
outDir ?: string
134
- ) : OutputOptions | OutputOptions [ ] {
134
+ ) : Rollup . OutputOptions | Rollup . OutputOptions [ ] {
135
135
if ( Array . isArray ( rollupOutputOpts ) ) {
136
136
// make sure at least one output is present in every case
137
137
if ( ! rollupOutputOpts . length ) {
@@ -152,10 +152,10 @@ export function normalizeRollupOutputOptions(
152
152
153
153
export function normalizeRollupOutputOptionsObject (
154
154
qwikPlugin : QwikPlugin ,
155
- rollupOutputOptsObj : OutputOptions | undefined ,
155
+ rollupOutputOptsObj : Rollup . OutputOptions | undefined ,
156
156
useAssetsDir : boolean
157
- ) : OutputOptions {
158
- const outputOpts : OutputOptions = { ...rollupOutputOptsObj } ;
157
+ ) : Rollup . OutputOptions {
158
+ const outputOpts : Rollup . OutputOptions = { ...rollupOutputOptsObj } ;
159
159
const opts = qwikPlugin . getOptions ( ) ;
160
160
const optimizer = qwikPlugin . getOptimizer ( ) ;
161
161
const manualChunks = qwikPlugin . manualChunks ;
@@ -169,7 +169,7 @@ export function normalizeRollupOutputOptionsObject(
169
169
: assetFileNames ;
170
170
}
171
171
172
- let fileName : string | ( ( chunkInfo : PreRenderedChunk ) => string ) | undefined ;
172
+ let fileName : string | ( ( chunkInfo : Rollup . PreRenderedChunk ) => string ) | undefined ;
173
173
if ( opts . buildMode === 'production' && ! opts . debug ) {
174
174
fileName = 'build/q-[hash].js' ;
175
175
} else {
@@ -198,14 +198,15 @@ export function normalizeRollupOutputOptionsObject(
198
198
} ;
199
199
}
200
200
// client development/debug output
201
- const getFilePath = ( fileNamePattern : string | ( ( info : PreRenderedChunk ) => string ) ) =>
201
+ const getFilePath = ( fileNamePattern : string | ( ( info : Rollup . PreRenderedChunk ) => string ) ) =>
202
202
typeof fileNamePattern === 'string'
203
203
? useAssetsDir
204
204
? `${ opts . assetsDir } /${ fileNamePattern } `
205
205
: fileNamePattern
206
206
: useAssetsDir
207
- ? ( chunkInfo : PreRenderedChunk ) => `${ opts . assetsDir } /${ fileNamePattern ( chunkInfo ) } `
208
- : ( chunkInfo : PreRenderedChunk ) => fileNamePattern ( chunkInfo ) ;
207
+ ? ( chunkInfo : Rollup . PreRenderedChunk ) =>
208
+ `${ opts . assetsDir } /${ fileNamePattern ( chunkInfo ) } `
209
+ : ( chunkInfo : Rollup . PreRenderedChunk ) => fileNamePattern ( chunkInfo ) ;
209
210
210
211
if ( ! outputOpts . entryFileNames ) {
211
212
outputOpts . entryFileNames = getFilePath ( fileName ) ;
@@ -261,7 +262,7 @@ export function normalizeRollupOutputOptionsObject(
261
262
262
263
export function createRollupError ( id : string , diagnostic : Diagnostic ) {
263
264
const loc = diagnostic . highlights [ 0 ] ?? { } ;
264
- const err : RollupError = Object . assign ( new Error ( diagnostic . message ) , {
265
+ const err : Rollup . RollupError = Object . assign ( new Error ( diagnostic . message ) , {
265
266
id,
266
267
plugin : 'qwik' ,
267
268
loc : {
@@ -355,5 +356,5 @@ export interface QwikRollupPluginOptions {
355
356
experimental ?: ( keyof typeof ExperimentalFeatures ) [ ] ;
356
357
}
357
358
export { ExperimentalFeatures } from './plugin' ;
358
- type P < T > = Plugin < T > & { api : T } ;
359
+ type P < T > = Rollup . Plugin < T > & { api : T } ;
359
360
export interface QwikRollupPlugin extends P < QwikRollupPluginApi > { }
0 commit comments