2021-01-10 21:59:07 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
2020-12-03 23:52:55 +01:00
|
|
|
mod async_cancel;
|
2020-11-25 00:38:23 +01:00
|
|
|
mod async_cell;
|
2020-01-06 16:24:44 +01:00
|
|
|
mod bindings;
|
2020-09-14 18:48:57 +02:00
|
|
|
pub mod error;
|
2021-04-28 18:41:50 +02:00
|
|
|
mod extensions;
|
2019-03-11 17:57:36 -04:00
|
|
|
mod flags;
|
2020-09-10 09:57:45 -04:00
|
|
|
mod gotham_state;
|
2021-05-26 21:07:12 +02:00
|
|
|
mod inspector;
|
2019-06-13 01:55:59 +02:00
|
|
|
mod module_specifier;
|
2019-03-26 11:56:34 -04:00
|
|
|
mod modules;
|
2020-08-13 02:04:17 +05:30
|
|
|
mod normalize_path;
|
2019-09-30 20:59:44 +02:00
|
|
|
mod ops;
|
2021-04-25 19:23:22 +02:00
|
|
|
mod ops_builtin;
|
2021-03-20 17:51:08 +01:00
|
|
|
mod ops_json;
|
2019-10-23 18:32:28 +02:00
|
|
|
mod resources;
|
2020-09-06 21:44:29 +02:00
|
|
|
mod runtime;
|
2019-02-26 17:36:05 -05:00
|
|
|
|
2020-09-16 14:28:07 -04:00
|
|
|
// Re-exports
|
|
|
|
pub use futures;
|
2020-03-27 16:09:51 -04:00
|
|
|
pub use rusty_v8 as v8;
|
2020-10-09 15:45:40 -04:00
|
|
|
pub use serde;
|
2020-09-16 14:28:07 -04:00
|
|
|
pub use serde_json;
|
2021-06-25 19:09:25 -06:00
|
|
|
pub use serde_v8;
|
2021-04-30 14:42:09 +02:00
|
|
|
pub use serde_v8::Buffer as ZeroCopyBuf;
|
2021-06-26 17:34:24 +02:00
|
|
|
pub use serde_v8::ByteString;
|
2020-09-16 14:28:07 -04:00
|
|
|
pub use url;
|
2020-01-05 09:19:29 -05:00
|
|
|
|
2020-12-03 23:52:55 +01: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-25 00:38:23 +01: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 23:52:55 +01:00
|
|
|
pub use crate::async_cell::RcLike;
|
2020-11-25 00:38:23 +01:00
|
|
|
pub use crate::async_cell::RcRef;
|
2019-03-11 17:57:36 -04:00
|
|
|
pub use crate::flags::v8_set_flags;
|
2021-05-26 21:07:12 +02:00
|
|
|
pub use crate::inspector::InspectorSessionProxy;
|
|
|
|
pub use crate::inspector::JsRuntimeInspector;
|
|
|
|
pub use crate::inspector::LocalInspectorSession;
|
2021-02-17 13:47:18 -05: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 13:36:43 -04:00
|
|
|
pub use crate::module_specifier::ModuleResolutionError;
|
|
|
|
pub use crate::module_specifier::ModuleSpecifier;
|
2021-02-17 13:47:18 -05:00
|
|
|
pub use crate::module_specifier::DUMMY_SPECIFIER;
|
2020-11-28 06:45:38 +09:00
|
|
|
pub use crate::modules::FsModuleLoader;
|
2020-05-28 13:36:43 -04:00
|
|
|
pub use crate::modules::ModuleId;
|
|
|
|
pub use crate::modules::ModuleLoadId;
|
|
|
|
pub use crate::modules::ModuleLoader;
|
|
|
|
pub use crate::modules::ModuleSource;
|
|
|
|
pub use crate::modules::ModuleSourceFuture;
|
2020-12-11 18:49:26 +01:00
|
|
|
pub use crate::modules::NoopModuleLoader;
|
2021-05-19 20:53:43 +02:00
|
|
|
// TODO(bartlomieju): this struct should be implementation
|
|
|
|
// detail nad not be public
|
2020-05-28 13:36:43 -04:00
|
|
|
pub use crate::modules::RecursiveModuleLoad;
|
2020-08-13 02:04:17 +05:30
|
|
|
pub use crate::normalize_path::normalize_path;
|
2021-03-31 16:37:38 +02:00
|
|
|
pub use crate::ops::serialize_op_result;
|
2020-05-28 13:36:43 -04:00
|
|
|
pub use crate::ops::Op;
|
|
|
|
pub use crate::ops::OpAsyncFuture;
|
2020-09-06 02:34:02 +02:00
|
|
|
pub use crate::ops::OpFn;
|
2020-05-28 13:36:43 -04:00
|
|
|
pub use crate::ops::OpId;
|
2021-03-31 16:37:38 +02:00
|
|
|
pub use crate::ops::OpPayload;
|
2021-04-30 16:51:54 +02:00
|
|
|
pub use crate::ops::OpResult;
|
2020-09-10 09:57:45 -04:00
|
|
|
pub use crate::ops::OpState;
|
2020-09-06 02:34:02 +02:00
|
|
|
pub use crate::ops::OpTable;
|
2021-03-31 16:37:38 +02:00
|
|
|
pub use crate::ops::PromiseId;
|
2021-04-25 19:23:22 +02:00
|
|
|
pub use crate::ops_builtin::op_close;
|
2021-05-03 01:30:03 +02:00
|
|
|
pub use crate::ops_builtin::op_print;
|
2021-04-25 19:23:22 +02:00
|
|
|
pub use crate::ops_builtin::op_resources;
|
2021-04-12 21:55:05 +02:00
|
|
|
pub use crate::ops_json::op_async;
|
2021-06-25 13:15:35 +09:00
|
|
|
pub use crate::ops_json::op_async_unref;
|
2021-04-12 21:55:05 +02:00
|
|
|
pub use crate::ops_json::op_sync;
|
2020-12-16 17:14:12 +01:00
|
|
|
pub use crate::resources::Resource;
|
|
|
|
pub use crate::resources::ResourceId;
|
2020-05-28 13:36:43 -04:00
|
|
|
pub use crate::resources::ResourceTable;
|
2020-09-06 21:44:29 +02:00
|
|
|
pub use crate::runtime::GetErrorClassFn;
|
2020-12-01 23:33:44 +01:00
|
|
|
pub use crate::runtime::JsErrorCreateFn;
|
2020-09-06 21:44:29 +02:00
|
|
|
pub use crate::runtime::JsRuntime;
|
2020-09-11 15:18:49 +02:00
|
|
|
pub use crate::runtime::RuntimeOptions;
|
2020-09-06 21:44:29 +02:00
|
|
|
pub use crate::runtime::Snapshot;
|
2021-04-28 18:41:50 +02:00
|
|
|
// pub use crate::runtime_modules::include_js_files!;
|
|
|
|
pub use crate::extensions::Extension;
|
|
|
|
pub use crate::extensions::OpMiddlewareFn;
|
2019-02-26 17:36:05 -05:00
|
|
|
|
2019-03-11 17:57:36 -04:00
|
|
|
pub fn v8_version() -> &'static str {
|
2020-01-05 09:19:29 -05:00
|
|
|
v8::V8::get_version()
|
2019-02-26 17:36:05 -05:00
|
|
|
}
|
|
|
|
|
2021-06-22 01:45:41 +02: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.
|
|
|
|
///
|
|
|
|
/// Returns a string in form of: "[deno:<filename>:<line>:<column>]"
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! located_script_name {
|
|
|
|
() => {
|
|
|
|
format!(
|
|
|
|
"[deno:{}:{}:{}]",
|
|
|
|
std::file!(),
|
|
|
|
std::line!(),
|
|
|
|
std::column!()
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-02-02 00:55:23 +09:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_v8_version() {
|
|
|
|
assert!(v8_version().len() > 3);
|
|
|
|
}
|
2019-02-26 17:36:05 -05:00
|
|
|
}
|