Skip to content

Commit fb7ad9d

Browse files
authored
Move compiler.mjs to tools/ directory. NFC (emscripten-core#23643)
For consistency with the other JS entry points we have (preprocessor.mjs and acorn-optimizer.mjs) that already live in the tools directory.
1 parent 06efef8 commit fb7ad9d

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

site/source/docs/contributing/developers_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The :ref:`Emscripten Compiler Frontend (emcc) <emccdoc>` is a python script that
8282
- **emcc** then calls `emscripten.py <https://github.com/emscripten-core/emscripten/blob/main/tools/emscripten.py>`_
8383
which performs the final transformation to Wasm (including invoking
8484
**wasm-emscripten-finalize** from Binaryen) and calls the JS compiler
85-
(see ``src/compiler.mjs`` and related files) which emits the JS.
85+
(see ``tools/compiler.mjs`` and related files) which emits the JS.
8686
- If optimizing Wasm, **emcc** will then call **wasm-opt**, run meta-dce, and
8787
other useful things. It will also run JS optimizations on the JS that is
8888
emitted alongside the Wasm.

src/compiler.mjs renamed to tools/compiler.mjs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99

1010
import assert from 'node:assert';
1111
import {parseArgs} from 'node:util';
12-
import {Benchmarker, applySettings, loadDefaultSettings, printErr, readFile} from './utility.mjs';
12+
import {
13+
Benchmarker,
14+
applySettings,
15+
loadDefaultSettings,
16+
printErr,
17+
readFile,
18+
} from '../src/utility.mjs';
1319

1420
loadDefaultSettings();
1521

@@ -70,12 +76,12 @@ assert(
7076
// We can't use static import statements here because several of these
7177
// file depend on having the settings defined in the global scope (which
7278
// we do dynamically above.
73-
await import('./modules.mjs');
74-
await import('./parseTools.mjs');
79+
await import('../src/modules.mjs');
80+
await import('../src/parseTools.mjs');
7581
if (!STRICT) {
76-
await import('./parseTools_legacy.mjs');
82+
await import('../src/parseTools_legacy.mjs');
7783
}
78-
const jsifier = await import('./jsifier.mjs');
84+
const jsifier = await import('../src/jsifier.mjs');
7985

8086
// ===============================
8187
// Main
@@ -93,7 +99,7 @@ try {
9399
printErr(err);
94100
} else {
95101
// Compiler failed on internal compiler error!
96-
printErr('Internal compiler error in src/compiler.mjs!');
102+
printErr('Internal compiler error JS compiler');
97103
printErr('Please create a bug report at https://github.com/emscripten-core/emscripten/issues/');
98104
printErr(
99105
'with a log of the build and the input files used to run. Exception message: "' +

tools/emscripten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def compile_javascript(symbols_only=False):
190190
args = [settings_file]
191191
if symbols_only:
192192
args += ['--symbols-only']
193-
out = shared.run_js_tool(path_from_root('src/compiler.mjs'),
193+
out = shared.run_js_tool(path_from_root('tools/compiler.mjs'),
194194
args, stdout=subprocess.PIPE, stderr=stderr_file, encoding='utf-8')
195195
if symbols_only:
196196
glue = None

tools/maint/gen_sig_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def extract_sig_info(sig_info, extra_settings=None, extra_cflags=None, cxx=False
320320
settings.update(extra_settings)
321321
with tempfiles.get_file('.json') as settings_json:
322322
utils.write_file(settings_json, json.dumps(settings))
323-
output = shared.run_js_tool(utils.path_from_root('src/compiler.mjs'),
323+
output = shared.run_js_tool(utils.path_from_root('tools/compiler.mjs'),
324324
['--symbols-only', settings_json],
325325
stdout=subprocess.PIPE)
326326
symbols = json.loads(output)['deps'].keys()

0 commit comments

Comments
 (0)