mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 04:48:52 -05:00
chore: move crypto types to op_crates/crypto (#9609)
This commit is contained in:
parent
07eb009044
commit
4b56537ea9
4 changed files with 38 additions and 22 deletions
|
@ -8,6 +8,7 @@ use deno_core::serde_json::json;
|
|||
use deno_core::serde_json::Value;
|
||||
use deno_core::JsRuntime;
|
||||
use deno_core::RuntimeOptions;
|
||||
use deno_runtime::deno_crypto;
|
||||
use deno_runtime::deno_fetch;
|
||||
use deno_runtime::deno_web;
|
||||
use deno_runtime::deno_websocket;
|
||||
|
@ -62,6 +63,7 @@ fn create_compiler_snapshot(
|
|||
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.websocket", deno_websocket::get_declaration());
|
||||
op_crate_libs.insert("deno.crypto", deno_crypto::get_declaration());
|
||||
|
||||
// ensure we invalidate the build properly.
|
||||
for (_, path) in op_crate_libs.iter() {
|
||||
|
@ -262,6 +264,10 @@ fn main() {
|
|||
"cargo:rustc-env=DENO_WEBSOCKET_LIB_PATH={}",
|
||||
deno_websocket::get_declaration().display()
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=DENO_CRYPTO_LIB_PATH={}",
|
||||
deno_crypto::get_declaration().display()
|
||||
);
|
||||
|
||||
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
|
||||
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
|
||||
|
|
23
cli/dts/lib.deno.shared_globals.d.ts
vendored
23
cli/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -8,6 +8,7 @@
|
|||
/// <reference lib="deno.web" />
|
||||
/// <reference lib="deno.fetch" />
|
||||
/// <reference lib="deno.websocket" />
|
||||
/// <reference lib="deno.crypto" />
|
||||
|
||||
declare namespace WebAssembly {
|
||||
/**
|
||||
|
@ -343,8 +344,6 @@ interface VoidFunction {
|
|||
*/
|
||||
declare function queueMicrotask(func: VoidFunction): void;
|
||||
|
||||
declare var crypto: Crypto;
|
||||
|
||||
/** Registers an event listener in the global scope, which will be called
|
||||
* synchronously whenever the event `type` is dispatched.
|
||||
*
|
||||
|
@ -416,26 +415,6 @@ declare interface Console {
|
|||
|
||||
declare var console: Console;
|
||||
|
||||
declare interface Crypto {
|
||||
readonly subtle: null;
|
||||
getRandomValues<
|
||||
T extends
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| Uint8Array
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Uint8ClampedArray
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| DataView
|
||||
| null,
|
||||
>(
|
||||
array: T,
|
||||
): T;
|
||||
}
|
||||
|
||||
interface MessageEventInit<T = any> extends EventInit {
|
||||
data?: T;
|
||||
origin?: string;
|
||||
|
|
26
op_crates/crypto/lib.deno_crypto.d.ts
vendored
Normal file
26
op_crates/crypto/lib.deno_crypto.d.ts
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
declare var crypto: Crypto;
|
||||
|
||||
declare interface Crypto {
|
||||
readonly subtle: null;
|
||||
getRandomValues<
|
||||
T extends
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| Uint8Array
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Uint8ClampedArray
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| DataView
|
||||
| null,
|
||||
>(
|
||||
array: T,
|
||||
): T;
|
||||
}
|
|
@ -11,6 +11,7 @@ use deno_core::ZeroCopyBuf;
|
|||
use rand::rngs::StdRng;
|
||||
use rand::thread_rng;
|
||||
use rand::Rng;
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub use rand; // Re-export rand
|
||||
|
||||
|
@ -41,3 +42,7 @@ pub fn op_crypto_get_random_values(
|
|||
|
||||
Ok(json!({}))
|
||||
}
|
||||
|
||||
pub fn get_declaration() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_crypto.d.ts")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue