Commit graph

461 commits

Author SHA1 Message Date
木杉 537c6b3ed9 fix realpath behavior in windows (#3425) 2019-12-01 11:23:35 -08:00
Kevin (Kun) "Kassimo" Qian f88dc4e197 Add Deno.realpath (#3404) 2019-11-26 00:40:57 -08:00
Bartek Iwańczuk 658ec2aaf9 better error message for missing module (#3402) 2019-11-25 09:33:23 -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 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 8b90b8e883 refactor: per-worker resource table, take 2 (#3342)
- removes global `RESOURCE_TABLE` - resource tables are now created per `Worker`
  in `State`
- renames `CliResource` to `StreamResource` and moves all logic related
  to it to `cli/ops/io.rs`
- removes `cli/resources.rs`
- adds `state` argument to `op_read` and `op_write` and consequently adds
  `stateful_minimal_op` to `State`
- IMPORTANT NOTE: workers don't have access to process stdio - this is
  caused by fact that dropping worker would close stdout for process
  (because it's constructed from raw handle, which closes underlying file
  descriptor on drop)
2019-11-14 12:10:25 -05:00
Kevin (Kun) "Kassimo" Qian 4189cc1ab5 Loader: support .wasm imports (#3328)
* loader: support .wasm imports

* http_server: true

* Support named exports

* Clippy
2019-11-14 08:31:39 -05:00
Ryan Dahl fdf0ede2ac Revert "refactor: per-worker resource table (#3306)"
This patch does not work with the recent bundler changes (#3325).
Unfortunately I didn't merge master before landing this patch. It has
something to do with console.log not working inside the compiler worker.

This reverts commit fd62379eaf.
2019-11-13 23:42:35 -05:00
Bartek Iwańczuk fd62379eaf refactor: per-worker resource table (#3306)
- removes global `RESOURCE_TABLE` - resource tables are now created per `Worker`
  in `State`
- renames `CliResource` to `StreamResource` and moves all logic related
  to it to `cli/ops/io.rs`
- removes `cli/resources.rs`
- adds `state` argument to `op_read` and `op_write` and consequently adds
  `stateful_minimal_op` to `State`
- IMPORTANT NOTE: workers don't have access to process stdio - this is
  caused by fact that dropping worker would close stdout for process
  (because it's constructed from raw handle, which closes underlying file
  descriptor on drop)
2019-11-13 22:16:57 -05:00
Yoshiya Hinosawa 31115067cd Add permissions.request (#3296) 2019-11-11 10:33:29 -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 c57207e96a refactor: move Child resource to ops/process.rs (#3291) 2019-11-07 18:52:21 -05:00
Bartek Iwańczuk 25c276055b refactor: remove cli::resources::Resource (#3285) 2019-11-07 11:11:15 -05:00
Bartek Iwańczuk 415d4c2e52 refactor: rewrite accept resources (#3271) 2019-11-07 09:59:02 -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
Yoshiya Hinosawa efd7e78af3 Use web standard Permissions API (#3200) 2019-10-27 11:22:53 -04:00
Bartek Iwańczuk dfcdc03152 fix: handle malformed control buffers (#3202) 2019-10-25 13:23:16 -04:00
Bartek Iwańczuk 492b87d460 Add error handling for minimal dispatch (#3176) 2019-10-24 17:22:31 -04:00
EnokMan 7c60ab4664 refactor DenoPermissions.check_net & resolve_addr (#3182) 2019-10-23 10:19:26 -04:00
Bartek Iwańczuk 6c5a981fd2 feat: Deno.listenTLS (#3152) 2019-10-21 14:38:28 -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
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
Ryan Dahl b81e5db17a
Merge deno_cli_snapshots into deno_cli (#3064) 2019-10-04 20:28:51 -04:00
Nayeem Rahman eecb4fea26 Use xeval from deno_std (#3058) 2019-10-04 09:02:36 -04:00
Kitson Kelly d9ff4eccb5 Async compiler processing (#3043)
Basically this does pre-processing of TypeScript files and gathers all the
dependencies asynchronously. Only then after all the dependencies are gathered,
does it do a compile, which at that point all the dependencies are cached in
memory in the compiler, so with the exception of the hard coded assets, there
are no ops during the compilation.

Because op_fetch_source_files is now handled asynchronously in the runtime, we
can eliminate the tokio_util::block_on() which was causing the increase in
threads. Benchmarking on my machine has shown about a 5% improvement in speed
when dealing with compiling TypeScript. Still a long way to go, but an
improvement.

In theory the module name resolution and the fetching of the source files could
be broken out as two different ops. This would prevent situations of sending the
full source file all the time when actually the module is the same module
referenced by multiple modules, but that could be done subsequently to this.
2019-10-03 07:23:29 -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
Kevin (Kun) "Kassimo" Qian 6efca6d1a1 Add Deno.hostname() (#3032) 2019-09-27 19:09:42 -04:00
Kitson Kelly 3d2d0ee771 Handle uncaught worker errors without panicking (#3019) 2019-09-25 10:46:58 -04:00
Jonathon Orsi 045e74bb39 feat: Add Deno.dialTLS()
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2019-09-23 15:12:42 -04:00
Ryan Dahl 97bb2bdb79
dial/listen API change (#3000)
Previously: dial("tcp", "deno.land:80")
Now: dial({ hostname: "deno.land", port: 80, transport: "tcp" })
Similarly with listen().
2019-09-20 18:32:18 -04:00
Bert Belder 93b7acf99d
js: reschedule global timer if it fires earlier than expected (#2989)
When the global timer fires earlier than expected, which apparently
happens sometimes on server editions of Windows, we didn't call any
setTimeout callbacks, but we *also* didn't reschedule the global timer
to fire again later.

When this situation occurred it would make deno exit abruptly if there
were no other asynchronous ops running on the event loop. It could also
lead to application hangs if the upcoming setTimeout callback was
critical for the application to make progress.
2019-09-20 19:00:12 +02:00
Ryan Dahl c9ef182886
Make deno_cli installable via crates.io (#2946)
- Fixes cargo publish on deno_typescript, deno_cli_snapshots, and
  deno_cli.
- Combines cli_snapshots and js into one directory.
- Extracts TS version at compile time rather than runtime
- Bumps version awkwardly - it was necessary to test end-to-end
  publishing. Sorry.
- Adds git submodule deno_typescript/typescript
2019-09-15 18:36:27 -04:00
Tomohito Nakayama a93b29007f Rename ansi.rs to colors.rs (#2956) 2019-09-15 14:48:25 -04:00
Bartek Iwańczuk 686b86edb1 feat: parallelize downloads from TS compiler (#2949) 2019-09-14 12:05:00 -04:00
Bartek Iwańczuk 2a83327a21 fix: replace bad rid panics with errors (#2870) 2019-09-10 00:59:40 -04:00
Yoshiya Hinosawa 595b4daa77 Remove replacements hack in deno_typescript (#2864) 2019-09-06 12:57:15 -04:00
Yoshiya Hinosawa 249db0f7d9 Handle typescript version in rust (#2855) 2019-09-03 22:12:21 -04:00
Yoshiya Hinosawa 56508f113d ops/fetch: add statusText (#2851) 2019-09-02 12:30:14 -04:00
Bartek Iwańczuk 723284fd20
Use 'reqwest' to implement HTTP client (#2822)
Closes #2720
2019-08-30 14:49:03 -07:00
Ryan Dahl c370f749b2
Remove ts_library_builder, maintain lib.deno_runtime.d.ts by hand (#2827) 2019-08-30 11:11:33 -04:00
Bartek Iwańczuk 20739a8111 feat: implement Addr interface (#2821) 2019-08-27 11:35:32 -04:00
Ryan Dahl 725eb98105
Clean up various flatbuffer references (#2819) 2019-08-26 22:29:51 -04:00
Ryan Dahl d8ada4d3fc Port readSync/writeSync ops to minimal
This removes dispatch_flatbuffers as it is now unused. There are still a
few places where msg_generated is used: ErrorKind and MediaType. These
will be dealt with later.
2019-08-26 14:56:42 -04:00
Bartek Iwańczuk a6f6209f52 port fs ops to JSON (#2812) 2019-08-26 10:18:42 -04:00
Bartek Iwańczuk 520f9631e0 bring back json ops (#2815) 2019-08-26 08:50:21 -04:00
Bartek Iwańczuk 017f88ee99 fix: shared queue requires aligned buffer (#2816) 2019-08-26 07:48:40 -04:00
Ryan Dahl 2235dd795d
Revert json ops (#2814)
* Revert "port more ops to JSON (#2809)"

This reverts commit 137f33733d.

* Revert "port ops to JSON: compiler, errors, fetch, files (#2804)"

This reverts commit 79f82cf10e.

* Revert "Port rest of os ops to JSON (#2802)"

This reverts commit 5b2baa5c99.
2019-08-24 13:20:48 -07:00
Bartek Iwańczuk 137f33733d port more ops to JSON (#2809) 2019-08-24 08:31:14 -07:00
Bartek Iwańczuk 79f82cf10e port ops to JSON: compiler, errors, fetch, files (#2804) 2019-08-24 06:02:42 -07:00
Ryan Dahl 5b2baa5c99
Port rest of os ops to JSON (#2802) 2019-08-24 05:13:50 -07:00
Ryan Dahl bc467b265f
introduce JSON serialization for ops (#2799)
Converts env(), exit(), execPath(), utime() and utimeSync() to use JSON
instead of flatbuffers.
2019-08-22 22:30:14 -07: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
Ryan Dahl 81f809f2a6 Revert "Remove dead code: legacy read/write ops"
This is causing a segfault for unknown reasons - see #2787.

This reverts commit 498f6ad431.
2019-08-16 14:41:08 -04:00
Ryan Dahl 498f6ad431
Remove dead code: legacy read/write ops (#2776)
readSync and writeSync use dispatch_minimal now.
2019-08-14 19:54:35 -04:00
Bartek Iwańczuk e6c349af9f split up ops.rs (#2753)
Note cli/dispatch_minimal.rs ops are not yet included in cli/ops.

This is part of work towards #2730
2019-08-14 11:03:02 -04:00