2022-01-08 03:09:52 +00:00
|
|
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
2020-12-03 22:52:55 +00:00
|
|
|
mod async_cancel;
|
2020-11-24 23:38:23 +00:00
|
|
|
mod async_cell;
|
2020-01-06 15:24:44 +00:00
|
|
|
mod bindings;
|
2020-09-14 16:48:57 +00:00
|
|
|
pub mod error;
|
2021-11-04 15:44:34 +00:00
|
|
|
mod error_codes;
|
2021-04-28 16:41:50 +00:00
|
|
|
mod extensions;
|
2019-03-11 21:57:36 +00:00
|
|
|
mod flags;
|
2020-09-10 13:57:45 +00:00
|
|
|
mod gotham_state;
|
2021-05-26 19:07:12 +00:00
|
|
|
mod inspector;
|
2019-06-12 23:55:59 +00:00
|
|
|
mod module_specifier;
|
2019-03-26 15:56:34 +00:00
|
|
|
mod modules;
|
2020-08-12 20:34:17 +00:00
|
|
|
mod normalize_path;
|
2019-09-30 18:59:44 +00:00
|
|
|
mod ops;
|
2021-04-25 17:23:22 +00:00
|
|
|
mod ops_builtin;
|
2022-06-07 09:25:10 +00:00
|
|
|
mod ops_builtin_v8;
|
2021-10-10 15:20:30 +00:00
|
|
|
mod ops_metrics;
|
2019-10-23 16:32:28 +00:00
|
|
|
mod resources;
|
2020-09-06 19:44:29 +00:00
|
|
|
mod runtime;
|
2022-04-15 14:08:09 +00:00
|
|
|
mod source_map;
|
2019-02-26 22:36:05 +00:00
|
|
|
|
2020-09-16 18:28:07 +00:00
|
|
|
// Re-exports
|
2021-11-16 14:02:28 +00:00
|
|
|
pub use anyhow;
|
2020-09-16 18:28:07 +00:00
|
|
|
pub use futures;
|
2021-07-07 03:48:01 +00:00
|
|
|
pub use parking_lot;
|
2020-10-09 19:45:40 +00:00
|
|
|
pub use serde;
|
2020-09-16 18:28:07 +00:00
|
|
|
pub use serde_json;
|
2021-06-26 01:09:25 +00:00
|
|
|
pub use serde_v8;
|
2021-06-26 15:34:24 +00:00
|
|
|
pub use serde_v8::ByteString;
|
2021-10-20 13:40:20 +00:00
|
|
|
pub use serde_v8::StringOrBuffer;
|
2022-03-15 23:22:00 +00:00
|
|
|
pub use serde_v8::U16String;
|
2022-04-25 14:56:47 +00:00
|
|
|
pub use serde_v8::ZeroCopyBuf;
|
2022-04-15 14:08:09 +00:00
|
|
|
pub use sourcemap;
|
2020-09-16 18:28:07 +00:00
|
|
|
pub use url;
|
2021-10-27 21:26:15 +00:00
|
|
|
pub use v8;
|
2020-01-05 14:19:29 +00:00
|
|
|
|
2020-12-03 22:52:55 +00:00
|
|
|
pub use crate::async_cancel::CancelFuture;
|
|
|
|
pub use crate::async_cancel::CancelHandle;
|
|
|
|
pub use crate::async_cancel::CancelTryFuture;
|
|
|
|
pub use crate::async_cancel::Cancelable;
|
|
|
|
pub use crate::async_cancel::Canceled;
|
|
|
|
pub use crate::async_cancel::TryCancelable;
|
2020-11-24 23:38:23 +00:00
|
|
|
pub use crate::async_cell::AsyncMut;
|
|
|
|
pub use crate::async_cell::AsyncMutFuture;
|
|
|
|
pub use crate::async_cell::AsyncRef;
|
|
|
|
pub use crate::async_cell::AsyncRefCell;
|
|
|
|
pub use crate::async_cell::AsyncRefFuture;
|
2020-12-03 22:52:55 +00:00
|
|
|
pub use crate::async_cell::RcLike;
|
2020-11-24 23:38:23 +00:00
|
|
|
pub use crate::async_cell::RcRef;
|
2022-03-14 17:44:15 +00:00
|
|
|
pub use crate::extensions::Extension;
|
|
|
|
pub use crate::extensions::ExtensionBuilder;
|
2022-03-15 22:43:17 +00:00
|
|
|
pub use crate::extensions::OpDecl;
|
2022-03-14 17:44:15 +00:00
|
|
|
pub use crate::extensions::OpMiddlewareFn;
|
2019-03-11 21:57:36 +00:00
|
|
|
pub use crate::flags::v8_set_flags;
|
2021-12-28 16:40:42 +00:00
|
|
|
pub use crate::inspector::InspectorMsg;
|
|
|
|
pub use crate::inspector::InspectorMsgKind;
|
2021-05-26 19:07:12 +00:00
|
|
|
pub use crate::inspector::InspectorSessionProxy;
|
|
|
|
pub use crate::inspector::JsRuntimeInspector;
|
|
|
|
pub use crate::inspector::LocalInspectorSession;
|
2021-02-17 18:47:18 +00:00
|
|
|
pub use crate::module_specifier::resolve_import;
|
|
|
|
pub use crate::module_specifier::resolve_path;
|
|
|
|
pub use crate::module_specifier::resolve_url;
|
|
|
|
pub use crate::module_specifier::resolve_url_or_path;
|
2020-05-28 17:36:43 +00:00
|
|
|
pub use crate::module_specifier::ModuleResolutionError;
|
|
|
|
pub use crate::module_specifier::ModuleSpecifier;
|
2021-02-17 18:47:18 +00:00
|
|
|
pub use crate::module_specifier::DUMMY_SPECIFIER;
|
2020-11-27 21:45:38 +00:00
|
|
|
pub use crate::modules::FsModuleLoader;
|
2020-05-28 17:36:43 +00:00
|
|
|
pub use crate::modules::ModuleId;
|
|
|
|
pub use crate::modules::ModuleLoader;
|
|
|
|
pub use crate::modules::ModuleSource;
|
|
|
|
pub use crate::modules::ModuleSourceFuture;
|
2021-12-15 18:22:36 +00:00
|
|
|
pub use crate::modules::ModuleType;
|
2020-12-11 17:49:26 +00:00
|
|
|
pub use crate::modules::NoopModuleLoader;
|
2020-08-12 20:34:17 +00:00
|
|
|
pub use crate::normalize_path::normalize_path;
|
2020-05-28 17:36:43 +00:00
|
|
|
pub use crate::ops::Op;
|
|
|
|
pub use crate::ops::OpAsyncFuture;
|
2021-10-09 20:37:19 +00:00
|
|
|
pub use crate::ops::OpCall;
|
2022-03-14 17:44:15 +00:00
|
|
|
pub use crate::ops::OpError;
|
2020-09-06 00:34:02 +00:00
|
|
|
pub use crate::ops::OpFn;
|
2020-05-28 17:36:43 +00:00
|
|
|
pub use crate::ops::OpId;
|
2021-04-30 14:51:54 +00:00
|
|
|
pub use crate::ops::OpResult;
|
2020-09-10 13:57:45 +00:00
|
|
|
pub use crate::ops::OpState;
|
2021-03-31 14:37:38 +00:00
|
|
|
pub use crate::ops::PromiseId;
|
2021-04-25 17:23:22 +00:00
|
|
|
pub use crate::ops_builtin::op_close;
|
2021-05-02 23:30:03 +00:00
|
|
|
pub use crate::ops_builtin::op_print;
|
2021-04-25 17:23:22 +00:00
|
|
|
pub use crate::ops_builtin::op_resources;
|
2022-03-15 21:58:03 +00:00
|
|
|
pub use crate::ops_builtin::op_void_async;
|
|
|
|
pub use crate::ops_builtin::op_void_sync;
|
2022-03-14 17:44:15 +00:00
|
|
|
pub use crate::ops_metrics::OpsTracker;
|
2021-11-09 18:26:17 +00:00
|
|
|
pub use crate::resources::AsyncResult;
|
2020-12-16 16:14:12 +00:00
|
|
|
pub use crate::resources::Resource;
|
|
|
|
pub use crate::resources::ResourceId;
|
2020-05-28 17:36:43 +00:00
|
|
|
pub use crate::resources::ResourceTable;
|
2021-12-21 14:53:46 +00:00
|
|
|
pub use crate::runtime::CompiledWasmModuleStore;
|
2021-12-30 01:05:26 +00:00
|
|
|
pub use crate::runtime::CrossIsolateStore;
|
2020-09-06 19:44:29 +00:00
|
|
|
pub use crate::runtime::GetErrorClassFn;
|
2020-12-01 22:33:44 +00:00
|
|
|
pub use crate::runtime::JsErrorCreateFn;
|
2022-04-17 11:53:08 +00:00
|
|
|
pub use crate::runtime::JsRealm;
|
2020-09-06 19:44:29 +00:00
|
|
|
pub use crate::runtime::JsRuntime;
|
2020-09-11 13:18:49 +00:00
|
|
|
pub use crate::runtime::RuntimeOptions;
|
2021-12-21 14:53:46 +00:00
|
|
|
pub use crate::runtime::SharedArrayBufferStore;
|
2020-09-06 19:44:29 +00:00
|
|
|
pub use crate::runtime::Snapshot;
|
2022-04-15 14:08:09 +00:00
|
|
|
pub use crate::source_map::SourceMapGetter;
|
2022-03-14 17:44:15 +00:00
|
|
|
pub use deno_ops::op;
|
2019-02-26 22:36:05 +00:00
|
|
|
|
2019-03-11 21:57:36 +00:00
|
|
|
pub fn v8_version() -> &'static str {
|
2020-01-05 14:19:29 +00:00
|
|
|
v8::V8::get_version()
|
2019-02-26 22:36:05 +00:00
|
|
|
}
|
|
|
|
|
2022-03-14 17:44:15 +00:00
|
|
|
/// An internal module re-exporting funcs used by the #[op] (`deno_ops`) macro
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub mod _ops {
|
|
|
|
pub use super::bindings::throw_type_error;
|
|
|
|
pub use super::error_codes::get_error_code;
|
|
|
|
pub use super::ops::to_op_result;
|
2022-04-08 08:32:48 +00:00
|
|
|
pub use super::ops::OpCtx;
|
2022-03-14 17:44:15 +00:00
|
|
|
pub use super::runtime::queue_async_op;
|
|
|
|
}
|
|
|
|
|
2021-06-21 23:45:41 +00:00
|
|
|
/// A helper macro that will return a call site in Rust code. Should be
|
|
|
|
/// used when executing internal one-line scripts for JsRuntime lifecycle.
|
|
|
|
///
|
2021-09-05 14:22:45 +00:00
|
|
|
/// Returns a string in form of: "`[deno:<filename>:<line>:<column>]`"
|
2021-06-21 23:45:41 +00:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! located_script_name {
|
|
|
|
() => {
|
|
|
|
format!(
|
|
|
|
"[deno:{}:{}:{}]",
|
|
|
|
std::file!(),
|
|
|
|
std::line!(),
|
|
|
|
std::column!()
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-02-01 15:55:23 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_v8_version() {
|
|
|
|
assert!(v8_version().len() > 3);
|
|
|
|
}
|
2019-02-26 22:36:05 +00:00
|
|
|
}
|