@emnapi/runtime 0.38.2 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emnapi.cjs.js +311 -186
- package/dist/emnapi.cjs.min.js +1 -1
- package/dist/emnapi.d.ts +61 -28
- package/dist/emnapi.esm-bundler.js +321 -197
- package/dist/emnapi.iife.d.ts +53 -27
- package/dist/emnapi.iife.js +352 -227
- package/dist/emnapi.js +352 -227
- package/dist/emnapi.min.js +1 -1
- package/dist/emnapi.min.mjs +1 -1
- package/dist/emnapi.mjs +308 -184
- package/index.js +1 -1
- 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?;
|
|
@@ -40,16 +42,26 @@ export class Context {
|
|
|
40
42
|
supportBigInt: boolean;
|
|
41
43
|
supportNewFunction: boolean;
|
|
42
44
|
canSetFunctionName: boolean;
|
|
43
|
-
setImmediate: (
|
|
45
|
+
setImmediate: (callback: () => void) => void;
|
|
44
46
|
Buffer: BufferCtor | undefined;
|
|
47
|
+
MessageChannel: {
|
|
48
|
+
new (): MessageChannel;
|
|
49
|
+
prototype: MessageChannel;
|
|
50
|
+
} | undefined;
|
|
45
51
|
};
|
|
46
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
|
+
};
|
|
47
59
|
createNotSupportWeakRefError(api: string, message: string): NotSupportWeakRefError;
|
|
48
60
|
createNotSupportBigIntError(api: string, message: string): NotSupportBigIntError;
|
|
49
61
|
createNotSupportBufferError(api: string, message: string): NotSupportBufferError;
|
|
50
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;
|
|
51
63
|
createDeferred<T = any>(value: IDeferrdValue<T>): Deferred<T>;
|
|
52
|
-
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;
|
|
53
65
|
getCurrentScope(): HandleScope | null;
|
|
54
66
|
addToCurrentScope<V>(value: V): Handle<V>;
|
|
55
67
|
openScope(envObject: Env): HandleScope;
|
|
@@ -60,7 +72,10 @@ export class Context {
|
|
|
60
72
|
runCleanup(): void;
|
|
61
73
|
increaseWaitingRequestCounter(): void;
|
|
62
74
|
decreaseWaitingRequestCounter(): void;
|
|
63
|
-
|
|
75
|
+
setCanCallIntoJs(value: boolean): void;
|
|
76
|
+
setStopping(value: boolean): void;
|
|
77
|
+
canCallIntoJs(): boolean;
|
|
78
|
+
destroy(): void;
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
export function createContext(): Context;
|
|
@@ -76,18 +91,16 @@ export class Deferred<T = any> implements IStoreValue {
|
|
|
76
91
|
dispose(): void;
|
|
77
92
|
}
|
|
78
93
|
|
|
79
|
-
export class DeferredStore extends Store<Deferred> {
|
|
80
|
-
constructor();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
94
|
export class EmnapiError extends Error {
|
|
84
95
|
constructor(message?: string);
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
export class Env implements IStoreValue {
|
|
88
99
|
readonly ctx: Context;
|
|
100
|
+
moduleApiVersion: number;
|
|
89
101
|
makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void;
|
|
90
102
|
makeDynCall_vp: (cb: Ptr) => (a: Ptr) => void;
|
|
103
|
+
abort: (msg?: string) => never;
|
|
91
104
|
id: number;
|
|
92
105
|
openHandleScopes: number;
|
|
93
106
|
instanceData: RefBase | null;
|
|
@@ -95,16 +108,15 @@ export class Env implements IStoreValue {
|
|
|
95
108
|
refs: number;
|
|
96
109
|
reflist: RefTracker;
|
|
97
110
|
finalizing_reflist: RefTracker;
|
|
98
|
-
private destructing;
|
|
99
|
-
finalizationScheduled: boolean;
|
|
100
111
|
pendingFinalizers: RefTracker[];
|
|
101
112
|
lastError: {
|
|
102
113
|
errorCode: napi_status;
|
|
103
114
|
engineErrorCode: number;
|
|
104
115
|
engineReserved: Ptr;
|
|
105
116
|
};
|
|
106
|
-
|
|
107
|
-
|
|
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;
|
|
108
120
|
ref(): void;
|
|
109
121
|
unref(): void;
|
|
110
122
|
ensureHandle<S>(value: S): Handle<S>;
|
|
@@ -112,11 +124,11 @@ export class Env implements IStoreValue {
|
|
|
112
124
|
clearLastError(): napi_status;
|
|
113
125
|
setLastError(error_code: napi_status, engine_error_code?: uint32_t, engine_reserved?: void_p): napi_status;
|
|
114
126
|
getReturnStatus(): napi_status;
|
|
115
|
-
callIntoModule<T>(fn: (env: Env) => T): T;
|
|
127
|
+
callIntoModule<T>(fn: (env: Env) => T, handleException?: (envObject: Env, value: any) => void): T;
|
|
116
128
|
callFinalizer(cb: napi_finalize, data: void_p, hint: void_p): void;
|
|
117
129
|
enqueueFinalizer(finalizer: RefTracker): void;
|
|
118
130
|
dequeueFinalizer(finalizer: RefTracker): void;
|
|
119
|
-
|
|
131
|
+
deleteMe(): void;
|
|
120
132
|
dispose(): void;
|
|
121
133
|
private readonly _bindingMap;
|
|
122
134
|
initObjectBinding<S extends object>(value: S): IReferenceBinding;
|
|
@@ -125,10 +137,6 @@ export class Env implements IStoreValue {
|
|
|
125
137
|
getInstanceData(): number;
|
|
126
138
|
}
|
|
127
139
|
|
|
128
|
-
export class EnvStore extends Store<Env> {
|
|
129
|
-
constructor();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
140
|
export class Finalizer {
|
|
133
141
|
envObject: Env;
|
|
134
142
|
protected _finalizeCallback: napi_finalize;
|
|
@@ -148,9 +156,7 @@ export class Handle<S> {
|
|
|
148
156
|
id: number;
|
|
149
157
|
value: S;
|
|
150
158
|
constructor(id: number, value: S);
|
|
151
|
-
init(id: number, value: S): void;
|
|
152
159
|
data(envObject: Env): void_p;
|
|
153
|
-
isEmpty(): boolean;
|
|
154
160
|
isNumber(): boolean;
|
|
155
161
|
isBigInt(): boolean;
|
|
156
162
|
isString(): boolean;
|
|
@@ -222,6 +228,28 @@ export interface IStoreValue {
|
|
|
222
228
|
[x: string]: any;
|
|
223
229
|
}
|
|
224
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
|
+
|
|
225
253
|
export class NotSupportBigIntError extends EmnapiError {
|
|
226
254
|
constructor(api: string, message: string);
|
|
227
255
|
}
|
|
@@ -268,6 +296,7 @@ export class RefBase extends Finalizer {
|
|
|
268
296
|
|
|
269
297
|
export class Reference extends RefBase implements IStoreValue {
|
|
270
298
|
id: number;
|
|
299
|
+
private canBeWeak;
|
|
271
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;
|
|
272
301
|
persistent: Persistent<object>;
|
|
273
302
|
private constructor();
|
|
@@ -279,10 +308,6 @@ export class Reference extends RefBase implements IStoreValue {
|
|
|
279
308
|
dispose(): void;
|
|
280
309
|
}
|
|
281
310
|
|
|
282
|
-
export class RefStore extends Store<Reference> {
|
|
283
|
-
constructor();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
311
|
export class RefTracker {
|
|
287
312
|
finalize(): void;
|
|
288
313
|
private _next;
|
|
@@ -306,7 +331,7 @@ export class Store<V extends IStoreValue> {
|
|
|
306
331
|
protected _values: Array<V | undefined>;
|
|
307
332
|
private _freeList;
|
|
308
333
|
private _size;
|
|
309
|
-
constructor(
|
|
334
|
+
constructor();
|
|
310
335
|
add(value: V): void;
|
|
311
336
|
get(id: Ptr): V | undefined;
|
|
312
337
|
has(id: Ptr): boolean;
|
|
@@ -316,6 +341,7 @@ export class Store<V extends IStoreValue> {
|
|
|
316
341
|
|
|
317
342
|
export class TryCatch {
|
|
318
343
|
private _exception;
|
|
344
|
+
private _caught;
|
|
319
345
|
hasCaught(): boolean;
|
|
320
346
|
exception(): any;
|
|
321
347
|
setError(err: any): void;
|