summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 7d131de86..327b75f0a 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -3,7 +3,6 @@
use deno_core::error::custom_error;
use deno_core::op_sync;
use deno_core::serde::Deserialize;
-use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_core::JsRuntime;
@@ -122,6 +121,7 @@ fn create_compiler_snapshot(
"es2020.string",
"es2020.symbol.wellknown",
"es2021",
+ "es2021.intl",
"es2021.promise",
"es2021.string",
"es2021.weakref",
@@ -168,14 +168,19 @@ fn create_compiler_snapshot(
"op_cwd",
op_sync(move |_state, _args: Value, _: ()| Ok(json!("cache:///"))),
);
+ // As of TypeScript 4.5, it tries to detect the existence of substitute lib
+ // files, which we currently don't use, so we just return false.
+ js_runtime.register_op(
+ "op_exists",
+ op_sync(move |_state, _args: LoadArgs, _: ()| Ok(json!(false))),
+ );
// using the same op that is used in `tsc.rs` for loading modules and reading
// files, but a slightly different implementation at build time.
js_runtime.register_op(
"op_load",
- op_sync(move |_state, args, _: ()| {
- let v: LoadArgs = serde_json::from_value(args)?;
+ op_sync(move |_state, args: LoadArgs, _: ()| {
// we need a basic file to send to tsc to warm it up.
- if v.specifier == build_specifier {
+ if args.specifier == build_specifier {
Ok(json!({
"data": r#"console.log("hello deno!");"#,
"hash": "1",
@@ -184,7 +189,7 @@ fn create_compiler_snapshot(
}))
// specifiers come across as `asset:///lib.{lib_name}.d.ts` and we need to
// parse out just the name so we can lookup the asset.
- } else if let Some(caps) = re_asset.captures(&v.specifier) {
+ } else if let Some(caps) = re_asset.captures(&args.specifier) {
if let Some(lib) = caps.get(1).map(|m| m.as_str()) {
// if it comes from an op crate, we were supplied with the path to the
// file.
@@ -204,13 +209,13 @@ fn create_compiler_snapshot(
} else {
Err(custom_error(
"InvalidSpecifier",
- format!("An invalid specifier was requested: {}", v.specifier),
+ format!("An invalid specifier was requested: {}", args.specifier),
))
}
} else {
Err(custom_error(
"InvalidSpecifier",
- format!("An invalid specifier was requested: {}", v.specifier),
+ format!("An invalid specifier was requested: {}", args.specifier),
))
}
}),