summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorAndy Finch <andyfinch7@gmail.com>2020-02-01 03:02:23 -0800
committerGitHub <noreply@github.com>2020-02-01 12:02:23 +0100
commit4f8a5c0239cd633ea3fd15a27046da3edee2b2f2 (patch)
tree80467fdd1132a44dc7fce01d73261693ee6c7fb5 /cli/build.rs
parent2cd3994902fb6a4d4d0603c839a78503d792b96a (diff)
feat: support crate imports in deno_typescript (#3814)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 7e073c8ff..e75b09d74 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -1,4 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+use deno_core::include_crate_modules;
use deno_core::CoreOp;
use deno_core::Isolate;
use deno_core::Op;
@@ -47,6 +48,8 @@ fn main() {
deno_typescript::ts_version()
);
+ let extern_crate_modules = include_crate_modules![deno_core];
+
// The generation of snapshots is slow and often unnecessary. Until we figure
// out how to speed it up, or avoid it when unnecessary, this env var provides
// an escape hatch for the impatient hacker in need of faster incremental
@@ -65,9 +68,12 @@ fn main() {
let bundle_path = o.join("CLI_SNAPSHOT.js");
let snapshot_path = o.join("CLI_SNAPSHOT.bin");
- let main_module_name =
- deno_typescript::compile_bundle(&bundle_path, root_names)
- .expect("Bundle compilation failed");
+ let main_module_name = deno_typescript::compile_bundle(
+ &bundle_path,
+ root_names,
+ Some(extern_crate_modules.clone()),
+ )
+ .expect("Bundle compilation failed");
assert!(bundle_path.exists());
let runtime_isolate = &mut Isolate::new(StartupData::None, true);
@@ -102,9 +108,12 @@ fn main() {
c.join("js/lib.deno.ns.d.ts"),
);
- let main_module_name =
- deno_typescript::compile_bundle(&bundle_path, root_names)
- .expect("Bundle compilation failed");
+ let main_module_name = deno_typescript::compile_bundle(
+ &bundle_path,
+ root_names,
+ Some(extern_crate_modules),
+ )
+ .expect("Bundle compilation failed");
assert!(bundle_path.exists());
let runtime_isolate = &mut Isolate::new(StartupData::None, true);