#![feature(let_chains)]
#![feature(box_patterns)]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]
#![feature(trivial_bounds)]
#![allow(clippy::redundant_closure_call)]
#![allow(clippy::to_string_trait_impl)]
#![allow(clippy::macro_metavars_in_unsafe)]
#![allow(clippy::too_long_first_doc_paragraph)]
pub mod cache;
pub mod common;
pub mod config;
pub mod context;
pub mod error;
pub mod module;
pub mod plugin;
pub mod resource;
pub mod stats;
pub use cache::cacheable::*;
pub use farmfe_macro_cache_item::cache_item;
pub const VERSION: &str = "0.5.0";
pub use dashmap;
pub use heck;
pub use lazy_static;
pub use parking_lot;
pub use petgraph;
#[cfg(feature = "profile")]
pub use puffin;
pub use rayon;
pub use regex;
pub use relative_path;
pub use rkyv;
pub use serde;
pub use serde_json;
pub use swc_common;
pub use swc_css_ast;
pub use swc_ecma_ast;
pub use swc_ecma_parser;
pub use swc_html_ast;
pub use wax;
pub type HashMap<K, V> = rustc_hash::FxHashMap<K, V>;
pub type HashSet<K> = rustc_hash::FxHashSet<K>;
pub type DashMap<K, V> = dashmap::DashMap<K, V, rustc_hash::FxBuildHasher>;
#[macro_export]
macro_rules! farm_profile_scope {
($s:expr) => {
#[cfg(feature = "profile")]
let msg = farmfe_utils::transform_string_to_static_str(String::from($s));
#[cfg(feature = "profile")]
farmfe_core::puffin::profile_scope!(msg);
};
}
#[macro_export]
macro_rules! farm_profile_function {
($s:expr) => {
#[cfg(feature = "profile")]
{
let msg = farmfe_utils::transform_string_to_static_str(String::from($s));
farmfe_core::puffin::profile_function!(msg);
}
};
() => {
farm_profile_function!("")
};
}
#[macro_export]
macro_rules! serialize {
($t:expr) => {{
let bytes = rkyv::to_bytes::<rkyv::rancor::Error>($t).unwrap();
bytes.to_vec()
}};
}
#[macro_export]
macro_rules! deserialize {
($bytes:expr, $ty:ty, $archived_ty:ty) => {{
let archived = unsafe { rkyv::access_unchecked::<$archived_ty>($bytes) };
let deserialized: $ty = rkyv::deserialize::<$ty, rkyv::rancor::Error>(archived).unwrap();
deserialized
}};
($bytes:expr, $ty:ty) => {{
deserialize!($bytes, $ty, rkyv::Archived::<$ty>)
}};
}