fallow-engine 3.43.0

Typed analysis engine facade for fallow consumers
Documentation
//! Explicit ECMAScript and host-property exclusions for custom global slots.
//!
//! Root spellings remain separate. `globalThis` can denote either host, so its
//! catalogue is the union; no runtime identity is inferred from that exclusion.

const ECMASCRIPT: &[&str] = &[
    "globalThis",
    "Infinity",
    "NaN",
    "undefined",
    "eval",
    "isFinite",
    "isNaN",
    "parseFloat",
    "parseInt",
    "decodeURI",
    "decodeURIComponent",
    "encodeURI",
    "encodeURIComponent",
    "Object",
    "Function",
    "Boolean",
    "Symbol",
    "Number",
    "BigInt",
    "Math",
    "Date",
    "String",
    "RegExp",
    "Array",
    "Map",
    "Set",
    "WeakMap",
    "WeakSet",
    "WeakRef",
    "FinalizationRegistry",
    "ArrayBuffer",
    "SharedArrayBuffer",
    "DataView",
    "Int8Array",
    "Uint8Array",
    "Uint8ClampedArray",
    "Int16Array",
    "Uint16Array",
    "Int32Array",
    "Uint32Array",
    "Float32Array",
    "Float64Array",
    "BigInt64Array",
    "BigUint64Array",
    "Atomics",
    "JSON",
    "Promise",
    "Reflect",
    "Proxy",
    "Intl",
    "Error",
    "AggregateError",
    "EvalError",
    "RangeError",
    "ReferenceError",
    "SyntaxError",
    "TypeError",
    "URIError",
    "WebAssembly",
];
const COMMON_HOST: &[&str] = &[
    "console",
    "performance",
    "crypto",
    "fetch",
    "setTimeout",
    "clearTimeout",
    "setInterval",
    "clearInterval",
    "queueMicrotask",
    "structuredClone",
    "URL",
    "URLSearchParams",
    "TextEncoder",
    "TextDecoder",
    "AbortController",
    "AbortSignal",
    "Request",
    "Response",
    "Headers",
    "FormData",
    "Blob",
    "File",
    "Event",
    "EventTarget",
    "ReadableStream",
    "WritableStream",
    "TransformStream",
    "atob",
    "btoa",
];
const BROWSER: &[&str] = &[
    "document",
    "location",
    "navigator",
    "history",
    "localStorage",
    "sessionStorage",
    "indexedDB",
    "caches",
    "requestAnimationFrame",
    "cancelAnimationFrame",
    "addEventListener",
    "removeEventListener",
    "dispatchEvent",
    "postMessage",
    "window",
    "self",
    "top",
    "parent",
    "frames",
    "opener",
    "closed",
    "length",
    "name",
    "origin",
    "screen",
    "event",
    "innerWidth",
    "innerHeight",
    "outerWidth",
    "outerHeight",
    "scrollX",
    "scrollY",
    "devicePixelRatio",
    "onload",
    "onerror",
    "onmessage",
    "onbeforeunload",
    "alert",
    "confirm",
    "prompt",
    "open",
    "close",
    "getComputedStyle",
    "matchMedia",
    "customElements",
    "HTMLElement",
    "Element",
    "Node",
    "Worker",
    "ServiceWorker",
    "WebSocket",
    "XMLHttpRequest",
    "Image",
    "Audio",
    "MutationObserver",
    "ResizeObserver",
    "IntersectionObserver",
    "requestIdleCallback",
    "cancelIdleCallback",
];
const NODE: &[&str] = &[
    "global",
    "process",
    "Buffer",
    "setImmediate",
    "clearImmediate",
];

pub(super) fn is_builtin(root: &str, slot: &str) -> bool {
    ECMASCRIPT.contains(&slot)
        || COMMON_HOST.contains(&slot)
        || (matches!(root, "window" | "self" | "globalThis") && BROWSER.contains(&slot))
        || (matches!(root, "global" | "globalThis") && NODE.contains(&slot))
}