@@ -2184,6 +2184,15 @@ def create_esm_wrapper(wrapper_file, support_target, wasm_target):
21842184 shared .check_call (cmd , input = mod )
21852185
21862186
2187+ def convert_line_endings_in_file (filename , to_eol ):
2188+ if to_eol == os .linesep :
2189+ assert os .path .exists (filename )
2190+ return # No conversion needed
2191+
2192+ text = read_file (filename )
2193+ write_file (filename , text , line_endings = to_eol )
2194+
2195+
21872196@ToolchainProfiler .profile_block ('final emitting' )
21882197def phase_final_emitting (options , target , js_target , wasm_target ):
21892198 global final_js
@@ -2246,7 +2255,7 @@ def phase_final_emitting(options, target, js_target, wasm_target):
22462255
22472256 target_basename = unsuffixed_basename (target )
22482257
2249- utils . convert_line_endings_in_file (js_target , options .output_eol )
2258+ convert_line_endings_in_file (js_target , options .output_eol )
22502259
22512260 # If we were asked to also generate HTML, do that
22522261 if options .oformat == OFormat .HTML :
@@ -2636,7 +2645,7 @@ def generate_html(target, options, js_target, target_basename, wasm_target):
26362645 if settings .MINIFY_HTML and (settings .OPT_LEVEL >= 1 or settings .SHRINK_LEVEL >= 1 ):
26372646 minify_html (target )
26382647
2639- utils . convert_line_endings_in_file (target , options .output_eol )
2648+ convert_line_endings_in_file (target , options .output_eol )
26402649
26412650
26422651def find_library (lib , lib_dirs ):
0 commit comments