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