use super::{GlobalNames, GlobalSet, Globals};
const DATA: &[u8; 33711] = include_bytes!("data.bin");
const fn bytes<const START: usize, const LEN: usize>() -> [u8; LEN] {
let mut values = [0; LEN];
let mut index = 0;
while index < LEN {
values[index] = DATA[START + index];
index += 1;
}
values
}
const fn u16s<const START: usize, const LEN: usize>() -> [u16; LEN] {
let mut values = [0; LEN];
let mut index = 0;
while index < LEN {
let offset = START + index * 2;
values[index] = u16::from_le_bytes([DATA[offset], DATA[offset + 1]]);
index += 1;
}
values
}
const fn u32s<const START: usize, const LEN: usize>() -> [u32; LEN] {
let mut values = [0; LEN];
let mut index = 0;
while index < LEN {
let offset = START + index * 4;
values[index] = u32::from_le_bytes([
DATA[offset],
DATA[offset + 1],
DATA[offset + 2],
DATA[offset + 3],
]);
index += 1;
}
values
}
const fn global_name_refs(names: &'static [u8], offsets: &'static [u16]) -> [&'static str; 1638] {
let mut refs = [""; 1638];
let mut index = 0;
while index < refs.len() {
let start = offsets[index] as usize;
let end = offsets[index + 1] as usize;
refs[index] = unsafe {
let bytes = core::slice::from_raw_parts(names.as_ptr().add(start), end - start);
core::str::from_utf8_unchecked(bytes)
};
index += 1;
}
refs
}
pub(super) const GLOBAL_NAME_COUNT: usize = 1638;
pub(super) const GLOBAL_NAME_BYTES: usize = 205;
pub(super) static GLOBAL_NAMES: GlobalNames = GlobalNames {
seed: 16287231350648472473,
pilots: &bytes::<0x0000, 549>(),
remap: &u32s::<0x0225, 17>(),
names: &bytes::<0x0269, 22100>(),
offsets: &u16s::<0x58bd, 1639>(),
};
pub(super) static GLOBAL_NAME_REFS: [&str; 1638] =
global_name_refs(GLOBAL_NAMES.names, GLOBAL_NAMES.offsets);
#[rustfmt::skip]
pub static GLOBALS_BUILTIN: GlobalSet = GlobalSet { members: &bytes::<0x658b, 205>(), writable: &u16s::<0x6658, 0>() };
#[rustfmt::skip]
pub static GLOBALS_ES6: GlobalSet = GlobalSet { members: &bytes::<0x6658, 205>(), writable: &u16s::<0x6725, 0>() };
pub use GLOBALS_ES6 as GLOBALS_ES2015;
pub use GLOBALS_ES6 as GLOBALS_ES2016;
#[rustfmt::skip]
pub static GLOBALS_ES2017: GlobalSet = GlobalSet { members: &bytes::<0x6725, 205>(), writable: &u16s::<0x67f2, 0>() };
pub use GLOBALS_ES2017 as GLOBALS_ES2018;
pub use GLOBALS_ES2017 as GLOBALS_ES2019;
#[rustfmt::skip]
pub static GLOBALS_ES2020: GlobalSet = GlobalSet { members: &bytes::<0x67f2, 205>(), writable: &u16s::<0x68bf, 0>() };
#[rustfmt::skip]
pub static GLOBALS_ES2021: GlobalSet = GlobalSet { members: &bytes::<0x68bf, 205>(), writable: &u16s::<0x698c, 0>() };
pub use GLOBALS_ES2021 as GLOBALS_ES2022;
pub use GLOBALS_ES2021 as GLOBALS_ES2023;
pub use GLOBALS_ES2021 as GLOBALS_ES2024;
#[rustfmt::skip]
pub static GLOBALS_ES2025: GlobalSet = GlobalSet { members: &bytes::<0x698c, 205>(), writable: &u16s::<0x6a59, 0>() };
pub use GLOBALS_ES2025 as GLOBALS_ES2026;
#[rustfmt::skip]
pub static GLOBALS_AUDIOWORKLET: GlobalSet = GlobalSet { members: &bytes::<0x6a59, 205>(), writable: &u16s::<0x6b26, 0>() };
#[rustfmt::skip]
pub static GLOBALS_BROWSER: GlobalSet = GlobalSet { members: &bytes::<0x6b26, 205>(), writable: &u16s::<0x6bf3, 125>() };
#[rustfmt::skip]
pub static GLOBALS_BUN: GlobalSet = GlobalSet { members: &bytes::<0x6ced, 205>(), writable: &u16s::<0x6dba, 2>() };
#[rustfmt::skip]
pub static GLOBALS_NODE: GlobalSet = GlobalSet { members: &bytes::<0x6dbe, 205>(), writable: &u16s::<0x6e8b, 1>() };
#[rustfmt::skip]
pub static GLOBALS_SHARED_NODE_BROWSER: GlobalSet = GlobalSet { members: &bytes::<0x6e8d, 205>(), writable: &u16s::<0x6f5a, 0>() };
#[rustfmt::skip]
pub static GLOBALS_WORKER: GlobalSet = GlobalSet { members: &bytes::<0x6f5a, 205>(), writable: &u16s::<0x7027, 9>() };
#[rustfmt::skip]
pub static GLOBALS_SERVICEWORKER: GlobalSet = GlobalSet { members: &bytes::<0x7039, 205>(), writable: &u16s::<0x7106, 25>() };
#[rustfmt::skip]
pub static GLOBALS_AMD: GlobalSet = GlobalSet { members: &bytes::<0x7138, 205>(), writable: &u16s::<0x7205, 0>() };
#[rustfmt::skip]
pub static GLOBALS_APPLESCRIPT: GlobalSet = GlobalSet { members: &bytes::<0x7205, 205>(), writable: &u16s::<0x72d2, 0>() };
#[rustfmt::skip]
pub static GLOBALS_ASTRO: GlobalSet = GlobalSet { members: &bytes::<0x72d2, 205>(), writable: &u16s::<0x739f, 0>() };
#[rustfmt::skip]
pub static GLOBALS_ATOMTEST: GlobalSet = GlobalSet { members: &bytes::<0x739f, 205>(), writable: &u16s::<0x746c, 0>() };
#[rustfmt::skip]
pub static GLOBALS_COMMONJS: GlobalSet = GlobalSet { members: &bytes::<0x746c, 205>(), writable: &u16s::<0x7539, 1>() };
#[rustfmt::skip]
pub static GLOBALS_EMBERTEST: GlobalSet = GlobalSet { members: &bytes::<0x753b, 205>(), writable: &u16s::<0x7608, 0>() };
#[rustfmt::skip]
pub static GLOBALS_GREASEMONKEY: GlobalSet = GlobalSet { members: &bytes::<0x7608, 205>(), writable: &u16s::<0x76d5, 0>() };
#[rustfmt::skip]
pub static GLOBALS_JASMINE: GlobalSet = GlobalSet { members: &bytes::<0x76d5, 205>(), writable: &u16s::<0x77a2, 0>() };
#[rustfmt::skip]
pub static GLOBALS_JEST: GlobalSet = GlobalSet { members: &bytes::<0x77a2, 205>(), writable: &u16s::<0x786f, 0>() };
#[rustfmt::skip]
pub static GLOBALS_JQUERY: GlobalSet = GlobalSet { members: &bytes::<0x786f, 205>(), writable: &u16s::<0x793c, 0>() };
#[rustfmt::skip]
pub static GLOBALS_METEOR: GlobalSet = GlobalSet { members: &bytes::<0x793c, 205>(), writable: &u16s::<0x7a09, 0>() };
#[rustfmt::skip]
pub static GLOBALS_MOCHA: GlobalSet = GlobalSet { members: &bytes::<0x7a09, 205>(), writable: &u16s::<0x7ad6, 0>() };
#[rustfmt::skip]
pub static GLOBALS_MONGO: GlobalSet = GlobalSet { members: &bytes::<0x7ad6, 205>(), writable: &u16s::<0x7ba3, 0>() };
#[rustfmt::skip]
pub static GLOBALS_NASHORN: GlobalSet = GlobalSet { members: &bytes::<0x7ba3, 205>(), writable: &u16s::<0x7c70, 0>() };
#[rustfmt::skip]
pub static GLOBALS_PROTRACTOR: GlobalSet = GlobalSet { members: &bytes::<0x7c70, 205>(), writable: &u16s::<0x7d3d, 0>() };
#[rustfmt::skip]
pub static GLOBALS_PROTOTYPEJS: GlobalSet = GlobalSet { members: &bytes::<0x7d3d, 205>(), writable: &u16s::<0x7e0a, 0>() };
#[rustfmt::skip]
pub static GLOBALS_PHANTOMJS: GlobalSet = GlobalSet { members: &bytes::<0x7e0a, 205>(), writable: &u16s::<0x7ed7, 5>() };
#[rustfmt::skip]
pub static GLOBALS_SHELLJS: GlobalSet = GlobalSet { members: &bytes::<0x7ee1, 205>(), writable: &u16s::<0x7fae, 0>() };
#[rustfmt::skip]
pub static GLOBALS_SVELTE: GlobalSet = GlobalSet { members: &bytes::<0x7fae, 205>(), writable: &u16s::<0x807b, 0>() };
#[rustfmt::skip]
pub static GLOBALS_WEBEXTENSIONS: GlobalSet = GlobalSet { members: &bytes::<0x807b, 205>(), writable: &u16s::<0x8148, 0>() };
#[rustfmt::skip]
pub static GLOBALS_QUNIT: GlobalSet = GlobalSet { members: &bytes::<0x8148, 205>(), writable: &u16s::<0x8215, 0>() };
#[rustfmt::skip]
pub static GLOBALS_VITEST: GlobalSet = GlobalSet { members: &bytes::<0x8215, 205>(), writable: &u16s::<0x82e2, 0>() };
#[rustfmt::skip]
pub static GLOBALS_VUE: GlobalSet = GlobalSet { members: &bytes::<0x82e2, 205>(), writable: &u16s::<0x83af, 0>() };
pub(super) static ENVIRONMENTS: [(&str, &GlobalSet); 44] = [
("builtin", &GLOBALS_BUILTIN),
("es6", &GLOBALS_ES6),
("es2015", &GLOBALS_ES2015),
("es2016", &GLOBALS_ES2016),
("es2017", &GLOBALS_ES2017),
("es2018", &GLOBALS_ES2018),
("es2019", &GLOBALS_ES2019),
("es2020", &GLOBALS_ES2020),
("es2021", &GLOBALS_ES2021),
("es2022", &GLOBALS_ES2022),
("es2023", &GLOBALS_ES2023),
("es2024", &GLOBALS_ES2024),
("es2025", &GLOBALS_ES2025),
("es2026", &GLOBALS_ES2026),
("audioworklet", &GLOBALS_AUDIOWORKLET),
("browser", &GLOBALS_BROWSER),
("bun", &GLOBALS_BUN),
("node", &GLOBALS_NODE),
("shared-node-browser", &GLOBALS_SHARED_NODE_BROWSER),
("worker", &GLOBALS_WORKER),
("serviceworker", &GLOBALS_SERVICEWORKER),
("amd", &GLOBALS_AMD),
("applescript", &GLOBALS_APPLESCRIPT),
("astro", &GLOBALS_ASTRO),
("atomtest", &GLOBALS_ATOMTEST),
("commonjs", &GLOBALS_COMMONJS),
("embertest", &GLOBALS_EMBERTEST),
("greasemonkey", &GLOBALS_GREASEMONKEY),
("jasmine", &GLOBALS_JASMINE),
("jest", &GLOBALS_JEST),
("jquery", &GLOBALS_JQUERY),
("meteor", &GLOBALS_METEOR),
("mocha", &GLOBALS_MOCHA),
("mongo", &GLOBALS_MONGO),
("nashorn", &GLOBALS_NASHORN),
("protractor", &GLOBALS_PROTRACTOR),
("prototypejs", &GLOBALS_PROTOTYPEJS),
("phantomjs", &GLOBALS_PHANTOMJS),
("shelljs", &GLOBALS_SHELLJS),
("svelte", &GLOBALS_SVELTE),
("webextensions", &GLOBALS_WEBEXTENSIONS),
("qunit", &GLOBALS_QUNIT),
("vitest", &GLOBALS_VITEST),
("vue", &GLOBALS_VUE),
];
pub(super) fn get_environment(key: &str) -> Option<&'static GlobalSet> {
match key {
"builtin" => Some(&GLOBALS_BUILTIN),
"es6" => Some(&GLOBALS_ES6),
"es2015" => Some(&GLOBALS_ES2015),
"es2016" => Some(&GLOBALS_ES2016),
"es2017" => Some(&GLOBALS_ES2017),
"es2018" => Some(&GLOBALS_ES2018),
"es2019" => Some(&GLOBALS_ES2019),
"es2020" => Some(&GLOBALS_ES2020),
"es2021" => Some(&GLOBALS_ES2021),
"es2022" => Some(&GLOBALS_ES2022),
"es2023" => Some(&GLOBALS_ES2023),
"es2024" => Some(&GLOBALS_ES2024),
"es2025" => Some(&GLOBALS_ES2025),
"es2026" => Some(&GLOBALS_ES2026),
"audioworklet" => Some(&GLOBALS_AUDIOWORKLET),
"browser" => Some(&GLOBALS_BROWSER),
"bun" => Some(&GLOBALS_BUN),
"node" => Some(&GLOBALS_NODE),
"shared-node-browser" => Some(&GLOBALS_SHARED_NODE_BROWSER),
"worker" => Some(&GLOBALS_WORKER),
"serviceworker" => Some(&GLOBALS_SERVICEWORKER),
"amd" => Some(&GLOBALS_AMD),
"applescript" => Some(&GLOBALS_APPLESCRIPT),
"astro" => Some(&GLOBALS_ASTRO),
"atomtest" => Some(&GLOBALS_ATOMTEST),
"commonjs" => Some(&GLOBALS_COMMONJS),
"embertest" => Some(&GLOBALS_EMBERTEST),
"greasemonkey" => Some(&GLOBALS_GREASEMONKEY),
"jasmine" => Some(&GLOBALS_JASMINE),
"jest" => Some(&GLOBALS_JEST),
"jquery" => Some(&GLOBALS_JQUERY),
"meteor" => Some(&GLOBALS_METEOR),
"mocha" => Some(&GLOBALS_MOCHA),
"mongo" => Some(&GLOBALS_MONGO),
"nashorn" => Some(&GLOBALS_NASHORN),
"protractor" => Some(&GLOBALS_PROTRACTOR),
"prototypejs" => Some(&GLOBALS_PROTOTYPEJS),
"phantomjs" => Some(&GLOBALS_PHANTOMJS),
"shelljs" => Some(&GLOBALS_SHELLJS),
"svelte" => Some(&GLOBALS_SVELTE),
"webextensions" => Some(&GLOBALS_WEBEXTENSIONS),
"qunit" => Some(&GLOBALS_QUNIT),
"vitest" => Some(&GLOBALS_VITEST),
"vue" => Some(&GLOBALS_VUE),
_ => None,
}
}
pub static GLOBALS: Globals = Globals;