1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-02 17:01:14 -05:00
Commit graph

369 commits

Author SHA1 Message Date
Sajjad Hashemian
c2663e1d82 Implement deno.mkdir() 2018-09-10 15:02:07 -04:00
Ryan Dahl
e293c204a0 Support async futures that have empty response. 2018-09-10 15:02:07 -04:00
Ryan Dahl
35bc9ddf63 Implement deno.readFile()
As an example of how to implement ops that have both sync and async
versions.
2018-09-10 00:14:28 -04:00
Ryan Dahl
c29392b25f create_msg -> serialize_response 2018-09-10 00:14:28 -04:00
Ryan Dahl
9bb0627a88 Remove null_buf() 2018-09-10 00:14:28 -04:00
Ryan Dahl
e2a285b871 Better NotFound error handling in CodeFetch
throwResolutionError was swallowing unrelated errors.
2018-09-09 23:12:22 -04:00
Ryan Dahl
a4f1b367b9 Remove namespace from src/msg.fbs 2018-09-09 23:12:22 -04:00
Ryan Dahl
0d03fafbfe Map promises onto futures.
Refactors handlers.rs

The idea is that all Deno "ops" (aka bindings) should map onto
a Rust Future. By setting the "sync" flag in the Base message
users can determine if the future is executed immediately or put
on the event loop.

In the case of async futures, a promise is automatically created.
Errors are automatically forwarded and raised.

TODO:

- The file system ops in src/handler.rs are not using the thread pool
  yet. This will be done in the future using tokio_threadpool::blocking.
  That is, if you try to call them asynchronously, you will get a promise
  and it will act asynchronous, but currently it will be blocking.
- Handlers in src/handler.rs returned boxed futures. This was to make
  it easy while developing. We should try to remove this allocation.
2018-09-09 18:47:22 -04:00
J2P
3deaf99a92 Format msg.fbs 2018-09-07 20:36:18 -04:00
Parsa Ghadimi
1052f8d0c9 Check allow-net in fetch 2018-09-06 11:07:10 -04:00
Mirko Jotic
fcdfacc2de Implementing --deps flag
- Adding a ModuleId type alias to specify original url or local file of
dependency
- Modifying ModuleMetaData class to contain ModuleId
- Adding a --deps flag
2018-09-06 10:42:07 -04:00
Ryan Dahl
59f3fca166 v0.1.3
* Fixes module resolution error #645
* Better flag parsing
* lStatSync -> lstatSync
* Added deno.renameSync()
* Added deno.mkdirSync()
* Fix circular dependencies #653
* Added deno.env() and --allow-env
2018-09-05 23:08:20 -04:00
Ryan Dahl
e7741ab97f Rename src/binding.rs -> src/libdeno.rs 2018-09-05 22:27:47 -04:00
Ryan Dahl
32f0c37a42 Format 2018-09-05 22:27:47 -04:00
Ryan Dahl
e4990804fa Improve module resolution.
Windows can't handle ":" in path names, so we use a special directory
format .deno/deps/localhost_PORT4545/ to represent hosts with
non-default ports.

Fixes #645.
2018-09-05 22:27:23 -04:00
Ian Shehadeh
827f489c5a Better flag parsing 2018-09-04 16:00:32 -04:00
Mani Maghsoudlou
641e3d404d Implement renameSync 2018-09-04 11:57:04 -04:00
Sajjad Hashemian
b2b4299e3b Implement mkdirSync 2018-09-03 15:06:00 -04:00
Ryan Dahl
dff909ef6c Clean up handlers. 2018-09-03 10:45:58 -04:00
Ryan Dahl
4ccae957fb Upgrade flatbuffers 2018-09-03 10:45:58 -04:00
Ryan Dahl
787832c68e Format. 2018-09-03 10:45:58 -04:00
J2P
f949ded933 Log level code refactoring 2018-09-02 19:16:50 -04:00
Aaron Power
f131445a46 Implemented deno.env and refactored flags.rs 2018-08-31 13:18:24 -04:00
Ryan Dahl
cce3bd470b v0.1.2
* Added https import support.
* Added deno.makeTempDirSync().
* Added deno.lstatSync() and deno.statSync().
2018-08-30 18:29:05 -04:00
Ryan Dahl
0ec629d105 format 2018-08-30 14:41:55 -04:00
Aaron Power
b86bf4d8a4 Implemented statSync and lStatSync 2018-08-30 12:39:33 -04:00
Ryan Dahl
d8d5c421c3 Support https imports.
Adds hyper-rustls to the build.

Use ring for sha1 instead of "ssh1" crate.

Fixes #528.
2018-08-30 08:29:28 -04:00
Ryan Dahl
11896647e6 Downgrading tokio to registry version.
Prep for rustls.
2018-08-30 08:29:28 -04:00
Ryan Dahl
902e6e2ee6 Fix warnings.
Ref #374
2018-08-30 05:48:40 -04:00
Bert Belder
ceaf822682
Implement makeTempDirSync() 2018-08-29 22:40:05 +02:00
Ryan Dahl
c42e4ddbb7 v0.1.1 2018-08-28 09:37:52 -04:00
Aaron Power
3a5cf9ca8b Replaced read_file_sync{_string} with std::fs::read{_to_string} 2018-08-26 11:00:22 -04:00
Ryan Dahl
68d388229e Bump version to v0.1.0
https://github.com/denoland/deno/milestone/1
2018-08-23 10:37:06 -04:00
Ryan Dahl
ecb955929f Normalize windows paths.
Add resolve_module test
2018-08-23 09:41:08 -04:00
Ryan Dahl
e2f9b0e6fd First pass at HTTP imports
Implement --reload

Integrate hyper errors into DenoError

In collaboration with Tommy Savaria <tommy.savaria@protonmail.ch>
2018-08-23 09:41:08 -04:00
Ryan Dahl
7d7263c48f Implement writeFileSync
In collaboration with Tommy Savaria <tommy.savaria@protonmail.ch>
2018-08-22 18:39:07 -04:00
Ryan Dahl
ca4ace6b1f Bump version to v0.0.3 2018-08-22 12:08:52 -04:00
Jeremy Banks
27ef77e31b Change usage example script extension from .js to .ts 2018-08-22 09:57:21 -04:00
Ryan Dahl
18d495c7d1 Better error handling in src/handlers.rs
Introduces error codes that are shared between JS/RS

Fixes #526.
2018-08-21 15:37:45 -04:00
Ryan Dahl
cb1393cdae
Travis deploy (#548)
* Fix travis deploy / simplify build.

- No more stages, only build release mode.
- Fixes API key issue.

* Reinstate master only - testing was successful.
2018-08-21 08:42:23 -04:00
Ryan Dahl
868e8d8866 First pass at fetch()
With help from Thomas Ghysels <info@thomasg.be>
2018-08-20 16:53:39 -04:00
Yoshiya Hinosawa
aaabc853e8 chore: move libdeno files to //libdeno/ 2018-08-19 11:27:47 -04:00
Ryan Dahl
42e7b7b3e7 Use snake-case for cmd_id. 2018-08-17 18:50:37 -04:00
Ryan Dahl
0b61d955eb Upgrade fbs to latest.
Reduces numbers of warnings.
2018-08-17 18:50:37 -04:00
Ryan Dahl
17b9c5c390
Command line flag parsing (#524)
In particular this allow -D for logging debug output.
2018-08-17 16:34:30 -04:00
Ryan Dahl
b6912e718a Remove dead code: src/flatbuffer_builder.cc 2018-08-16 08:40:11 -04:00
Ryan Dahl
36d82374cf Implement deno_handle_msg_from_js in Rust
Fixes #419, #414.
2018-08-16 08:40:11 -04:00
Ryan Dahl
d770cc18f8 Upgrade Rust Flatbuffers 2018-08-16 08:40:11 -04:00
Ryan Dahl
c7ce450ee9 Rename mock_runtime_test to libdeno_test
Fixes #465
2018-08-11 09:02:07 -07:00
Kitson Kelly
2c8bdd2f5f Fix stacktraces in deno_ns 2018-08-10 11:50:45 -07:00
Robby Madruga
99932f6422 Change Deno::new to return an owned Box 2018-08-09 14:59:49 -07:00
Ryan Dahl
413bcf2042 Add readFileSync 2018-08-09 14:27:46 -07:00
Ryan Dahl
72544de443 Add fs::read_file_sync_string 2018-08-09 14:27:46 -07:00
Ryan Dahl
fb87cb38ec
First pass at setTimeout with Tokio (#434) 2018-08-09 12:17:08 -07:00
Ryan Dahl
51380bf399 Organize libdeno functions. 2018-08-08 18:35:26 -07:00
Ryan Dahl
070c5f85da Fix rust logger. 2018-08-08 18:35:26 -07:00
Ryan Dahl
69f73ee368 Hacky error handling for Url::from_file_path. 2018-08-08 18:35:26 -07:00
Ryan Dahl
60f6067cf9 Implement os.exit 2018-08-03 22:41:59 -04:00
Ryan Dahl
d8b68648d1 Update repo links to denoland. 2018-08-02 23:12:49 -04:00
Ryan Dahl
c7c6203e61
Source map support (#429)
This change increases size:
out/debug/obj/libdeno/from_snapshot.o  19M -> 34M
out/release/deno                       32M -> 47M
2018-08-02 13:13:32 -04:00
Ryan Dahl
6b6fac209c Optimize compile time by using asm.
Switches to using asm incbin to embed the V8 snapshot instead of
outputing C code and then compiling it.

Compile time for from_snapshot.o goes from 44s to 1s.
2018-08-01 12:14:10 -04:00
Ryan Dahl
db8dc0e9f8 Better handling of exceptions during snapshot creation. 2018-08-01 12:14:10 -04:00
Ryan Dahl
ae82db54f6 build: use compiled_action for create_snapshot.
Switch the order of the snapshot_creator args, in order to allow for
optional source map arg.
2018-08-01 12:14:10 -04:00
Ryan Dahl
4d386e9e1c Implement CodeCache 2018-07-29 00:22:39 -04:00
Ryan Dahl
1f093c12f8 Add sha1 and tempfile crates. 2018-07-29 00:22:39 -04:00
Ryan Dahl
20a41aa9b5 Add from_c() to get a Deno object from ptr.
This is a utility function for CodeCache and other handlers.
2018-07-29 00:22:39 -04:00
Ryan Dahl
e7445507aa Implement a logger so we can get logging output. 2018-07-29 00:22:39 -04:00
Ryan Dahl
b39a71d4c6 Fix clang warning.
warning: comparison of integers of different signs: 'const unsigned
long' and 'const int' [-Wsign-compare]
2018-07-26 11:38:03 -04:00
robbym
180170d860 Add --v8-options flag (#405) 2018-07-25 21:27:27 -04:00
Ryan Dahl
0213053856 Remove handlers crate target.
- Add build scripts for Rust flatbuffers.
- Rewrites some reply.cc methods in Rust.
- Changes some struct elements to table in msg.fbs (rust flatbuffers
  lacks support currently)
- Renames handlers_test to test_rs.
- This reorg is needed to make progress on the code cache handler.
2018-07-24 12:29:54 -04:00
Ryan Dahl
b79ce93010 Allow deno_buf with null alloc_ptr to be memcpy'd
This is a temporary hack to allow for easier restructuring of
the serialization code as we move Flatbuffer stuff from C++ to Rust.
2018-07-24 12:29:54 -04:00
Ryan Dahl
b87e6d5604 Add mock_runtime_test for deno_last_exception. 2018-07-24 12:29:54 -04:00
Ryan Dahl
1de16af1f3 Change copyrights to be 'Deno authors'. 2018-07-24 10:38:11 -04:00
Bert Belder
cc14df427f
Fix resolve_module() when module_specifier is an absolute file path 2018-07-22 03:50:16 +02:00
Ryan Dahl
dff5c16e85
Add tools/test.py test runner. (#384) 2018-07-21 19:08:24 -04:00
Ryan Dahl
21c4b8a42d Use 2 space indent.
Apologies for the churn, but my screen is small. rustfmt assumes big
monitors.
2018-07-20 03:46:26 -04:00
Ryan Dahl
a7bf154cb8 Wrap rust at 80 columns. 2018-07-20 03:46:26 -04:00
Bert Belder
c67d98eb7f
Make test_resolve_module pass on windows 2018-07-19 21:55:43 +02:00
Ryan Dahl
ae393879a7 cleanup: Move C extern code to src/binding.rs 2018-07-19 08:29:26 -04:00
Ryan Dahl
3dde880c32 Rename deno_nosnapshot to deno_ns. 2018-07-18 15:43:50 -04:00
Ryan Dahl
b892188878 Better exception output. 2018-07-18 15:43:50 -04:00
Ryan Dahl
3e51605bc9 Execute JS for the first time in Rust rewrite.
Implements code_fetch handler in Rust.

Add ability to embed string assets (for typescript declaration files)

Remove deno_cc and deno_cc_nosnapshot targets.
2018-07-18 15:43:50 -04:00
Ryan Dahl
c6ae3f7abc Add deno::Basename and deno::BinaryContentAsC utilies.
These are prep for code sharing with the asset code soon to land.
2018-07-18 15:43:50 -04:00
Ryan Dahl
c775d0c176 Fix warnings in mock_runtime_test.cc 2018-07-18 15:43:50 -04:00
Ryan Dahl
c4f2097c7b Run tools/format.py 2018-07-13 14:38:50 -04:00
Ryan Dahl
2c30a25568 Move C++ test main function to its own file. 2018-07-13 14:38:50 -04:00
Bert Belder
24b0e91d80
Move buffers between V8 and native
* send()/recv() now operate on TypedArrays rather than ArrayBuffers.

* Remove a copy (through ArrayBuffer.slice()) from the send path.

* Remove a copy (through v8::ArrayBuffer::New()) from the return path.

* After moving a buffer from JS to native, the ArrayBuffer object and
  it's views are made inaccessible ('neutered').

* `struct deno_buf` now holds two [ptr, length] tuples, one for the actual
  memory allocation, and one for the logical data contained therein.
  This is necessary because flatbuffers fills it's buffer bottom-up, so
  the serialized blob doesn't start at beginning of the buffer, but
  somewhere in the middle.
2018-07-12 21:26:38 +02:00
Bert Belder
bbcd4c8dd3
Remove channel argument from Rust message callback
This makes `deno` not crash any more.
2018-07-12 21:07:20 +02:00
Faris Amali Alis
7e5f0a7a66 Add nosnapshot executables for faster incremental builds (#359)
Fixes #311.
2018-07-12 15:06:36 -04:00
Ryan Dahl
d160de7f44
Add rust url crate. (#355) 2018-07-10 14:56:12 -04:00
Bert Belder
8a17db8266
Add 'command id' field to messages
This allows for correlating response messages to the command message that
caused them.
2018-07-08 21:01:24 +02:00
Ryan Dahl
6bff970d69 Add rust_test to gn build, with working example. 2018-07-07 17:24:46 -04:00
Ryan Dahl
a2dde56c59 Remove channel parameter from deno_send/recv. 2018-07-06 18:25:09 -04:00
Ryan Dahl
9778eceaf5 Use C++ to do flatbuffer parsing.
- Port protobuf messages to flatbuffers.
- Demo linking to rust from C++ executable.
- Start using the prototype TS libraries.
2018-07-06 17:33:06 -04:00
Ryan Dahl
d9cb093989 Run tools/format.sh 2018-07-06 17:33:06 -04:00
Ryan Dahl
21e1425656 Better c++ error handling 2018-07-06 12:22:11 -04:00
Ryan Dahl
d30664958e Further gn/rust cleanups
Move rust.gni and deno.gni into build_extra/

Removes rust_library which was only an action. This instead defines
rust_component, which is an action plus a gn "component" target
to expose the resulting object file. This simplifies link code in
rust.gni.

Support rust modules that can be linked into C++.
2018-07-06 10:46:30 -04:00
Faris Amali Alis
bfe08aa462 Rename deno.cc to binding.cc and other renames (#339)
Fixes #336
2018-07-06 03:19:19 -04:00
Ryan Dahl
131e0ce4c7 Rename mock_main to deno_cc 2018-07-05 12:41:28 -04:00
Ryan Dahl
06a28998ea Replace protobufs with flatbuffers 2018-07-04 16:43:08 -04:00
Bert Belder
29ba462e7d Fix msg.pb.h path 2018-07-04 21:55:58 +02:00
Mike Reinstein
693e43e421 removed now irrelevant kKeep segfault comment 2018-07-04 03:46:52 +02:00
Mike Reinstein
24dfbd1568 switch from kClear to kKeep 2018-07-04 01:55:40 +02:00
Mike Reinstein
86dac80d98 upgrade v8 to 6.9.297. remove IIFE workaround for bug in v8 snapshot serializer 2018-07-04 01:55:40 +02:00
Ryan Dahl
a33f575cda Switch back to recv/send instead of pub/sub for low-level API. 2018-07-03 21:22:39 +02:00
Robby Madruga
7fcaf7d35d Rustify Deno API 2018-07-03 21:22:39 +02:00
Ryan Dahl
92d01f8519 Remove BaseMsg from msg.proto 2018-07-03 21:22:39 +02:00
Ryan Dahl
cf07ec5b63 Call into JS from rust 2018-07-03 21:22:39 +02:00
Yoshiya Hinosawa
6f7ca760b8 move v8 to third_party/v8 (#322) 2018-07-03 10:15:32 +02:00
Ryan Dahl
6d288b63cd Call lint in travis (and fix long long issue) 2018-07-02 09:09:23 +02:00
Yoshiya Hinosawa
ea35281d63 chore: move //src/js to //js
refs: #285
2018-07-01 17:22:36 +02:00
Yoshiya Hinosawa
6830370c3e reorg: Move GN files to root (#309)
refs: #285
2018-07-01 13:47:28 +02:00
Ryan Dahl
467408c6dc Reorg: Move tools/ and gitignore to root. 2018-06-28 21:56:53 +02:00
Ryan Dahl
4b234df803 Rename deno_rs to deno. 2018-06-25 23:08:14 +02:00
Ryan Dahl
5aeaad9a6a Fix run_node.py symlink. 2018-06-25 23:07:57 +02:00
Ryan Dahl
1330553be1 Add onerror test to mock_runtime_test.cc 2018-06-22 23:42:04 +02:00
Ryan Dahl
9315adb8c5 lint 2018-06-22 23:19:55 +02:00
Ryan Dahl
bd4693471f
run_node.py don't error if symlink exists (#279)
The switch from deno2/ to src/ made Travis's cached symlink invalid and
now os.path.exists() returns false.
2018-06-22 17:50:27 +02:00
Tristan Marion
3b595253a2 Move deno2 folder to src (#277) 2018-06-22 15:30:35 +02:00