Skip to content

Commit 1236377

Browse files
author
Bartek Wrona
committed
Replace require('node:tty') with library symbol in libnoderawfs.js
NODERAWFS postset used require('node:tty') directly, which breaks in ESM output (.mjs) where require is not available. Extract it into a $nodeTTY library symbol using makeNodeImport, matching the pattern used by $nodePath and other node module imports. This fixes all _rawfs test failures in test-esm-integration and test-modularize-instance.
1 parent d68b648 commit 1236377

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/libnoderawfs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*/
66

77
addToLibrary({
8-
$NODERAWFS__deps: ['$ERRNO_CODES', '$FS', '$NODEFS', '$mmapAlloc', '$FS_modeStringToFlags', '$NODERAWFS_stream_funcs'],
8+
$nodeTTY: "{{{ makeNodeImport('node:tty', false) }}}",
9+
$NODERAWFS__deps: ['$ERRNO_CODES', '$FS', '$NODEFS', '$mmapAlloc', '$FS_modeStringToFlags', '$NODERAWFS_stream_funcs', '$nodeTTY'],
910
$NODERAWFS__postset: `
1011
if (!ENVIRONMENT_IS_NODE) {
1112
throw new Error("NODERAWFS is currently only supported on Node.js environment.")
1213
}
13-
var nodeTTY = require('node:tty');
1414
function _wrapNodeError(func) {
1515
return (...args) => {
1616
try {

0 commit comments

Comments
 (0)