mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
feat: support crate imports in deno_typescript (#3814)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
This commit is contained in:
parent
2cd3994902
commit
4f8a5c0239
6 changed files with 85 additions and 26 deletions
21
cli/build.rs
21
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue