()
| 2476 | |
| 2477 | |
| 2478 | def module_export_name_substitution(): |
| 2479 | assert not settings.MODULARIZE |
| 2480 | global final_js |
| 2481 | logger.debug(f'Private module export name substitution with {settings.EXPORT_NAME}') |
| 2482 | src = read_file(final_js) |
| 2483 | final_js += '.module_export_name_substitution.js' |
| 2484 | if settings.MINIMAL_RUNTIME and not settings.ENVIRONMENT_MAY_BE_NODE and not settings.ENVIRONMENT_MAY_BE_SHELL and not settings.ENVIRONMENT_MAY_BE_AUDIO_WORKLET: |
| 2485 | # On the web, with MINIMAL_RUNTIME, the Module object is always provided |
| 2486 | # via the shell html in order to provide the .asm.js/.wasm content. |
| 2487 | replacement = settings.EXPORT_NAME |
| 2488 | else: |
| 2489 | replacement = "typeof %(EXPORT_NAME)s != 'undefined' ? %(EXPORT_NAME)s : {}" % {"EXPORT_NAME": settings.EXPORT_NAME} |
| 2490 | new_src = re.sub(r'{\s*[\'"]?__EMSCRIPTEN_PRIVATE_MODULE_EXPORT_NAME_SUBSTITUTION__[\'"]?:\s*1\s*}', replacement, src) |
| 2491 | assert new_src != src, 'Unable to find Closure syntax __EMSCRIPTEN_PRIVATE_MODULE_EXPORT_NAME_SUBSTITUTION__ in source!' |
| 2492 | write_file(final_js, new_src) |
| 2493 | shared.get_temp_files().note(final_js) |
| 2494 | save_intermediate('module_export_name_substitution') |
| 2495 | |
| 2496 | |
| 2497 | def generate_traditional_runtime_html(target, options, js_target, wasm_target): |
no test coverage detected