@@ -14,10 +14,11 @@ import { Miniflare, convertV4MiniflareOptions } from 'miniflare';
1414import { build } from 'vite' ;
1515import { afterEach , describe , expect , it } from 'vite-plus/test' ;
1616import { analyzeApplication } from '../../src/application-routing.ts' ;
17- import { buildVoidManifest , collectWorkerFiles } from '../../src/cli/package.ts' ;
17+ import { buildVoidManifest } from '../../src/cli/package.ts' ;
1818import { syncWranglerDurableObjects , syncWranglerWebSockets } from '../../src/cli/wrangler.ts' ;
1919import { readConfig } from '../../src/config.ts' ;
2020import { scanDurableObjectModules } from '../../src/durable/scan.ts' ;
21+ import { collectPrerenderWorkerModules } from '../../src/prerender.ts' ;
2122import { compileRouteTable , compileWorkerEntry } from '../../src/router/compile.ts' ;
2223
2324const repository = join ( import . meta. dirname , '..' , '..' , '..' , '..' ) ;
@@ -379,21 +380,14 @@ export default defineRoom({
379380 { tag : 'void-durable-counter-v1' , new_sqlite_classes : [ 'CounterDurableObject' ] } ,
380381 { tag : 'void-ws-v1' , new_sqlite_classes : [ 'ChatRoomWs' ] } ,
381382 ] ) ;
382- const files = collectWorkerFiles ( output ) ;
383- const modulePaths = [
384- config . main ,
385- ...Array . from ( files . keys ( ) ) . filter ( ( path ) => path !== config . main ) ,
386- ] ;
387- expect ( modulePaths . every ( ( path ) => / \. (?: j s | m j s ) $ / . test ( path ) ) ) . toBe ( true ) ;
383+ // Source maps belong in uploads, but are not executable Worker modules.
384+ const modules = collectPrerenderWorkerModules ( output , config . main ) ;
385+ expect ( modules . every ( ( module ) => module . type === 'ESModule' ) ) . toBe ( true ) ;
388386 runtime = new Miniflare (
389387 convertV4MiniflareOptions ( {
390388 compatibilityDate : config . compatibility_date ,
391389 compatibilityFlags : config . compatibility_flags ,
392- modules : modulePaths . map ( ( path ) => ( {
393- type : 'ESModule' ,
394- path : join ( output , path ) ,
395- contents : files . get ( path ) ! ,
396- } ) ) ,
390+ modules,
397391 modulesRoot : output ,
398392 durableObjects : {
399393 COUNTER : { className : 'CounterDurableObject' , useSQLite : true } ,
0 commit comments