0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

80 commits

Author SHA1 Message Date
Bartek Iwańczuk
e5beb800c9
refactor: move JsRuntimeInspector to deno_core (#10763)
This commit moves implementation of "JsRuntimeInspector" to "deno_core" crate.

To achieve that following changes were made:

* "Worker" and "WebWorker" no longer own instance of "JsRuntimeInspector",
instead it is now owned by "deno_core::JsRuntime".

* Consequently polling of inspector is no longer done in "Worker"/"WebWorker",
instead it's done in "deno_core::JsRuntime::poll_event_loop".

* "deno_core::JsRuntime::poll_event_loop" and "deno_core::JsRuntime::run_event_loop",
now accept "wait_for_inspector" boolean that tells if event loop should still be 
"pending" if there are active inspector sessions - this change fixes the problem 
that inspector disconnects from the frontend and process exits once the code has
stopped executing.
2021-05-26 21:07:12 +02:00
Bartek Iwańczuk
0768f8d369
refactor(core): move ModuleMap to separate RefCell (#10656)
This commit moves bulk of the logic related to module loading
from "JsRuntime" to "ModuleMap".

Next steps are to rewrite the actual loading logic (represented by
"RecursiveModuleLoad") to be a part of "ModuleMap" as well --
that way we will be able to track multiple module loads from within
the map which should help me solve the problem of concurrent
loads (since all info about currently loading/loaded modules will
be contained in the ModuleMap, so we'll be able to know if actually
all required modules have been loaded).
2021-05-19 20:53:43 +02:00
Elias Sjögreen
4ed1428c34
fix: align plugin api with Extension (#10427) 2021-05-07 09:45:07 -04:00
Aaron O'Mullan
ea917384fe
refactor(core): convert core.print() to a builtin op (#10436) 2021-05-02 19:30:03 -04:00
Aaron O'Mullan
fc9c7de94b
cleanup(core): replace OpResponse with OpResult (#10434)
Drop the Value/Buffer enum since #10432 allows buffers to be serialized rust => v8
2021-04-30 10:51:54 -04:00
Aaron O'Mullan
4e6790a5fa
feat(serde_v8): ZeroCopyBuf (#10432)
Bidirectional zero-copy serialization of buffers between v8 & rust
that can be nested in structs/tuples/etc.
2021-04-30 08:42:09 -04:00
Aaron O'Mullan
0260b488fb
core: introduce extensions (#9800)
Extensions allow declarative extensions to "JsRuntime" (ops, state, JS or middleware).

This allows for:
- `op_crates` to be plug-and-play & self-contained, reducing complexity leaked to consumers
- op middleware (like metrics_op) to be opt-in and for new middleware (unstable, tracing,...)
- `MainWorker` and `WebWorker` to be composable, allowing users to extend workers with their ops whilst benefiting from the other infrastructure (inspector, etc...)

In short extensions improve deno's modularity, reducing complexity and leaky abstractions for embedders and the internal codebase.
2021-04-28 18:41:50 +02:00
Aaron O'Mullan
1c7164257d
refactor(core): move builtin ops to their own file (#10336) 2021-04-25 19:23:22 +02:00
Aaron O'Mullan
167f017ca0
refactor(core): move SerializablePkg to serde_v8 (#10231) 2021-04-19 15:19:49 +02:00
Aaron O'Mullan
2eafbf2b98
perf(core/ops): avoid allocs when returning primitives (#10149) 2021-04-12 17:38:26 -04:00
Aaron O'Mullan
46b1c653c0
refactor(deno): remove concept of bin & json ops (#10145) 2021-04-12 15:55:05 -04:00
Aaron O'Mullan
19d0e6b671
perf(serde_v8): introduce Serializable boxable object (#9983) 2021-04-04 01:17:02 +02:00
Aaron O'Mullan
058579da56
refactor(ops): remove variadic buffers (#9944) 2021-04-02 09:47:57 -04:00
Aaron O'Mullan
fec1b2a5a4
refactor: new optimized op-layer using serde_v8 (#9843)
- Improves op performance.
- Handle op-metadata (errors, promise IDs) explicitly in the op-layer vs
  per op-encoding (aka: out-of-payload).
- Remove shared queue & custom "asyncHandlers", all async values are
  returned in batches via js_recv_cb.
- The op-layer should be thought of as simple function calls with little
  indirection or translation besides the conceptually straightforward
  serde_v8 bijections.
- Preserve concepts of json/bin/min as semantic groups of their
  inputs/outputs instead of their op-encoding strategy, preserving these
  groups will also facilitate partial transitions over to v8 Fast API for the
  "min" and "bin" groups
2021-03-31 10:37:38 -04:00
Ryan Dahl
f46e39c5c5
remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
Inteon
1251c89321
refactor: Move bin ops to deno_core and unify logic with json ops (#9457)
This commit moves implementation of bin ops to "deno_core" crates
as well as unifying logic between bin ops and json ops to reuse
as much code as possible (both in Rust and JavaScript).
2021-03-20 17:51:08 +01:00
Ryan Dahl
c7dabc99ee
Make ModuleSpecifier a type alias, not wrapper struct (#9531) 2021-02-17 13:47:18 -05:00
Yusuke Tanaka
84f8b87f1b
chore: make all tests annotated with #[cfg(test)] (#9347) 2021-02-01 10:55:23 -05:00
Ryan Dahl
2b75a11559
update copyright to 2021 (#9081) 2021-01-10 21:59:07 -05:00
Bartek Iwańczuk
6984b63f2f
refactor: rewrite ops to use ResourceTable2 (#8512)
This commit migrates all ops to use new resource table
and "AsyncRefCell".

Old implementation of resource table was completely 
removed and all code referencing it was updated to use
new system.
2020-12-16 17:14:12 +01:00
Bartek Iwańczuk
a19fea918f
Revert "build: Factor out common code into core/build_util.rs (#8756)" (#8763)
This reverts commit 502c77aad9.
2020-12-14 18:42:40 +01:00
Ryan Dahl
502c77aad9
build: Factor out common code into core/build_util.rs (#8756) 2020-12-14 14:28:56 +01:00
Bartek Iwańczuk
65e72b68ac
refactor(cli): decouple ops from ProgramState and Flags (#8659)
This commit does major refactor of "Worker" and "WebWorker",
in order to decouple them from "ProgramState" and "Flags".
The main points of interest are "create_main_worker()" and
"create_web_worker_callback()" functions which are responsible
for creating "Worker" and "WebWorker" in CLI context.
As a result it is now possible to factor out common "runtime"
functionality into a separate crate.
2020-12-11 18:49:26 +01:00
Bert Belder
b200e6fc3e
core: add plumbing for canceling ops when closing a resource (#8661) 2020-12-09 15:58:36 +01:00
Bartek Iwańczuk
f49d955601
fix(compile): disable source mapping of errors (#8581)
This commit disables source mapping of errors
for standalone binaries. Since applying source
maps relies on using file fetcher infrastructure
it's not feasible to use it for standalone binaries
that are not supposed to use that infrastructure.
2020-12-01 23:33:44 +01:00
Yusuke Tanaka
b8d3caa5d5
feat(core): Add FsModuleLoader that supports loading from filesystem (#8523)
This commit adds `FsModuleLoader` to `deno_core`, which implements
`ModuleLoader` trait. It is used when creating a runtime that supports
module loading from filesystem.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-11-27 22:45:38 +01:00
Bert Belder
8d12653738
core: implement 'AsyncRefCell' and 'ResourceTable2' (#8273) 2020-11-25 01:15:14 +01:00
Ben Noordhuis
46b892ad37
refactor(core): more control over isolate creation (#8000)
Make JSRuntime::new() accept a custom v8::CreateParams object to tune
the v8::Isolate it creates.

Subsumes the functionality of HeapLimits, which I therefore removed.
2020-10-17 11:56:15 +02:00
Ryan Dahl
2379a3b340
Implement Serialize for ModuleSpecifier (#7900)
Also re-export serde from deno_core, since its now a dependency.
2020-10-09 15:45:40 -04:00
Ryan Dahl
ffd08a2249
Actually remove js_check (#7636) 2020-09-22 23:16:00 -04:00
Bartek Iwańczuk
bda9379385
refactor: move op_resources and op_close to deno_core (#7539)
Moves op_close and op_resources to deno_core::ops and exports them.
Adds serde dependency to deno_core and reexports it.

Moves JS implementation of those ops to Deno.core and reexports them in Deno.
2020-09-17 18:09:50 +02:00
Ryan Dahl
104aebdfb5
Re-export deno_core::url (#7525)
Also re-exports deno_core::futures and deno_core::serde_json but these are not yet used in the CLI.
2020-09-16 14:28:07 -04:00
Ryan Dahl
055dfe2ff4
Make JsRuntimeState private (#7484) 2020-09-14 23:49:12 -04:00
Scott Olson
cf91550c65
refactor: Remove dependency on downcast_rs. (#7475)
We don't seem to use downcast_rs in any essential way. We can just use
the standard library `Any` directly.
2020-09-14 22:33:18 -04:00
Bert Belder
f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Bartek Iwańczuk
0d1f626edd
refactor(core): JsRuntime initialization (#7415)
Removes:
- "deno_core::StartupData"
- "deno_core::Script"
- "deno_core::OwnedScript"

Changes to "JsRuntime":
- remove "new_with_loader()"
- remove "with_heap_limits()"
- rename "IsolateOptions" to "RuntimeOptions" and make public
- "JsRuntime::new()" takes "RuntimeOptions" as a single param
2020-09-11 15:18:49 +02:00
Ryan Dahl
7c2e7c6608
Use gotham-like state for ops (#7385)
Provides a concrete state type that can be dynamically added. This is necessary for op crates.
* renames BasicState to OpState
* async ops take `Rc<RefCell<OpState>>`
* sync ops take `&mut OpState`
* removes `OpRegistry`, `OpRouter` traits
* `get_error_class_fn` moved to OpState
* ResourceTable moved to OpState
2020-09-10 09:57:45 -04:00
KrisChambers
1cd2267500
feat(info): Dependency count and sizes (#6786)
This commit changes "deno info" subcommand logic.

- Modules are no longer loaded into V8 isolate - analysis
  is done using ModuleGraph.
- Removed deno_core::Deps structure.
- Modules are no longer type-checked and transpiled - 
  "compiled" file is shown only if it is already available.
- Added number of unique dependencies for root module.
- Changed tree output:
  - file size is shown next to the dependency
  - repeated dependencies are marked with "*"
  - used less spaces in prefix to save terminal width
2020-09-07 15:59:47 +02:00
Bartek Iwańczuk
f57a2c1e85
refactor(core): rename CoreIsolate to JsRuntime (#7373)
deno_core/
- rename core_isolate.rs to runtime.rs
- rename CoreIsolate to JsRuntime
- rename JSError to JsError
- rename JSStackFrame to JsStackFrame

cli/
- update references from deno_core::CoreIsolate to deno_core::JsRuntime
- rename deno_core::JSError to deno_core::JsError
- rename fmt_errors::JSError to fmt_errors::JsError
2020-09-06 21:44:29 +02:00
Bartek Iwańczuk
803bdd37c7
refactor(core): merge CoreIsolate and EsIsolate (#7370) 2020-09-06 16:50:49 +02:00
Bert Belder
c821e8f2f1
Move JSON ops to deno_core (#7336) 2020-09-06 02:34:02 +02:00
Ryan Dahl
fee6f79330
Remove unused crate_modules feature (#7311) 2020-09-01 13:55:40 -04:00
Bert Belder
c8b5f1e454
Simplify ErrBox-to-class mapping & hook it up to core json ops (#7195) 2020-08-26 18:48:04 +02:00
Bert Belder
9bfb0df805
refactor: remove OpError, use ErrBox everywhere (#7187)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-08-26 00:22:15 +02:00
Ryan Dahl
0095611af9
First pass at json ops in core (#7033)
Adds Deno.core.jsonOpSync and Deno.core.jsonOpAsync
2020-08-20 09:45:59 -04:00
Bert Belder
f6e9150b33
Async op dispatcher support with 'stateful_json_op_(a)sync()' (#7095)
Closes: #7020
2020-08-18 20:50:52 +02:00
Moritz Gunz
a17ea9150d
Add missing export of HeapLimits (#7047)
Currently this blocks using the ::with_heap_limits constructor of CoreIsolate, because you cannot access the struct.
2020-08-14 13:39:51 -04:00
Divy Srivastava
ad4af23aba
unify path normalization utility (#6865) 2020-08-12 16:34:17 -04:00
Ryan Dahl
f5a4f1fdc0
Undo JsonOpDispatcher and OpDispatcher traits (#7023)
This reverts commit f83d672ffa.
This reverts commit d51972377c.
2020-08-12 16:44:58 +02:00
Gurwinder Singh
d51972377c
refactor: Make OpDispatcher a trait (#6736) 2020-07-13 16:19:51 -04:00