From e83ff62ccbe33ad9c19cb9cab9154b6767d6d74b Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Fri, 12 Mar 2021 16:17:18 +0100 Subject: chore: split web op crate (#9635) This commit starts splitting out the deno_web op crate into multiple smaller crates. This commit splits out WebIDL and URL API, but in the future I want to split out each spec into its own crate. That means we will have (in rough order of loading): `webidl`, `dom`, `streams`, `console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and `webgpu` crates. --- cli/build.rs | 6 ++++++ cli/dts/lib.deno.shared_globals.d.ts | 1 + cli/main.rs | 3 ++- cli/tsc.rs | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/build.rs b/cli/build.rs index 236097cbf..3f97a71b7 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -10,6 +10,7 @@ use deno_core::JsRuntime; use deno_core::RuntimeOptions; use deno_runtime::deno_crypto; use deno_runtime::deno_fetch; +use deno_runtime::deno_url; use deno_runtime::deno_web; use deno_runtime::deno_webgpu; use deno_runtime::deno_websocket; @@ -61,6 +62,7 @@ fn create_compiler_snapshot( ) { // libs that are being provided by op crates. let mut op_crate_libs = HashMap::new(); + op_crate_libs.insert("deno.url", deno_url::get_declaration()); op_crate_libs.insert("deno.web", deno_web::get_declaration()); op_crate_libs.insert("deno.fetch", deno_fetch::get_declaration()); op_crate_libs.insert("deno.webgpu", deno_webgpu::get_declaration()); @@ -254,6 +256,10 @@ fn main() { println!("cargo:rustc-env=TS_VERSION={}", ts_version()); println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_commit_hash()); + println!( + "cargo:rustc-env=DENO_URL_LIB_PATH={}", + deno_url::get_declaration().display() + ); println!( "cargo:rustc-env=DENO_WEB_LIB_PATH={}", deno_web::get_declaration().display() diff --git a/cli/dts/lib.deno.shared_globals.d.ts b/cli/dts/lib.deno.shared_globals.d.ts index 4332b757b..206cafdc3 100644 --- a/cli/dts/lib.deno.shared_globals.d.ts +++ b/cli/dts/lib.deno.shared_globals.d.ts @@ -5,6 +5,7 @@ /// /// +/// /// /// /// diff --git a/cli/main.rs b/cli/main.rs index 93639d34f..8d685c6db 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -278,8 +278,9 @@ fn print_cache_info( pub fn get_types(unstable: bool) -> String { let mut types = format!( - "{}\n{}\n{}\n{}\n{}\n{}\n{}", + "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}", crate::tsc::DENO_NS_LIB, + crate::tsc::DENO_URL_LIB, crate::tsc::DENO_WEB_LIB, crate::tsc::DENO_FETCH_LIB, crate::tsc::DENO_WEBGPU_LIB, diff --git a/cli/tsc.rs b/cli/tsc.rs index 8d28b959d..6bf854650 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -29,6 +29,7 @@ use std::sync::Mutex; // Declaration files pub static DENO_NS_LIB: &str = include_str!("dts/lib.deno.ns.d.ts"); +pub static DENO_URL_LIB: &str = include_str!(env!("DENO_URL_LIB_PATH")); pub static DENO_WEB_LIB: &str = include_str!(env!("DENO_WEB_LIB_PATH")); pub static DENO_FETCH_LIB: &str = include_str!(env!("DENO_FETCH_LIB_PATH")); pub static DENO_WEBGPU_LIB: &str = include_str!(env!("DENO_WEBGPU_LIB_PATH")); -- cgit v1.2.3