11/** @import { ServerMetadata } from 'types' */
2- /** @import { OutputBundle } from 'rollup ' */
2+ /** @import { Rolldown } from 'vite ' */
33
44import fs from 'node:fs' ;
55import path from 'node:path' ;
66import { Parser } from 'acorn' ;
77import MagicString from 'magic-string' ;
88import { posixify } from '../../../utils/filesystem.js' ;
9- import { import_peer } from '../../../utils/import.js' ;
109
1110/**
11+ * @param {typeof import('vite') } vite
1212 * @param {string } out
1313 * @param {Array<{ hash: string, file: string }> } remotes
1414 * @param {ServerMetadata } metadata
1515 * @param {string } cwd
16- * @param {OutputBundle } server_bundle
16+ * @param {Rolldown.RolldownOutput } server_bundle
1717 * @param {NonNullable<import('vitest/config').ViteUserConfig['build']>['sourcemap'] } sourcemap
1818 */
1919export async function treeshake_prerendered_remotes (
20+ vite ,
2021 out ,
2122 remotes ,
2223 metadata ,
@@ -26,8 +27,6 @@ export async function treeshake_prerendered_remotes(
2627) {
2728 if ( remotes . length === 0 ) return ;
2829
29- const vite = /** @type {typeof import('vite') } */ ( await import_peer ( 'vite' ) ) ;
30-
3130 for ( const remote of remotes ) {
3231 const exports_map = metadata . remotes . get ( remote . hash ) ;
3332 if ( ! exports_map ) continue ;
@@ -90,7 +89,7 @@ export async function treeshake_prerendered_remotes(
9089 const stubbed = modified_code . toString ( ) ;
9190 fs . writeFileSync ( chunk_path , stubbed ) ;
9291
93- const bundle = /** @type {import('vite').Rollup.RollupOutput } */ (
92+ const bundle = /** @type {import('vite').Rolldown.RolldownOutput } */ (
9493 await vite . build ( {
9594 configFile : false ,
9695 build : {
0 commit comments