swc_bundler/
hook.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::Error;
use swc_common::{FileName, Span};
use swc_ecma_ast::KeyValueProp;

#[non_exhaustive]
pub struct ModuleRecord {
    pub file_name: FileName,
    pub is_entry: bool,
}

pub trait Hook: swc_common::sync::Sync + swc_common::sync::Send {
    fn get_import_meta_props(
        &self,
        span: Span,
        module_record: &ModuleRecord,
    ) -> Result<Vec<KeyValueProp>, Error>;
}