typescript_ast/ast/
module.rs

1use std::collections::HashMap;
2
3use super::{value::Value, statement::Statement};
4
5#[derive(Debug)]
6pub enum ImportAlias {
7    None{name: String},
8    Alias{name: String, alias: String},
9}
10
11#[derive(Debug)]
12pub enum Import {
13    Normal{path: String},
14    From{names: Vec<ImportAlias>, path: String}
15}
16
17#[derive(Debug)]
18pub struct Module {
19    pub exports: HashMap<String, Value>,
20    pub imports: Vec<Import>,
21    pub statements: Vec<Statement>,
22}
23
24impl Module {
25    pub fn new() -> Self {
26        Self {
27            exports: HashMap::new(),
28            imports: Vec::new(),
29            statements: Vec::new(),
30        }
31    }
32}