js 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/ext/js/bindgen/ext.c +2 -2
- data/ext/js/bindgen/ext_component_type.o +0 -0
- data/ext/js/extconf.rb +2 -0
- data/ext/js/js-core.c +2 -2
- data/ext/js/witapi-core.c +35 -17
- data/lib/js/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 153c572884d06b66e29644640877fa1b35d8d08725d44cafb0895e0269f40d8d
|
4
|
+
data.tar.gz: 67351a2724d1c4f74aba3506d14334bef7055918e564429ac9eaf73b277dbcac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5cfd35ce5a3242d83553dc3fe8e71664fcad0198535d85ee06adbad272cae7d3eddc2ade6e9852b4f81c559056f4f0904474f83ad6d0a000536a9b0d93a10b
|
7
|
+
data.tar.gz: bd603fe5fe568ec47898d1356a1e46f0bde720313c56b24e36b4f1f70d46f3995c87728621463d332ba37fd347f7ae7f78d218c99adf0d594f50954e21515a49
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# js
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/js)
|
4
|
+
|
5
|
+
JavaScript bindings for ruby.wasm. This gem provides a way to use JavaScript functionalities from Ruby through WebAssembly.
|
6
|
+
|
7
|
+
## Versioning and Compatibility
|
8
|
+
|
9
|
+
This gem follows the versioning of ruby.wasm. The version of this gem is the same as the version of ruby.wasm it is compatible with.
|
data/ext/js/bindgen/ext.c
CHANGED
@@ -150,7 +150,7 @@ void ruby_js_js_runtime_list_borrow_js_abi_value_free(ruby_js_js_runtime_list_bo
|
|
150
150
|
}
|
151
151
|
}
|
152
152
|
|
153
|
-
__attribute__((__import_module__("ruby:js/ruby-runtime"), __import_name__("[resource-drop]rb-iseq")))
|
153
|
+
__attribute__((__import_module__("[export]ruby:js/ruby-runtime"), __import_name__("[resource-drop]rb-iseq")))
|
154
154
|
extern void __wasm_import_exports_ruby_js_ruby_runtime_rb_iseq_drop(int32_t handle);
|
155
155
|
|
156
156
|
void exports_ruby_js_ruby_runtime_rb_iseq_drop_own(exports_ruby_js_ruby_runtime_own_rb_iseq_t handle) {
|
@@ -176,7 +176,7 @@ void __wasm_export_exports_ruby_js_ruby_runtime_rb_iseq_dtor(exports_ruby_js_rub
|
|
176
176
|
exports_ruby_js_ruby_runtime_rb_iseq_destructor(arg);
|
177
177
|
}
|
178
178
|
|
179
|
-
__attribute__((__import_module__("ruby:js/ruby-runtime"), __import_name__("[resource-drop]rb-abi-value")))
|
179
|
+
__attribute__((__import_module__("[export]ruby:js/ruby-runtime"), __import_name__("[resource-drop]rb-abi-value")))
|
180
180
|
extern void __wasm_import_exports_ruby_js_ruby_runtime_rb_abi_value_drop(int32_t handle);
|
181
181
|
|
182
182
|
void exports_ruby_js_ruby_runtime_rb_abi_value_drop_own(exports_ruby_js_ruby_runtime_own_rb_abi_value_t handle) {
|
Binary file
|
data/ext/js/extconf.rb
CHANGED
@@ -3,6 +3,8 @@ require "mkmf"
|
|
3
3
|
MakeMakefile::RbConfig ||= RbConfig
|
4
4
|
unless MakeMakefile::RbConfig::CONFIG["platform"] =~ /wasm/
|
5
5
|
$stderr.puts "This extension is only for WebAssembly. Creating a dummy Makefile."
|
6
|
+
# Explicitly set $srcs to avoid the default '*.c' globbing.
|
7
|
+
$srcs = []
|
6
8
|
create_makefile("js")
|
7
9
|
return
|
8
10
|
end
|
data/ext/js/js-core.c
CHANGED
@@ -438,7 +438,7 @@ static VALUE _rb_js_import_from_js(VALUE obj) {
|
|
438
438
|
* Returns +obj+ wrapped by JS class RbValue.
|
439
439
|
*/
|
440
440
|
static VALUE _rb_js_obj_wrap(VALUE obj, VALUE wrapping) {
|
441
|
-
#
|
441
|
+
#ifdef JS_ENABLE_COMPONENT_MODEL
|
442
442
|
rb_abi_stage_rb_value_to_js(wrapping);
|
443
443
|
return jsvalue_s_new(rb_js_abi_host_rb_object_to_js_rb_value());
|
444
444
|
#else
|
@@ -511,7 +511,7 @@ static VALUE _rb_js_false_to_js(VALUE obj) {
|
|
511
511
|
* Returns +self+ as a JS::Object.
|
512
512
|
*/
|
513
513
|
static VALUE _rb_js_proc_to_js(VALUE obj) {
|
514
|
-
#
|
514
|
+
#ifdef JS_ENABLE_COMPONENT_MODEL
|
515
515
|
rb_abi_stage_rb_value_to_js(obj);
|
516
516
|
return jsvalue_s_new(ruby_js_js_runtime_proc_to_js_function());
|
517
517
|
#else
|
data/ext/js/witapi-core.c
CHANGED
@@ -3,7 +3,11 @@
|
|
3
3
|
#include "ruby.h"
|
4
4
|
#include "ruby/version.h"
|
5
5
|
|
6
|
-
|
6
|
+
#include "types.h"
|
7
|
+
|
8
|
+
static VALUE rb_eval_string_value_protect_thunk(VALUE ctx) {
|
9
|
+
const rb_abi_guest_string_t *cabi_str = (const rb_abi_guest_string_t *)ctx;
|
10
|
+
VALUE str = rb_utf8_str_new((const char *)cabi_str->ptr, cabi_str->len);
|
7
11
|
const ID id_eval = rb_intern("eval");
|
8
12
|
VALUE binding = rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING"));
|
9
13
|
const VALUE file = rb_utf8_str_new("eval", 4);
|
@@ -11,14 +15,13 @@ static VALUE rb_eval_string_value_protect_thunk(VALUE str) {
|
|
11
15
|
return rb_funcallv(rb_mKernel, id_eval, 3, args);
|
12
16
|
}
|
13
17
|
|
14
|
-
static VALUE rb_eval_string_value_protect(
|
15
|
-
|
18
|
+
static VALUE rb_eval_string_value_protect(const rb_abi_guest_string_t *str,
|
19
|
+
int *pstate) {
|
20
|
+
return rb_protect(rb_eval_string_value_protect_thunk, (VALUE)str, pstate);
|
16
21
|
}
|
17
22
|
|
18
23
|
#define TAG_NONE 0
|
19
24
|
|
20
|
-
#include "types.h"
|
21
|
-
|
22
25
|
__attribute__((import_module("asyncify"), import_name("start_unwind"))) void
|
23
26
|
asyncify_start_unwind(void *buf);
|
24
27
|
#define asyncify_start_unwind(buf) \
|
@@ -200,15 +203,17 @@ void exports_ruby_js_ruby_runtime_rb_abi_value_destructor(
|
|
200
203
|
|
201
204
|
void rb_abi_guest_ruby_show_version(void) { ruby_show_version(); }
|
202
205
|
|
203
|
-
void
|
204
|
-
|
205
|
-
|
206
|
+
__attribute__((noinline)) static void rb_abi_guest_ruby_init_thunk(void) {
|
207
|
+
ruby_init();
|
206
208
|
rb_abi_guest_arena_hash = rb_hash_new();
|
207
209
|
rb_abi_guest_refcount_hash = rb_hash_new();
|
208
210
|
|
209
211
|
rb_gc_register_mark_object(rb_abi_guest_arena_hash);
|
210
212
|
rb_gc_register_mark_object(rb_abi_guest_refcount_hash);
|
211
213
|
}
|
214
|
+
void rb_abi_guest_ruby_init(void) {
|
215
|
+
RB_WASM_LIB_RT(rb_abi_guest_ruby_init_thunk())
|
216
|
+
}
|
212
217
|
|
213
218
|
void rb_abi_guest_ruby_sysinit(rb_abi_guest_list_string_t *args) {
|
214
219
|
char **c_args;
|
@@ -234,12 +239,11 @@ void rb_abi_guest_ruby_init_loadpath(void) {
|
|
234
239
|
RB_WASM_LIB_RT(ruby_init_loadpath())
|
235
240
|
}
|
236
241
|
|
237
|
-
void
|
242
|
+
__attribute__((noinline)) static void rb_abi_guest_rb_eval_string_protect_thunk(
|
238
243
|
rb_abi_guest_string_t *str, rb_abi_guest_tuple2_rb_abi_value_s32_t *ret0) {
|
239
244
|
VALUE retval;
|
240
245
|
RB_WASM_DEBUG_LOG("rb_eval_string_protect: str = %s\n", str->ptr);
|
241
|
-
|
242
|
-
RB_WASM_LIB_RT(retval = rb_eval_string_value_protect(utf8_str, &ret0->f1));
|
246
|
+
retval = rb_eval_string_value_protect(str, &ret0->f1);
|
243
247
|
RB_WASM_DEBUG_LOG("rb_eval_string_protect: retval = %p, state = %d\n",
|
244
248
|
(void *)retval, ret0->f1);
|
245
249
|
|
@@ -248,6 +252,10 @@ void rb_abi_guest_rb_eval_string_protect(
|
|
248
252
|
}
|
249
253
|
ret0->f0 = rb_abi_guest_rb_abi_value_new((void *)retval);
|
250
254
|
}
|
255
|
+
void rb_abi_guest_rb_eval_string_protect(
|
256
|
+
rb_abi_guest_string_t *str, rb_abi_guest_tuple2_rb_abi_value_s32_t *ret0) {
|
257
|
+
RB_WASM_LIB_RT(rb_abi_guest_rb_eval_string_protect_thunk(str, ret0));
|
258
|
+
}
|
251
259
|
|
252
260
|
struct rb_funcallv_thunk_ctx {
|
253
261
|
VALUE recv;
|
@@ -284,7 +292,9 @@ void rb_abi_guest_rb_funcallv_protect(
|
|
284
292
|
}
|
285
293
|
|
286
294
|
rb_abi_guest_rb_id_t rb_abi_guest_rb_intern(rb_abi_guest_string_t *name) {
|
287
|
-
|
295
|
+
VALUE retval;
|
296
|
+
RB_WASM_LIB_RT(retval = rb_intern((const char *)name->ptr));
|
297
|
+
return (rb_abi_guest_rb_id_t)retval;
|
288
298
|
}
|
289
299
|
|
290
300
|
rb_abi_guest_own_rb_abi_value_t rb_abi_guest_rb_errinfo(void) {
|
@@ -294,16 +304,24 @@ rb_abi_guest_own_rb_abi_value_t rb_abi_guest_rb_errinfo(void) {
|
|
294
304
|
return rb_abi_guest_rb_abi_value_new((void *)retval);
|
295
305
|
}
|
296
306
|
|
297
|
-
void rb_abi_guest_rb_clear_errinfo(void) {
|
307
|
+
void rb_abi_guest_rb_clear_errinfo(void) {
|
308
|
+
RB_WASM_LIB_RT(rb_set_errinfo(Qnil));
|
309
|
+
}
|
298
310
|
|
299
|
-
|
300
|
-
|
311
|
+
__attribute__((noinline)) static void
|
312
|
+
rb_abi_guest_rstring_ptr_thunk(rb_abi_guest_rb_abi_value_t value,
|
313
|
+
rb_abi_guest_string_t *ret0) {
|
301
314
|
VALUE r_str = (VALUE)rb_abi_guest_rb_abi_value_get(&value);
|
302
315
|
ret0->len = RSTRING_LEN(r_str);
|
303
316
|
ret0->ptr = xmalloc(ret0->len);
|
304
317
|
memcpy(ret0->ptr, RSTRING_PTR(r_str), ret0->len);
|
305
318
|
}
|
306
319
|
|
320
|
+
void rb_abi_guest_rstring_ptr(rb_abi_guest_rb_abi_value_t value,
|
321
|
+
rb_abi_guest_string_t *ret0) {
|
322
|
+
RB_WASM_LIB_RT(rb_abi_guest_rstring_ptr_thunk(value, ret0));
|
323
|
+
}
|
324
|
+
|
307
325
|
uint32_t rb_abi_guest_rb_abi_value_data_ptr(rb_abi_guest_rb_abi_value_t self) {
|
308
326
|
VALUE obj = (VALUE)rb_abi_guest_rb_abi_value_get(&self);
|
309
327
|
return (uint32_t)DATA_PTR(obj);
|
@@ -340,6 +358,8 @@ bool rb_abi_guest_rb_set_should_prohibit_rewind(bool value) {
|
|
340
358
|
return old;
|
341
359
|
}
|
342
360
|
|
361
|
+
#ifdef JS_ENABLE_COMPONENT_MODEL
|
362
|
+
|
343
363
|
static VALUE rb_abi_export_stage = Qnil;
|
344
364
|
static rb_abi_guest_own_rb_abi_value_t rb_abi_export_rb_value_to_js(void) {
|
345
365
|
VALUE staged = rb_abi_export_stage;
|
@@ -354,8 +374,6 @@ void rb_abi_stage_rb_value_to_js(VALUE value) {
|
|
354
374
|
rb_abi_export_stage = value;
|
355
375
|
}
|
356
376
|
|
357
|
-
#ifdef JS_ENABLE_COMPONENT_MODEL
|
358
|
-
|
359
377
|
extern void __wasm_call_ctors(void);
|
360
378
|
static inline void __wasm_call_ctors_if_needed(void) {
|
361
379
|
static bool __wasm_call_ctors_done = false;
|
data/lib/js/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date: 2024-
|
11
|
+
date: 2024-06-29 00:00:00.000000000 Z
|
11
12
|
dependencies: []
|
12
13
|
description: JavaScript bindings for ruby.wasm. This gem provides a way to use JavaScript
|
13
14
|
functionalities from Ruby through WebAssembly.
|
@@ -18,6 +19,7 @@ extensions:
|
|
18
19
|
- ext/js/extconf.rb
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
22
|
+
- README.md
|
21
23
|
- ext/js/bindgen/.clang-format
|
22
24
|
- ext/js/bindgen/ext.c
|
23
25
|
- ext/js/bindgen/ext.h
|
@@ -50,6 +52,7 @@ licenses:
|
|
50
52
|
- MIT
|
51
53
|
metadata:
|
52
54
|
source_code_uri: https://github.com/ruby/ruby.wasm/tree/main/packages/gems/js
|
55
|
+
post_install_message:
|
53
56
|
rdoc_options: []
|
54
57
|
require_paths:
|
55
58
|
- lib
|
@@ -64,7 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
67
|
- !ruby/object:Gem::Version
|
65
68
|
version: '0'
|
66
69
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.5.9
|
71
|
+
signing_key:
|
68
72
|
specification_version: 4
|
69
73
|
summary: JavaScript bindings for ruby.wasm
|
70
74
|
test_files: []
|