1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

346 commits

Author SHA1 Message Date
Ryan Dahl
f37d67e809
Revert "Split Runner from Compiler" (#1462)
This reverts commit 3d03f5b0cb.
2019-01-06 14:17:13 -05:00
Ryan Dahl
57301909cd
Add deno.pid (#1464) 2019-01-06 14:16:42 -05:00
Ryan Dahl
ea6c9f2f36
Revert "use byte array instead of string for code fetch (#1307)" (#1455)
This reverts commit e976b3e041.

There is nothing technically wrong with this commit, but it's adding
complexity to a big refactor (native ES modules #975). Since it's not
necessary and simply a philosophical preference, I will revert for now
and try to bring it back later.
2019-01-03 22:11:01 -05:00
Ryan Dahl
a8d326b431
resolve_module: handle "." and ".." referrers (#1454) 2019-01-03 12:51:56 -05:00
Ryan Dahl
7024d9f253 Add rust binding and test for deno_execute_mod() 2019-01-03 09:45:40 -05:00
Ryan Dahl
d2b85d4904 Use camel-case for libdeno::deno_recv_cb
For better greppability and conformance with other symbols in libdeno.rs
2019-01-03 09:45:40 -05:00
Ryan Dahl
5b9c488921 Fix test js_error_apply_source_map_2
If the project is checked out into a directory not called "deno" this
test fails.
2019-01-03 05:41:51 -05:00
Ryan Dahl
2c477dd7cb Happy new year! 2019-01-02 02:37:08 +01:00
Kevin (Kun) "Kassimo" Qian
73fb98ce70 Lazily create .mime files only with mismatch/no extension (#1417) 2018-12-27 20:40:06 +00:00
Ryan Dahl
6cc998f28b
Remove support for extensionless import (#1396) 2018-12-23 11:44:08 -05:00
Yoshiya Hinosawa
bee55fcd20 make stdout unbuffered (#1355) 2018-12-22 23:53:29 -05:00
Kevin (Kun) "Kassimo" Qian
e4be1209b6 Avoid fetch segfault on empty Uri (#1394) 2018-12-21 04:47:09 -05:00
Bert Belder
3a31633041
log: bump default minimum log level to "warn" 2018-12-19 12:19:45 +01:00
Bert Belder
22874d44a6
build: fix RLS-invoked 'cargo check' build 2018-12-19 04:10:10 +01:00
F001
0bb43ebbfc remove repeative permission checks (#1350) 2018-12-14 03:29:17 -05:00
Ryan Dahl
9cfb533c83
Check that IsolateState is thread safe. (#1321) 2018-12-13 16:26:46 -05:00
Ryan Dahl
f986eb25c5
Merge deno_new_snapshotter behavior into deno_new (#1318) 2018-12-13 16:25:42 -05:00
Kevin (Kun) "Kassimo" Qian
2cb52cc4d1 Fix deno.open permission check (#1336) 2018-12-13 16:20:37 -05:00
Goffert van Gool
40d6daf824 Read version from Cargo.toml (#1267) 2018-12-13 16:16:58 -05:00
Bartek Iwańczuk
c2b91a3ef6 Flesh out open() modes (#1282) 2018-12-12 12:05:58 -05:00
Tnarita0000
e31866a60d Change default to false Base.bool 2018-12-12 11:44:56 -05:00
ggtmtmgg
6b8daf9f3f js_errors: rename source_url to script_name (#1329) 2018-12-12 11:44:13 -05:00
F001
e976b3e041 use byte array instead of string for code fetch (#1307) 2018-12-12 04:43:42 -05:00
Kevin (Kun) "Kassimo" Qian
65dd0d516d Simplify src fetch logic and auto append suffix in cache search (#1322) 2018-12-12 02:34:12 -05:00
Kevin (Kun) "Kassimo" Qian
585de35b1d readDir entry mode (#1326) 2018-12-12 02:31:18 -05:00
Ryan Dahl
a8c3b44804 Remove custom panic handler.
This was introduced because Tokio would swallow panics. This is still
the case, but this panic handler causes more problems than it solves.
It requires people to know how to use debuggers to inspect stacktraces.

TODO:
- Fix Tokio to not swallow errors.
- Be vigilant in the intrim to not introduce broken tests due to this
  unfortunate "feature" of tokio.
2018-12-11 15:22:54 -05:00
Ryan Dahl
81c8926ee9 Use default filename for Isolate::execute. 2018-12-11 15:07:55 -05:00
Ryan Dahl
8d3e8b1c64 Remove dead code: ASSET_PREFIX 2018-12-11 15:06:56 -05:00
Ryan Dahl
acd9fa2298 deno_dir: move tests into submodule 2018-12-11 15:06:56 -05:00
Ryan Dahl
52079b26db Minor rename for CodeFetch parameters
This bring it inline with terminology used in V8
See ResolveCallback in v8.h
2018-12-11 15:06:56 -05:00
F001
c1de50b0ca Replace blocking! macro by generic function (#1305) 2018-12-11 08:36:34 -05:00
Ryan Dahl
9a960b9f58
Use stderr for exceptions (#1303) 2018-12-10 17:50:41 -05:00
binaryta
c427c2df42 Add TooLarge error code for buffers (#1298)
In collaboration with @yushimatenjin
2018-12-09 15:38:30 -05:00
Ryan Dahl
e6121762f8 v0.2.2
- Don't crash when .mime file not exist in cache (#1291)
- Process source maps in Rust instead of JS (#1280)
- Use alternate TextEncoder/TextDecoder implementation (#1281)
- Upgrade flatbuffers to 80d148
- Fix memory leaks (#1265, #1275)
2018-12-07 17:44:49 -05:00
Kevin (Kun) "Kassimo" Qian
0d3584cf46 Don't crash when .mime file not exist in cache (#1291) 2018-12-07 13:39:10 -05:00
Ryan Dahl
c113df1bb8
Process source maps in Rust instead of JS (#1280)
- Improves speed and binary size significantly.
- Makes deno_last_exception() output a JSON structure.
- Isolate::execute and Isolate::event_loop now return
  structured, mapped JSError objects on errors.
- Removes libdeno functions:
  libdeno.setGlobalErrorHandler()
  libdeno.setPromiseRejectHandler()
  libdeno.setPromiseErrorExaminer()

In collaboration with Ryan Dahl.
2018-12-06 23:05:36 -05:00
F001
60c008d23b Isolate::from_raw_ptr and other cleanups.
`Isolate::from_void_ptr` is renamed to `from_raw_ptr`, to keep
consistency with std libs.

It is changed to `unsafe` function, because it can't guarantee that the
input is valid. This guarantee should be provided by the caller.

Its return type is changed to `&Isolate`, because `&mut Isolate` type
requires that no other aliases co-exist in this period of time, this
does not seem true. So I changed most of the methods to accept shared
reference `&Isolate`. It is easier to reason about the correctness of
`unsafe` blocks. As long as these shared references are in the same
thread, these `unsafe` codes are probably correct.
2018-12-05 00:14:53 -08:00
Ryan Dahl
d70b04c6d7
Add deno_config struct for isolate creation. (#1277)
In preperation for adding other callbacks to libdeno.
2018-12-04 15:06:20 -08:00
F001
30420ad317 Remove static lifetime bound in OpCreator (#1276)
The main purpose of this PR is to remove the `'static` lifetime bound in

type OpCreator =
  fn(state: &Arc<IsolateState>, base: &msg::Base, data: &'static mut [u8])
    -> Box<Op>;

The reason is simple: it is plain wrong, the `data` is actually not `'static`. It is created when the message is sent from C side, and will be recycled when the message is responded. It violates the definition of `'static` lifetime.

If someone save this pointer somewhere else, and reuse it later again, uninitialized memory could be accessed. This kind of memory unsafety does not happen yet because the logic is carefully organized in this project. Lifetime constraints are maintained by code convention. It could be more robust if we can express this constraint by Rust's type system.

Basic idea: tie buffer's lifetime to an object's lifetime, a.k.a, RAII. The type `deno_buf` is pretty suitable for this job.
2018-12-04 13:21:02 -08:00
F001
9e839b7e23 Avoid memory leak (#1265) 2018-12-03 19:07:34 -08:00
Ryan Dahl
f727214db0 Use include_bytes! instead of incbin.
This is the second attempt at this patch. The first version was reverted
in 2ffd78daf9

The problem, I suspect, was that the snapshot was represented as a
source_set, which inserted a node into the dependency tree.
include_bytes does properly insert the snapshot into rustc's depfile but
the use of source_set confused gn. Now the that the deno executable has
the create_deno_snapshot as a direct dependency, changes will be
propagated.
2018-12-03 13:44:21 -08:00
Ryan Dahl
b5c6bfa0c8 v0.2.1
- Allow async functions in REPL (#1233)
- Handle Location header relative URI (#1240)
- Add deno.readAll() (#1234)
- Add Process.output (#1235)
- Upgrade to TypeScript 3.2.1
- Upgrade crates: tokio 0.1.13, hyper 0.12.16, ring 0.13.5
2018-11-30 16:28:27 -08:00
Andy Hayden
aab02805dd clippy fixes (#1250) 2018-11-30 00:30:49 -08:00
F001
b6fda735ee Replace mutex by atomics (#1238) 2018-11-29 19:03:00 -08:00
Kevin (Kun) "Kassimo" Qian
286e76d8c1 Handle Location header relative URI (#1240) 2018-11-29 19:01:01 -08:00
Kevin (Kun) "Kassimo" Qian
09aa9b9698 REPL unblock event loop AND fix REPL setTimeout fire problems 2018-11-28 15:25:30 -08:00
Ryan Dahl
570269b73d Don't use snapshot for src/isolate.rs tests. 2018-11-27 11:33:23 -08:00
Ryan Dahl
2ffd78daf9 Revert "Use include_bytes! instead of incbin. (#1182)"
Reverting because this is causing Appveyor to be red. However
I hope we can reintroduce include_bytes! soon in a way that
works on windows. Fixes #1208.

This reverts commits 96c3641fff
and 92e404706b.
2018-11-23 11:26:36 -08:00
Ryan Dahl
d083f7271b v0.2.0
Changes since v0.1.12:
- First pass at running subprocesses (#1156)
- Improve flag parsing (#1200)
- Improve fetch() (#1194 #1188 #1102)
- Support shebang (#1197)
2018-11-16 13:23:50 +08:00
Bert Belder
48bf4062e4 First pass at running subprocesses (#1156) 2018-11-16 12:07:40 +08:00
Bartek Iwańczuk
9b702da9e5 improve flag parsing 2018-11-16 11:44:43 +08:00
Ryan Dahl
eaec5a8780 Support uploading data from fetch()
Does not yet support streaming, only strings and TypedArrays for now.
2018-11-16 11:44:25 +08:00
Ryan Dahl
9d9853b319 Lift snapshot to be an argument of Isolate::new(). 2018-11-16 08:25:54 +08:00
Ryan Dahl
f88fa2dcf8 Support shebang 2018-11-16 08:05:13 +08:00
Ryan Dahl
d7abdfe754 Simplify NotFound code. 2018-11-16 08:05:13 +08:00
Ryan Dahl
3c8d2bde68
Support request method and headers in fetch() (#1188)
Adds a general HttpHeader flatbuffer message for serializing requests
and responses.
2018-11-14 17:36:34 -08:00
Ryan Dahl
b1579460ce Support streaming response bodies from fetch()
Also Buffer.readFrom in fetch() to buffer response.
2018-11-13 21:44:38 -08:00
Ryan Dahl
f2223fb9ad Wrapper around hyper::Body so it can be used as AsyncRead 2018-11-13 21:44:38 -08:00
Ryan Dahl
92e404706b
Use include_bytes! instead of incbin. (#1182) 2018-11-12 17:17:30 -08:00
Ryan Dahl
0c740ff85d v0.1.12
- Update to TypeScript 3.1.6 (#1177)
- Fixes Headers type not available. (#1175)
- Reader/Writer to use Uint8Array not ArrayBufferView (#1171)
- Fixes importing modules starting with 'http'. (#1167)
- build: Use target/ instead of out/ (#1153)
- Support repl multiline input (#1165)
2018-11-12 09:16:00 -08:00
Ryan Dahl
98e6366cb5
Local filenames starting with 'http' shouldn't be remote. (#1167) 2018-11-08 10:38:54 -08:00
Andy Hayden
13e1eb2b87 Fix many of the clippy::pedantic warnings 2018-11-06 06:43:02 -08:00
Andy Hayden
7a17e2aec6 Remove flags::process
It was doing two independent things:
- print help and exit
- set log level

It's better to do those explicitly in main.rs
2018-11-06 06:25:38 -08:00
Ryan Dahl
e1d5f82d36 v0.1.11
- Performance and stability improvements on all platforms.
- Add repl (#998)
- Add deno.Buffer (#1121)
- Support cargo check (#1128)
- Upgrade Rust crates and Flatbuffers. (#1145, #1127)
- Add helper to turn deno.Reader into async iterator (#1130)
- Add ability to load JSON as modules (#1065)
- Add deno.resources() (#1119)
- Add application/x-typescript mime type support (#1111)
2018-11-05 14:51:29 -08:00
Andy Hayden
27ecfc1617 Add repl (#998)
- Running repl from js side.
- Add tests for repl behavior.
- Handle ctrl-C and ctrl-D.
2018-11-05 09:55:59 -08:00
Andy Hayden
1241b8e9ba Fix clippy warnings (#1149)
Run with: cargo clippy
https://github.com/rust-lang-nursery/rust-clippy
2018-11-04 06:04:24 -08:00
Bert Belder
b9914c3113
third_party: add tokio-process Rust crate and its dependencies 2018-11-03 07:42:24 +01:00
Ryan Dahl
ee24254bad Rename EnvPair to KeyValue. 2018-11-02 20:50:01 -07:00
Bert Belder
ec17239f46
cargo: build in Cargo's out dir if DENO_BUILD_PATH is not set
Plus some minor improvements and clean-ups:

* Resolve DENO_BUILD_PATH to an absolute path if necessary.
* Rename DENO_BUILD_PATH to GN_OUT_DIR in places where it is supposed to
  be set by the build system (and not a user configuration variable).
* Output Cargo `rerun-if-*-changed` instructions first, so even if the
  build itself fails, configuration changes will still trigger a re-run
  of build.rs.
* Remove TODOs that are impossible.
* Re-run build.rs when the flatbuffer definition file changes.
2018-11-01 14:18:18 +01:00
Ryan Dahl
198e396ead
Support cargo check (#1128)
- Based on code from @qti3e and @piscisaureus in #724 and #1125
  respectively.
- TODO The DENO_BUILD_PATH env var must be supplied and must be an
  absolute path, this restriction should be removed in future work.
2018-10-31 11:11:10 -07:00
Joseph
21dac66465 Better output on panic (#1129) 2018-10-31 07:30:52 -07:00
Ryan Dahl
7c82667f75
Upgrade Flatbuffers. (#1127)
Use msg_generated.rs as mod instead of crate.
2018-10-31 00:32:42 -07:00
Ryan Dahl
80b5c61460 Rename FetchReq op to Fetch. 2018-10-30 17:42:19 -07:00
Bartek Iwańczuk
946acbc559 Add resources op (#1119) 2018-10-30 12:58:55 -07:00
Kitson Kelly
8b39d2c99e Separate source map from output code. 2018-10-29 08:16:35 -07:00
Kevin (Kun) "Kassimo" Qian
a68403d090 Add application/x-typescript mime type support 2018-10-28 11:18:53 -07:00
Ryan Dahl
da959e8c87 v0.1.10
- Add URLSearchParams (#1049)
- Implement clone for FetchResponse (#1054)
- Use content-type headers when importing from URLs. (#1020)
- Use checkJs option, JavaScript will be type checked and users can
  supply JSDoc type annotations that will be enforced by Deno (#1068)
- Add separate http/https cache dirs to DENO_DIR (#971)
- Support https in fetch. (#1100)
- Add chmod/chmodSync on unix (#1088)
- Remove broken features: --deps and trace() (#1103)
- Ergonomics: Prompt TTY for permission escalation (#1081)
2018-10-27 08:13:28 -07:00
Ryan Dahl
882a323811 Minor sorting not handled by format. 2018-10-27 08:08:51 -07:00
Ryan Dahl
6adc87e3eb
Ergonomics: Prompt TTY for permission escalation (#1081) 2018-10-27 06:11:39 -07:00
Ryan Dahl
6bbf0777b1 Remove broken feature: --deps 2018-10-26 13:07:33 -07:00
Kevin (Kun) "Kassimo" Qian
a99aaf5def Add chmod/chmodSync on unix (and fix Cargo.toml) (#1088)
Initial implementation by Srijan Reddy (@srijanreddy98, #672).
2018-10-26 13:01:45 -07:00
Ryan Dahl
9b8f77f525 Support https in fetch.
fetch should use same hyper connector as import.
2018-10-26 09:40:27 -07:00
Kevin (Kun) "Kassimo" Qian
8500b78955 Add separate http/https cache dirs to DENO_DIR (#971)
Also change remote relative import logic.
2018-10-26 06:55:05 -07:00
Ryan Dahl
0501330607 Add libdeno.shared global shared ArrayBuffer. 2018-10-24 14:52:38 -07:00
Ryan Dahl
fd68f85ce8 libdeno: deno_new should take a snapshot parameter. 2018-10-24 14:52:38 -07:00
Joseph
d2df67e822 fix typos (#1083) 2018-10-24 08:54:34 -07:00
Bert Belder
ae00df73a2
Move eager functions into eager_unix.rs 2018-10-24 11:16:00 +02:00
Bert Belder
58f0547e09
Refactor eager_{read,write,accept}_tcp into separate functions 2018-10-24 11:16:00 +02:00
Kevin (Kun) "Kassimo" Qian
988ec88dd0 Switch to getopts for flag parsing (#1080) 2018-10-23 21:02:43 -07:00
Kitson Kelly
8ef7da2611 Enforce media types 2018-10-23 04:48:00 -07:00
Ryan Dahl
c85311dd7d v0.1.9
- Performance and stability improvements on all platforms.
- Add cwd() and chdir() #907
- Specify deno_dir location with env var DENO_DIR #970
- Make fetch() header compliant with the current spec #1019
- Upgrade TypeScript to 3.1.3
- Upgrade V8 to 7.1.302.4
2018-10-20 17:30:17 -07:00
Ryan Dahl
92b0a94c23 Optimization: eager accept 2018-10-20 12:39:56 -07:00
Ryan Dahl
aac9e204b7 Optimization: eager write 2018-10-20 12:39:56 -07:00
Ryan Dahl
2c33334d28 Optimization: eager read
TCP sockets should attempt the non-blocking read in the main thread.
2018-10-20 12:39:56 -07:00
Ryan Dahl
2af25b1957 Allow partial writes.
Do not use tokio_io::io:write_all().
Adds src/tokio_write.rs
2018-10-20 12:39:56 -07:00
Ryan Dahl
8f9d407e22 Sort ops. 2018-10-19 21:36:07 -04:00
ztplz
b809a82fd9 Add missing copyrights (#1024) 2018-10-19 15:25:29 -04:00
Bert Belder
d0b859ec37
format 2018-10-19 00:29:09 +02:00
Bartek Iwańczuk
3a226f166f add test case for metrics 2018-10-18 05:08:49 -04:00
Bartek Iwańczuk
fd2bb015c7 fix metrics logic 2018-10-18 05:08:49 -04:00