(
config: ResolvedConfig,
input: string,
bundlerOptions: any,
plugins: any,
generateOptions: any
)
| 142 | |
| 143 | // Rollup path (Vite 7 and earlier). |
| 144 | async function bundleWorkerEntryRollup( |
| 145 | config: ResolvedConfig, |
| 146 | input: string, |
| 147 | bundlerOptions: any, |
| 148 | plugins: any, |
| 149 | generateOptions: any |
| 150 | ): Promise<BundledWorkerChunk> { |
| 151 | const { rollup } = await import('rollup'); |
| 152 | const bundle = await rollup({ |
| 153 | ...bundlerOptions, |
| 154 | input, |
| 155 | plugins, |
| 156 | preserveEntrySignatures: false |
| 157 | }); |
| 158 | try { |
| 159 | const { output } = await bundle.generate(generateOptions); |
| 160 | const [outputChunk, ...rest] = output; |
| 161 | for (const o of rest) { |
| 162 | if (o.type === 'asset') { |
| 163 | saveEmitWorkerAsset(config, o); |
| 164 | } else { |
| 165 | saveEmitWorkerAsset(config, { fileName: o.fileName, source: o.code }); |
| 166 | } |
| 167 | } |
| 168 | return outputChunk; |
| 169 | } finally { |
| 170 | await bundle.close(); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | // Rolldown path (Vite 8+). |
| 175 | async function bundleWorkerEntryRolldown( |
no test coverage detected