mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-28 04:01:33 +00:00
Implement static
imports
This allows importing static objects like `document`, `window`, or an arbitrary JS object from a module
This commit is contained in:
@ -11,7 +11,8 @@ pub const SCHEMA_VERSION: &str = "0";
|
||||
pub struct Program {
|
||||
pub exports: Vec<Export>,
|
||||
pub enums: Vec<Enum>,
|
||||
pub imports: Vec<Import>,
|
||||
pub imported_functions: Vec<Import>,
|
||||
pub imported_fields: Vec<ImportField>,
|
||||
pub custom_type_names: Vec<CustomTypeName>,
|
||||
pub version: String,
|
||||
pub schema_version: String,
|
||||
@ -30,6 +31,12 @@ pub struct Import {
|
||||
pub function: Function,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ImportField {
|
||||
pub module: Option<String>,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Export {
|
||||
pub class: Option<String>,
|
||||
@ -148,3 +155,9 @@ pub fn version() -> String {
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
impl ImportField {
|
||||
pub fn shim_name(&self) -> String {
|
||||
format!("__wbg_field_import_shim_{}", self.name)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user