chidori_static_analysis/
lib.rs1pub mod language;
2use lazy_static::lazy_static;
3use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5use std::sync::Mutex;
6use wasm_bindgen::prelude::*;
7
8use rustpython_parser::{ast, Parse};
9
10use crate::language::python::parse::build_report;
11use crate::language::python::parse::extract_dependencies_python as extract_dependencies_python_impl;
12
13#[macro_use]
14extern crate swc_common;
15
16#[wasm_bindgen]
17extern "C" {
18 }
21
22#[wasm_bindgen]
23pub fn extract_dependencies_python(source_code: &str) -> Result<JsValue, JsValue> {
24 let result = extract_dependencies_python_impl(source_code).map_err(|e| e.to_string())?;
25 serde_wasm_bindgen::to_value(&result).map_err(|e| JsValue::from_str(&e.to_string()))
26}
27
28#[wasm_bindgen]
29pub fn extract_cell_info(source_code: &str) -> Result<JsValue, JsValue> {
30 let context_stack_references = extract_dependencies_python_impl(source_code).map_err(|e| e.to_string())?;
31 let result = build_report(&context_stack_references);
32 serde_wasm_bindgen::to_value(&result).map_err(|e| JsValue::from_str(&e.to_string()))
33}