@@ -2199,8 +2199,10 @@ addEventListener('fetch', event => {});`
21992199
22002200 it ( "when using a module worker type, it should add an asset manifest module, and bind to a namespace" , async ( ) => {
22012201 const assets = [
2202- { filePath : "file-1.txt" , content : "Content of file-1" } ,
2203- { filePath : "file-2.txt" , content : "Content of file-2" } ,
2202+ // Using `.text` extension instead of `.txt` means files won't be
2203+ // treated as additional modules
2204+ { filePath : "file-1.text" , content : "Content of file-1" } ,
2205+ { filePath : "file-2.text" , content : "Content of file-2" } ,
22042206 ] ;
22052207 const kvNamespace = {
22062208 title : "__test-name-workers_sites_assets" ,
@@ -2211,8 +2213,27 @@ addEventListener('fetch', event => {});`
22112213 site : {
22122214 bucket : "assets" ,
22132215 } ,
2216+ find_additional_modules : true ,
2217+ rules : [ { type : "ESModule" , globs : [ "**/*.mjs" ] } ] ,
22142218 } ) ;
22152219 writeWorkerSource ( { type : "esm" } ) ;
2220+ fs . mkdirSync ( "a/b/c" , { recursive : true } ) ;
2221+ fs . writeFileSync (
2222+ "a/1.mjs" ,
2223+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2224+ ) ;
2225+ fs . writeFileSync (
2226+ "a/b/2.mjs" ,
2227+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2228+ ) ;
2229+ fs . writeFileSync (
2230+ "a/b/3.mjs" ,
2231+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2232+ ) ;
2233+ fs . writeFileSync (
2234+ "a/b/c/4.mjs" ,
2235+ 'export { default } from "__STATIC_CONTENT_MANIFEST";'
2236+ ) ;
22162237 writeAssets ( assets ) ;
22172238 mockUploadWorkerRequest ( {
22182239 expectedBindings : [
@@ -2224,7 +2245,13 @@ addEventListener('fetch', event => {});`
22242245 ] ,
22252246 expectedModules : {
22262247 __STATIC_CONTENT_MANIFEST :
2227- '{"file-1.txt":"file-1.2ca234f380.txt","file-2.txt":"file-2.5938485188.txt"}' ,
2248+ '{"file-1.text":"file-1.2ca234f380.text","file-2.text":"file-2.5938485188.text"}' ,
2249+ "a/__STATIC_CONTENT_MANIFEST" :
2250+ 'export { default } from "../__STATIC_CONTENT_MANIFEST";' ,
2251+ "a/b/__STATIC_CONTENT_MANIFEST" :
2252+ 'export { default } from "../../__STATIC_CONTENT_MANIFEST";' ,
2253+ "a/b/c/__STATIC_CONTENT_MANIFEST" :
2254+ 'export { default } from "../../../__STATIC_CONTENT_MANIFEST";' ,
22282255 } ,
22292256 } ) ;
22302257 mockSubDomainRequest ( ) ;
@@ -2235,10 +2262,15 @@ addEventListener('fetch', event => {});`
22352262 await runWrangler ( "deploy" ) ;
22362263
22372264 expect ( std . info ) . toMatchInlineSnapshot ( `
2238- "Fetching list of already uploaded assets...
2265+ "Attaching additional modules:
2266+ - a/1.mjs (esm)
2267+ - a/b/2.mjs (esm)
2268+ - a/b/3.mjs (esm)
2269+ - a/b/c/4.mjs (esm)
2270+ Fetching list of already uploaded assets...
22392271 Building list of assets to upload...
2240- + file-1.2ca234f380.txt (uploading new version of file-1.txt )
2241- + file-2.5938485188.txt (uploading new version of file-2.txt )
2272+ + file-1.2ca234f380.text (uploading new version of file-1.text )
2273+ + file-2.5938485188.text (uploading new version of file-2.text )
22422274 Uploading 2 new assets...
22432275 Uploaded 100% [2 out of 2]"
22442276 ` ) ;
0 commit comments