Commit graph

81 commits

Author SHA1 Message Date
Kitson Kelly c489589e2b
refactor: new module graph used for no check (#7621) 2020-09-25 08:31:17 +10:00
Bartek Iwańczuk 92edc36442
refactor: use futures and serde_json from deno_core (#7614) 2020-09-21 18:36:37 +02:00
Ryan Dahl 526d668102
Use reqwest from deno_fetch export (#7562) 2020-09-18 13:07:09 -04:00
Ryan Dahl 104aebdfb5
Re-export deno_core::url (#7525)
Also re-exports deno_core::futures and deno_core::serde_json but these are not yet used in the CLI.
2020-09-16 14:28:07 -04:00
Bartek Iwańczuk d4a24c870e
Revert "fix(cli/http_utils): accept a single key-multiple values headers (#7375)" (#7515)
This reverts commit f5c84920c2.
2020-09-16 13:34:16 +02:00
Ryan Dahl b2fa903d64 cli/msg.rs -> cli/media_type.rs 2020-09-15 11:55:51 -04:00
tokiedokie f5c84920c2
fix(cli/http_utils): accept a single key-multiple values headers (#7375) 2020-09-15 07:18:48 +02:00
Bert Belder f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Kitson Kelly a6f34d4722
refactor: use ParsedModule and improve MediaTypes enum (#7456) 2020-09-14 14:27:44 +02:00
Bartek Iwańczuk 60dbc6b294
Revert "feat(unstable): Support data: urls (#5157)" (#7432)
This reverts commit e3319f34a6.
2020-09-12 11:08:00 +02:00
Valentin Anger e3319f34a6
feat(unstable): Support data: urls (#5157) 2020-09-11 22:40:48 +02:00
Bert Belder c821e8f2f1
Move JSON ops to deno_core (#7336) 2020-09-06 02:34:02 +02:00
Bert Belder 9bfb0df805
refactor: remove OpError, use ErrBox everywhere (#7187)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-08-26 00:22:15 +02:00
Bert Belder 27f4aeb924
Make Rc/Arc wrapper around State/GlobalState visible (#7104) 2020-08-19 02:01:48 +02:00
Ryan Dahl 7d01fcbb77
Remove unnecessary drop calls (#7007) 2020-08-10 17:31:05 -04:00
Maayan Hanin 5fc5e7b54a
fix(cli): add support for non-UTF8 source files (#6789)
Fixes: #5542
2020-08-03 23:39:48 +02:00
Ryan Dahl ca4dcb36dd
Rename cli/js2 to cli/rt (#6857) 2020-07-23 16:27:26 +02:00
Bartek Iwańczuk fa61956f03
Port internal TS code to JS (#6793)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-07-19 19:49:44 +02:00
Valentin Anger db36857288
refactor: util functions take slices instead of heap values (#6547) 2020-06-29 14:17:37 +02:00
Ryan Dahl 0620862605
Clean up some fetch_remote_source tets (#6446) 2020-06-24 14:12:04 -04:00
Bartek Iwańczuk 826a3135b4
refactor(compiler): split code paths for compile and bundle (#6304)
* refactor "compile" and "runtimeCompile" in "compiler.ts" and factor out
separate methods for "compile" and "bundle" operations

* remove noisy debug output from "compiler.ts"
 
* provide "Serialize" implementations for enums in "msg.rs"

* rename "analyze_dependencies_and_references" to "pre_process_file" and
move it to "tsc.rs"

* refactor ModuleGraph to use more concrete types and properly annotate
locations where errors occur

* remove dead code from "file_fetcher.rs" - "SourceFile.types_url" is no
longer needed, as type reference parsing is done in "ModuleGraph"

* remove unneeded field "source_path" from ".meta" files stored for
compiled source file (towards #6080)
2020-06-19 12:27:15 +02:00
Bartek Iwańczuk 90c5dcfe79
chore(test): move testing utilities to test_util crate (#6360) 2020-06-18 11:54:55 -04:00
Bartek Iwańczuk b8872cd303
fix(cache): apply redirection limit for cached files (#6308) 2020-06-15 23:46:48 +02:00
Luca Casonato 0ffc99a61d
Move to allowlist and blocklist (#6282) 2020-06-13 13:09:39 -04:00
Bartek Iwańczuk db70b77e4b
fix: handle @deno-types in export {} (#6202)
* fix: handle @deno-types in export {}

* lint

* fix tests

* fmt

* fix test
2020-06-10 14:19:41 +02:00
Bartek Iwańczuk 02d46bae9f
fix: media type for .cjs and application/node (#6005) 2020-05-31 21:08:26 +02:00
Bartek Iwańczuk 8799855fdc
refactor: reorganize TS compiler (#5603) 2020-05-20 16:25:40 +02:00
Bartek Iwańczuk 9d63772fe5
refactor: rewrite TS dependency analysis in Rust (#5029)
This commit completely overhauls how module analysis is 
performed in TS compiler by moving the logic to Rust.

In the current setup module analysis is performed using 
"ts.preProcessFile" API in a special TS compiler worker 
running on a separate thread.

"ts.preProcessFile" allowed us to build a lot of functionality
in CLI including X-TypeScript-Types header support 
and @deno-types directive support. Unfortunately at the 
same time complexity of the ops required to perform 
supporting tasks exploded and caused some hidden 
permission escapes.

This PR introduces "ModuleGraphLoader" which can parse
source and load recursively all dependent source files; as 
well as declaration files. All dependencies used in TS 
compiler and now fetched and collected upfront in Rust 
before spinning up TS compiler.

To achieve feature parity with existing APIs this commit 
includes a lot of changes:

* add "ModuleGraphLoader"
  - can fetch local and remote sources
  - parses source code using SWC and extracts imports, exports, file references, special 
     headers
  - this struct inherited all of the hidden complexity and cruft from TS version and requires 
     several follow up PRs
* rewrite cli/tsc.rs to perform module analysis upfront and send all required source code to 
  TS worker in one message
* remove op_resolve_modules and op_fetch_source_files from cli/ops/compiler.rs
* run TS worker on the same thread
2020-05-18 12:59:29 +02:00
Bartek Iwańczuk 32aeec9630
refactor: check permissions in SourceFileFetcher (#5011)
This PR hot-fixes permission escapes in dynamic imports, workers
and runtime compiler APIs.

"permissions" parameter was added to public APIs of SourceFileFetcher
and appropriate permission checks are performed during loading of
local and remote files.
2020-05-11 13:13:27 +02:00
Bartek Iwańczuk 0ba90c8c11
fix(imports): fix panic on unsupported scheme (#5131) 2020-05-07 15:57:10 +02:00
Yoshiya Hinosawa dabe88f854
fix(deno_dir): better error message (#5120)
Add better error messages when a cache subdirectory in 
`DENO_DIR` cannot be created.
2020-05-07 14:32:57 +02:00
Bartek Iwańczuk aab26d226e
remove calls to futures::executor::block_on (#4760) 2020-04-15 23:14:28 -04:00
Kitson Kelly f527407287
clippy (#4618) 2020-04-03 22:41:16 -04:00
Florian Häglsperger 62f4a2a788
Add global "quiet" flag (#4135) 2020-03-10 08:26:17 -04:00
Aurélien Bertron 5e31b96f9a
Add content type for wasm, fix encoding in wasm test fixture (#4269) 2020-03-06 11:31:22 -05:00
Ryan Dahl 0099c28db3
http_cache: change .headers.json to .metadata.json (#4175)
Add original URL to metadata. This is so the VS Code Plugin can reverse
look up the URL for cache entries. Ref #4069.
2020-02-28 13:15:31 -05:00
Kevin (Kun) "Kassimo" Qian 7255cc9bc0
Support TypeScript eval through deno eval -T flag (#4141) 2020-02-28 09:17:56 -05:00
Kevin (Kun) "Kassimo" Qian b5bf28e68f
fetch_cached_remote_source support redirect URL without base (#4099) 2020-02-28 09:04:18 -05:00
Ryan Dahl f47f3f9672
Remove _async from method names since _sync are gone (#4128) 2020-02-25 20:42:00 +01:00
Bartek Iwańczuk 4e1abb4f3a
refactor: use OpError instead of ErrBox for errors in ops (#4058)
To better reflect changes in error types in JS from #3662 this PR changes 
default error type used in ops from "ErrBox" to "OpError".

"OpError" is a type that can be sent over to JSON; it has all 
information needed to construct error in JavaScript. That
made "GetErrorKind" trait useless and so it was removed altogether.

To provide compatibility with previous use of "ErrBox" an implementation of
"From<ErrBox> for OpError" was added, however, it is an escape hatch and
ops implementors should strive to use "OpError" directly.
2020-02-23 14:51:29 -05:00
Bartek Iwańczuk dd8a109481
refactor: remove unneeded ErrorKinds (#3936) 2020-02-21 10:36:13 -05:00
Bartek Iwańczuk 742a16b506
refactor: rewrite file_fetcher to use async fns, lift blocking call (#4037) 2020-02-19 17:51:10 -05:00
Bartek Iwańczuk 852823fa50
refactor: rewrite HTTP cache for file fetcher (#4030) 2020-02-19 08:17:13 -05:00
Kitson Kelly 046bbb2691
Support loading additional TS lib files (#3863)
Fixes #3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
2020-02-19 00:34:11 -05:00
Bartek Iwańczuk 302debebb3
refactor: cleanup cli/lib.rs (#4006)
* rename methods on Worker related to module loading
* reorganize cli/lib.rs
* remove cli/progress.rs and cli/shell.rs
2020-02-18 10:08:18 -05:00
geoFlux 2e7d449623
feat: add --cert flag for http client (#3972) 2020-02-17 11:59:51 -05:00
Nayeem Rahman 3563ab4c53
fix: Correctly determine a --cached-only error (#3979) 2020-02-12 17:02:34 +01:00
Tilman Roeder 2ab49a80a6
Do not encode files loaded from network as utf8 (#3856) 2020-02-04 11:27:50 -05:00
Ryan Dahl fba40d86c4
Use tokio::test for some of cli's unit tests (#3868) 2020-02-03 08:53:50 -05:00
Luka Hartwig f168597b7a
Remove //tests symlink (#3849) 2020-02-02 16:55:22 -05:00