diff options
author | Andy Finch <andyfinch7@gmail.com> | 2020-02-01 03:02:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-01 12:02:23 +0100 |
commit | 4f8a5c0239cd633ea3fd15a27046da3edee2b2f2 (patch) | |
tree | 80467fdd1132a44dc7fce01d73261693ee6c7fb5 /core/modules.rs | |
parent | 2cd3994902fb6a4d4d0603c839a78503d792b96a (diff) |
feat: support crate imports in deno_typescript (#3814)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'core/modules.rs')
-rw-r--r-- | core/modules.rs | 20 |
1 files changed, 20 insertions, 0 deletions
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<String, String> = HashMap::new(); + $( + temp.insert(stringify!($x).to_string(), $x::DENO_CRATE_PATH.to_string()); + )* + temp + } + }; +} + #[cfg(test)] mod tests { use super::*; |