1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::interface::NodeRequireFunction;
use js_sys::{JsString, Object};
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
extern {
    #[wasm_bindgen(extends = Object)]
    #[derive(Clone, Debug)]
    pub type NodeModule;

    #[wasm_bindgen(method, getter)]
    pub fn children(this: &NodeModule) -> Box<[JsValue]>;

    #[wasm_bindgen(method, getter)]
    pub fn exports(this: &NodeModule) -> JsValue;

    #[wasm_bindgen(method, getter)]
    pub fn filename(this: &NodeModule) -> JsString;

    #[wasm_bindgen(method, getter)]
    pub fn id(this: &NodeModule) -> JsString;

    #[wasm_bindgen(method, getter)]
    pub fn loaded(this: &NodeModule) -> bool;

    #[wasm_bindgen(method, getter)]
    pub fn parent(this: &NodeModule) -> Option<NodeModule>;

    #[wasm_bindgen(method, getter)]
    pub fn paths(this: &NodeModule) -> Box<[JsValue]>;

    #[wasm_bindgen(method, getter)]
    pub fn require(this: &NodeModule) -> NodeRequireFunction;
}