|
| 1 | +import { basename, dirname } from 'https://deno.land/[email protected]/path/mod.ts' |
1 | 2 | import { createBlankRouterURL, RouteModule } from '../framework/core/routing.ts'
|
2 |
| -import { dirname, basename } from 'https://deno.land/[email protected]/path/mod.ts' |
3 | 3 | import log from '../shared/log.ts'
|
4 | 4 | import util from '../shared/util.ts'
|
5 | 5 | import type { RouterURL } from '../types.ts'
|
@@ -98,12 +98,12 @@ export class Renderer {
|
98 | 98 | const isDev = this.#app.isDev
|
99 | 99 | const state = { entryFile: '' }
|
100 | 100 | const appModule = this.#app.findModuleByName('app')
|
101 |
| - const { default: App } = appModule ? await import(`file://${appModule.jsFile}#${appModule.hash.slice(0, 6)}`) : {} as any |
| 101 | + const { default: App } = appModule ? await import(`file://${appModule.jsFile}#${appModule.hash.slice(0, 8)}`) : {} as any |
102 | 102 | const nestedPageComponents = await Promise.all(nestedModules
|
103 | 103 | .filter(({ url }) => this.#app.getModule(url) !== null)
|
104 | 104 | .map(async ({ url }) => {
|
105 | 105 | const { jsFile, hash } = this.#app.getModule(url)!
|
106 |
| - const { default: Component } = await import(`file://${jsFile}#${hash.slice(0, 6)}`) |
| 106 | + const { default: Component } = await import(`file://${jsFile}#${hash.slice(0, 8)}`) |
107 | 107 | state.entryFile = dirname(url) + '/' + basename(jsFile)
|
108 | 108 | return {
|
109 | 109 | url,
|
@@ -158,8 +158,8 @@ export class Renderer {
|
158 | 158 | async render404Page(url: RouterURL): Promise<string> {
|
159 | 159 | const appModule = this.#app.findModuleByName('app')
|
160 | 160 | const e404Module = this.#app.findModuleByName('404')
|
161 |
| - const { default: App } = appModule ? await import(`file://${appModule.jsFile}#${appModule.hash.slice(0, 6)}`) : {} as any |
162 |
| - const { default: E404 } = e404Module ? await import(`file://${e404Module.jsFile}#${e404Module.hash.slice(0, 6)}`) : {} as any |
| 161 | + const { default: App } = appModule ? await import(`file://${appModule.jsFile}#${appModule.hash.slice(0, 8)}`) : {} as any |
| 162 | + const { default: E404 } = e404Module ? await import(`file://${e404Module.jsFile}#${e404Module.hash.slice(0, 8)}`) : {} as any |
163 | 163 | const styles = await this.lookupStyleModules(...[
|
164 | 164 | appModule ? appModule.url : [],
|
165 | 165 | e404Module ? e404Module.url : []
|
@@ -198,7 +198,7 @@ export class Renderer {
|
198 | 198 | const loadingModule = this.#app.findModuleByName('loading')
|
199 | 199 |
|
200 | 200 | if (loadingModule) {
|
201 |
| - const { default: Loading } = await import(`file://${loadingModule.jsFile}#${loadingModule.hash.slice(0, 6)}`) |
| 201 | + const { default: Loading } = await import(`file://${loadingModule.jsFile}#${loadingModule.hash.slice(0, 8)}`) |
202 | 202 | const styles = await this.lookupStyleModules(loadingModule.url)
|
203 | 203 | const {
|
204 | 204 | head,
|
@@ -238,7 +238,7 @@ export class Renderer {
|
238 | 238 |
|
239 | 239 | private async lookupStyleModules(...urls: string[]): Promise<Record<string, string>> {
|
240 | 240 | return (await Promise.all(this.#app.lookupStyleModules(...urls).map(async ({ jsFile, hash }) => {
|
241 |
| - const { default: { __url$: url, __css$: css } } = await import(`file://${jsFile}#${hash.slice(0, 6)}`) |
| 241 | + const { default: { __url$: url, __css$: css } } = await import(`file://${jsFile}#${hash.slice(0, 8)}`) |
242 | 242 | return { url, css }
|
243 | 243 | }))).reduce((styles, mod) => {
|
244 | 244 | styles[mod.url] = mod.css
|
|
0 commit comments