Commit graph

47 commits

Author SHA1 Message Date
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
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
Kevin (Kun) "Kassimo" Qian ec44be0760 lock: support lock-write for fetch command (#3787) 2020-01-26 13:43:59 -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
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
Yoshiya Hinosawa bc89f04cbf Add signal handlers (#3757) 2020-01-24 08:15:31 -05: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
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
Bartek Iwańczuk 5e2fd183ff
refactor: Rename JS entry functions (#3732) 2020-01-21 15:53:29 +01:00
Bartek Iwańczuk 7966bf14c0
refactor: split worker and worker host logic (#3722)
* split ops/worker.rs into ops/worker_host.rs and ops/web_worker.rs

* refactor js/workers.ts and factor out js/worker_main.ts - entry point for WebWorker runtime

* BREAKING CHANGE: remove support for blob: URL in Worker

* BREAKING CHANGE: remove Deno namespace support and noDenoNamespace option in Worker constructor

* introduce WebWorker struct which is a stripped down version of cli::Worker
2020-01-21 09:49:47 +01:00
Bartek Iwańczuk 32cbcfe4e9
don't include assets in binary (#3661) 2020-01-12 14:53:32 +01:00
Kitson Kelly 737ab94ea1 Create an old program to be used in snapshot. (#3644) 2020-01-12 12:20:33 +01: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
Ry Dahl 29df272133
error on warnings (#3612) 2020-01-06 11:38:56 -05:00
Ry Dahl 76e44ddfd0
Rename crates: 'deno' to 'deno_core' and 'deno_cli' to 'deno' (#3600) 2020-01-05 11:56:18 -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 4258ed262f
refactor: move HttpBody to cli/http_util.rs (#3569) 2019-12-31 15:09:58 +01:00
Kevin (Kun) "Kassimo" Qian 9ef0b18eb0 repl: do not crash on async op reject (#3527) 2019-12-20 00:04:14 -05:00
Ry Dahl ee013102ff
remove duplicated argv member from ThreadSafeGlobalState (#3433) 2019-12-03 17:23:10 -05:00
Kevin (Kun) "Kassimo" Qian 3451c5fb55 Tweaks to arg_hacks and add v8-flags to repl (#3409) 2019-11-26 20:25:14 -08:00
Ry Dahl c016684653
refactor: reorganize flags (#3389)
- Remove ability to specify run arguments like `--allow-net` after the
  script argument. It's too hacky to make work with clap.
- Remove `--v8-options`, instead use `--v8-flags=--help`
- Give more descriptive names to unit tests in flags.rs
- Assume argv and subcommand into DenoFlags struct so the output of
  flags module is only DenoFlags rather than the tuple (subcommand, flags,
  argv).
- Improve CLI help text
- Make `deno run` specific args like `--allow-net` only show up in 'deno
  help run' instead of as global flags in `deno help`.
- Removes `deno version` to simplify our implementation and be closer to
  clap defaults. `deno -V` now only shows Deno's version and not V8's nor
  TypeScript. `Deno.versions` can be used to see that information.
- Prevent clap from auto-detecting terminal width and attempting to wrap
  text.
2019-11-26 08:06:32 -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
Kevin (Kun) "Kassimo" Qian 2b3afda625 Use async to replace FutureExt in lib.rs (#3359) 2019-11-16 23:25:12 -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
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
Kitson Kelly 8d03397293 Make bundles fully standalone (#3325)
- Bundles are fully standalone. They now include the shared loader with
  `deno_typescript`.
- Refactor of the loader in `deno_typescript` to perform module
  instantiation in a more
- Change of behaviour when an output file is not specified on the CLI.
  Previously a default name was determined and the bundle written to that
  file, now the bundle will be sent to `stdout`.
- Refactors in the TypeScript compiler to be able to support the concept
  of a request type.  This provides a cleaner abstraction and makes it
  easier to support things like single module transpiles to the userland.
- Remove a "dangerous" circular dependency between `os.ts` and `deno.ts`,
  and define `pid` and `noColor` in a better way.
- Don't bind early to `console` in `repl.ts`.
- Add an integration test for generating a bundle.
2019-11-13 10:35:56 -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
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
Ry Dahl 86b3ac5108
feat: lockfiles (#3231)
Use --lock-write=lock.json or --lock-check=lock.json on the command
line.
2019-11-03 10:39:27 -05: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
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
Bartek Iwańczuk c920c5f62a feat: window.onunload (#3023) 2019-10-02 11:32:51 -04:00
Kitson Kelly 3d2d0ee771 Handle uncaught worker errors without panicking (#3019) 2019-09-25 10:46:58 -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 9cfdc60a23
Move integration tests to //cli/tests/ (#2964)
This ensures the deno executable is properly created before running the integration tests.

Also allows deno_cli to be used as a lib. Docs are now properly generated: https://docs.rs/deno_cli/0.18.4/deno_cli/

Towards #2933
Prep for #2955
2019-09-16 21:05:14 -04:00