0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

536 commits

Author SHA1 Message Date
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