1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00
denoland-deno/core
Bartek Iwańczuk b40086fd7d
refactor(core): include_js_files! 'dir' option doesn't change specifiers (#18019)
This commit changes "include_js_files!" macro from "deno_core"
in a way that "dir" option doesn't cause specifiers to be rewritten 
to include it.

Example:
```
include_js_files! {
  dir "js",
  "hello.js",
}
```

The above definition required embedders to use:
`import ... from "internal:<ext_name>/js/hello.js"`. 
But with this change, the "js" directory in which the files are stored
is an implementation detail, which for embedders results in: 
`import ... from "internal:<ext_name>/hello.js"`.

The directory the files are stored in, is an implementation detail and 
in some cases might result in a significant size difference for the 
snapshot. As an example, in "deno_node" extension, we store the 
source code in "polyfills" directory; which resulted in each specifier 
to look like "internal:deno_node/polyfills/<module_name>", but with 
this change it's "internal:deno_node/<module_name>". 

Given that "deno_node" has over 100 files, many of them having 
several import specifiers to the same extension, this change removes
10 characters from each import specifier.
2023-03-05 02:31:38 +00:00
..
examples fix(core): remove async op inlining optimization (#17899) 2023-02-23 19:50:15 +00:00
00_primordials.js fix(core): introduce SafeRegExp to primordials (#17592) 2023-03-01 08:14:16 +09:00
01_core.js fix(core): remove async op inlining optimization (#17899) 2023-02-23 19:50:15 +00:00
02_error.js fix(core): Add lint check for core (#17223) 2023-01-26 16:56:42 +05:30
async_cancel.rs refactor(cli,core,ext,rt): remove some unnecessary clone or malloc (#17274) 2023-01-05 14:29:50 -05:00
async_cell.rs docs: fix minor typo in AsyncRefCell comment (#17732) 2023-02-11 02:11:16 +00:00
bindings.rs fix(core): remove async op inlining optimization (#17899) 2023-02-23 19:50:15 +00:00
Cargo.toml chore: forward v1.31.1 release commit to main (#17939) 2023-02-24 22:37:46 -05:00
encode_decode_test.js chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
error.rs refactor: rename deno specifiers to internal (#17655) 2023-02-05 17:49:20 +01:00
error_builder_test.js chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
error_codes.rs fix: add WouldBlock error (#17339) 2023-02-12 23:14:33 +01:00
extensions.rs refactor(core): include_js_files! 'dir' option doesn't change specifiers (#18019) 2023-03-05 02:31:38 +00:00
flags.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
gotham_state.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
icudtl.dat chore: upgrade rusty_v8 to 0.62.2 (#17604) 2023-02-07 13:36:41 +01:00
inspector.rs chore: upgrade rusty_v8 to 0.62.2 (#17604) 2023-02-07 13:36:41 +01:00
internal.d.ts fix(core): introduce SafeRegExp to primordials (#17592) 2023-03-01 08:14:16 +09:00
io.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
lib.deno_core.d.ts fix(ext/ffi): Fix re-ref'ing UnsafeCallback (#17704) 2023-02-22 19:09:59 +00:00
lib.rs refactor: remove Semaphore::new(1) and use TaskQueue (#18014) 2023-03-04 20:07:11 -05:00
module_specifier.rs chore: upgrade to Rust 1.67 (#17548) 2023-01-27 10:43:16 -05:00
modules.rs refactor(core): More efficient serde for ES modules in snapshot (#17856) 2023-02-21 21:12:22 +01:00
normalize_path.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
ops.rs chore: upgrade to Rust 1.67 (#17548) 2023-01-27 10:43:16 -05:00
ops_builtin.rs feat(ops): reland fast zero copy string arguments (#17996) 2023-03-03 19:04:10 +05:30
ops_builtin_v8.rs chore: upgrade rusty_v8 to 0.63.0 (#17705) 2023-02-10 12:40:03 +00:00
ops_metrics.rs chore: use rustfmt imports_granularity option (#17421) 2023-01-14 23:18:58 -05:00
README.md chore(core): remove core.opSync (#16379) 2022-10-21 19:35:23 +05:30
resources.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
runtime.rs fix(core): remove async op inlining optimization (#17899) 2023-02-23 19:50:15 +00:00
serialize_deserialize_test.js chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
snapshot_util.rs build: add "include_js_files_for_snapshotting" Cargo feature (#17826) 2023-02-20 21:45:34 +01:00
source_map.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
task_queue.rs refactor: remove Semaphore::new(1) and use TaskQueue (#18014) 2023-03-04 20:07:11 -05:00

Deno Core Crate

crates docs

The main dependency of this crate is rusty_v8, which provides the V8-Rust bindings.

This Rust crate contains the essential V8 bindings for Deno's command-line interface (Deno CLI). The main abstraction here is the JsRuntime which provides a way to execute JavaScript.

The JsRuntime implements an event loop abstraction for the executed code that keeps track of all pending tasks (async ops, dynamic module loads). It is user's responsibility to drive that loop by using JsRuntime::run_event_loop method - it must be executed in the context of Rust's future executor (eg. tokio, smol).

Rust functions can be registered in JavaScript using deno_core::Extension. Use the Deno.core.ops.op_name() and Deno.core.opAsync("op_name", ...) functions to trigger the op function callback. A conventional way to write ops is using the deno_ops crate.

Documentation for this crate is thin at the moment. Please see hello_world.rs and http_bench_json_ops.rs as examples of usage.

TypeScript support and lots of other functionality are not available at this layer. See the CLI for that.