Commit graph

77 commits

Author SHA1 Message Date
a3b3d3bc51
chore: update quickjs to 2024-01-13 2024-03-23 01:21:50 +01:00
fb9644c07c fix: clippy lints 2023-02-05 23:38:46 +01:00
a702c33c57 fix: warnings from deprecated chrono fn 2023-02-05 22:49:49 +01:00
df3ec1d417 added quickjs patch for dateparser 2023-02-05 21:31:46 +01:00
95c79348b2 recreate bindings with latest bindgen 2023-02-05 20:29:03 +01:00
9f69e8f5b4 format code 2023-02-05 18:34:00 +01:00
fbb192e4b3 fix clippy lints 2023-02-05 18:22:56 +01:00
6eeb0f70b9 fix: cargo warnings 2022-10-03 00:37:26 +02:00
749be29936 added date validation 2022-08-13 18:07:09 +02:00
333283c377 fix more date formats, now passes all tests 2022-08-13 15:02:04 +02:00
f52e54d69c 2 small fixes 2022-08-13 01:39:24 +02:00
f13cc55ce2 added better date parser 2022-08-13 01:05:39 +02:00
Christoph Herzog
a158099b25
fix: Remove unused imports 2021-08-09 15:49:37 +02:00
Christoph Herzog
4a4c2ff04f docs: Update Windows info in crate docs 2021-06-08 21:24:47 +00:00
Christoph Herzog
9980a14770 Preparations for making bytecode compilation public 2021-06-08 21:24:47 +00:00
Christoph Herzog
8ed314de5f Remove dead code, make JsCompiledFunction public 2021-06-08 21:24:47 +00:00
Christoph Herzog
ad8d27e463 Move DroppableValue to bindings
Since it is only used for bindings, it's better located there.
2021-06-08 21:24:47 +00:00
Christoph Herzog
f32bb7165a Initial Bindings Refactor
This commit cleans up the bindings code and makes it a little more
structured and coherent.

It also removes sum direct usage of C code, or uses newly exported C
functions where appropriate.

The future goal of these changes is to export more functionality to
users and make the Owned* wrappers public.

* Manually export some additional helpers via static-helpers.c
* Rename Owned* types and move them to a subdirectory
* Add more convenience methods on Owned* types
* Add additional Owned wrappers for functions, bytecode, modules
* Move compile utils to bindings
* Move serializiation to subfile

TODO: The serialization code is also in need of a cleanup.
2021-06-08 21:24:47 +00:00
Andries Hiemstra
05f39f3db6 Implement bytecode compilation. 2021-06-08 21:24:47 +00:00
Christoph Herzog
e6e6fd66d9 Prevent double free on set_property failure 2021-03-25 09:51:17 +00:00
Christoph Herzog
5db7b834eb Allow JsValue arguments in add_callback + dead code cleanup 2021-03-25 09:51:17 +00:00
Christoph Herzog
e759be05f7 Fix set_global() use after free. 2021-03-15 14:06:58 +00:00
Christoph Herzog
5daf2b2527 Implement TryFrom<JsValue> for Vec<T> 2021-02-18 09:20:54 +01:00
Christoph Herzog
7182a89f38 add Context::set_global 2021-02-04 21:52:25 +01:00
Christoph Herzog
ff3c3521be Move tests to dedicated file 2021-02-04 21:13:34 +01:00
Christoph Herzog
2e37802653 Fix docs warnings 2021-02-04 20:49:01 +01:00
Christoph Herzog
aca955fe3d Handle int values in Date deserialization 2021-02-04 20:05:40 +01:00
Ivan Pavluk
0c3eff9024 cargo fmt 2020-11-26 10:16:13 +01:00
Ivan Pavluk
f9eb75785c Add JsValue::Undefined 2020-11-26 10:16:13 +01:00
Christoph Herzog
96220c78d1 Add size cast that seems to be needed on some linux variants 2020-05-25 14:14:06 +02:00
Noah
387b3b53df Update quickjs to 2020-04-12 2020-05-25 14:14:06 +02:00
Rail Khusnutdinov
e1982fc724 impl TryFrom<JsValue> for HashMap<String, V> 2020-03-24 22:14:36 +00:00
Mrmaxmeier
ceab2c9251 fix build for log feature 2020-01-28 21:00:26 +01:00
Christoph Herzog
870d45fb3d chore: Add _NonExhaustive variant to Value
BREAKING CHANGE : the new variant ensures that we can add new value types
without a semver break in the future.
2019-11-02 23:44:22 +01:00
Alexander Rodin
4d6451b22d fix: Use c_char instead of architecture-specific i8 2019-10-15 12:31:28 +02:00
Alexander Rodin
59fac31256
fix: Use space instead of comma as a separator 2019-10-04 18:37:22 +03:00
Christoph Herzog
4307fd83a8 chore: Remove outdated TODOs 2019-10-02 19:23:26 +02:00
Christoph Herzog
e039582a72 (feat) Console support
This commit implements console support.

A ConsoleBackend trait can be implemented and registered in the
ContextBuilder.

A implementation that forwards to the `log` crate is available with the
new `log` feature.
2019-10-02 17:28:42 +02:00
Christoph Herzog
0abd08b4e6 (feat) Support vararg callbacks with the Arguments wrapper type
Callbacks accepting a undetermined amount of arguments can now be
created by using a closure that takes a single callbacks::Arguments arg.
2019-10-02 14:04:35 +02:00
Alexander Rodin
142af5003a chore: Deny warnings and missing docs for tests using cfg_attr 2019-10-01 22:41:58 +02:00
Christoph Herzog
10a53ad3af chore: Remove redundant #[cfg] attributes 2019-09-26 18:08:51 +02:00
Alexander Rodin
308686035b feat: Arbitrary Precision Integer Support
Implement support for the arbitrary precision integers feature of
quickjs.

In Rust, values are represented with the num-bignum::BigInt type.
2019-09-26 18:08:06 +02:00
Alexander Rodin
a2d8e1c3e1 Free runtime if context cannot be created 2019-09-21 15:02:46 +02:00
Christoph Herzog
223a28fa27 (docs) Add note about future property iterator 2019-08-30 20:29:06 +02:00
Alexander Rodin
5fd3bc7c72 Use RAII-style approach to free JS enum on errors 2019-08-30 20:29:06 +02:00
Alexander Rodin
be7fffaf14 Free atoms returned by q::JS_GetPropertyInternal 2019-08-30 20:29:06 +02:00
Christoph Herzog
52a26ae639 Use JS_DefineProperty instead of SetProperty for new objects
This is the safe way to do it according to the QuickJS mailing list.
(might cause bugs if base object already has a similar property)
2019-08-20 13:45:43 +02:00
Christoph Herzog
273c60066a fix: Fix timetstamp conversion logic for JsValue::Date
A wrong multiplication factor was used to convert timestamps, which resulted
in treating nanoseconds as milliseconds instead.

Fixed by switching to millisecond helper functions in chrono.
2019-08-13 11:17:53 +02:00
Christoph Herzog
cd42e0665d Add chrono integration 2019-08-13 01:34:49 +02:00
Christoph Herzog
e9475d5f4e Implement resolving of async values. 2019-08-12 19:39:20 +02:00