js 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/js/depend +2 -1
- data/ext/js/extconf.rb +18 -1
- data/ext/js/witapi-core.c +5 -0
- data/lib/js/version.rb +1 -1
- data/lib/js.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81f4c9b970a32b1074724040b7cf50b1eb5b92c997ecc85195f6d3cc294da8fb
|
4
|
+
data.tar.gz: 765a9b39f1a77485834a71f6f5cb420d01225a0a8057316a8ec6b622d58578b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73305608f6fcc88d01fa044ff2eda293165721e8317a93f811aca35bae0b755e2dd0db595487d5f297f4c58bdc9b7e8c61931a77e920323d585f2ee3446f21d6
|
7
|
+
data.tar.gz: bae658a9d87eb2bb1f233dd54c5351b93f2f937253d0c6476006ae184dc80ef6b91ff35488aec1c4e66d26f8fe81515b767b9520fcef316577e2e6a5d7ef24f2
|
data/ext/js/depend
CHANGED
data/ext/js/extconf.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
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
|
+
create_makefile("js")
|
7
|
+
return
|
8
|
+
end
|
9
|
+
|
2
10
|
$objs = %w[js-core.o witapi-core.o]
|
3
11
|
|
4
12
|
use_component_model = enable_config("component-model", false)
|
@@ -11,7 +19,16 @@ else
|
|
11
19
|
$objs << "bindgen/legacy/rb-js-abi-host.o"
|
12
20
|
$objs << "bindgen/legacy/rb-abi-guest.o"
|
13
21
|
end
|
22
|
+
|
23
|
+
component_type_obj = "$(srcdir)/bindgen/ext_component_type.o"
|
24
|
+
|
25
|
+
unless $static
|
26
|
+
# When building shared library, we need to link the component type object
|
27
|
+
# to the shared library instead of the main ruby executable.
|
28
|
+
$libs << component_type_obj
|
29
|
+
end
|
30
|
+
|
14
31
|
create_makefile("js") do |mk|
|
15
|
-
mk << "EXTRA_OBJS =
|
32
|
+
mk << "EXTRA_OBJS = #{component_type_obj}\n" if use_component_model
|
16
33
|
mk
|
17
34
|
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,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2024-05-
|
10
|
+
date: 2024-05-05 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: JavaScript bindings for ruby.wasm. This gem provides a way to use JavaScript
|
13
13
|
functionalities from Ruby through WebAssembly.
|