js 2.5.2 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- 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/depend +2 -1
- data/ext/js/extconf.rb +20 -1
- data/ext/js/witapi-core.c +5 -0
- data/lib/js/version.rb +1 -1
- data/lib/js.rb +5 -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: 2886bbeac0af159a2c25b2cceb53b967f4ef7928f2e8518648f0517f4b5a8a3b
|
4
|
+
data.tar.gz: 598e83d78b499fabeb223f98b980f5716650246d42a24cd0cb327fd27ac95e10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a2c02d0f6d42e27ff3d45385e1bcc1e7464d18ea0ed07e92cf08a8d7469cbb27cdc38f8ee69eb67ca3052455d1cd2a5a10016e338f03f3aa8bb3127a806ae0
|
7
|
+
data.tar.gz: cffe906a9cfa1710d75f9df827bdc9b406009ddc90291fef4b036aa7c6e70a495de130883114762f83456dd69243134683bb7c4bef038069229385c97b89cd5d
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# js
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/js.svg)](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/depend
CHANGED
data/ext/js/extconf.rb
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
require "mkmf"
|
2
|
+
|
3
|
+
MakeMakefile::RbConfig ||= RbConfig
|
4
|
+
unless MakeMakefile::RbConfig::CONFIG["platform"] =~ /wasm/
|
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 = []
|
8
|
+
create_makefile("js")
|
9
|
+
return
|
10
|
+
end
|
11
|
+
|
2
12
|
$objs = %w[js-core.o witapi-core.o]
|
3
13
|
|
4
14
|
use_component_model = enable_config("component-model", false)
|
@@ -11,7 +21,16 @@ else
|
|
11
21
|
$objs << "bindgen/legacy/rb-js-abi-host.o"
|
12
22
|
$objs << "bindgen/legacy/rb-abi-guest.o"
|
13
23
|
end
|
24
|
+
|
25
|
+
component_type_obj = "$(srcdir)/bindgen/ext_component_type.o"
|
26
|
+
|
27
|
+
unless $static
|
28
|
+
# When building shared library, we need to link the component type object
|
29
|
+
# to the shared library instead of the main ruby executable.
|
30
|
+
$libs << component_type_obj
|
31
|
+
end
|
32
|
+
|
14
33
|
create_makefile("js") do |mk|
|
15
|
-
mk << "EXTRA_OBJS =
|
34
|
+
mk << "EXTRA_OBJS = #{component_type_obj}\n" if use_component_model
|
16
35
|
mk
|
17
36
|
end
|
data/ext/js/witapi-core.c
CHANGED
@@ -363,10 +363,15 @@ static inline void __wasm_call_ctors_if_needed(void) {
|
|
363
363
|
__wasm_call_ctors_done = true;
|
364
364
|
__wasm_call_ctors();
|
365
365
|
|
366
|
+
// Initialize VFS runtime if it's used
|
367
|
+
// NOTE: We don't use wasi-vfs for PIC build. Instead, we use
|
368
|
+
// Component Model-native wasi-virt.
|
369
|
+
# ifndef __PIC__
|
366
370
|
__attribute__((weak)) extern void __wasi_vfs_rt_init(void);
|
367
371
|
if (__wasi_vfs_rt_init) {
|
368
372
|
__wasi_vfs_rt_init();
|
369
373
|
}
|
374
|
+
# endif
|
370
375
|
}
|
371
376
|
}
|
372
377
|
|
data/lib/js/version.rb
CHANGED
data/lib/js.rb
CHANGED
@@ -173,7 +173,11 @@ class JS::Object
|
|
173
173
|
if sym_str.end_with?("?")
|
174
174
|
# When a JS method is called with a ? suffix, it is treated as a predicate method,
|
175
175
|
# and the return value is converted to a Ruby boolean value automatically.
|
176
|
-
self.call(sym_str[0..-2].to_sym, *args, &block)
|
176
|
+
result = self.call(sym_str[0..-2].to_sym, *args, &block)
|
177
|
+
|
178
|
+
# Type coerce the result to boolean type
|
179
|
+
# to match the true/false determination in JavaScript's if statement.
|
180
|
+
JS.global.Boolean(result) == JS::True
|
177
181
|
elsif self[sym].typeof == "function"
|
178
182
|
self.call(sym, *args, &block)
|
179
183
|
else
|
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.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-22 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.3
|
71
|
+
signing_key:
|
68
72
|
specification_version: 4
|
69
73
|
summary: JavaScript bindings for ruby.wasm
|
70
74
|
test_files: []
|