boot-function #1
							
								
								
									
										16
									
								
								local.tsx
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								local.tsx
									
									
									
									
									
								
							| @ -31,18 +31,8 @@ Configure({ | |||||||
|         }); |         }); | ||||||
|         return inImports; |         return inImports; | ||||||
|     }, |     }, | ||||||
|     async Serve(inReq, inURL, inExt, inMap) |     Serve(inReq, inURL, inExt, inMap) | ||||||
|     { |     { | ||||||
|         if(inURL.pathname.startsWith("/hmr/")) |  | ||||||
|         { |  | ||||||
|             const path = import.meta.url+"/.."+inURL.pathname; |  | ||||||
|             const code = await Transpile.Fetch(path, inURL.pathname, true); |  | ||||||
|             if(code) |  | ||||||
|             { |  | ||||||
|                 return new Response(code, {headers:{"content-type":"application/javascript"}}) |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if(inReq.headers.get("upgrade") == "websocket") |         if(inReq.headers.get("upgrade") == "websocket") | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
| @ -54,9 +44,7 @@ Configure({ | |||||||
|               socket.onerror = (e) => console.log("Socket errored:", e); |               socket.onerror = (e) => console.log("Socket errored:", e); | ||||||
|               return response; |               return response; | ||||||
|             } |             } | ||||||
|             catch(e) |             catch(e){ /**/ } | ||||||
|             { |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								serve.tsx
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								serve.tsx
									
									
									
									
									
								
							| @ -177,10 +177,22 @@ HTTP.serve(async(req: Request)=> | |||||||
| 
 | 
 | ||||||
|     // transpileable files
 |     // transpileable files
 | ||||||
|     if(Transpile.Check(ext)) |     if(Transpile.Check(ext)) | ||||||
|  |     { | ||||||
|  |         if(url.pathname.startsWith("/_lib_/")) | ||||||
|  |         { | ||||||
|  |             const path = import.meta.url+"/.."+url.pathname; | ||||||
|  |             const code = await Transpile.Fetch(path, url.pathname, true); | ||||||
|  |             if(code) | ||||||
|  |             { | ||||||
|  |                 return new Response(code, {headers:{"content-type":"application/javascript"}}); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         else | ||||||
|         { |         { | ||||||
|             const lookup = await Transpile.Fetch(Configuration.Proxy + url.pathname, url.pathname); |             const lookup = await Transpile.Fetch(Configuration.Proxy + url.pathname, url.pathname); | ||||||
|             return new Response(lookup, {status:lookup?200:404, headers:{...headers, "content-type":"application/javascript"}} );             |             return new Response(lookup, {status:lookup?200:404, headers:{...headers, "content-type":"application/javascript"}} );             | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     // all other static files
 |     // all other static files
 | ||||||
|     if(ext) |     if(ext) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user