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

78 commits

Author SHA1 Message Date
Ryan Dahl
fa3c35301a
Rename //src/ to //cli/ (#1962)
To better distinguish the deno_core crate from the executable deno,
which will now be called "the cli" internally.
2019-03-19 12:18:05 -04:00
andy finch
cdfd32dd74 Re-implement init scripts in core (#1958)
Re-enables arm64 CI test
2019-03-18 20:03:37 -04:00
Ryan Dahl
44773c9b0f Integrate //core into existing code base
This disables a few tests which are broken still:
- tests/error_004_missing_module.test
- tests/error_005_missing_dynamic_import.test
- tests/error_006_import_ext_failure.test
- repl_test test_set_timeout
- repl_test test_async_op
- repl_test test_set_timeout_interlaced
- all of permission_prompt_test
2019-03-18 17:17:08 -04:00
Ryan Dahl
58cc69f672 Make timers act like normal ops
This is in preperation for core integration.
2019-03-12 19:25:57 -04:00
Kitson Kelly
24d6bf6aeb Remove 'deno' builtin module (#1895) 2019-03-07 21:56:56 -05:00
andy finch
75fe80d5a4 use-snapshots build option for cross compile support. (#1852) 2019-03-04 18:09:35 -05:00
andy finch
8c310d3d56 Permissions refactor (#1864)
Refactored permissions to be assignable on a per-isolate 
basis, and added a fix for #1858 to op_fetch_module_meta_data.
2019-03-01 19:25:50 -05:00
Ryan Dahl
b3b989ffdc
Use deno_core::JSError in deno (#1855)
src/js_errors.rs takes care of source maps and color while
core/js_errors.rs is just the basic struct.
2019-02-28 16:19:04 -05:00
Ryan Dahl
b8a537d020
deno_core (#1827)
A new low-level crate with focus on speed. 
This doesn't yet hook into the existing code base.
2019-02-26 17:36:05 -05:00
Bartek Iwańczuk
5dfbbbb07a Add import.meta.main (#1835) 2019-02-26 13:29:45 -05:00
andy finch
9ed413b318 Updated some type assertions to work with other libc implementations. (#1837) 2019-02-26 03:56:19 -05:00
Ryan Dahl
42408febe8 Add window.location 2019-02-18 23:04:59 -05:00
Kitson Kelly
54094c7510 Rationalise compiler ops (#1740) 2019-02-18 10:42:15 -05:00
Ryan Dahl
99ce807a12
Add deps to --info output. (#1720)
Move module stuff into its own file.
2019-02-08 21:36:10 -05:00
Dmitry Sharshakov
9ab03389f0 Add --allow-read (#1689)
Co-authored-by: Greg Altman <g.s.altman@gmail.com>
2019-02-08 15:59:38 -05:00
jingweicai
37b05740fa fix: do not load cache files when recompile flag is set (#1695) 2019-02-06 23:42:34 -05:00
Ryan Dahl
4b61170e22 Better error message for bad filename CLI argument. 2019-02-02 17:33:21 -05:00
Ryan Dahl
1770a77bca Clean up return value of deno_execute
and deno_respond
2019-02-02 16:46:31 -05:00
Bert Belder
e5899b14e2
src: simplify rust code 2019-02-01 14:58:25 -08:00
Ryan Dahl
00597ffde1
Refactor libdeno ES module interface. (#1624)
Allows for future asynchronous module loading.

Add support for import.meta.url

Fixes #1496
2019-01-30 17:21:31 -05:00
JaePil Jung
7f88b5fff3 Minor code cleanups (#1570) 2019-01-24 10:54:43 -05:00
Kevin (Kun) "Kassimo" Qian
f9b167deb0 Avoid crashes on ES module resolution when module not found (#1546) 2019-01-18 15:15:09 -05:00
Kevin (Kun) "Kassimo" Qian
c870cf4082 Add --prefetch flag for deps prefetch without running (#1475) 2019-01-15 12:19:58 -05:00
Bert Belder
d8adeb41de Clippy fixes (also fixes build with nightly) (#1527) 2019-01-15 07:06:25 -05:00
Andy Hayden
526fdac053
Update to rust 2018 edition 2019-01-14 22:30:04 +01: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
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
7024d9f253 Add rust binding and test for deno_execute_mod() 2019-01-03 09:45:40 -05:00
Ryan Dahl
2c477dd7cb Happy new year! 2019-01-02 02:37:08 +01: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
Ryan Dahl
81c8926ee9 Use default filename for Isolate::execute. 2018-12-11 15:07:55 -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
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
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
Bert Belder
48bf4062e4 First pass at running subprocesses (#1156) 2018-11-16 12:07:40 +08:00
Ryan Dahl
9d9853b319 Lift snapshot to be an argument of Isolate::new(). 2018-11-16 08:25:54 +08:00
Ryan Dahl
92e404706b
Use include_bytes! instead of incbin. (#1182) 2018-11-12 17:17:30 -08:00
Andy Hayden
13e1eb2b87 Fix many of the clippy::pedantic warnings 2018-11-06 06:43:02 -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
Ryan Dahl
6adc87e3eb
Ergonomics: Prompt TTY for permission escalation (#1081) 2018-10-27 06:11:39 -07:00
Ryan Dahl
0501330607 Add libdeno.shared global shared ArrayBuffer. 2018-10-24 14:52:38 -07:00