Commit graph

536 commits

Author SHA1 Message Date
Ryan Dahl 55ea854671
Move create_channels into worker constructor (#3889) 2020-02-05 08:40:38 +01:00
Luka Hartwig 7d115a2a65
refactor: port fetch test to rust (#3887) 2020-02-04 17:42:07 -05:00
Bartek Iwańczuk 184be99f5b
refactor: CLI subcommands and argv (#3886) 2020-02-04 20:24:33 +01:00
Tilman Roeder 2ab49a80a6
Do not encode files loaded from network as utf8 (#3856) 2020-02-04 11:27:50 -05:00
Bartek Iwańczuk 70eccff7f1
reenable some tests (#3882) 2020-02-04 09:10:46 -05:00
Ryan Dahl 161cf7cdfd
refactor: Use Tokio's single-threaded runtime (#3844)
This change simplifies how we execute V8. Previously V8 Isolates jumped
around threads every time they were woken up. This was overly complex and
potentially hurting performance in a myriad ways. Now isolates run on
their own dedicated thread and never move.

- blocking_json spawns a thread and does not use a thread pool
- op_host_poll_worker and op_host_resume_worker are non-operational
- removes Worker::get_message and Worker::post_message
- ThreadSafeState::workers table contains WorkerChannel entries instead
  of actual Worker instances.
- MainWorker and CompilerWorker are no longer Futures.
- The multi-threaded version of deno_core_http_bench was removed.
- AyncOps no longer need to be Send + Sync

This PR is very large and several tests were disabled to speed
integration:
- installer_test_local_module_run
- installer_test_remote_module_run
- _015_duplicate_parallel_import
- _026_workers
2020-02-03 18:08:44 -05:00
Ryan Dahl 0471243334
upgrade: dprint 0.3.0-alpha.6 2020-02-03 15:52:32 -05:00
Bartek Iwańczuk f4cc08c4fc
v0.32.0 2020-02-03 16:36:07 +01:00
serverhiccups 2b0cf74a8f
Make fetch API more standards compliant (#3667) 2020-02-03 15:54:47 +01:00
Ryan Dahl fba40d86c4
Use tokio::test for some of cli's unit tests (#3868) 2020-02-03 08:53:50 -05:00
Rafael Vargas 55063dd8e8
fix: Deno.remove() to properly remove dangling symlinks (#3860)
For some reason, the unit tests for Deno.remove() were not being imported to 
unit_tests.ts and, consequently, not being executed. Thus, I imported them, 
refactored some existent ones and wrote new ones for the symlink removal case.

Since the creation of a symlink is not implemented for Windows yet, assertions
that consider this state were added when the tests are executed in this OS.
2020-02-03 08:20:15 -05:00
Luka Hartwig f168597b7a
Remove //tests symlink (#3849) 2020-02-02 16:55:22 -05:00
Andy Finch 4f8a5c0239
feat: support crate imports in deno_typescript (#3814)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-02-01 12:02:23 +01:00
Tim Ermilov 2cd3994902
Add support for multiple files in fetch command (#3845) 2020-01-31 16:07:37 -05:00
Ryan Dahl 1dc8afe3af
Add NO_BUILD_SNAPSHOTS to speed up incremental builds (#3847) 2020-01-31 12:43:08 -05:00
Bartek Iwańczuk e1697421e2
chore: remove std/installer, port installer tests to Rust (#3843) 2020-01-31 17:34:50 +01:00
Bartek Iwańczuk c7a2a33ea1
chore: upgrade dprint (#3842) 2020-01-31 11:06:42 +01:00
Bartek Iwańczuk de5c099b47
feat: deno install in Rust (#3806)
//std/installer couldn't be removed due to bug, but it's now deprecated.
2020-01-30 18:42:39 -05:00
Ryan Dahl 25b13c8917
Use tokio::main (#3831) 2020-01-30 11:28:51 -05:00
Ryan Dahl 2338e7679c
Remove --current-thread flag (#3830)
This flag was added to evaluate performance relative to tokio's threaded
runtime. Although it's faster in the HTTP benchmark, it's clear the runtime
is not the only perf problem.

Removing this flag will simplify further refactors, in particular
adopting the #[tokio::main] macro. This will be done in a follow up.

Ultimately we expect to move to the current thread runtime with Isolates
pinned to specific threads, but that will be a much larger refactor. The
--current-thread just complicates that effort.
2020-01-30 10:49:33 -05:00
Ryan Dahl 8e3bc774f7
Adjust dprint configuration to be closer to prettier (#3824) 2020-01-30 09:33:32 +01:00
Ryan Dahl e1b3a0769a
Try to fix docs.rs for cli crate (#3823) 2020-01-30 09:32:20 +01:00
EnokMan 1c6c6c6d7f
Deno.makeTempDir() check permissions (#3810) 2020-01-29 23:21:41 -05:00
Bartek Iwańczuk 73a3cc21d0
feat: dprint formatter (#3820)
* rewrite fmt_test in Rust, remove tools/fmt_test.py
* remove //std/prettier
2020-01-29 21:16:48 -05:00
Bartek Iwańczuk 161adfc51b
workers: proper TS libs, more spec-compliant APIs (#3812)
* split lib.deno_main.d.ts into:
  - lib.deno.shared_globals.d.ts
  - lib.deno.window.d.ts
  - lib.deno.worker.d.ts
* remove no longer used libs:
  - lib.deno_main.d.ts
  - lib.deno_worker.d.ts
* change module loading to use proper TS library for compilation
* align to Worker API spec:
  - Worker.terminate()
  - self.close()
  - self.name
2020-01-29 18:54:23 +01:00
Bartek Iwańczuk f32c31a0eb dx: descriptive permission errors (#3808)
Before:
```
▶ target/debug/deno https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/std/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```

After:
```
▶ target/debug/deno https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: network access to "0.0.0.0:8080", run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/std/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: read access to "/etc/passwd", run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```
2020-01-27 21:13:17 -05:00
Bartek Iwańczuk ac10d79d23 refactor: isomorphic snapshot for CLI (#3728) 2020-01-27 21:12:25 -05:00
Kitson Kelly f604becaba Improve support of type definitions (#3755) 2020-01-26 13:59:41 -05:00
Kevin (Kun) "Kassimo" Qian ec44be0760 lock: support lock-write for fetch command (#3787) 2020-01-26 13:43:59 -05:00
Ryan Dahl 9d98f0126c
Remove dead code in cli/shell.rs (#3792) 2020-01-26 11:40:28 -05:00
Ben Noordhuis ba78ba69b0 fix clippy warnings (#3798) 2020-01-26 10:50:15 -05:00
Ben Noordhuis 97ed0c954d feat: make eval support --v8-flags=... (#3797)
Closes #3796
2020-01-26 09:49:34 -05:00
Bartek Iwańczuk c824eb5817
refactor: Modules and Loader trait (#3791)
* move is_dyn_import argument from Loader::resolve to Loader::load - it was always kind of strange that resolve() checks permissions.
* change argument type from &str to &ModuleSpecifier where applicable
2020-01-25 18:53:16 +01:00
Bert Belder 37a7b01d5c
Refactor error tracking and scope juggling in deno_core (#3783) 2020-01-25 14:31:42 +01:00
Kevin (Kun) "Kassimo" Qian 514cdd941c Do not panic and improve error message on cache failure (#3784) 2020-01-24 17:16:31 -05:00
Ryan Dahl 5e32c5ea44
s/PinnedBuf/ZeroCopyBuf (#3782) 2020-01-24 15:10:49 -05:00
Kitson Kelly 950537e8ef Break out runtime lib to main and worker (#3771)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-24 14:15:01 -05:00
Ryan Dahl 8bc639a23e
v0.31.0 2020-01-24 11:07:53 -05:00
Ryan Dahl fe427eedb1 Mark signal APIs as unstable (#3779) 2020-01-24 16:58:17 +01:00
Yoshiya Hinosawa bc89f04cbf Add signal handlers (#3757) 2020-01-24 08:15:31 -05:00
Ryan Dahl 74e6eb14dd update readmes (#3765) 2020-01-23 22:32:52 +01:00
Bartek Iwańczuk 63293a90e1
refactor: snapshotting (#3753) 2020-01-22 23:58:13 +01:00
Bartek Iwańczuk bd9561f4de
Reland "Create an old program to be used in snapshot." (#3747)
* read CLI assets from disk during snapshotting
2020-01-22 20:18:01 +01:00
Ry Dahl fa7f34eb8c
Revert "Create an old program to be used in snapshot. (#3644)"
Ref #3712. This change allowed the deno_typescript crate to reference
cli/js/lib.deno_runtime.d.ts which breaks "cargo package". We intend to
reintroduce a revised version of this patch later once "cargo
package" is working and tested.

This reverts commit 737ab94ea1.
2020-01-21 14:57:56 -05:00
Ryan Dahl 7fd50065a7 v0.30.1
This patch release is being done only to test crate publishing, hence
lack of release notes or published binaries.
2020-01-21 12:44:05 -05:00
Yoshiya Hinosawa 9de8178c9b feat: add AsyncUnref ops (#3721)
This is in order to support features like signal handlers, which
shouldn't prevent the program from exiting.
2020-01-21 12:01:10 -05:00
Bartek Iwańczuk ecd1d3abb0
refactor: split cli::Worker (#3735)
* cli::Worker is base struct to create specialized workers
* add MainWorker
* add CompilerWorker
* refactor WebWorker to use Worker
2020-01-21 17:50:06 +01:00
Ry Dahl 229eb292f8
Revert "don't include assets in binary (#3661)"
Ref #3712

This reverts commit 32cbcfe4e9.
2020-01-21 10:24:02 -05:00
Takashi Idobe 108294deeb change copyrights from 2019 to 2020 (#3733) 2020-01-21 10:01:55 -05:00
Bartek Iwańczuk 5e2fd183ff
refactor: Rename JS entry functions (#3732) 2020-01-21 15:53:29 +01:00