@cortexkit/pi-magic-context 0.44.4 → 0.45.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.
Files changed (40) hide show
  1. package/dist/embedding-worker.js +47 -0
  2. package/dist/emscripten-module-0g8f45e6.js +602 -0
  3. package/dist/emscripten-module-0pekdjxz.js +1532 -0
  4. package/dist/emscripten-module-e67xwsp3.js +503 -0
  5. package/dist/emscripten-module-pj1vyb44.js +4559 -0
  6. package/dist/ffi-3cx1cxpk.js +78 -0
  7. package/dist/ffi-7bqqe4cd.js +91 -0
  8. package/dist/ffi-7e6gryj5.js +91 -0
  9. package/dist/ffi-bpvkebwr.js +78 -0
  10. package/dist/historian-calibration-extension.js +7 -4
  11. package/dist/{index-5am7amy4.js → index-2bw9k8nx.js} +7848 -23072
  12. package/dist/index-2pbbk3en.js +410 -0
  13. package/dist/index-4d3cba70.js +10 -0
  14. package/dist/{index-59dmj4zs.js → index-7n8gb6j3.js} +165 -3
  15. package/dist/{index-97e5fzy3.js → index-7s5yk3za.js} +1 -1
  16. package/dist/index-901ekbga.js +244 -0
  17. package/dist/index-e16q5sd7.js +240 -0
  18. package/dist/index-g0xfx1c2.js +275 -0
  19. package/dist/{module-asyncify-2EFITU5U-rkqjhjxd.js → index-g20jdh0p.js} +114 -105
  20. package/dist/index-j0mbc5vj.js +359 -0
  21. package/dist/index-k0yd1ph9.js +7774 -0
  22. package/dist/{index-5fw91enm.js → index-n3g5mwa8.js} +1 -1
  23. package/dist/index-q1yc6bs0.js +104 -0
  24. package/dist/index-ttf0cqq8.js +8938 -0
  25. package/dist/{index-npagr1cy.js → index-vxjgsr9m.js} +736 -904
  26. package/dist/{index-n8kg008j.js → index-w76x3af7.js} +28 -18
  27. package/dist/index.js +3983 -1670
  28. package/dist/{message-time-backfill-5yrp95cx.js → message-time-backfill-g83dkh8m.js} +19 -4
  29. package/dist/migration-worker.js +51 -0
  30. package/dist/module-ES6BEMUI-3cet1pyp.js +12 -0
  31. package/dist/module-asyncify-2EFITU5U-c2razzd9.js +6 -0
  32. package/dist/{read-session-chunk-w493f72c.js → read-session-chunk-kmt7a6zj.js} +32 -5
  33. package/dist/rpc-notifications-gm1mdpwh.js +16 -0
  34. package/dist/{safe-notification-target-y3hg2m7p.js → safe-notification-target-6cn3z99t.js} +2 -2
  35. package/dist/subagent-entry.js +15 -6
  36. package/package.json +4 -4
  37. package/dist/index-b3eqj1g6.js +0 -51
  38. package/dist/index-rn7gafjr.js +0 -8
  39. package/dist/index-v6t0tg85.js +0 -13
  40. package/dist/rpc-notifications-jxy30tgz.js +0 -8
@@ -1,10 +1,17 @@
1
- import {
2
- EvalFlags,
3
- IntrinsicsFlags,
4
- JSPromiseStateEnum,
5
- GetOwnPropertyNamesFlags,
6
- IsEqualOp
7
- } from "./index-rn7gafjr.js";
1
+ // ../../node_modules/.bun/@jitl+quickjs-ffi-types@0.32.0/node_modules/@jitl/quickjs-ffi-types/dist/index.mjs
2
+ function assertSync2(fn) {
3
+ return function(...args) {
4
+ let result = fn(...args);
5
+ if (result && typeof result == "object" && result instanceof Promise)
6
+ throw new Error("Function unexpectedly returned a Promise");
7
+ return result;
8
+ };
9
+ }
10
+ var EvalFlags2 = { JS_EVAL_TYPE_GLOBAL: 0, JS_EVAL_TYPE_MODULE: 1, JS_EVAL_TYPE_DIRECT: 2, JS_EVAL_TYPE_INDIRECT: 3, JS_EVAL_TYPE_MASK: 3, JS_EVAL_FLAG_STRICT: 8, JS_EVAL_FLAG_STRIP: 16, JS_EVAL_FLAG_COMPILE_ONLY: 32, JS_EVAL_FLAG_BACKTRACE_BARRIER: 64 };
11
+ var IntrinsicsFlags2 = { BaseObjects: 1, Date: 2, Eval: 4, StringNormalize: 8, RegExp: 16, RegExpCompiler: 32, JSON: 64, Proxy: 128, MapSet: 256, TypedArrays: 512, Promise: 1024, BigInt: 2048, BigFloat: 4096, BigDecimal: 8192, OperatorOverloading: 16384, BignumExt: 32768 };
12
+ var JSPromiseStateEnum2 = { Pending: 0, Fulfilled: 1, Rejected: 2 };
13
+ var GetOwnPropertyNamesFlags2 = { JS_GPN_STRING_MASK: 1, JS_GPN_SYMBOL_MASK: 2, JS_GPN_PRIVATE_MASK: 4, JS_GPN_ENUM_ONLY: 16, JS_GPN_SET_ENUM: 32, QTS_GPN_NUMBER_MASK: 64, QTS_STANDARD_COMPLIANT_NUMBER: 128 };
14
+ var IsEqualOp2 = { IsStrictlyEqual: 0, IsSameValue: 1, IsSameValueZero: 2 };
8
15
 
9
16
  // ../../node_modules/.bun/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/chunk-V2S4ZYJR.mjs
10
17
  var __defProp = Object.defineProperty;
@@ -13,7 +20,10 @@ var __export = (target, all) => {
13
20
  __defProp(target, name, { get: all[name], enumerable: true });
14
21
  };
15
22
  var QTS_DEBUG = false;
16
- function debugLog(...args) {
23
+ function setDebugMode2(enabled = true) {
24
+ QTS_DEBUG = enabled;
25
+ }
26
+ function debugLog2(...args) {
17
27
  QTS_DEBUG && console.log("quickjs-emscripten:", ...args);
18
28
  }
19
29
  var errors_exports = {};
@@ -123,17 +133,17 @@ function awaitEachYieldedPromise(gen) {
123
133
  }
124
134
  return handleNextStep(gen.next());
125
135
  }
126
- var UsingDisposable = class {
136
+ var UsingDisposable2 = class {
127
137
  [Symbol.dispose]() {
128
138
  return this.dispose();
129
139
  }
130
140
  };
131
141
  var SymbolDispose = Symbol.dispose ?? Symbol.for("Symbol.dispose");
132
- var prototypeAsAny = UsingDisposable.prototype;
142
+ var prototypeAsAny = UsingDisposable2.prototype;
133
143
  prototypeAsAny[SymbolDispose] || (prototypeAsAny[SymbolDispose] = function() {
134
144
  return this.dispose();
135
145
  });
136
- var Lifetime = class _Lifetime extends UsingDisposable {
146
+ var Lifetime2 = class _Lifetime extends UsingDisposable2 {
137
147
  constructor(_value, copier, disposer, _owner) {
138
148
  super();
139
149
  this._value = _value;
@@ -181,7 +191,7 @@ ${this._constructorStack}
181
191
  Lifetime used`) : new QuickJSUseAfterFree("Lifetime not alive");
182
192
  }
183
193
  };
184
- var StaticLifetime = class extends Lifetime {
194
+ var StaticLifetime2 = class extends Lifetime2 {
185
195
  constructor(value, owner) {
186
196
  super(value, undefined, undefined, owner);
187
197
  }
@@ -193,7 +203,7 @@ var StaticLifetime = class extends Lifetime {
193
203
  }
194
204
  dispose() {}
195
205
  };
196
- var WeakLifetime = class extends Lifetime {
206
+ var WeakLifetime2 = class extends Lifetime2 {
197
207
  constructor(value, copier, disposer, owner) {
198
208
  super(value, copier, disposer, owner);
199
209
  }
@@ -214,10 +224,10 @@ function scopeFinally(scope, blockError) {
214
224
  if (blockError || disposeError)
215
225
  throw blockError || disposeError;
216
226
  }
217
- var Scope = class _Scope extends UsingDisposable {
227
+ var Scope2 = class _Scope extends UsingDisposable2 {
218
228
  constructor() {
219
229
  super(...arguments);
220
- this._disposables = new Lifetime(new Set);
230
+ this._disposables = new Lifetime2(new Set);
221
231
  this.manage = (lifetime) => (this._disposables.value.add(lifetime), lifetime);
222
232
  }
223
233
  static withScope(block) {
@@ -262,7 +272,7 @@ var Scope = class _Scope extends UsingDisposable {
262
272
  this._disposables.dispose();
263
273
  }
264
274
  };
265
- function createDisposableArray(items) {
275
+ function createDisposableArray2(items) {
266
276
  let array = items ? Array.from(items) : [];
267
277
  function disposeAlive() {
268
278
  return array.forEach((disposable) => disposable.alive ? disposable.dispose() : undefined);
@@ -275,18 +285,18 @@ function createDisposableArray(items) {
275
285
  function isDisposable(value) {
276
286
  return !!(value && (typeof value == "object" || typeof value == "function") && ("alive" in value) && typeof value.alive == "boolean" && ("dispose" in value) && typeof value.dispose == "function");
277
287
  }
278
- var AbstractDisposableResult = class _AbstractDisposableResult extends UsingDisposable {
288
+ var AbstractDisposableResult = class _AbstractDisposableResult extends UsingDisposable2 {
279
289
  static success(value) {
280
- return new DisposableSuccess(value);
290
+ return new DisposableSuccess2(value);
281
291
  }
282
292
  static fail(error, onUnwrap) {
283
- return new DisposableFail(error, onUnwrap);
293
+ return new DisposableFail2(error, onUnwrap);
284
294
  }
285
295
  static is(result) {
286
296
  return result instanceof _AbstractDisposableResult;
287
297
  }
288
298
  };
289
- var DisposableSuccess = class extends AbstractDisposableResult {
299
+ var DisposableSuccess2 = class extends AbstractDisposableResult {
290
300
  constructor(value) {
291
301
  super();
292
302
  this.value = value;
@@ -304,7 +314,7 @@ var DisposableSuccess = class extends AbstractDisposableResult {
304
314
  return this.value;
305
315
  }
306
316
  };
307
- var DisposableFail = class extends AbstractDisposableResult {
317
+ var DisposableFail2 = class extends AbstractDisposableResult {
308
318
  constructor(error, onUnwrap) {
309
319
  super();
310
320
  this.error = error;
@@ -323,8 +333,8 @@ var DisposableFail = class extends AbstractDisposableResult {
323
333
  return fallback;
324
334
  }
325
335
  };
326
- var DisposableResult = AbstractDisposableResult;
327
- var QuickJSDeferredPromise = class extends UsingDisposable {
336
+ var DisposableResult2 = AbstractDisposableResult;
337
+ var QuickJSDeferredPromise2 = class extends UsingDisposable2 {
328
338
  constructor(args) {
329
339
  super();
330
340
  this.resolve = (value) => {
@@ -353,22 +363,22 @@ var ModuleMemory = class {
353
363
  }
354
364
  toPointerArray(handleArray) {
355
365
  let typedArray = new Int32Array(handleArray.map((handle) => handle.value)), numBytes = typedArray.length * typedArray.BYTES_PER_ELEMENT, ptr = this.module._malloc(numBytes);
356
- return new Uint8Array(this.module.HEAPU8.buffer, ptr, numBytes).set(new Uint8Array(typedArray.buffer)), new Lifetime(ptr, undefined, (ptr2) => this.module._free(ptr2));
366
+ return new Uint8Array(this.module.HEAPU8.buffer, ptr, numBytes).set(new Uint8Array(typedArray.buffer)), new Lifetime2(ptr, undefined, (ptr2) => this.module._free(ptr2));
357
367
  }
358
368
  newTypedArray(kind, length) {
359
369
  let zeros = new kind(new Array(length).fill(0)), numBytes = zeros.length * zeros.BYTES_PER_ELEMENT, ptr = this.module._malloc(numBytes), typedArray = new kind(this.module.HEAPU8.buffer, ptr, length);
360
- return typedArray.set(zeros), new Lifetime({ typedArray, ptr }, undefined, (value) => this.module._free(value.ptr));
370
+ return typedArray.set(zeros), new Lifetime2({ typedArray, ptr }, undefined, (value) => this.module._free(value.ptr));
361
371
  }
362
372
  newMutablePointerArray(length) {
363
373
  return this.newTypedArray(Int32Array, length);
364
374
  }
365
375
  newHeapCharPointer(string) {
366
376
  let strlen = this.module.lengthBytesUTF8(string), dataBytes = strlen + 1, ptr = this.module._malloc(dataBytes);
367
- return this.module.stringToUTF8(string, ptr, dataBytes), new Lifetime({ ptr, strlen }, undefined, (value) => this.module._free(value.ptr));
377
+ return this.module.stringToUTF8(string, ptr, dataBytes), new Lifetime2({ ptr, strlen }, undefined, (value) => this.module._free(value.ptr));
368
378
  }
369
379
  newHeapBufferPointer(buffer) {
370
380
  let numBytes = buffer.byteLength, ptr = this.module._malloc(numBytes);
371
- return this.module.HEAPU8.set(buffer, ptr), new Lifetime({ pointer: ptr, numBytes }, undefined, (value) => this.module._free(value.pointer));
381
+ return this.module.HEAPU8.set(buffer, ptr), new Lifetime2({ pointer: ptr, numBytes }, undefined, (value) => this.module._free(value.pointer));
372
382
  }
373
383
  consumeHeapCharPointer(ptr) {
374
384
  let str = this.module.UTF8ToString(ptr);
@@ -376,15 +386,15 @@ var ModuleMemory = class {
376
386
  }
377
387
  };
378
388
  var UnstableSymbol = Symbol("Unstable");
379
- var DefaultIntrinsics = Object.freeze({ BaseObjects: true, Date: true, Eval: true, StringNormalize: true, RegExp: true, JSON: true, Proxy: true, MapSet: true, TypedArrays: true, Promise: true });
389
+ var DefaultIntrinsics2 = Object.freeze({ BaseObjects: true, Date: true, Eval: true, StringNormalize: true, RegExp: true, JSON: true, Proxy: true, MapSet: true, TypedArrays: true, Promise: true });
380
390
  function intrinsicsToFlags(intrinsics) {
381
391
  if (!intrinsics)
382
392
  return 0;
383
393
  let result = 0;
384
394
  for (let [maybeIntrinsicName, enabled] of Object.entries(intrinsics)) {
385
- if (!(maybeIntrinsicName in IntrinsicsFlags))
395
+ if (!(maybeIntrinsicName in IntrinsicsFlags2))
386
396
  throw new QuickJSUnknownIntrinsic(maybeIntrinsicName);
387
- enabled && (result |= IntrinsicsFlags[maybeIntrinsicName]);
397
+ enabled && (result |= IntrinsicsFlags2[maybeIntrinsicName]);
388
398
  }
389
399
  return result;
390
400
  }
@@ -394,7 +404,7 @@ function evalOptionsToFlags(evalOptions) {
394
404
  if (evalOptions === undefined)
395
405
  return 0;
396
406
  let { type, strict, strip, compileOnly, backtraceBarrier } = evalOptions, flags = 0;
397
- return type === "global" && (flags |= EvalFlags.JS_EVAL_TYPE_GLOBAL), type === "module" && (flags |= EvalFlags.JS_EVAL_TYPE_MODULE), strict && (flags |= EvalFlags.JS_EVAL_FLAG_STRICT), strip && (flags |= EvalFlags.JS_EVAL_FLAG_STRIP), compileOnly && (flags |= EvalFlags.JS_EVAL_FLAG_COMPILE_ONLY), backtraceBarrier && (flags |= EvalFlags.JS_EVAL_FLAG_BACKTRACE_BARRIER), flags;
407
+ return type === "global" && (flags |= EvalFlags2.JS_EVAL_TYPE_GLOBAL), type === "module" && (flags |= EvalFlags2.JS_EVAL_TYPE_MODULE), strict && (flags |= EvalFlags2.JS_EVAL_FLAG_STRICT), strip && (flags |= EvalFlags2.JS_EVAL_FLAG_STRIP), compileOnly && (flags |= EvalFlags2.JS_EVAL_FLAG_COMPILE_ONLY), backtraceBarrier && (flags |= EvalFlags2.JS_EVAL_FLAG_BACKTRACE_BARRIER), flags;
398
408
  }
399
409
  function getOwnPropertyNamesOptionsToFlags(options) {
400
410
  if (typeof options == "number")
@@ -402,7 +412,7 @@ function getOwnPropertyNamesOptionsToFlags(options) {
402
412
  if (options === undefined)
403
413
  return 0;
404
414
  let { strings: includeStrings, symbols: includeSymbols, quickjsPrivate: includePrivate, onlyEnumerable, numbers: includeNumbers, numbersAsStrings } = options, flags = 0;
405
- return includeStrings && (flags |= GetOwnPropertyNamesFlags.JS_GPN_STRING_MASK), includeSymbols && (flags |= GetOwnPropertyNamesFlags.JS_GPN_SYMBOL_MASK), includePrivate && (flags |= GetOwnPropertyNamesFlags.JS_GPN_PRIVATE_MASK), onlyEnumerable && (flags |= GetOwnPropertyNamesFlags.JS_GPN_ENUM_ONLY), includeNumbers && (flags |= GetOwnPropertyNamesFlags.QTS_GPN_NUMBER_MASK), numbersAsStrings && (flags |= GetOwnPropertyNamesFlags.QTS_STANDARD_COMPLIANT_NUMBER), flags;
415
+ return includeStrings && (flags |= GetOwnPropertyNamesFlags2.JS_GPN_STRING_MASK), includeSymbols && (flags |= GetOwnPropertyNamesFlags2.JS_GPN_SYMBOL_MASK), includePrivate && (flags |= GetOwnPropertyNamesFlags2.JS_GPN_PRIVATE_MASK), onlyEnumerable && (flags |= GetOwnPropertyNamesFlags2.JS_GPN_ENUM_ONLY), includeNumbers && (flags |= GetOwnPropertyNamesFlags2.QTS_GPN_NUMBER_MASK), numbersAsStrings && (flags |= GetOwnPropertyNamesFlags2.QTS_STANDARD_COMPLIANT_NUMBER), flags;
406
416
  }
407
417
  function concat(...values) {
408
418
  let result = [];
@@ -410,7 +420,7 @@ function concat(...values) {
410
420
  value !== undefined && (result = result.concat(value));
411
421
  return result;
412
422
  }
413
- var QuickJSIterator = class extends UsingDisposable {
423
+ var QuickJSIterator = class extends UsingDisposable2 {
414
424
  constructor(handle, context) {
415
425
  super();
416
426
  this.handle = handle;
@@ -439,7 +449,7 @@ var QuickJSIterator = class extends UsingDisposable {
439
449
  throw(e) {
440
450
  if (!this.alive)
441
451
  return { done: true, value: undefined };
442
- let errorHandle = e instanceof Lifetime ? e : this.context.newError(e), throwMethod = this.context.getProp(this.handle, "throw"), result = this.callIteratorMethod(throwMethod, e);
452
+ let errorHandle = e instanceof Lifetime2 ? e : this.context.newError(e), throwMethod = this.context.getProp(this.handle, "throw"), result = this.callIteratorMethod(throwMethod, e);
443
453
  return errorHandle.alive && errorHandle.dispose(), throwMethod.dispose(), this.dispose(), result;
444
454
  }
445
455
  get alive() {
@@ -453,7 +463,7 @@ var QuickJSIterator = class extends UsingDisposable {
453
463
  if (callResult.error)
454
464
  return this.dispose(), { value: callResult };
455
465
  let done = this.context.getProp(callResult.value, "done").consume((v) => this.context.dump(v)), value = this.context.getProp(callResult.value, "value");
456
- return callResult.value.dispose(), done && this.dispose(), { value: DisposableResult.success(value), done };
466
+ return callResult.value.dispose(), done && this.dispose(), { value: DisposableResult2.success(value), done };
457
467
  }
458
468
  };
459
469
  var INT32_MIN = -2147483648;
@@ -499,7 +509,7 @@ var HostRefMap = class {
499
509
  return this.nextId++;
500
510
  }
501
511
  };
502
- var HostRef = class extends UsingDisposable {
512
+ var HostRef = class extends UsingDisposable2 {
503
513
  constructor(runtime, handle, id) {
504
514
  if (id === INVALID_HOST_REF_ID)
505
515
  throw new QuickJSHostRefInvalid("cannot create HostRef with undefined id");
@@ -521,7 +531,7 @@ var HostRef = class extends UsingDisposable {
521
531
  var ContextMemory = class extends ModuleMemory {
522
532
  constructor(args) {
523
533
  super(args.module);
524
- this.scope = new Scope;
534
+ this.scope = new Scope2;
525
535
  this.copyJSValue = (ptr) => this.ffi.QTS_DupValuePointer(this.ctx.value, ptr);
526
536
  this.freeJSValue = (ptr) => {
527
537
  this.ffi.QTS_FreeValuePointer(this.ctx.value, ptr);
@@ -548,13 +558,13 @@ var ContextMemory = class extends ModuleMemory {
548
558
  let dispose = extraDispose ? (val) => {
549
559
  extraDispose(), this.freeJSValue(val);
550
560
  } : this.freeJSValue;
551
- return new Lifetime(ptr, this.copyJSValue, dispose, this.owner);
561
+ return new Lifetime2(ptr, this.copyJSValue, dispose, this.owner);
552
562
  }
553
563
  staticHeapValueHandle(ptr) {
554
- return this.manage(this.heapValueHandle(ptr)), new StaticLifetime(ptr, this.owner);
564
+ return this.manage(this.heapValueHandle(ptr)), new StaticLifetime2(ptr, this.owner);
555
565
  }
556
566
  };
557
- var QuickJSContext = class extends UsingDisposable {
567
+ var QuickJSContext2 = class extends UsingDisposable2 {
558
568
  constructor(args) {
559
569
  super();
560
570
  this._undefined = undefined;
@@ -570,18 +580,18 @@ var QuickJSContext = class extends UsingDisposable {
570
580
  if (ctx !== this.ctx.value)
571
581
  throw new Error("QuickJSContext instance received C -> JS call with mismatched ctx");
572
582
  let fn = this.getFunction(fn_id);
573
- return Scope.withScopeMaybeAsync(this, function* (awaited, scope) {
574
- let thisHandle = scope.manage(new WeakLifetime(this_ptr, this.memory.copyJSValue, this.memory.freeJSValue, this.runtime)), argHandles = new Array(argc);
583
+ return Scope2.withScopeMaybeAsync(this, function* (awaited, scope) {
584
+ let thisHandle = scope.manage(new WeakLifetime2(this_ptr, this.memory.copyJSValue, this.memory.freeJSValue, this.runtime)), argHandles = new Array(argc);
575
585
  for (let i = 0;i < argc; i++) {
576
586
  let ptr = this.ffi.QTS_ArgvGetJSValueConstPointer(argv, i);
577
- argHandles[i] = scope.manage(new WeakLifetime(ptr, this.memory.copyJSValue, this.memory.freeJSValue, this.runtime));
587
+ argHandles[i] = scope.manage(new WeakLifetime2(ptr, this.memory.copyJSValue, this.memory.freeJSValue, this.runtime));
578
588
  }
579
589
  try {
580
590
  let result = yield* awaited(fn.apply(thisHandle, argHandles));
581
591
  if (result) {
582
592
  if ("error" in result && result.error)
583
593
  throw this.runtime.debugLog("throw error", result.error), result.error;
584
- let handle = scope.manage(result instanceof Lifetime ? result : result.value);
594
+ let handle = scope.manage(result instanceof Lifetime2 ? result : result.value);
585
595
  return this.ffi.QTS_DupValuePointer(this.ctx.value, handle.value);
586
596
  }
587
597
  return 0;
@@ -602,25 +612,25 @@ var QuickJSContext = class extends UsingDisposable {
602
612
  if (this._undefined)
603
613
  return this._undefined;
604
614
  let ptr = this.ffi.QTS_GetUndefined();
605
- return this._undefined = new StaticLifetime(ptr);
615
+ return this._undefined = new StaticLifetime2(ptr);
606
616
  }
607
617
  get null() {
608
618
  if (this._null)
609
619
  return this._null;
610
620
  let ptr = this.ffi.QTS_GetNull();
611
- return this._null = new StaticLifetime(ptr);
621
+ return this._null = new StaticLifetime2(ptr);
612
622
  }
613
623
  get true() {
614
624
  if (this._true)
615
625
  return this._true;
616
626
  let ptr = this.ffi.QTS_GetTrue();
617
- return this._true = new StaticLifetime(ptr);
627
+ return this._true = new StaticLifetime2(ptr);
618
628
  }
619
629
  get false() {
620
630
  if (this._false)
621
631
  return this._false;
622
632
  let ptr = this.ffi.QTS_GetFalse();
623
- return this._false = new StaticLifetime(ptr);
633
+ return this._false = new StaticLifetime2(ptr);
624
634
  }
625
635
  get global() {
626
636
  if (this._global)
@@ -649,7 +659,7 @@ var QuickJSContext = class extends UsingDisposable {
649
659
  newBigInt(num) {
650
660
  if (!this._BigInt) {
651
661
  let bigIntHandle2 = this.getProp(this.global, "BigInt");
652
- this.memory.manage(bigIntHandle2), this._BigInt = new StaticLifetime(bigIntHandle2.value, this.runtime);
662
+ this.memory.manage(bigIntHandle2), this._BigInt = new StaticLifetime2(bigIntHandle2.value, this.runtime);
653
663
  }
654
664
  let bigIntHandle = this._BigInt, asString = String(num);
655
665
  return this.newString(asString).consume((handle) => this.unwrapResult(this.callFunction(bigIntHandle, this.undefined, handle)));
@@ -668,11 +678,11 @@ var QuickJSContext = class extends UsingDisposable {
668
678
  return this.memory.heapValueHandle(ptr);
669
679
  }
670
680
  newPromise(value) {
671
- let deferredPromise = Scope.withScope((scope) => {
681
+ let deferredPromise = Scope2.withScope((scope) => {
672
682
  let mutablePointerArray = scope.manage(this.memory.newMutablePointerArray(2)), promisePtr = this.ffi.QTS_NewPromiseCapability(this.ctx.value, mutablePointerArray.value.ptr), promiseHandle = this.memory.heapValueHandle(promisePtr), [resolveHandle, rejectHandle] = Array.from(mutablePointerArray.value.typedArray).map((jsvaluePtr) => this.memory.heapValueHandle(jsvaluePtr));
673
- return new QuickJSDeferredPromise({ context: this, promiseHandle, resolveHandle, rejectHandle });
683
+ return new QuickJSDeferredPromise2({ context: this, promiseHandle, resolveHandle, rejectHandle });
674
684
  });
675
- return value && typeof value == "function" && (value = new Promise(value)), value && Promise.resolve(value).then(deferredPromise.resolve, (error) => error instanceof Lifetime ? deferredPromise.reject(error) : this.newError(error).consume(deferredPromise.reject)), deferredPromise;
685
+ return value && typeof value == "function" && (value = new Promise(value)), value && Promise.resolve(value).then(deferredPromise.resolve, (error) => error instanceof Lifetime2 ? deferredPromise.reject(error) : this.newError(error).consume(deferredPromise.reject)), deferredPromise;
676
686
  }
677
687
  newFunction(nameOrFn, maybeFn) {
678
688
  let fn = typeof nameOrFn == "function" ? nameOrFn : maybeFn;
@@ -742,32 +752,32 @@ var QuickJSContext = class extends UsingDisposable {
742
752
  let len = this.ffi.QTS_GetArrayBufferLength(this.ctx.value, handle.value), ptr = this.ffi.QTS_GetArrayBuffer(this.ctx.value, handle.value);
743
753
  if (!ptr)
744
754
  throw new Error("Couldn't allocate memory to get ArrayBuffer");
745
- return new Lifetime(this.module.HEAPU8.subarray(ptr, ptr + len), undefined, () => this.module._free(ptr));
755
+ return new Lifetime2(this.module.HEAPU8.subarray(ptr, ptr + len), undefined, () => this.module._free(ptr));
746
756
  }
747
757
  getPromiseState(handle) {
748
758
  this.runtime.assertOwned(handle);
749
759
  let state = this.ffi.QTS_PromiseState(this.ctx.value, handle.value);
750
760
  if (state < 0)
751
761
  return { type: "fulfilled", value: handle, notAPromise: true };
752
- if (state === JSPromiseStateEnum.Pending)
762
+ if (state === JSPromiseStateEnum2.Pending)
753
763
  return { type: "pending", get error() {
754
764
  return new QuickJSPromisePending("Cannot unwrap a pending promise");
755
765
  } };
756
766
  let ptr = this.ffi.QTS_PromiseResult(this.ctx.value, handle.value), result = this.memory.heapValueHandle(ptr);
757
- if (state === JSPromiseStateEnum.Fulfilled)
767
+ if (state === JSPromiseStateEnum2.Fulfilled)
758
768
  return { type: "fulfilled", value: result };
759
- if (state === JSPromiseStateEnum.Rejected)
769
+ if (state === JSPromiseStateEnum2.Rejected)
760
770
  return { type: "rejected", error: result };
761
771
  throw result.dispose(), new Error(`Unknown JSPromiseStateEnum: ${state}`);
762
772
  }
763
773
  resolvePromise(promiseLikeHandle) {
764
774
  this.runtime.assertOwned(promiseLikeHandle);
765
- let vmResolveResult = Scope.withScope((scope) => {
775
+ let vmResolveResult = Scope2.withScope((scope) => {
766
776
  let vmPromise = scope.manage(this.getProp(this.global, "Promise")), vmPromiseResolve = scope.manage(this.getProp(vmPromise, "resolve"));
767
777
  return this.callFunction(vmPromiseResolve, vmPromise, promiseLikeHandle);
768
778
  });
769
779
  return vmResolveResult.error ? Promise.resolve(vmResolveResult) : new Promise((resolve) => {
770
- Scope.withScope((scope) => {
780
+ Scope2.withScope((scope) => {
771
781
  let resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
772
782
  resolve(this.success(value && value.dup()));
773
783
  })), rejectHandle = scope.manage(this.newFunction("reject", (error) => {
@@ -777,7 +787,7 @@ var QuickJSContext = class extends UsingDisposable {
777
787
  });
778
788
  });
779
789
  }
780
- isEqual(a, b, equalityType = IsEqualOp.IsStrictlyEqual) {
790
+ isEqual(a, b, equalityType = IsEqualOp2.IsStrictlyEqual) {
781
791
  if (a === b)
782
792
  return true;
783
793
  this.runtime.assertOwned(a), this.runtime.assertOwned(b);
@@ -787,13 +797,13 @@ var QuickJSContext = class extends UsingDisposable {
787
797
  return !!result;
788
798
  }
789
799
  eq(handle, other) {
790
- return this.isEqual(handle, other, IsEqualOp.IsStrictlyEqual);
800
+ return this.isEqual(handle, other, IsEqualOp2.IsStrictlyEqual);
791
801
  }
792
802
  sameValue(handle, other) {
793
- return this.isEqual(handle, other, IsEqualOp.IsSameValue);
803
+ return this.isEqual(handle, other, IsEqualOp2.IsSameValue);
794
804
  }
795
805
  sameValueZero(handle, other) {
796
- return this.isEqual(handle, other, IsEqualOp.IsSameValueZero);
806
+ return this.isEqual(handle, other, IsEqualOp2.IsSameValueZero);
797
807
  }
798
808
  getProp(handle, key) {
799
809
  this.runtime.assertOwned(handle);
@@ -809,17 +819,17 @@ var QuickJSContext = class extends UsingDisposable {
809
819
  let flags = getOwnPropertyNamesOptionsToFlags(options);
810
820
  if (flags === 0)
811
821
  throw new QuickJSEmptyGetOwnPropertyNames("No options set, will return an empty array");
812
- return Scope.withScope((scope) => {
822
+ return Scope2.withScope((scope) => {
813
823
  let outPtr = scope.manage(this.memory.newMutablePointerArray(1)), errorPtr = this.ffi.QTS_GetOwnPropertyNames(this.ctx.value, outPtr.value.ptr, this.uint32Out.value.ptr, handle.value, flags);
814
824
  if (errorPtr)
815
825
  return this.fail(this.memory.heapValueHandle(errorPtr));
816
826
  let len = this.uint32Out.value.typedArray[0], ptr = outPtr.value.typedArray[0], pointerArray = new Uint32Array(this.module.HEAP8.buffer, ptr, len), handles = Array.from(pointerArray).map((ptr2) => this.memory.heapValueHandle(ptr2));
817
- return this.ffi.QTS_FreeVoidPointer(this.ctx.value, ptr), this.success(createDisposableArray(handles));
827
+ return this.ffi.QTS_FreeVoidPointer(this.ctx.value, ptr), this.success(createDisposableArray2(handles));
818
828
  });
819
829
  }
820
830
  getIterator(iterableHandle) {
821
831
  let SymbolIterator = this._SymbolIterator ?? (this._SymbolIterator = this.memory.manage(this.getWellKnownSymbol("iterator")));
822
- return Scope.withScope((scope) => {
832
+ return Scope2.withScope((scope) => {
823
833
  let methodHandle = scope.manage(this.getProp(iterableHandle, SymbolIterator)), iteratorCallResult = this.callFunction(methodHandle, iterableHandle);
824
834
  return iteratorCallResult.error ? iteratorCallResult : this.success(new QuickJSIterator(iteratorCallResult.value, this));
825
835
  });
@@ -828,7 +838,7 @@ var QuickJSContext = class extends UsingDisposable {
828
838
  this.runtime.assertOwned(handle), this.borrowPropertyKey(key).consume((quickJSKey) => this.ffi.QTS_SetProp(this.ctx.value, handle.value, quickJSKey.value, value.value));
829
839
  }
830
840
  defineProp(handle, key, descriptor) {
831
- this.runtime.assertOwned(handle), Scope.withScope((scope) => {
841
+ this.runtime.assertOwned(handle), Scope2.withScope((scope) => {
832
842
  let quickJSKey = scope.manage(this.borrowPropertyKey(key)), value = descriptor.value || this.undefined, configurable = !!descriptor.configurable, enumerable = !!descriptor.enumerable, hasValue = !!descriptor.value, get = descriptor.get ? scope.manage(this.newFunction(descriptor.get.name, descriptor.get)) : this.undefined, set = descriptor.set ? scope.manage(this.newFunction(descriptor.set.name, descriptor.set)) : this.undefined;
833
843
  this.ffi.QTS_DefineProp(this.ctx.value, handle.value, quickJSKey.value, value.value, get.value, set.value, configurable, enumerable, hasValue);
834
844
  });
@@ -851,7 +861,7 @@ var QuickJSContext = class extends UsingDisposable {
851
861
  return this.errorToHandle(error).consume((handle) => this.ffi.QTS_Throw(this.ctx.value, handle.value));
852
862
  }
853
863
  borrowPropertyKey(key) {
854
- return typeof key == "number" ? this.newNumber(key) : typeof key == "string" ? this.newString(key) : new StaticLifetime(key.value, this.runtime);
864
+ return typeof key == "number" ? this.newNumber(key) : typeof key == "string" ? this.newString(key) : new StaticLifetime2(key.value, this.runtime);
855
865
  }
856
866
  getMemory(rt) {
857
867
  if (rt === this.rt.value)
@@ -909,7 +919,7 @@ ${cause.stack}Host: ${hostStack}`), Object.assign(exception, rest), exception;
909
919
  return fn;
910
920
  }
911
921
  errorToHandle(error) {
912
- return error instanceof Lifetime ? error : this.newError(error);
922
+ return error instanceof Lifetime2 ? error : this.newError(error);
913
923
  }
914
924
  encodeBinaryJSON(handle) {
915
925
  let ptr = this.ffi.QTS_bjson_encode(this.ctx.value, handle.value);
@@ -920,16 +930,16 @@ ${cause.stack}Host: ${hostStack}`), Object.assign(exception, rest), exception;
920
930
  return this.memory.heapValueHandle(ptr);
921
931
  }
922
932
  success(value) {
923
- return DisposableResult.success(value);
933
+ return DisposableResult2.success(value);
924
934
  }
925
935
  fail(error) {
926
- return DisposableResult.fail(error, (error2) => this.unwrapResult(error2));
936
+ return DisposableResult2.fail(error, (error2) => this.unwrapResult(error2));
927
937
  }
928
938
  };
929
- var QuickJSRuntime = class extends UsingDisposable {
939
+ var QuickJSRuntime2 = class extends UsingDisposable2 {
930
940
  constructor(args) {
931
941
  super();
932
- this.scope = new Scope;
942
+ this.scope = new Scope2;
933
943
  this.contextMap = new Map;
934
944
  this.hostRefs = new HostRefMap;
935
945
  this._debugMode = false;
@@ -986,9 +996,9 @@ var QuickJSRuntime = class extends UsingDisposable {
986
996
  return this.scope.dispose();
987
997
  }
988
998
  newContext(options = {}) {
989
- let intrinsics = intrinsicsToFlags(options.intrinsics), ctx = new Lifetime(options.contextPointer || this.ffi.QTS_NewContext(this.rt.value, intrinsics), undefined, (ctx_ptr) => {
999
+ let intrinsics = intrinsicsToFlags(options.intrinsics), ctx = new Lifetime2(options.contextPointer || this.ffi.QTS_NewContext(this.rt.value, intrinsics), undefined, (ctx_ptr) => {
990
1000
  this.contextMap.delete(ctx_ptr), this.callbacks.deleteContext(ctx_ptr), this.ffi.QTS_FreeContext(ctx_ptr);
991
- }), context = new QuickJSContext({ module: this.module, ctx, ffi: this.ffi, rt: this.rt, ownedLifetimes: options.ownedLifetimes, runtime: this, callbacks: this.callbacks });
1001
+ }), context = new QuickJSContext2({ module: this.module, ctx, ffi: this.ffi, rt: this.rt, ownedLifetimes: options.ownedLifetimes, runtime: this, callbacks: this.callbacks });
992
1002
  return this.contextMap.set(ctx.value, context), context;
993
1003
  }
994
1004
  setModuleLoader(moduleLoader, moduleNormalizer) {
@@ -1010,14 +1020,14 @@ var QuickJSRuntime = class extends UsingDisposable {
1010
1020
  executePendingJobs(maxJobsToExecute = -1) {
1011
1021
  let ctxPtrOut = this.memory.newMutablePointerArray(1), valuePtr = this.ffi.QTS_ExecutePendingJob(this.rt.value, maxJobsToExecute ?? -1, ctxPtrOut.value.ptr), ctxPtr = ctxPtrOut.value.typedArray[0];
1012
1022
  if (ctxPtrOut.dispose(), ctxPtr === 0)
1013
- return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value, valuePtr), DisposableResult.success(0);
1023
+ return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value, valuePtr), DisposableResult2.success(0);
1014
1024
  let context = this.contextMap.get(ctxPtr) ?? this.newContext({ contextPointer: ctxPtr }), resultValue = context.getMemory(this.rt.value).heapValueHandle(valuePtr);
1015
1025
  if (context.typeof(resultValue) === "number") {
1016
1026
  let executedJobs = context.getNumber(resultValue);
1017
- return resultValue.dispose(), DisposableResult.success(executedJobs);
1027
+ return resultValue.dispose(), DisposableResult2.success(executedJobs);
1018
1028
  } else {
1019
1029
  let error = Object.assign(resultValue, { context });
1020
- return DisposableResult.fail(error, (error2) => context.unwrapResult(error2));
1030
+ return DisposableResult2.fail(error, (error2) => context.unwrapResult(error2));
1021
1031
  }
1022
1032
  }
1023
1033
  setMemoryLimit(limitBytes) {
@@ -1062,7 +1072,7 @@ var QuickJSEmscriptenModuleCallbacks = class {
1062
1072
  this.freeHostRef = args.freeHostRef, this.callFunction = args.callFunction, this.shouldInterrupt = args.shouldInterrupt, this.loadModuleSource = args.loadModuleSource, this.normalizeModule = args.normalizeModule;
1063
1073
  }
1064
1074
  };
1065
- var QuickJSModuleCallbacks = class {
1075
+ var QuickJSModuleCallbacks2 = class {
1066
1076
  constructor(module) {
1067
1077
  this.contextCallbacks = new Map;
1068
1078
  this.runtimeCallbacks = new Map;
@@ -1135,19 +1145,19 @@ var QuickJSModuleCallbacks = class {
1135
1145
  try {
1136
1146
  let result = fn();
1137
1147
  if (!(result instanceof Promise)) {
1138
- debugLog("asyncify.handleSleep: not suspending:", result), done(result);
1148
+ debugLog2("asyncify.handleSleep: not suspending:", result), done(result);
1139
1149
  return;
1140
1150
  }
1141
1151
  if (this.suspended)
1142
1152
  throw new QuickJSAsyncifyError(`Already suspended at: ${this.suspended.stack}
1143
1153
  Attempted to suspend at:`);
1144
- this.suspended = new QuickJSAsyncifySuspended(`(${this.suspendedCount++})`), debugLog("asyncify.handleSleep: suspending:", this.suspended), result.then((resolvedResult) => {
1145
- this.suspended = undefined, debugLog("asyncify.handleSleep: resolved:", resolvedResult), done(resolvedResult);
1154
+ this.suspended = new QuickJSAsyncifySuspended(`(${this.suspendedCount++})`), debugLog2("asyncify.handleSleep: suspending:", this.suspended), result.then((resolvedResult) => {
1155
+ this.suspended = undefined, debugLog2("asyncify.handleSleep: resolved:", resolvedResult), done(resolvedResult);
1146
1156
  }, (error) => {
1147
- debugLog("asyncify.handleSleep: rejected:", error), console.error("QuickJS: cannot handle error in suspended function", error), this.suspended = undefined;
1157
+ debugLog2("asyncify.handleSleep: rejected:", error), console.error("QuickJS: cannot handle error in suspended function", error), this.suspended = undefined;
1148
1158
  });
1149
1159
  } catch (error) {
1150
- throw debugLog("asyncify.handleSleep: error:", error), this.suspended = undefined, error;
1160
+ throw debugLog2("asyncify.handleSleep: error:", error), this.suspended = undefined, error;
1151
1161
  }
1152
1162
  });
1153
1163
  let value = fn();
@@ -1156,30 +1166,30 @@ Attempted to suspend at:`);
1156
1166
  return value;
1157
1167
  }
1158
1168
  };
1159
- function applyBaseRuntimeOptions(runtime, options) {
1169
+ function applyBaseRuntimeOptions2(runtime, options) {
1160
1170
  options.interruptHandler && runtime.setInterruptHandler(options.interruptHandler), options.maxStackSizeBytes !== undefined && runtime.setMaxStackSize(options.maxStackSizeBytes), options.memoryLimitBytes !== undefined && runtime.setMemoryLimit(options.memoryLimitBytes);
1161
1171
  }
1162
- function applyModuleEvalRuntimeOptions(runtime, options) {
1172
+ function applyModuleEvalRuntimeOptions2(runtime, options) {
1163
1173
  options.moduleLoader && runtime.setModuleLoader(options.moduleLoader), options.shouldInterrupt && runtime.setInterruptHandler(options.shouldInterrupt), options.memoryLimitBytes !== undefined && runtime.setMemoryLimit(options.memoryLimitBytes), options.maxStackSizeBytes !== undefined && runtime.setMaxStackSize(options.maxStackSizeBytes);
1164
1174
  }
1165
- var QuickJSWASMModule = class {
1175
+ var QuickJSWASMModule2 = class {
1166
1176
  constructor(module, ffi) {
1167
- this.module = module, this.ffi = ffi, this.callbacks = new QuickJSModuleCallbacks(module);
1177
+ this.module = module, this.ffi = ffi, this.callbacks = new QuickJSModuleCallbacks2(module);
1168
1178
  }
1169
1179
  newRuntime(options = {}) {
1170
- let rt = new Lifetime(this.ffi.QTS_NewRuntime(), undefined, (rt_ptr) => {
1180
+ let rt = new Lifetime2(this.ffi.QTS_NewRuntime(), undefined, (rt_ptr) => {
1171
1181
  this.ffi.QTS_FreeRuntime(rt_ptr), this.callbacks.deleteRuntime(rt_ptr);
1172
- }), runtime = new QuickJSRuntime({ module: this.module, callbacks: this.callbacks, ffi: this.ffi, rt });
1173
- return applyBaseRuntimeOptions(runtime, options), options.moduleLoader && runtime.setModuleLoader(options.moduleLoader), runtime;
1182
+ }), runtime = new QuickJSRuntime2({ module: this.module, callbacks: this.callbacks, ffi: this.ffi, rt });
1183
+ return applyBaseRuntimeOptions2(runtime, options), options.moduleLoader && runtime.setModuleLoader(options.moduleLoader), runtime;
1174
1184
  }
1175
1185
  newContext(options = {}) {
1176
1186
  let runtime = this.newRuntime(), context = runtime.newContext({ ...options, ownedLifetimes: concat(runtime, options.ownedLifetimes) });
1177
1187
  return runtime.context = context, context;
1178
1188
  }
1179
1189
  evalCode(code, options = {}) {
1180
- return Scope.withScope((scope) => {
1190
+ return Scope2.withScope((scope) => {
1181
1191
  let vm = scope.manage(this.newContext());
1182
- applyModuleEvalRuntimeOptions(vm.runtime, options);
1192
+ applyModuleEvalRuntimeOptions2(vm.runtime, options);
1183
1193
  let result = vm.evalCode(code, "eval.js");
1184
1194
  if (options.memoryLimitBytes !== undefined && vm.runtime.setMemoryLimit(-1), result.error)
1185
1195
  throw vm.dump(scope.manage(result.error));
@@ -1198,7 +1208,7 @@ var QuickJSWASMModule = class {
1198
1208
  };
1199
1209
 
1200
1210
  // ../../node_modules/.bun/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/chunk-TAV5CUKK.mjs
1201
- var QuickJSAsyncContext = class extends QuickJSContext {
1211
+ var QuickJSAsyncContext2 = class extends QuickJSContext2 {
1202
1212
  async evalCodeAsync(code, filename = "eval.js", options) {
1203
1213
  let detectModule = options === undefined ? 1 : 0, flags = evalOptionsToFlags(options), resultPtr = 0;
1204
1214
  try {
@@ -1213,14 +1223,14 @@ var QuickJSAsyncContext = class extends QuickJSContext {
1213
1223
  return this.newFunction(name, fn);
1214
1224
  }
1215
1225
  };
1216
- var QuickJSAsyncRuntime = class extends QuickJSRuntime {
1226
+ var QuickJSAsyncRuntime2 = class extends QuickJSRuntime2 {
1217
1227
  constructor(args) {
1218
1228
  super(args);
1219
1229
  }
1220
1230
  newContext(options = {}) {
1221
- let intrinsics = intrinsicsToFlags(options.intrinsics), ctx = new Lifetime(this.ffi.QTS_NewContext(this.rt.value, intrinsics), undefined, (ctx_ptr) => {
1231
+ let intrinsics = intrinsicsToFlags(options.intrinsics), ctx = new Lifetime2(this.ffi.QTS_NewContext(this.rt.value, intrinsics), undefined, (ctx_ptr) => {
1222
1232
  this.contextMap.delete(ctx_ptr), this.callbacks.deleteContext(ctx_ptr), this.ffi.QTS_FreeContext(ctx_ptr);
1223
- }), context = new QuickJSAsyncContext({ module: this.module, ctx, ffi: this.ffi, rt: this.rt, ownedLifetimes: [], runtime: this, callbacks: this.callbacks });
1233
+ }), context = new QuickJSAsyncContext2({ module: this.module, ctx, ffi: this.ffi, rt: this.rt, ownedLifetimes: [], runtime: this, callbacks: this.callbacks });
1224
1234
  return this.contextMap.set(ctx.value, context), context;
1225
1235
  }
1226
1236
  setModuleLoader(moduleLoader, moduleNormalizer) {
@@ -1230,16 +1240,16 @@ var QuickJSAsyncRuntime = class extends QuickJSRuntime {
1230
1240
  return super.setMaxStackSize(stackSize);
1231
1241
  }
1232
1242
  };
1233
- var QuickJSAsyncWASMModule = class extends QuickJSWASMModule {
1243
+ var QuickJSAsyncWASMModule2 = class extends QuickJSWASMModule2 {
1234
1244
  constructor(module, ffi) {
1235
1245
  super(module, ffi);
1236
1246
  this.ffi = ffi, this.module = module;
1237
1247
  }
1238
1248
  newRuntime(options = {}) {
1239
- let rt = new Lifetime(this.ffi.QTS_NewRuntime(), undefined, (rt_ptr) => {
1249
+ let rt = new Lifetime2(this.ffi.QTS_NewRuntime(), undefined, (rt_ptr) => {
1240
1250
  this.callbacks.deleteRuntime(rt_ptr), this.ffi.QTS_FreeRuntime(rt_ptr);
1241
- }), runtime = new QuickJSAsyncRuntime({ module: this.module, ffi: this.ffi, rt, callbacks: this.callbacks });
1242
- return applyBaseRuntimeOptions(runtime, options), options.moduleLoader && runtime.setModuleLoader(options.moduleLoader), runtime;
1251
+ }), runtime = new QuickJSAsyncRuntime2({ module: this.module, ffi: this.ffi, rt, callbacks: this.callbacks });
1252
+ return applyBaseRuntimeOptions2(runtime, options), options.moduleLoader && runtime.setModuleLoader(options.moduleLoader), runtime;
1243
1253
  }
1244
1254
  newContext(options = {}) {
1245
1255
  let runtime = this.newRuntime(), lifetimes = options.ownedLifetimes ? options.ownedLifetimes.concat([runtime]) : [runtime], context = runtime.newContext({ ...options, ownedLifetimes: lifetimes });
@@ -1249,9 +1259,9 @@ var QuickJSAsyncWASMModule = class extends QuickJSWASMModule {
1249
1259
  throw new QuickJSNotImplemented("QuickJSWASMModuleAsyncify.evalCode: use evalCodeAsync instead");
1250
1260
  }
1251
1261
  evalCodeAsync(code, options) {
1252
- return Scope.withScopeAsync(async (scope) => {
1262
+ return Scope2.withScopeAsync(async (scope) => {
1253
1263
  let vm = scope.manage(this.newContext());
1254
- applyModuleEvalRuntimeOptions(vm.runtime, options);
1264
+ applyModuleEvalRuntimeOptions2(vm.runtime, options);
1255
1265
  let result = await vm.evalCodeAsync(code, "eval.js");
1256
1266
  if (options.memoryLimitBytes !== undefined && vm.runtime.setMemoryLimit(-1), result.error)
1257
1267
  throw vm.dump(scope.manage(result.error));
@@ -1259,6 +1269,5 @@ var QuickJSAsyncWASMModule = class extends QuickJSWASMModule {
1259
1269
  });
1260
1270
  }
1261
1271
  };
1262
- export {
1263
- QuickJSAsyncWASMModule
1264
- };
1272
+
1273
+ export { assertSync2, EvalFlags2, IntrinsicsFlags2, JSPromiseStateEnum2, GetOwnPropertyNamesFlags2, IsEqualOp2, setDebugMode2, debugLog2, errors_exports, QuickJSMemoryLeakDetected, QuickJSEmscriptenModuleError, UsingDisposable2, Lifetime2, StaticLifetime2, WeakLifetime2, Scope2, createDisposableArray2, DisposableSuccess2, DisposableFail2, DisposableResult2, QuickJSDeferredPromise2, DefaultIntrinsics2, QuickJSContext2, QuickJSRuntime2, QuickJSModuleCallbacks2, applyBaseRuntimeOptions2, applyModuleEvalRuntimeOptions2, QuickJSWASMModule2, QuickJSAsyncContext2, QuickJSAsyncRuntime2, QuickJSAsyncWASMModule2 };