From 4f8a5c0239cd633ea3fd15a27046da3edee2b2f2 Mon Sep 17 00:00:00 2001 From: Andy Finch Date: Sat, 1 Feb 2020 03:02:23 -0800 Subject: feat: support crate imports in deno_typescript (#3814) Co-authored-by: Ryan Dahl --- core/modules.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'core/modules.rs') diff --git a/core/modules.rs b/core/modules.rs index 21c2481dd..c02bd4cab 100644 --- a/core/modules.rs +++ b/core/modules.rs @@ -449,6 +449,26 @@ impl fmt::Display for Deps { } } +#[macro_export] +macro_rules! crate_modules { + () => { + pub const DENO_CRATE_PATH: &'static str = env!("CARGO_MANIFEST_DIR"); + }; +} + +#[macro_export] +macro_rules! include_crate_modules { + ( $( $x:ident ),* ) => { + { + let mut temp: HashMap = HashMap::new(); + $( + temp.insert(stringify!($x).to_string(), $x::DENO_CRATE_PATH.to_string()); + )* + temp + } + }; +} + #[cfg(test)] mod tests { use super::*; -- cgit v1.2.3