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

65 commits

Author SHA1 Message Date
Bartek Iwańczuk
5fa056e53b workers: minimal error handling and async module loading (#3665) 2020-01-17 18:43:53 -05:00
Bartek Iwańczuk
cbdf9c5009
refactor: module loading in EsIsolate (#3615)
* refactored RecursiveLoad - it was renamed to RecursiveModuleLoad, it does not take ownership of isolate anymore - a struct implementing Stream that yields SourceCodeInfo

* untangled module loading logic between RecursiveLoad and isolate - that logic is encapsulated in EsIsolate and RecursiveModuleLoad, where isolate just consumes modules as they become available - does not require to pass Arc<Mutex<Isolate>> around anymore

* removed EsIsolate.mods_ in favor of Modules and moved them inside EsIsolate

* EsIsolate now requires "loader" argument during construction - struct that implements Loader trait

* rewrite first methods on isolate as async
2020-01-08 15:06:04 +01:00
Bartek Iwańczuk
ad9fd589d4
core: factor out EsIsolate from Isolate (#3613) 2020-01-07 12:45:44 +01:00
Bartek Iwańczuk
870622d3cc
merge libdeno::DenoIsolate into core::Isolate (#3605) 2020-01-06 16:24:44 +01:00
Ry Dahl
76e44ddfd0
Rename crates: 'deno' to 'deno_core' and 'deno_cli' to 'deno' (#3600) 2020-01-05 11:56:18 -05:00
Gurwinder Singh
9f6bab6010 Use async at places, use &self instead of self: &Self (#3594) 2020-01-04 05:20:52 -05:00
Ry Dahl
bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
Gurwinder Singh
55add2d366 cleanup after tokio upgrade (#3571)
tokio_util::run and tokio::run_on_current_thread should accept Future<Output=()> instead of Future<Output=Result<(), ()>>. Currently, all the passed futures have to add Ok(()) or futures::future::ok(()) unnecessarily to call this method.
2020-01-01 09:51:27 -05:00
Bartek Iwańczuk
46d76a7562
upgrade: Tokio 0.2 (#3418) 2019-12-30 14:57:17 +01:00
Axetroy
3bb15ceaea Upgrades rust to 1.40.0 (#3542) 2019-12-23 09:59:44 -05:00
Kevin (Kun) "Kassimo" Qian
9ef0b18eb0 repl: do not crash on async op reject (#3527) 2019-12-20 00:04:14 -05:00
Andy Finch
7c3b9b4f4f feat: first pass at native plugins (#3372) 2019-12-05 15:30:20 -05:00
Ry Dahl
ee013102ff
remove duplicated argv member from ThreadSafeGlobalState (#3433) 2019-12-03 17:23:10 -05:00
Kevin (Kun) "Kassimo" Qian
bca23e6433 refactor: Elevate DenoPermissions lock to top level (#3398) 2019-11-24 10:42:30 -05:00
Bartek Iwańczuk
c6bb3d5a10 remove tokio_util::block_on (#3388)
This PR removes tokio_util::block_on - refactored compiler and file 
fetcher slightly so that we can safely block there - that's because 
only blocking path consist of only synchronous operations.

Additionally I removed excessive use of tokio_util::panic_on_error 
and tokio_util::run_in_task and moved both functions to cli/worker.rs, 
to tests module.

Closes #2960
2019-11-22 12:46:57 -05:00
Bartek Iwańczuk
363b968bfc minor clean ups in TS compiler (#3394) 2019-11-22 12:14:34 -05:00
Bartek Iwańczuk
1912ed6740 remove tokio_util::block_on from ops/workers.rs (#3381) 2019-11-19 19:17:05 -05:00
Bartek Iwańczuk
f356b2bd5e refactor: fixes for futures (#3363)
After landing #3358 the benchmarks exploded indicating problems with workers and deno_core_http_bench.

This PR dramatically fixes thread/syscall count that showed up on benchmarks. Thread count is not back to previous levels but difference went from hundreds/thousands to about ~50.
2019-11-17 08:14:50 -05:00
Bartek Iwańczuk
8f9a942cb9 Use futures 0.3 API (#3358) 2019-11-16 19:17:47 -05:00
Bartek Iwańczuk
335e8bd33c refactor: worker is no longer a resource (#3290) 2019-11-09 12:07:14 -08:00
Bartek Iwańczuk
25c276055b refactor: remove cli::resources::Resource (#3285) 2019-11-07 11:11:15 -05:00
Ry Dahl
5c1deac0cf
Remove CoreResource::inspect_repr method (#3274)
Towards simplifying (or better removing entirely) the CoreResource
trait. Resources should be any bit of privileged heap allocated memory
that needs to be referenced from JS, not very specific trait
implementations. Therefore CoreResource should be pushed towards being
as general as possible.
2019-11-06 12:17:28 -05:00
Bartek Iwańczuk
0049d4e50c Refactor Worker and ThreadSafeState (#3242)
* Split ThreadSafeState into State and GlobalState. State is a "local"
  state belonging to "Worker" while "GlobalState" is state shared by
  whole program.
* Update "Worker" and ops to use "GlobalState" where applicable
* Move and refactor "WorkerChannels" resource
2019-11-04 10:38:52 -05:00
Bartek Iwańczuk
a7992e7703 refactor: use core ResourceTable in cli (#3206) 2019-10-28 20:42:44 -04:00
Kevin (Kun) "Kassimo" Qian
eff2a27bd0 feat: Allow "deno eval" to run code as module (#3148) 2019-10-19 17:19:19 -04:00
Bartek Iwańczuk
4221b90c3f perf: eager poll async ops in Isolate (#3046) 2019-10-14 17:46:27 -04:00
Yusuke Sakurai
6056595357 fix: [tls] op_dial_tls is not registerd and broken (#3121) 2019-10-13 10:37:37 -04:00
Ryan Dahl
97d8498d46
Add init methods for each op module (#3087) 2019-10-11 11:41:54 -07:00
Bartek Iwańczuk
e1d49fe0fe remove more calls to tokio_util::block_on (#3059)
towards #2960
2019-10-06 15:03:30 -04:00
Jed Fox
99eec73b4b feat: Add support for passing a key to Deno.env() (#2952)
This adds a new op to get a single env var.
2019-10-02 11:55:28 -04:00
Bartek Iwańczuk
75eeac03f3 use Isolate::register_op in deno_cli (#3039) 2019-10-01 18:51:05 -04:00
Ryan Dahl
56ac638d93
Remove test.py, use cargo test as test frontend (#2967)
Fixes #2933
2019-09-19 14:48:05 -04:00
Ryan Dahl
9d62d77cfa
Run tests after "cargo build" on travis (#2854) 2019-09-04 17:16:46 -04:00
Ryan Dahl
bdc97b3976
Organize dispatch a bit (#2796)
Just some clean up reorganization around flatbuffer/minimal dispatch
code. This is prep for adding a JSON dispatcher.
2019-08-21 20:42:48 -04:00
Kevin (Kun) "Kassimo" Qian
286ee1d8b6 Fix dynamic import base path problem for REPL and eval (#2757) 2019-08-09 16:33:59 -07:00
Bert Belder
6fbf2e9624
Dynamic import (#2516) 2019-08-09 01:19:45 +02:00
Ryan Dahl
e438ac2c74
Add op_id throughout op API (#2734)
Removes the magic number hack to switch between flatbuffers and the
minimal dispatcher.

Adds machinery to pass the op_id through the shared_queue.
2019-08-07 14:02:29 -04:00
Kevin (Kun) "Kassimo" Qian
ddee2dff14 Provide option to delete Deno namespace in worker (#2717) 2019-08-05 07:23:41 -04:00
Ryan Dahl
3971dcfe10
Use system rustfmt instead of fixed binary (#2701) 2019-07-31 17:11:37 -04:00
Bartek Iwańczuk
421cbd39b4 factor out FileFetcher to separate module (#2683)
* merge SourceFileFetcher trait and FileFetcher struct

* move logic related to source file fetching to //cli/file_fetcher.rs

* use Result when creating new ThreadSafeState
2019-07-31 11:58:41 +00:00
Bartek Iwańczuk
8214b686ce Refactor DenoDir (#2636)
* rename `ModuleMetaData` to `SourceFile` and remove TS specific
  functionality

* add `TsCompiler` struct encapsulating processing of TypeScript files

* move `SourceMapGetter` trait implementation to `//cli/compiler.rs`

* add low-level `DiskCache` API for general purpose caches and use it in
  `DenoDir` and `TsCompiler` for filesystem access

* don't use hash-like filenames for compiled modules, instead use
  metadata file for storing compilation hash

* add `SourceFileCache` for in-process caching of loaded files for fast
  subsequent access

* define `SourceFileFetcher` trait encapsulating loading of local and
  remote files and implement it for `DenoDir`

* define `use_cache` and `no_fetch` flags on `DenoDir` instead of using
  in fetch methods
2019-07-17 18:15:30 -04:00
Bert Belder
abe8a113ad Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
2019-07-11 14:37:00 -04:00
Bert Belder
9b1997b8b6
core: clearly define when module lookup is path-based vs URL-based
The rules are now as follows:

* In `import` statements, as mandated by the WHATWG specification,
  the import specifier is always treated as a URL.
  If it is a relative URL, it must start with either / or ./ or ../

* A script name passed to deno as a command line argument may be either
  an absolute URL or a local path.
  - If the name starts with a valid URI scheme followed by a colon, e.g.
    'http:', 'https:', 'file:', 'foo+bar:', it always interpreted as a
    URL (even if Deno doesn't support the indicated protocol).
  - Otherwise, the script name is interpreted as a local path. The local
    path may be relative, and operating system semantics determine how
    it is resolved. Prefixing a relative path with ./ is not required.
2019-07-08 13:07:32 +02:00
Kitson Kelly
425df50484 Combine CLI Errors (#2487) 2019-06-19 19:07:01 -07:00
Bartek Iwańczuk
bca5cc5041 Move ModuleSpecifier to //core (#2509) 2019-06-12 16:55:59 -07:00
Bartek Iwańczuk
b3c4307d02 Refactor module resolving (#2493)
Adds ModuleSpecifier, which wraps a URL. This is now passed around instead of
specifier and resolver strings.
2019-06-12 12:00:08 -07:00
Ryan Dahl
2a5138a516
Remove Config struct from core (#2502)
It's unnecessary indirection and is preventing the ability to easily
pass isolate references into the dispatch and dyn_import closures.

Note: this changes how StartupData::Script is executed. It's no longer done
during Isolate::new() but rather lazily on first poll or execution.
2019-06-12 10:53:24 -07:00
Gurwinder S
7fc3d5ed8b Removed unused method and update docs (#2499) 2019-06-11 16:09:31 -04:00
Ryan Dahl
de8c85f8f2
Move Modules to ThreadSafeState (#2498) 2019-06-11 14:35:03 -04:00
Kitson Kelly
307e092753 Add 'bundle' subcommand. (#2467) 2019-06-08 14:42:28 -04:00