@@ -78,6 +78,32 @@ function updateAssetFile(filePath, renameMap) {
7878
7979 let content = fs . readFileSync ( filePath , 'utf8' ) ;
8080
81+ // Handle compressed navigation.js (base64 + pako)
82+ if ( filePath . endsWith ( 'navigation.js' ) ) {
83+ const match = content . match ( / w i n d o w \. n a v i g a t i o n D a t a = " ( [ ^ " ] + ) " / ) ;
84+ if ( match ) {
85+ try {
86+ const pako = require ( 'pako' ) ;
87+ const decoded = Buffer . from ( match [ 1 ] , 'base64' ) ;
88+ let jsonStr = pako . inflate ( decoded , { to : 'string' } ) ;
89+
90+ // Update references to lowercase in the JSON
91+ for ( const [ original , lowercase ] of renameMap ) {
92+ jsonStr = jsonStr . replace ( new RegExp ( original . replace ( '.' , '\\.' ) , 'g' ) , lowercase ) ;
93+ }
94+
95+ // Re-compress and encode
96+ const compressed = pako . deflate ( jsonStr ) ;
97+ const encoded = Buffer . from ( compressed ) . toString ( 'base64' ) ;
98+ content = `window.navigationData = "${ encoded } "` ;
99+ fs . writeFileSync ( filePath , content , 'utf8' ) ;
100+ return ;
101+ } catch ( e ) {
102+ console . warn ( 'Failed to process navigation.js:' , e . message ) ;
103+ }
104+ }
105+ }
106+
81107 // Format for readability (search.js specific)
82108 if ( filePath . endsWith ( 'search.js' ) ) {
83109 content = content . replace ( / " , " / g, '",\n"' ) ;
0 commit comments