@@ -21,7 +21,7 @@ import { get_manifest_routes } from '../../../core/sync/write_app_manifest.js';
2121import { write_client_manifest } from '../../../core/sync/write_client_manifest.js' ;
2222import { logger , runtime_directory } from '../../../core/utils.js' ;
2323import { compact } from '../../../utils/array.js' ;
24- import { copy , read , resolve_entry } from '../../../utils/filesystem.js' ;
24+ import { copy , read , resolve_entry , walk } from '../../../utils/filesystem.js' ;
2525import { load_and_validate_params } from '../../../utils/params.js' ;
2626import { posixify } from '../../../utils/os.js' ;
2727import { stackless } from '../../../utils/error.js' ;
@@ -1106,31 +1106,24 @@ const replace_manifest_placeholder_variables = (chunks, output_dir, values) => {
11061106 * }} values
11071107 */
11081108const replace_manifest_placeholder_strings = ( dir , values ) => {
1109- /** @type {Record< string, string> } */
1110- const replacements = { } ;
1109+ /** @type {Array<[ string, string] > } */
1110+ const replacements = [ ] ;
11111111
11121112 if ( values . immutable !== undefined ) {
1113- replacements [ '__sveltekit_manifest_build__' ] = JSON . stringify ( values . immutable ) ;
1113+ replacements . push ( [ '__sveltekit_manifest_build__' , JSON . stringify ( values . immutable ) ] ) ;
11141114 }
11151115 if ( values . prerendered !== undefined ) {
1116- replacements [ '__sveltekit_manifest_prerendered__' ] = JSON . stringify ( values . prerendered ) ;
1116+ replacements . push ( [ '__sveltekit_manifest_prerendered__' , JSON . stringify ( values . prerendered ) ] ) ;
11171117 }
11181118
1119- for ( const file of fs . readdirSync ( dir ) ) {
1120- const file_path = `${ dir } /${ file } ` ;
1121- const stat = fs . statSync ( file_path ) ;
1122-
1123- if ( stat . isDirectory ( ) ) {
1124- replace_manifest_placeholder_strings ( file_path , values ) ;
1125- continue ;
1126- }
1127-
1119+ for ( const file of walk ( dir ) ) {
11281120 if ( ! file . endsWith ( '.js' ) ) continue ;
11291121
1122+ const file_path = `${ dir } /${ file } ` ;
11301123 let code = read ( file_path ) ;
11311124 let changed = false ;
11321125
1133- for ( const [ sentinel , replacement ] of Object . entries ( replacements ) ) {
1126+ for ( const [ sentinel , replacement ] of replacements ) {
11341127 if ( code . includes ( sentinel ) ) {
11351128 code = code . replaceAll ( `"${ sentinel } "` , replacement ) ;
11361129 changed = true ;
0 commit comments