Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/library_nodefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

mergeInto(LibraryManager.library, {
$NODEFS__deps: ['$FS', '$PATH', '$ERRNO_CODES', '$mmapAlloc'],
$NODEFS__postset: 'if (ENVIRONMENT_IS_NODE) { requireNodeFS(); NODEFS.staticInit(); }',
$NODEFS__postset: 'if (ENVIRONMENT_IS_NODE) { NODEFS.staticInit(); }',
$NODEFS: {
isWindows: false,
staticInit: () => {
Expand Down
17 changes: 3 additions & 14 deletions src/node_shell_read.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@
* SPDX-License-Identifier: MIT
*/

var fs;
var nodePath;

var requireNodeFS = () => {
// Use nodePath as the indicator for these not being initialized,
// since in some environments a global fs may have already been
// created.
if (!nodePath) {
fs = require('fs');
nodePath = require('path');
}
};
// These modules will usually be used on Node.js.
var fs = require('fs');
var nodePath = require('path');

read_ = (filename, binary) => {
#if SUPPORT_BASE64_EMBEDDING
Expand All @@ -24,7 +15,6 @@ read_ = (filename, binary) => {
return binary ? ret : ret.toString();
}
#endif
requireNodeFS();
filename = nodePath['normalize'](filename);
return fs.readFileSync(filename, binary ? undefined : 'utf8');
};
Expand All @@ -47,7 +37,6 @@ readAsync = (filename, onload, onerror) => {
onload(ret);
}
#endif
requireNodeFS();
filename = nodePath['normalize'](filename);
fs.readFile(filename, function(err, data) {
if (err) onerror(err);
Expand Down
1 change: 0 additions & 1 deletion src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ function instantiateSync(file, info) {
// to load ok, but we do actually recompile the binary every time).
var cachedCodeFile = '{{{ WASM_BINARY_FILE }}}.' + v8.cachedDataVersionTag() + '.cached';
cachedCodeFile = locateFile(cachedCodeFile);
requireNodeFS();
var hasCached = fs.existsSync(cachedCodeFile);
if (hasCached) {
#if RUNTIME_LOGGING
Expand Down
2 changes: 0 additions & 2 deletions src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ if (ENVIRONMENT_IS_NODE) {
#if WASM == 2
// If target shell does not support Wasm, load the JS version of the code.
if (typeof WebAssembly == 'undefined') {
requireNodeFS();
eval(fs.readFileSync(locateFile('{{{ TARGET_BASENAME }}}.wasm.js'))+'');
}
#endif
Expand Down Expand Up @@ -423,7 +422,6 @@ if (ENVIRONMENT_IS_NODE) {
var defaultPrint = console.log.bind(console);
var defaultPrintErr = console.warn.bind(console);
if (ENVIRONMENT_IS_NODE) {
requireNodeFS();
defaultPrint = (str) => fs.writeSync(1, str + '\n');
defaultPrintErr = (str) => fs.writeSync(2, str + '\n');
}
Expand Down
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_ctors1.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
25955
25925
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_ctors2.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
25919
25889
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_except.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
31454
31422
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_except_wasm.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
26109
26079
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_mangle.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
31553
31521
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_noexcept.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
25955
25925
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
26205
26149
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O1.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9145
9089
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O2.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6539
6511
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O3.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5989
5961
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_Os.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5989
5961
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_Oz.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5948
5920
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4667
4641
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5259
5234
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5258
5233
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6150
6122
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3_grow.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6481
6453
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5754
5727
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3_standalone.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5678
5651
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5260
5235
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5258
5233
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5258
5233
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22908
22852
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O1.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5660
5607
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O2.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4374
4348
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O3.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3883
3857
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_Os.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3883
3857
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_Oz-ctors.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3772
3746
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_Oz.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3883
3857
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_pthreads.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15790
15756
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_pthreads.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18307
18301
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
67175
66962
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_no_asserts.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
39976
39763
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_strict.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
66041
65828