js 2.5.1 → 2.5.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.
data/js.gemspec CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  end
26
26
  end
27
27
  spec.require_paths = ["lib"]
28
- spec.extensions = ["ext/js/extconf.rb", "ext/witapi/extconf.rb"]
28
+ spec.extensions = ["ext/js/extconf.rb"]
29
29
  end
data/lib/js/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JS
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
@@ -0,0 +1,45 @@
1
+ package ruby:js;
2
+
3
+ interface js-runtime {
4
+
5
+ resource js-abi-value {}
6
+
7
+ variant js-abi-result {
8
+ success(js-abi-value),
9
+ failure(js-abi-value),
10
+ }
11
+
12
+ eval-js: func(code: string) -> js-abi-result;
13
+ is-js: func(value: borrow<js-abi-value>) -> bool;
14
+ instance-of: func(value: borrow<js-abi-value>, klass: borrow<js-abi-value>) -> bool;
15
+ global-this: func() -> js-abi-value;
16
+ int-to-js-number: func(value: s32) -> js-abi-value;
17
+ float-to-js-number: func(value: float64) -> js-abi-value;
18
+ string-to-js-string: func(value: string) -> js-abi-value;
19
+ bool-to-js-bool: func(value: bool) -> js-abi-value;
20
+ proc-to-js-function: func() -> js-abi-value;
21
+ rb-object-to-js-rb-value: func() -> js-abi-value;
22
+
23
+ js-value-to-string: func(value: borrow<js-abi-value>) -> string;
24
+
25
+ variant raw-integer {
26
+ as-float(float64),
27
+ bignum(string),
28
+ }
29
+
30
+ js-value-to-integer: func(value: borrow<js-abi-value>) -> raw-integer;
31
+
32
+ export-js-value-to-host: func(value: borrow<js-abi-value>);
33
+ import-js-value-from-host: func() -> js-abi-value;
34
+
35
+ js-value-typeof: func(value: borrow<js-abi-value>) -> string;
36
+
37
+ js-value-equal: func(lhs: borrow<js-abi-value>, rhs: borrow<js-abi-value>) -> bool;
38
+ js-value-strictly-equal: func(lhs: borrow<js-abi-value>, rhs: borrow<js-abi-value>) -> bool;
39
+
40
+ reflect-apply: func(target: borrow<js-abi-value>, this-argument: borrow<js-abi-value>, arguments: list<borrow<js-abi-value>>) -> js-abi-result;
41
+ reflect-get: func(target: borrow<js-abi-value>, property-key: string) -> js-abi-result;
42
+ reflect-set: func(target: borrow<js-abi-value>, property-key: string, value: borrow<js-abi-value>) -> js-abi-result;
43
+
44
+ throw-prohibit-rewind-exception: func(message: string);
45
+ }
@@ -0,0 +1,43 @@
1
+ package ruby:js;
2
+
3
+ interface ruby-runtime {
4
+ use js-runtime.{js-abi-value};
5
+
6
+ resource rb-iseq {}
7
+ resource rb-abi-value {}
8
+
9
+ type rb-errno = s32;
10
+ type rb-id = u32;
11
+
12
+ ruby-show-version: func();
13
+ ruby-init: func();
14
+ ruby-sysinit: func(args: list<string>);
15
+ ruby-options: func(args: list<string>) -> rb-iseq;
16
+ ruby-script: func(name: string);
17
+ ruby-init-loadpath: func();
18
+ rb-eval-string-protect: func(str: string) -> tuple<rb-abi-value, s32>;
19
+ rb-funcallv-protect: func(recv: borrow<rb-abi-value>, mid: rb-id, args: list<borrow<rb-abi-value>>) -> tuple<rb-abi-value, s32>;
20
+ rb-intern: func(name: string) -> rb-id;
21
+ rb-errinfo: func() -> rb-abi-value;
22
+ rb-clear-errinfo: func();
23
+
24
+ rstring-ptr: func(value: borrow<rb-abi-value>) -> string;
25
+
26
+ rb-vm-bugreport: func();
27
+
28
+ rb-gc-enable: func() -> bool;
29
+ rb-gc-disable: func() -> bool;
30
+
31
+ rb-set-should-prohibit-rewind: func(new-value: bool) -> bool;
32
+ // XXX: Do we really need them?
33
+ // wrap-js-value: func(value: js-abi-value) -> rb-abi-value;
34
+ // to-js-value: func(value: borrow<rb-abi-value>) -> js-abi-value;
35
+
36
+ // Transfer the value from Ruby to JS
37
+ //
38
+ // 1. Ruby side registers the value in the stage
39
+ // 2. Ruby side calls JS's `import-rb-value-from-rb()`
40
+ // 3. `import-rb-value-from-rb()` calls `export-rb-value-to-js()`
41
+ // 4. `export-rb-value-to-js()` returns the staged value
42
+ export-rb-value-to-js: func() -> rb-abi-value;
43
+ }
data/wit/world.wit ADDED
@@ -0,0 +1,6 @@
1
+ package ruby:js;
2
+
3
+ world ext {
4
+ import js-runtime;
5
+ export ruby-runtime;
6
+ }
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuta Saito
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-04-21 00:00:00.000000000 Z
10
+ date: 2024-05-04 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: JavaScript bindings for ruby.wasm. This gem provides a way to use JavaScript
14
13
  functionalities from Ruby through WebAssembly.
@@ -17,23 +16,23 @@ email:
17
16
  executables: []
18
17
  extensions:
19
18
  - ext/js/extconf.rb
20
- - ext/witapi/extconf.rb
21
19
  extra_rdoc_files: []
22
20
  files:
23
21
  - ext/js/bindgen/.clang-format
24
- - ext/js/bindgen/rb-js-abi-host.c
25
- - ext/js/bindgen/rb-js-abi-host.h
26
- - ext/js/bindgen/rb-js-abi-host.wit
22
+ - ext/js/bindgen/ext.c
23
+ - ext/js/bindgen/ext.h
24
+ - ext/js/bindgen/ext_component_type.o
25
+ - ext/js/bindgen/legacy/rb-abi-guest.c
26
+ - ext/js/bindgen/legacy/rb-abi-guest.h
27
+ - ext/js/bindgen/legacy/rb-abi-guest.wit
28
+ - ext/js/bindgen/legacy/rb-js-abi-host.c
29
+ - ext/js/bindgen/legacy/rb-js-abi-host.h
30
+ - ext/js/bindgen/legacy/rb-js-abi-host.wit
27
31
  - ext/js/depend
28
32
  - ext/js/extconf.rb
29
33
  - ext/js/js-core.c
30
- - ext/witapi/bindgen/.clang-format
31
- - ext/witapi/bindgen/rb-abi-guest.c
32
- - ext/witapi/bindgen/rb-abi-guest.h
33
- - ext/witapi/bindgen/rb-abi-guest.wit
34
- - ext/witapi/depend
35
- - ext/witapi/extconf.rb
36
- - ext/witapi/witapi-core.c
34
+ - ext/js/types.h
35
+ - ext/js/witapi-core.c
37
36
  - js.gemspec
38
37
  - lib/js.rb
39
38
  - lib/js/array.rb
@@ -43,12 +42,14 @@ files:
43
42
  - lib/js/require_remote/evaluator.rb
44
43
  - lib/js/require_remote/url_resolver.rb
45
44
  - lib/js/version.rb
45
+ - wit/js-runtime.wit
46
+ - wit/ruby-runtime.wit
47
+ - wit/world.wit
46
48
  homepage: https://github.com/ruby/ruby.wasm
47
49
  licenses:
48
50
  - MIT
49
51
  metadata:
50
52
  source_code_uri: https://github.com/ruby/ruby.wasm/tree/main/packages/gems/js
51
- post_install_message:
52
53
  rdoc_options: []
53
54
  require_paths:
54
55
  - lib
@@ -63,8 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
64
  - !ruby/object:Gem::Version
64
65
  version: '0'
65
66
  requirements: []
66
- rubygems_version: 3.4.19
67
- signing_key:
67
+ rubygems_version: 3.6.0.dev
68
68
  specification_version: 4
69
69
  summary: JavaScript bindings for ruby.wasm
70
70
  test_files: []
@@ -1,2 +0,0 @@
1
- DisableFormat: true
2
- SortIncludes: false
data/ext/witapi/depend DELETED
@@ -1,11 +0,0 @@
1
- link.filelist:
2
- echo $(foreach obj,$(OBJS),$(abspath $(obj))) > $@
3
- echo -mexec-model=reactor >> $@
4
-
5
- witapi.a: link.filelist
6
-
7
- witapi-core.o: $(srcdir)/bindgen/rb-abi-guest.h
8
-
9
- bindgen/%.o: $(srcdir)/bindgen/%.c
10
- @mkdir -p "$(@D)"
11
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< -I$(srcdir)/bindgen
@@ -1,3 +0,0 @@
1
- require "mkmf"
2
- $objs = %w[witapi-core.o bindgen/rb-abi-guest.o]
3
- create_makefile("witapi")