@mirascript/mirascript 0.1.93-alpha.2 → 0.1.93

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.
Files changed (142) hide show
  1. package/dist/chunk-7JTZW66P.js +1075 -0
  2. package/dist/chunk-7JTZW66P.js.map +6 -0
  3. package/dist/{chunk-Y7S6AHE7.js → chunk-F3FHURMG.js} +55 -939
  4. package/dist/chunk-F3FHURMG.js.map +6 -0
  5. package/dist/{chunk-HHKY7Y7L.js → chunk-GTNLLZL4.js} +4 -82
  6. package/dist/chunk-GTNLLZL4.js.map +6 -0
  7. package/dist/chunk-H2OHULLB.js +89 -0
  8. package/dist/chunk-H2OHULLB.js.map +6 -0
  9. package/dist/compiler/worker.js +2 -1
  10. package/dist/compiler/worker.js.map +1 -1
  11. package/dist/experimental-context.d.ts +93 -0
  12. package/dist/experimental-context.d.ts.map +1 -0
  13. package/dist/experimental-context.js +90 -0
  14. package/dist/experimental-context.js.map +6 -0
  15. package/dist/helpers/convert/string.d.ts +0 -2
  16. package/dist/helpers/convert/string.d.ts.map +1 -1
  17. package/dist/helpers/error.d.ts.map +1 -1
  18. package/dist/helpers/serialize/display.d.ts +29 -0
  19. package/dist/helpers/serialize/display.d.ts.map +1 -0
  20. package/dist/helpers/serialize/index.d.ts +5 -0
  21. package/dist/helpers/serialize/index.d.ts.map +1 -0
  22. package/dist/helpers/serialize/interface.d.ts +33 -0
  23. package/dist/helpers/serialize/interface.d.ts.map +1 -0
  24. package/dist/helpers/serialize/serialize.d.ts +39 -0
  25. package/dist/helpers/serialize/serialize.d.ts.map +1 -0
  26. package/dist/helpers/serialize/simple.d.ts +9 -0
  27. package/dist/helpers/serialize/simple.d.ts.map +1 -0
  28. package/dist/helpers/serialize/string.d.ts +6 -0
  29. package/dist/helpers/serialize/string.d.ts.map +1 -0
  30. package/dist/helpers/utils.d.ts +4 -0
  31. package/dist/helpers/utils.d.ts.map +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +12 -8
  35. package/dist/index.js.map +1 -1
  36. package/dist/subtle.d.ts +1 -1
  37. package/dist/subtle.d.ts.map +1 -1
  38. package/dist/subtle.js +9 -6
  39. package/dist/subtle.js.map +1 -1
  40. package/dist/vm/effects/run.d.ts +7 -0
  41. package/dist/vm/effects/run.d.ts.map +1 -0
  42. package/dist/vm/effects/state.d.ts +62 -0
  43. package/dist/vm/effects/state.d.ts.map +1 -0
  44. package/dist/vm/effects/wrap.d.ts +4 -0
  45. package/dist/vm/effects/wrap.d.ts.map +1 -0
  46. package/dist/vm/lib/global/bit.d.ts +7 -7
  47. package/dist/vm/lib/global/bit.d.ts.map +1 -1
  48. package/dist/vm/lib/global/debug.d.ts +1 -1
  49. package/dist/vm/lib/global/debug.d.ts.map +1 -1
  50. package/dist/vm/lib/global/json.d.ts +2 -2
  51. package/dist/vm/lib/global/json.d.ts.map +1 -1
  52. package/dist/vm/lib/global/math/index.d.ts +2 -2
  53. package/dist/vm/lib/global/math/index.d.ts.map +1 -1
  54. package/dist/vm/lib/global/math/tgamma.d.ts +2 -2
  55. package/dist/vm/lib/global/math/tgamma.d.ts.map +1 -1
  56. package/dist/vm/lib/global/sequence/all-any.d.ts +2 -2
  57. package/dist/vm/lib/global/sequence/all-any.d.ts.map +1 -1
  58. package/dist/vm/lib/global/sequence/entries.d.ts +3 -3
  59. package/dist/vm/lib/global/sequence/entries.d.ts.map +1 -1
  60. package/dist/vm/lib/global/sequence/find.d.ts +1 -1
  61. package/dist/vm/lib/global/sequence/flatten.d.ts +1 -1
  62. package/dist/vm/lib/global/sequence/flatten.d.ts.map +1 -1
  63. package/dist/vm/lib/global/sequence/fold.d.ts +1 -1
  64. package/dist/vm/lib/global/sequence/fold.d.ts.map +1 -1
  65. package/dist/vm/lib/global/sequence/group.d.ts +1 -1
  66. package/dist/vm/lib/global/sequence/group.d.ts.map +1 -1
  67. package/dist/vm/lib/global/sequence/len.d.ts +1 -1
  68. package/dist/vm/lib/global/sequence/len.d.ts.map +1 -1
  69. package/dist/vm/lib/global/sequence/map-filter.d.ts +3 -3
  70. package/dist/vm/lib/global/sequence/map-filter.d.ts.map +1 -1
  71. package/dist/vm/lib/global/sequence/new.d.ts +2 -2
  72. package/dist/vm/lib/global/sequence/new.d.ts.map +1 -1
  73. package/dist/vm/lib/global/sequence/repeat.d.ts +1 -1
  74. package/dist/vm/lib/global/sequence/repeat.d.ts.map +1 -1
  75. package/dist/vm/lib/global/sequence/reverse.d.ts +1 -1
  76. package/dist/vm/lib/global/sequence/reverse.d.ts.map +1 -1
  77. package/dist/vm/lib/global/sequence/sort.d.ts +2 -2
  78. package/dist/vm/lib/global/sequence/sort.d.ts.map +1 -1
  79. package/dist/vm/lib/global/sequence/unique.d.ts +2 -2
  80. package/dist/vm/lib/global/sequence/unique.d.ts.map +1 -1
  81. package/dist/vm/lib/global/sequence/with.d.ts +1 -1
  82. package/dist/vm/lib/global/sequence/with.d.ts.map +1 -1
  83. package/dist/vm/lib/global/sequence/zip.d.ts +1 -1
  84. package/dist/vm/lib/global/sequence/zip.d.ts.map +1 -1
  85. package/dist/vm/lib/global/string/case.d.ts +2 -2
  86. package/dist/vm/lib/global/string/case.d.ts.map +1 -1
  87. package/dist/vm/lib/global/string/index.d.ts +4 -4
  88. package/dist/vm/lib/global/string/index.d.ts.map +1 -1
  89. package/dist/vm/lib/global/string/search.d.ts +3 -3
  90. package/dist/vm/lib/global/string/search.d.ts.map +1 -1
  91. package/dist/vm/lib/global/string/trim.d.ts +3 -3
  92. package/dist/vm/lib/global/string/trim.d.ts.map +1 -1
  93. package/dist/vm/lib/global/time.d.ts +3 -3
  94. package/dist/vm/lib/global/time.d.ts.map +1 -1
  95. package/dist/vm/lib/global/to-primitive.d.ts +3 -3
  96. package/dist/vm/lib/global/to-primitive.d.ts.map +1 -1
  97. package/dist/vm/lib/mod/matrix/bin-ops.d.ts +6 -6
  98. package/dist/vm/lib/mod/matrix/bin-ops.d.ts.map +1 -1
  99. package/dist/vm/lib/mod/matrix/fill.d.ts +4 -4
  100. package/dist/vm/lib/mod/matrix/fill.d.ts.map +1 -1
  101. package/dist/vm/lib/mod/matrix/invert.d.ts +1 -1
  102. package/dist/vm/lib/mod/matrix/invert.d.ts.map +1 -1
  103. package/dist/vm/lib/mod/matrix/size.d.ts +1 -1
  104. package/dist/vm/lib/mod/matrix/size.d.ts.map +1 -1
  105. package/dist/vm/lib/mod/matrix/transpose.d.ts +1 -1
  106. package/dist/vm/lib/mod/matrix/transpose.d.ts.map +1 -1
  107. package/dist/vm/types/function.d.ts +4 -2
  108. package/dist/vm/types/function.d.ts.map +1 -1
  109. package/package.json +8 -4
  110. package/src/experimental-context.ts +121 -0
  111. package/src/helpers/convert/boolean.ts +1 -1
  112. package/src/helpers/convert/number.ts +1 -1
  113. package/src/helpers/convert/string.ts +6 -11
  114. package/src/helpers/error.ts +2 -0
  115. package/src/helpers/serialize/display.ts +60 -0
  116. package/src/helpers/serialize/index.ts +4 -0
  117. package/src/helpers/serialize/interface.ts +33 -0
  118. package/src/helpers/serialize/serialize.ts +200 -0
  119. package/src/helpers/serialize/simple.ts +25 -0
  120. package/src/helpers/serialize/string.ts +91 -0
  121. package/src/helpers/utils.ts +11 -2
  122. package/src/index.ts +1 -1
  123. package/src/subtle.ts +2 -2
  124. package/src/vm/effects/run.ts +80 -0
  125. package/src/vm/effects/state.ts +108 -0
  126. package/src/vm/effects/wrap.ts +71 -0
  127. package/src/vm/lib/global/debug.ts +6 -3
  128. package/src/vm/lib/global/math/index.ts +9 -5
  129. package/src/vm/lib/global/sequence/zip.ts +1 -1
  130. package/src/vm/lib/global/time.ts +5 -2
  131. package/src/vm/lib/helpers.ts +1 -1
  132. package/src/vm/operations/call.ts +1 -1
  133. package/src/vm/operations/compound.ts +1 -1
  134. package/src/vm/operations/iterable.ts +1 -1
  135. package/src/vm/operations/slice.ts +1 -1
  136. package/src/vm/operations/spread.ts +1 -1
  137. package/src/vm/types/function.ts +7 -5
  138. package/dist/chunk-HHKY7Y7L.js.map +0 -6
  139. package/dist/chunk-Y7S6AHE7.js.map +0 -6
  140. package/dist/helpers/serialize.d.ts +0 -63
  141. package/dist/helpers/serialize.d.ts.map +0 -1
  142. package/src/helpers/serialize.ts +0 -397
@@ -0,0 +1,1075 @@
1
+ import {
2
+ __export,
3
+ __reExport,
4
+ apply,
5
+ defineProperty,
6
+ entries,
7
+ freeze,
8
+ getOwnPropertyNames,
9
+ getPrototypeOf,
10
+ hasOwn,
11
+ isArray,
12
+ isNaN,
13
+ isPromiseLike,
14
+ keys,
15
+ values
16
+ } from "./chunk-H2OHULLB.js";
17
+
18
+ // src/helpers/serialize/simple.ts
19
+ function serializeNil() {
20
+ return "nil";
21
+ }
22
+ function serializeBoolean(value) {
23
+ return value ? "true" : "false";
24
+ }
25
+ function numberToString(value, minusZero) {
26
+ if (isNaN(value)) return "nan";
27
+ if (value === Infinity) return "inf";
28
+ if (value === -Infinity) return "-inf";
29
+ if (minusZero && value === 0 && 1 / value < 0) return "-0";
30
+ return String(value);
31
+ }
32
+ function serializeNumber(value) {
33
+ return numberToString(value, true);
34
+ }
35
+
36
+ // src/helpers/constants.ts
37
+ var constants_exports = {};
38
+ __export(constants_exports, {
39
+ VM_ARRAY_MAX_LENGTH: () => VM_ARRAY_MAX_LENGTH,
40
+ VM_FUNCTION_ANONYMOUS_NAME: () => VM_FUNCTION_ANONYMOUS_NAME,
41
+ VM_SCRIPT_NAME: () => VM_SCRIPT_NAME,
42
+ kVmContext: () => kVmContext,
43
+ kVmExtern: () => kVmExtern,
44
+ kVmFunction: () => kVmFunction,
45
+ kVmFunctionProxy: () => kVmFunctionProxy,
46
+ kVmModule: () => kVmModule,
47
+ kVmScript: () => kVmScript,
48
+ kVmWrapper: () => kVmWrapper
49
+ });
50
+ __reExport(constants_exports, constants_star);
51
+ import * as constants_star from "@mirascript/constants";
52
+ var VM_ARRAY_MAX_LENGTH = 16777216;
53
+ var kVmScript = /* @__PURE__ */ Symbol.for("mirascript.vm.script");
54
+ var kVmFunction = /* @__PURE__ */ Symbol.for("mirascript.vm.function");
55
+ var kVmFunctionProxy = /* @__PURE__ */ Symbol.for("mirascript.vm.function.proxy");
56
+ var kVmContext = /* @__PURE__ */ Symbol.for("mirascript.vm.context");
57
+ var kVmExtern = /* @__PURE__ */ Symbol.for("mirascript.vm.extern");
58
+ var kVmModule = /* @__PURE__ */ Symbol.for("mirascript.vm.module");
59
+ var kVmWrapper = /* @__PURE__ */ Symbol.for("mirascript.vm.wrapper");
60
+ var VM_SCRIPT_NAME = `<script_root>`;
61
+ var VM_FUNCTION_ANONYMOUS_NAME = `<anonymous>`;
62
+
63
+ // src/helpers/types/basic.ts
64
+ function isVmScript(value) {
65
+ return typeof value === "function" && kVmScript in value;
66
+ }
67
+ function isVmContext(context) {
68
+ return context != null && typeof context == "object" && kVmContext in context;
69
+ }
70
+ function isVmFunction(value) {
71
+ return typeof value == "function" && kVmFunction in value;
72
+ }
73
+ function getVmFunctionInfo(value) {
74
+ if (typeof value != "function") return void 0;
75
+ return value[kVmFunction];
76
+ }
77
+ function isVmWrapper(value) {
78
+ return value != null && typeof value == "object" && kVmWrapper in value;
79
+ }
80
+ function isVmModule(value) {
81
+ return value != null && typeof value == "object" && kVmModule in value;
82
+ }
83
+ function isVmExtern(value) {
84
+ return value != null && typeof value == "object" && kVmExtern in value;
85
+ }
86
+ function isVmCallable(value) {
87
+ return isVmFunction(value) || isVmExtern(value) && typeof value.value == "function";
88
+ }
89
+ function isVmPrimitive(value) {
90
+ if (value === null || typeof value == "number" || typeof value == "string" || typeof value == "boolean") {
91
+ value;
92
+ value;
93
+ return true;
94
+ }
95
+ return false;
96
+ }
97
+ function isVmArray(value) {
98
+ if (!isArray(value)) return false;
99
+ value;
100
+ return true;
101
+ }
102
+ function isVmRecord(value) {
103
+ if (value == null || typeof value != "object") return false;
104
+ if (isVmWrapper(value) || isVmArray(value)) return false;
105
+ value;
106
+ return true;
107
+ }
108
+
109
+ // src/helpers/types/proto.ts
110
+ function isPlainArray(value) {
111
+ const proto = getPrototypeOf(value);
112
+ return isArray(proto) && hasOwn(proto, "push");
113
+ }
114
+ function isPlainObject(value) {
115
+ const proto1 = getPrototypeOf(value);
116
+ if (proto1 == null) return true;
117
+ const proto2 = getPrototypeOf(proto1);
118
+ if (proto2 != null) return false;
119
+ return hasOwn(proto1, "hasOwnProperty");
120
+ }
121
+
122
+ // src/helpers/types/const.ts
123
+ var MAX_DEPTH = 16;
124
+ function isVmArrayDeep(value, depth) {
125
+ if (!isPlainArray(value)) return false;
126
+ if (depth <= 0) return true;
127
+ const inner_depth = depth - 1;
128
+ return value.every((item) => isVmConstInner(item, inner_depth));
129
+ }
130
+ function isVmRecordDeep(value, depth) {
131
+ if (!isPlainObject(value)) return false;
132
+ if (depth <= 0) return true;
133
+ const inner_depth = depth - 1;
134
+ return values(value).every((value2) => isVmConstInner(value2, inner_depth));
135
+ }
136
+ function isVmConstInner(value, depth) {
137
+ if (value == null) return true;
138
+ if (typeof value == "string" || typeof value == "number" || typeof value == "boolean") return true;
139
+ if (typeof value == "object") {
140
+ if (isVmWrapper(value)) return false;
141
+ if (isArray(value)) {
142
+ return isVmArrayDeep(value, depth);
143
+ } else {
144
+ return isVmRecordDeep(value, depth);
145
+ }
146
+ }
147
+ return false;
148
+ }
149
+ function isVmConst(value, checkDeep = false) {
150
+ if (value === void 0) return false;
151
+ return isVmConstInner(value, checkDeep ? MAX_DEPTH : 0);
152
+ }
153
+
154
+ // src/helpers/types/get-type.ts
155
+ function getVmType(value) {
156
+ if (value === void 0) return "uninitialized";
157
+ if (value === null) return "nil";
158
+ if (isVmWrapper(value)) return value.type;
159
+ if (isVmArray(value)) return "array";
160
+ if (typeof value == "object") return "record";
161
+ return typeof value;
162
+ }
163
+
164
+ // src/helpers/types/array-like.ts
165
+ function isVmArrayLikeRecordByEntries(entries2) {
166
+ const { length } = entries2;
167
+ if (length === 0) return true;
168
+ if (length > VM_ARRAY_MAX_LENGTH) return false;
169
+ const firstKey = entries2[0][0];
170
+ if (firstKey !== "0") return false;
171
+ const lastKey = entries2[length - 1][0];
172
+ if (lastKey !== String(length - 1)) return false;
173
+ return true;
174
+ }
175
+ function isVmArrayLikeRecordByKeys(keys2) {
176
+ const { length } = keys2;
177
+ if (length === 0) return true;
178
+ if (length > VM_ARRAY_MAX_LENGTH) return false;
179
+ const firstKey = keys2[0];
180
+ if (firstKey !== "0") return false;
181
+ const lastKey = keys2[length - 1];
182
+ if (lastKey !== String(length - 1)) return false;
183
+ return true;
184
+ }
185
+ function isVmArrayLikeRecord(value) {
186
+ return isVmArrayLikeRecordByKeys(keys(value));
187
+ }
188
+
189
+ // src/helpers/types/composed.ts
190
+ function isVmImmutable(value, checkDeep = false) {
191
+ return isVmModule(value) || isVmFunction(value) || isVmConst(value, checkDeep);
192
+ }
193
+ function isVmValue(value, checkDeep = false) {
194
+ return isVmWrapper(value) || isVmFunction(value) || isVmConst(value, checkDeep);
195
+ }
196
+ function isVmAny(value, checkDeep) {
197
+ if (value == null) return true;
198
+ return isVmValue(value, checkDeep);
199
+ }
200
+
201
+ // src/helpers/serialize/serialize.ts
202
+ import { REG_IDENTIFIER_FULL, REG_ORDINAL_FULL } from "@mirascript/constants";
203
+
204
+ // src/helpers/serialize/string.ts
205
+ function serializeStringEscaped(escaped, options) {
206
+ return options.serializeStringEscape("\\" + escaped, options);
207
+ }
208
+ function serializeStringContent(value, options) {
209
+ return options.serializeStringContent(value, options);
210
+ }
211
+ var STRING_QUOTE = `'`;
212
+ var STRING_REG = new RegExp(String.raw`[${STRING_QUOTE}\\\$\p{C}\u2028\u2029]`, "gu");
213
+ var STRING_MARK = /^[\p{M}]$/u;
214
+ function serializeSpecialChar(char, options) {
215
+ if (char === STRING_QUOTE) {
216
+ return serializeStringEscaped(STRING_QUOTE, options);
217
+ } else if (char === "\0") {
218
+ return serializeStringEscaped(`0`, options);
219
+ } else if (char === "\n") {
220
+ return serializeStringEscaped(`n`, options);
221
+ } else if (char === "\r") {
222
+ return serializeStringEscaped(`r`, options);
223
+ } else if (char === " ") {
224
+ return serializeStringEscaped(`t`, options);
225
+ } else if (char === "\b") {
226
+ return serializeStringEscaped(`b`, options);
227
+ } else if (char === "\f") {
228
+ return serializeStringEscaped(`f`, options);
229
+ } else if (char === "\v") {
230
+ return serializeStringEscaped(`v`, options);
231
+ } else if (char === "\\") {
232
+ return serializeStringEscaped(`\\`, options);
233
+ } else if (char === "$") {
234
+ return serializeStringEscaped(`$`, options);
235
+ } else {
236
+ const code = char.codePointAt(0);
237
+ if (code <= 127) {
238
+ return serializeStringEscaped(`x${code.toString(16).padStart(2, "0")}`, options);
239
+ } else if (code >= 55296 && code <= 57343) {
240
+ return serializeStringContent("�", options);
241
+ } else {
242
+ return serializeStringEscaped(`u{${code.toString(16)}}`, options);
243
+ }
244
+ }
245
+ }
246
+ function serializeStringImpl(value, options) {
247
+ const oq = options.serializeStringQuote(STRING_QUOTE, true, options);
248
+ const cq = options.serializeStringQuote(STRING_QUOTE, false, options);
249
+ if (value.length === 0) {
250
+ return oq + cq;
251
+ }
252
+ let ret = oq;
253
+ let lastIndex = 0;
254
+ while (value.length > lastIndex) {
255
+ const cp = value.codePointAt(lastIndex);
256
+ const ch = String.fromCodePoint(cp);
257
+ if (!STRING_MARK.test(ch)) break;
258
+ ret += serializeStringEscaped(`u{${cp.toString(16)}}`, options);
259
+ lastIndex += ch.length;
260
+ }
261
+ STRING_REG.lastIndex = lastIndex;
262
+ let match;
263
+ while ((match = STRING_REG.exec(value)) !== null) {
264
+ ret += serializeStringContent(value.slice(lastIndex, match.index), options);
265
+ lastIndex = STRING_REG.lastIndex;
266
+ ret += serializeSpecialChar(match[0], options);
267
+ }
268
+ ret += serializeStringContent(value.slice(lastIndex), options);
269
+ ret += cq;
270
+ return ret;
271
+ }
272
+
273
+ // src/helpers/serialize/serialize.ts
274
+ function serializeString(value, options) {
275
+ return serializeStringImpl(value, getSerializeOptions(options));
276
+ }
277
+ function serializeRecordKeyDefault(key) {
278
+ if (REG_ORDINAL_FULL.test(key) || REG_IDENTIFIER_FULL.test(key)) {
279
+ return key;
280
+ }
281
+ return serializeStringImpl(key, DEFAULT_OPTIONS);
282
+ }
283
+ function serializeRecordKeyOpt(value, options) {
284
+ if (isDefaultOptions(options)) {
285
+ return serializeRecordKeyDefault(value);
286
+ }
287
+ if (REG_ORDINAL_FULL.test(value)) {
288
+ return options.serializePropName(Number(value), options);
289
+ }
290
+ if (REG_IDENTIFIER_FULL.test(value)) {
291
+ return options.serializePropName(value, options);
292
+ }
293
+ return options.serializeString(value, options);
294
+ }
295
+ function serializeRecordKey(key, options) {
296
+ if (isDefaultOptions(options)) {
297
+ return serializeRecordKeyDefault(key);
298
+ }
299
+ return serializeRecordKeyOpt(key, getSerializeOptions(options));
300
+ }
301
+ function serializeArray(value, depth, options) {
302
+ if (depth > options.maxDepth) return `[]`;
303
+ if (value.length === 0) return "[]";
304
+ let result = "[";
305
+ for (let i = 0; i < value.length; i++) {
306
+ if (i > 0) result += ", ";
307
+ result += serializeImpl(value[i], depth, options);
308
+ }
309
+ result += "]";
310
+ return result;
311
+ }
312
+ var { valueOf } = Object.prototype;
313
+ function customValueOf(value) {
314
+ const thisValueOf = value.valueOf;
315
+ if (typeof thisValueOf !== "function" || thisValueOf === valueOf) {
316
+ return void 0;
317
+ }
318
+ const customValue = thisValueOf.call(value);
319
+ if (customValue === value) return void 0;
320
+ return customValue;
321
+ }
322
+ function serializeRecord(value, depth, options) {
323
+ const customValue = customValueOf(value);
324
+ if (customValue !== void 0) {
325
+ return serializeImpl(customValue, depth - 1, options);
326
+ }
327
+ if (depth > options.maxDepth) return `()`;
328
+ const e = entries(value);
329
+ if (e.length === 0) return "()";
330
+ if (e.length === 1) {
331
+ const [k, v] = e[0];
332
+ if (k === "0") {
333
+ return `(${serializeImpl(v, depth, options)},)`;
334
+ }
335
+ return `(${serializeRecordKeyOpt(k, options)}: ${serializeImpl(v, depth, options)})`;
336
+ }
337
+ const omitKey = isVmArrayLikeRecordByEntries(e);
338
+ let result = "(";
339
+ for (const [key, val] of e) {
340
+ if (result.length > 1) result += ", ";
341
+ if (omitKey) {
342
+ result += serializeImpl(val, depth, options);
343
+ } else {
344
+ result += `${serializeRecordKeyOpt(key, options)}: ${serializeImpl(val, depth, options)}`;
345
+ }
346
+ }
347
+ result += ")";
348
+ return result;
349
+ }
350
+ function serializeImpl(value, depth, options) {
351
+ if (value == null) {
352
+ return options.serializeNil(options);
353
+ }
354
+ if (typeof value == "boolean") {
355
+ return options.serializeBoolean(value, options);
356
+ }
357
+ if (typeof value == "number") {
358
+ return options.serializeNumber(value, options);
359
+ }
360
+ if (typeof value == "string") {
361
+ return options.serializeString(value, options);
362
+ }
363
+ if (isVmFunction(value)) {
364
+ return options.serializeFunction(value, options);
365
+ }
366
+ if (isVmModule(value)) {
367
+ return options.serializeModule(value, depth + 1, options);
368
+ }
369
+ if (isVmExtern(value)) {
370
+ return options.serializeExtern(value, depth + 1, options);
371
+ }
372
+ if (isVmArray(value)) {
373
+ return options.serializeArray(value, depth + 1, options);
374
+ }
375
+ if (isVmRecord(value)) {
376
+ return options.serializeRecord(value, depth + 1, options);
377
+ }
378
+ value;
379
+ return options.serializeNil(options);
380
+ }
381
+ function serialize(value, options) {
382
+ return serializeImpl(value, 0, getSerializeOptions(options));
383
+ }
384
+ function isDefaultOptions(options) {
385
+ return options == null || options === DEFAULT_OPTIONS;
386
+ }
387
+ function mergeOptions(base, options) {
388
+ if (options == null) return base;
389
+ let opt = null;
390
+ for (const key in options) {
391
+ if (!hasOwn(options, key) || !hasOwn(base, key)) continue;
392
+ const el = options[key];
393
+ if (el == null) continue;
394
+ opt ??= { ...base };
395
+ opt[key] = el;
396
+ }
397
+ return opt ? Object.freeze(opt) : base;
398
+ }
399
+ function getSerializeOptions(options) {
400
+ if (isDefaultOptions(options)) return DEFAULT_OPTIONS;
401
+ return mergeOptions(DEFAULT_OPTIONS, options);
402
+ }
403
+ var DEFAULT_OPTIONS = Object.freeze({
404
+ maxDepth: 128,
405
+ serializeNil,
406
+ serializeBoolean,
407
+ serializeNumber,
408
+ serializeString: serializeStringImpl,
409
+ serializeStringQuote: (value) => value,
410
+ serializeStringEscape: (value) => value,
411
+ serializeStringContent: (value) => value,
412
+ serializeArray,
413
+ serializeRecord,
414
+ serializePropName: String,
415
+ serializeFunction: serializeNil,
416
+ serializeModule: serializeNil,
417
+ serializeExtern: serializeNil
418
+ });
419
+
420
+ // src/vm/effects/state.ts
421
+ var AsyncRequiredError = class extends Error {
422
+ constructor() {
423
+ super("An async VM function requires runInContext");
424
+ this.name = "AsyncRequiredError";
425
+ }
426
+ };
427
+ var ReplayMismatchError = class extends Error {
428
+ constructor() {
429
+ super("Host effect sequence changed during replay");
430
+ this.name = "ReplayMismatchError";
431
+ }
432
+ };
433
+ var ContextReentrancyError = class extends Error {
434
+ constructor() {
435
+ super("Nested execution contexts and host effects are not supported");
436
+ this.name = "ContextReentrancyError";
437
+ }
438
+ };
439
+ var SuspensionError = class extends Error {
440
+ constructor(slot) {
441
+ super("Host effect suspended");
442
+ this.slot = slot;
443
+ this.name = "SuspensionError";
444
+ }
445
+ };
446
+ var kEffectContext = /* @__PURE__ */ Symbol("EffectContext");
447
+ function createContext() {
448
+ return {
449
+ __proto__: null,
450
+ __marker__: kEffectContext,
451
+ cursor: 0,
452
+ slots: [],
453
+ inHost: false
454
+ };
455
+ }
456
+ var currentContext;
457
+ function setCurrentContext(context) {
458
+ const previous = currentContext;
459
+ currentContext = context;
460
+ return previous;
461
+ }
462
+ function resetContext(context) {
463
+ context.cursor = 0;
464
+ context.suspension = void 0;
465
+ }
466
+ function failContext(error) {
467
+ if (currentContext) currentContext.failure ??= error;
468
+ throw error;
469
+ }
470
+ function throwIfFailed(context) {
471
+ if (context.failure) throw context.failure;
472
+ }
473
+ function rethrowControl(error) {
474
+ if (error instanceof SuspensionError || error instanceof AsyncRequiredError || error instanceof ReplayMismatchError || error instanceof ContextReentrancyError) {
475
+ throw error;
476
+ }
477
+ }
478
+
479
+ // src/helpers/serialize/display.ts
480
+ function displayFunction(value) {
481
+ try {
482
+ const name = getVmFunctionInfo(value)?.fullName;
483
+ return name ? `<function ${name}>` : `<function>`;
484
+ } catch (error) {
485
+ rethrowControl(error);
486
+ return `<function>`;
487
+ }
488
+ }
489
+ function displayModule(value) {
490
+ try {
491
+ return value.toString(true);
492
+ } catch (error) {
493
+ rethrowControl(error);
494
+ return `<module>`;
495
+ }
496
+ }
497
+ function displayExtern(value) {
498
+ try {
499
+ const tag = `<extern ${value.tag}>`;
500
+ const rep = value.toString(true);
501
+ if (rep === tag || rep.length > 50) {
502
+ return tag;
503
+ }
504
+ return `${tag} ${rep}`;
505
+ } catch (error) {
506
+ rethrowControl(error);
507
+ return `<extern>`;
508
+ }
509
+ }
510
+ var DISPLAY_OPTIONS = Object.freeze({
511
+ ...DEFAULT_OPTIONS,
512
+ maxDepth: 3,
513
+ serializeFunction: displayFunction,
514
+ serializeModule: displayModule,
515
+ serializeExtern: displayExtern
516
+ });
517
+ function display(value, options) {
518
+ const opt = mergeOptions(DISPLAY_OPTIONS, options);
519
+ return serializeImpl(value, 0, opt);
520
+ }
521
+
522
+ // src/helpers/error.ts
523
+ var VmError = class _VmError extends Error {
524
+ constructor(message, recovered) {
525
+ super(message);
526
+ this.recovered = recovered;
527
+ this.name = "VmError";
528
+ }
529
+ /** 从其他错误构造 */
530
+ static from(prefix, error, recovered) {
531
+ rethrowControl(error);
532
+ if (prefix) {
533
+ if (prefix.endsWith(":")) {
534
+ prefix += " ";
535
+ } else if (!prefix.endsWith(": ")) {
536
+ prefix += ": ";
537
+ }
538
+ }
539
+ let vmError;
540
+ if (error instanceof Error) {
541
+ vmError = new _VmError(`${prefix}${error.message}`, recovered);
542
+ vmError.stack = error.stack;
543
+ } else {
544
+ vmError = new _VmError(`${prefix}${String(error)}`, recovered);
545
+ }
546
+ vmError.cause = error;
547
+ return vmError;
548
+ }
549
+ };
550
+
551
+ // src/helpers/convert/string.ts
552
+ function innerToString(value, useBraces) {
553
+ if (value == null) return "nil";
554
+ if (typeof value == "number") return numberToString(value, false);
555
+ if (typeof value == "string" || typeof value == "boolean") return String(value);
556
+ if (typeof value == "function") return displayFunction(value);
557
+ if (isVmWrapper(value)) return value.toString(useBraces);
558
+ if (isVmArray(value)) {
559
+ const strings = [];
560
+ for (const item of value) {
561
+ strings.push(innerToString(item, true));
562
+ }
563
+ const results = strings.join(", ");
564
+ if (!useBraces) return results;
565
+ return `[${results}]`;
566
+ } else {
567
+ const entries2 = keys(value).map((key) => `${key}: ${innerToString(value[key], true)}`).join(", ");
568
+ if (!useBraces) return entries2;
569
+ return `(${entries2})`;
570
+ }
571
+ }
572
+ function toString(value, fallback) {
573
+ if (typeof value == "string") return value;
574
+ if (value == null) return "";
575
+ try {
576
+ return innerToString(value, false);
577
+ } catch (ex) {
578
+ rethrowControl(ex);
579
+ if (fallback === void 0) {
580
+ const e = new VmError(`Failed to convert value to string: ${display(value)}`, "");
581
+ e.cause = ex;
582
+ throw e;
583
+ }
584
+ return fallback;
585
+ }
586
+ }
587
+
588
+ // src/vm/types/wrapper.ts
589
+ var VmWrapper = class {
590
+ constructor(value) {
591
+ this.value = value;
592
+ }
593
+ /** 描述键对应的值 */
594
+ describe(key) {
595
+ return void 0;
596
+ }
597
+ /** 转为字符串 */
598
+ toString(useBraces) {
599
+ const { type, tag } = this;
600
+ if (!tag) return `<${type}>`;
601
+ return `<${type} ${tag}>`;
602
+ }
603
+ };
604
+ Object.defineProperty(VmWrapper.prototype, kVmWrapper, { value: true });
605
+
606
+ // src/vm/operations/common.ts
607
+ var $AssertInit = (value) => {
608
+ if (value === void 0) throw new VmError(`Uninitialized value`, null);
609
+ };
610
+
611
+ // src/vm/operations/call.ts
612
+ function $Call(func, args) {
613
+ const argsLen = args.length;
614
+ for (let i = 0; i < argsLen; i++) {
615
+ $AssertInit(args[i]);
616
+ }
617
+ if (typeof func == "function") {
618
+ return func(...args) ?? null;
619
+ }
620
+ if (isVmExtern(func)) {
621
+ return func.call(args) ?? null;
622
+ }
623
+ throw new VmError(`Value is not callable: ${display(func)}`, null);
624
+ }
625
+ function $VArgs(varags) {
626
+ for (let i = 0, l = varags.length; i < l; i++) {
627
+ const el = varags[i];
628
+ if (!isVmConst(el)) {
629
+ varags[i] = null;
630
+ }
631
+ }
632
+ return varags;
633
+ }
634
+
635
+ // src/vm/types/boundary.ts
636
+ function toVmFunctionProxy(fn) {
637
+ const cached = fn[kVmFunctionProxy];
638
+ if (cached != null) return cached;
639
+ const proxy = (...args) => {
640
+ const ret = $Call(
641
+ fn,
642
+ // 作为函数参数传入的值一定丢失了它的 this
643
+ args.map((v) => wrapToVmValue(v, null, null))
644
+ );
645
+ return unwrapFromVmValue(ret, true);
646
+ };
647
+ defineProperty(fn, kVmFunctionProxy, { value: proxy });
648
+ defineProperty(proxy, kVmFunctionProxy, { value: fn });
649
+ defineProperty(proxy, "name", {
650
+ value: fn.name,
651
+ configurable: true
652
+ });
653
+ return proxy;
654
+ }
655
+ function fromVmFunctionProxy(fn) {
656
+ if (isVmFunction(fn)) return fn;
657
+ const original = fn[kVmFunctionProxy];
658
+ if (original && isVmFunction(original)) return original;
659
+ return null;
660
+ }
661
+ function wrapToVmConst(value, assumeVmValue = null) {
662
+ if (value == null) return null;
663
+ switch (typeof value) {
664
+ case "function":
665
+ return null;
666
+ case "object": {
667
+ if (isVmWrapper(value)) return null;
668
+ if (value instanceof Date) return value.valueOf();
669
+ if (assumeVmValue?.(value)) return value;
670
+ return null;
671
+ }
672
+ case "string":
673
+ case "number":
674
+ case "boolean":
675
+ return value;
676
+ case "bigint":
677
+ return Number(value);
678
+ case "symbol":
679
+ case "undefined":
680
+ default:
681
+ return null;
682
+ }
683
+ }
684
+ function wrapToVmValue(value, thisArg = null, assumeVmValue = null) {
685
+ if (value == null) return null;
686
+ if (typeof value == "function") {
687
+ const unwrapped = fromVmFunctionProxy(value);
688
+ if (unwrapped != null) return unwrapped;
689
+ return new VmExtern(value, thisArg);
690
+ }
691
+ const constValue = wrapToVmConst(value, assumeVmValue);
692
+ if (constValue != null) return constValue;
693
+ if (typeof value == "object") {
694
+ if (isVmWrapper(value)) return value;
695
+ return new VmExtern(value);
696
+ }
697
+ return null;
698
+ }
699
+ function bindThis(fn, thisArg) {
700
+ if (thisArg == null) return fn;
701
+ return new Proxy(fn, {
702
+ apply(target, _thisArg, args) {
703
+ return apply(target, thisArg, args);
704
+ }
705
+ });
706
+ }
707
+ function unwrapFromVmValue(value, bindThisArg = true) {
708
+ if (isVmFunction(value)) {
709
+ return toVmFunctionProxy(value);
710
+ }
711
+ if (value == null || typeof value != "object") return value;
712
+ if (!isVmExtern(value)) return value;
713
+ if (value.thisArg == null || typeof value.value != "function") {
714
+ return value.value;
715
+ }
716
+ const f = value;
717
+ return bindThisArg ? bindThis(f.value, f.thisArg) : f.value;
718
+ }
719
+
720
+ // src/vm/types/extern/tag.ts
721
+ var ObjectPrototype = Object.prototype;
722
+ function getJsObjectTag(value) {
723
+ return ObjectPrototype.toString.call(value).slice(8, -1);
724
+ }
725
+ function classNameOf(kls) {
726
+ const { displayName } = kls;
727
+ if (typeof displayName === "string" && displayName.trim()) {
728
+ return displayName.trim();
729
+ }
730
+ const { name } = kls;
731
+ if (typeof name == "string" && name.length > 2) {
732
+ return name;
733
+ }
734
+ return null;
735
+ }
736
+ function getTag(value) {
737
+ const tag = getJsObjectTag(value);
738
+ if (tag === "Function") {
739
+ if ("prototype" in value && typeof value.prototype == "object") {
740
+ const className = classNameOf(value);
741
+ if (!className) return `class`;
742
+ return `class ${className}`;
743
+ }
744
+ return `function`;
745
+ }
746
+ if (tag === "AsyncFunction") {
747
+ return `async function`;
748
+ }
749
+ if (tag === "GeneratorFunction") {
750
+ return `function*`;
751
+ }
752
+ if (tag === "AsyncGeneratorFunction") {
753
+ return `async function*`;
754
+ }
755
+ if (tag === "Object") {
756
+ const proto = getPrototypeOf(value);
757
+ if (proto === ObjectPrototype) {
758
+ return "Object";
759
+ }
760
+ if (proto == null) {
761
+ return "Object: null prototype";
762
+ }
763
+ if (typeof proto.constructor === "function") {
764
+ return classNameOf(proto.constructor) ?? "Object";
765
+ }
766
+ }
767
+ return tag;
768
+ }
769
+
770
+ // src/vm/types/extern/utils.ts
771
+ function isArrayLike(value) {
772
+ return isArray(value) || ArrayBuffer.isView(value) && "length" in value;
773
+ }
774
+ function getKeys(value, includeNonEnumerable) {
775
+ if (!includeNonEnumerable) {
776
+ const keys3 = [];
777
+ for (const key in value) {
778
+ keys3.push(key);
779
+ }
780
+ return keys3;
781
+ }
782
+ const keys2 = /* @__PURE__ */ new Set();
783
+ let e = value;
784
+ while (e != null && (typeof e == "object" || typeof e == "function")) {
785
+ for (const key of getOwnPropertyNames(e)) {
786
+ keys2.add(key);
787
+ }
788
+ e = getPrototypeOf(e);
789
+ }
790
+ return Array.from(keys2);
791
+ }
792
+ var ObjectToString = Object.prototype.toString;
793
+ var FunctionToString = Function.prototype.toString;
794
+ var ArrayToString = Array.prototype.toString;
795
+ var TypedArrayToString = Uint8Array.prototype.toString;
796
+ function hasCustomToString(value) {
797
+ const { toString: toString2 } = value;
798
+ if (typeof toString2 != "function") return false;
799
+ if (toString2 === ObjectToString || toString2 === FunctionToString || toString2 === ArrayToString || toString2 === TypedArrayToString)
800
+ return false;
801
+ return true;
802
+ }
803
+
804
+ // src/vm/types/extern/access.ts
805
+ var pFunction = Function.prototype;
806
+ var pArray = Array.prototype;
807
+ var pObject = Object.prototype;
808
+ function canAccessProperty(value, key, read) {
809
+ if (key.startsWith("_")) return false;
810
+ if (typeof value == "function" && (key === "prototype" || key === "arguments" || key === "caller")) return false;
811
+ if (hasOwn(value, key)) return true;
812
+ if (!read) return true;
813
+ if (!(key in value)) return false;
814
+ if (key === "constructor") return false;
815
+ const prop = value[key];
816
+ if (key in pFunction && prop === pFunction[key]) return false;
817
+ if (key in pArray && prop === pArray[key]) return false;
818
+ if (key in pObject && prop === pObject[key]) return false;
819
+ return true;
820
+ }
821
+
822
+ // src/vm/types/extern/index.ts
823
+ var ArrayMap = Array.prototype.map;
824
+ var VmExtern = class extends VmWrapper {
825
+ constructor(value, thisArg = null) {
826
+ super(value);
827
+ this.thisArg = thisArg;
828
+ }
829
+ /**
830
+ * Check if the object has a property
831
+ * This method will be used in {@link get}, {@link set}, {@link has}, and {@link keys} methods
832
+ */
833
+ access(key, read) {
834
+ return canAccessProperty(this.value, key, read);
835
+ }
836
+ /** 决定是否对属性进行包装 */
837
+ assumeVmValue(value, key) {
838
+ return false;
839
+ }
840
+ /** @inheritdoc */
841
+ has(key) {
842
+ return this.access(key, true);
843
+ }
844
+ /** @inheritdoc */
845
+ get(key) {
846
+ if (!(key in this.value)) return void 0;
847
+ if (!this.access(key, true)) return void 0;
848
+ const prop = this.value[key];
849
+ return wrapToVmValue(prop, this.value, (v) => this.assumeVmValue(v, key));
850
+ }
851
+ /** Set a property on the object */
852
+ set(key, value) {
853
+ if (!this.access(key, false)) return false;
854
+ const prop = unwrapFromVmValue(value, true);
855
+ this.value[key] = prop;
856
+ return true;
857
+ }
858
+ /** Call extern value */
859
+ call(args) {
860
+ const { value } = this;
861
+ if (typeof value != "function") {
862
+ throw VmError.from(`Not a callable extern`, null, null);
863
+ }
864
+ const caller = this.thisArg;
865
+ const unwrappedArgs = args.map((arg) => unwrapFromVmValue(arg, true));
866
+ let ret;
867
+ try {
868
+ ret = apply(value, caller, unwrappedArgs);
869
+ } catch (ex) {
870
+ throw VmError.from(`Callable extern`, ex, null);
871
+ }
872
+ return wrapToVmValue(ret, null, (obj) => this.assumeVmValue(obj, void 0));
873
+ }
874
+ /** @inheritdoc */
875
+ keys(includeNonEnumerable = false) {
876
+ const keys2 = getKeys(this.value, includeNonEnumerable);
877
+ return keys2.filter((key) => this.access(key, true));
878
+ }
879
+ /** @inheritdoc */
880
+ same(other) {
881
+ if (!isVmExtern(other)) return false;
882
+ return this.value === other.value && this.thisArg === other.thisArg;
883
+ }
884
+ /**
885
+ * Should this extern be treated as array-like?
886
+ *
887
+ * By default, this method returns true if the wrapped value is an Array or a TypedArray.
888
+ */
889
+ isArrayLike() {
890
+ return isArrayLike(this.value);
891
+ }
892
+ /** @inheritdoc */
893
+ toString(useBraces) {
894
+ if (hasCustomToString(this.value)) {
895
+ return String(this.value);
896
+ }
897
+ if (this.isArrayLike()) {
898
+ const mapped = ArrayMap.call(this.value, (item) => {
899
+ if (item === void 0) return "";
900
+ return innerToString(wrapToVmValue(item ?? null, null, null), true);
901
+ });
902
+ const str = mapped.join(", ");
903
+ if (useBraces) return `[${str}]`;
904
+ return str;
905
+ }
906
+ return super.toString(useBraces);
907
+ }
908
+ /** @inheritdoc */
909
+ get type() {
910
+ return "extern";
911
+ }
912
+ /** @inheritdoc */
913
+ get tag() {
914
+ const tag = getTag(this.value);
915
+ if (this.isArrayLike()) {
916
+ return `${tag}(${this.value.length})`;
917
+ }
918
+ return tag;
919
+ }
920
+ };
921
+ Object.defineProperty(VmExtern.prototype, kVmExtern, { value: true });
922
+
923
+ // src/vm/types/function.ts
924
+ var nameIfNotAnonymous = ({ name }, fallback) => {
925
+ if (!name) return fallback;
926
+ if (name === VM_FUNCTION_ANONYMOUS_NAME) return fallback;
927
+ return name;
928
+ };
929
+ function VmFunction(fn, option = {}) {
930
+ if (typeof fn != "function") {
931
+ throw new TypeError("Invalid function");
932
+ }
933
+ const exists = fromVmFunctionProxy(fn);
934
+ if (exists) return exists;
935
+ let opt;
936
+ if (isVmFunction(option)) {
937
+ opt = { ...option[kVmFunction], name: nameIfNotAnonymous(option, null) };
938
+ } else if (typeof option == "function") {
939
+ opt = {
940
+ ...option,
941
+ isLib: true,
942
+ name: nameIfNotAnonymous(option, null)
943
+ };
944
+ } else {
945
+ opt = option;
946
+ }
947
+ const info = {
948
+ __proto__: null,
949
+ fullName: opt.fullName ?? nameIfNotAnonymous(fn, ""),
950
+ isLib: opt.isLib ?? false,
951
+ summary: opt.summary || void 0,
952
+ params: opt.params,
953
+ returns: opt.returns ?? void 0,
954
+ examples: opt.examples?.length ? opt.examples : void 0,
955
+ deprecated: opt.deprecated ?? void 0
956
+ };
957
+ const name = opt.name ?? fn.name;
958
+ defineProperty(fn, "name", { value: name, configurable: true });
959
+ defineProperty(fn, kVmFunction, { value: freeze(info) });
960
+ return fn;
961
+ }
962
+
963
+ // src/vm/effects/wrap.ts
964
+ function wrapEffect(kind, fn) {
965
+ const token = /* @__PURE__ */ Symbol();
966
+ return function(...args) {
967
+ const context = currentContext;
968
+ if (!context) {
969
+ if (kind === "async") throw new AsyncRequiredError();
970
+ return apply(fn, this, args);
971
+ }
972
+ throwIfFailed(context);
973
+ if (context.inHost) failContext(new ContextReentrancyError());
974
+ if (context.suspension) throw context.suspension;
975
+ const index = context.cursor++;
976
+ let slot = context.slots[index];
977
+ if (slot) {
978
+ if (slot.token !== token || slot.kind !== kind) failContext(new ReplayMismatchError());
979
+ } else {
980
+ slot = { token, kind, state: "pending", value: void 0 };
981
+ context.slots.push(slot);
982
+ context.inHost = true;
983
+ try {
984
+ const value = apply(fn, this, args);
985
+ if (kind === "async" && isPromiseLike(value)) {
986
+ const pending = slot;
987
+ pending.ready = Promise.resolve(value).then(
988
+ (result) => {
989
+ pending.state = "resolved";
990
+ pending.value = result;
991
+ },
992
+ (error) => {
993
+ pending.state = "rejected";
994
+ pending.value = error;
995
+ }
996
+ );
997
+ } else {
998
+ slot.state = "resolved";
999
+ slot.value = value;
1000
+ }
1001
+ } catch (error) {
1002
+ rethrowControl(error);
1003
+ slot.state = "rejected";
1004
+ slot.value = error;
1005
+ } finally {
1006
+ context.inHost = false;
1007
+ }
1008
+ }
1009
+ throwIfFailed(context);
1010
+ if (slot.state === "rejected") throw slot.value;
1011
+ if (slot.state === "resolved") return slot.value;
1012
+ context.suspension = new SuspensionError(slot);
1013
+ throw context.suspension;
1014
+ };
1015
+ }
1016
+
1017
+ export {
1018
+ serializeNil,
1019
+ serializeBoolean,
1020
+ serializeNumber,
1021
+ VM_ARRAY_MAX_LENGTH,
1022
+ kVmScript,
1023
+ kVmContext,
1024
+ kVmModule,
1025
+ VM_SCRIPT_NAME,
1026
+ VM_FUNCTION_ANONYMOUS_NAME,
1027
+ constants_exports,
1028
+ isVmScript,
1029
+ isVmContext,
1030
+ isVmFunction,
1031
+ getVmFunctionInfo,
1032
+ isVmWrapper,
1033
+ isVmModule,
1034
+ isVmExtern,
1035
+ isVmCallable,
1036
+ isVmPrimitive,
1037
+ isVmArray,
1038
+ isVmRecord,
1039
+ isVmConst,
1040
+ getVmType,
1041
+ isVmArrayLikeRecordByEntries,
1042
+ isVmArrayLikeRecordByKeys,
1043
+ isVmArrayLikeRecord,
1044
+ isVmImmutable,
1045
+ isVmValue,
1046
+ isVmAny,
1047
+ serializeString,
1048
+ serializeRecordKey,
1049
+ serializeArray,
1050
+ serializeRecord,
1051
+ serialize,
1052
+ AsyncRequiredError,
1053
+ ReplayMismatchError,
1054
+ ContextReentrancyError,
1055
+ createContext,
1056
+ currentContext,
1057
+ setCurrentContext,
1058
+ resetContext,
1059
+ failContext,
1060
+ rethrowControl,
1061
+ display,
1062
+ VmError,
1063
+ $AssertInit,
1064
+ toString,
1065
+ $Call,
1066
+ $VArgs,
1067
+ VmWrapper,
1068
+ VmExtern,
1069
+ wrapToVmConst,
1070
+ wrapToVmValue,
1071
+ unwrapFromVmValue,
1072
+ VmFunction,
1073
+ wrapEffect
1074
+ };
1075
+ //# sourceMappingURL=chunk-7JTZW66P.js.map