File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 1+ import { join , parse } from "node:path" ;
2+
3+ export function hashremap ( input : string , hash : string ) {
4+ const parsed = parse ( input ) ;
5+ return `${ join ( parsed . dir , parsed . name ) } -${ hash } ${ parsed . ext } ` ;
6+ }
7+
8+ export function generateHashedName ( name : string , hash : Record < string , string > ) {
9+ return hash [ name ] ? hashremap ( name , hash [ name ] ) : name ;
10+ }
Original file line number Diff line number Diff line change 11import { FileSystemRouter , type BunFile } from "bun" ;
22import { NJSON } from "next-json" ;
33import { readFileSync , statSync } from "node:fs" ;
4- import { join , parse , relative } from "node:path" ;
4+ import { join , relative } from "node:path" ;
55import { renderToReadableStream } from "react-dom/server" ;
66import { ClientOnlyError } from "./client" ;
7+ import { hashremap } from "./hash" ;
78import { MetaContext , PreloadModule } from "./preload" ;
89
910export class StaticRouters {
@@ -225,11 +226,6 @@ function* scanCacheDependencies(
225226 } catch { }
226227}
227228
228- function hashremap ( input : string , hash : string ) {
229- const parsed = parse ( input ) ;
230- return `${ join ( parsed . dir , parsed . name ) } -${ hash } ${ parsed . ext } ` ;
231- }
232-
233229export class StaticFileCache {
234230 #cache = new Map < string , BunFile > ( ) ;
235231 constructor ( public base : string ) { }
Original file line number Diff line number Diff line change 11import { createContext , use } from "react" ;
22import { preloadModule , type PreloadModuleOptions } from "react-dom" ;
3+ import { generateHashedName } from "./hash" ;
34
45// @ignore
56export const MetaContext = createContext < {
@@ -19,10 +20,6 @@ function* walkDependencies(
1920 }
2021}
2122
22- function generateHashedName ( name : string , hash : Record < string , string > ) {
23- return hash [ name ] ? `${ name } ?${ hash [ name ] } ` : name ;
24- }
25-
2623export function PreloadModule ( {
2724 module,
2825 ...options
You can’t perform that action at this time.
0 commit comments