Skip to main content

quickjs_detect_module_bytes

Function quickjs_detect_module_bytes 

Source
pub fn quickjs_detect_module_bytes(source: &[u8]) -> bool
Expand description

Apply QuickJS’s module-detection heuristic to an explicitly sized source buffer without decoding or replacing authored bytes.

Like upstream JS_DetectModule, the shebang scan observes the explicit buffer length, while the following simple token scanner treats an embedded NUL as end of input. Malformed UTF-8 is skipped inside comments and a shebang but remains a non-identifier token everywhere else.