quickjs 0.14.0 → 0.14.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69b86d7c5040dba161c1d6f67cb3eab3fd8a3dc51b30eb6d355c2580dbc29602
4
- data.tar.gz: 5e174baed18d79e0ac18a496f97cd580fd20830a98fb240351eeea46abe57683
3
+ metadata.gz: d0430b7f91db5ab0332aaa70759b574b286fcbaef0ae68c1345536256b98e9a8
4
+ data.tar.gz: '088306bccab3579af65b1ffade1780141527b1dd562b9400203707fba2464b84'
5
5
  SHA512:
6
- metadata.gz: 9f7abcc1733fcfe9c51aacf81c9e34b05e7e44142a9db79a8bd4525ba67570f897cd7c1fb200428507876dad35a67b9a3f383711a3b0cfc9ff1b46728cd1c125
7
- data.tar.gz: a15abae6b482f0df7efc89e9b0a3b9d3ca3bab8bb8d04ce7844f60b195a0314d8e12d2b3bbdf8cf01dae763e75945d4e84cf3c1efbe2a99d4cfa525e2279625e
6
+ metadata.gz: e876fa5eb3f2937006c1fe1ceea5445b12928f15df06ccfedf644cd5ef5e97774dba79e08210620fa3d8ae4802da2d3d87c8c34340b0125705f330611077a2ae
7
+ data.tar.gz: 8e0ab490bf17410f9a648ba98b9fcce7f510a67e1fbbd0d7c383b560ef11d6911f2bea906474671c4f1bb874fe312c0758df2d508366208720dc4c11aff519e7
@@ -178,17 +178,18 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
178
178
  return JS_ToBool(ctx, j_val) > 0 ? Qtrue : Qfalse;
179
179
  }
180
180
  case JS_TAG_STRING:
181
- {
182
- int couldntParse;
183
- VALUE r_result = rb_protect(r_try_json_parse, to_r_json(ctx, j_val), &couldntParse);
184
- if (couldntParse)
185
- {
181
+ case JS_TAG_STRING_ROPE:
182
+ {
183
+ // QuickJS keeps long `s += chunk` chains as a rope (JS_TAG_STRING_ROPE)
184
+ // until something materialises them. JS_ToCStringLen flattens ropes
185
+ // transparently, so both tags share the same conversion path.
186
+ size_t len;
187
+ const char *str = JS_ToCStringLen(ctx, &len, j_val);
188
+ if (str == NULL)
186
189
  return Qnil;
187
- }
188
- else
189
- {
190
- return r_result;
191
- }
190
+ VALUE r_str = rb_utf8_str_new(str, (long)len);
191
+ JS_FreeCString(ctx, str);
192
+ return r_str;
192
193
  }
193
194
  case JS_TAG_OBJECT:
194
195
  {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Quickjs
4
- VERSION = "0.14.0"
4
+ VERSION = "0.14.1"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickjs-rb-polyfills",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "build": "rolldown -c rolldown.config.mjs",
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.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hmsk