rolldown_plugin_utils 1.2.9

Shared utilities for Rolldown plugins
Documentation
use rolldown_plugin::typedmap::TypedMapKey;

// Use `10kB` as a threshold for 'auto'
// https://v8.dev/blog/cost-of-javascript-2019#json
pub const THRESHOLD_SIZE: usize = 10 * 1000;

/// Marks an `import.meta.glob` pattern resolve so the resolver can apply glob-aware
/// handling. The value additionally flags subpath-import (`#`) patterns.
#[derive(Hash, PartialEq, Eq)]
pub struct ViteImportGlob;

pub struct ViteImportGlobValue(pub bool);

impl ViteImportGlobValue {
  pub fn is_sub_imports_pattern(&self) -> bool {
    self.0
  }
}

impl TypedMapKey for ViteImportGlob {
  type Value = ViteImportGlobValue;
}