quickjs-emscripten-sync 1.1.0 → 1.4.0
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.
- package/LICENSE +2 -2
- package/README.md +59 -49
- package/dist/index.d.ts +121 -26
- package/dist/quickjs-emscripten-sync.es.js +962 -0
- package/dist/quickjs-emscripten-sync.umd.js +64 -0
- package/package.json +28 -40
- package/src/default.ts +2 -2
- package/src/index.test.ts +371 -69
- package/src/index.ts +135 -72
- package/src/marshal/function.test.ts +70 -61
- package/src/marshal/function.ts +10 -9
- package/src/marshal/index.test.ts +135 -62
- package/src/marshal/index.ts +33 -16
- package/src/marshal/json.test.ts +94 -0
- package/src/marshal/json.ts +16 -0
- package/src/marshal/object.test.ts +65 -58
- package/src/marshal/object.ts +6 -5
- package/src/marshal/primitive.test.ts +23 -17
- package/src/marshal/primitive.ts +10 -9
- package/src/marshal/promise.test.ts +86 -0
- package/src/marshal/promise.ts +26 -0
- package/src/marshal/properties.test.ts +23 -19
- package/src/marshal/properties.ts +11 -10
- package/src/marshal/symbol.test.ts +9 -7
- package/src/marshal/symbol.ts +5 -4
- package/src/unmarshal/function.test.ts +70 -61
- package/src/unmarshal/function.ts +39 -30
- package/src/unmarshal/index.test.ts +101 -100
- package/src/unmarshal/index.ts +13 -9
- package/src/unmarshal/object.test.ts +45 -41
- package/src/unmarshal/object.ts +14 -13
- package/src/unmarshal/primitive.test.ts +20 -15
- package/src/unmarshal/primitive.ts +10 -10
- package/src/unmarshal/promise.test.ts +44 -0
- package/src/unmarshal/promise.ts +38 -0
- package/src/unmarshal/properties.test.ts +10 -8
- package/src/unmarshal/properties.ts +47 -42
- package/src/unmarshal/symbol.test.ts +9 -7
- package/src/unmarshal/symbol.ts +4 -4
- package/src/util.test.ts +23 -5
- package/src/util.ts +15 -0
- package/src/vmmap.test.ts +88 -82
- package/src/vmmap.ts +21 -17
- package/src/vmutil.test.ts +159 -53
- package/src/vmutil.ts +91 -19
- package/src/wrapper.test.ts +151 -115
- package/src/wrapper.ts +69 -48
- package/dist/default.d.ts +0 -4
- package/dist/index.js +0 -8
- package/dist/marshal/function.d.ts +0 -2
- package/dist/marshal/index.d.ts +0 -11
- package/dist/marshal/object.d.ts +0 -2
- package/dist/marshal/primitive.d.ts +0 -2
- package/dist/marshal/properties.d.ts +0 -2
- package/dist/marshal/symbol.d.ts +0 -2
- package/dist/quickjs-emscripten-sync.cjs.development.js +0 -1289
- package/dist/quickjs-emscripten-sync.cjs.development.js.map +0 -1
- package/dist/quickjs-emscripten-sync.cjs.production.min.js +0 -2
- package/dist/quickjs-emscripten-sync.cjs.production.min.js.map +0 -1
- package/dist/quickjs-emscripten-sync.esm.js +0 -1272
- package/dist/quickjs-emscripten-sync.esm.js.map +0 -1
- package/dist/unmarshal/function.d.ts +0 -2
- package/dist/unmarshal/index.d.ts +0 -9
- package/dist/unmarshal/object.d.ts +0 -2
- package/dist/unmarshal/primitive.d.ts +0 -2
- package/dist/unmarshal/properties.d.ts +0 -2
- package/dist/unmarshal/symbol.d.ts +0 -2
- package/dist/util.d.ts +0 -7
- package/dist/vmmap.d.ts +0 -35
- package/dist/vmutil.d.ts +0 -7
- package/dist/wrapper.d.ts +0 -11
|
@@ -1,1272 +0,0 @@
|
|
|
1
|
-
function _defineProperties(target, props) {
|
|
2
|
-
for (var i = 0; i < props.length; i++) {
|
|
3
|
-
var descriptor = props[i];
|
|
4
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
5
|
-
descriptor.configurable = true;
|
|
6
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
7
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
12
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
13
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
14
|
-
return Constructor;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function _setPrototypeOf(o, p) {
|
|
18
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
19
|
-
o.__proto__ = p;
|
|
20
|
-
return o;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return _setPrototypeOf(o, p);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function _isNativeReflectConstruct() {
|
|
27
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
28
|
-
if (Reflect.construct.sham) return false;
|
|
29
|
-
if (typeof Proxy === "function") return true;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
33
|
-
return true;
|
|
34
|
-
} catch (e) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _construct(Parent, args, Class) {
|
|
40
|
-
if (_isNativeReflectConstruct()) {
|
|
41
|
-
_construct = Reflect.construct;
|
|
42
|
-
} else {
|
|
43
|
-
_construct = function _construct(Parent, args, Class) {
|
|
44
|
-
var a = [null];
|
|
45
|
-
a.push.apply(a, args);
|
|
46
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
47
|
-
var instance = new Constructor();
|
|
48
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
49
|
-
return instance;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return _construct.apply(null, arguments);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
57
|
-
if (!o) return;
|
|
58
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
59
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
60
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
61
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
62
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function _arrayLikeToArray(arr, len) {
|
|
66
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
67
|
-
|
|
68
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
69
|
-
|
|
70
|
-
return arr2;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
74
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
75
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
76
|
-
|
|
77
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
78
|
-
if (it) o = it;
|
|
79
|
-
var i = 0;
|
|
80
|
-
return function () {
|
|
81
|
-
if (i >= o.length) return {
|
|
82
|
-
done: true
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
done: false,
|
|
86
|
-
value: o[i++]
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var _Symbol$iterator;
|
|
95
|
-
|
|
96
|
-
_Symbol$iterator = Symbol.iterator;
|
|
97
|
-
|
|
98
|
-
var VMMap = /*#__PURE__*/function () {
|
|
99
|
-
function VMMap(vm) {
|
|
100
|
-
var _this = this;
|
|
101
|
-
|
|
102
|
-
this.vm = void 0;
|
|
103
|
-
this._map1 = new Map();
|
|
104
|
-
this._map2 = new Map();
|
|
105
|
-
this._map3 = new Map();
|
|
106
|
-
this._map4 = new Map();
|
|
107
|
-
this._counterMap = new Map();
|
|
108
|
-
this._disposables = new Set();
|
|
109
|
-
this._mapGet = void 0;
|
|
110
|
-
this._mapSet = void 0;
|
|
111
|
-
this._mapDelete = void 0;
|
|
112
|
-
this._mapClear = void 0;
|
|
113
|
-
this._counter = 0;
|
|
114
|
-
this.vm = vm;
|
|
115
|
-
var result = vm.unwrapResult(vm.evalCode("() => {\n const mapSym = new Map();\n let map = new WeakMap();\n let map2 = new WeakMap();\n const isObj = o => typeof o === \"object\" && o !== null || typeof o === \"function\";\n return {\n get: key => mapSym.get(key) ?? map.get(key) ?? map2.get(key) ?? -1,\n set: (key, value, key2) => {\n if (typeof key === \"symbol\") mapSym.set(key, value);\n if (isObj(key)) map.set(key, value);\n if (isObj(key2)) map2.set(key2, value);\n },\n delete: (key, key2) => {\n mapSym.delete(key);\n map.delete(key);\n map2.delete(key2);\n },\n clear: () => {\n mapSym.clear();\n map = new WeakMap();\n map2 = new WeakMap();\n }\n };\n }")).consume(function (fn) {
|
|
116
|
-
return _this._call(fn, undefined);
|
|
117
|
-
});
|
|
118
|
-
this._mapGet = vm.getProp(result, "get");
|
|
119
|
-
this._mapSet = vm.getProp(result, "set");
|
|
120
|
-
this._mapDelete = vm.getProp(result, "delete");
|
|
121
|
-
this._mapClear = vm.getProp(result, "clear");
|
|
122
|
-
result.dispose();
|
|
123
|
-
|
|
124
|
-
this._disposables.add(this._mapGet);
|
|
125
|
-
|
|
126
|
-
this._disposables.add(this._mapSet);
|
|
127
|
-
|
|
128
|
-
this._disposables.add(this._mapDelete);
|
|
129
|
-
|
|
130
|
-
this._disposables.add(this._mapClear);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
var _proto = VMMap.prototype;
|
|
134
|
-
|
|
135
|
-
_proto.set = function set(key, handle, key2, handle2) {
|
|
136
|
-
var _this$get,
|
|
137
|
-
_this2 = this;
|
|
138
|
-
|
|
139
|
-
if (!handle.alive || handle2 && !handle2.alive) return false;
|
|
140
|
-
var v = (_this$get = this.get(key)) != null ? _this$get : this.get(key2);
|
|
141
|
-
|
|
142
|
-
if (v) {
|
|
143
|
-
// handle and handle2 are unused so they should be disposed
|
|
144
|
-
return v === handle || v === handle2;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
var counter = this._counter++;
|
|
148
|
-
|
|
149
|
-
this._map1.set(key, counter);
|
|
150
|
-
|
|
151
|
-
this._map3.set(counter, handle);
|
|
152
|
-
|
|
153
|
-
this._counterMap.set(counter, key);
|
|
154
|
-
|
|
155
|
-
if (key2) {
|
|
156
|
-
this._map2.set(key2, counter);
|
|
157
|
-
|
|
158
|
-
if (handle2) {
|
|
159
|
-
this._map4.set(counter, handle2);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.vm.newNumber(counter).consume(function (c) {
|
|
164
|
-
_this2._call(_this2._mapSet, undefined, handle, c, handle2 != null ? handle2 : _this2.vm.undefined);
|
|
165
|
-
});
|
|
166
|
-
return true;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
_proto.merge = function merge(iteratable) {
|
|
170
|
-
if (!iteratable) return;
|
|
171
|
-
|
|
172
|
-
for (var _iterator = _createForOfIteratorHelperLoose(iteratable), _step; !(_step = _iterator()).done;) {
|
|
173
|
-
var iter = _step.value;
|
|
174
|
-
if (!iter) continue;
|
|
175
|
-
|
|
176
|
-
if (iter[1]) {
|
|
177
|
-
this.set(iter[0], iter[1], iter[2], iter[3]);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
_proto.get = function get(key) {
|
|
183
|
-
var _this$_map1$get;
|
|
184
|
-
|
|
185
|
-
var num = (_this$_map1$get = this._map1.get(key)) != null ? _this$_map1$get : this._map2.get(key);
|
|
186
|
-
var handle = typeof num === "number" ? this._map3.get(num) : undefined;
|
|
187
|
-
if (!handle) return;
|
|
188
|
-
|
|
189
|
-
if (!handle.alive) {
|
|
190
|
-
this["delete"](key);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return handle;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
_proto.getByHandle = function getByHandle(handle) {
|
|
198
|
-
if (!handle.alive) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return this._counterMap.get(this.vm.getNumber(this._call(this._mapGet, undefined, handle)));
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
_proto.has = function has(key) {
|
|
206
|
-
return !!this.get(key);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
_proto.hasHandle = function hasHandle(handle) {
|
|
210
|
-
return typeof this.getByHandle(handle) !== "undefined";
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
_proto["delete"] = function _delete(key, dispose) {
|
|
214
|
-
var _this$_map1$get2;
|
|
215
|
-
|
|
216
|
-
var num = (_this$_map1$get2 = this._map1.get(key)) != null ? _this$_map1$get2 : this._map2.get(key);
|
|
217
|
-
if (typeof num === "undefined") return;
|
|
218
|
-
|
|
219
|
-
var handle = this._map3.get(num);
|
|
220
|
-
|
|
221
|
-
var handle2 = this._map4.get(num);
|
|
222
|
-
|
|
223
|
-
this._call.apply(this, [this._mapDelete, undefined].concat([handle, handle2].filter(function (h) {
|
|
224
|
-
return !!(h != null && h.alive);
|
|
225
|
-
})));
|
|
226
|
-
|
|
227
|
-
this._map1["delete"](key);
|
|
228
|
-
|
|
229
|
-
this._map2["delete"](key);
|
|
230
|
-
|
|
231
|
-
this._map3["delete"](num);
|
|
232
|
-
|
|
233
|
-
this._map4["delete"](num);
|
|
234
|
-
|
|
235
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(this._map1), _step2; !(_step2 = _iterator2()).done;) {
|
|
236
|
-
var _step2$value = _step2.value,
|
|
237
|
-
k = _step2$value[0],
|
|
238
|
-
v = _step2$value[1];
|
|
239
|
-
|
|
240
|
-
if (v === num) {
|
|
241
|
-
this._map1["delete"](k);
|
|
242
|
-
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
for (var _iterator3 = _createForOfIteratorHelperLoose(this._map2), _step3; !(_step3 = _iterator3()).done;) {
|
|
248
|
-
var _step3$value = _step3.value,
|
|
249
|
-
_k = _step3$value[0],
|
|
250
|
-
_v = _step3$value[1];
|
|
251
|
-
|
|
252
|
-
if (_v === num) {
|
|
253
|
-
this._map2["delete"](_k);
|
|
254
|
-
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
for (var _iterator4 = _createForOfIteratorHelperLoose(this._counterMap), _step4; !(_step4 = _iterator4()).done;) {
|
|
260
|
-
var _step4$value = _step4.value,
|
|
261
|
-
_k2 = _step4$value[0],
|
|
262
|
-
_v2 = _step4$value[1];
|
|
263
|
-
|
|
264
|
-
if (_v2 === key) {
|
|
265
|
-
this._counterMap["delete"](_k2);
|
|
266
|
-
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (dispose) {
|
|
272
|
-
if (handle != null && handle.alive) handle.dispose();
|
|
273
|
-
if (handle2 != null && handle2.alive) handle2.dispose();
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
_proto.deleteByHandle = function deleteByHandle(handle, dispose) {
|
|
278
|
-
var key = this.getByHandle(handle);
|
|
279
|
-
|
|
280
|
-
if (typeof key !== "undefined") {
|
|
281
|
-
this["delete"](key, dispose);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
_proto.clear = function clear() {
|
|
286
|
-
this._counter = 0;
|
|
287
|
-
|
|
288
|
-
this._map1.clear();
|
|
289
|
-
|
|
290
|
-
this._map2.clear();
|
|
291
|
-
|
|
292
|
-
this._map3.clear();
|
|
293
|
-
|
|
294
|
-
this._map4.clear();
|
|
295
|
-
|
|
296
|
-
this._counterMap.clear();
|
|
297
|
-
|
|
298
|
-
if (this._mapClear.alive) {
|
|
299
|
-
this._call(this._mapClear, undefined);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
_proto.dispose = function dispose() {
|
|
304
|
-
for (var _iterator5 = _createForOfIteratorHelperLoose(this._disposables.values()), _step5; !(_step5 = _iterator5()).done;) {
|
|
305
|
-
var v = _step5.value;
|
|
306
|
-
|
|
307
|
-
if (v.alive) {
|
|
308
|
-
v.dispose();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
for (var _iterator6 = _createForOfIteratorHelperLoose(this._map3.values()), _step6; !(_step6 = _iterator6()).done;) {
|
|
313
|
-
var _v3 = _step6.value;
|
|
314
|
-
|
|
315
|
-
if (_v3.alive) {
|
|
316
|
-
_v3.dispose();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
for (var _iterator7 = _createForOfIteratorHelperLoose(this._map4.values()), _step7; !(_step7 = _iterator7()).done;) {
|
|
321
|
-
var _v4 = _step7.value;
|
|
322
|
-
|
|
323
|
-
if (_v4.alive) {
|
|
324
|
-
_v4.dispose();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
this._disposables.clear();
|
|
329
|
-
|
|
330
|
-
this.clear();
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
_proto[_Symbol$iterator] = function () {
|
|
334
|
-
var _this3 = this;
|
|
335
|
-
|
|
336
|
-
var keys = this._map1.keys();
|
|
337
|
-
|
|
338
|
-
return {
|
|
339
|
-
next: function next() {
|
|
340
|
-
while (true) {
|
|
341
|
-
var k1 = keys.next();
|
|
342
|
-
if (k1.done) return {
|
|
343
|
-
value: undefined,
|
|
344
|
-
done: true
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
var n = _this3._map1.get(k1.value);
|
|
348
|
-
|
|
349
|
-
if (typeof n === "undefined") continue;
|
|
350
|
-
|
|
351
|
-
var v1 = _this3._map3.get(n);
|
|
352
|
-
|
|
353
|
-
var v2 = _this3._map4.get(n);
|
|
354
|
-
|
|
355
|
-
if (!v1) continue;
|
|
356
|
-
|
|
357
|
-
var k2 = _this3._get2(n);
|
|
358
|
-
|
|
359
|
-
return {
|
|
360
|
-
value: [k1.value, v1, k2, v2],
|
|
361
|
-
done: false
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
_proto._get2 = function _get2(num) {
|
|
369
|
-
for (var _iterator8 = _createForOfIteratorHelperLoose(this._map2), _step8; !(_step8 = _iterator8()).done;) {
|
|
370
|
-
var _step8$value = _step8.value,
|
|
371
|
-
k = _step8$value[0],
|
|
372
|
-
v = _step8$value[1];
|
|
373
|
-
if (v === num) return k;
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
_proto._call = function _call(fn, thisArg) {
|
|
378
|
-
var _this$vm;
|
|
379
|
-
|
|
380
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
381
|
-
args[_key - 2] = arguments[_key];
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return this.vm.unwrapResult((_this$vm = this.vm).callFunction.apply(_this$vm, [fn, typeof thisArg === "undefined" ? this.vm.undefined : thisArg].concat(args)));
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
_createClass(VMMap, [{
|
|
388
|
-
key: "size",
|
|
389
|
-
get: function get() {
|
|
390
|
-
return this._map1.size;
|
|
391
|
-
}
|
|
392
|
-
}]);
|
|
393
|
-
|
|
394
|
-
return VMMap;
|
|
395
|
-
}();
|
|
396
|
-
|
|
397
|
-
function isES2015Class(cls) {
|
|
398
|
-
return typeof cls === "function" && /^class\s/.test(Function.prototype.toString.call(cls));
|
|
399
|
-
}
|
|
400
|
-
function isObject(value) {
|
|
401
|
-
return typeof value === "function" || typeof value === "object" && value !== null;
|
|
402
|
-
}
|
|
403
|
-
function walkObject(value, callback) {
|
|
404
|
-
var set = new Set();
|
|
405
|
-
|
|
406
|
-
var walk = function walk(v) {
|
|
407
|
-
if (!isObject(v) || set.has(v) || (callback == null ? void 0 : callback(v, set)) === false) return;
|
|
408
|
-
set.add(v);
|
|
409
|
-
|
|
410
|
-
if (Array.isArray(v)) {
|
|
411
|
-
for (var _iterator = _createForOfIteratorHelperLoose(v), _step; !(_step = _iterator()).done;) {
|
|
412
|
-
var e = _step.value;
|
|
413
|
-
walk(e);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (typeof v === "object") {
|
|
420
|
-
var proto = Object.getPrototypeOf(v);
|
|
421
|
-
|
|
422
|
-
if (proto && proto !== Object.prototype) {
|
|
423
|
-
walk(proto);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
for (var _i = 0, _Object$values = Object.values(Object.getOwnPropertyDescriptors(v)); _i < _Object$values.length; _i++) {
|
|
428
|
-
var d = _Object$values[_i];
|
|
429
|
-
if ("value" in d) walk(d.value);
|
|
430
|
-
if ("get" in d) walk(d.get);
|
|
431
|
-
if ("set" in d) walk(d.set);
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
walk(value);
|
|
436
|
-
return set;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Measure the complexity of an object as you traverse the field and prototype chain. If max is specified, when the complexity reaches max, the traversal is terminated and it returns the max. In this function, one object and function are counted as a complexity of 1, and primitives are not counted as a complexity.
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
function complexity(value, max) {
|
|
443
|
-
return walkObject(value, max ? function (_, set) {
|
|
444
|
-
return set.size < max;
|
|
445
|
-
} : undefined).size;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function call(vm, code, thisArg) {
|
|
449
|
-
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
450
|
-
args[_key - 3] = arguments[_key];
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return vm.unwrapResult(vm.evalCode(code)).consume(function (f) {
|
|
454
|
-
if (typeof thisArg === "undefined" && args.length === 0) return f;
|
|
455
|
-
return vm.unwrapResult(vm.callFunction.apply(vm, [f, thisArg != null ? thisArg : vm.undefined].concat(args)));
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
function eq(vm, a, b) {
|
|
459
|
-
return vm.dump(call(vm, "Object.is", undefined, a, b));
|
|
460
|
-
}
|
|
461
|
-
function isHandleObject(vm, a) {
|
|
462
|
-
return vm.dump(call(vm, "a => typeof a === \"object\" && a !== null || typeof a === \"function\"", undefined, a));
|
|
463
|
-
}
|
|
464
|
-
function send(vm, target) {
|
|
465
|
-
var json = JSON.stringify(target);
|
|
466
|
-
if (!json) return vm.undefined;
|
|
467
|
-
return call(vm, "JSON.parse", undefined, vm.newString(json));
|
|
468
|
-
}
|
|
469
|
-
function consumeAll(handles, cb) {
|
|
470
|
-
try {
|
|
471
|
-
return cb(handles);
|
|
472
|
-
} finally {
|
|
473
|
-
for (var _iterator = _createForOfIteratorHelperLoose(handles), _step; !(_step = _iterator()).done;) {
|
|
474
|
-
var h = _step.value;
|
|
475
|
-
if (h.alive) h.dispose();
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function marshalProperties(vm, target, handle, marshal) {
|
|
481
|
-
var descs = vm.newObject();
|
|
482
|
-
|
|
483
|
-
var cb = function cb(key, desc) {
|
|
484
|
-
var keyHandle = marshal(key);
|
|
485
|
-
var valueHandle = typeof desc.value === "undefined" ? undefined : marshal(desc.value);
|
|
486
|
-
var getHandle = typeof desc.get === "undefined" ? undefined : marshal(desc.get);
|
|
487
|
-
var setHandle = typeof desc.set === "undefined" ? undefined : marshal(desc.set);
|
|
488
|
-
vm.newObject().consume(function (descObj) {
|
|
489
|
-
Object.entries(desc).forEach(function (_ref) {
|
|
490
|
-
var k = _ref[0],
|
|
491
|
-
v = _ref[1];
|
|
492
|
-
var v2 = k === "value" ? valueHandle : k === "get" ? getHandle : k === "set" ? setHandle : v ? vm["true"] : vm["false"];
|
|
493
|
-
|
|
494
|
-
if (v2) {
|
|
495
|
-
vm.setProp(descObj, k, v2);
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
vm.setProp(descs, keyHandle, descObj);
|
|
499
|
-
});
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
var desc = Object.getOwnPropertyDescriptors(target);
|
|
503
|
-
Object.entries(desc).forEach(function (_ref2) {
|
|
504
|
-
var k = _ref2[0],
|
|
505
|
-
v = _ref2[1];
|
|
506
|
-
return cb(k, v);
|
|
507
|
-
});
|
|
508
|
-
Object.getOwnPropertySymbols(desc).forEach(function (k) {
|
|
509
|
-
return cb(k, desc[k]);
|
|
510
|
-
});
|
|
511
|
-
call(vm, "Object.defineProperties", undefined, handle, descs).dispose();
|
|
512
|
-
descs.dispose();
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function marshalFunction(vm, target, marshal, unmarshal, preMarshal, preApply) {
|
|
516
|
-
var _preMarshal;
|
|
517
|
-
|
|
518
|
-
if (typeof target !== "function") return;
|
|
519
|
-
var raw = vm.newFunction(target.name, function () {
|
|
520
|
-
var _this = this;
|
|
521
|
-
|
|
522
|
-
var that = unmarshal(this);
|
|
523
|
-
|
|
524
|
-
for (var _len = arguments.length, argHandles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
525
|
-
argHandles[_key] = arguments[_key];
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
var args = argHandles.map(function (a) {
|
|
529
|
-
return unmarshal(a);
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
if (isES2015Class(target) && isObject(that)) {
|
|
533
|
-
// Class constructors cannot be invoked without new expression, and new.target is not changed
|
|
534
|
-
var result = _construct(target, args);
|
|
535
|
-
|
|
536
|
-
Object.entries(result).forEach(function (_ref) {
|
|
537
|
-
var key = _ref[0],
|
|
538
|
-
value = _ref[1];
|
|
539
|
-
vm.setProp(_this, key, marshal(value));
|
|
540
|
-
});
|
|
541
|
-
return this;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
return marshal(preApply ? preApply(target, that, args) : target.apply(that, args));
|
|
545
|
-
}).consume(function (handle2) {
|
|
546
|
-
return (// fucntions created by vm.newFunction are not callable as a class constrcutor
|
|
547
|
-
call(vm, "Cls => {\n const fn = function(...args) { return Cls.apply(this, args); };\n fn.name = Cls.name;\n fn.length = Cls.length;\n return fn;\n }", undefined, handle2)
|
|
548
|
-
);
|
|
549
|
-
});
|
|
550
|
-
var handle = (_preMarshal = preMarshal(target, raw)) != null ? _preMarshal : raw;
|
|
551
|
-
marshalProperties(vm, target, raw, marshal);
|
|
552
|
-
return handle;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
function marshalObject(vm, target, marshal, preMarshal) {
|
|
556
|
-
var _preMarshal;
|
|
557
|
-
|
|
558
|
-
if (typeof target !== "object" || target === null) return;
|
|
559
|
-
var raw = Array.isArray(target) ? vm.newArray() : vm.newObject();
|
|
560
|
-
var handle = (_preMarshal = preMarshal(target, raw)) != null ? _preMarshal : raw; // prototype
|
|
561
|
-
|
|
562
|
-
var prototype = Object.getPrototypeOf(target);
|
|
563
|
-
var prototypeHandle = prototype && prototype !== Object.prototype && prototype !== Array.prototype ? marshal(prototype) : undefined;
|
|
564
|
-
|
|
565
|
-
if (prototypeHandle) {
|
|
566
|
-
call(vm, "Object.setPrototypeOf", undefined, handle, prototypeHandle).dispose();
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
marshalProperties(vm, target, raw, marshal);
|
|
570
|
-
return handle;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// import { call } from "../vmutil";
|
|
574
|
-
function marshalPrimitive(vm, target) {
|
|
575
|
-
switch (typeof target) {
|
|
576
|
-
case "undefined":
|
|
577
|
-
return vm.undefined;
|
|
578
|
-
|
|
579
|
-
case "number":
|
|
580
|
-
return vm.newNumber(target);
|
|
581
|
-
|
|
582
|
-
case "string":
|
|
583
|
-
return vm.newString(target);
|
|
584
|
-
|
|
585
|
-
case "boolean":
|
|
586
|
-
return target ? vm["true"] : vm["false"];
|
|
587
|
-
|
|
588
|
-
case "object":
|
|
589
|
-
return target === null ? vm["null"] : undefined;
|
|
590
|
-
// BigInt is not supported by quickjs-emscripten
|
|
591
|
-
// case "bigint":
|
|
592
|
-
// return call(
|
|
593
|
-
// vm,
|
|
594
|
-
// `s => BigInt(s)`,
|
|
595
|
-
// undefined,
|
|
596
|
-
// vm.newString(target.toString())
|
|
597
|
-
// );
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
return undefined;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
function marshalSymbol(vm, target, preMarshal) {
|
|
604
|
-
var _preMarshal;
|
|
605
|
-
|
|
606
|
-
if (typeof target !== "symbol") return;
|
|
607
|
-
var handle = call(vm, "d => Symbol(d)", undefined, target.description ? vm.newString(target.description) : vm.undefined);
|
|
608
|
-
return (_preMarshal = preMarshal(target, handle)) != null ? _preMarshal : handle;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
function marshal(target, options) {
|
|
612
|
-
var _ref, _ref2, _marshalSymbol;
|
|
613
|
-
|
|
614
|
-
var vm = options.vm,
|
|
615
|
-
unmarshal = options.unmarshal,
|
|
616
|
-
isMarshalable = options.isMarshalable,
|
|
617
|
-
find = options.find,
|
|
618
|
-
pre = options.pre;
|
|
619
|
-
{
|
|
620
|
-
var primitive = marshalPrimitive(vm, target);
|
|
621
|
-
|
|
622
|
-
if (primitive) {
|
|
623
|
-
return primitive;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
{
|
|
627
|
-
var handle = find(target);
|
|
628
|
-
if (handle) return handle;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
if ((isMarshalable == null ? void 0 : isMarshalable(target)) === false) {
|
|
632
|
-
return vm.undefined;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
var marshal2 = function marshal2(t) {
|
|
636
|
-
return marshal(t, options);
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
var result = (_ref = (_ref2 = (_marshalSymbol = marshalSymbol(vm, target, pre)) != null ? _marshalSymbol : marshalFunction(vm, target, marshal2, unmarshal, pre, options.preApply)) != null ? _ref2 : marshalObject(vm, target, marshal2, pre)) != null ? _ref : vm.undefined;
|
|
640
|
-
return result;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
function unmarshalProperties(vm, handle, target, unmarshal) {
|
|
644
|
-
vm.newFunction("", function (key, value) {
|
|
645
|
-
var _unmarshal = unmarshal(key),
|
|
646
|
-
keyName = _unmarshal[0];
|
|
647
|
-
|
|
648
|
-
if (typeof keyName !== "string" && typeof keyName !== "number" && typeof keyName !== "symbol") return;
|
|
649
|
-
var desc = [["value", true], ["get", true], ["set", true], ["configurable", false], ["enumerable", false], ["writable", false]].reduce(function (desc, _ref) {
|
|
650
|
-
var key = _ref[0],
|
|
651
|
-
unmarshable = _ref[1];
|
|
652
|
-
var h = vm.getProp(value, key);
|
|
653
|
-
var ty = vm["typeof"](h);
|
|
654
|
-
if (ty === "undefined") return desc;
|
|
655
|
-
|
|
656
|
-
if (!unmarshable && ty === "boolean") {
|
|
657
|
-
desc[key] = vm.dump(vm.getProp(value, key));
|
|
658
|
-
return desc;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
var _unmarshal2 = unmarshal(h),
|
|
662
|
-
v = _unmarshal2[0],
|
|
663
|
-
alreadyExists = _unmarshal2[1];
|
|
664
|
-
|
|
665
|
-
if (alreadyExists) {
|
|
666
|
-
h.dispose();
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
desc[key] = v;
|
|
670
|
-
return desc;
|
|
671
|
-
}, {});
|
|
672
|
-
Object.defineProperty(target, keyName, desc);
|
|
673
|
-
}).consume(function (fn) {
|
|
674
|
-
call(vm, "(o, fn) => {\n const descs = Object.getOwnPropertyDescriptors(o);\n Object.entries(descs).forEach(([k, v]) => fn(k, v));\n Object.getOwnPropertySymbols(descs).forEach(k => fn(k, descs[k]));\n }", undefined, handle, fn).dispose();
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
function unmarshalFunction(vm, handle, marshal, unmarshal, preUnmarshal) {
|
|
679
|
-
var _preUnmarshal;
|
|
680
|
-
|
|
681
|
-
if (vm["typeof"](handle) !== "function") return;
|
|
682
|
-
|
|
683
|
-
var raw = function _target() {
|
|
684
|
-
var thisHandle = marshal(this);
|
|
685
|
-
|
|
686
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
687
|
-
args[_key] = arguments[_key];
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
var argHandles = args.map(function (a) {
|
|
691
|
-
return marshal(a);
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
if (this instanceof _target ? this.constructor : void 0) {
|
|
695
|
-
var _unmarshal = unmarshal(call.apply(void 0, [vm, "(Cls, ...args) => new Cls(...args)", thisHandle, handle].concat(argHandles))),
|
|
696
|
-
instance = _unmarshal[0];
|
|
697
|
-
|
|
698
|
-
Object.defineProperties(this, Object.getOwnPropertyDescriptors(instance));
|
|
699
|
-
return this;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
var resultHandle = vm.unwrapResult(vm.callFunction.apply(vm, [handle, thisHandle].concat(argHandles)));
|
|
703
|
-
|
|
704
|
-
var _unmarshal2 = unmarshal(resultHandle),
|
|
705
|
-
result = _unmarshal2[0],
|
|
706
|
-
alreadyExists = _unmarshal2[1];
|
|
707
|
-
|
|
708
|
-
if (alreadyExists) resultHandle.dispose();
|
|
709
|
-
return result;
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
var func = (_preUnmarshal = preUnmarshal(raw, handle)) != null ? _preUnmarshal : raw;
|
|
713
|
-
unmarshalProperties(vm, handle, raw, unmarshal);
|
|
714
|
-
return func;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
function unmarshalObject(vm, handle, unmarshal, preUnmarshal) {
|
|
718
|
-
var _preUnmarshal;
|
|
719
|
-
|
|
720
|
-
if (vm["typeof"](handle) !== "object" || // null check
|
|
721
|
-
vm.unwrapResult(vm.evalCode("o => o === null")).consume(function (n) {
|
|
722
|
-
return vm.dump(vm.unwrapResult(vm.callFunction(n, vm.undefined, handle)));
|
|
723
|
-
})) return;
|
|
724
|
-
var raw = call(vm, "Array.isArray", undefined, handle).consume(function (r) {
|
|
725
|
-
return vm.dump(r);
|
|
726
|
-
}) ? [] : {};
|
|
727
|
-
var obj = (_preUnmarshal = preUnmarshal(raw, handle)) != null ? _preUnmarshal : raw;
|
|
728
|
-
var prototype = call(vm, "o => {\n const p = Object.getPrototypeOf(o);\n return !p || p === Object.prototype || p === Array.prototype ? undefined : p;\n }", undefined, handle).consume(function (prototype) {
|
|
729
|
-
if (vm["typeof"](prototype) === "undefined") return;
|
|
730
|
-
|
|
731
|
-
var _unmarshal = unmarshal(prototype),
|
|
732
|
-
proto = _unmarshal[0];
|
|
733
|
-
|
|
734
|
-
return proto;
|
|
735
|
-
});
|
|
736
|
-
|
|
737
|
-
if (typeof prototype === "object") {
|
|
738
|
-
Object.setPrototypeOf(obj, prototype);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
unmarshalProperties(vm, handle, raw, unmarshal);
|
|
742
|
-
return obj;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
function unmarshalPrimitive(vm, handle) {
|
|
746
|
-
var ty = vm["typeof"](handle);
|
|
747
|
-
|
|
748
|
-
if (ty === "undefined" || ty === "number" || ty === "string" || ty === "boolean") {
|
|
749
|
-
return [vm.dump(handle), true];
|
|
750
|
-
} else if (ty === "object") {
|
|
751
|
-
var isNull = vm.unwrapResult(vm.evalCode("a => a === null")).consume(function (n) {
|
|
752
|
-
return vm.dump(vm.unwrapResult(vm.callFunction(n, vm.undefined, handle)));
|
|
753
|
-
});
|
|
754
|
-
|
|
755
|
-
if (isNull) {
|
|
756
|
-
return [null, true];
|
|
757
|
-
}
|
|
758
|
-
} // BigInt is not supported by quickjs-emscripten
|
|
759
|
-
// if (ty === "bigint") {
|
|
760
|
-
// const str = vm
|
|
761
|
-
// .getProp(handle, "toString")
|
|
762
|
-
// .consume(toString => vm.unwrapResult(vm.callFunction(toString, handle)))
|
|
763
|
-
// .consume(str => vm.getString(str));
|
|
764
|
-
// const bi = BigInt(str);
|
|
765
|
-
// return [bi, true];
|
|
766
|
-
// }
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return [undefined, false];
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
function unmarshalSymbol(vm, handle, preUnmarshal) {
|
|
773
|
-
var _preUnmarshal;
|
|
774
|
-
|
|
775
|
-
if (vm["typeof"](handle) !== "symbol") return;
|
|
776
|
-
var desc = vm.getString(vm.getProp(handle, "description"));
|
|
777
|
-
var sym = Symbol(desc);
|
|
778
|
-
return (_preUnmarshal = preUnmarshal(sym, handle)) != null ? _preUnmarshal : sym;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function unmarshal(handle, options) {
|
|
782
|
-
var _unmarshalInner = unmarshalInner(handle, options),
|
|
783
|
-
result = _unmarshalInner[0];
|
|
784
|
-
|
|
785
|
-
return result;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
function unmarshalInner(handle, options) {
|
|
789
|
-
var _ref, _unmarshalSymbol;
|
|
790
|
-
|
|
791
|
-
var vm = options.vm,
|
|
792
|
-
marshal = options.marshal,
|
|
793
|
-
find = options.find,
|
|
794
|
-
pre = options.pre;
|
|
795
|
-
{
|
|
796
|
-
var _unmarshalPrimitive = unmarshalPrimitive(vm, handle),
|
|
797
|
-
target = _unmarshalPrimitive[0],
|
|
798
|
-
ok = _unmarshalPrimitive[1];
|
|
799
|
-
|
|
800
|
-
if (ok) return [target, false];
|
|
801
|
-
}
|
|
802
|
-
{
|
|
803
|
-
var _target = find(handle);
|
|
804
|
-
|
|
805
|
-
if (_target) {
|
|
806
|
-
return [_target, true];
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
var unmarshal2 = function unmarshal2(h) {
|
|
811
|
-
return unmarshalInner(h, options);
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
var result = (_ref = (_unmarshalSymbol = unmarshalSymbol(vm, handle, pre)) != null ? _unmarshalSymbol : unmarshalFunction(vm, handle, marshal, unmarshal2, pre)) != null ? _ref : unmarshalObject(vm, handle, unmarshal2, pre);
|
|
815
|
-
return [result, false];
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
function wrap(vm, target, proxyKeySymbol, proxyKeySymbolHandle, marshal, syncMode) {
|
|
819
|
-
if (!isObject(target)) return undefined;
|
|
820
|
-
if (isWrapped(target, proxyKeySymbol)) return target;
|
|
821
|
-
var rec = new Proxy(target, {
|
|
822
|
-
get: function get(obj, key) {
|
|
823
|
-
return key === proxyKeySymbol ? obj : Reflect.get(obj, key);
|
|
824
|
-
},
|
|
825
|
-
set: function set(obj, key, value, receiver) {
|
|
826
|
-
var _syncMode;
|
|
827
|
-
|
|
828
|
-
var v = unwrap(value, proxyKeySymbol);
|
|
829
|
-
var sync = (_syncMode = syncMode == null ? void 0 : syncMode(receiver)) != null ? _syncMode : "host";
|
|
830
|
-
|
|
831
|
-
if (sync === "vm" || Reflect.set(obj, key, v, receiver)) {
|
|
832
|
-
if (sync === "host") return true;
|
|
833
|
-
|
|
834
|
-
var _unwrapHandle = unwrapHandle(vm, marshal(receiver), proxyKeySymbolHandle),
|
|
835
|
-
handle2 = _unwrapHandle[0],
|
|
836
|
-
unwrapped = _unwrapHandle[1];
|
|
837
|
-
|
|
838
|
-
if (unwrapped) {
|
|
839
|
-
handle2.consume(function (h) {
|
|
840
|
-
return vm.setProp(h, marshal(key), marshal(v));
|
|
841
|
-
});
|
|
842
|
-
} else {
|
|
843
|
-
vm.setProp(handle2, marshal(key), marshal(v));
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
return true;
|
|
848
|
-
},
|
|
849
|
-
deleteProperty: function deleteProperty(obj, key) {
|
|
850
|
-
var _syncMode2;
|
|
851
|
-
|
|
852
|
-
var sync = (_syncMode2 = syncMode == null ? void 0 : syncMode(rec)) != null ? _syncMode2 : "host";
|
|
853
|
-
|
|
854
|
-
var _unwrapHandle2 = unwrapHandle(vm, marshal(rec), proxyKeySymbolHandle),
|
|
855
|
-
handle2 = _unwrapHandle2[0],
|
|
856
|
-
unwrapped = _unwrapHandle2[1];
|
|
857
|
-
|
|
858
|
-
if (sync === "vm" || Reflect.deleteProperty(obj, key)) {
|
|
859
|
-
if (sync === "host") return true;
|
|
860
|
-
|
|
861
|
-
if (unwrapped) {
|
|
862
|
-
handle2.consume(function (h) {
|
|
863
|
-
return call(vm, "(a, b) => delete a[b]", undefined, h, marshal(key));
|
|
864
|
-
});
|
|
865
|
-
} else {
|
|
866
|
-
call(vm, "(a, b) => delete a[b]", undefined, handle2, marshal(key));
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
return true;
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
return rec;
|
|
874
|
-
}
|
|
875
|
-
function wrapHandle(vm, handle, proxyKeySymbol, proxyKeySymbolHandle, unmarshal, syncMode) {
|
|
876
|
-
if (!isHandleObject(vm, handle)) return [undefined, false];
|
|
877
|
-
if (isHandleWrapped(vm, handle, proxyKeySymbolHandle)) return [handle, false];
|
|
878
|
-
return consumeAll([vm.newFunction("getSyncMode", function (h) {
|
|
879
|
-
var res = syncMode == null ? void 0 : syncMode(unmarshal(h));
|
|
880
|
-
if (typeof res === "string") return vm.newString(res);
|
|
881
|
-
return vm.undefined;
|
|
882
|
-
}), vm.newFunction("setter", function (h, keyHandle, valueHandle) {
|
|
883
|
-
var target = unmarshal(h);
|
|
884
|
-
if (!target) return;
|
|
885
|
-
var key = unmarshal(keyHandle);
|
|
886
|
-
if (key === "__proto__") return; // for security
|
|
887
|
-
|
|
888
|
-
var value = unmarshal(valueHandle);
|
|
889
|
-
unwrap(target, proxyKeySymbol)[key] = value;
|
|
890
|
-
}), vm.newFunction("deleter", function (h, keyHandle) {
|
|
891
|
-
var target = unmarshal(h);
|
|
892
|
-
if (!target) return;
|
|
893
|
-
var key = unmarshal(keyHandle);
|
|
894
|
-
delete unwrap(target, proxyKeySymbol)[key];
|
|
895
|
-
})], function (args) {
|
|
896
|
-
return [call.apply(void 0, [vm, "(target, sym, getSyncMode, setter, deleter) => {\n const rec = new Proxy(target, {\n get(obj, key, receiver) {\n return key === sym ? obj : Reflect.get(obj, key, receiver)\n },\n set(obj, key, value, receiver) {\n const v = typeof value === \"object\" && value !== null || typeof value === \"function\"\n ? value[sym] ?? value\n : value;\n const sync = getSyncMode(receiver) ?? \"vm\";\n if (sync === \"host\" || Reflect.set(obj, key, v, receiver)) {\n if (sync !== \"vm\") {\n setter(receiver, key, v);\n }\n }\n return true;\n },\n deleteProperty(obj, key) {\n const sync = getSyncMode(rec) ?? \"vm\";\n if (sync === \"host\" || Reflect.deleteProperty(obj, key)) {\n if (sync !== \"vm\") {\n deleter(rec, key);\n }\n }\n return true;\n },\n });\n return rec;\n }", undefined, handle, proxyKeySymbolHandle].concat(args)), true];
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
function unwrap(obj, key) {
|
|
900
|
-
var _obj$key;
|
|
901
|
-
|
|
902
|
-
return isObject(obj) ? (_obj$key = obj[key]) != null ? _obj$key : obj : obj;
|
|
903
|
-
}
|
|
904
|
-
function unwrapHandle(vm, handle, key) {
|
|
905
|
-
if (!isHandleWrapped(vm, handle, key)) return [handle, false];
|
|
906
|
-
return [vm.getProp(handle, key), true];
|
|
907
|
-
}
|
|
908
|
-
function isWrapped(obj, key) {
|
|
909
|
-
return isObject(obj) && !!obj[key];
|
|
910
|
-
}
|
|
911
|
-
function isHandleWrapped(vm, handle, key) {
|
|
912
|
-
return !!vm.dump(call(vm, "(a, s) => (typeof a === \"object\" && a !== null || typeof a === \"function\") && !!a[s]", undefined, handle, key));
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
/**
|
|
916
|
-
* Default value of registeredObjects option of the Arena class constructor.
|
|
917
|
-
*/
|
|
918
|
-
var defaultRegisteredObjects = /*#__PURE__*/[// basic objects
|
|
919
|
-
[Symbol, "Symbol"], [Symbol.prototype, "Symbol.prototype"], [Object, "Object"], [Object.prototype, "Object.prototype"], [Function, "Function"], [Function.prototype, "Function.prototype"], [Boolean, "Boolean"], [Boolean.prototype, "Boolean.prototype"], [Array, "Array"], [Array.prototype, "Array.prototype"], // [BigInt, "BigInt"],
|
|
920
|
-
// [BigInt.prototype, "BigInt.prototype"],
|
|
921
|
-
// errors
|
|
922
|
-
[Error, "Error"], [Error.prototype, "Error.prototype"], [EvalError, "EvalError"], [EvalError.prototype, "EvalError.prototype"], [RangeError, "RangeError"], [RangeError.prototype, "RangeError.prototype"], [ReferenceError, "ReferenceError"], [ReferenceError.prototype, "ReferenceError.prototype"], [SyntaxError, "SyntaxError"], [SyntaxError.prototype, "SyntaxError.prototype"], [TypeError, "TypeError"], [TypeError.prototype, "TypeError.prototype"], [URIError, "URIError"], [URIError.prototype, "URIError.prototype"]].concat( /*#__PURE__*/Object.getOwnPropertyNames(Symbol).filter(function (k) {
|
|
923
|
-
return typeof Symbol[k] === "symbol";
|
|
924
|
-
}).map(function (k) {
|
|
925
|
-
return [Symbol[k], "Symbol." + k];
|
|
926
|
-
}));
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* The Arena class manages all generated handles at once by quickjs-emscripten and automatically converts objects between the host and the QuickJS VM.
|
|
930
|
-
*/
|
|
931
|
-
|
|
932
|
-
var Arena = /*#__PURE__*/function () {
|
|
933
|
-
/** Constructs a new Arena instance. It requires a quickjs-emscripten VM initialized with `quickjs.createVM()`. */
|
|
934
|
-
function Arena(vm, options) {
|
|
935
|
-
var _options$registeredOb;
|
|
936
|
-
|
|
937
|
-
this.vm = void 0;
|
|
938
|
-
this._map = void 0;
|
|
939
|
-
this._registeredMap = void 0;
|
|
940
|
-
this._registeredMapDispose = new Set();
|
|
941
|
-
this._sync = new Set();
|
|
942
|
-
this._temporalSync = new Set();
|
|
943
|
-
this._symbol = Symbol();
|
|
944
|
-
this._symbolHandle = void 0;
|
|
945
|
-
this._options = void 0;
|
|
946
|
-
this.vm = vm;
|
|
947
|
-
this._options = options;
|
|
948
|
-
this._symbolHandle = vm.unwrapResult(vm.evalCode("Symbol()"));
|
|
949
|
-
this._map = new VMMap(vm);
|
|
950
|
-
this._registeredMap = new VMMap(vm);
|
|
951
|
-
this.registerAll((_options$registeredOb = options == null ? void 0 : options.registeredObjects) != null ? _options$registeredOb : defaultRegisteredObjects);
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Dispose of the arena and managed handles. This method won't dispose the VM itself, so the VM has to be disposed of manually.
|
|
955
|
-
*/
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
var _proto = Arena.prototype;
|
|
959
|
-
|
|
960
|
-
_proto.dispose = function dispose() {
|
|
961
|
-
this._map.dispose();
|
|
962
|
-
|
|
963
|
-
this._registeredMap.dispose();
|
|
964
|
-
|
|
965
|
-
this._symbolHandle.dispose();
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Evaluate JS code in the VM and get the result as an object on the host side. It also converts and re-throws error objects when an error is thrown during evaluation.
|
|
969
|
-
*/
|
|
970
|
-
;
|
|
971
|
-
|
|
972
|
-
_proto.evalCode = function evalCode(code) {
|
|
973
|
-
var handle = this.vm.evalCode(code);
|
|
974
|
-
return this._unwrapResultAndUnmarshal(handle);
|
|
975
|
-
}
|
|
976
|
-
/**
|
|
977
|
-
* Almost same as `vm.executePendingJobs()`, but it converts and re-throws error objects when an error is thrown during evaluation.
|
|
978
|
-
*/
|
|
979
|
-
;
|
|
980
|
-
|
|
981
|
-
_proto.executePendingJobs = function executePendingJobs(maxJobsToExecute) {
|
|
982
|
-
var _this = this;
|
|
983
|
-
|
|
984
|
-
var result = this.vm.executePendingJobs(maxJobsToExecute);
|
|
985
|
-
|
|
986
|
-
if ("value" in result) {
|
|
987
|
-
return result.value;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
throw result.error.consume(function (err) {
|
|
991
|
-
return _this._unmarshal(err);
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* Expose objects as global objects in the VM.
|
|
996
|
-
*
|
|
997
|
-
* By default, exposed objects are not synchronized between the host and the VM.
|
|
998
|
-
* If you want to sync an objects, first wrap the object with sync method, and then expose the wrapped object.
|
|
999
|
-
*/
|
|
1000
|
-
;
|
|
1001
|
-
|
|
1002
|
-
_proto.expose = function expose(obj) {
|
|
1003
|
-
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
1004
|
-
var _Object$entries$_i = _Object$entries[_i],
|
|
1005
|
-
key = _Object$entries$_i[0],
|
|
1006
|
-
value = _Object$entries$_i[1];
|
|
1007
|
-
|
|
1008
|
-
var handle = this._marshal(value);
|
|
1009
|
-
|
|
1010
|
-
this.vm.setProp(this.vm.global, key, handle);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
/**
|
|
1014
|
-
* Enables sync for the object between the host and the VM and returns objects wrapped with proxies.
|
|
1015
|
-
*
|
|
1016
|
-
* The return value is necessary in order to reflect changes to the object from the host to the VM. Please note that setting a value in the field or deleting a field in the original object will not synchronize it.
|
|
1017
|
-
*/
|
|
1018
|
-
;
|
|
1019
|
-
|
|
1020
|
-
_proto.sync = function sync(target) {
|
|
1021
|
-
var _this2 = this;
|
|
1022
|
-
|
|
1023
|
-
var wrapped = this._wrap(target);
|
|
1024
|
-
|
|
1025
|
-
if (typeof wrapped === "undefined") return target;
|
|
1026
|
-
walkObject(wrapped, function (v) {
|
|
1027
|
-
_this2._sync.add(_this2._unwrap(v));
|
|
1028
|
-
});
|
|
1029
|
-
return wrapped;
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Register a pair of objects that will be considered the same between the host and the QuickJS VM.
|
|
1033
|
-
*
|
|
1034
|
-
* Instead of a string, you can also pass a QuickJSHandle directly. In that case, however, when you have to dispose them manually when destroying the VM.
|
|
1035
|
-
*/
|
|
1036
|
-
;
|
|
1037
|
-
|
|
1038
|
-
_proto.register = function register(target, handleOrCode) {
|
|
1039
|
-
if (this._registeredMap.has(target)) return;
|
|
1040
|
-
var handle = typeof handleOrCode === "string" ? this._unwrapResult(this.vm.evalCode(handleOrCode)) : handleOrCode;
|
|
1041
|
-
if (eq(this.vm, handle, this.vm.undefined)) return;
|
|
1042
|
-
|
|
1043
|
-
if (typeof handleOrCode === "string") {
|
|
1044
|
-
this._registeredMapDispose.add(target);
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
this._registeredMap.set(target, handle);
|
|
1048
|
-
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Execute `register` methods for each pair.
|
|
1051
|
-
*/
|
|
1052
|
-
;
|
|
1053
|
-
|
|
1054
|
-
_proto.registerAll = function registerAll(map) {
|
|
1055
|
-
for (var _iterator = _createForOfIteratorHelperLoose(map), _step; !(_step = _iterator()).done;) {
|
|
1056
|
-
var _step$value = _step.value,
|
|
1057
|
-
k = _step$value[0],
|
|
1058
|
-
v = _step$value[1];
|
|
1059
|
-
this.register(k, v);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Unregister a pair of objects that were registered with `registeredObjects` option and `register` method.
|
|
1064
|
-
*/
|
|
1065
|
-
;
|
|
1066
|
-
|
|
1067
|
-
_proto.unregister = function unregister(target, dispose) {
|
|
1068
|
-
this._registeredMap["delete"](target, this._registeredMapDispose.has(target) || dispose);
|
|
1069
|
-
|
|
1070
|
-
this._registeredMapDispose["delete"](target);
|
|
1071
|
-
}
|
|
1072
|
-
/**
|
|
1073
|
-
* Execute `unregister` methods for each target.
|
|
1074
|
-
*/
|
|
1075
|
-
;
|
|
1076
|
-
|
|
1077
|
-
_proto.unregisterAll = function unregisterAll(targets, dispose) {
|
|
1078
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(targets), _step2; !(_step2 = _iterator2()).done;) {
|
|
1079
|
-
var t = _step2.value;
|
|
1080
|
-
this.unregister(t, dispose);
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
|
-
|
|
1084
|
-
_proto.startSync = function startSync(target) {
|
|
1085
|
-
if (!isObject(target)) return;
|
|
1086
|
-
|
|
1087
|
-
this._sync.add(this._unwrap(target));
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
|
-
_proto.endSync = function endSync(target) {
|
|
1091
|
-
this._sync["delete"](this._unwrap(target));
|
|
1092
|
-
};
|
|
1093
|
-
|
|
1094
|
-
_proto._unwrapResult = function _unwrapResult(result) {
|
|
1095
|
-
var _this3 = this;
|
|
1096
|
-
|
|
1097
|
-
if ("value" in result) {
|
|
1098
|
-
return result.value;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
throw result.error.consume(function (err) {
|
|
1102
|
-
return _this3._unmarshal(err);
|
|
1103
|
-
});
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
_proto._unwrapResultAndUnmarshal = function _unwrapResultAndUnmarshal(result) {
|
|
1107
|
-
var _this4 = this;
|
|
1108
|
-
|
|
1109
|
-
if (!result) return;
|
|
1110
|
-
return this._unwrapResult(result).consume(function (h) {
|
|
1111
|
-
return _this4._unmarshal(h);
|
|
1112
|
-
});
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
_proto._marshal = function _marshal(target) {
|
|
1116
|
-
var _this$_wrap,
|
|
1117
|
-
_this5 = this;
|
|
1118
|
-
|
|
1119
|
-
var registered = this._registeredMap.get(target);
|
|
1120
|
-
|
|
1121
|
-
if (registered) {
|
|
1122
|
-
return registered;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
var map = new VMMap(this.vm);
|
|
1126
|
-
map.merge(this._map);
|
|
1127
|
-
var handle = marshal((_this$_wrap = this._wrap(target)) != null ? _this$_wrap : target, {
|
|
1128
|
-
vm: this.vm,
|
|
1129
|
-
unmarshal: function unmarshal(h) {
|
|
1130
|
-
return _this5._unmarshal(h);
|
|
1131
|
-
},
|
|
1132
|
-
isMarshalable: function isMarshalable(t) {
|
|
1133
|
-
var _this5$_options$isMar, _this5$_options;
|
|
1134
|
-
|
|
1135
|
-
return (_this5$_options$isMar = (_this5$_options = _this5._options) == null ? void 0 : _this5$_options.isMarshalable == null ? void 0 : _this5$_options.isMarshalable(_this5._unwrap(t))) != null ? _this5$_options$isMar : true;
|
|
1136
|
-
},
|
|
1137
|
-
find: function find(t) {
|
|
1138
|
-
var _this5$_registeredMap;
|
|
1139
|
-
|
|
1140
|
-
return (_this5$_registeredMap = _this5._registeredMap.get(t)) != null ? _this5$_registeredMap : map.get(t);
|
|
1141
|
-
},
|
|
1142
|
-
pre: function pre(t, h) {
|
|
1143
|
-
var _this5$_register;
|
|
1144
|
-
|
|
1145
|
-
return (_this5$_register = _this5._register(t, h, map)) == null ? void 0 : _this5$_register[1];
|
|
1146
|
-
},
|
|
1147
|
-
preApply: function preApply(target, that, args) {
|
|
1148
|
-
var unwrapped = isObject(that) ? _this5._unwrap(that) : undefined; // override sync mode of this object while calling the function
|
|
1149
|
-
|
|
1150
|
-
if (unwrapped) _this5._temporalSync.add(unwrapped);
|
|
1151
|
-
|
|
1152
|
-
try {
|
|
1153
|
-
return target.apply(that, args);
|
|
1154
|
-
} finally {
|
|
1155
|
-
// restore sync mode
|
|
1156
|
-
if (unwrapped) _this5._temporalSync["delete"](unwrapped);
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
|
-
|
|
1161
|
-
this._map.merge(map);
|
|
1162
|
-
|
|
1163
|
-
map.clear();
|
|
1164
|
-
map.dispose();
|
|
1165
|
-
return handle;
|
|
1166
|
-
};
|
|
1167
|
-
|
|
1168
|
-
_proto._unmarshal = function _unmarshal(handle) {
|
|
1169
|
-
var _this6 = this;
|
|
1170
|
-
|
|
1171
|
-
var registered = this._registeredMap.getByHandle(handle);
|
|
1172
|
-
|
|
1173
|
-
if (typeof registered !== "undefined") {
|
|
1174
|
-
return registered;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
var _this$_wrapHandle = this._wrapHandle(handle),
|
|
1178
|
-
wrappedHandle = _this$_wrapHandle[0];
|
|
1179
|
-
|
|
1180
|
-
return unmarshal(wrappedHandle != null ? wrappedHandle : handle, {
|
|
1181
|
-
vm: this.vm,
|
|
1182
|
-
marshal: function marshal(v) {
|
|
1183
|
-
return _this6._marshal(v);
|
|
1184
|
-
},
|
|
1185
|
-
find: function find(h) {
|
|
1186
|
-
var _this6$_registeredMap;
|
|
1187
|
-
|
|
1188
|
-
return (_this6$_registeredMap = _this6._registeredMap.getByHandle(h)) != null ? _this6$_registeredMap : _this6._map.getByHandle(h);
|
|
1189
|
-
},
|
|
1190
|
-
pre: function pre(t, h) {
|
|
1191
|
-
var _this6$_register;
|
|
1192
|
-
|
|
1193
|
-
return (_this6$_register = _this6._register(t, h, undefined, true)) == null ? void 0 : _this6$_register[0];
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1196
|
-
};
|
|
1197
|
-
|
|
1198
|
-
_proto._register = function _register(t, h, map, sync) {
|
|
1199
|
-
if (map === void 0) {
|
|
1200
|
-
map = this._map;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
if (this._registeredMap.has(t) || this._registeredMap.hasHandle(h)) {
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
var wrappedT = this._wrap(t);
|
|
1208
|
-
|
|
1209
|
-
var _this$_wrapHandle2 = this._wrapHandle(h),
|
|
1210
|
-
wrappedH = _this$_wrapHandle2[0];
|
|
1211
|
-
|
|
1212
|
-
if (!wrappedT || !wrappedH) return; // t or h is not an object
|
|
1213
|
-
|
|
1214
|
-
var unwrappedT = this._unwrap(t);
|
|
1215
|
-
|
|
1216
|
-
var _this$_unwrapHandle = this._unwrapHandle(h),
|
|
1217
|
-
unwrappedH = _this$_unwrapHandle[0],
|
|
1218
|
-
unwrapped = _this$_unwrapHandle[1];
|
|
1219
|
-
|
|
1220
|
-
var res = map.set(wrappedT, wrappedH, unwrappedT, unwrappedH);
|
|
1221
|
-
|
|
1222
|
-
if (!res) {
|
|
1223
|
-
// already registered
|
|
1224
|
-
if (unwrapped) unwrappedH.dispose();
|
|
1225
|
-
throw new Error("already registered");
|
|
1226
|
-
} else if (sync) {
|
|
1227
|
-
this._sync.add(unwrappedT);
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
return [wrappedT, wrappedH];
|
|
1231
|
-
};
|
|
1232
|
-
|
|
1233
|
-
_proto._syncMode = function _syncMode(obj) {
|
|
1234
|
-
var obj2 = this._unwrap(obj);
|
|
1235
|
-
|
|
1236
|
-
return this._sync.has(obj2) || this._temporalSync.has(obj2) ? "both" : undefined;
|
|
1237
|
-
};
|
|
1238
|
-
|
|
1239
|
-
_proto._wrap = function _wrap(target) {
|
|
1240
|
-
var _this7 = this;
|
|
1241
|
-
|
|
1242
|
-
return wrap(this.vm, target, this._symbol, this._symbolHandle, function (t) {
|
|
1243
|
-
return _this7._marshal(t);
|
|
1244
|
-
}, function (t) {
|
|
1245
|
-
return _this7._syncMode(t);
|
|
1246
|
-
});
|
|
1247
|
-
};
|
|
1248
|
-
|
|
1249
|
-
_proto._unwrap = function _unwrap(target) {
|
|
1250
|
-
return unwrap(target, this._symbol);
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
|
-
_proto._wrapHandle = function _wrapHandle(handle) {
|
|
1254
|
-
var _this8 = this;
|
|
1255
|
-
|
|
1256
|
-
return wrapHandle(this.vm, handle, this._symbol, this._symbolHandle, function (h) {
|
|
1257
|
-
return _this8._unmarshal(h);
|
|
1258
|
-
}, function (t) {
|
|
1259
|
-
return _this8._syncMode(t);
|
|
1260
|
-
});
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
_proto._unwrapHandle = function _unwrapHandle(target) {
|
|
1264
|
-
return unwrapHandle(this.vm, target, this._symbolHandle);
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
|
-
return Arena;
|
|
1268
|
-
}();
|
|
1269
|
-
|
|
1270
|
-
export default Arena;
|
|
1271
|
-
export { Arena, VMMap, call, complexity, consumeAll, defaultRegisteredObjects, eq, isES2015Class, isHandleObject, isObject, marshal, send, unmarshal, walkObject };
|
|
1272
|
-
//# sourceMappingURL=quickjs-emscripten-sync.esm.js.map
|