@emnapi/runtime 0.38.3 → 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.
- package/dist/emnapi.cjs.js +271 -162
- package/dist/emnapi.cjs.min.js +1 -1
- package/dist/emnapi.d.ts +56 -27
- package/dist/emnapi.esm-bundler.js +281 -173
- package/dist/emnapi.iife.d.ts +48 -26
- package/dist/emnapi.iife.js +312 -203
- package/dist/emnapi.js +312 -203
- package/dist/emnapi.min.js +1 -1
- package/dist/emnapi.min.mjs +1 -1
- package/dist/emnapi.mjs +268 -160
- package/package.json +1 -1
package/dist/emnapi.iife.d.ts
CHANGED
|
@@ -25,10 +25,12 @@ export class ConstHandle<S extends undefined | null | boolean | typeof globalThi
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export class Context {
|
|
28
|
-
|
|
28
|
+
private _isStopping;
|
|
29
|
+
private _canCallIntoJs;
|
|
30
|
+
envStore: Store<Env>;
|
|
29
31
|
scopeStore: ScopeStore;
|
|
30
|
-
refStore:
|
|
31
|
-
deferredStore:
|
|
32
|
+
refStore: Store<Reference>;
|
|
33
|
+
deferredStore: Store<Deferred<any>>;
|
|
32
34
|
handleStore: HandleStore;
|
|
33
35
|
cbinfoStack: CallbackInfoStack;
|
|
34
36
|
private readonly refCounter?;
|
|
@@ -48,12 +50,18 @@ export class Context {
|
|
|
48
50
|
} | undefined;
|
|
49
51
|
};
|
|
50
52
|
constructor();
|
|
53
|
+
getRuntimeVersions(): {
|
|
54
|
+
version: string;
|
|
55
|
+
NAPI_VERSION: Version;
|
|
56
|
+
NAPI_VERSION_EXPERIMENTAL: Version;
|
|
57
|
+
NODE_API_DEFAULT_MODULE_API_VERSION: Version;
|
|
58
|
+
};
|
|
51
59
|
createNotSupportWeakRefError(api: string, message: string): NotSupportWeakRefError;
|
|
52
60
|
createNotSupportBigIntError(api: string, message: string): NotSupportBigIntError;
|
|
53
61
|
createNotSupportBufferError(api: string, message: string): NotSupportBufferError;
|
|
54
62
|
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;
|
|
55
63
|
createDeferred<T = any>(value: IDeferrdValue<T>): Deferred<T>;
|
|
56
|
-
createEnv(makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void, makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void): Env;
|
|
64
|
+
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;
|
|
57
65
|
getCurrentScope(): HandleScope | null;
|
|
58
66
|
addToCurrentScope<V>(value: V): Handle<V>;
|
|
59
67
|
openScope(envObject: Env): HandleScope;
|
|
@@ -64,7 +72,10 @@ export class Context {
|
|
|
64
72
|
runCleanup(): void;
|
|
65
73
|
increaseWaitingRequestCounter(): void;
|
|
66
74
|
decreaseWaitingRequestCounter(): void;
|
|
67
|
-
|
|
75
|
+
setCanCallIntoJs(value: boolean): void;
|
|
76
|
+
setStopping(value: boolean): void;
|
|
77
|
+
canCallIntoJs(): boolean;
|
|
78
|
+
destroy(): void;
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
export function createContext(): Context;
|
|
@@ -80,18 +91,16 @@ export class Deferred<T = any> implements IStoreValue {
|
|
|
80
91
|
dispose(): void;
|
|
81
92
|
}
|
|
82
93
|
|
|
83
|
-
export class DeferredStore extends Store<Deferred> {
|
|
84
|
-
constructor();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
94
|
export class EmnapiError extends Error {
|
|
88
95
|
constructor(message?: string);
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
export class Env implements IStoreValue {
|
|
92
99
|
readonly ctx: Context;
|
|
100
|
+
moduleApiVersion: number;
|
|
93
101
|
makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void;
|
|
94
102
|
makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void;
|
|
103
|
+
abort: (msg?: string) => never;
|
|
95
104
|
id: number;
|
|
96
105
|
openHandleScopes: number;
|
|
97
106
|
instanceData: RefBase | null;
|
|
@@ -99,16 +108,15 @@ export class Env implements IStoreValue {
|
|
|
99
108
|
refs: number;
|
|
100
109
|
reflist: RefTracker;
|
|
101
110
|
finalizing_reflist: RefTracker;
|
|
102
|
-
private destructing;
|
|
103
|
-
finalizationScheduled: boolean;
|
|
104
111
|
pendingFinalizers: RefTracker[];
|
|
105
112
|
lastError: {
|
|
106
113
|
errorCode: napi_status;
|
|
107
114
|
engineErrorCode: number;
|
|
108
115
|
engineReserved: Ptr;
|
|
109
116
|
};
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
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);
|
|
118
|
+
canCallIntoJs(): boolean;
|
|
119
|
+
terminatedOrTerminating(): boolean;
|
|
112
120
|
ref(): void;
|
|
113
121
|
unref(): void;
|
|
114
122
|
ensureHandle<S>(value: S): Handle<S>;
|
|
@@ -116,11 +124,11 @@ export class Env implements IStoreValue {
|
|
|
116
124
|
clearLastError(): napi_status;
|
|
117
125
|
setLastError(error_code: napi_status, engine_error_code?: uint32_t, engine_reserved?: void_p): napi_status;
|
|
118
126
|
getReturnStatus(): napi_status;
|
|
119
|
-
callIntoModule<T>(fn: (env: Env) => T): T;
|
|
127
|
+
callIntoModule<T>(fn: (env: Env) => T, handleException?: (envObject: Env, value: any) => void): T;
|
|
120
128
|
callFinalizer(cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
121
129
|
enqueueFinalizer(finalizer: RefTracker): void;
|
|
122
130
|
dequeueFinalizer(finalizer: RefTracker): void;
|
|
123
|
-
|
|
131
|
+
deleteMe(): void;
|
|
124
132
|
dispose(): void;
|
|
125
133
|
private readonly _bindingMap;
|
|
126
134
|
initObjectBinding<S extends object>(value: S): IReferenceBinding;
|
|
@@ -129,10 +137,6 @@ export class Env implements IStoreValue {
|
|
|
129
137
|
getInstanceData(): number;
|
|
130
138
|
}
|
|
131
139
|
|
|
132
|
-
export class EnvStore extends Store<Env> {
|
|
133
|
-
constructor();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
140
|
export class Finalizer {
|
|
137
141
|
envObject: Env;
|
|
138
142
|
protected _finalizeCallback: napi_finalize;
|
|
@@ -152,9 +156,7 @@ export class Handle<S> {
|
|
|
152
156
|
id: number;
|
|
153
157
|
value: S;
|
|
154
158
|
constructor(id: number, value: S);
|
|
155
|
-
init(id: number, value: S): void;
|
|
156
159
|
data(envObject: Env): void_p;
|
|
157
|
-
isEmpty(): boolean;
|
|
158
160
|
isNumber(): boolean;
|
|
159
161
|
isBigInt(): boolean;
|
|
160
162
|
isString(): boolean;
|
|
@@ -226,6 +228,28 @@ export interface IStoreValue {
|
|
|
226
228
|
[x: string]: any;
|
|
227
229
|
}
|
|
228
230
|
|
|
231
|
+
export const NAPI_VERSION = Version.NAPI_VERSION;
|
|
232
|
+
|
|
233
|
+
export const NAPI_VERSION_EXPERIMENTAL = Version.NAPI_VERSION_EXPERIMENTAL;
|
|
234
|
+
|
|
235
|
+
export const NODE_API_DEFAULT_MODULE_API_VERSION = Version.NODE_API_DEFAULT_MODULE_API_VERSION;
|
|
236
|
+
|
|
237
|
+
export class NodeEnv extends Env {
|
|
238
|
+
filename: string;
|
|
239
|
+
private readonly nodeBinding?;
|
|
240
|
+
destructing: boolean;
|
|
241
|
+
finalizationScheduled: boolean;
|
|
242
|
+
constructor(ctx: Context, 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);
|
|
243
|
+
deleteMe(): void;
|
|
244
|
+
canCallIntoJs(): boolean;
|
|
245
|
+
triggerFatalException(err: any): void;
|
|
246
|
+
callbackIntoModule<T>(enforceUncaughtExceptionPolicy: boolean, fn: (env: Env) => T): T;
|
|
247
|
+
callFinalizer(cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
248
|
+
callFinalizerInternal(forceUncaught: int, cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
249
|
+
enqueueFinalizer(finalizer: RefTracker): void;
|
|
250
|
+
drainFinalizerQueue(): void;
|
|
251
|
+
}
|
|
252
|
+
|
|
229
253
|
export class NotSupportBigIntError extends EmnapiError {
|
|
230
254
|
constructor(api: string, message: string);
|
|
231
255
|
}
|
|
@@ -272,6 +296,7 @@ export class RefBase extends Finalizer {
|
|
|
272
296
|
|
|
273
297
|
export class Reference extends RefBase implements IStoreValue {
|
|
274
298
|
id: number;
|
|
299
|
+
private canBeWeak;
|
|
275
300
|
static create(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;
|
|
276
301
|
persistent: Persistent<object>;
|
|
277
302
|
private constructor();
|
|
@@ -283,10 +308,6 @@ export class Reference extends RefBase implements IStoreValue {
|
|
|
283
308
|
dispose(): void;
|
|
284
309
|
}
|
|
285
310
|
|
|
286
|
-
export class RefStore extends Store<Reference> {
|
|
287
|
-
constructor();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
311
|
export class RefTracker {
|
|
291
312
|
finalize(): void;
|
|
292
313
|
private _next;
|
|
@@ -310,7 +331,7 @@ export class Store<V extends IStoreValue> {
|
|
|
310
331
|
protected _values: Array<V | undefined>;
|
|
311
332
|
private _freeList;
|
|
312
333
|
private _size;
|
|
313
|
-
constructor(
|
|
334
|
+
constructor();
|
|
314
335
|
add(value: V): void;
|
|
315
336
|
get(id: Ptr): V | undefined;
|
|
316
337
|
has(id: Ptr): boolean;
|
|
@@ -320,6 +341,7 @@ export class Store<V extends IStoreValue> {
|
|
|
320
341
|
|
|
321
342
|
export class TryCatch {
|
|
322
343
|
private _exception;
|
|
344
|
+
private _caught;
|
|
323
345
|
hasCaught(): boolean;
|
|
324
346
|
exception(): any;
|
|
325
347
|
setError(err: any): void;
|