quickjs 0.21.0 → 0.22.0.rc1
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 +237 -7
- data/ext/quickjsrb/quickjsrb.c +3113 -556
- data/ext/quickjsrb/quickjsrb.h +401 -6
- data/ext/quickjsrb/quickjsrb_crypto_subtle.c +584 -76
- data/ext/quickjsrb/quickjsrb_file.c +253 -48
- data/lib/quickjs/crypto_key.rb +13 -0
- data/lib/quickjs/importable.rb +80 -0
- data/lib/quickjs/modules.rb +98 -0
- data/lib/quickjs/polyfills.rb +15 -1
- data/lib/quickjs/variables.rb +890 -0
- data/lib/quickjs/version.rb +1 -1
- data/lib/quickjs.rb +3 -0
- data/polyfills/package-lock.json +2 -2
- data/polyfills/package.json +1 -1
- data/sig/quickjs.rbs +20 -3
- metadata +4 -2
- data/ext/quickjsrb/quickjs/repl.c +0 -2057
data/lib/quickjs/version.rb
CHANGED
data/lib/quickjs.rb
CHANGED
|
@@ -9,6 +9,9 @@ require_relative "quickjs/function"
|
|
|
9
9
|
require_relative "quickjs/quickjsrb"
|
|
10
10
|
require_relative "quickjs/runnable"
|
|
11
11
|
require_relative "quickjs/polyfills"
|
|
12
|
+
require_relative "quickjs/modules"
|
|
13
|
+
require_relative "quickjs/importable"
|
|
14
|
+
require_relative "quickjs/variables"
|
|
12
15
|
|
|
13
16
|
module Quickjs
|
|
14
17
|
class Blob
|
data/polyfills/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickjs-rb-polyfills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0.rc1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "quickjs-rb-polyfills",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.22.0.rc1",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"rolldown": "^1.0.0-rc.14"
|
|
12
12
|
}
|
data/polyfills/package.json
CHANGED
data/sig/quickjs.rbs
CHANGED
|
@@ -15,13 +15,21 @@ module Quickjs
|
|
|
15
15
|
|
|
16
16
|
def self.register_polyfill: (Symbol name, source: String | ^() -> String, ?init: String?) -> nil
|
|
17
17
|
|
|
18
|
+
def self.register_module: (String name, source: String | ^() -> String) -> nil
|
|
19
|
+
|
|
20
|
+
def self.compile_module: (String source, ?filename: String?, **untyped) -> Quickjs::Importable
|
|
21
|
+
|
|
22
|
+
class Importable
|
|
23
|
+
attr_reader canonical_name: String
|
|
24
|
+
end
|
|
25
|
+
|
|
18
26
|
class Value
|
|
19
27
|
UNDEFINED: Symbol
|
|
20
28
|
NAN: Symbol
|
|
21
29
|
end
|
|
22
30
|
|
|
23
31
|
class VM
|
|
24
|
-
def initialize: (?features: Array[Symbol], ?memory_limit: Integer, ?max_stack_size: Integer, ?timeout_msec: Integer) -> void
|
|
32
|
+
def initialize: (?features: Array[Symbol], ?preload_modules: Array[String], ?memory_limit: Integer, ?max_stack_size: Integer, ?timeout_msec: Integer, ?max_pending_rejections: Integer) -> void
|
|
25
33
|
|
|
26
34
|
def eval_code: (String code, ?async: bool, ?filename: String) -> untyped
|
|
27
35
|
|
|
@@ -32,7 +40,13 @@ module Quickjs
|
|
|
32
40
|
def define_function: (String | Symbol name, *Symbol flags) { (*untyped) -> untyped } -> Symbol
|
|
33
41
|
| (Array[String | Symbol] path, *Symbol flags) { (*untyped) -> untyped } -> Array[Symbol]
|
|
34
42
|
|
|
35
|
-
def
|
|
43
|
+
def define_const: (String | Symbol name, untyped value) -> Symbol
|
|
44
|
+
|
|
45
|
+
def define_let: (String | Symbol name, untyped value) -> Symbol
|
|
46
|
+
|
|
47
|
+
def define_var: (String | Symbol name, untyped value) -> Symbol
|
|
48
|
+
|
|
49
|
+
def import: (String | Array[String] | Hash[Symbol, String] imported, from: String | Quickjs::Importable, ?code_to_expose: String?) -> true
|
|
36
50
|
| (String | Array[String] | Hash[Symbol, String] imported, filename: String, ?code_to_expose: String?) -> true
|
|
37
51
|
|
|
38
52
|
type module_loader_return = String | Hash[Symbol, String] | nil
|
|
@@ -42,7 +56,9 @@ module Quickjs
|
|
|
42
56
|
|
|
43
57
|
def module_loader=: (module_loader_proc | nil) -> (module_loader_proc | nil)
|
|
44
58
|
|
|
45
|
-
|
|
59
|
+
# Normally a Quickjs::*Error built from the reason; a bridge raising while
|
|
60
|
+
# the reason is read is handed through as itself.
|
|
61
|
+
def on_unhandled_rejection: () { (Exception) -> void } -> nil
|
|
46
62
|
|
|
47
63
|
def on_log: () { (Log) -> void } -> nil
|
|
48
64
|
|
|
@@ -51,6 +67,7 @@ module Quickjs
|
|
|
51
67
|
def gc!: () -> nil
|
|
52
68
|
|
|
53
69
|
def memory_poisoned?: () -> bool
|
|
70
|
+
def poisoned?: () -> bool
|
|
54
71
|
|
|
55
72
|
def dispose!: () -> nil
|
|
56
73
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: quickjs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.22.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hmsk
|
|
@@ -72,7 +72,6 @@ files:
|
|
|
72
72
|
- ext/quickjsrb/quickjs/quickjs-opcode.h
|
|
73
73
|
- ext/quickjsrb/quickjs/quickjs.c
|
|
74
74
|
- ext/quickjsrb/quickjs/quickjs.h
|
|
75
|
-
- ext/quickjsrb/quickjs/repl.c
|
|
76
75
|
- ext/quickjsrb/quickjs/run-test262.c
|
|
77
76
|
- ext/quickjsrb/quickjs/unicode_gen.c
|
|
78
77
|
- ext/quickjsrb/quickjs/unicode_gen_def.h
|
|
@@ -90,9 +89,12 @@ files:
|
|
|
90
89
|
- lib/quickjs.rb
|
|
91
90
|
- lib/quickjs/crypto_key.rb
|
|
92
91
|
- lib/quickjs/function.rb
|
|
92
|
+
- lib/quickjs/importable.rb
|
|
93
|
+
- lib/quickjs/modules.rb
|
|
93
94
|
- lib/quickjs/polyfills.rb
|
|
94
95
|
- lib/quickjs/runnable.rb
|
|
95
96
|
- lib/quickjs/subtle_crypto.rb
|
|
97
|
+
- lib/quickjs/variables.rb
|
|
96
98
|
- lib/quickjs/version.rb
|
|
97
99
|
- polyfills/package-lock.json
|
|
98
100
|
- polyfills/package.json
|