MCPcopy Create free account
hub / github.com/Botloader/botloader / gen_script_source_header

Function gen_script_source_header

components/vm/src/lib.rs:31–48  ·  view source on GitHub ↗
(script: Option<&Script>)

Source from the content-addressed store, hash-verified

29}
30
31fn gen_script_source_header(script: Option<&Script>) -> String {
32 match script {
33 None => {
34 r#"import {Script} from "/script"; const script = new Script("unknown.ts", 0, null);"#
35 .to_string()
36 }
37 Some(s) => {
38 format!(
39 r#"import {{Script}} from "/script";const script = new Script("{}.ts", {}, {});"#,
40 s.name,
41 s.id,
42 s.plugin_id
43 .map(|v| format!("'{v}'"))
44 .unwrap_or("null".to_string()),
45 )
46 }
47 }
48}
49
50pub fn init_v8_flags(v8_flags: &[String]) {
51 let v8_flags_includes_help = v8_flags

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected