(filename, expand_macros=False)
| 1337 | |
| 1338 | |
| 1339 | def read_and_preprocess(filename, expand_macros=False): |
| 1340 | # Create a settings file with the current settings to pass to the JS preprocessor |
| 1341 | settings_json = json.dumps(settings.external_dict(), sort_keys=True, indent=2) |
| 1342 | write_intermediate(settings_json, 'settings.json') |
| 1343 | |
| 1344 | # Run the JS preprocessor |
| 1345 | dirname, filename = os.path.split(filename) |
| 1346 | if not dirname: |
| 1347 | dirname = None |
| 1348 | args = ['-', filename] |
| 1349 | if expand_macros: |
| 1350 | args += ['--expand-macros'] |
| 1351 | |
| 1352 | return shared.run_js_tool(path_from_root('tools/preprocessor.mjs'), args, input=settings_json, stdout=subprocess.PIPE, cwd=dirname) |
| 1353 | |
| 1354 | |
| 1355 | def js_legalization_pass_flags(): |
nothing calls this directly
no test coverage detected