Skip to content

Commit b97a62b

Browse files
committed
chore: bring back Rollup type
1 parent 96b3f8e commit b97a62b

File tree

1 file changed

+13
-12
lines changed
  • packages/qwik/src/optimizer/src/plugins

1 file changed

+13
-12
lines changed

packages/qwik/src/optimizer/src/plugins/rollup.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Rollup } from 'vite';
12
import type {
23
Diagnostic,
34
EntryStrategy,
@@ -16,7 +17,6 @@ import {
1617
type QwikPlugin,
1718
type QwikPluginOptions,
1819
} from './plugin';
19-
import type { OutputOptions, Plugin, PreRenderedChunk, RollupError } from 'rollup';
2020

2121
type QwikRollupPluginApi = {
2222
getOptimizer: () => Optimizer;
@@ -128,10 +128,10 @@ export function qwikRollup(qwikRollupOpts: QwikRollupPluginOptions = {}): any {
128128

129129
export function normalizeRollupOutputOptions(
130130
qwikPlugin: QwikPlugin,
131-
rollupOutputOpts: OutputOptions | OutputOptions[] | undefined,
131+
rollupOutputOpts: Rollup.OutputOptions | Rollup.OutputOptions[] | undefined,
132132
useAssetsDir: boolean,
133133
outDir?: string
134-
): OutputOptions | OutputOptions[] {
134+
): Rollup.OutputOptions | Rollup.OutputOptions[] {
135135
if (Array.isArray(rollupOutputOpts)) {
136136
// make sure at least one output is present in every case
137137
if (!rollupOutputOpts.length) {
@@ -152,10 +152,10 @@ export function normalizeRollupOutputOptions(
152152

153153
export function normalizeRollupOutputOptionsObject(
154154
qwikPlugin: QwikPlugin,
155-
rollupOutputOptsObj: OutputOptions | undefined,
155+
rollupOutputOptsObj: Rollup.OutputOptions | undefined,
156156
useAssetsDir: boolean
157-
): OutputOptions {
158-
const outputOpts: OutputOptions = { ...rollupOutputOptsObj };
157+
): Rollup.OutputOptions {
158+
const outputOpts: Rollup.OutputOptions = { ...rollupOutputOptsObj };
159159
const opts = qwikPlugin.getOptions();
160160
const optimizer = qwikPlugin.getOptimizer();
161161
const manualChunks = qwikPlugin.manualChunks;
@@ -169,7 +169,7 @@ export function normalizeRollupOutputOptionsObject(
169169
: assetFileNames;
170170
}
171171

172-
let fileName: string | ((chunkInfo: PreRenderedChunk) => string) | undefined;
172+
let fileName: string | ((chunkInfo: Rollup.PreRenderedChunk) => string) | undefined;
173173
if (opts.buildMode === 'production' && !opts.debug) {
174174
fileName = 'build/q-[hash].js';
175175
} else {
@@ -198,14 +198,15 @@ export function normalizeRollupOutputOptionsObject(
198198
};
199199
}
200200
// client development/debug output
201-
const getFilePath = (fileNamePattern: string | ((info: PreRenderedChunk) => string)) =>
201+
const getFilePath = (fileNamePattern: string | ((info: Rollup.PreRenderedChunk) => string)) =>
202202
typeof fileNamePattern === 'string'
203203
? useAssetsDir
204204
? `${opts.assetsDir}/${fileNamePattern}`
205205
: fileNamePattern
206206
: 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);
209210

210211
if (!outputOpts.entryFileNames) {
211212
outputOpts.entryFileNames = getFilePath(fileName);
@@ -261,7 +262,7 @@ export function normalizeRollupOutputOptionsObject(
261262

262263
export function createRollupError(id: string, diagnostic: Diagnostic) {
263264
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), {
265266
id,
266267
plugin: 'qwik',
267268
loc: {
@@ -355,5 +356,5 @@ export interface QwikRollupPluginOptions {
355356
experimental?: (keyof typeof ExperimentalFeatures)[];
356357
}
357358
export { ExperimentalFeatures } from './plugin';
358-
type P<T> = Plugin<T> & { api: T };
359+
type P<T> = Rollup.Plugin<T> & { api: T };
359360
export interface QwikRollupPlugin extends P<QwikRollupPluginApi> {}

0 commit comments

Comments
 (0)