quickjs_jit_stdlib/llrt/llrt_utils/
io.rs1macro_rules! define_extension {
7 ($base:ident, $file:ident, $ext:expr) => {
8 #[allow(dead_code)]
9 pub const $base: &str = $ext;
10 #[allow(dead_code)]
11 pub const $file: &str = concat!(".", $ext);
12 };
13}
14
15define_extension!(BYTECODE_EXT, BYTECODE_FILE_EXT, "lrt");
16
17macro_rules! define_supported_extensions {
18 ($constant_ext:ident, $($ext:literal),*) => {
20 pub const SUPPORTED_EXTENSIONS: &[&str] = &[$($ext),*, $constant_ext];
22
23 pub const JS_EXTENSIONS: &[&str] = &[$($ext),*];
24
25 pub fn is_supported_ext(ext: &str) -> bool {
27 matches!(ext, $($ext)|* | $constant_ext)
28 }
29 };
30}
31
32define_supported_extensions!(BYTECODE_FILE_EXT, ".js", ".mjs", ".cjs");