maudit_rolldown_common 0.1.0

This crate is mostly for sharing code between rolldwon crates. fork of Rolldown for the Maudit project until Rolldown is published on crates.io
Documentation
use crate::side_effects::DeterminedSideEffects;
use crate::{ImportRecordIdx, ModuleIdx, ResolvedImportRecord, SymbolRef};
use arcstr::ArcStr;
use oxc_index::IndexVec;

#[derive(Debug)]
pub struct ExternalModule {
  pub idx: ModuleIdx,
  pub exec_order: u32,
  /// Usages:
  /// - Used for iife format to inject symbol and deconflict.
  /// - Used for for rewrite `import { foo } from 'external';console.log(foo)` to `var external = require('external'); console.log(external.foo)` in cjs format.
  pub namespace_ref: SymbolRef,
  pub name: ArcStr,
  pub import_records: IndexVec<ImportRecordIdx, ResolvedImportRecord>,
  pub side_effects: DeterminedSideEffects,
}

impl ExternalModule {
  pub fn new(
    idx: ModuleIdx,
    module_id: ArcStr,
    side_effects: DeterminedSideEffects,
    namespace_ref: SymbolRef,
  ) -> Self {
    Self {
      idx,
      exec_order: u32::MAX,
      namespace_ref,
      name: module_id,
      import_records: IndexVec::default(),
      side_effects,
    }
  }
}