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

306 commits

Author SHA1 Message Date
Andy Hayden
526fdac053
Update to rust 2018 edition 2019-01-14 22:30:04 +01:00
Ryan Dahl
3c1a0ad19e
Properly parse network addresses. (#1515) 2019-01-13 22:14:59 -05:00
Bert Belder
69c370c5cc
src: remove dependency on the 'kernel32' crate 2019-01-14 02:18:18 +01:00
Kevin (Kun) "Kassimo" Qian
e29a676b78 Avoid show confusing lines in gen/bundle/main.js that throws error (#1502) 2019-01-12 09:14:09 -05:00
Ryan Dahl
6322f45e7b Pipe new exception info through into JSError
Adds a new integration test for syntax error.
2019-01-11 21:44:26 -05:00
Ryan Dahl
cca3a9562b
Re-enable --recompile (#1492) 2019-01-09 20:52:13 -05:00
Ryan Dahl
0ceb554343
Native ES modules (#1460)
* Native ES modules

This is a major refactor of internal compiler.

Before: JS and TS both were sent through the typescript compiler where
their imports were parsed and handled. Both compiled to AMD JS and
finally sent to V8

Now: JS is sent directly into V8. TS is sent through the typescript
compiler, but tsc generates ES modules now instead of AMD. This
generated JS is then dumped into V8.

This should much faster for pure JS code. It may improve TS compilation
speed.

In the future this allows us to separate TS out of the runtime heap and
into its own dedicated snapshot. This will result in a smaller runtime
heap, and thus should be faster.

Some tests were unfortunately disabled to ease landing this patch:
1. compiler_tests.ts which I intend to bring back in later commits.
2. Some text_encoding_test.ts tests which made the file invalid utf8.
   See PR for a discussion.
Also worth noting that this is necessary to support WASM
2019-01-09 12:59:46 -05:00
Ryan Dahl
3afdae165d
Add --allow-all flag (#1482) 2019-01-09 11:59:54 -05:00
Ryan Dahl
6f79ad721a
Minimal Worker support (#1476)
This adds the ability to spawn additional Isolates from Rust and send
and receive messages from them. This is preliminary work to support
running the typescript compiler in a separate isolate and thus support
native ES modules. Ref #975.
2019-01-08 14:44:06 -05:00
Ryan Dahl
9ff6bca863
Isolate::execute_mod wrap filename in CString (#1479)
When we called js_filename.as_ptr() without using CString it wasn't
necessarally null terminated, which was creating spurious failures.
2019-01-08 14:42:53 -05:00
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