@emnapi/runtime 0.42.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emnapi.cjs.js +72 -28
- package/dist/emnapi.cjs.min.d.ts +19 -8
- package/dist/emnapi.cjs.min.js +1 -1
- package/dist/emnapi.d.mts +19 -8
- package/dist/emnapi.d.ts +19 -8
- package/dist/emnapi.esm-bundler.js +81 -37
- package/dist/emnapi.iife.d.ts +19 -8
- package/dist/emnapi.iife.js +81 -36
- package/dist/emnapi.js +81 -36
- package/dist/emnapi.min.d.mts +19 -8
- package/dist/emnapi.min.js +1 -1
- package/dist/emnapi.min.mjs +1 -1
- package/dist/emnapi.mjs +72 -29
- package/package.json +1 -1
package/dist/emnapi.cjs.js
CHANGED
|
@@ -199,7 +199,7 @@ const _Buffer = typeof Buffer === 'function'
|
|
|
199
199
|
catch (_) { }
|
|
200
200
|
return undefined;
|
|
201
201
|
})();
|
|
202
|
-
const version = "0.
|
|
202
|
+
const version = "0.43.0";
|
|
203
203
|
const NODE_API_SUPPORTED_VERSION_MIN = 1;
|
|
204
204
|
const NODE_API_SUPPORTED_VERSION_MAX = 9;
|
|
205
205
|
const NAPI_VERSION_EXPERIMENTAL = 2147483647;
|
|
@@ -489,7 +489,7 @@ class Finalizer {
|
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
class
|
|
492
|
+
class TrackedFinalizer extends Finalizer {
|
|
493
493
|
static finalizeAll(list) {
|
|
494
494
|
RefTracker.finalizeAll(list);
|
|
495
495
|
}
|
|
@@ -499,12 +499,13 @@ class RefBase extends Finalizer {
|
|
|
499
499
|
unlink() {
|
|
500
500
|
RefTracker.prototype.unlink.call(this);
|
|
501
501
|
}
|
|
502
|
-
|
|
502
|
+
static create(envObject, finalize_callback, finalize_data, finalize_hint) {
|
|
503
|
+
return new TrackedFinalizer(envObject, finalize_callback, finalize_data, finalize_hint);
|
|
504
|
+
}
|
|
505
|
+
constructor(envObject, finalize_callback, finalize_data, finalize_hint) {
|
|
503
506
|
super(envObject, finalize_callback, finalize_data, finalize_hint);
|
|
504
507
|
this._next = null;
|
|
505
508
|
this._prev = null;
|
|
506
|
-
this._refcount = initial_refcount;
|
|
507
|
-
this._ownership = ownership;
|
|
508
509
|
this.link(!finalize_callback ? envObject.reflist : envObject.finalizing_reflist);
|
|
509
510
|
}
|
|
510
511
|
dispose() {
|
|
@@ -512,26 +513,10 @@ class RefBase extends Finalizer {
|
|
|
512
513
|
this.envObject.dequeueFinalizer(this);
|
|
513
514
|
super.dispose();
|
|
514
515
|
}
|
|
515
|
-
data() {
|
|
516
|
-
return this._finalizeData;
|
|
517
|
-
}
|
|
518
|
-
ref() {
|
|
519
|
-
return ++this._refcount;
|
|
520
|
-
}
|
|
521
|
-
unref() {
|
|
522
|
-
if (this._refcount === 0) {
|
|
523
|
-
return 0;
|
|
524
|
-
}
|
|
525
|
-
return --this._refcount;
|
|
526
|
-
}
|
|
527
|
-
refCount() {
|
|
528
|
-
return this._refcount;
|
|
529
|
-
}
|
|
530
|
-
ownership() {
|
|
531
|
-
return this._ownership;
|
|
532
|
-
}
|
|
533
516
|
finalize() {
|
|
534
|
-
|
|
517
|
+
this.finalizeCore(true);
|
|
518
|
+
}
|
|
519
|
+
finalizeCore(deleteMe) {
|
|
535
520
|
const finalize_callback = this._finalizeCallback;
|
|
536
521
|
const finalize_data = this._finalizeData;
|
|
537
522
|
const finalize_hint = this._finalizeHint;
|
|
@@ -549,7 +534,7 @@ class RefBase extends Finalizer {
|
|
|
549
534
|
error = err;
|
|
550
535
|
}
|
|
551
536
|
}
|
|
552
|
-
if (
|
|
537
|
+
if (deleteMe) {
|
|
553
538
|
this.dispose();
|
|
554
539
|
}
|
|
555
540
|
if (caught) {
|
|
@@ -558,6 +543,35 @@ class RefBase extends Finalizer {
|
|
|
558
543
|
}
|
|
559
544
|
}
|
|
560
545
|
|
|
546
|
+
class RefBase extends TrackedFinalizer {
|
|
547
|
+
constructor(envObject, initial_refcount, ownership, finalize_callback, finalize_data, finalize_hint) {
|
|
548
|
+
super(envObject, finalize_callback, finalize_data, finalize_hint);
|
|
549
|
+
this._refcount = initial_refcount;
|
|
550
|
+
this._ownership = ownership;
|
|
551
|
+
}
|
|
552
|
+
data() {
|
|
553
|
+
return this._finalizeData;
|
|
554
|
+
}
|
|
555
|
+
ref() {
|
|
556
|
+
return ++this._refcount;
|
|
557
|
+
}
|
|
558
|
+
unref() {
|
|
559
|
+
if (this._refcount === 0) {
|
|
560
|
+
return 0;
|
|
561
|
+
}
|
|
562
|
+
return --this._refcount;
|
|
563
|
+
}
|
|
564
|
+
refCount() {
|
|
565
|
+
return this._refcount;
|
|
566
|
+
}
|
|
567
|
+
ownership() {
|
|
568
|
+
return this._ownership;
|
|
569
|
+
}
|
|
570
|
+
finalize() {
|
|
571
|
+
this.finalizeCore(this._ownership === 0);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
561
575
|
function throwNodeApiVersionError(moduleName, moduleApiVersion) {
|
|
562
576
|
const errorMessage = `${moduleName} requires Node-API version ${moduleApiVersion}, but this version of Node.js only supports version ${NODE_API_SUPPORTED_VERSION_MAX} add-ons.`;
|
|
563
577
|
throw new Error(errorMessage);
|
|
@@ -587,6 +601,7 @@ class Env {
|
|
|
587
601
|
engineErrorCode: 0,
|
|
588
602
|
engineReserved: 0
|
|
589
603
|
};
|
|
604
|
+
this.inGcFinalizer = false;
|
|
590
605
|
this._bindingMap = new WeakMap();
|
|
591
606
|
this.id = 0;
|
|
592
607
|
}
|
|
@@ -658,6 +673,31 @@ class Env {
|
|
|
658
673
|
this.ctx.closeScope(this, scope);
|
|
659
674
|
}
|
|
660
675
|
}
|
|
676
|
+
invokeFinalizerFromGC(finalizer) {
|
|
677
|
+
if (this.moduleApiVersion !== NAPI_VERSION_EXPERIMENTAL) {
|
|
678
|
+
this.enqueueFinalizer(finalizer);
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
const saved = this.inGcFinalizer;
|
|
682
|
+
this.inGcFinalizer = true;
|
|
683
|
+
try {
|
|
684
|
+
finalizer.finalize();
|
|
685
|
+
}
|
|
686
|
+
finally {
|
|
687
|
+
this.inGcFinalizer = saved;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
checkGCAccess() {
|
|
692
|
+
if (this.moduleApiVersion === NAPI_VERSION_EXPERIMENTAL && this.inGcFinalizer) {
|
|
693
|
+
this.abort('Finalizer is calling a function that may affect GC state.\n' +
|
|
694
|
+
'The finalizers are run directly from GC and must not affect GC ' +
|
|
695
|
+
'state.\n' +
|
|
696
|
+
'Use `node_api_post_finalizer` from inside of the finalizer to work ' +
|
|
697
|
+
'around this issue.\n' +
|
|
698
|
+
'It schedules the call as a new task in the event loop.');
|
|
699
|
+
}
|
|
700
|
+
}
|
|
661
701
|
enqueueFinalizer(finalizer) {
|
|
662
702
|
if (this.pendingFinalizers.indexOf(finalizer) === -1) {
|
|
663
703
|
this.pendingFinalizers.push(finalizer);
|
|
@@ -720,7 +760,7 @@ class NodeEnv extends Env {
|
|
|
720
760
|
super.deleteMe();
|
|
721
761
|
}
|
|
722
762
|
canCallIntoJs() {
|
|
723
|
-
return this.ctx.canCallIntoJs();
|
|
763
|
+
return super.canCallIntoJs() && this.ctx.canCallIntoJs();
|
|
724
764
|
}
|
|
725
765
|
triggerFatalException(err) {
|
|
726
766
|
if (this.nodeBinding) {
|
|
@@ -746,7 +786,7 @@ class NodeEnv extends Env {
|
|
|
746
786
|
}
|
|
747
787
|
const hasProcess = typeof process === 'object' && process !== null;
|
|
748
788
|
const hasForceFlag = hasProcess ? Boolean(process.execArgv && (process.execArgv.indexOf('--force-node-api-uncaught-exceptions-policy') !== -1)) : false;
|
|
749
|
-
if (!hasForceFlag && !enforceUncaughtExceptionPolicy) {
|
|
789
|
+
if (envObject.moduleApiVersion < NAPI_VERSION_EXPERIMENTAL && !hasForceFlag && !enforceUncaughtExceptionPolicy) {
|
|
750
790
|
const warn = hasProcess && typeof process.emitWarning === 'function'
|
|
751
791
|
? process.emitWarning
|
|
752
792
|
: function (warning, type, code) {
|
|
@@ -947,7 +987,7 @@ Persistent._registry = supportFinalizer
|
|
|
947
987
|
|
|
948
988
|
function weakCallback(ref) {
|
|
949
989
|
ref.persistent.reset();
|
|
950
|
-
ref.envObject.
|
|
990
|
+
ref.envObject.invokeFinalizerFromGC(ref);
|
|
951
991
|
}
|
|
952
992
|
function canBeHeldWeakly(value) {
|
|
953
993
|
return value.isObject() || value.isFunction() || value.isSymbol();
|
|
@@ -1216,6 +1256,9 @@ class Context {
|
|
|
1216
1256
|
createEnv(filename, moduleApiVersion, makeDynCall_vppp, makeDynCall_vp, abort, nodeBinding) {
|
|
1217
1257
|
return newEnv(this, filename, moduleApiVersion, makeDynCall_vppp, makeDynCall_vp, abort, nodeBinding);
|
|
1218
1258
|
}
|
|
1259
|
+
createTrackedFinalizer(envObject, finalize_callback, finalize_data, finalize_hint) {
|
|
1260
|
+
return TrackedFinalizer.create(envObject, finalize_callback, finalize_data, finalize_hint);
|
|
1261
|
+
}
|
|
1219
1262
|
getCurrentScope() {
|
|
1220
1263
|
return this.scopeStore.currentScope;
|
|
1221
1264
|
}
|
|
@@ -1307,6 +1350,7 @@ exports.RefTracker = RefTracker;
|
|
|
1307
1350
|
exports.Reference = Reference;
|
|
1308
1351
|
exports.ScopeStore = ScopeStore;
|
|
1309
1352
|
exports.Store = Store;
|
|
1353
|
+
exports.TrackedFinalizer = TrackedFinalizer;
|
|
1310
1354
|
exports.TryCatch = TryCatch;
|
|
1311
1355
|
exports.createContext = createContext;
|
|
1312
1356
|
exports.getDefaultContext = getDefaultContext;
|
package/dist/emnapi.cjs.min.d.ts
CHANGED
|
@@ -316,6 +316,7 @@ export declare class Context {
|
|
|
316
316
|
createReference(envObject: Env, handle_id: napi_value, initialRefcount: uint32_t, ownership: 0 | 1, finalize_callback?: napi_finalize, finalize_data?: void_p, finalize_hint?: void_p): Reference;
|
|
317
317
|
createDeferred<T = any>(value: IDeferrdValue<T>): Deferred<T>;
|
|
318
318
|
createEnv(filename: string, moduleApiVersion: number, makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void, abort: (msg?: string) => never, nodeBinding?: any): Env;
|
|
319
|
+
createTrackedFinalizer(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p): TrackedFinalizer;
|
|
319
320
|
getCurrentScope(): HandleScope | null;
|
|
320
321
|
addToCurrentScope<V>(value: V): Handle<V>;
|
|
321
322
|
openScope(envObject: Env): HandleScope;
|
|
@@ -368,6 +369,7 @@ export declare class Env implements IStoreValue {
|
|
|
368
369
|
engineErrorCode: number;
|
|
369
370
|
engineReserved: Ptr;
|
|
370
371
|
};
|
|
372
|
+
inGcFinalizer: boolean;
|
|
371
373
|
constructor(ctx: Context, moduleApiVersion: number, makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void, abort: (msg?: string) => never);
|
|
372
374
|
canCallIntoJs(): boolean;
|
|
373
375
|
terminatedOrTerminating(): boolean;
|
|
@@ -380,6 +382,8 @@ export declare class Env implements IStoreValue {
|
|
|
380
382
|
getReturnStatus(): napi_status;
|
|
381
383
|
callIntoModule<T>(fn: (env: Env) => T, handleException?: (envObject: Env, value: any) => void): T;
|
|
382
384
|
callFinalizer(cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
385
|
+
invokeFinalizerFromGC(finalizer: RefTracker): void;
|
|
386
|
+
checkGCAccess(): void;
|
|
383
387
|
enqueueFinalizer(finalizer: RefTracker): void;
|
|
384
388
|
dequeueFinalizer(finalizer: RefTracker): void;
|
|
385
389
|
deleteMe(): void;
|
|
@@ -527,17 +531,10 @@ export declare class Persistent<T> {
|
|
|
527
531
|
deref(): T | undefined;
|
|
528
532
|
}
|
|
529
533
|
|
|
530
|
-
export declare
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export declare class RefBase extends Finalizer {
|
|
534
|
-
static finalizeAll(list: RefTracker): void;
|
|
535
|
-
link(list: RefTracker): void;
|
|
536
|
-
unlink(): void;
|
|
534
|
+
export declare class RefBase extends TrackedFinalizer {
|
|
537
535
|
private _refcount;
|
|
538
536
|
private readonly _ownership;
|
|
539
537
|
constructor(envObject: Env, initial_refcount: uint32_t, ownership: number, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p);
|
|
540
|
-
dispose(): void;
|
|
541
538
|
data(): void_p;
|
|
542
539
|
ref(): uint32_t;
|
|
543
540
|
unref(): uint32_t;
|
|
@@ -591,6 +588,20 @@ export declare class Store<V extends IStoreValue> {
|
|
|
591
588
|
dispose(): void;
|
|
592
589
|
}
|
|
593
590
|
|
|
591
|
+
export declare interface TrackedFinalizer extends Finalizer, RefTracker {
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export declare class TrackedFinalizer extends Finalizer {
|
|
595
|
+
static finalizeAll(list: RefTracker): void;
|
|
596
|
+
link(list: RefTracker): void;
|
|
597
|
+
unlink(): void;
|
|
598
|
+
static create(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p): TrackedFinalizer;
|
|
599
|
+
protected constructor(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p);
|
|
600
|
+
dispose(): void;
|
|
601
|
+
finalize(): void;
|
|
602
|
+
protected finalizeCore(deleteMe: boolean): void;
|
|
603
|
+
}
|
|
604
|
+
|
|
594
605
|
export declare class TryCatch {
|
|
595
606
|
private _exception;
|
|
596
607
|
private _caught;
|
package/dist/emnapi.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[];class t{constructor(e,t,n,i,s,r,o){this.id=e,this.parent=t,this.child=n,this.thiz=i,this.data=s,this.args=r,this.fn=o}getNewTarget(e){const t=this.thiz;return null==t||null==t.constructor?0:t instanceof this.fn?e.ensureHandleId(t.constructor):0}dispose(){void 0!==this.thiz&&(this.thiz=void 0),this.args=e,this.fn=null}}const n=new t(0,null,null,null,0,null,null);class i{constructor(){this.current=n}get(e){if(1===e)return n.child;let t=n;for(let n=0;n<e;++n)if(t=t.child,null===t)return null;return t===n?null:t}pop(){const e=this.current;e!==n&&(this.current=e.parent,e.dispose())}push(e,n,i,s){let r=this.current.child;return r?(r.thiz=e,r.data=n,r.args=i,r.fn=s):(r=new t(this.current.id+1,this.current,null,e,n,i,s),this.current.child=r),this.current=r,r.id}dispose(){this.current=null}}const s=function(){let e;try{e=new Function}catch(e){return!1}return"function"==typeof e}(),r=function(){if("undefined"!=typeof globalThis)return globalThis;let e=function(){return this}();if(!e&&s)try{e=new Function("return this")()}catch(e){}if(!e){if("undefined"==typeof __webpack_public_path__&&"undefined"!=typeof global)return global;if("undefined"!=typeof window)return window;if("undefined"!=typeof self)return self}return e}();class o{constructor(){this._exception=void 0,this._caught=!1}hasCaught(){return this._caught}exception(){return this._exception}setError(e){this._caught=!0,this._exception=e}reset(){this._caught=!1,this._exception=void 0}extractException(){const e=this._exception;return this.reset(),e}}const a=function(){var e;try{return Boolean(null===(e=Object.getOwnPropertyDescriptor(Function.prototype,"name"))||void 0===e?void 0:e.configurable)}catch(e){return!1}}(),l="object"==typeof Reflect,c="undefined"!=typeof FinalizationRegistry&&"undefined"!=typeof WeakRef,u=function(){try{const e=Symbol();new WeakRef(e),(new WeakMap).set(e,void 0)}catch(e){return!1}return!0}(),h="undefined"!=typeof BigInt;function p(e){return"object"==typeof e&&null!==e||"function"==typeof e}const d=function(){let e;return e="undefined"!=typeof __webpack_public_path__||"undefined"!=typeof __webpack_public_path__?"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:void 0:"undefined"!=typeof require?require:void 0,e}(),f="function"==typeof MessageChannel?MessageChannel:function(){try{return d("worker_threads").MessageChannel}catch(e){}}(),_="function"==typeof setImmediate?setImmediate:function(e){if("function"!=typeof e)throw new TypeError('The "callback" argument must be of type function');if(f){let t=new f;t.port1.onmessage=function(){t.port1.onmessage=null,t=void 0,e()},t.port2.postMessage(null)}else setTimeout(e,0)},v="function"==typeof Buffer?Buffer:function(){try{return d("buffer").Buffer}catch(e){}}(),g="0.42.0",y=9,x=2147483647;class S{constructor(e,t){this.id=e,this.value=t}data(e){return e.getObjectBinding(this.value).data}isNumber(){return"number"==typeof this.value}isBigInt(){return"bigint"==typeof this.value}isString(){return"string"==typeof this.value}isFunction(){return"function"==typeof this.value}isExternal(){return p(this.value)&&null===Object.getPrototypeOf(this.value)}isObject(){return"object"==typeof this.value&&null!==this.value}isArray(){return Array.isArray(this.value)}isArrayBuffer(){return this.value instanceof ArrayBuffer}isTypedArray(){return ArrayBuffer.isView(this.value)&&!(this.value instanceof DataView)}isBuffer(){return"function"==typeof v&&v.isBuffer(this.value)}isDataView(){return this.value instanceof DataView}isDate(){return this.value instanceof Date}isPromise(){return this.value instanceof Promise}isBoolean(){return"boolean"==typeof this.value}isUndefined(){return void 0===this.value}isSymbol(){return"symbol"==typeof this.value}isNull(){return null===this.value}dispose(){this.value=void 0}}class b extends S{constructor(e,t){super(e,t)}dispose(){}}function E(){Object.setPrototypeOf(this,null)}E.prototype=null;class w{constructor(){this._values=[void 0,w.UNDEFINED,w.NULL,w.FALSE,w.TRUE,w.GLOBAL],this._next=w.MIN_ID}push(e){let t;const n=this._next,i=this._values;return n<i.length?(t=i[n],t.value=e):(t=new S(n,e),i[n]=t),this._next++,t}erase(e,t){this._next=e;const n=this._values;for(let i=e;i<t;++i)n[i].dispose()}get(e){return this._values[e]}swap(e,t){const n=this._values,i=n[e];n[e]=n[t],n[e].id=Number(e),n[t]=i,i.id=Number(t)}dispose(){this._values.length=w.MIN_ID,this._next=w.MIN_ID}}w.UNDEFINED=new b(1,void 0),w.NULL=new b(2,null),w.FALSE=new b(3,!1),w.TRUE=new b(4,!0),w.GLOBAL=new b(5,r),w.MIN_ID=6;class k{constructor(e,t,n,i,s=i){this.handleStore=e,this.id=t,this.parent=n,this.child=null,null!==n&&(n.child=this),this.start=i,this.end=s,this._escapeCalled=!1}add(e){const t=this.handleStore.push(e);return this.end++,t}addExternal(e,t){const n=new E,i=e.ctx.handleStore.push(n);return e.initObjectBinding(n).data=t,this.end++,i}dispose(){this.start!==this.end&&this.handleStore.erase(this.start,this.end)}escape(e){if(this._escapeCalled)return null;if(this._escapeCalled=!0,e<this.start||e>=this.end)return null;this.handleStore.swap(e,this.start);const t=this.handleStore.get(this.start);return this.start++,this.parent.end++,t}escapeCalled(){return this._escapeCalled}}class C{constructor(){this._rootScope=new k(null,0,null,1,w.MIN_ID),this.currentScope=this._rootScope}get(e){e=Number(e);let t=this.currentScope;for(;t!==this._rootScope;){if(t.id===e)return t;t=t.parent}}openScope(e){const t=this.currentScope;let n=t.child;return null!==n?(n.start=n.end=t.end,n._escapeCalled=!1):n=new k(e.ctx.handleStore,t.id+1,t,t.end),this.currentScope=n,e.openHandleScopes++,n}closeScope(e){if(0===e.openHandleScopes)return;const t=this.currentScope;this.currentScope=t.parent,t.dispose(),e.openHandleScopes--}dispose(){let e=this.currentScope;for(;null!==e;){e.handleStore=null,e.id=0,e.parent=null,e.start=w.MIN_ID,e.end=w.MIN_ID,e._escapeCalled=!1;const t=e.child;e.child=null,e=t}this.currentScope=null}}class m{constructor(){this._next=null,this._prev=null}finalize(){}link(e){this._prev=e,this._next=e._next,null!==this._next&&(this._next._prev=this),e._next=this}unlink(){null!==this._prev&&(this._prev._next=this._next),null!==this._next&&(this._next._prev=this._prev),this._prev=null,this._next=null}static finalizeAll(e){for(;null!==e._next;)e._next.finalize()}}class z{constructor(e,t=0,n=0,i=0){this.envObject=e,this._finalizeCallback=t,this._finalizeData=n,this._finalizeHint=i}callback(){return this._finalizeCallback}data(){return this._finalizeData}hint(){return this._finalizeHint}resetFinalizer(){this._finalizeCallback=0,this._finalizeData=0,this._finalizeHint=0}dispose(){this.envObject=void 0}}class I extends z{static finalizeAll(e){m.finalizeAll(e)}link(e){m.prototype.link.call(this,e)}unlink(){m.prototype.unlink.call(this)}constructor(e,t,n,i,s,r){super(e,i,s,r),this._next=null,this._prev=null,this._refcount=t,this._ownership=n,this.link(i?e.finalizing_reflist:e.reflist)}dispose(){this.unlink(),this.envObject.dequeueFinalizer(this),super.dispose()}data(){return this._finalizeData}ref(){return++this._refcount}unref(){return 0===this._refcount?0:--this._refcount}refCount(){return this._refcount}ownership(){return this._ownership}finalize(){const e=this._ownership,t=this._finalizeCallback,n=this._finalizeData,i=this._finalizeHint;let s;this.resetFinalizer(),this.unlink();let r=!1;if(t){const e=Number(t);try{this.envObject.callFinalizer(e,n,i)}catch(e){r=!0,s=e}}if(0===e&&this.dispose(),r)throw s}}function O(e,t){if(!e.terminatedOrTerminating())throw t}class D{constructor(e,t,n,i,s){this.ctx=e,this.moduleApiVersion=t,this.makeDynCall_vppp=n,this.makeDynCall_vp=i,this.abort=s,this.openHandleScopes=0,this.instanceData=null,this.tryCatch=new o,this.refs=1,this.reflist=new m,this.finalizing_reflist=new m,this.pendingFinalizers=[],this.lastError={errorCode:0,engineErrorCode:0,engineReserved:0},this._bindingMap=new WeakMap,this.id=0}canCallIntoJs(){return!0}terminatedOrTerminating(){return!this.canCallIntoJs()}ref(){this.refs++}unref(){this.refs--,0===this.refs&&this.dispose()}ensureHandle(e){return this.ctx.ensureHandle(e)}ensureHandleId(e){return this.ensureHandle(e).id}clearLastError(){const e=this.lastError;return 0!==e.errorCode&&(e.errorCode=0),0!==e.engineErrorCode&&(e.engineErrorCode=0),0!==e.engineReserved&&(e.engineReserved=0),0}setLastError(e,t=0,n=0){const i=this.lastError;return i.errorCode!==e&&(i.errorCode=e),i.engineErrorCode!==t&&(i.engineErrorCode=t),i.engineReserved!==n&&(i.engineReserved=n),e}getReturnStatus(){return this.tryCatch.hasCaught()?this.setLastError(10):0}callIntoModule(e,t=O){const n=this.openHandleScopes;this.clearLastError();const i=e(this);if(n!==this.openHandleScopes&&this.abort("open_handle_scopes != open_handle_scopes_before"),this.tryCatch.hasCaught()){t(this,this.tryCatch.extractException())}return i}callFinalizer(e,t,n){const i=this.makeDynCall_vppp(e),s=this.id,r=this.ctx.openScope(this);try{this.callIntoModule((()=>{i(s,t,n)}))}finally{this.ctx.closeScope(this,r)}}enqueueFinalizer(e){-1===this.pendingFinalizers.indexOf(e)&&this.pendingFinalizers.push(e)}dequeueFinalizer(e){const t=this.pendingFinalizers.indexOf(e);-1!==t&&this.pendingFinalizers.splice(t,1)}deleteMe(){I.finalizeAll(this.finalizing_reflist),I.finalizeAll(this.reflist),this.tryCatch.extractException(),this.ctx.envStore.remove(this.id)}dispose(){0!==this.id&&(this.deleteMe(),this.id=0)}initObjectBinding(e){const t={wrapped:0,tag:null,data:0};return this._bindingMap.set(e,t),t}getObjectBinding(e){return this._bindingMap.has(e)?this._bindingMap.get(e):this.initObjectBinding(e)}setInstanceData(e,t,n){this.instanceData&&this.instanceData.dispose(),this.instanceData=new I(this,0,0,t,e,n)}getInstanceData(){return this.instanceData?this.instanceData.data():0}}class N extends D{constructor(e,t,n,i,s,r,o){super(e,n,i,s,r),this.filename=t,this.nodeBinding=o,this.destructing=!1,this.finalizationScheduled=!1}deleteMe(){this.destructing=!0,this.drainFinalizerQueue(),super.deleteMe()}canCallIntoJs(){return this.ctx.canCallIntoJs()}triggerFatalException(e){if(this.nodeBinding)this.nodeBinding.napi.fatalException(e);else{if("object"!=typeof process||null===process||"function"!=typeof process._fatalException)throw e;process._fatalException(e)||(console.error(e),process.exit(1))}}callbackIntoModule(e,t){return this.callIntoModule(t,((t,n)=>{if(t.terminatedOrTerminating())return;const i="object"==typeof process&&null!==process;if(!!i&&Boolean(process.execArgv&&-1!==process.execArgv.indexOf("--force-node-api-uncaught-exceptions-policy"))||e)t.triggerFatalException(n);else{(i&&"function"==typeof process.emitWarning?process.emitWarning:function(e,t,n){if(e instanceof Error)console.warn(e.toString());else{const i=n?`[${n}] `:"";console.warn(`${i}${t||"Warning"}: ${e}`)}})("Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=true to handle those exceptions properly.","DeprecationWarning","DEP0168")}}))}callFinalizer(e,t,n){this.callFinalizerInternal(1,e,t,n)}callFinalizerInternal(e,t,n,i){const s=this.makeDynCall_vppp(t),r=this.id,o=this.ctx.openScope(this);try{this.callbackIntoModule(Boolean(e),(()=>{s(r,n,i)}))}finally{this.ctx.closeScope(this,o)}}enqueueFinalizer(e){super.enqueueFinalizer(e),this.finalizationScheduled||this.destructing||(this.finalizationScheduled=!0,this.ref(),_((()=>{this.finalizationScheduled=!1,this.unref(),this.drainFinalizerQueue()})))}drainFinalizerQueue(){for(;this.pendingFinalizers.length>0;){this.pendingFinalizers.shift().finalize()}}}function F(e,t,n,i,s,r,o){(n="number"!=typeof n?8:n)<8?n=8:n>y&&n!==x&&function(e,t){throw new Error(`${e} requires Node-API version ${t}, but this version of Node.js only supports version ${y} add-ons.`)}(t,n);const a=new N(e,t,n,i,s,r,o);return e.envStore.add(a),e.addCleanupHook(a,(()=>{a.unref()}),0),a}class R extends Error{constructor(e){super(e);const t=new.target,n=t.prototype;if(!(this instanceof R)){const e=Object.setPrototypeOf;"function"==typeof e?e.call(Object,this,n):this.__proto__=n,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}}}Object.defineProperty(R.prototype,"name",{configurable:!0,writable:!0,value:"EmnapiError"});class H extends R{constructor(e,t){super(`${e}: The current runtime does not support "FinalizationRegistry" and "WeakRef".${t?` ${t}`:""}`)}}Object.defineProperty(H.prototype,"name",{configurable:!0,writable:!0,value:"NotSupportWeakRefError"});class A extends R{constructor(e,t){super(`${e}: The current runtime does not support "Buffer". Consider using buffer polyfill to make sure \`globalThis.Buffer\` is defined.${t?` ${t}`:""}`)}}Object.defineProperty(A.prototype,"name",{configurable:!0,writable:!0,value:"NotSupportBufferError"});class B{constructor(e){this._value=e}deref(){return this._value}dispose(){this._value=void 0}}class j{constructor(e){this._ref=new B(e)}setWeak(e,t){if(!c||void 0===this._ref||this._ref instanceof WeakRef)return;const n=this._ref.deref();try{j._registry.register(n,this,this);const i=new WeakRef(n);this._ref.dispose(),this._ref=i,this._param=e,this._callback=t}catch(e){if("symbol"!=typeof n)throw e}}clearWeak(){if(c&&void 0!==this._ref&&this._ref instanceof WeakRef){try{j._registry.unregister(this)}catch(e){}this._param=void 0,this._callback=void 0;const e=this._ref.deref();this._ref=void 0===e?e:new B(e)}}reset(){if(c)try{j._registry.unregister(this)}catch(e){}this._param=void 0,this._callback=void 0,this._ref instanceof B&&this._ref.dispose(),this._ref=void 0}isEmpty(){return void 0===this._ref}deref(){if(void 0!==this._ref)return this._ref.deref()}}function M(e){e.persistent.reset(),e.envObject.enqueueFinalizer(e)}j._registry=c?new FinalizationRegistry((e=>{e._ref=void 0;const t=e._callback,n=e._param;e._callback=void 0,e._param=void 0,"function"==typeof t&&t(n)})):void 0;class L extends I{static create(e,t,n,i,s=0,r=0,o=0){const a=e.ctx.handleStore.get(t),l=new L(e,n,i,s,r,o);var c;return e.ctx.refStore.add(l),l.canBeWeak=(c=a).isObject()||c.isFunction()||c.isSymbol(),l.persistent=new j(a.value),0===n&&l._setWeak(),l}constructor(e,t,n,i=0,s=0,r=0){super(e,t>>>0,n,i,s,r),this.id=0}ref(){if(this.persistent.isEmpty())return 0;const e=super.ref();return 1===e&&this.canBeWeak&&this.persistent.clearWeak(),e}unref(){if(this.persistent.isEmpty())return 0;const e=this.refCount(),t=super.unref();return 1===e&&0===t&&this._setWeak(),t}get(){if(this.persistent.isEmpty())return 0;const e=this.persistent.deref();return this.envObject.ensureHandle(e).id}_setWeak(){this.canBeWeak?this.persistent.setWeak(this,M):this.persistent.reset()}finalize(){this.persistent.reset(),super.finalize()}dispose(){0!==this.id&&(this.persistent.reset(),this.envObject.ctx.refStore.remove(this.id),super.dispose(),this.id=0)}}class P{static create(e,t){const n=new P(e,t);return e.deferredStore.add(n),n}constructor(e,t){this.id=0,this.ctx=e,this.value=t}resolve(e){this.value.resolve(e),this.dispose()}reject(e){this.value.reject(e),this.dispose()}dispose(){this.ctx.deferredStore.remove(this.id),this.id=0,this.value=null,this.ctx=null}}class T{constructor(){this._values=[void 0],this._values.length=4,this._size=1,this._freeList=[]}add(e){let t;if(this._freeList.length)t=this._freeList.shift();else{t=this._size,this._size++;const e=this._values.length;t>=e&&(this._values.length=e+(e>>1)+16)}e.id=t,this._values[t]=e}get(e){return this._values[e]}has(e){return void 0!==this._values[e]}remove(e){const t=this._values[e];t&&(t.id=0,this._values[e]=void 0,this._freeList.push(Number(e)))}dispose(){for(let e=1;e<this._size;++e){const t=this._values[e];null==t||t.dispose()}this._values=[void 0],this._size=1,this._freeList=[]}}class W{constructor(e,t,n,i){this.envObject=e,this.fn=t,this.arg=n,this.order=i}}class U{constructor(){this._cleanupHooks=[],this._cleanupHookCounter=0}empty(){return 0===this._cleanupHooks.length}add(e,t,n){if(this._cleanupHooks.filter((i=>i.envObject===e&&i.fn===t&&i.arg===n)).length>0)throw new Error("Can not add same fn and arg twice");this._cleanupHooks.push(new W(e,t,n,this._cleanupHookCounter++))}remove(e,t,n){for(let i=0;i<this._cleanupHooks.length;++i){const s=this._cleanupHooks[i];if(s.envObject===e&&s.fn===t&&s.arg===n)return void this._cleanupHooks.splice(i,1)}}drain(){const e=this._cleanupHooks.slice();e.sort(((e,t)=>t.order-e.order));for(let t=0;t<e.length;++t){const n=e[t];"number"==typeof n.fn?n.envObject.makeDynCall_vp(n.fn)(n.arg):n.fn(n.arg),this._cleanupHooks.splice(this._cleanupHooks.indexOf(n),1)}}dispose(){this._cleanupHooks.length=0,this._cleanupHookCounter=0}}class q{constructor(){this.refHandle=(new f).port1,this.count=0}increase(){0===this.count&&this.refHandle.ref(),this.count++}decrease(){0!==this.count&&(1===this.count&&this.refHandle.unref(),this.count--)}}class V{constructor(){this._isStopping=!1,this._canCallIntoJs=!0,this.envStore=new T,this.scopeStore=new C,this.refStore=new T,this.deferredStore=new T,this.handleStore=new w,this.cbinfoStack=new i,this.feature={supportReflect:l,supportFinalizer:c,supportWeakSymbol:u,supportBigInt:h,supportNewFunction:s,canSetFunctionName:a,setImmediate:_,Buffer:v,MessageChannel:f},this.cleanupQueue=new U,"object"==typeof process&&null!==process&&"function"==typeof process.once&&(this.refCounter=new q,process.once("beforeExit",(()=>{this.destroy()})))}getRuntimeVersions(){return{version:g,NODE_API_SUPPORTED_VERSION_MAX:y,NAPI_VERSION_EXPERIMENTAL:x,NODE_API_DEFAULT_MODULE_API_VERSION:8}}createNotSupportWeakRefError(e,t){return new H(e,t)}createNotSupportBufferError(e,t){return new A(e,t)}createReference(e,t,n,i,s=0,r=0,o=0){return L.create(e,t,n,i,s,r,o)}createDeferred(e){return P.create(this,e)}createEnv(e,t,n,i,s,r){return F(this,e,t,n,i,s,r)}getCurrentScope(){return this.scopeStore.currentScope}addToCurrentScope(e){return this.scopeStore.currentScope.add(e)}openScope(e){return this.scopeStore.openScope(e)}closeScope(e,t){this.scopeStore.closeScope(e)}ensureHandle(e){switch(e){case void 0:return w.UNDEFINED;case null:return w.NULL;case!0:return w.TRUE;case!1:return w.FALSE;case r:return w.GLOBAL}return this.addToCurrentScope(e)}addCleanupHook(e,t,n){this.cleanupQueue.add(e,t,n)}removeCleanupHook(e,t,n){this.cleanupQueue.remove(e,t,n)}runCleanup(){for(;!this.cleanupQueue.empty();)this.cleanupQueue.drain()}increaseWaitingRequestCounter(){var e;null===(e=this.refCounter)||void 0===e||e.increase()}decreaseWaitingRequestCounter(){var e;null===(e=this.refCounter)||void 0===e||e.decrease()}setCanCallIntoJs(e){this._canCallIntoJs=e}setStopping(e){this._isStopping=e}canCallIntoJs(){return this._canCallIntoJs&&!this._isStopping}destroy(){this.setStopping(!0),this.setCanCallIntoJs(!1),this.runCleanup()}}let $;function J(){return new V}exports.CallbackInfo=t,exports.CallbackInfoStack=i,exports.ConstHandle=b,exports.Context=V,exports.Deferred=P,exports.EmnapiError=R,exports.Env=D,exports.Finalizer=z,exports.Handle=S,exports.HandleScope=k,exports.HandleStore=w,exports.NAPI_VERSION_EXPERIMENTAL=x,exports.NODE_API_DEFAULT_MODULE_API_VERSION=8,exports.NODE_API_SUPPORTED_VERSION_MAX=y,exports.NODE_API_SUPPORTED_VERSION_MIN=1,exports.NodeEnv=N,exports.NotSupportBufferError=A,exports.NotSupportWeakRefError=H,exports.Persistent=j,exports.RefBase=I,exports.RefTracker=m,exports.Reference=L,exports.ScopeStore=C,exports.Store=T,exports.TryCatch=o,exports.createContext=J,exports.getDefaultContext=function(){return $||($=J()),$},exports.isReferenceType=p,exports.version=g;
|
|
1
|
+
const e=[];class t{constructor(e,t,i,n,s,r,o){this.id=e,this.parent=t,this.child=i,this.thiz=n,this.data=s,this.args=r,this.fn=o}getNewTarget(e){const t=this.thiz;return null==t||null==t.constructor?0:t instanceof this.fn?e.ensureHandleId(t.constructor):0}dispose(){void 0!==this.thiz&&(this.thiz=void 0),this.args=e,this.fn=null}}const i=new t(0,null,null,null,0,null,null);class n{constructor(){this.current=i}get(e){if(1===e)return i.child;let t=i;for(let i=0;i<e;++i)if(t=t.child,null===t)return null;return t===i?null:t}pop(){const e=this.current;e!==i&&(this.current=e.parent,e.dispose())}push(e,i,n,s){let r=this.current.child;return r?(r.thiz=e,r.data=i,r.args=n,r.fn=s):(r=new t(this.current.id+1,this.current,null,e,i,n,s),this.current.child=r),this.current=r,r.id}dispose(){this.current=null}}const s=function(){let e;try{e=new Function}catch(e){return!1}return"function"==typeof e}(),r=function(){if("undefined"!=typeof globalThis)return globalThis;let e=function(){return this}();if(!e&&s)try{e=new Function("return this")()}catch(e){}if(!e){if("undefined"==typeof __webpack_public_path__&&"undefined"!=typeof global)return global;if("undefined"!=typeof window)return window;if("undefined"!=typeof self)return self}return e}();class o{constructor(){this._exception=void 0,this._caught=!1}hasCaught(){return this._caught}exception(){return this._exception}setError(e){this._caught=!0,this._exception=e}reset(){this._caught=!1,this._exception=void 0}extractException(){const e=this._exception;return this.reset(),e}}const a=function(){var e;try{return Boolean(null===(e=Object.getOwnPropertyDescriptor(Function.prototype,"name"))||void 0===e?void 0:e.configurable)}catch(e){return!1}}(),l="object"==typeof Reflect,c="undefined"!=typeof FinalizationRegistry&&"undefined"!=typeof WeakRef,u=function(){try{const e=Symbol();new WeakRef(e),(new WeakMap).set(e,void 0)}catch(e){return!1}return!0}(),h="undefined"!=typeof BigInt;function p(e){return"object"==typeof e&&null!==e||"function"==typeof e}const f=function(){let e;return e="undefined"!=typeof __webpack_public_path__||"undefined"!=typeof __webpack_public_path__?"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:void 0:"undefined"!=typeof require?require:void 0,e}(),d="function"==typeof MessageChannel?MessageChannel:function(){try{return f("worker_threads").MessageChannel}catch(e){}}(),_="function"==typeof setImmediate?setImmediate:function(e){if("function"!=typeof e)throw new TypeError('The "callback" argument must be of type function');if(d){let t=new d;t.port1.onmessage=function(){t.port1.onmessage=null,t=void 0,e()},t.port2.postMessage(null)}else setTimeout(e,0)},v="function"==typeof Buffer?Buffer:function(){try{return f("buffer").Buffer}catch(e){}}(),g="0.43.0",y=9,x=2147483647;class S{constructor(e,t){this.id=e,this.value=t}data(e){return e.getObjectBinding(this.value).data}isNumber(){return"number"==typeof this.value}isBigInt(){return"bigint"==typeof this.value}isString(){return"string"==typeof this.value}isFunction(){return"function"==typeof this.value}isExternal(){return p(this.value)&&null===Object.getPrototypeOf(this.value)}isObject(){return"object"==typeof this.value&&null!==this.value}isArray(){return Array.isArray(this.value)}isArrayBuffer(){return this.value instanceof ArrayBuffer}isTypedArray(){return ArrayBuffer.isView(this.value)&&!(this.value instanceof DataView)}isBuffer(){return"function"==typeof v&&v.isBuffer(this.value)}isDataView(){return this.value instanceof DataView}isDate(){return this.value instanceof Date}isPromise(){return this.value instanceof Promise}isBoolean(){return"boolean"==typeof this.value}isUndefined(){return void 0===this.value}isSymbol(){return"symbol"==typeof this.value}isNull(){return null===this.value}dispose(){this.value=void 0}}class b extends S{constructor(e,t){super(e,t)}dispose(){}}function k(){Object.setPrototypeOf(this,null)}k.prototype=null;class w{constructor(){this._values=[void 0,w.UNDEFINED,w.NULL,w.FALSE,w.TRUE,w.GLOBAL],this._next=w.MIN_ID}push(e){let t;const i=this._next,n=this._values;return i<n.length?(t=n[i],t.value=e):(t=new S(i,e),n[i]=t),this._next++,t}erase(e,t){this._next=e;const i=this._values;for(let n=e;n<t;++n)i[n].dispose()}get(e){return this._values[e]}swap(e,t){const i=this._values,n=i[e];i[e]=i[t],i[e].id=Number(e),i[t]=n,n.id=Number(t)}dispose(){this._values.length=w.MIN_ID,this._next=w.MIN_ID}}w.UNDEFINED=new b(1,void 0),w.NULL=new b(2,null),w.FALSE=new b(3,!1),w.TRUE=new b(4,!0),w.GLOBAL=new b(5,r),w.MIN_ID=6;class z{constructor(e,t,i,n,s=n){this.handleStore=e,this.id=t,this.parent=i,this.child=null,null!==i&&(i.child=this),this.start=n,this.end=s,this._escapeCalled=!1}add(e){const t=this.handleStore.push(e);return this.end++,t}addExternal(e,t){const i=new k,n=e.ctx.handleStore.push(i);return e.initObjectBinding(i).data=t,this.end++,n}dispose(){this.start!==this.end&&this.handleStore.erase(this.start,this.end)}escape(e){if(this._escapeCalled)return null;if(this._escapeCalled=!0,e<this.start||e>=this.end)return null;this.handleStore.swap(e,this.start);const t=this.handleStore.get(this.start);return this.start++,this.parent.end++,t}escapeCalled(){return this._escapeCalled}}class C{constructor(){this._rootScope=new z(null,0,null,1,w.MIN_ID),this.currentScope=this._rootScope}get(e){e=Number(e);let t=this.currentScope;for(;t!==this._rootScope;){if(t.id===e)return t;t=t.parent}}openScope(e){const t=this.currentScope;let i=t.child;return null!==i?(i.start=i.end=t.end,i._escapeCalled=!1):i=new z(e.ctx.handleStore,t.id+1,t,t.end),this.currentScope=i,e.openHandleScopes++,i}closeScope(e){if(0===e.openHandleScopes)return;const t=this.currentScope;this.currentScope=t.parent,t.dispose(),e.openHandleScopes--}dispose(){let e=this.currentScope;for(;null!==e;){e.handleStore=null,e.id=0,e.parent=null,e.start=w.MIN_ID,e.end=w.MIN_ID,e._escapeCalled=!1;const t=e.child;e.child=null,e=t}this.currentScope=null}}class E{constructor(){this._next=null,this._prev=null}finalize(){}link(e){this._prev=e,this._next=e._next,null!==this._next&&(this._next._prev=this),e._next=this}unlink(){null!==this._prev&&(this._prev._next=this._next),null!==this._next&&(this._next._prev=this._prev),this._prev=null,this._next=null}static finalizeAll(e){for(;null!==e._next;)e._next.finalize()}}class m{constructor(e,t=0,i=0,n=0){this.envObject=e,this._finalizeCallback=t,this._finalizeData=i,this._finalizeHint=n}callback(){return this._finalizeCallback}data(){return this._finalizeData}hint(){return this._finalizeHint}resetFinalizer(){this._finalizeCallback=0,this._finalizeData=0,this._finalizeHint=0}dispose(){this.envObject=void 0}}class I extends m{static finalizeAll(e){E.finalizeAll(e)}link(e){E.prototype.link.call(this,e)}unlink(){E.prototype.unlink.call(this)}static create(e,t,i,n){return new I(e,t,i,n)}constructor(e,t,i,n){super(e,t,i,n),this._next=null,this._prev=null,this.link(t?e.finalizing_reflist:e.reflist)}dispose(){this.unlink(),this.envObject.dequeueFinalizer(this),super.dispose()}finalize(){this.finalizeCore(!0)}finalizeCore(e){const t=this._finalizeCallback,i=this._finalizeData,n=this._finalizeHint;let s;this.resetFinalizer(),this.unlink();let r=!1;if(t){const e=Number(t);try{this.envObject.callFinalizer(e,i,n)}catch(e){r=!0,s=e}}if(e&&this.dispose(),r)throw s}}class F extends I{constructor(e,t,i,n,s,r){super(e,n,s,r),this._refcount=t,this._ownership=i}data(){return this._finalizeData}ref(){return++this._refcount}unref(){return 0===this._refcount?0:--this._refcount}refCount(){return this._refcount}ownership(){return this._ownership}finalize(){this.finalizeCore(0===this._ownership)}}function O(e,t){if(!e.terminatedOrTerminating())throw t}class D{constructor(e,t,i,n,s){this.ctx=e,this.moduleApiVersion=t,this.makeDynCall_vppp=i,this.makeDynCall_vp=n,this.abort=s,this.openHandleScopes=0,this.instanceData=null,this.tryCatch=new o,this.refs=1,this.reflist=new E,this.finalizing_reflist=new E,this.pendingFinalizers=[],this.lastError={errorCode:0,engineErrorCode:0,engineReserved:0},this.inGcFinalizer=!1,this._bindingMap=new WeakMap,this.id=0}canCallIntoJs(){return!0}terminatedOrTerminating(){return!this.canCallIntoJs()}ref(){this.refs++}unref(){this.refs--,0===this.refs&&this.dispose()}ensureHandle(e){return this.ctx.ensureHandle(e)}ensureHandleId(e){return this.ensureHandle(e).id}clearLastError(){const e=this.lastError;return 0!==e.errorCode&&(e.errorCode=0),0!==e.engineErrorCode&&(e.engineErrorCode=0),0!==e.engineReserved&&(e.engineReserved=0),0}setLastError(e,t=0,i=0){const n=this.lastError;return n.errorCode!==e&&(n.errorCode=e),n.engineErrorCode!==t&&(n.engineErrorCode=t),n.engineReserved!==i&&(n.engineReserved=i),e}getReturnStatus(){return this.tryCatch.hasCaught()?this.setLastError(10):0}callIntoModule(e,t=O){const i=this.openHandleScopes;this.clearLastError();const n=e(this);if(i!==this.openHandleScopes&&this.abort("open_handle_scopes != open_handle_scopes_before"),this.tryCatch.hasCaught()){t(this,this.tryCatch.extractException())}return n}callFinalizer(e,t,i){const n=this.makeDynCall_vppp(e),s=this.id,r=this.ctx.openScope(this);try{this.callIntoModule((()=>{n(s,t,i)}))}finally{this.ctx.closeScope(this,r)}}invokeFinalizerFromGC(e){if(this.moduleApiVersion!==x)this.enqueueFinalizer(e);else{const t=this.inGcFinalizer;this.inGcFinalizer=!0;try{e.finalize()}finally{this.inGcFinalizer=t}}}checkGCAccess(){this.moduleApiVersion===x&&this.inGcFinalizer&&this.abort("Finalizer is calling a function that may affect GC state.\nThe finalizers are run directly from GC and must not affect GC state.\nUse `node_api_post_finalizer` from inside of the finalizer to work around this issue.\nIt schedules the call as a new task in the event loop.")}enqueueFinalizer(e){-1===this.pendingFinalizers.indexOf(e)&&this.pendingFinalizers.push(e)}dequeueFinalizer(e){const t=this.pendingFinalizers.indexOf(e);-1!==t&&this.pendingFinalizers.splice(t,1)}deleteMe(){F.finalizeAll(this.finalizing_reflist),F.finalizeAll(this.reflist),this.tryCatch.extractException(),this.ctx.envStore.remove(this.id)}dispose(){0!==this.id&&(this.deleteMe(),this.id=0)}initObjectBinding(e){const t={wrapped:0,tag:null,data:0};return this._bindingMap.set(e,t),t}getObjectBinding(e){return this._bindingMap.has(e)?this._bindingMap.get(e):this.initObjectBinding(e)}setInstanceData(e,t,i){this.instanceData&&this.instanceData.dispose(),this.instanceData=new F(this,0,0,t,e,i)}getInstanceData(){return this.instanceData?this.instanceData.data():0}}class N extends D{constructor(e,t,i,n,s,r,o){super(e,i,n,s,r),this.filename=t,this.nodeBinding=o,this.destructing=!1,this.finalizationScheduled=!1}deleteMe(){this.destructing=!0,this.drainFinalizerQueue(),super.deleteMe()}canCallIntoJs(){return super.canCallIntoJs()&&this.ctx.canCallIntoJs()}triggerFatalException(e){if(this.nodeBinding)this.nodeBinding.napi.fatalException(e);else{if("object"!=typeof process||null===process||"function"!=typeof process._fatalException)throw e;process._fatalException(e)||(console.error(e),process.exit(1))}}callbackIntoModule(e,t){return this.callIntoModule(t,((t,i)=>{if(t.terminatedOrTerminating())return;const n="object"==typeof process&&null!==process,s=!!n&&Boolean(process.execArgv&&-1!==process.execArgv.indexOf("--force-node-api-uncaught-exceptions-policy"));if(t.moduleApiVersion<x&&!s&&!e){(n&&"function"==typeof process.emitWarning?process.emitWarning:function(e,t,i){if(e instanceof Error)console.warn(e.toString());else{const n=i?`[${i}] `:"";console.warn(`${n}${t||"Warning"}: ${e}`)}})("Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=true to handle those exceptions properly.","DeprecationWarning","DEP0168")}else t.triggerFatalException(i)}))}callFinalizer(e,t,i){this.callFinalizerInternal(1,e,t,i)}callFinalizerInternal(e,t,i,n){const s=this.makeDynCall_vppp(t),r=this.id,o=this.ctx.openScope(this);try{this.callbackIntoModule(Boolean(e),(()=>{s(r,i,n)}))}finally{this.ctx.closeScope(this,o)}}enqueueFinalizer(e){super.enqueueFinalizer(e),this.finalizationScheduled||this.destructing||(this.finalizationScheduled=!0,this.ref(),_((()=>{this.finalizationScheduled=!1,this.unref(),this.drainFinalizerQueue()})))}drainFinalizerQueue(){for(;this.pendingFinalizers.length>0;){this.pendingFinalizers.shift().finalize()}}}function R(e,t,i,n,s,r,o){(i="number"!=typeof i?8:i)<8?i=8:i>y&&i!==x&&function(e,t){throw new Error(`${e} requires Node-API version ${t}, but this version of Node.js only supports version ${y} add-ons.`)}(t,i);const a=new N(e,t,i,n,s,r,o);return e.envStore.add(a),e.addCleanupHook(a,(()=>{a.unref()}),0),a}class A extends Error{constructor(e){super(e);const t=new.target,i=t.prototype;if(!(this instanceof A)){const e=Object.setPrototypeOf;"function"==typeof e?e.call(Object,this,i):this.__proto__=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}}}Object.defineProperty(A.prototype,"name",{configurable:!0,writable:!0,value:"EmnapiError"});class H extends A{constructor(e,t){super(`${e}: The current runtime does not support "FinalizationRegistry" and "WeakRef".${t?` ${t}`:""}`)}}Object.defineProperty(H.prototype,"name",{configurable:!0,writable:!0,value:"NotSupportWeakRefError"});class B extends A{constructor(e,t){super(`${e}: The current runtime does not support "Buffer". Consider using buffer polyfill to make sure \`globalThis.Buffer\` is defined.${t?` ${t}`:""}`)}}Object.defineProperty(B.prototype,"name",{configurable:!0,writable:!0,value:"NotSupportBufferError"});class j{constructor(e){this._value=e}deref(){return this._value}dispose(){this._value=void 0}}class M{constructor(e){this._ref=new j(e)}setWeak(e,t){if(!c||void 0===this._ref||this._ref instanceof WeakRef)return;const i=this._ref.deref();try{M._registry.register(i,this,this);const n=new WeakRef(i);this._ref.dispose(),this._ref=n,this._param=e,this._callback=t}catch(e){if("symbol"!=typeof i)throw e}}clearWeak(){if(c&&void 0!==this._ref&&this._ref instanceof WeakRef){try{M._registry.unregister(this)}catch(e){}this._param=void 0,this._callback=void 0;const e=this._ref.deref();this._ref=void 0===e?e:new j(e)}}reset(){if(c)try{M._registry.unregister(this)}catch(e){}this._param=void 0,this._callback=void 0,this._ref instanceof j&&this._ref.dispose(),this._ref=void 0}isEmpty(){return void 0===this._ref}deref(){if(void 0!==this._ref)return this._ref.deref()}}function T(e){e.persistent.reset(),e.envObject.invokeFinalizerFromGC(e)}M._registry=c?new FinalizationRegistry((e=>{e._ref=void 0;const t=e._callback,i=e._param;e._callback=void 0,e._param=void 0,"function"==typeof t&&t(i)})):void 0;class L extends F{static create(e,t,i,n,s=0,r=0,o=0){const a=e.ctx.handleStore.get(t),l=new L(e,i,n,s,r,o);var c;return e.ctx.refStore.add(l),l.canBeWeak=(c=a).isObject()||c.isFunction()||c.isSymbol(),l.persistent=new M(a.value),0===i&&l._setWeak(),l}constructor(e,t,i,n=0,s=0,r=0){super(e,t>>>0,i,n,s,r),this.id=0}ref(){if(this.persistent.isEmpty())return 0;const e=super.ref();return 1===e&&this.canBeWeak&&this.persistent.clearWeak(),e}unref(){if(this.persistent.isEmpty())return 0;const e=this.refCount(),t=super.unref();return 1===e&&0===t&&this._setWeak(),t}get(){if(this.persistent.isEmpty())return 0;const e=this.persistent.deref();return this.envObject.ensureHandle(e).id}_setWeak(){this.canBeWeak?this.persistent.setWeak(this,T):this.persistent.reset()}finalize(){this.persistent.reset(),super.finalize()}dispose(){0!==this.id&&(this.persistent.reset(),this.envObject.ctx.refStore.remove(this.id),super.dispose(),this.id=0)}}class P{static create(e,t){const i=new P(e,t);return e.deferredStore.add(i),i}constructor(e,t){this.id=0,this.ctx=e,this.value=t}resolve(e){this.value.resolve(e),this.dispose()}reject(e){this.value.reject(e),this.dispose()}dispose(){this.ctx.deferredStore.remove(this.id),this.id=0,this.value=null,this.ctx=null}}class W{constructor(){this._values=[void 0],this._values.length=4,this._size=1,this._freeList=[]}add(e){let t;if(this._freeList.length)t=this._freeList.shift();else{t=this._size,this._size++;const e=this._values.length;t>=e&&(this._values.length=e+(e>>1)+16)}e.id=t,this._values[t]=e}get(e){return this._values[e]}has(e){return void 0!==this._values[e]}remove(e){const t=this._values[e];t&&(t.id=0,this._values[e]=void 0,this._freeList.push(Number(e)))}dispose(){for(let e=1;e<this._size;++e){const t=this._values[e];null==t||t.dispose()}this._values=[void 0],this._size=1,this._freeList=[]}}class U{constructor(e,t,i,n){this.envObject=e,this.fn=t,this.arg=i,this.order=n}}class V{constructor(){this._cleanupHooks=[],this._cleanupHookCounter=0}empty(){return 0===this._cleanupHooks.length}add(e,t,i){if(this._cleanupHooks.filter((n=>n.envObject===e&&n.fn===t&&n.arg===i)).length>0)throw new Error("Can not add same fn and arg twice");this._cleanupHooks.push(new U(e,t,i,this._cleanupHookCounter++))}remove(e,t,i){for(let n=0;n<this._cleanupHooks.length;++n){const s=this._cleanupHooks[n];if(s.envObject===e&&s.fn===t&&s.arg===i)return void this._cleanupHooks.splice(n,1)}}drain(){const e=this._cleanupHooks.slice();e.sort(((e,t)=>t.order-e.order));for(let t=0;t<e.length;++t){const i=e[t];"number"==typeof i.fn?i.envObject.makeDynCall_vp(i.fn)(i.arg):i.fn(i.arg),this._cleanupHooks.splice(this._cleanupHooks.indexOf(i),1)}}dispose(){this._cleanupHooks.length=0,this._cleanupHookCounter=0}}class G{constructor(){this.refHandle=(new d).port1,this.count=0}increase(){0===this.count&&this.refHandle.ref(),this.count++}decrease(){0!==this.count&&(1===this.count&&this.refHandle.unref(),this.count--)}}class q{constructor(){this._isStopping=!1,this._canCallIntoJs=!0,this.envStore=new W,this.scopeStore=new C,this.refStore=new W,this.deferredStore=new W,this.handleStore=new w,this.cbinfoStack=new n,this.feature={supportReflect:l,supportFinalizer:c,supportWeakSymbol:u,supportBigInt:h,supportNewFunction:s,canSetFunctionName:a,setImmediate:_,Buffer:v,MessageChannel:d},this.cleanupQueue=new V,"object"==typeof process&&null!==process&&"function"==typeof process.once&&(this.refCounter=new G,process.once("beforeExit",(()=>{this.destroy()})))}getRuntimeVersions(){return{version:g,NODE_API_SUPPORTED_VERSION_MAX:y,NAPI_VERSION_EXPERIMENTAL:x,NODE_API_DEFAULT_MODULE_API_VERSION:8}}createNotSupportWeakRefError(e,t){return new H(e,t)}createNotSupportBufferError(e,t){return new B(e,t)}createReference(e,t,i,n,s=0,r=0,o=0){return L.create(e,t,i,n,s,r,o)}createDeferred(e){return P.create(this,e)}createEnv(e,t,i,n,s,r){return R(this,e,t,i,n,s,r)}createTrackedFinalizer(e,t,i,n){return I.create(e,t,i,n)}getCurrentScope(){return this.scopeStore.currentScope}addToCurrentScope(e){return this.scopeStore.currentScope.add(e)}openScope(e){return this.scopeStore.openScope(e)}closeScope(e,t){this.scopeStore.closeScope(e)}ensureHandle(e){switch(e){case void 0:return w.UNDEFINED;case null:return w.NULL;case!0:return w.TRUE;case!1:return w.FALSE;case r:return w.GLOBAL}return this.addToCurrentScope(e)}addCleanupHook(e,t,i){this.cleanupQueue.add(e,t,i)}removeCleanupHook(e,t,i){this.cleanupQueue.remove(e,t,i)}runCleanup(){for(;!this.cleanupQueue.empty();)this.cleanupQueue.drain()}increaseWaitingRequestCounter(){var e;null===(e=this.refCounter)||void 0===e||e.increase()}decreaseWaitingRequestCounter(){var e;null===(e=this.refCounter)||void 0===e||e.decrease()}setCanCallIntoJs(e){this._canCallIntoJs=e}setStopping(e){this._isStopping=e}canCallIntoJs(){return this._canCallIntoJs&&!this._isStopping}destroy(){this.setStopping(!0),this.setCanCallIntoJs(!1),this.runCleanup()}}let $;function J(){return new q}exports.CallbackInfo=t,exports.CallbackInfoStack=n,exports.ConstHandle=b,exports.Context=q,exports.Deferred=P,exports.EmnapiError=A,exports.Env=D,exports.Finalizer=m,exports.Handle=S,exports.HandleScope=z,exports.HandleStore=w,exports.NAPI_VERSION_EXPERIMENTAL=x,exports.NODE_API_DEFAULT_MODULE_API_VERSION=8,exports.NODE_API_SUPPORTED_VERSION_MAX=y,exports.NODE_API_SUPPORTED_VERSION_MIN=1,exports.NodeEnv=N,exports.NotSupportBufferError=B,exports.NotSupportWeakRefError=H,exports.Persistent=M,exports.RefBase=F,exports.RefTracker=E,exports.Reference=L,exports.ScopeStore=C,exports.Store=W,exports.TrackedFinalizer=I,exports.TryCatch=o,exports.createContext=J,exports.getDefaultContext=function(){return $||($=J()),$},exports.isReferenceType=p,exports.version=g;
|
package/dist/emnapi.d.mts
CHANGED
|
@@ -316,6 +316,7 @@ export declare class Context {
|
|
|
316
316
|
createReference(envObject: Env, handle_id: napi_value, initialRefcount: uint32_t, ownership: 0 | 1, finalize_callback?: napi_finalize, finalize_data?: void_p, finalize_hint?: void_p): Reference;
|
|
317
317
|
createDeferred<T = any>(value: IDeferrdValue<T>): Deferred<T>;
|
|
318
318
|
createEnv(filename: string, moduleApiVersion: number, makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void, abort: (msg?: string) => never, nodeBinding?: any): Env;
|
|
319
|
+
createTrackedFinalizer(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p): TrackedFinalizer;
|
|
319
320
|
getCurrentScope(): HandleScope | null;
|
|
320
321
|
addToCurrentScope<V>(value: V): Handle<V>;
|
|
321
322
|
openScope(envObject: Env): HandleScope;
|
|
@@ -368,6 +369,7 @@ export declare class Env implements IStoreValue {
|
|
|
368
369
|
engineErrorCode: number;
|
|
369
370
|
engineReserved: Ptr;
|
|
370
371
|
};
|
|
372
|
+
inGcFinalizer: boolean;
|
|
371
373
|
constructor(ctx: Context, moduleApiVersion: number, makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void, abort: (msg?: string) => never);
|
|
372
374
|
canCallIntoJs(): boolean;
|
|
373
375
|
terminatedOrTerminating(): boolean;
|
|
@@ -380,6 +382,8 @@ export declare class Env implements IStoreValue {
|
|
|
380
382
|
getReturnStatus(): napi_status;
|
|
381
383
|
callIntoModule<T>(fn: (env: Env) => T, handleException?: (envObject: Env, value: any) => void): T;
|
|
382
384
|
callFinalizer(cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
385
|
+
invokeFinalizerFromGC(finalizer: RefTracker): void;
|
|
386
|
+
checkGCAccess(): void;
|
|
383
387
|
enqueueFinalizer(finalizer: RefTracker): void;
|
|
384
388
|
dequeueFinalizer(finalizer: RefTracker): void;
|
|
385
389
|
deleteMe(): void;
|
|
@@ -527,17 +531,10 @@ export declare class Persistent<T> {
|
|
|
527
531
|
deref(): T | undefined;
|
|
528
532
|
}
|
|
529
533
|
|
|
530
|
-
export declare
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export declare class RefBase extends Finalizer {
|
|
534
|
-
static finalizeAll(list: RefTracker): void;
|
|
535
|
-
link(list: RefTracker): void;
|
|
536
|
-
unlink(): void;
|
|
534
|
+
export declare class RefBase extends TrackedFinalizer {
|
|
537
535
|
private _refcount;
|
|
538
536
|
private readonly _ownership;
|
|
539
537
|
constructor(envObject: Env, initial_refcount: uint32_t, ownership: number, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p);
|
|
540
|
-
dispose(): void;
|
|
541
538
|
data(): void_p;
|
|
542
539
|
ref(): uint32_t;
|
|
543
540
|
unref(): uint32_t;
|
|
@@ -591,6 +588,20 @@ export declare class Store<V extends IStoreValue> {
|
|
|
591
588
|
dispose(): void;
|
|
592
589
|
}
|
|
593
590
|
|
|
591
|
+
export declare interface TrackedFinalizer extends Finalizer, RefTracker {
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export declare class TrackedFinalizer extends Finalizer {
|
|
595
|
+
static finalizeAll(list: RefTracker): void;
|
|
596
|
+
link(list: RefTracker): void;
|
|
597
|
+
unlink(): void;
|
|
598
|
+
static create(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p): TrackedFinalizer;
|
|
599
|
+
protected constructor(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p);
|
|
600
|
+
dispose(): void;
|
|
601
|
+
finalize(): void;
|
|
602
|
+
protected finalizeCore(deleteMe: boolean): void;
|
|
603
|
+
}
|
|
604
|
+
|
|
594
605
|
export declare class TryCatch {
|
|
595
606
|
private _exception;
|
|
596
607
|
private _caught;
|
package/dist/emnapi.d.ts
CHANGED
|
@@ -316,6 +316,7 @@ export declare class Context {
|
|
|
316
316
|
createReference(envObject: Env, handle_id: napi_value, initialRefcount: uint32_t, ownership: 0 | 1, finalize_callback?: napi_finalize, finalize_data?: void_p, finalize_hint?: void_p): Reference;
|
|
317
317
|
createDeferred<T = any>(value: IDeferrdValue<T>): Deferred<T>;
|
|
318
318
|
createEnv(filename: string, moduleApiVersion: number, makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void, abort: (msg?: string) => never, nodeBinding?: any): Env;
|
|
319
|
+
createTrackedFinalizer(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p): TrackedFinalizer;
|
|
319
320
|
getCurrentScope(): HandleScope | null;
|
|
320
321
|
addToCurrentScope<V>(value: V): Handle<V>;
|
|
321
322
|
openScope(envObject: Env): HandleScope;
|
|
@@ -368,6 +369,7 @@ export declare class Env implements IStoreValue {
|
|
|
368
369
|
engineErrorCode: number;
|
|
369
370
|
engineReserved: Ptr;
|
|
370
371
|
};
|
|
372
|
+
inGcFinalizer: boolean;
|
|
371
373
|
constructor(ctx: Context, moduleApiVersion: number, makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void, abort: (msg?: string) => never);
|
|
372
374
|
canCallIntoJs(): boolean;
|
|
373
375
|
terminatedOrTerminating(): boolean;
|
|
@@ -380,6 +382,8 @@ export declare class Env implements IStoreValue {
|
|
|
380
382
|
getReturnStatus(): napi_status;
|
|
381
383
|
callIntoModule<T>(fn: (env: Env) => T, handleException?: (envObject: Env, value: any) => void): T;
|
|
382
384
|
callFinalizer(cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
385
|
+
invokeFinalizerFromGC(finalizer: RefTracker): void;
|
|
386
|
+
checkGCAccess(): void;
|
|
383
387
|
enqueueFinalizer(finalizer: RefTracker): void;
|
|
384
388
|
dequeueFinalizer(finalizer: RefTracker): void;
|
|
385
389
|
deleteMe(): void;
|
|
@@ -527,17 +531,10 @@ export declare class Persistent<T> {
|
|
|
527
531
|
deref(): T | undefined;
|
|
528
532
|
}
|
|
529
533
|
|
|
530
|
-
export declare
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export declare class RefBase extends Finalizer {
|
|
534
|
-
static finalizeAll(list: RefTracker): void;
|
|
535
|
-
link(list: RefTracker): void;
|
|
536
|
-
unlink(): void;
|
|
534
|
+
export declare class RefBase extends TrackedFinalizer {
|
|
537
535
|
private _refcount;
|
|
538
536
|
private readonly _ownership;
|
|
539
537
|
constructor(envObject: Env, initial_refcount: uint32_t, ownership: number, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p);
|
|
540
|
-
dispose(): void;
|
|
541
538
|
data(): void_p;
|
|
542
539
|
ref(): uint32_t;
|
|
543
540
|
unref(): uint32_t;
|
|
@@ -591,6 +588,20 @@ export declare class Store<V extends IStoreValue> {
|
|
|
591
588
|
dispose(): void;
|
|
592
589
|
}
|
|
593
590
|
|
|
591
|
+
export declare interface TrackedFinalizer extends Finalizer, RefTracker {
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export declare class TrackedFinalizer extends Finalizer {
|
|
595
|
+
static finalizeAll(list: RefTracker): void;
|
|
596
|
+
link(list: RefTracker): void;
|
|
597
|
+
unlink(): void;
|
|
598
|
+
static create(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p): TrackedFinalizer;
|
|
599
|
+
protected constructor(envObject: Env, finalize_callback: napi_finalize, finalize_data: void_p, finalize_hint: void_p);
|
|
600
|
+
dispose(): void;
|
|
601
|
+
finalize(): void;
|
|
602
|
+
protected finalizeCore(deleteMe: boolean): void;
|
|
603
|
+
}
|
|
604
|
+
|
|
594
605
|
export declare class TryCatch {
|
|
595
606
|
private _exception;
|
|
596
607
|
private _caught;
|