use metacall::{loaders, switch};
fn main() {
let _metacall = switch::initialize().unwrap();
loaders::from_memory("node", "console.log('Hello world')").unwrap();
}
behavior
Exception in node_loader_trampoline_load_from_memory while loading: console.log('Hello world' 0x5b3b086100b0-0x5b3b08610080-26-2913836576:1
console.log('Hello world'
^^^^^^^^^^^^^
SyntaxError: missing ) after argument list
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at node_loader_trampoline_load_from_memory (/gnu/store/ka685gr3ah26nmjfny1kwixmv2nsc2ms-metacall-0.7.8/lib/bootstrap.js:182:5)
🐛 Bug Report
the script that is loaded from memory lost the last character because its size is not correct and misses a one-character from its length.
Possible Solution
https://github.com/metacall/core/blob/76f02c051c9bfd84926331f8ada8b9506a12f04d/source/ports/rs_port/src/loaders.rs#L82-L87
Steps to Reproduce
source code
behavior