@@ -4,7 +4,7 @@ import { E400MissingDefaultExportAsComponent, E404Page, ErrorBoundary } from './
44import events from './events.ts'
55import { createPageProps , RouteModule , Routing } from './routing.ts'
66import type { RouterURL } from './types.ts'
7- import util , { hashShort , reModuleExt } from './util.ts'
7+ import util , { hashShort , reHttp } from './util.ts'
88
99export function ALEPH ( { initial } : {
1010 initial : {
@@ -50,7 +50,7 @@ export function ALEPH({ initial }: {
5050 if ( mod . deps ) {
5151 // import async dependencies
5252 for ( const dep of mod . deps . filter ( ( { isStyle } ) => ! ! isStyle ) ) {
53- await import ( getModuleImportUrl ( baseUrl , { id : dep . url . replace ( reModuleExt , '.js' ) , hash : dep . hash } , e . forceRefetch ) )
53+ await import ( getModuleImportUrl ( baseUrl , { id : util . ensureExt ( dep . url . replace ( reHttp , '/-/' ) , '.js' ) , hash : dep . hash } , e . forceRefetch ) )
5454 }
5555 if ( mod . deps . filter ( ( { isData, url } ) => ! ! isData && url . startsWith ( '#useDeno.' ) ) . length > 0 ) {
5656 const { default : data } = await import ( `/_aleph/data${ [ url . pathname , url . query . toString ( ) ] . filter ( Boolean ) . join ( '@' ) } /data.js` + ( e . forceRefetch ? `?t=${ Date . now ( ) } ` : '' ) )
@@ -146,7 +146,7 @@ export function ALEPH({ initial }: {
146146 if ( mod . deps ) {
147147 // import async dependencies
148148 for ( const dep of mod . deps . filter ( ( { isStyle } ) => ! ! isStyle ) ) {
149- await import ( getModuleImportUrl ( baseUrl , { id : dep . url . replace ( reModuleExt , '.js' ) , hash : dep . hash } ) )
149+ await import ( getModuleImportUrl ( baseUrl , { id : util . ensureExt ( dep . url . replace ( reHttp , '/-/' ) , '.js' ) , hash : dep . hash } ) )
150150 }
151151 if ( mod . deps . filter ( ( { isData, url } ) => ! ! isData && url . startsWith ( '#useDeno.' ) ) . length > 0 ) {
152152 const { default : data } = await import ( `/_aleph/data${ [ url . pathname , url . query . toString ( ) ] . filter ( Boolean ) . join ( '@' ) } /data.js` )
@@ -208,7 +208,7 @@ export function ALEPH({ initial }: {
208208}
209209
210210export function getModuleImportUrl ( baseUrl : string , mod : RouteModule , forceRefetch = false ) {
211- return util . cleanPath ( baseUrl + '/_aleph/' + util . trimSuffix ( mod . id , '.js' ) + `.${ mod . hash . slice ( 0 , hashShort ) } .js` + ( forceRefetch ? `?t=${ Date . now ( ) } ` : '' ) )
211+ return util . cleanPath ( baseUrl + '/_aleph/' + ( mod . id . startsWith ( '/-/' ) ? mod . id : util . trimSuffix ( mod . id , '.js' ) + `.${ mod . hash . slice ( 0 , hashShort ) } .js` ) + ( forceRefetch ? `?t=${ Date . now ( ) } ` : '' ) )
212212}
213213
214214export async function redirect ( url : string , replace ?: boolean ) {
0 commit comments