pub fn new(plugin_path: &str) -> Box<Self> {
    let mut runtime = JsRuntime::new(RuntimeOptions {
      module_loader: Some(Rc::new(FsModuleLoader)),
      ..Default::default()
    });

    runtime
      .execute_script("visitor.js", include_str!("visitor.js"))
      .unwrap();
    runtime
      .execute_script("control-flow.js", include_str!("control-flow.js"))
      .unwrap();
    runtime.register_op(
      "op_add_diagnostics",
      deno_core::op_sync(op_add_diagnostics),
    );
    runtime
      .register_op("op_add_rule_code", deno_core::op_sync(op_add_rule_code));
    runtime.register_op(
      "op_query_control_flow_by_span",
      deno_core::op_sync(op_query_control_flow_by_span),
    );
    runtime.sync_ops_cache();

    let module_id =
      deno_core::futures::executor::block_on(runtime.load_module(
        &resolve_url_or_path("dummy.js").unwrap(),
        Some(create_dummy_source(plugin_path)),
      ))
      .unwrap();

    Box::new(Self { runtime, module_id })
  }
/// Create new JsRuntime for running plugin rules.
Create new JsRuntime for running plugin rules.
Create new JsRuntime for running plugin rules .
pub fn new(plugin_path: &str) -> Box<Self> {
    let mut runtime = JsRuntime::new(RuntimeOptions {
      module_loader: Some(Rc::new(FsModuleLoader)),
      ..Default::default()
    });
    runtime
      .execute_script("visitor.js", include_str!("visitor.js"))
      .unwrap();
    runtime
      .execute_script("control-flow.js", include_str!("control-flow.js"))
      .unwrap();
    runtime.register_op(
      "op_add_diagnostics",
      deno_core::op_sync(op_add_diagnostics),
    );
    runtime
      .register_op("op_add_rule_code", deno_core::op_sync(op_add_rule_code));
    runtime.register_op(
      "op_query_control_flow_by_span",
      deno_core::op_sync(op_query_control_flow_by_span),
    );
    runtime.sync_ops_cache();
    let module_id =
      deno_core::futures::executor::block_on(runtime.load_module(
        &resolve_url_or_path("dummy.js").unwrap(),
        Some(create_dummy_source(plugin_path)),
      ))
      .unwrap();
    Box::new(Self { runtime, module_id })
  }
pub fn new ( plugin_path : & str ) -> Box < Self > { let mut runtime = JsRuntime :: new ( RuntimeOptions { module_loader : Some ( Rc :: new ( FsModuleLoader ) ) , .. Default :: default ( ) } ) ; runtime . execute_script ( " " , include_str ! ( " " ) ) . unwrap ( ) ; runtime . execute_script ( " " , include_str ! ( " " ) ) . unwrap ( ) ; runtime . register_op ( " " , deno_core :: op_sync ( op_add_diagnostics ) , ) ; runtime . register_op ( " " , deno_core :: op_sync ( op_add_rule_code ) ) ; runtime . register_op ( " " , deno_core :: op_sync ( op_query_control_flow_by_span ) , ) ; runtime . sync_ops_cache ( ) ; let module_id = deno_core :: futures :: executor :: block_on ( runtime . load_module ( & resolve_url_or_path ( " " ) . unwrap ( ) , Some ( create_dummy_source ( plugin_path ) ) , ) ) . unwrap ( ) ; Box :: new ( Self { runtime , module_id } ) }
Create new JsRuntime for running plugin rules.
Create new JsRuntime for running plugin rules .
plugin_path
&str