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
35
36
37
38
39
40
41
42
43
44
45
46
use std::sync::Arc;
use auto_impl::auto_impl;
use stc_ts_types::{ModuleId, ModuleTypeData, Type};
use swc_atoms::JsWord;
use swc_common::FileName;
use crate::VResult;
#[derive(Debug, Clone)]
pub struct ModuleInfo {
pub module_id: ModuleId,
pub data: Type,
}
#[auto_impl(Box, Arc)]
pub trait Load: 'static + Send + Sync {
fn module_id(&self, base: &Arc<FileName>, src: &str) -> Option<ModuleId>;
fn is_in_same_circular_group(&self, base: &Arc<FileName>, src: &str) -> bool;
fn load_circular_dep(&self, base: &Arc<FileName>, src: &str, partial: &ModuleTypeData) -> VResult<Type>;
fn load_non_circular_dep(&self, base: &Arc<FileName>, src: &str) -> VResult<Type>;
fn declare_module(&self, name: &JsWord, module: Type) -> ModuleId;
}