@emnapi/runtime 1.1.1 → 1.3.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.
@@ -84,7 +84,7 @@ var emnapi = (function (exports) {
84
84
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
85
85
  PERFORMANCE OF THIS SOFTWARE.
86
86
  ***************************************************************************** */
87
- /* global Reflect, Promise, SuppressedError, Symbol */
87
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
88
88
 
89
89
  var extendStatics = function(d, b) {
90
90
  extendStatics = Object.setPrototypeOf ||
@@ -246,7 +246,7 @@ var emnapi = (function (exports) {
246
246
  catch (_) { }
247
247
  return undefined;
248
248
  })();
249
- var version = "1.1.1";
249
+ var version = "1.3.0";
250
250
  var NODE_API_SUPPORTED_VERSION_MIN = 1 /* Version.NODE_API_SUPPORTED_VERSION_MIN */;
251
251
  var NODE_API_SUPPORTED_VERSION_MAX = 9 /* Version.NODE_API_SUPPORTED_VERSION_MAX */;
252
252
  var NAPI_VERSION_EXPERIMENTAL = 2147483647 /* Version.NAPI_VERSION_EXPERIMENTAL */;
@@ -287,8 +287,9 @@ var emnapi = (function (exports) {
287
287
  Handle.prototype.isTypedArray = function () {
288
288
  return (ArrayBuffer.isView(this.value)) && !(this.value instanceof DataView);
289
289
  };
290
- Handle.prototype.isBuffer = function () {
291
- return typeof _Buffer === 'function' && _Buffer.isBuffer(this.value);
290
+ Handle.prototype.isBuffer = function (BufferConstructor) {
291
+ BufferConstructor !== null && BufferConstructor !== void 0 ? BufferConstructor : (BufferConstructor = _Buffer);
292
+ return typeof BufferConstructor === 'function' && BufferConstructor.isBuffer(this.value);
292
293
  };
293
294
  Handle.prototype.isDataView = function () {
294
295
  return (this.value instanceof DataView);
@@ -498,6 +499,8 @@ var emnapi = (function (exports) {
498
499
  this._prev = null;
499
500
  }
500
501
  /** @virtual */
502
+ RefTracker.prototype.dispose = function () { };
503
+ /** @virtual */
501
504
  RefTracker.prototype.finalize = function () { };
502
505
  RefTracker.prototype.link = function (list) {
503
506
  this._prev = list;
@@ -534,17 +537,37 @@ var emnapi = (function (exports) {
534
537
  this._finalizeCallback = _finalizeCallback;
535
538
  this._finalizeData = _finalizeData;
536
539
  this._finalizeHint = _finalizeHint;
540
+ this._makeDynCall_vppp = envObject.makeDynCall_vppp;
537
541
  }
538
542
  Finalizer.prototype.callback = function () { return this._finalizeCallback; };
539
543
  Finalizer.prototype.data = function () { return this._finalizeData; };
540
544
  Finalizer.prototype.hint = function () { return this._finalizeHint; };
545
+ Finalizer.prototype.resetEnv = function () {
546
+ this.envObject = undefined;
547
+ };
541
548
  Finalizer.prototype.resetFinalizer = function () {
542
549
  this._finalizeCallback = 0;
543
550
  this._finalizeData = 0;
544
551
  this._finalizeHint = 0;
545
552
  };
553
+ Finalizer.prototype.callFinalizer = function () {
554
+ var finalize_callback = this._finalizeCallback;
555
+ var finalize_data = this._finalizeData;
556
+ var finalize_hint = this._finalizeHint;
557
+ this.resetFinalizer();
558
+ if (!finalize_callback)
559
+ return;
560
+ var fini = Number(finalize_callback);
561
+ if (!this.envObject) {
562
+ this._makeDynCall_vppp(fini)(0, finalize_data, finalize_hint);
563
+ }
564
+ else {
565
+ this.envObject.callFinalizer(fini, finalize_data, finalize_hint);
566
+ }
567
+ };
546
568
  Finalizer.prototype.dispose = function () {
547
569
  this.envObject = undefined;
570
+ this._makeDynCall_vppp = undefined;
548
571
  };
549
572
  return Finalizer;
550
573
  }());
@@ -552,91 +575,45 @@ var emnapi = (function (exports) {
552
575
  var TrackedFinalizer = /*#__PURE__*/ (function (_super) {
553
576
  __extends(TrackedFinalizer, _super);
554
577
  function TrackedFinalizer(envObject, finalize_callback, finalize_data, finalize_hint) {
555
- var _this = _super.call(this, envObject, finalize_callback, finalize_data, finalize_hint) || this;
556
- _this._next = null;
557
- _this._prev = null;
558
- _this.link(!finalize_callback ? envObject.reflist : envObject.finalizing_reflist);
578
+ var _this = _super.call(this) || this;
579
+ _this._finalizer = new Finalizer(envObject, finalize_callback, finalize_data, finalize_hint);
559
580
  return _this;
560
581
  }
561
- TrackedFinalizer.finalizeAll = function (list) {
562
- RefTracker.finalizeAll(list);
563
- };
564
- TrackedFinalizer.prototype.link = function (list) {
565
- RefTracker.prototype.link.call(this, list);
566
- };
567
- TrackedFinalizer.prototype.unlink = function () {
568
- RefTracker.prototype.unlink.call(this);
569
- };
570
582
  TrackedFinalizer.create = function (envObject, finalize_callback, finalize_data, finalize_hint) {
571
- return new TrackedFinalizer(envObject, finalize_callback, finalize_data, finalize_hint);
583
+ var finalizer = new TrackedFinalizer(envObject, finalize_callback, finalize_data, finalize_hint);
584
+ finalizer.link(envObject.finalizing_reflist);
585
+ return finalizer;
586
+ };
587
+ TrackedFinalizer.prototype.data = function () {
588
+ return this._finalizer.data();
572
589
  };
573
590
  TrackedFinalizer.prototype.dispose = function () {
591
+ if (!this._finalizer)
592
+ return;
574
593
  this.unlink();
575
- this.envObject.dequeueFinalizer(this);
594
+ this._finalizer.envObject.dequeueFinalizer(this);
595
+ this._finalizer.dispose();
596
+ this._finalizer = undefined;
576
597
  _super.prototype.dispose.call(this);
577
598
  };
578
599
  TrackedFinalizer.prototype.finalize = function () {
579
- this.finalizeCore(true);
580
- };
581
- TrackedFinalizer.prototype.finalizeCore = function (deleteMe) {
582
- var finalize_callback = this._finalizeCallback;
583
- var finalize_data = this._finalizeData;
584
- var finalize_hint = this._finalizeHint;
585
- this.resetFinalizer();
586
600
  this.unlink();
587
601
  var error;
588
602
  var caught = false;
589
- if (finalize_callback) {
590
- var fini = Number(finalize_callback);
591
- try {
592
- this.envObject.callFinalizer(fini, finalize_data, finalize_hint);
593
- }
594
- catch (err) {
595
- caught = true;
596
- error = err;
597
- }
603
+ try {
604
+ this._finalizer.callFinalizer();
598
605
  }
599
- if (deleteMe) {
600
- this.dispose();
606
+ catch (err) {
607
+ caught = true;
608
+ error = err;
601
609
  }
610
+ this.dispose();
602
611
  if (caught) {
603
612
  throw error;
604
613
  }
605
614
  };
606
615
  return TrackedFinalizer;
607
- }(Finalizer));
608
-
609
- var RefBase = /*#__PURE__*/ (function (_super) {
610
- __extends(RefBase, _super);
611
- function RefBase(envObject, initial_refcount, ownership, finalize_callback, finalize_data, finalize_hint) {
612
- var _this = _super.call(this, envObject, finalize_callback, finalize_data, finalize_hint) || this;
613
- _this._refcount = initial_refcount;
614
- _this._ownership = ownership;
615
- return _this;
616
- }
617
- RefBase.prototype.data = function () {
618
- return this._finalizeData;
619
- };
620
- RefBase.prototype.ref = function () {
621
- return ++this._refcount;
622
- };
623
- RefBase.prototype.unref = function () {
624
- if (this._refcount === 0) {
625
- return 0;
626
- }
627
- return --this._refcount;
628
- };
629
- RefBase.prototype.refCount = function () {
630
- return this._refcount;
631
- };
632
- RefBase.prototype.ownership = function () {
633
- return this._ownership;
634
- };
635
- RefBase.prototype.finalize = function () {
636
- this.finalizeCore(this._ownership === 0 /* Ownership.kRuntime */);
637
- };
638
- return RefBase;
639
- }(TrackedFinalizer));
616
+ }(RefTracker));
640
617
 
641
618
  function throwNodeApiVersionError(moduleName, moduleApiVersion) {
642
619
  var errorMessage = "".concat(moduleName, " requires Node-API version ").concat(moduleApiVersion, ", but this version of Node.js only supports version ").concat(NODE_API_SUPPORTED_VERSION_MAX, " add-ons.");
@@ -732,18 +709,6 @@ var emnapi = (function (exports) {
732
709
  }
733
710
  return r;
734
711
  };
735
- /** @virtual */
736
- Env.prototype.callFinalizer = function (cb, data, hint) {
737
- var f = this.makeDynCall_vppp(cb);
738
- var env = this.id;
739
- var scope = this.ctx.openScope(this);
740
- try {
741
- this.callIntoModule(function () { f(env, data, hint); });
742
- }
743
- finally {
744
- this.ctx.closeScope(this, scope);
745
- }
746
- };
747
712
  Env.prototype.invokeFinalizerFromGC = function (finalizer) {
748
713
  if (this.moduleApiVersion !== NAPI_VERSION_EXPERIMENTAL) {
749
714
  this.enqueueFinalizer(finalizer);
@@ -784,8 +749,8 @@ var emnapi = (function (exports) {
784
749
  };
785
750
  /** @virtual */
786
751
  Env.prototype.deleteMe = function () {
787
- RefBase.finalizeAll(this.finalizing_reflist);
788
- RefBase.finalizeAll(this.reflist);
752
+ RefTracker.finalizeAll(this.finalizing_reflist);
753
+ RefTracker.finalizeAll(this.reflist);
789
754
  this.tryCatch.extractException();
790
755
  this.ctx.envStore.remove(this.id);
791
756
  };
@@ -793,6 +758,8 @@ var emnapi = (function (exports) {
793
758
  if (this.id === 0)
794
759
  return;
795
760
  this.deleteMe();
761
+ this.finalizing_reflist.dispose();
762
+ this.reflist.dispose();
796
763
  this.id = 0;
797
764
  };
798
765
  Env.prototype.initObjectBinding = function (value) {
@@ -814,7 +781,7 @@ var emnapi = (function (exports) {
814
781
  if (this.instanceData) {
815
782
  this.instanceData.dispose();
816
783
  }
817
- this.instanceData = new RefBase(this, 0, 0 /* Ownership.kRuntime */, finalize_cb, data, finalize_hint);
784
+ this.instanceData = TrackedFinalizer.create(this, finalize_cb, data, finalize_hint);
818
785
  };
819
786
  Env.prototype.getInstanceData = function () {
820
787
  return this.instanceData ? this.instanceData.data() : 0;
@@ -1077,69 +1044,82 @@ var emnapi = (function (exports) {
1077
1044
  return Persistent;
1078
1045
  }());
1079
1046
 
1080
- function weakCallback(ref) {
1081
- ref.persistent.reset();
1082
- ref.envObject.invokeFinalizerFromGC(ref);
1083
- }
1047
+ exports.ReferenceOwnership = void 0;
1048
+ (function (ReferenceOwnership) {
1049
+ ReferenceOwnership[ReferenceOwnership["kRuntime"] = 0] = "kRuntime";
1050
+ ReferenceOwnership[ReferenceOwnership["kUserland"] = 1] = "kUserland";
1051
+ })(exports.ReferenceOwnership || (exports.ReferenceOwnership = {}));
1084
1052
  function canBeHeldWeakly(value) {
1085
1053
  return value.isObject() || value.isFunction() || value.isSymbol();
1086
1054
  }
1087
1055
  var Reference = /*#__PURE__*/ (function (_super) {
1088
1056
  __extends(Reference, _super);
1089
- function Reference(envObject, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint) {
1090
- if (finalize_callback === void 0) { finalize_callback = 0; }
1091
- if (finalize_data === void 0) { finalize_data = 0; }
1092
- if (finalize_hint === void 0) { finalize_hint = 0; }
1093
- var _this = _super.call(this, envObject, initialRefcount >>> 0, ownership, finalize_callback, finalize_data, finalize_hint) || this;
1057
+ function Reference(envObject, handle_id, initialRefcount, ownership) {
1058
+ var _this = _super.call(this) || this;
1059
+ _this.envObject = envObject;
1060
+ _this._refcount = initialRefcount;
1061
+ _this._ownership = ownership;
1062
+ var handle = envObject.ctx.handleStore.get(handle_id);
1063
+ _this.canBeWeak = canBeHeldWeakly(handle);
1064
+ _this.persistent = new Persistent(handle.value);
1094
1065
  _this.id = 0;
1066
+ if (initialRefcount === 0) {
1067
+ _this._setWeak();
1068
+ }
1095
1069
  return _this;
1096
1070
  }
1097
- Reference.create = function (envObject, handle_id, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint) {
1098
- if (finalize_callback === void 0) { finalize_callback = 0; }
1099
- if (finalize_data === void 0) { finalize_data = 0; }
1100
- if (finalize_hint === void 0) { finalize_hint = 0; }
1101
- var handle = envObject.ctx.handleStore.get(handle_id);
1102
- var ref = new Reference(envObject, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint);
1071
+ Reference.weakCallback = function (ref) {
1072
+ ref.persistent.reset();
1073
+ ref.invokeFinalizerFromGC();
1074
+ };
1075
+ Reference.create = function (envObject, handle_id, initialRefcount, ownership, _unused1, _unused2, _unused3) {
1076
+ var ref = new Reference(envObject, handle_id, initialRefcount, ownership);
1103
1077
  envObject.ctx.refStore.add(ref);
1104
- ref.canBeWeak = canBeHeldWeakly(handle);
1105
- ref.persistent = new Persistent(handle.value);
1106
- if (initialRefcount === 0) {
1107
- ref._setWeak();
1108
- }
1078
+ ref.link(envObject.reflist);
1109
1079
  return ref;
1110
1080
  };
1111
1081
  Reference.prototype.ref = function () {
1112
1082
  if (this.persistent.isEmpty()) {
1113
1083
  return 0;
1114
1084
  }
1115
- var count = _super.prototype.ref.call(this);
1116
- if (count === 1 && this.canBeWeak) {
1085
+ if (++this._refcount === 1 && this.canBeWeak) {
1117
1086
  this.persistent.clearWeak();
1118
1087
  }
1119
- return count;
1088
+ return this._refcount;
1120
1089
  };
1121
1090
  Reference.prototype.unref = function () {
1122
- if (this.persistent.isEmpty()) {
1091
+ if (this.persistent.isEmpty() || this._refcount === 0) {
1123
1092
  return 0;
1124
1093
  }
1125
- var oldRefcount = this.refCount();
1126
- var refcount = _super.prototype.unref.call(this);
1127
- if (oldRefcount === 1 && refcount === 0) {
1094
+ if (--this._refcount === 0) {
1128
1095
  this._setWeak();
1129
1096
  }
1130
- return refcount;
1097
+ return this._refcount;
1131
1098
  };
1132
- Reference.prototype.get = function () {
1099
+ Reference.prototype.get = function (envObject) {
1100
+ if (envObject === void 0) { envObject = this.envObject; }
1133
1101
  if (this.persistent.isEmpty()) {
1134
1102
  return 0;
1135
1103
  }
1136
1104
  var obj = this.persistent.deref();
1137
- var handle = this.envObject.ensureHandle(obj);
1105
+ var handle = envObject.ensureHandle(obj);
1138
1106
  return handle.id;
1139
1107
  };
1108
+ /** @virtual */
1109
+ Reference.prototype.resetFinalizer = function () { };
1110
+ /** @virtual */
1111
+ Reference.prototype.data = function () { return 0; };
1112
+ Reference.prototype.refcount = function () { return this._refcount; };
1113
+ Reference.prototype.ownership = function () { return this._ownership; };
1114
+ /** @virtual */
1115
+ Reference.prototype.callUserFinalizer = function () { };
1116
+ /** @virtual */
1117
+ Reference.prototype.invokeFinalizerFromGC = function () {
1118
+ this.finalize();
1119
+ };
1140
1120
  Reference.prototype._setWeak = function () {
1141
1121
  if (this.canBeWeak) {
1142
- this.persistent.setWeak(this, weakCallback);
1122
+ this.persistent.setWeak(this, Reference.weakCallback);
1143
1123
  }
1144
1124
  else {
1145
1125
  this.persistent.reset();
@@ -1147,18 +1127,78 @@ var emnapi = (function (exports) {
1147
1127
  };
1148
1128
  Reference.prototype.finalize = function () {
1149
1129
  this.persistent.reset();
1150
- _super.prototype.finalize.call(this);
1130
+ var deleteMe = this._ownership === exports.ReferenceOwnership.kRuntime;
1131
+ this.unlink();
1132
+ this.callUserFinalizer();
1133
+ if (deleteMe) {
1134
+ this.dispose();
1135
+ }
1151
1136
  };
1152
1137
  Reference.prototype.dispose = function () {
1153
1138
  if (this.id === 0)
1154
1139
  return;
1140
+ this.unlink();
1155
1141
  this.persistent.reset();
1156
1142
  this.envObject.ctx.refStore.remove(this.id);
1157
1143
  _super.prototype.dispose.call(this);
1144
+ this.envObject = undefined;
1158
1145
  this.id = 0;
1159
1146
  };
1160
1147
  return Reference;
1161
- }(RefBase));
1148
+ }(RefTracker));
1149
+ var ReferenceWithData = /*#__PURE__*/ (function (_super) {
1150
+ __extends(ReferenceWithData, _super);
1151
+ function ReferenceWithData(envObject, value, initialRefcount, ownership, _data) {
1152
+ var _this = _super.call(this, envObject, value, initialRefcount, ownership) || this;
1153
+ _this._data = _data;
1154
+ return _this;
1155
+ }
1156
+ ReferenceWithData.create = function (envObject, value, initialRefcount, ownership, data) {
1157
+ var reference = new ReferenceWithData(envObject, value, initialRefcount, ownership, data);
1158
+ envObject.ctx.refStore.add(reference);
1159
+ reference.link(envObject.reflist);
1160
+ return reference;
1161
+ };
1162
+ ReferenceWithData.prototype.data = function () {
1163
+ return this._data;
1164
+ };
1165
+ return ReferenceWithData;
1166
+ }(Reference));
1167
+ var ReferenceWithFinalizer = /*#__PURE__*/ (function (_super) {
1168
+ __extends(ReferenceWithFinalizer, _super);
1169
+ function ReferenceWithFinalizer(envObject, value, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint) {
1170
+ var _this = _super.call(this, envObject, value, initialRefcount, ownership) || this;
1171
+ _this._finalizer = new Finalizer(envObject, finalize_callback, finalize_data, finalize_hint);
1172
+ return _this;
1173
+ }
1174
+ ReferenceWithFinalizer.create = function (envObject, value, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint) {
1175
+ var reference = new ReferenceWithFinalizer(envObject, value, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint);
1176
+ envObject.ctx.refStore.add(reference);
1177
+ reference.link(envObject.finalizing_reflist);
1178
+ return reference;
1179
+ };
1180
+ ReferenceWithFinalizer.prototype.resetFinalizer = function () {
1181
+ this._finalizer.resetFinalizer();
1182
+ };
1183
+ ReferenceWithFinalizer.prototype.data = function () {
1184
+ return this._finalizer.data();
1185
+ };
1186
+ ReferenceWithFinalizer.prototype.callUserFinalizer = function () {
1187
+ this._finalizer.callFinalizer();
1188
+ };
1189
+ ReferenceWithFinalizer.prototype.invokeFinalizerFromGC = function () {
1190
+ this._finalizer.envObject.invokeFinalizerFromGC(this);
1191
+ };
1192
+ ReferenceWithFinalizer.prototype.dispose = function () {
1193
+ if (!this._finalizer)
1194
+ return;
1195
+ this._finalizer.envObject.dequeueFinalizer(this);
1196
+ this._finalizer.dispose();
1197
+ _super.prototype.dispose.call(this);
1198
+ this._finalizer = undefined;
1199
+ };
1200
+ return ReferenceWithFinalizer;
1201
+ }(Reference));
1162
1202
 
1163
1203
  var Deferred = /*#__PURE__*/ (function () {
1164
1204
  function Deferred(ctx, value) {
@@ -1315,6 +1355,7 @@ var emnapi = (function (exports) {
1315
1355
  var _this = this;
1316
1356
  this._isStopping = false;
1317
1357
  this._canCallIntoJs = true;
1358
+ this._suppressDestroy = false;
1318
1359
  this.envStore = new Store();
1319
1360
  this.scopeStore = new ScopeStore();
1320
1361
  this.refStore = new Store();
@@ -1336,10 +1377,23 @@ var emnapi = (function (exports) {
1336
1377
  if (typeof process === 'object' && process !== null && typeof process.once === 'function') {
1337
1378
  this.refCounter = new NodejsWaitingRequestCounter();
1338
1379
  process.once('beforeExit', function () {
1339
- _this.destroy();
1380
+ if (!_this._suppressDestroy) {
1381
+ _this.destroy();
1382
+ }
1340
1383
  });
1341
1384
  }
1342
1385
  }
1386
+ /**
1387
+ * Suppress the destroy on `beforeExit` event in Node.js.
1388
+ * Call this method if you want to keep the context and
1389
+ * all associated {@link Env | Env} alive,
1390
+ * this also means that cleanup hooks will not be called.
1391
+ * After call this method, you should call
1392
+ * {@link Context.destroy | `Context.prototype.destroy`} method manually.
1393
+ */
1394
+ Context.prototype.suppressDestroy = function () {
1395
+ this._suppressDestroy = true;
1396
+ };
1343
1397
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1344
1398
  Context.prototype.getRuntimeVersions = function () {
1345
1399
  return {
@@ -1355,11 +1409,17 @@ var emnapi = (function (exports) {
1355
1409
  Context.prototype.createNotSupportBufferError = function (api, message) {
1356
1410
  return new NotSupportBufferError(api, message);
1357
1411
  };
1358
- Context.prototype.createReference = function (envObject, handle_id, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint) {
1412
+ Context.prototype.createReference = function (envObject, handle_id, initialRefcount, ownership) {
1413
+ return Reference.create(envObject, handle_id, initialRefcount, ownership);
1414
+ };
1415
+ Context.prototype.createReferenceWithData = function (envObject, handle_id, initialRefcount, ownership, data) {
1416
+ return ReferenceWithData.create(envObject, handle_id, initialRefcount, ownership, data);
1417
+ };
1418
+ Context.prototype.createReferenceWithFinalizer = function (envObject, handle_id, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint) {
1359
1419
  if (finalize_callback === void 0) { finalize_callback = 0; }
1360
1420
  if (finalize_data === void 0) { finalize_data = 0; }
1361
1421
  if (finalize_hint === void 0) { finalize_hint = 0; }
1362
- return Reference.create(envObject, handle_id, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint);
1422
+ return ReferenceWithFinalizer.create(envObject, handle_id, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint);
1363
1423
  };
1364
1424
  Context.prototype.createDeferred = function (value) {
1365
1425
  return Deferred.create(this, value);
@@ -1420,6 +1480,10 @@ var emnapi = (function (exports) {
1420
1480
  Context.prototype.canCallIntoJs = function () {
1421
1481
  return this._canCallIntoJs && !this._isStopping;
1422
1482
  };
1483
+ /**
1484
+ * Destroy the context and call cleanup hooks.
1485
+ * Associated {@link Env | Env} will be destroyed.
1486
+ */
1423
1487
  Context.prototype.destroy = function () {
1424
1488
  this.setStopping(true);
1425
1489
  this.setCanCallIntoJs(false);
@@ -1457,9 +1521,10 @@ var emnapi = (function (exports) {
1457
1521
  exports.NotSupportBufferError = NotSupportBufferError;
1458
1522
  exports.NotSupportWeakRefError = NotSupportWeakRefError;
1459
1523
  exports.Persistent = Persistent;
1460
- exports.RefBase = RefBase;
1461
1524
  exports.RefTracker = RefTracker;
1462
1525
  exports.Reference = Reference;
1526
+ exports.ReferenceWithData = ReferenceWithData;
1527
+ exports.ReferenceWithFinalizer = ReferenceWithFinalizer;
1463
1528
  exports.ScopeStore = ScopeStore;
1464
1529
  exports.Store = Store;
1465
1530
  exports.TrackedFinalizer = TrackedFinalizer;