emnapi 0.38.2 → 0.39.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.
@@ -62,7 +62,7 @@ var emnapiAWST = {
62
62
  var envObject = emnapiCtx.envStore.get(env);
63
63
  var scope = emnapiCtx.openScope(envObject);
64
64
  try {
65
- envObject.callIntoModule(function () {
65
+ envObject.callbackIntoModule(true, function () {
66
66
  {{{ makeDynCall('vpip', 'complete') }}}(env, status, data);
67
67
  });
68
68
  }
@@ -154,6 +154,9 @@ function _emnapi_create_memory_view(env, typedarray_type, external_data, byte_le
154
154
  var envObject_1 = emnapiCtx.envStore.get(env);
155
155
  if (envObject_1.tryCatch.hasCaught())
156
156
  return envObject_1.setLastError(10 /* napi_status.napi_pending_exception */);
157
+ if (!envObject_1.canCallIntoJs()) {
158
+ return envObject_1.setLastError(envObject_1.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
159
+ }
157
160
  envObject_1.clearLastError();
158
161
  try {
159
162
  if (result == 0)
@@ -311,6 +314,9 @@ function emnapi_sync_memory(env, js_to_wasm, arraybuffer_or_view, offset, len) {
311
314
  var envObject_2 = emnapiCtx.envStore.get(env);
312
315
  if (envObject_2.tryCatch.hasCaught())
313
316
  return envObject_2.setLastError(10 /* napi_status.napi_pending_exception */);
317
+ if (!envObject_2.canCallIntoJs()) {
318
+ return envObject_2.setLastError(envObject_2.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
319
+ }
314
320
  envObject_2.clearLastError();
315
321
  try {
316
322
  if (arraybuffer_or_view == 0)
@@ -366,6 +372,9 @@ function emnapi_get_memory_address(env, arraybuffer_or_view, address, ownership,
366
372
  var envObject_3 = emnapiCtx.envStore.get(env);
367
373
  if (envObject_3.tryCatch.hasCaught())
368
374
  return envObject_3.setLastError(10 /* napi_status.napi_pending_exception */);
375
+ if (!envObject_3.canCallIntoJs()) {
376
+ return envObject_3.setLastError(envObject_3.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
377
+ }
369
378
  envObject_3.clearLastError();
370
379
  try {
371
380
  if (arraybuffer_or_view == 0)
@@ -453,15 +462,20 @@ function napi_throw(env, error) {
453
462
  var envObject_4 = emnapiCtx.envStore.get(env);
454
463
  if (envObject_4.tryCatch.hasCaught())
455
464
  return envObject_4.setLastError(10 /* napi_status.napi_pending_exception */);
465
+ if (!envObject_4.canCallIntoJs()) {
466
+ return envObject_4.setLastError(envObject_4.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
467
+ }
456
468
  envObject_4.clearLastError();
457
469
  try {
458
470
  if (error == 0)
459
471
  return envObject_4.setLastError(1 /* napi_status.napi_invalid_arg */);
460
472
  envObject_4.tryCatch.setError(emnapiCtx.handleStore.get(error).value);
461
473
  return envObject_4.clearLastError();
462
- } // @ts-expect-error
474
+ }
463
475
  catch (err_5) {
464
- envObject_4.tryCatch.setError(err_5);
476
+ envObject_4.tryCatch.
477
+ // @ts-expect-error
478
+ setError(err_5);
465
479
  return envObject_4.setLastError(10 /* napi_status.napi_pending_exception */);
466
480
  }
467
481
  }
@@ -472,6 +486,9 @@ function napi_throw_error(env, code, msg) {
472
486
  var envObject_5 = emnapiCtx.envStore.get(env);
473
487
  if (envObject_5.tryCatch.hasCaught())
474
488
  return envObject_5.setLastError(10 /* napi_status.napi_pending_exception */);
489
+ if (!envObject_5.canCallIntoJs()) {
490
+ return envObject_5.setLastError(envObject_5.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
491
+ }
475
492
  envObject_5.clearLastError();
476
493
  try {
477
494
  if (msg == 0)
@@ -484,9 +501,11 @@ function napi_throw_error(env, code, msg) {
484
501
  }
485
502
  envObject_5.tryCatch.setError(error_1);
486
503
  return envObject_5.clearLastError();
487
- } // @ts-expect-error
504
+ }
488
505
  catch (err_6) {
489
- envObject_5.tryCatch.setError(err_6);
506
+ envObject_5.tryCatch.
507
+ // @ts-expect-error
508
+ setError(err_6);
490
509
  return envObject_5.setLastError(10 /* napi_status.napi_pending_exception */);
491
510
  }
492
511
  }
@@ -497,6 +516,9 @@ function napi_throw_type_error(env, code, msg) {
497
516
  var envObject_6 = emnapiCtx.envStore.get(env);
498
517
  if (envObject_6.tryCatch.hasCaught())
499
518
  return envObject_6.setLastError(10 /* napi_status.napi_pending_exception */);
519
+ if (!envObject_6.canCallIntoJs()) {
520
+ return envObject_6.setLastError(envObject_6.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
521
+ }
500
522
  envObject_6.clearLastError();
501
523
  try {
502
524
  if (msg == 0)
@@ -509,9 +531,11 @@ function napi_throw_type_error(env, code, msg) {
509
531
  }
510
532
  envObject_6.tryCatch.setError(error_2);
511
533
  return envObject_6.clearLastError();
512
- } // @ts-expect-error
534
+ }
513
535
  catch (err_7) {
514
- envObject_6.tryCatch.setError(err_7);
536
+ envObject_6.tryCatch.
537
+ // @ts-expect-error
538
+ setError(err_7);
515
539
  return envObject_6.setLastError(10 /* napi_status.napi_pending_exception */);
516
540
  }
517
541
  }
@@ -522,6 +546,9 @@ function napi_throw_range_error(env, code, msg) {
522
546
  var envObject_7 = emnapiCtx.envStore.get(env);
523
547
  if (envObject_7.tryCatch.hasCaught())
524
548
  return envObject_7.setLastError(10 /* napi_status.napi_pending_exception */);
549
+ if (!envObject_7.canCallIntoJs()) {
550
+ return envObject_7.setLastError(envObject_7.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
551
+ }
525
552
  envObject_7.clearLastError();
526
553
  try {
527
554
  if (msg == 0)
@@ -534,9 +561,11 @@ function napi_throw_range_error(env, code, msg) {
534
561
  }
535
562
  envObject_7.tryCatch.setError(error_3);
536
563
  return envObject_7.clearLastError();
537
- } // @ts-expect-error
564
+ }
538
565
  catch (err_8) {
539
- envObject_7.tryCatch.setError(err_8);
566
+ envObject_7.tryCatch.
567
+ // @ts-expect-error
568
+ setError(err_8);
540
569
  return envObject_7.setLastError(10 /* napi_status.napi_pending_exception */);
541
570
  }
542
571
  }
@@ -547,6 +576,9 @@ function node_api_throw_syntax_error(env, code, msg) {
547
576
  var envObject_8 = emnapiCtx.envStore.get(env);
548
577
  if (envObject_8.tryCatch.hasCaught())
549
578
  return envObject_8.setLastError(10 /* napi_status.napi_pending_exception */);
579
+ if (!envObject_8.canCallIntoJs()) {
580
+ return envObject_8.setLastError(envObject_8.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
581
+ }
550
582
  envObject_8.clearLastError();
551
583
  try {
552
584
  if (msg == 0)
@@ -559,9 +591,11 @@ function node_api_throw_syntax_error(env, code, msg) {
559
591
  }
560
592
  envObject_8.tryCatch.setError(error_4);
561
593
  return envObject_8.clearLastError();
562
- } // @ts-expect-error
594
+ }
563
595
  catch (err_9) {
564
- envObject_8.tryCatch.setError(err_9);
596
+ envObject_8.tryCatch.
597
+ // @ts-expect-error
598
+ setError(err_9);
565
599
  return envObject_8.setLastError(10 /* napi_status.napi_pending_exception */);
566
600
  }
567
601
  }
@@ -706,10 +740,14 @@ function napi_fatal_error(location, location_len, message, message_len) {
706
740
  {{{ from64('location_len') }}};
707
741
  {{{ from64('message') }}};
708
742
  {{{ from64('message_len') }}};
709
- abort('FATAL ERROR: ' +
710
- emnapiString.UTF8ToString(location, location_len) +
711
- ' ' +
712
- emnapiString.UTF8ToString(message, message_len));
743
+ var locationStr = emnapiString.UTF8ToString(location, location_len);
744
+ var messageStr = emnapiString.UTF8ToString(message, message_len);
745
+ if (emnapiNodeBinding) {
746
+ emnapiNodeBinding.napi.fatalError(locationStr, messageStr);
747
+ }
748
+ else {
749
+ abort('FATAL ERROR: ' + locationStr + ' ' + messageStr);
750
+ }
713
751
  }
714
752
  // @ts-expect-error
715
753
  function napi_fatal_exception(env, err) {
@@ -718,19 +756,26 @@ function napi_fatal_exception(env, err) {
718
756
  var envObject_9 = emnapiCtx.envStore.get(env);
719
757
  if (envObject_9.tryCatch.hasCaught())
720
758
  return envObject_9.setLastError(10 /* napi_status.napi_pending_exception */);
759
+ if (!envObject_9.canCallIntoJs()) {
760
+ return envObject_9.setLastError(envObject_9.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
761
+ }
721
762
  envObject_9.clearLastError();
722
763
  try {
723
764
  if (err == 0)
724
765
  return envObject_9.setLastError(1 /* napi_status.napi_invalid_arg */);
725
- if (typeof process === "object" && process !== null && typeof process._fatalException === "function") {
726
- var error_5 = envObject_9.ctx.handleStore.get(err);
727
- process._fatalException(error_5.value);
728
- return envObject_9.clearLastError();
766
+ var error_5 = envObject_9.ctx.handleStore.get(err);
767
+ try {
768
+ (envObject_9).triggerFatalException(error_5.value);
729
769
  }
730
- return envObject_9.setLastError(9 /* napi_status.napi_generic_failure */);
731
- } // @ts-expect-error
770
+ catch (_1) {
771
+ return envObject_9.setLastError(9 /* napi_status.napi_generic_failure */);
772
+ }
773
+ return envObject_9.clearLastError();
774
+ }
732
775
  catch (err_10) {
733
- envObject_9.tryCatch.setError(err_10);
776
+ envObject_9.tryCatch.
777
+ // @ts-expect-error
778
+ setError(err_10);
734
779
  return envObject_9.setLastError(10 /* napi_status.napi_pending_exception */);
735
780
  }
736
781
  }
@@ -758,6 +803,9 @@ function napi_create_function(env, utf8name, length, cb, data, result) {
758
803
  .envStore.get(env);
759
804
  if (envObject_10.tryCatch.hasCaught())
760
805
  return envObject_10.setLastError(10 /* napi_status.napi_pending_exception */);
806
+ if (!envObject_10.canCallIntoJs()) {
807
+ return envObject_10.setLastError(envObject_10.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
808
+ }
761
809
  envObject_10.clearLastError();
762
810
  try {
763
811
  if (result == 0)
@@ -833,6 +881,9 @@ function napi_call_function(env, recv, func, argc, argv, result
833
881
  .envStore.get(env);
834
882
  if (envObject_11.tryCatch.hasCaught())
835
883
  return envObject_11.setLastError(10 /* napi_status.napi_pending_exception */);
884
+ if (!envObject_11.canCallIntoJs()) {
885
+ return envObject_11.setLastError(envObject_11.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
886
+ }
836
887
  envObject_11.clearLastError();
837
888
  try {
838
889
  if (recv == 0)
@@ -880,6 +931,9 @@ function napi_new_instance(env, constructor, argc, argv, result
880
931
  .envStore.get(env);
881
932
  if (envObject_12.tryCatch.hasCaught())
882
933
  return envObject_12.setLastError(10 /* napi_status.napi_pending_exception */);
934
+ if (!envObject_12.canCallIntoJs()) {
935
+ return envObject_12.setLastError(envObject_12.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
936
+ }
883
937
  envObject_12.clearLastError();
884
938
  try {
885
939
  if (constructor == 0)
@@ -1060,6 +1114,9 @@ function emnapiWrap(env, js_object, native_object, finalize_cb, finalize_hint, r
1060
1114
  var envObject_13 = emnapiCtx.envStore.get(env);
1061
1115
  if (envObject_13.tryCatch.hasCaught())
1062
1116
  return envObject_13.setLastError(10 /* napi_status.napi_pending_exception */);
1117
+ if (!envObject_13.canCallIntoJs()) {
1118
+ return envObject_13.setLastError(envObject_13.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1119
+ }
1063
1120
  envObject_13.clearLastError();
1064
1121
  try {
1065
1122
  if (js_object == 0)
@@ -1101,6 +1158,9 @@ function emnapiUnwrap(env, js_object, result, action) {
1101
1158
  var envObject_14 = emnapiCtx.envStore.get(env);
1102
1159
  if (envObject_14.tryCatch.hasCaught())
1103
1160
  return envObject_14.setLastError(10 /* napi_status.napi_pending_exception */);
1161
+ if (!envObject_14.canCallIntoJs()) {
1162
+ return envObject_14.setLastError(envObject_14.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1163
+ }
1104
1164
  envObject_14.clearLastError();
1105
1165
  try {
1106
1166
  if (js_object == 0)
@@ -1225,8 +1285,10 @@ function napi_create_reference(env, value, initial_refcount, result) {
1225
1285
  if (result == 0)
1226
1286
  return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
1227
1287
  var handle = emnapiCtx.handleStore.get(value);
1228
- if (!(handle.isObject() || handle.isFunction() || handle.isSymbol())) {
1229
- return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
1288
+ if (envObject.moduleApiVersion !== 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */) {
1289
+ if (!(handle.isObject() || handle.isFunction() || handle.isSymbol())) {
1290
+ return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
1291
+ }
1230
1292
  }
1231
1293
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1232
1294
  var ref = emnapiCtx.createReference(envObject, handle.id, initial_refcount >>> 0, 1 /* Ownership.kUserland */);
@@ -1440,6 +1502,15 @@ var emnapiExternalMemory = {
1440
1502
  }
1441
1503
  };
1442
1504
  emnapiDefineVar('$emnapiExternalMemory', emnapiExternalMemory, ['malloc', 'free', '$emnapiInit'], 'emnapiExternalMemory.init();');
1505
+ function __emnapi_get_filename(env, buf, len) {
1506
+ var envObject = emnapiCtx.envStore.get(env);
1507
+ var filename = envObject.filename;
1508
+ if (!buf) {
1509
+ return emnapiString.lengthBytesUTF8(filename);
1510
+ }
1511
+ return emnapiString.stringToUTF8(filename, buf, len);
1512
+ }
1513
+ emnapiImplementInternal('_emnapi_get_filename', 'ippi', __emnapi_get_filename, ['$emnapiString']);
1443
1514
  function __emnapi_node_emit_async_init(async_resource, async_resource_name, trigger_async_id, result) {
1444
1515
  if (!emnapiNodeBinding)
1445
1516
  return;
@@ -1568,6 +1639,9 @@ function napi_make_callback(env, async_context, recv, func, argc, argv, result)
1568
1639
  var envObject_15 = emnapiCtx.envStore.get(env);
1569
1640
  if (envObject_15.tryCatch.hasCaught())
1570
1641
  return envObject_15.setLastError(10 /* napi_status.napi_pending_exception */);
1642
+ if (!envObject_15.canCallIntoJs()) {
1643
+ return envObject_15.setLastError(envObject_15.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1644
+ }
1571
1645
  envObject_15.clearLastError();
1572
1646
  try {
1573
1647
  if (recv == 0)
@@ -1632,6 +1706,11 @@ function napi_create_promise(env, deferred, promise) {
1632
1706
  envObject_16 = emnapiCtx.envStore.get(env);
1633
1707
  if (envObject_16.tryCatch.hasCaught())
1634
1708
  return envObject_16.setLastError(10 /* napi_status.napi_pending_exception */);
1709
+ if (!envObject_16.canCallIntoJs()) {
1710
+ return envObject_16.
1711
+ // @ts-expect-error
1712
+ setLastError(envObject_16.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1713
+ }
1635
1714
  envObject_16.clearLastError();
1636
1715
  try {
1637
1716
  if (deferred == 0)
@@ -1663,6 +1742,11 @@ function napi_resolve_deferred(env, deferred, resolution) {
1663
1742
  envObject_17 = emnapiCtx.envStore.get(env);
1664
1743
  if (envObject_17.tryCatch.hasCaught())
1665
1744
  return envObject_17.setLastError(10 /* napi_status.napi_pending_exception */);
1745
+ if (!envObject_17.canCallIntoJs()) {
1746
+ return envObject_17.
1747
+ // @ts-expect-error
1748
+ setLastError(envObject_17.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1749
+ }
1666
1750
  envObject_17.clearLastError();
1667
1751
  try {
1668
1752
  if (deferred == 0)
@@ -1686,6 +1770,11 @@ function napi_reject_deferred(env, deferred, resolution) {
1686
1770
  envObject_18 = emnapiCtx.envStore.get(env);
1687
1771
  if (envObject_18.tryCatch.hasCaught())
1688
1772
  return envObject_18.setLastError(10 /* napi_status.napi_pending_exception */);
1773
+ if (!envObject_18.canCallIntoJs()) {
1774
+ return envObject_18.
1775
+ // @ts-expect-error
1776
+ setLastError(envObject_18.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1777
+ }
1689
1778
  envObject_18.clearLastError();
1690
1779
  try {
1691
1780
  if (deferred == 0)
@@ -1730,6 +1819,9 @@ function _napi_get_all_property_names(env, object, key_mode, key_filter, key_con
1730
1819
  var envObject_19 = emnapiCtx.envStore.get(env);
1731
1820
  if (envObject_19.tryCatch.hasCaught())
1732
1821
  return envObject_19.setLastError(10 /* napi_status.napi_pending_exception */);
1822
+ if (!envObject_19.canCallIntoJs()) {
1823
+ return envObject_19.setLastError(envObject_19.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1824
+ }
1733
1825
  envObject_19.clearLastError();
1734
1826
  try {
1735
1827
  if (result == 0)
@@ -1744,7 +1836,7 @@ function _napi_get_all_property_names(env, object, key_mode, key_filter, key_con
1744
1836
  try {
1745
1837
  obj_1 = h_1.isObject() || h_1.isFunction() ? h_1.value : Object(h_1.value);
1746
1838
  }
1747
- catch (_1) {
1839
+ catch (_2) {
1748
1840
  return envObject_19.setLastError(2 /* napi_status.napi_object_expected */);
1749
1841
  }
1750
1842
  if (key_mode !== 0 /* napi_key_collection_mode.napi_key_include_prototypes */ && key_mode !== 1 /* napi_key_collection_mode.napi_key_own_only */) {
@@ -1872,6 +1964,9 @@ function napi_set_property(env, object, key, value) {
1872
1964
  var envObject_20 = emnapiCtx.envStore.get(env);
1873
1965
  if (envObject_20.tryCatch.hasCaught())
1874
1966
  return envObject_20.setLastError(10 /* napi_status.napi_pending_exception */);
1967
+ if (!envObject_20.canCallIntoJs()) {
1968
+ return envObject_20.setLastError(envObject_20.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
1969
+ }
1875
1970
  envObject_20.clearLastError();
1876
1971
  try {
1877
1972
  if (key == 0)
@@ -1901,6 +1996,9 @@ function napi_has_property(env, object, key, result) {
1901
1996
  var envObject_21 = emnapiCtx.envStore.get(env);
1902
1997
  if (envObject_21.tryCatch.hasCaught())
1903
1998
  return envObject_21.setLastError(10 /* napi_status.napi_pending_exception */);
1999
+ if (!envObject_21.canCallIntoJs()) {
2000
+ return envObject_21.setLastError(envObject_21.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2001
+ }
1904
2002
  envObject_21.clearLastError();
1905
2003
  try {
1906
2004
  if (key == 0)
@@ -1917,7 +2015,7 @@ function napi_has_property(env, object, key, result) {
1917
2015
  try {
1918
2016
  v_1 = h_3.isObject() || h_3.isFunction() ? h_3.value : Object(h_3.value);
1919
2017
  }
1920
- catch (_2) {
2018
+ catch (_3) {
1921
2019
  return envObject_21.setLastError(2 /* napi_status.napi_object_expected */);
1922
2020
  }
1923
2021
  {{{ from64("result") }}};
@@ -1939,6 +2037,9 @@ function napi_get_property(env, object, key, result) {
1939
2037
  var envObject_22 = emnapiCtx.envStore.get(env);
1940
2038
  if (envObject_22.tryCatch.hasCaught())
1941
2039
  return envObject_22.setLastError(10 /* napi_status.napi_pending_exception */);
2040
+ if (!envObject_22.canCallIntoJs()) {
2041
+ return envObject_22.setLastError(envObject_22.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2042
+ }
1942
2043
  envObject_22.clearLastError();
1943
2044
  try {
1944
2045
  if (key == 0)
@@ -1955,7 +2056,7 @@ function napi_get_property(env, object, key, result) {
1955
2056
  try {
1956
2057
  v_2 = h_4.isObject() || h_4.isFunction() ? h_4.value : Object(h_4.value);
1957
2058
  }
1958
- catch (_3) {
2059
+ catch (_4) {
1959
2060
  return envObject_22.setLastError(2 /* napi_status.napi_object_expected */);
1960
2061
  }
1961
2062
  {{{ from64("result") }}};
@@ -1978,6 +2079,9 @@ function napi_delete_property(env, object, key, result) {
1978
2079
  var envObject_23 = emnapiCtx.envStore.get(env);
1979
2080
  if (envObject_23.tryCatch.hasCaught())
1980
2081
  return envObject_23.setLastError(10 /* napi_status.napi_pending_exception */);
2082
+ if (!envObject_23.canCallIntoJs()) {
2083
+ return envObject_23.setLastError(envObject_23.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2084
+ }
1981
2085
  envObject_23.clearLastError();
1982
2086
  try {
1983
2087
  if (key == 0)
@@ -1996,7 +2100,7 @@ function napi_delete_property(env, object, key, result) {
1996
2100
  try {
1997
2101
  r = delete h_5.value[propertyKey_1];
1998
2102
  }
1999
- catch (_4) {
2103
+ catch (_5) {
2000
2104
  r = false;
2001
2105
  }
2002
2106
  }
@@ -2020,6 +2124,9 @@ function napi_has_own_property(env, object, key, result) {
2020
2124
  var envObject_24 = emnapiCtx.envStore.get(env);
2021
2125
  if (envObject_24.tryCatch.hasCaught())
2022
2126
  return envObject_24.setLastError(10 /* napi_status.napi_pending_exception */);
2127
+ if (!envObject_24.canCallIntoJs()) {
2128
+ return envObject_24.setLastError(envObject_24.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2129
+ }
2023
2130
  envObject_24.clearLastError();
2024
2131
  try {
2025
2132
  if (key == 0)
@@ -2036,7 +2143,7 @@ function napi_has_own_property(env, object, key, result) {
2036
2143
  try {
2037
2144
  v_3 = h_6.isObject() || h_6.isFunction() ? h_6.value : Object(h_6.value);
2038
2145
  }
2039
- catch (_5) {
2146
+ catch (_6) {
2040
2147
  return envObject_24.setLastError(2 /* napi_status.napi_object_expected */);
2041
2148
  }
2042
2149
  var prop_2 = emnapiCtx.handleStore.get(key).value;
@@ -2060,6 +2167,9 @@ function napi_set_named_property(env, object, cname, value) {
2060
2167
  var envObject_25 = emnapiCtx.envStore.get(env);
2061
2168
  if (envObject_25.tryCatch.hasCaught())
2062
2169
  return envObject_25.setLastError(10 /* napi_status.napi_pending_exception */);
2170
+ if (!envObject_25.canCallIntoJs()) {
2171
+ return envObject_25.setLastError(envObject_25.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2172
+ }
2063
2173
  envObject_25.clearLastError();
2064
2174
  try {
2065
2175
  if (value == 0)
@@ -2091,6 +2201,9 @@ function napi_has_named_property(env, object, utf8name, result) {
2091
2201
  var envObject_26 = emnapiCtx.envStore.get(env);
2092
2202
  if (envObject_26.tryCatch.hasCaught())
2093
2203
  return envObject_26.setLastError(10 /* napi_status.napi_pending_exception */);
2204
+ if (!envObject_26.canCallIntoJs()) {
2205
+ return envObject_26.setLastError(envObject_26.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2206
+ }
2094
2207
  envObject_26.clearLastError();
2095
2208
  try {
2096
2209
  if (result == 0)
@@ -2108,7 +2221,7 @@ function napi_has_named_property(env, object, utf8name, result) {
2108
2221
  try {
2109
2222
  v_4 = h_8.isObject() || h_8.isFunction() ? h_8.value : Object(h_8.value);
2110
2223
  }
2111
- catch (_6) {
2224
+ catch (_7) {
2112
2225
  return envObject_26.setLastError(2 /* napi_status.napi_object_expected */);
2113
2226
  }
2114
2227
  {{{ from64("utf8name") }}};
@@ -2131,6 +2244,9 @@ function napi_get_named_property(env, object, utf8name, result) {
2131
2244
  var envObject_27 = emnapiCtx.envStore.get(env);
2132
2245
  if (envObject_27.tryCatch.hasCaught())
2133
2246
  return envObject_27.setLastError(10 /* napi_status.napi_pending_exception */);
2247
+ if (!envObject_27.canCallIntoJs()) {
2248
+ return envObject_27.setLastError(envObject_27.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2249
+ }
2134
2250
  envObject_27.clearLastError();
2135
2251
  try {
2136
2252
  if (result == 0)
@@ -2148,7 +2264,7 @@ function napi_get_named_property(env, object, utf8name, result) {
2148
2264
  try {
2149
2265
  v_5 = h_9.isObject() || h_9.isFunction() ? h_9.value : Object(h_9.value);
2150
2266
  }
2151
- catch (_7) {
2267
+ catch (_8) {
2152
2268
  return envObject_27.setLastError(2 /* napi_status.napi_object_expected */);
2153
2269
  }
2154
2270
  {{{ from64("utf8name") }}};
@@ -2170,6 +2286,9 @@ function napi_set_element(env, object, index, value) {
2170
2286
  var envObject_28 = emnapiCtx.envStore.get(env);
2171
2287
  if (envObject_28.tryCatch.hasCaught())
2172
2288
  return envObject_28.setLastError(10 /* napi_status.napi_pending_exception */);
2289
+ if (!envObject_28.canCallIntoJs()) {
2290
+ return envObject_28.setLastError(envObject_28.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2291
+ }
2173
2292
  envObject_28.clearLastError();
2174
2293
  try {
2175
2294
  if (value == 0)
@@ -2197,6 +2316,9 @@ function napi_has_element(env, object, index, result) {
2197
2316
  var envObject_29 = emnapiCtx.envStore.get(env);
2198
2317
  if (envObject_29.tryCatch.hasCaught())
2199
2318
  return envObject_29.setLastError(10 /* napi_status.napi_pending_exception */);
2319
+ if (!envObject_29.canCallIntoJs()) {
2320
+ return envObject_29.setLastError(envObject_29.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2321
+ }
2200
2322
  envObject_29.clearLastError();
2201
2323
  try {
2202
2324
  if (result == 0)
@@ -2211,7 +2333,7 @@ function napi_has_element(env, object, index, result) {
2211
2333
  try {
2212
2334
  v_6 = h_11.isObject() || h_11.isFunction() ? h_11.value : Object(h_11.value);
2213
2335
  }
2214
- catch (_8) {
2336
+ catch (_9) {
2215
2337
  return envObject_29.setLastError(2 /* napi_status.napi_object_expected */);
2216
2338
  }
2217
2339
  {{{ from64("result") }}};
@@ -2233,6 +2355,9 @@ function napi_get_element(env, object, index, result) {
2233
2355
  var envObject_30 = emnapiCtx.envStore.get(env);
2234
2356
  if (envObject_30.tryCatch.hasCaught())
2235
2357
  return envObject_30.setLastError(10 /* napi_status.napi_pending_exception */);
2358
+ if (!envObject_30.canCallIntoJs()) {
2359
+ return envObject_30.setLastError(envObject_30.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2360
+ }
2236
2361
  envObject_30.clearLastError();
2237
2362
  try {
2238
2363
  if (result == 0)
@@ -2247,7 +2372,7 @@ function napi_get_element(env, object, index, result) {
2247
2372
  try {
2248
2373
  v_7 = h_12.isObject() || h_12.isFunction() ? h_12.value : Object(h_12.value);
2249
2374
  }
2250
- catch (_9) {
2375
+ catch (_10) {
2251
2376
  return envObject_30.setLastError(2 /* napi_status.napi_object_expected */);
2252
2377
  }
2253
2378
  {{{ from64("result") }}};
@@ -2270,6 +2395,9 @@ function napi_delete_element(env, object, index, result) {
2270
2395
  var envObject_31 = emnapiCtx.envStore.get(env);
2271
2396
  if (envObject_31.tryCatch.hasCaught())
2272
2397
  return envObject_31.setLastError(10 /* napi_status.napi_pending_exception */);
2398
+ if (!envObject_31.canCallIntoJs()) {
2399
+ return envObject_31.setLastError(envObject_31.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2400
+ }
2273
2401
  envObject_31.clearLastError();
2274
2402
  try {
2275
2403
  if (object == 0)
@@ -2285,7 +2413,7 @@ function napi_delete_element(env, object, index, result) {
2285
2413
  try {
2286
2414
  r = delete h_13.value[index >>> 0];
2287
2415
  }
2288
- catch (_10) {
2416
+ catch (_11) {
2289
2417
  r = false;
2290
2418
  }
2291
2419
  }
@@ -2310,6 +2438,9 @@ function napi_define_properties(env, object, property_count, properties
2310
2438
  var envObject_32 = emnapiCtx.envStore.get(env);
2311
2439
  if (envObject_32.tryCatch.hasCaught())
2312
2440
  return envObject_32.setLastError(10 /* napi_status.napi_pending_exception */);
2441
+ if (!envObject_32.canCallIntoJs()) {
2442
+ return envObject_32.setLastError(envObject_32.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2443
+ }
2313
2444
  envObject_32.clearLastError();
2314
2445
  try {
2315
2446
  {{{ from64("properties") }}};
@@ -2367,6 +2498,9 @@ function napi_object_freeze(env, object) {
2367
2498
  var envObject_33 = emnapiCtx.envStore.get(env);
2368
2499
  if (envObject_33.tryCatch.hasCaught())
2369
2500
  return envObject_33.setLastError(10 /* napi_status.napi_pending_exception */);
2501
+ if (!envObject_33.canCallIntoJs()) {
2502
+ return envObject_33.setLastError(envObject_33.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2503
+ }
2370
2504
  envObject_33.clearLastError();
2371
2505
  try {
2372
2506
  if (!object)
@@ -2391,6 +2525,9 @@ function napi_object_seal(env, object) {
2391
2525
  var envObject_34 = emnapiCtx.envStore.get(env);
2392
2526
  if (envObject_34.tryCatch.hasCaught())
2393
2527
  return envObject_34.setLastError(10 /* napi_status.napi_pending_exception */);
2528
+ if (!envObject_34.canCallIntoJs()) {
2529
+ return envObject_34.setLastError(envObject_34.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2530
+ }
2394
2531
  envObject_34.clearLastError();
2395
2532
  try {
2396
2533
  if (!object)
@@ -2437,6 +2574,9 @@ function napi_run_script(env, script, result) {
2437
2574
  get(env);
2438
2575
  if (envObject_35.tryCatch.hasCaught())
2439
2576
  return envObject_35.setLastError(10 /* napi_status.napi_pending_exception */);
2577
+ if (!envObject_35.canCallIntoJs()) {
2578
+ return envObject_35.setLastError(envObject_35.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
2579
+ }
2440
2580
  envObject_35.clearLastError();
2441
2581
  try {
2442
2582
  if (script == 0)
@@ -3174,7 +3314,7 @@ var emnapiTSFN = {
3174
3314
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3175
3315
  var context = emnapiTSFN.getContext(func);
3176
3316
  var f = function () {
3177
- envObject.callFinalizer({{{ to64('finalize') }}}, {{{ to64('data') }}}, {{{ to64('context') }}});
3317
+ envObject.callFinalizerInternal(0, {{{ to64('finalize') }}}, {{{ to64('data') }}}, {{{ to64('context') }}});
3178
3318
  };
3179
3319
  try {
3180
3320
  if (finalize) {
@@ -3269,7 +3409,7 @@ var emnapiTSFN = {
3269
3409
  var envObject_36 = emnapiCtx.envStore.get(env);
3270
3410
  emnapiCtx.openScope(envObject_36);
3271
3411
  var f = function () {
3272
- envObject_36.callIntoModule(function () {
3412
+ envObject_36.callbackIntoModule(false, function () {
3273
3413
  var callJsCb = emnapiTSFN.getCallJSCb(func);
3274
3414
  var ref = emnapiTSFN.getRef(func);
3275
3415
  var js_callback = ref ? emnapiCtx.refStore.get(ref).get() : 0;
@@ -3587,11 +3727,11 @@ function __emnapi_next_tick(callback, data) {
3587
3727
  {{{ makeDynCall('vp', 'callback') }}}(data);
3588
3728
  });
3589
3729
  }
3590
- function __emnapi_call_into_module(env, callback, data, close_scope_if_throw) {
3730
+ function __emnapi_callback_into_module(forceUncaught, env, callback, data, close_scope_if_throw) {
3591
3731
  var envObject = emnapiCtx.envStore.get(env);
3592
3732
  var scope = emnapiCtx.openScope(envObject);
3593
3733
  try {
3594
- envObject.callIntoModule(function () {
3734
+ envObject.callbackIntoModule(Boolean(forceUncaught), function () {
3595
3735
  {{{ makeDynCall('vpp', 'callback') }}}(env, data);
3596
3736
  });
3597
3737
  }
@@ -3604,10 +3744,10 @@ function __emnapi_call_into_module(env, callback, data, close_scope_if_throw) {
3604
3744
  }
3605
3745
  emnapiCtx.closeScope(envObject, scope);
3606
3746
  }
3607
- function __emnapi_call_finalizer(env, callback, data, hint) {
3747
+ function __emnapi_call_finalizer(forceUncaught, env, callback, data, hint) {
3608
3748
  var envObject = emnapiCtx.envStore.get(env);
3609
3749
  {{{ from64('callback') }}};
3610
- envObject.callFinalizer(callback, data, hint);
3750
+ envObject.callFinalizerInternal(forceUncaught, callback, data, hint);
3611
3751
  }
3612
3752
  function __emnapi_ctx_increase_waiting_request_counter() {
3613
3753
  emnapiCtx.increaseWaitingRequestCounter();
@@ -3617,8 +3757,8 @@ function __emnapi_ctx_decrease_waiting_request_counter() {
3617
3757
  }
3618
3758
  emnapiImplementInternal('_emnapi_set_immediate', 'vpp', __emnapi_set_immediate);
3619
3759
  emnapiImplementInternal('_emnapi_next_tick', 'vpp', __emnapi_next_tick);
3620
- emnapiImplementInternal('_emnapi_call_into_module', 'vpppi', __emnapi_call_into_module);
3621
- emnapiImplementInternal('_emnapi_call_finalizer', 'vpppp', __emnapi_call_finalizer);
3760
+ emnapiImplementInternal('_emnapi_callback_into_module', 'vipppi', __emnapi_callback_into_module);
3761
+ emnapiImplementInternal('_emnapi_call_finalizer', 'vipppp', __emnapi_call_finalizer);
3622
3762
  emnapiImplementInternal('_emnapi_ctx_increase_waiting_request_counter', 'v', __emnapi_ctx_increase_waiting_request_counter);
3623
3763
  emnapiImplementInternal('_emnapi_ctx_decrease_waiting_request_counter', 'v', __emnapi_ctx_decrease_waiting_request_counter);
3624
3764
  function napi_typeof(env, value, result) {
@@ -3683,6 +3823,9 @@ function napi_coerce_to_bool(env, value, result) {
3683
3823
  var envObject_37 = emnapiCtx.envStore.get(env);
3684
3824
  if (envObject_37.tryCatch.hasCaught())
3685
3825
  return envObject_37.setLastError(10 /* napi_status.napi_pending_exception */);
3826
+ if (!envObject_37.canCallIntoJs()) {
3827
+ return envObject_37.setLastError(envObject_37.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
3828
+ }
3686
3829
  envObject_37.clearLastError();
3687
3830
  try {
3688
3831
  if (value == 0)
@@ -3709,6 +3852,9 @@ function napi_coerce_to_number(env, value, result) {
3709
3852
  var envObject_38 = emnapiCtx.envStore.get(env);
3710
3853
  if (envObject_38.tryCatch.hasCaught())
3711
3854
  return envObject_38.setLastError(10 /* napi_status.napi_pending_exception */);
3855
+ if (!envObject_38.canCallIntoJs()) {
3856
+ return envObject_38.setLastError(envObject_38.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
3857
+ }
3712
3858
  envObject_38.clearLastError();
3713
3859
  try {
3714
3860
  if (value == 0)
@@ -3739,6 +3885,9 @@ function napi_coerce_to_object(env, value, result) {
3739
3885
  var envObject_39 = emnapiCtx.envStore.get(env);
3740
3886
  if (envObject_39.tryCatch.hasCaught())
3741
3887
  return envObject_39.setLastError(10 /* napi_status.napi_pending_exception */);
3888
+ if (!envObject_39.canCallIntoJs()) {
3889
+ return envObject_39.setLastError(envObject_39.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
3890
+ }
3742
3891
  envObject_39.clearLastError();
3743
3892
  try {
3744
3893
  if (value == 0)
@@ -3769,6 +3918,9 @@ function napi_coerce_to_string(env, value, result) {
3769
3918
  var envObject_40 = emnapiCtx.envStore.get(env);
3770
3919
  if (envObject_40.tryCatch.hasCaught())
3771
3920
  return envObject_40.setLastError(10 /* napi_status.napi_pending_exception */);
3921
+ if (!envObject_40.canCallIntoJs()) {
3922
+ return envObject_40.setLastError(envObject_40.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
3923
+ }
3772
3924
  envObject_40.clearLastError();
3773
3925
  try {
3774
3926
  if (value == 0)
@@ -3799,6 +3951,9 @@ function napi_instanceof(env, object, constructor, result) {
3799
3951
  var envObject_41 = emnapiCtx.envStore.get(env);
3800
3952
  if (envObject_41.tryCatch.hasCaught())
3801
3953
  return envObject_41.setLastError(10 /* napi_status.napi_pending_exception */);
3954
+ if (!envObject_41.canCallIntoJs()) {
3955
+ return envObject_41.setLastError(envObject_41.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
3956
+ }
3802
3957
  envObject_41.clearLastError();
3803
3958
  try {
3804
3959
  if (object == 0)
@@ -3938,6 +4093,9 @@ function napi_strict_equals(env, lhs, rhs, result) {
3938
4093
  var envObject_42 = emnapiCtx.envStore.get(env);
3939
4094
  if (envObject_42.tryCatch.hasCaught())
3940
4095
  return envObject_42.setLastError(10 /* napi_status.napi_pending_exception */);
4096
+ if (!envObject_42.canCallIntoJs()) {
4097
+ return envObject_42.setLastError(envObject_42.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4098
+ }
3941
4099
  envObject_42.clearLastError();
3942
4100
  try {
3943
4101
  if (lhs == 0)
@@ -3972,7 +4130,8 @@ function napi_detach_arraybuffer(env, arraybuffer) {
3972
4130
  return envObject.setLastError(19 /* napi_status.napi_arraybuffer_expected */);
3973
4131
  }
3974
4132
  try {
3975
- var messageChannel = new MessageChannel();
4133
+ var MessageChannel_1 = emnapiCtx.feature.MessageChannel;
4134
+ var messageChannel = new MessageChannel_1();
3976
4135
  messageChannel.port1.postMessage(value, [value]);
3977
4136
  }
3978
4137
  catch (err) {
@@ -3988,6 +4147,9 @@ function napi_is_detached_arraybuffer(env, arraybuffer, result) {
3988
4147
  var envObject_43 = emnapiCtx.envStore.get(env);
3989
4148
  if (envObject_43.tryCatch.hasCaught())
3990
4149
  return envObject_43.setLastError(10 /* napi_status.napi_pending_exception */);
4150
+ if (!envObject_43.canCallIntoJs()) {
4151
+ return envObject_43.setLastError(envObject_43.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4152
+ }
3991
4153
  envObject_43.clearLastError();
3992
4154
  try {
3993
4155
  if (arraybuffer == 0)
@@ -4001,7 +4163,7 @@ function napi_is_detached_arraybuffer(env, arraybuffer, result) {
4001
4163
  // eslint-disable-next-line no-new
4002
4164
  new Uint8Array(h_17.value);
4003
4165
  }
4004
- catch (_11) {
4166
+ catch (_12) {
4005
4167
  {{{ makeSetValue("result", 0, "1", "i8") }}};
4006
4168
  return envObject_43.getReturnStatus();
4007
4169
  }
@@ -4030,6 +4192,18 @@ emnapiImplement('napi_is_dataview', 'ippp', napi_is_dataview);
4030
4192
  emnapiImplement('napi_strict_equals', 'ipppp', napi_strict_equals);
4031
4193
  emnapiImplement('napi_detach_arraybuffer', 'ipp', napi_detach_arraybuffer, ['napi_set_last_error']);
4032
4194
  emnapiImplement('napi_is_detached_arraybuffer', 'ippp', napi_is_detached_arraybuffer, ['napi_set_last_error']);
4195
+ function _napi_get_version(env, result) {
4196
+ if (env == 0)
4197
+ return 1 /* napi_status.napi_invalid_arg */;
4198
+ var envObject = emnapiCtx.envStore.get(env);
4199
+ if (result == 0)
4200
+ return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
4201
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4202
+ var NAPI_VERSION = 9 /* Version.NAPI_VERSION */;
4203
+ {{{ makeSetValue('result', 0, 'NAPI_VERSION', 'u32') }}};
4204
+ return envObject.clearLastError();
4205
+ }
4206
+ emnapiImplement('napi_get_version', 'ipp', _napi_get_version, []);
4033
4207
  function napi_define_class(env, utf8name, length, constructor, callback_data, property_count, properties, result
4034
4208
  // @ts-expect-error
4035
4209
  ) {
@@ -4040,6 +4214,9 @@ function napi_define_class(env, utf8name, length, constructor, callback_data, pr
4040
4214
  var envObject_44 = emnapiCtx.envStore.get(env);
4041
4215
  if (envObject_44.tryCatch.hasCaught())
4042
4216
  return envObject_44.setLastError(10 /* napi_status.napi_pending_exception */);
4217
+ if (!envObject_44.canCallIntoJs()) {
4218
+ return envObject_44.setLastError(envObject_44.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4219
+ }
4043
4220
  envObject_44.clearLastError();
4044
4221
  try {
4045
4222
  if (result == 0)
@@ -4112,6 +4289,9 @@ function napi_wrap(env, js_object, native_object, finalize_cb, finalize_hint, re
4112
4289
  var envObject_45 = emnapiCtx.envStore.get(env);
4113
4290
  if (envObject_45.tryCatch.hasCaught())
4114
4291
  return envObject_45.setLastError(10 /* napi_status.napi_pending_exception */);
4292
+ if (!envObject_45.canCallIntoJs()) {
4293
+ return envObject_45.setLastError(envObject_45.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4294
+ }
4115
4295
  envObject_45.clearLastError();
4116
4296
  try {
4117
4297
  throw emnapiCtx.createNotSupportWeakRefError("napi_wrap", "Parameter \"finalize_cb\" must be 0(NULL)");
@@ -4128,6 +4308,9 @@ function napi_wrap(env, js_object, native_object, finalize_cb, finalize_hint, re
4128
4308
  var envObject_46 = emnapiCtx.envStore.get(env);
4129
4309
  if (envObject_46.tryCatch.hasCaught())
4130
4310
  return envObject_46.setLastError(10 /* napi_status.napi_pending_exception */);
4311
+ if (!envObject_46.canCallIntoJs()) {
4312
+ return envObject_46.setLastError(envObject_46.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4313
+ }
4131
4314
  envObject_46.clearLastError();
4132
4315
  try {
4133
4316
  throw emnapiCtx.createNotSupportWeakRefError("napi_wrap", "Parameter \"result\" must be 0(NULL)");
@@ -4154,6 +4337,9 @@ function napi_type_tag_object(env, object, type_tag) {
4154
4337
  var envObject_47 = emnapiCtx.envStore.get(env);
4155
4338
  if (envObject_47.tryCatch.hasCaught())
4156
4339
  return envObject_47.setLastError(10 /* napi_status.napi_pending_exception */);
4340
+ if (!envObject_47.canCallIntoJs()) {
4341
+ return envObject_47.setLastError(envObject_47.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4342
+ }
4157
4343
  envObject_47.clearLastError();
4158
4344
  try {
4159
4345
  if (!object) {
@@ -4193,6 +4379,9 @@ function napi_check_object_type_tag(env, object, type_tag, result) {
4193
4379
  var envObject_48 = emnapiCtx.envStore.get(env);
4194
4380
  if (envObject_48.tryCatch.hasCaught())
4195
4381
  return envObject_48.setLastError(10 /* napi_status.napi_pending_exception */);
4382
+ if (!envObject_48.canCallIntoJs()) {
4383
+ return envObject_48.setLastError(envObject_48.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4384
+ }
4196
4385
  envObject_48.clearLastError();
4197
4386
  try {
4198
4387
  if (!object) {
@@ -4471,6 +4660,9 @@ function napi_get_date_value(env, value, result) {
4471
4660
  var envObject_49 = emnapiCtx.envStore.get(env);
4472
4661
  if (envObject_49.tryCatch.hasCaught())
4473
4662
  return envObject_49.setLastError(10 /* napi_status.napi_pending_exception */);
4663
+ if (!envObject_49.canCallIntoJs()) {
4664
+ return envObject_49.setLastError(envObject_49.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
4665
+ }
4474
4666
  envObject_49.clearLastError();
4475
4667
  try {
4476
4668
  if (value == 0)
@@ -4487,8 +4679,7 @@ function napi_get_date_value(env, value, result) {
4487
4679
  return envObject_49.getReturnStatus();
4488
4680
  }
4489
4681
  catch (err_49) {
4490
- envObject_49.tryCatch
4491
- .setError(err_49);
4682
+ envObject_49.tryCatch.setError(err_49);
4492
4683
  return envObject_49.setLastError(10 /* napi_status.napi_pending_exception */);
4493
4684
  }
4494
4685
  }
@@ -5086,6 +5277,9 @@ function napi_create_bigint_words(env, sign_bit, word_count, words, result) {
5086
5277
  var envObject_50 = emnapiCtx.envStore.get(env);
5087
5278
  if (envObject_50.tryCatch.hasCaught())
5088
5279
  return envObject_50.setLastError(10 /* napi_status.napi_pending_exception */);
5280
+ if (!envObject_50.canCallIntoJs()) {
5281
+ return envObject_50.setLastError(envObject_50.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5282
+ }
5089
5283
  envObject_50.clearLastError();
5090
5284
  try {
5091
5285
  if (!emnapiCtx.feature.supportBigInt) {
@@ -5117,7 +5311,9 @@ function napi_create_bigint_words(env, sign_bit, word_count, words, result) {
5117
5311
  }
5118
5312
  catch (err_50) {
5119
5313
  envObject_50.tryCatch.setError(err_50);
5120
- return envObject_50.setLastError(10 /* napi_status.napi_pending_exception */);
5314
+ return envObject_50.setLastError // eslint-disable-next-line @typescript-eslint/no-unused-vars
5315
+ (// eslint-disable-next-line @typescript-eslint/no-unused-vars
5316
+ 10 /* napi_status.napi_pending_exception */);
5121
5317
  }
5122
5318
  }
5123
5319
  emnapiImplement('napi_create_int32', 'ipip', napi_create_int32);
@@ -5180,6 +5376,9 @@ function napi_create_arraybuffer(env, byte_length, data, result) {
5180
5376
  get(env);
5181
5377
  if (envObject_51.tryCatch.hasCaught())
5182
5378
  return envObject_51.setLastError(10 /* napi_status.napi_pending_exception */);
5379
+ if (!envObject_51.canCallIntoJs()) {
5380
+ return envObject_51.setLastError(envObject_51.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5381
+ }
5183
5382
  envObject_51.clearLastError();
5184
5383
  try {
5185
5384
  if (result == 0)
@@ -5190,7 +5389,8 @@ function napi_create_arraybuffer(env, byte_length, data, result) {
5190
5389
  {{{ makeSetValue("result", 0, "value", "*") }}};
5191
5390
  return envObject_51.getReturnStatus();
5192
5391
  }
5193
- catch (err_51) {
5392
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5393
+ (err_51) {
5194
5394
  envObject_51.tryCatch.setError(err_51);
5195
5395
  return envObject_51.setLastError(10 /* napi_status.napi_pending_exception */);
5196
5396
  }
@@ -5207,6 +5407,9 @@ function napi_create_date(env, time, result) {
5207
5407
  get(env);
5208
5408
  if (envObject_52.tryCatch.hasCaught())
5209
5409
  return envObject_52.setLastError(10 /* napi_status.napi_pending_exception */);
5410
+ if (!envObject_52.canCallIntoJs()) {
5411
+ return envObject_52.setLastError(envObject_52.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5412
+ }
5210
5413
  envObject_52.clearLastError();
5211
5414
  try {
5212
5415
  if (result == 0)
@@ -5217,7 +5420,8 @@ function napi_create_date(env, time, result) {
5217
5420
  {{{ makeSetValue("result", 0, "value", "*") }}};
5218
5421
  return envObject_52.getReturnStatus();
5219
5422
  }
5220
- catch (err_52) {
5423
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5424
+ (err_52) {
5221
5425
  envObject_52.tryCatch.setError(err_52);
5222
5426
  return envObject_52.setLastError(10 /* napi_status.napi_pending_exception */);
5223
5427
  }
@@ -5234,6 +5438,9 @@ function napi_create_external(env, data, finalize_cb, finalize_hint, result) {
5234
5438
  get(env);
5235
5439
  if (envObject_53.tryCatch.hasCaught())
5236
5440
  return envObject_53.setLastError(10 /* napi_status.napi_pending_exception */);
5441
+ if (!envObject_53.canCallIntoJs()) {
5442
+ return envObject_53.setLastError(envObject_53.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5443
+ }
5237
5444
  envObject_53.clearLastError();
5238
5445
  try {
5239
5446
  if (result == 0)
@@ -5250,7 +5457,8 @@ function napi_create_external(env, data, finalize_cb, finalize_hint, result) {
5250
5457
  {{{ makeSetValue("result", 0, "value", "*") }}};
5251
5458
  return envObject_53.clearLastError();
5252
5459
  }
5253
- catch (err_53) {
5460
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5461
+ (err_53) {
5254
5462
  envObject_53.tryCatch.setError(err_53);
5255
5463
  return envObject_53.setLastError(10 /* napi_status.napi_pending_exception */);
5256
5464
  }
@@ -5268,6 +5476,9 @@ function napi_create_external_arraybuffer(env, external_data, byte_length, final
5268
5476
  get(env);
5269
5477
  if (envObject_54.tryCatch.hasCaught())
5270
5478
  return envObject_54.setLastError(10 /* napi_status.napi_pending_exception */);
5479
+ if (!envObject_54.canCallIntoJs()) {
5480
+ return envObject_54.setLastError(envObject_54.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5481
+ }
5271
5482
  envObject_54.clearLastError();
5272
5483
  try {
5273
5484
  if (result == 0)
@@ -5287,8 +5498,12 @@ function napi_create_external_arraybuffer(env, external_data, byte_length, final
5287
5498
  }
5288
5499
  var arrayBuffer_2 = new ArrayBuffer(byte_length);
5289
5500
  if (byte_length === 0) {
5290
- var messageChannel_1 = new MessageChannel();
5291
- messageChannel_1.port1.postMessage(arrayBuffer_2, [arrayBuffer_2]);
5501
+ try {
5502
+ var MessageChannel_2 = emnapiCtx.feature.MessageChannel;
5503
+ var messageChannel_1 = new MessageChannel_2();
5504
+ messageChannel_1.port1.postMessage(arrayBuffer_2, [arrayBuffer_2]);
5505
+ }
5506
+ catch (_13) { }
5292
5507
  }
5293
5508
  else {
5294
5509
  var u8arr_1 = new Uint8Array(arrayBuffer_2);
@@ -5315,7 +5530,8 @@ function napi_create_external_arraybuffer(env, external_data, byte_length, final
5315
5530
  {{{ makeSetValue("result", 0, "value", "*") }}};
5316
5531
  return envObject_54.getReturnStatus();
5317
5532
  }
5318
- catch (err_55) {
5533
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5534
+ (err_55) {
5319
5535
  envObject_54.tryCatch.setError(err_55);
5320
5536
  return envObject_54.setLastError(10 /* napi_status.napi_pending_exception */);
5321
5537
  }
@@ -5369,6 +5585,9 @@ function napi_create_typedarray(env, type, length, arraybuffer, byte_offset, res
5369
5585
  get(env);
5370
5586
  if (envObject_55.tryCatch.hasCaught())
5371
5587
  return envObject_55.setLastError(10 /* napi_status.napi_pending_exception */);
5588
+ if (!envObject_55.canCallIntoJs()) {
5589
+ return envObject_55.setLastError(envObject_55.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5590
+ }
5372
5591
  envObject_55.clearLastError();
5373
5592
  try {
5374
5593
  if (arraybuffer == 0)
@@ -5446,7 +5665,8 @@ function napi_create_typedarray(env, type, length, arraybuffer, byte_offset, res
5446
5665
  }
5447
5666
  return null;
5448
5667
  }
5449
- catch (err_56) {
5668
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5669
+ (err_56) {
5450
5670
  envObject_55.tryCatch.setError(err_56);
5451
5671
  return envObject_55.setLastError(10 /* napi_status.napi_pending_exception */);
5452
5672
  }
@@ -5465,6 +5685,9 @@ function napi_create_buffer(env, size, data, result
5465
5685
  get(env);
5466
5686
  if (envObject_56.tryCatch.hasCaught())
5467
5687
  return envObject_56.setLastError(10 /* napi_status.napi_pending_exception */);
5688
+ if (!envObject_56.canCallIntoJs()) {
5689
+ return envObject_56.setLastError(envObject_56.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5690
+ }
5468
5691
  envObject_56.clearLastError();
5469
5692
  try {
5470
5693
  if (result == 0)
@@ -5504,7 +5727,8 @@ function napi_create_buffer(env, size, data, result
5504
5727
  }
5505
5728
  return envObject_56.getReturnStatus();
5506
5729
  }
5507
- catch (err_59) {
5730
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5731
+ (err_59) {
5508
5732
  envObject_56.tryCatch.setError(err_59);
5509
5733
  return envObject_56.setLastError(10 /* napi_status.napi_pending_exception */);
5510
5734
  }
@@ -5522,6 +5746,9 @@ function napi_create_buffer_copy(env, length, data, result_data, result
5522
5746
  get(env);
5523
5747
  if (envObject_57.tryCatch.hasCaught())
5524
5748
  return envObject_57.setLastError(10 /* napi_status.napi_pending_exception */);
5749
+ if (!envObject_57.canCallIntoJs()) {
5750
+ return envObject_57.setLastError(envObject_57.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5751
+ }
5525
5752
  envObject_57.clearLastError();
5526
5753
  try {
5527
5754
  if (result == 0)
@@ -5537,7 +5764,8 @@ function napi_create_buffer_copy(env, length, data, result_data, result
5537
5764
  {{{ makeSetValue("result", 0, "value", "*") }}};
5538
5765
  return envObject_57.getReturnStatus();
5539
5766
  }
5540
- catch (err_60) {
5767
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5768
+ (err_60) {
5541
5769
  envObject_57.tryCatch.setError(err_60);
5542
5770
  return envObject_57.setLastError(10 /* napi_status.napi_pending_exception */);
5543
5771
  }
@@ -5558,6 +5786,9 @@ function napi_create_dataview(env, byte_length, arraybuffer, byte_offset, result
5558
5786
  get(env);
5559
5787
  if (envObject_58.tryCatch.hasCaught())
5560
5788
  return envObject_58.setLastError(10 /* napi_status.napi_pending_exception */);
5789
+ if (!envObject_58.canCallIntoJs()) {
5790
+ return envObject_58.setLastError(envObject_58.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
5791
+ }
5561
5792
  envObject_58.clearLastError();
5562
5793
  try {
5563
5794
  if (arraybuffer == 0)
@@ -5597,7 +5828,8 @@ function napi_create_dataview(env, byte_length, arraybuffer, byte_offset, result
5597
5828
  {{{ makeSetValue("result", 0, "value", "*") }}};
5598
5829
  return envObject_58.getReturnStatus();
5599
5830
  }
5600
- catch (err_62) {
5831
+ catch // eslint-disable-next-line @typescript-eslint/no-unused-vars
5832
+ (err_62) {
5601
5833
  envObject_58.tryCatch.setError(err_62);
5602
5834
  return envObject_58.setLastError(10 /* napi_status.napi_pending_exception */);
5603
5835
  }
@@ -5847,6 +6079,9 @@ function emnapi_get_module_object(env, result) {
5847
6079
  if (envObject_59.tryCatch
5848
6080
  .hasCaught())
5849
6081
  return envObject_59.setLastError(10 /* napi_status.napi_pending_exception */);
6082
+ if (!envObject_59.canCallIntoJs()) {
6083
+ return envObject_59.setLastError(envObject_59.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
6084
+ }
5850
6085
  envObject_59.clearLastError();
5851
6086
  try {
5852
6087
  if (result == 0)
@@ -5872,6 +6107,9 @@ function emnapi_get_module_property(env, utf8name, result) {
5872
6107
  if (envObject_60.tryCatch
5873
6108
  .hasCaught())
5874
6109
  return envObject_60.setLastError(10 /* napi_status.napi_pending_exception */);
6110
+ if (!envObject_60.canCallIntoJs()) {
6111
+ return envObject_60.setLastError(envObject_60.moduleApiVersion === 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */ ? 23 /* napi_status.napi_cannot_run_js */ : 10 /* napi_status.napi_pending_exception */);
6112
+ }
5875
6113
  envObject_60.clearLastError();
5876
6114
  try {
5877
6115
  if (utf8name == 0)
@@ -5911,9 +6149,8 @@ function emnapiInit(options) {
5911
6149
  throw new TypeError("Invalid `options.context`. Use `import { getDefaultContext } from '@emnapi/runtime'`");
5912
6150
  }
5913
6151
  emnapiCtx = context;
5914
- if (typeof options.filename === 'string') {
5915
- emnapiModule.filename = options.filename;
5916
- }
6152
+ var filename = typeof options.filename === 'string' ? options.filename : '';
6153
+ emnapiModule.filename = filename;
5917
6154
  if ('nodeBinding' in options) {
5918
6155
  var nodeBinding = options.nodeBinding;
5919
6156
  if (typeof nodeBinding !== 'object' || nodeBinding === null) {
@@ -5933,8 +6170,9 @@ function emnapiInit(options) {
5933
6170
  emnapiAsyncWorkPoolSize = -1024;
5934
6171
  }
5935
6172
  }
6173
+ var moduleApiVersion = _node_api_module_get_api_version_v1();
5936
6174
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
5937
- var envObject = emnapiModule.envObject || (emnapiModule.envObject = emnapiCtx.createEnv(function (cb) { return {{{ makeDynCall('vppp', 'cb') }}}; }, function (cb) { return {{{ makeDynCall('vp', 'cb') }}}; }));
6175
+ var envObject = emnapiModule.envObject || (emnapiModule.envObject = emnapiCtx.createEnv(filename, moduleApiVersion, function (cb) { return {{{ makeDynCall('vppp', 'cb') }}}; }, function (cb) { return {{{ makeDynCall('vp', 'cb') }}}; }, abort, emnapiNodeBinding));
5938
6176
  var scope = emnapiCtx.openScope(envObject);
5939
6177
  try {
5940
6178
  envObject.callIntoModule(function (_envObject) {
@@ -5954,18 +6192,11 @@ function emnapiInit(options) {
5954
6192
  delete emnapiModule.envObject;
5955
6193
  return emnapiModule.exports;
5956
6194
  }
5957
- emnapiImplementHelper('$emnapiInit', undefined, emnapiInit, ['$emnapiModule', '$emnapiCtx', '$emnapiNodeBinding', '$emnapiAsyncWorkPoolSize', 'napi_register_wasm_v1']);
6195
+ emnapiImplementHelper('$emnapiInit', undefined, emnapiInit, ['$emnapiModule', '$emnapiCtx', '$emnapiNodeBinding', '$emnapiAsyncWorkPoolSize', 'napi_register_wasm_v1', 'node_api_module_get_api_version_v1']);
5958
6196
  function __emnapi_async_work_pool_size() {
5959
6197
  return Math.abs(emnapiAsyncWorkPoolSize);
5960
6198
  }
5961
6199
  emnapiImplementInternal('_emnapi_async_work_pool_size', 'i', __emnapi_async_work_pool_size, ['$emnapiAsyncWorkPoolSize']);
5962
- function __emnapi_get_filename(buf, len) {
5963
- if (!buf) {
5964
- return emnapiString.lengthBytesUTF8(emnapiModule.filename);
5965
- }
5966
- return emnapiString.stringToUTF8(emnapiModule.filename, buf, len);
5967
- }
5968
- emnapiImplementInternal('_emnapi_get_filename', 'ipi', __emnapi_get_filename, ['$emnapiString']);
5969
6200
  /* eslint-disable @typescript-eslint/no-unused-vars */
5970
6201
  function emnapiImplement(name, sig, compilerTimeFunction, deps) {
5971
6202
  var _a;