use crate::runtime::STATICA_JS;
#[must_use]
pub fn wrap_script_with_scope(body: &str, scope_id: &str) -> String {
format!(
r#"{runtime}
function __staticaScope(scriptEl, scopeId) {{
return __statica.scope(scriptEl, scopeId);
}}
(function (scriptEl) {{
const $ = __statica.scope(scriptEl, "{scope}");
{body}
}})(document.currentScript);
"#,
runtime = STATICA_JS,
scope = scope_id,
body = body.trim()
)
}