Trait CjsCodeAnalyzer

Source
pub trait CjsCodeAnalyzer {
    // Required method
    fn analyze_cjs<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        specifier: &'life1 Url,
        maybe_source: Option<Cow<'a, str>>,
        esm_analysis_mode: EsmAnalysisMode,
    ) -> Pin<Box<dyn Future<Output = Result<CjsAnalysis<'a>, JsErrorBox>> + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Code analyzer for CJS and ESM files.

Required Methods§

Source

fn analyze_cjs<'a, 'life0, 'life1, 'async_trait>( &'life0 self, specifier: &'life1 Url, maybe_source: Option<Cow<'a, str>>, esm_analysis_mode: EsmAnalysisMode, ) -> Pin<Box<dyn Future<Output = Result<CjsAnalysis<'a>, JsErrorBox>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Analyzes CommonJs code for exports and reexports, which is then used to determine the wrapper ESM module exports.

Note that the source is provided by the caller when the caller already has it. If the source is needed by the implementation, then it can use the provided source, or otherwise load it if necessary.

Implementors§