rolldown_common 0.1.0

This crate is mostly for sharing code between rolldwon crates.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use oxc::semantic::SymbolId;

pub trait SymbolIdExt {
  /// Returns the symbol id as a string.
  fn is_module_namespace(&self) -> bool;
}

impl SymbolIdExt for SymbolId {
  /// Returns true if the symbol id is the special module namespace symbol.
  /// `namespace_object_ref` is always created in second times with `create_facade_root_symbol_ref`,
  ///  see: https://github.com/rolldown/rolldown/blob/8bc7dca5a09047b6b494e3fa7b6b7564aa465372/crates/rolldown/src/ast_scanner/mod.rs?plain=1#L156-L160
  #[inline]
  fn is_module_namespace(&self) -> bool {
    *self == SymbolId::from_raw_unchecked(u32::MAX - 2)
  }
}