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

729 commits

Author SHA1 Message Date
Ryan Dahl
1f821dd5e5
chore: remove dead code (#10321) 2021-04-23 10:39:02 +10:00
Aaron O'Mullan
ff9ff4a377
refactor(core): simplify error handling (#10297)
- register builtin v8 errors in core.js so consumers don't have to
- remove complexity of error args handling (consumers must provide a 
  constructor with custom args, core simply provides msg arg)
2021-04-21 20:50:50 -04:00
Aaron O'Mullan
89bb774010
refactor(core): kill recv() and init() (#10299)
`init()` was previously needed to init the shared queue, but now that it's
gone `init()` only registers the async msg handler which is snapshot 
safe and constant since the op layer refactor.
2021-04-21 20:48:17 -04:00
Bartek Iwańczuk
3432833574
chore: release crates (#10269)
* Revert "tooling(bench_util): benching and profiling utilities (#10223)"

This reverts commit 733a000305.

* Upgrade notify
2021-04-21 00:15:39 +02:00
Yoshiya Hinosawa
8424647d22
chore: update copyright headers (#10243) 2021-04-20 14:27:36 +09:00
Aaron O'Mullan
167f017ca0
refactor(core): move SerializablePkg to serde_v8 (#10231) 2021-04-19 15:19:49 +02:00
Aaron O'Mullan
5b31d0f846
cleanup(core): simplify op_async(), drop need for try_dispatch_op() (#10240) 2021-04-18 15:29:06 +02:00
Aaron O'Mullan
733a000305
tooling(bench_util): benching and profiling utilities (#10223) 2021-04-18 14:51:48 +02:00
Aaron O'Mullan
8fb1af1412
refactor(core): remove ZeroCopyBuf's dep on the bindings mod (#10232)
Also cleanup `bindings::deserialize()/decode()` so they 
use the `ZeroCopyBuf` abstraction rather than reimplementing it.

This cleanup will facilitate moving `ZeroCopyBuf` to `serde_v8` 
since it's now self contained and there are no other 
`get_backing_store_slice()` callers.
2021-04-18 14:39:26 +02:00
Ben Noordhuis
ad7f6d4510
fix(core): better "missing type" GothamState error (#10189)
Include the type name in the error message so you know what to look for.
2021-04-14 23:11:39 +02:00
Bartek Iwańczuk
1be65bbe4f
chore: release crates (#10164) 2021-04-13 18:22:48 +02:00
Casper Beyer
ec1fce58d9
fix(core): remove wasm-test-streaming flag (#10158) 2021-04-13 06:20:05 -04:00
Bert Belder
36f147364a
upgrade: rusty_v8 0.22.1 (V8 9.1.269.5) (#10159) 2021-04-13 08:47:24 +00:00
Bert Belder
b9f758d3ad upgrade: rusty_v8 0.22.0 (V8 9.1.269.2) (#10152) 2021-04-13 02:54:36 +02:00
Aaron O'Mullan
2eafbf2b98
perf(core/ops): avoid allocs when returning primitives (#10149) 2021-04-12 17:38:26 -04:00
Ben Noordhuis
73b7bd92e5 core: remove some unnecessary heap allocations 2021-04-12 22:03:32 +02:00
Ben Noordhuis
986513c080 core: let embedders plug in their own V8 platform
Fixes #9912.
2021-04-12 22:03:32 +02: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
bf99039ea9
feat: Add Deno.memoryUsage() (#9986) 2021-04-12 10:47:44 +02:00
Aaron O'Mullan
29eca72fea
core: avoid async op future reboxing to bundle PromiseId (#10123) 2021-04-11 07:05:43 +02:00
Aaron O'Mullan
0fd1fb9329
perf: use BTreeMap for ResourceTable (#10074) 2021-04-09 14:07:24 -04:00
Aaron O'Mullan
0b4cb29386
perf(core): use BTreeMap for GothamState (#10073)
This commit replaces GothamState's internal HashMap 
with a BTreeMap to improve performance.

OpState/GothamState keys by TypeId which is essentially 
an opaque u64. For small sets of integer keys BTreeMap 
outperforms HashMap mainly since it removes the hashing 
overhead and Eq/Comp on integer-like types is very cheap, 
it should also have a smaller memory footprint.

We only use ~30 unique types and thus ~30 unique keys to 
access OpState, so the keyset is small and immutable 
throughout the life of a JsRuntime, there's no meaningful 
churn in keys added/removed.
2021-04-09 19:49:11 +02:00
Nayeem Rahman
c86ee742a2
fix: async op error stacktraces (#10080)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2021-04-09 11:55:33 -04:00
Luca Casonato
4e70ff80c2
chore: update deps (#10058)
This commit updates crate dependencies.
2021-04-08 18:46:14 +02:00
Inteon
d050b491b1
fix(core): error handling in examples (#9867) 2021-04-08 18:04:02 +02:00
Aaron O'Mullan
2865f39bec
perf(core.js): introduce promise ring (#9979)
This is another optimization to help improve the baseline overhead 
of async ops. It shaves off ~55ns/op or ~7% of the current total 
async op overhead.

It achieves these gains by taking advantage of the sequential 
nature of promise IDs and optimistically stores them sequentially 
in a pre-allocated circular buffer and fallbacks to the promise Map 
for slow to resolve promises.
2021-04-07 14:38:54 +02:00
Aaron O'Mullan
91e80ada8a
core: remove serde_json-isms in op_close() and op_resources() (#10026)
Core no longer uses `serde_json` now, besides re-exporting it or in the module specifier tests
2021-04-05 23:17:00 -04:00
Nayeem Rahman
1312a57984
fix: Properly await already evaluating dynamic imports (#9984) 2021-04-04 07:26:00 -04:00
Aaron O'Mullan
19d0e6b671
perf(serde_v8): introduce Serializable boxable object (#9983) 2021-04-04 01:17:02 +02:00
Ryan Dahl
d2fbbfbbf3
refactor: don't call Context::Global in async_op_response (#9971) 2021-04-03 14:33:01 +02:00
Aaron O'Mullan
22cef71c4e
core/op_baseline: drop BufVec and minor cleanup (#9969) 2021-04-02 17:36:01 +02:00
Aaron O'Mullan
ee3aa612aa
perf: bench async op baseline (#9954) 2021-04-02 16:06:30 +02:00
Aaron O'Mullan
058579da56
refactor(ops): remove variadic buffers (#9944) 2021-04-02 09:47:57 -04:00
Kitson Kelly
df1d36a759 chore: bump dependent crates for cli (#9964) 2021-04-02 22:22:08 +11:00
Aaron O'Mullan
6eace4de5c
perf(core): js errors as unions vs tuples to reduce allocs (#9947) 2021-04-01 07:24:30 -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
Aaron O'Mullan
7efea6cc20
perf: add op_baseline bench (#9924) 2021-03-30 16:20:45 +02:00
Aaron O'Mullan
699eeebc12
refactor(core): decode JsStackFrames using serde_v8 (#9902) 2021-03-27 01:25:48 +01:00
Ryan Dahl
f46e39c5c5
remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
Aaron O'Mullan
505db5da2c
refactor(core): simplify heapStats() by using serde_v8 (#9901) 2021-03-26 09:09:22 -04:00
Ryan Dahl
9f9db6accd
chore: publish serde_v8, bump version (#9898) 2021-03-26 08:51:38 +01:00
Aaron O'Mullan
3d2e05dc7b
Introduce serde_v8 (#9722) 2021-03-25 22:36:46 -04:00
Yusuke Tanaka
e7954413e1
upgrade: Rust 1.51.0 (#9895) 2021-03-25 19:17:37 +01:00
Kitson Kelly
5ebb401703
feat(lsp): add import completions (#9821) 2021-03-25 11:13:37 +11:00
Aaron O'Mullan
876f075dde
feat(core): Deno.core.heapStats() (#9659)
This commit implements "Deno.core.heapStats()" function 
that allows to programatically measure isolate heap-usage.
2021-03-23 15:33:06 +01:00
Bartek Iwańczuk
c08284ab9d
chore: release crates (#9847) 2021-03-21 16:10:08 +01:00
Andrew Mitchell
c00872c0c0
fix(core): don't panic on invalid arguments for Deno.core.print (#9834) 2021-03-21 08:52:28 -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
0d26a82ea9
upgrade: tokio 1.4.0 (#9842) 2021-03-20 11:51:27 -04:00
Divy Srivastava
91ca58fb26
chores: enforce type ResourceId across codebase (#9837) 2021-03-19 13:25:37 -04:00
Inteon
20627c9136
refactor: update minimal ops & rename to buffer ops (#9719)
This commit rewrites "dispatch_minimal" into "dispatch_buffer".

It's part of an effort to unify JS interface for ops for both json
and minimal (buffer) ops.

Before this commit "minimal ops" could be either sync or async
depending on the return type from the op, but this commit changes
it to have separate signatures for sync and async ops (just like 
in case of json ops).
2021-03-18 14:10:27 +01:00
Yusuke Tanaka
c8fbf6d38a
chore: upgrade to tokio 1.3.0 (#9778) 2021-03-14 10:03:24 -04:00
Ben Noordhuis
10b99e8eb0
refactor: simplify icu data alignment (#9766) 2021-03-12 23:55:32 +01:00
Luca Casonato
fbec6e39c7
chore: bump crates (#9769) 2021-03-12 22:29:07 +01:00
Ryan Dahl
2f9d7c02dc
upgrade: rusty_v8 0.21.0 (#9725) 2021-03-10 15:16:43 -05:00
Bartek Iwańczuk
cdc0b6958d
chore: release crates (#9731) 2021-03-09 20:12:13 +01:00
Inteon
4cd1f3d2b2
fix(core): shared queue assertion failure in case of js error (#9721)
In case JavaScript throws an unhandled error, part of the "shared_queue" could
be still unprocessed.

If this is the case; throw the js runtime error instead of asserting on the 
queue size not being 0.
2021-03-08 15:53:39 +01:00
Nayeem Rahman
0f2121355f
fix(runtime/web_worker): Don't block self.onmessage with TLA (#9619)
This commit rewrites implementation of "JsRuntime::mod_evaluate". 

Event loop is no longer polled automatically and users must manually
drive event loop forward after calling "mod_evaluate".

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-03-04 13:19:47 +01:00
Ryan Dahl
f1fe6a57ba
Bump crate versions (#9651) 2021-03-02 15:15:43 -05:00
Ryan Dahl
3d87198ba0
Upgrade rusty_v8 (V8 9.0.257.3) (#9605) 2021-02-25 19:22:01 -05:00
Luca Casonato
975705a649
chore(core): optional args for registerErrorClass (#9602) 2021-02-25 20:06:06 +01:00
Bartek Iwańczuk
dc3683c7a4
refactor(core): cleanup module implementation (#9580)
* remove "ModuleNameMap", instead define that map inline inside "Modules" struct
* remove "dyn_import_id" argument from "mod_instantiate"
* rename "Modules" struct to "ModuleMap"
* rename "JsRuntime::modules" to "JsRuntime::module_map"
2021-02-23 15:22:55 +01:00
Inteon
dccf5e0c5c
refactor(core): Allow multiple overflown responses in single poll (#9433)
This commit rewrites "JsRuntime::poll" function to fix a corner case that
might caused "overflown_response" to be overwritten by other overflown response.

The logic has been changed to allow returning multiple overflown response
alongside responses from shared queue.
2021-02-23 13:08:50 +01:00
Nayeem Rahman
14ec22e880
fix(core/bindings): Add stacks for dynamic import resolution errors (#9562) 2021-02-21 16:22:06 +01:00
Nayeem Rahman
10fb25db63
fix(core/runtime): Fix dynamic imports for already rejected modules (#9559) 2021-02-20 22:50:13 +01:00
Luca Casonato
4f80587d26
chore: rename default branch to main (#9503) 2021-02-19 15:58:19 +01:00
Nayeem Rahman
555595e6d0
fix(core): Make dynamic import async errors catchable (#9505)
Fixes #6259
2021-02-19 09:36:02 +11:00
Ryan Dahl
c7dabc99ee
Make ModuleSpecifier a type alias, not wrapper struct (#9531) 2021-02-17 13:47:18 -05:00
Inteon
e2a91190c3
feat: add structured cloning to Deno.core (#9458)
This commit adds two new "Deno.core" APIs:
- "Deno.core.serialize"
- "Deno.core.deserialize"

These APIs are used to provide structured cloning of values
and will be used for further web worker implementation.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-02-16 14:20:21 +01:00
Bartek Iwańczuk
0cf952e7fb
upgrade: rusty_v8 0.19.0 (#9466)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2021-02-15 17:32:08 +01:00
Aaron O'Mullan
1afe6b48e0
refactor(core): Reduce verbosity of binding core functions (#9497) 2021-02-15 12:53:33 +01:00
Jared Beller
b50691efed
refactor(core): Strongly typed deserialization of JSON ops (#9423)
This PR makes json_op_sync/async generic to all Deserialize/Serialize types
instead of the loosely-typed serde_json::Value. Since serde_json::Value
implements Deserialize/Serialize, very little existing code needs to be updated,
however as json_op_sync/async are now generic, type inference is broken in some
cases (see cli/build.rs:146). I've found this reduces a good bit of boilerplate,
as seen in the updated deno_core examples.

This change may also reduce serialization and deserialization overhead as serde
has a better idea of what types it is working with. I am currently working on
benchmarks to confirm this and I will update this PR with my findings.
2021-02-13 11:56:56 -05:00
Bartek Iwańczuk
39f3aaaa72
chore: release crates (#9481) 2021-02-12 16:23:39 +01:00
Luca Casonato
a195c75033
chore: update dependencies (#9455) 2021-02-09 15:34:34 +01:00
Bartek Iwańczuk
b85ed4a6f0
chore: add flag to v8 (#9456) 2021-02-09 13:06:24 +01:00
Ikko Ashimine
45b465f839
chore: fix typo in lib.deno_core.d.ts (#9416) 2021-02-07 16:30:45 +01:00
Bartek Iwańczuk
a6723fafc5
upgrade: rusty_v8 0.17.0, v8 9.0.123 (#9413) 2021-02-05 22:25:02 +01:00
Bartek Iwańczuk
64f06be0eb
chore: release crates (#9410) 2021-02-05 15:08:18 +01:00
Developing
923214c537
chore: use strict mode for internal runtime, core, and op_crates js (#9391) 2021-02-04 23:18:32 +01:00
Yusuke Tanaka
84f8b87f1b
chore: make all tests annotated with #[cfg(test)] (#9347) 2021-02-01 10:55:23 -05:00
Kitson Kelly
534531e4dd
feat(lsp): add references code lens (#9316) 2021-02-01 14:30:41 +11:00
Yusuke Tanaka
ef46bc88bd
chore: upgrade tokio to 1.1.1 (#9327) 2021-01-29 21:18:31 -05:00
Ryan Dahl
11dd6f2013
v1.7.1 2021-01-29 09:53:03 -05:00
Luca Casonato
6ecc86cf2a
chore: add jsdoc to 26_fetch.js and enable some fetch tests (#9305) 2021-01-28 21:37:21 +01:00
Luca Casonato
40fc5f55ea
chore: update crates (#9251)
Updates SWC, dprint, deno_lint, deno_doc, serde, and Tokio (to 1.1.0).

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-01-26 17:00:40 +01:00
Nayeem Rahman
bdb1ee6480
fix(core): Handle prepareStackTrace() throws (#9211)
Fixes #9206
2021-01-21 20:48:04 +11:00
Ryan Dahl
bfaa121cd2
v1.7.0 2021-01-19 23:17:20 -05:00
Ryan Dahl
9312d48e69
upgrade: rusty_v8 0.16.0, v8 8.9.255.3 (#9180) 2021-01-19 18:40:30 -08:00
Ryan Dahl
8fc29f224d release crates 2021-01-13 14:00:13 -05:00
Bartek Iwańczuk
275a5c65a2
upgrade: tokio 1.0 (#8779)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2021-01-11 23:50:02 -08:00
Ryan Dahl
36ff7bdf57
chore: Move comment to correct place (#9086) 2021-01-11 18:22:15 +01:00
Ryan Dahl
2b75a11559
update copyright to 2021 (#9081) 2021-01-10 21:59:07 -05:00
Anonymous
b40d5e5e0b
ignore "use asm" (#9019)
Preventing V8 from logging erroneous line numbers. Use wasm.
2021-01-07 10:50:57 -05:00
Bartek Iwańczuk
46c0cab763
refactor(core): simplify Deno.core initialisation, remove stale TODO (#8847)
This commit rewrites initialisation of the "shared queue" and
in effect prevents from double execution of "core/core.js" and
"core/error.js".

Previously both of these files were executed every time a "JsRuntime"
was created. That lead to a situation where one copy of each script
was included in the snapshot and then another copy would be
executed after loading the snapshot.

Effectively "JsRuntime::shared_init" was removed; instead execution
of those scripts and actual initialisation of shared queue
was split into two helper functions: "JsRuntime::js_init" and
"JsRuntime::share_queue_init".

Additionally stale TODO comments were removed.
2021-01-05 22:10:50 +01:00
Luca Casonato
0d41e21b0e
fix: align encoding APIs to spec using WPT (#9004) 2021-01-05 19:50:40 +01:00
Bartek Iwańczuk
41a4a34aee
upgrade: Rust 1.49.0 (#8955) 2021-01-02 13:52:42 +01:00
Bartek Iwańczuk
4997f426c3
chore: release crates (#8931) 2020-12-30 15:29:17 +01:00
Deepanshu Utkarsh
115de4c81a
fix(core): Fix incorrect index in Promise.all error reporting (#8913) 2020-12-29 15:24:19 +01:00
Bartek Iwańczuk
c98c487fda
upgrade: rusty_v8 0.15.0, v8 8.8.294 (#8898) 2020-12-28 16:36:44 +01:00
Yosi Pramajaya
c1fdb30394
fix: fetch bad URL will not panic (#8884) 2020-12-26 08:06:00 -05:00
Ben Noordhuis
d77452c79f
core: fix http_bench_json_ops, register Error (#8860)
Fixes the following runtime error for me when benchmarking:

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err`
    value: Error: Unregistered error class: "Error"
      Connection reset by peer (os error 104)
      Classes of errors returned from ops should be registered via
      Deno.core.registerErrorClass().
        at processResponse (deno:core/core.js:219:13)
        at Object.jsonOpAsync (deno:core/core.js:240:12)
        at async read (http_bench_json_ops.js:29:21)
        at async serve (http_bench_json_ops.js:45:19)',
        core/examples/http_bench_json_ops.rs:260:28
2020-12-22 18:01:07 +01:00
Bartek Iwańczuk
6ce310fa27
chore: release crates (#8854) 2020-12-22 14:50:13 +01:00
Bartek Iwańczuk
3eec73ff90
Revert "fix: TLA in web worker (#8809)" (#8839)
This reverts commit e924bbdf36.
2020-12-20 15:14:19 +01:00
Bartek Iwańczuk
e924bbdf36
fix: TLA in web worker (#8809)
Implementors of `deno_core::JsRuntime` might want to do additional actions
during each turn of event loop, eg. `deno_runtime::Worker` polls inspector,
`deno_runtime::WebWorker` receives/dispatches messages from/to worker host.
Previously `JsRuntime::mod_evaluate` was implemented in such fashion that it 
only polled `JsRuntime`'s event loop. This behavior turned out to be wrong 
in the example of `WebWorker` which couldn't receive/dispatch messages because
its implementation of event loop was never called. 

This commit rewrites "mod_evaluate" to return a handle to receiver that resolves
when module's promise resolves. It is now implementors responsibility to poll
event loop after calling `mod_evaluate`.
2020-12-20 00:34:22 +01: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
Kitson Kelly
63a821b78b
fix(cli): make dynamic import errors catchable (#8750)
Fixes #6259
2020-12-15 16:52:55 +11:00
Bartek Iwańczuk
025c0a1d37
chore: release crates (#8765) 2020-12-14 19:47:28 +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
Bartek Iwańczuk
8f8749095c
chore: release crates (#8760) 2020-12-14 17:11:17 +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
389f492551
chore: release crates (#8744) 2020-12-13 22:34:54 +01:00
Bartek Iwańczuk
2e74f164b6
refactor: deno_runtime crate (#8640)
This commit moves Deno JS runtime, ops, permissions and
inspector implementation to new "deno_runtime" crate located
in "runtime/" directory.

Details in "runtime/README.md".

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-12-13 19:45:53 +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
Anh Hong
b8bc24d167
chore: fixed various misspellings and other typos (#8691) 2020-12-11 06:45:45 +11:00
Bartek Iwańczuk
f91fa16661
refactor(core): stack trace mapping (#8660)
This commit adds "Deno.core.createPrepareStackTrace". This function
was moved from "cli/rt/40_error_stack.js" to unify handling of stack frames in core
(before this PR there was implicit dependency on logic in "core/error.rs::JsError").
Unfortunately formatting logic must still be duplicated in "cli/error.js::PrettyJsError"
to provide coloring, but currently there's no solution to this problem.
"createPrepareStackTrace" can accept a single argument; a function that takes
a location and provides source mapped location back.
2020-12-10 14:45:41 +01:00
Ryan Dahl
b6dd850f71
build: fix doctests, run cargo publish --dry-run (#8689)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-12-09 17:02:07 +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
b1379b7de3
test(core): type aliases in OpState (#8653)
This commit adds a test case to core/gotham_state.rs that shows
that type aliases can't be used reliably. Instead wrapper types
should be used.
2020-12-09 15:55:05 +01:00
Bartek Iwańczuk
656caa2d4f
chore: release crates (#8662) 2020-12-08 13:54:19 +01:00
Ryan Dahl
8bf3e0f4c6
upgrade rusty_v8 to 0.14.0 (#8663) 2020-12-08 03:20:01 +01:00
Bartek Iwańczuk
02762824e6
refactor(core): change script name for core.js (#8650)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2020-12-08 00:36:15 +01:00
Paco
300b39b889
docs(core): Fix typo in load_module's docstring (#8564) 2020-12-05 15:43:46 +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
William Perron
57f163510a
fix(cli): make output of deno info --json deterministic (#8483)
Fixes #8458
2020-11-27 16:51:47 -05: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
Kitson Kelly
e2858d0bbb
chore: clippy future cleanups (#8514) 2020-11-28 06:47:35 +11:00
Bartek Iwańczuk
22f951aa67
fix: panic in worker when closing at top level (#8510)
Fixes panic occurring in worker when "self.close()" is called
at the top level, ie. worker shuts down while
module evaluation promise hasn't yet resolved.
2020-11-27 14:19:24 +01:00
Bert Belder
8d12653738
core: implement 'AsyncRefCell' and 'ResourceTable2' (#8273) 2020-11-25 01:15:14 +01:00
Bartek Iwańczuk
bc79d55649
v1.5.4 2020-11-23 15:10:58 +01:00
Nayeem Rahman
14877f7fe2
feat(unstable): Add deno test --no-run (#8093)
This commit adds new flag to "deno test" subcommand
called "--no-run" that allows to preload, cache an type
check.
2020-11-22 14:06:51 +01:00
Bartek Iwańczuk
ec7f1e399e
refactor(core): don't depend on get_identity_hash for modules (#8354)
This commit refactors "deno_core::Modules" structure to not depend on
"get_identity_hash" function to identify modules, but instead use default
hash implementation.
2020-11-21 16:23:35 +01:00
Bartek Iwańczuk
04f4201f30
refactor(corr): accept get_error_class_fn in RuntimeOptions (#8444)
This commit adds "get_error_class_fn" field to "RuntimeOptions"
struct in order to unify configuration of "JsRuntime".
2020-11-21 15:56:14 +01:00
Bartek Iwańczuk
cf7949db2f
upgrade: rusty_v8 0.13.0, v8 8.8.278.2 (#8446) 2020-11-21 14:45:07 +01:00
De Rouck Antoine
671f96025a
refactor(core): Improve code readability in core.js (#8345) 2020-11-21 14:19:43 +01:00
Bartek Iwańczuk
ab7b8ba8d1
v1.5.3 2020-11-16 11:14:00 +01:00
KNnut
2c8439bc1e
refactor(cli+core): various cleanups in Rust (#8336) 2020-11-13 09:17:31 +11:00
Bartek Iwańczuk
d4c8fa263d
refactor(core): don't depend on get_identity_hash for promises (#8352)
This commit changes how pending promise exceptions are stored
in JsRuntime by using global handle to promise instead of its
identity hash.
2020-11-11 23:11:40 +01:00
Kitson Kelly
71d7482577
v1.5.2 (#8301) 2020-11-09 10:58:21 +11:00
Jan Haller
6162807a7e
docs(core): document several concepts around JsRuntime and ops (#7897) 2020-11-06 12:26:14 +11:00
Bartek Iwańczuk
8e914be742
build: migrate to dlint (#8176)
This commit migrates repository from using "eslint" 
to "dlint" for linting JavaScript code.
2020-11-03 16:19:29 +01:00
Yoshiya Hinosawa
e736d0f60f
fix(prompt): fix display of non-ASCII characters on Windows (#8199) 2020-11-03 01:15:29 +01:00
Nayeem Rahman
07d23baa74
fix(core/error): Remove extra newline from JsError::fmt() (#8145) 2020-10-31 19:57:19 +01:00
Luca Casonato
03769f11b5
v1.5.1 2020-10-31 15:32:43 +01:00
Bartek Iwańczuk
dd01f206da
v1.5.0
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-27 16:00:23 +01:00
Nayeem Rahman
822e5b6536
fix(core/runtime): Indicate exceptions in promises (#8124)
Fixes #4879
2020-10-26 14:34:00 +11:00
Bartek Iwańczuk
8d95bd15e1
refactor(core): remove Deno.core.formatError() (#8091)
With recent improvements to REPL implementation,
Deno.core.formatError() API is no longer needed.
2020-10-23 22:16:12 +02:00
Bartek Iwańczuk
9d36331278
Revert "feat(cli): Add deno cache --test and --worker (#7920)" (#8089)
This reverts commit be15cf285d.
2020-10-23 16:56:25 +02:00
Nayeem Rahman
be15cf285d
feat(cli): Add deno cache --test and --worker (#7920) 2020-10-23 13:31:49 +02:00
Toan Nguyen
29e05bb014
fix: typos in cli and core (#8082) 2020-10-23 13:19:37 +02:00
Ryan Dahl
fb2cae9687
deno_core 0.64.0 (#8025) 2020-10-19 06:35:09 -04:00
Ryan Dahl
59888ff0b2
upgrade rusty_v8 (#8017) 2020-10-18 13:07:11 -04: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
Bartek Iwańczuk
135053486c
fix: top-level-await module execution (#7946)
This commit changes implementation of top-level-await in "deno_core".

Previously promise returned from module evaluation was not awaited,
leading to out-of-order execution of modules that have TLA. It's been
fixed by changing "JsRuntime::mod_evaluate" to be an async function
that resolves when the promise returned from module evaluation also
resolves. When waiting for promise resolution event loop is polled
repeatedly, until there are no more dynamic imports or pending
ops.
2020-10-14 14:04:09 +02:00
Kitson Kelly
10654fa955
refactor(cli): add tsc2 (#7942)
Ref #7225
2020-10-14 10:52:49 +11:00
Bartek Iwańczuk
527628e186
reland JsRuntime/Worker is not a Future (#7924) 2020-10-11 13:20:40 +02:00
Bartek Iwańczuk
9e9ec9784a
v1.4.6 2020-10-10 12:30:55 +02:00
Ryan Dahl
08bb8b3d53
Fix 100% CPU idling problem by reverting #7672 (#7911)
* Revert "refactor: Worker is not a Future (#7895)"

This reverts commit f4357f0ff9.

* Revert "refactor(core): JsRuntime is not a Future (#7855)"

This reverts commit d8879feb8c.

* Revert "fix(core): module execution with top level await (#7672)"

This reverts commit c7c7677825.
2020-10-10 11:41:11 +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
crowlKats
c06fbc449d
Fix typos (#7882) 2020-10-08 15:40:49 -04:00
Bartek Iwańczuk
b5e4b63a88
v1.4.5 2020-10-08 14:20:18 +02:00
Nayeem Rahman
986ad08bce
fix(cli/rt/error_stack): Improve message line formatting (#7860) 2020-10-08 11:05:19 +02:00
Bartek Iwańczuk
d8879feb8c
refactor(core): JsRuntime is not a Future (#7855)
This commit rewrites deno_core::JsRuntime to not implement Future
trait.

Instead there are two separate methods:
- JsRuntime::poll_event_loop() - does single tick of event loop
- JsRuntime::run_event_loop() - runs event loop to completion
2020-10-07 22:30:06 +02:00
Bartek Iwańczuk
a09f4a4abd
upgrade: rusty_v8 0.11.0, V8 8.7.220.3 (#7859) 2020-10-07 17:41:25 +02:00
Bartek Iwańczuk
9b70f2f345
refactor: rename isolate to js_runtime (#7858)
This commit renames occurrences of "isolate" variable name
to "js_runtime". This was outstanding debt after renaming
deno_core::CoreIsolate to JsRuntime.
2020-10-07 17:20:20 +02:00
Bartek Iwańczuk
83f6def3c6
refactor(core): JsRuntime doesn't defer to OwnedIsolate (#7853)
Remove Deref and DeferMut implementations for JsRuntime.
2020-10-07 15:56:52 +02:00
Bartek Iwańczuk
c7c7677825
fix(core): module execution with top level await (#7672)
This commit fixes implementation of top level await in "deno_core".

Previously promise returned from module execution was ignored causing to execute
modules out-of-order.

With this commit promise returned from module execution is stored on "JsRuntime"
and event loop is polled until the promise resolves.
2020-10-06 10:18:22 +02:00
Kitson Kelly
f632b3b6e7
fix(core): handle unregistered errors in core better (#7817) 2020-10-05 20:35:51 +11:00
Bartek Iwańczuk
8d00c32ee2
refactor(core): JsRuntime::poll (#7825)
This commit does reorganization of "JsRuntime::poll" to allow fixing of top-level-await bug.
2020-10-05 11:08:19 +02:00
Bartek Iwańczuk
ae1ed2d166
v1.4.4 2020-10-03 14:58:10 +02:00
Bartek Iwańczuk
63efa5f15d
v1.4.3 2020-10-02 14:37:48 +02:00
Casper Beyer
6825d7f13d
fix(cli/repl): use a default referrer when empty (#7794)
This makes use of a default referrer when its empty in repl mode so that
dynamic imports work in the global evaluation context.

Co-authored-by: Bartek Iwanczuk <biwanczuk@gmail.com>
2020-10-02 13:13:23 +02:00
Casper Beyer
454de99680
chore(core): remove experimental wasm bigint flag (#7790)
This removes the experimental bigint flag as it is enabled by default
now and is no longer necessary.
2020-10-02 11:27:18 +02:00
Bartek Iwańczuk
dacb340f8f
v1.4.2 2020-09-25 16:53:48 +02:00
Valentin Anger
71c2497fd4
Add example for deno_core (#7611) 2020-09-23 10:56:36 -04:00
Ryan Dahl
ffd08a2249
Actually remove js_check (#7636) 2020-09-22 23:16:00 -04:00
Bartek Iwańczuk
68fd7a927b
refactor(core): support error stack, remove js_check (#7629)
This commit adds support for stack traces in "deno_core".

Implementation of "Display" trait for "JsError" has been updated
and in consequence "deno_core::js_check" became obsolete and
removed.
2020-09-22 23:30:03 +02:00
Nayeem Rahman
a43984c9cf
refactor(cli/fmt_errors): Color stack traces in Rust (#7628) 2020-09-22 19:01:30 +02:00
tokiedokie
c4ed3fb7e7
chore: add copyright (#7593) 2020-09-21 08:26:41 -04:00
Bartek Iwańczuk
b657d743a2
refactor: remove CliState, use OpState, add CliModuleLoader (#7588)
- remove "CliState.workers" and "CliState.next_worker_id", instead
store them on "OpState" using type aliases.
- remove "CliState.global_timer" and "CliState.start_time", instead
store them on "OpState" using type aliases.
- remove "CliState.is_internal", instead pass it to Worker::new
- move "CliState::permissions" to "OpState"
- move "CliState::main_module" to "OpState"
- move "CliState::global_state" to "OpState"
- move "CliState::check_unstable()" to "GlobalState"
- change "cli_state()" to "global_state()"
- change "deno_core::ModuleLoader" trait to pass "OpState" to callbacks
- rename "CliState" to "CliModuleLoader"
2020-09-20 01:17:35 +02:00
Bert Belder
d6f3de6feb
v1.4.1 2020-09-18 21:28:11 +02: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
Bartek Iwańczuk
6c4da0e429
refactor: remove dispatch_json.js from cli/rt and cli/tsc (#7521)
Instead use Deno.core.jsonOpSync and Deno.core.jsonOpAsync
2020-09-16 22:22:43 +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
68099acbc6 Don't expose ErrWithV8Handle from deno_core 2020-09-15 11:55:51 -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
Bartek Iwańczuk
7023263b30
refactor(core): remove JsRuntime::set_js_error_create_fn (#7478)
Instead use RuntimeOptions.js_error_create_fn
2020-09-14 21:23:48 -04:00
Bert Belder
f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Bert Belder
530f48d2fd Upgrade Rust crates, pin 'webpki-roots' to version 0.19.0 (#7454) 2020-09-14 00:20:56 +02:00
Bartek Iwańczuk
b3fa81f867
v1.4.0 2020-09-13 16:35:31 +02:00
Bert Belder
bf70442b08
upgrade: rusty_v8 0.10.0 / V8 8.7.75 (#7429) 2020-09-13 13:43:50 +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
Bartek Iwańczuk
25053f92ff
fix(core): panic on big string allocation (#7395)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-09-09 20:52:11 +02:00
uki00a
ac455050ee
feat(console): print proxy details (#7139) 2020-09-08 16:06:26 +02: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
Bartek Iwańczuk
a14b3c9e30
v1.3.3 2020-09-04 18:15:24 +02:00