@@ -2182,8 +2182,10 @@ addEventListener('fetch', event => {});`
21822182
21832183 it ( "when using a module worker type, it should add an asset manifest module, and bind to a namespace" , async ( ) => {
21842184 const assets = [
2185- { filePath : "file-1.txt" , content : "Content of file-1" } ,
2186- { filePath : "file-2.txt" , content : "Content of file-2" } ,
2185+ // Using `.text` extension instead of `.txt` means files won't be
2186+ // treated as additional modules
2187+ { filePath : "file-1.text" , content : "Content of file-1" } ,
2188+ { filePath : "file-2.text" , content : "Content of file-2" } ,
21872189 ] ;
21882190 const kvNamespace = {
21892191 title : "__test-name-workers_sites_assets" ,
@@ -2194,8 +2196,27 @@ addEventListener('fetch', event => {});`
21942196 site : {
21952197 bucket : "assets" ,
21962198 } ,
2199+ find_additional_modules : true ,
2200+ rules : [ { type : "ESModule" , globs : [ "**/*.mjs" ] } ] ,
21972201 } ) ;
21982202 writeWorkerSource ( { type : "esm" } ) ;
2203+ fs . mkdirSync ( "a/b/c" , { recursive : true } ) ;
2204+ fs . writeFileSync (
2205+ "a/1.mjs" ,
2206+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2207+ ) ;
2208+ fs . writeFileSync (
2209+ "a/b/2.mjs" ,
2210+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2211+ ) ;
2212+ fs . writeFileSync (
2213+ "a/b/3.mjs" ,
2214+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2215+ ) ;
2216+ fs . writeFileSync (
2217+ "a/b/c/4.mjs" ,
2218+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2219+ ) ;
21992220 writeAssets ( assets ) ;
22002221 mockUploadWorkerRequest ( {
22012222 expectedBindings : [
@@ -2207,7 +2228,13 @@ addEventListener('fetch', event => {});`
22072228 ] ,
22082229 expectedModules : {
22092230 __STATIC_CONTENT_MANIFEST :
2210- '{"file-1.txt":"file-1.2ca234f380.txt","file-2.txt":"file-2.5938485188.txt"}' ,
2231+ '{"file-1.text":"file-1.2ca234f380.text","file-2.text":"file-2.5938485188.text"}' ,
2232+ "a/__STATIC_CONTENT_MANIFEST" :
2233+ 'export { default } from "../__STATIC_CONTENT_MANIFEST";' ,
2234+ "a/b/__STATIC_CONTENT_MANIFEST" :
2235+ 'export { default } from "../../__STATIC_CONTENT_MANIFEST";' ,
2236+ "a/b/c/__STATIC_CONTENT_MANIFEST" :
2237+ 'export { default } from "../../../__STATIC_CONTENT_MANIFEST";' ,
22112238 } ,
22122239 } ) ;
22132240 mockSubDomainRequest ( ) ;
@@ -2218,10 +2245,15 @@ addEventListener('fetch', event => {});`
22182245 await runWrangler ( "deploy" ) ;
22192246
22202247 expect ( std . info ) . toMatchInlineSnapshot ( `
2221- "Fetching list of already uploaded assets...
2248+ "Attaching additional modules:
2249+ - a/1.mjs (esm)
2250+ - a/b/2.mjs (esm)
2251+ - a/b/3.mjs (esm)
2252+ - a/b/c/4.mjs (esm)
2253+ Fetching list of already uploaded assets...
22222254 Building list of assets to upload...
2223- + file-1.2ca234f380.txt (uploading new version of file-1.txt )
2224- + file-2.5938485188.txt (uploading new version of file-2.txt )
2255+ + file-1.2ca234f380.text (uploading new version of file-1.text )
2256+ + file-2.5938485188.text (uploading new version of file-2.text )
22252257 Uploading 2 new assets...
22262258 Uploaded 100% [2 out of 2]"
22272259 ` ) ;
0 commit comments