Commit graph

281 commits

Author SHA1 Message Date
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
Ryan Dahl e152dae006
RecursiveLoad shouldn't own the Isolate (#2453)
This patch makes it so that RecursiveLoad doesn't own the Isolate, so
Worker::execute_mod_async does not consume itself.

Previously Worker implemented Loader, but now ThreadSafeState does.

This is necessary preparation work for dynamic import (#1789) and import
maps (#1921)
2019-06-05 16:35:38 -04:00
Kitson Kelly a71305b4fe Handle compiler diagnostics in Rust (#2445) 2019-06-04 09:03:56 -04:00
Ryan Dahl 856c44213b TS compiler refactor
* Compiler no longer has its own Tokio runtime. Compiler handles one
  message and then exits.

* Uses the simpler ts.CompilerHost interface instead of
  ts.LanguageServiceHost.

* avoids recompiling the same module by introducing a hacky but simple
  `hashset<string>` that stores the module names that have been already
  compiled.

* Removes the CompilerConfig op.

* Removes a lot of the mocking stuff in compiler.ts like `this._ts`. It
  is not useful as we don't even have tests.

* Turns off checkJs because it causes fmt_test to die with OOM.
2019-05-29 07:53:39 -04:00
Ryan Dahl aba952397a
Add progress bar (#2309) 2019-05-11 10:23:19 -04:00
Bartek Iwańczuk 459162fc6e add --no-fetch CLI flag to prevent remote downloads (#2213) 2019-05-03 11:09:51 -04:00
Ryan Dahl d68b44b6b2
core: make Isolate concrete, remove Dispatch trait (#2183)
Op dispatch is now dynamically dispatched, so slightly less efficient.
The immeasurable perf hit is a reasonable trade for the API simplicity
that is gained here.
2019-04-23 18:58:00 -04:00
Bartek Iwańczuk cd19da62d9 Refactor CLI entry point (#2157)
Changes "deno --types" to "deno types"
and "deno --prefetch" to "deno prefetch"
2019-04-21 11:34:18 -04:00
Kevin (Kun) "Kassimo" Qian afabb3f833 Fix redirects under async load (#2133) 2019-04-18 21:33:50 -04:00
Bert Belder 8477daa8b9
Fix clippy warnings 2019-04-17 15:35:46 +02:00
Ryan Dahl 1bfb443369
Implement async module loading in CLI (#2084) 2019-04-16 15:13:42 -04:00
Ryan Dahl c7e1f8fabd
Fix silent error, add custom panic handler (#2098)
This is to work around Tokio's panic recovery feature.
Ref https://github.com/tokio-rs/tokio/issues/495
Ref https://github.com/tokio-rs/tokio/issues/209
Ref https://github.com/denoland/deno/issues/1311
Fixes #2097
2019-04-14 16:07:24 -04:00
andy finch d3bd5879c3 better wait for removed_from_resource_table_on_close test (#2104) 2019-04-12 18:39:31 -04:00
andy finch 960ee5257a Improve op dispatch (#2088) 2019-04-11 10:58:31 -04:00
Ryan Dahl d2579f4564
core: Rename Behavior to Dispatch (#2082)
And rename IsolateState to ThreadSafeState.

Also make ThreadSafeState directly implement Dispatch. This is simpler.
2019-04-09 13:11:25 -04:00
Ryan Dahl 2debbdacb9
Merge Worker and Isolate types (#2078)
Reduces generics.
2019-04-08 17:10:00 -04:00
Renamed from cli/isolate.rs (Browse further)