@emnapi/core
Advanced tools
Comparing version 0.45.0 to 1.0.0
@@ -1,142 +0,157 @@ | ||
import type { Context } from '@emnapi/runtime' | ||
import type { Context } from '@emnapi/runtime'; | ||
export declare interface NodeBinding { | ||
node: { | ||
emitAsyncInit: Function | ||
emitAsyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
napi: { | ||
asyncInit: Function | ||
asyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
/** @public */ | ||
export declare type BaseCreateOptions = { | ||
filename?: string | ||
nodeBinding?: NodeBinding | ||
reuseWorker?: boolean | ||
asyncWorkPoolSize?: number | ||
onCreateWorker?: (info: CreateWorkerInfo) => any | ||
print?: (str: string) => void | ||
printErr?: (str: string) => void | ||
postMessage?: (msg: any) => any | ||
} | ||
export declare interface CreateWorkerInfo { | ||
type: 'thread' | 'async-work' | ||
} | ||
/** @public */ | ||
export declare function createNapiModule ( | ||
options: CreateOptions | ||
): NapiModule | ||
export declare type BaseCreateOptions = { | ||
filename?: string | ||
nodeBinding?: NodeBinding | ||
reuseWorker?: boolean | ||
asyncWorkPoolSize?: number | ||
onCreateWorker?: (info: CreateWorkerInfo) => any | ||
print?: (str: string) => void | ||
printErr?: (str: string) => void | ||
postMessage?: (msg: any) => any | ||
} | ||
/** @public */ | ||
export declare type CreateOptions = BaseCreateOptions & ({ | ||
context: Context | ||
childThread?: boolean | ||
context: Context | ||
childThread?: boolean | ||
} | { | ||
context?: Context | ||
childThread: true | ||
context?: Context | ||
childThread: true | ||
}) | ||
export declare interface PointerInfo { | ||
address: number | ||
ownership: 0 | 1 | ||
runtimeAllocated: 0 | 1 | ||
/** @public */ | ||
export declare interface CreateWorkerInfo { | ||
type: 'thread' | 'async-work' | ||
} | ||
/** @public */ | ||
export declare interface HandleOptions { | ||
onLoad(data: OnLoadData): InstantiatedSource | Promise<InstantiatedSource>; | ||
} | ||
/** @public */ | ||
export declare interface InitOptions { | ||
instance: WebAssembly.Instance | ||
module: WebAssembly.Module | ||
memory?: WebAssembly.Memory | ||
table?: WebAssembly.Table | ||
instance: WebAssembly.Instance | ||
module: WebAssembly.Module | ||
memory?: WebAssembly.Memory | ||
table?: WebAssembly.Table | ||
} | ||
export declare interface NapiModule { | ||
imports: { | ||
env: any | ||
napi: any | ||
emnapi: any | ||
} | ||
exports: any | ||
loaded: boolean | ||
filename: string | ||
childThread: boolean | ||
emnapi: { | ||
syncMemory<T extends ArrayBuffer | ArrayBufferView> ( | ||
js_to_wasm: boolean, | ||
arrayBufferOrView: T, | ||
offset?: number, | ||
len?: int | ||
): T | ||
getMemoryAddress (arrayBufferOrView: ArrayBuffer | ArrayBufferView): PointerInfo | ||
} | ||
export declare type InputType = string | URL | Response | BufferSource | WebAssembly.Module; | ||
init (options: InitOptions): any | ||
spawnThread (startArg: number, errorOrTid?: number): number | ||
startThread (tid: number, startArg: number): void | ||
initWorker (arg: number): void | ||
executeAsyncWork (work: number): void | ||
postMessage?: (msg: any) => any | ||
/** @public */ | ||
export declare interface InstantiatedSource extends WebAssembly.WebAssemblyInstantiatedSource { | ||
napiModule: NapiModule; | ||
} | ||
export declare function createNapiModule ( | ||
options: CreateOptions | ||
): NapiModule | ||
/** @public */ | ||
export declare function instantiateNapiModule( | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, options: InstantiateOptions): Promise<InstantiatedSource>; | ||
export declare interface ReactorWASI { | ||
readonly wasiImport?: Record<string, any> | ||
initialize (instance: object): void | ||
getImportObject? (): any | ||
} | ||
/** @public */ | ||
export declare function instantiateNapiModuleSync(wasmInput: BufferSource | WebAssembly.Module, options: InstantiateOptions): InstantiatedSource; | ||
/** @public */ | ||
export declare type InstantiateOptions = CreateOptions & LoadOptions; | ||
/** @public */ | ||
export declare function loadNapiModule(napiModule: NapiModule, | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, options?: LoadOptions): Promise<WebAssembly.WebAssemblyInstantiatedSource>; | ||
/** @public */ | ||
export declare function loadNapiModuleSync(napiModule: NapiModule, wasmInput: BufferSource | WebAssembly.Module, options?: LoadOptions): WebAssembly.WebAssemblyInstantiatedSource; | ||
/** @public */ | ||
export declare interface LoadOptions { | ||
wasi?: ReactorWASI | ||
overwriteImports?: (importObject: WebAssembly.Imports) => WebAssembly.Imports | ||
beforeInit?: (source: WebAssembly.WebAssemblyInstantiatedSource) => void | ||
getMemory?: (exports: WebAssembly.Exports) => WebAssembly.Memory | ||
getTable?: (exports: WebAssembly.Exports) => WebAssembly.Table | ||
wasi?: ReactorWASI; | ||
overwriteImports?: (importObject: WebAssembly.Imports) => WebAssembly.Imports; | ||
beforeInit?: (source: WebAssembly.WebAssemblyInstantiatedSource) => void; | ||
getMemory?: (exports: WebAssembly.Exports) => WebAssembly.Memory; | ||
getTable?: (exports: WebAssembly.Exports) => WebAssembly.Table; | ||
} | ||
export declare type InstantiateOptions = CreateOptions & LoadOptions | ||
export declare interface InstantiatedSource extends WebAssembly.WebAssemblyInstantiatedSource { | ||
napiModule: NapiModule | ||
/** @public */ | ||
export declare class MessageHandler { | ||
onLoad: (data: OnLoadData) => InstantiatedSource | Promise<InstantiatedSource>; | ||
instance: WebAssembly.Instance | undefined; | ||
napiModule: NapiModule | undefined; | ||
messagesBeforeLoad: any[]; | ||
constructor(options: HandleOptions); | ||
handle(e: any): void; | ||
} | ||
export declare type InputType = string | URL | Response | BufferSource | WebAssembly.Module | ||
/** @public */ | ||
export declare interface NapiModule { | ||
imports: { | ||
env: any | ||
napi: any | ||
emnapi: any | ||
} | ||
exports: any | ||
loaded: boolean | ||
filename: string | ||
childThread: boolean | ||
emnapi: { | ||
syncMemory<T extends ArrayBuffer | ArrayBufferView> ( | ||
js_to_wasm: boolean, | ||
arrayBufferOrView: T, | ||
offset?: number, | ||
len?: number | ||
): T | ||
getMemoryAddress (arrayBufferOrView: ArrayBuffer | ArrayBufferView): PointerInfo | ||
} | ||
export declare function loadNapiModule ( | ||
napiModule: NapiModule, | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, | ||
options?: LoadOptions | ||
): Promise<WebAssembly.WebAssemblyInstantiatedSource> | ||
init (options: InitOptions): any | ||
spawnThread (startArg: number, errorOrTid?: number): number | ||
startThread (tid: number, startArg: number): void | ||
initWorker (arg: number): void | ||
executeAsyncWork (work: number): void | ||
postMessage?: (msg: any) => any | ||
} | ||
export declare function loadNapiModuleSync ( | ||
napiModule: NapiModule, | ||
wasmInput: BufferSource | WebAssembly.Module, | ||
options?: LoadOptions | ||
): WebAssembly.WebAssemblyInstantiatedSource | ||
/** @public */ | ||
export declare interface NodeBinding { | ||
node: { | ||
emitAsyncInit: Function | ||
emitAsyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
napi: { | ||
asyncInit: Function | ||
asyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
} | ||
export declare function instantiateNapiModule ( | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, | ||
options: InstantiateOptions | ||
): Promise<InstantiatedSource> | ||
export declare function instantiateNapiModuleSync ( | ||
wasmInput: BufferSource | WebAssembly.Module, | ||
options: InstantiateOptions | ||
): InstantiatedSource | ||
/** @public */ | ||
export declare interface OnLoadData { | ||
wasmModule: WebAssembly.Module | ||
wasmMemory: WebAssembly.Memory | ||
wasmModule: WebAssembly.Module; | ||
wasmMemory: WebAssembly.Memory; | ||
} | ||
export declare interface HandleOptions { | ||
onLoad (data: OnLoadData): InstantiatedSource | Promise<InstantiatedSource> | ||
/** @public */ | ||
export declare interface PointerInfo { | ||
address: number | ||
ownership: 0 | 1 | ||
runtimeAllocated: 0 | 1 | ||
} | ||
export declare class MessageHandler { | ||
constructor (options: HandleOptions) | ||
handle (e: { data: any }): void | ||
/** @public */ | ||
export declare interface ReactorWASI { | ||
readonly wasiImport?: Record<string, any>; | ||
initialize(instance: object): void; | ||
getImportObject?(): any; | ||
} | ||
export declare const version: string; | ||
export { } |
@@ -1,144 +0,159 @@ | ||
import type { Context } from '@emnapi/runtime' | ||
import type { Context } from '@emnapi/runtime'; | ||
export declare interface NodeBinding { | ||
node: { | ||
emitAsyncInit: Function | ||
emitAsyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
napi: { | ||
asyncInit: Function | ||
asyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
/** @public */ | ||
export declare type BaseCreateOptions = { | ||
filename?: string | ||
nodeBinding?: NodeBinding | ||
reuseWorker?: boolean | ||
asyncWorkPoolSize?: number | ||
onCreateWorker?: (info: CreateWorkerInfo) => any | ||
print?: (str: string) => void | ||
printErr?: (str: string) => void | ||
postMessage?: (msg: any) => any | ||
} | ||
export declare interface CreateWorkerInfo { | ||
type: 'thread' | 'async-work' | ||
} | ||
/** @public */ | ||
export declare function createNapiModule ( | ||
options: CreateOptions | ||
): NapiModule | ||
export declare type BaseCreateOptions = { | ||
filename?: string | ||
nodeBinding?: NodeBinding | ||
reuseWorker?: boolean | ||
asyncWorkPoolSize?: number | ||
onCreateWorker?: (info: CreateWorkerInfo) => any | ||
print?: (str: string) => void | ||
printErr?: (str: string) => void | ||
postMessage?: (msg: any) => any | ||
} | ||
/** @public */ | ||
export declare type CreateOptions = BaseCreateOptions & ({ | ||
context: Context | ||
childThread?: boolean | ||
context: Context | ||
childThread?: boolean | ||
} | { | ||
context?: Context | ||
childThread: true | ||
context?: Context | ||
childThread: true | ||
}) | ||
export declare interface PointerInfo { | ||
address: number | ||
ownership: 0 | 1 | ||
runtimeAllocated: 0 | 1 | ||
/** @public */ | ||
export declare interface CreateWorkerInfo { | ||
type: 'thread' | 'async-work' | ||
} | ||
/** @public */ | ||
export declare interface HandleOptions { | ||
onLoad(data: OnLoadData): InstantiatedSource | Promise<InstantiatedSource>; | ||
} | ||
/** @public */ | ||
export declare interface InitOptions { | ||
instance: WebAssembly.Instance | ||
module: WebAssembly.Module | ||
memory?: WebAssembly.Memory | ||
table?: WebAssembly.Table | ||
instance: WebAssembly.Instance | ||
module: WebAssembly.Module | ||
memory?: WebAssembly.Memory | ||
table?: WebAssembly.Table | ||
} | ||
export declare interface NapiModule { | ||
imports: { | ||
env: any | ||
napi: any | ||
emnapi: any | ||
} | ||
exports: any | ||
loaded: boolean | ||
filename: string | ||
childThread: boolean | ||
emnapi: { | ||
syncMemory<T extends ArrayBuffer | ArrayBufferView> ( | ||
js_to_wasm: boolean, | ||
arrayBufferOrView: T, | ||
offset?: number, | ||
len?: int | ||
): T | ||
getMemoryAddress (arrayBufferOrView: ArrayBuffer | ArrayBufferView): PointerInfo | ||
} | ||
export declare type InputType = string | URL | Response | BufferSource | WebAssembly.Module; | ||
init (options: InitOptions): any | ||
spawnThread (startArg: number, errorOrTid?: number): number | ||
startThread (tid: number, startArg: number): void | ||
initWorker (arg: number): void | ||
executeAsyncWork (work: number): void | ||
postMessage?: (msg: any) => any | ||
/** @public */ | ||
export declare interface InstantiatedSource extends WebAssembly.WebAssemblyInstantiatedSource { | ||
napiModule: NapiModule; | ||
} | ||
export declare function createNapiModule ( | ||
options: CreateOptions | ||
): NapiModule | ||
/** @public */ | ||
export declare function instantiateNapiModule( | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, options: InstantiateOptions): Promise<InstantiatedSource>; | ||
export declare interface ReactorWASI { | ||
readonly wasiImport?: Record<string, any> | ||
initialize (instance: object): void | ||
getImportObject? (): any | ||
} | ||
/** @public */ | ||
export declare function instantiateNapiModuleSync(wasmInput: BufferSource | WebAssembly.Module, options: InstantiateOptions): InstantiatedSource; | ||
/** @public */ | ||
export declare type InstantiateOptions = CreateOptions & LoadOptions; | ||
/** @public */ | ||
export declare function loadNapiModule(napiModule: NapiModule, | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, options?: LoadOptions): Promise<WebAssembly.WebAssemblyInstantiatedSource>; | ||
/** @public */ | ||
export declare function loadNapiModuleSync(napiModule: NapiModule, wasmInput: BufferSource | WebAssembly.Module, options?: LoadOptions): WebAssembly.WebAssemblyInstantiatedSource; | ||
/** @public */ | ||
export declare interface LoadOptions { | ||
wasi?: ReactorWASI | ||
overwriteImports?: (importObject: WebAssembly.Imports) => WebAssembly.Imports | ||
beforeInit?: (source: WebAssembly.WebAssemblyInstantiatedSource) => void | ||
getMemory?: (exports: WebAssembly.Exports) => WebAssembly.Memory | ||
getTable?: (exports: WebAssembly.Exports) => WebAssembly.Table | ||
wasi?: ReactorWASI; | ||
overwriteImports?: (importObject: WebAssembly.Imports) => WebAssembly.Imports; | ||
beforeInit?: (source: WebAssembly.WebAssemblyInstantiatedSource) => void; | ||
getMemory?: (exports: WebAssembly.Exports) => WebAssembly.Memory; | ||
getTable?: (exports: WebAssembly.Exports) => WebAssembly.Table; | ||
} | ||
export declare type InstantiateOptions = CreateOptions & LoadOptions | ||
export declare interface InstantiatedSource extends WebAssembly.WebAssemblyInstantiatedSource { | ||
napiModule: NapiModule | ||
/** @public */ | ||
export declare class MessageHandler { | ||
onLoad: (data: OnLoadData) => InstantiatedSource | Promise<InstantiatedSource>; | ||
instance: WebAssembly.Instance | undefined; | ||
napiModule: NapiModule | undefined; | ||
messagesBeforeLoad: any[]; | ||
constructor(options: HandleOptions); | ||
handle(e: any): void; | ||
} | ||
export declare type InputType = string | URL | Response | BufferSource | WebAssembly.Module | ||
/** @public */ | ||
export declare interface NapiModule { | ||
imports: { | ||
env: any | ||
napi: any | ||
emnapi: any | ||
} | ||
exports: any | ||
loaded: boolean | ||
filename: string | ||
childThread: boolean | ||
emnapi: { | ||
syncMemory<T extends ArrayBuffer | ArrayBufferView> ( | ||
js_to_wasm: boolean, | ||
arrayBufferOrView: T, | ||
offset?: number, | ||
len?: number | ||
): T | ||
getMemoryAddress (arrayBufferOrView: ArrayBuffer | ArrayBufferView): PointerInfo | ||
} | ||
export declare function loadNapiModule ( | ||
napiModule: NapiModule, | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, | ||
options?: LoadOptions | ||
): Promise<WebAssembly.WebAssemblyInstantiatedSource> | ||
init (options: InitOptions): any | ||
spawnThread (startArg: number, errorOrTid?: number): number | ||
startThread (tid: number, startArg: number): void | ||
initWorker (arg: number): void | ||
executeAsyncWork (work: number): void | ||
postMessage?: (msg: any) => any | ||
} | ||
export declare function loadNapiModuleSync ( | ||
napiModule: NapiModule, | ||
wasmInput: BufferSource | WebAssembly.Module, | ||
options?: LoadOptions | ||
): WebAssembly.WebAssemblyInstantiatedSource | ||
/** @public */ | ||
export declare interface NodeBinding { | ||
node: { | ||
emitAsyncInit: Function | ||
emitAsyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
napi: { | ||
asyncInit: Function | ||
asyncDestroy: Function | ||
makeCallback: Function | ||
} | ||
} | ||
export declare function instantiateNapiModule ( | ||
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */ | ||
wasmInput: InputType | Promise<InputType>, | ||
options: InstantiateOptions | ||
): Promise<InstantiatedSource> | ||
export declare function instantiateNapiModuleSync ( | ||
wasmInput: BufferSource | WebAssembly.Module, | ||
options: InstantiateOptions | ||
): InstantiatedSource | ||
/** @public */ | ||
export declare interface OnLoadData { | ||
wasmModule: WebAssembly.Module | ||
wasmMemory: WebAssembly.Memory | ||
wasmModule: WebAssembly.Module; | ||
wasmMemory: WebAssembly.Memory; | ||
} | ||
export declare interface HandleOptions { | ||
onLoad (data: OnLoadData): InstantiatedSource | Promise<InstantiatedSource> | ||
/** @public */ | ||
export declare interface PointerInfo { | ||
address: number | ||
ownership: 0 | 1 | ||
runtimeAllocated: 0 | 1 | ||
} | ||
export declare class MessageHandler { | ||
constructor (options: HandleOptions) | ||
handle (e: { data: any }): void | ||
/** @public */ | ||
export declare interface ReactorWASI { | ||
readonly wasiImport?: Record<string, any>; | ||
initialize(instance: object): void; | ||
getImportObject?(): any; | ||
} | ||
export declare const version: string; | ||
export { } | ||
export as namespace emnapiCore; |
{ | ||
"name": "@emnapi/core", | ||
"version": "0.45.0", | ||
"version": "1.0.0", | ||
"description": "emnapi core", | ||
"main": "index.js", | ||
"module": "./dist/emnapi-core.esm-bundler.js", | ||
"types": "./index.d.ts", | ||
"types": "./dist/emnapi-core.d.ts", | ||
"sideEffects": false, | ||
@@ -12,5 +12,5 @@ "exports": { | ||
"types": { | ||
"module": "./index.d.ts", | ||
"module": "./dist/emnapi-core.d.ts", | ||
"import": "./dist/emnapi-core.d.mts", | ||
"default": "./index.d.ts" | ||
"default": "./dist/emnapi-core.d.ts" | ||
}, | ||
@@ -22,3 +22,3 @@ "module": "./dist/emnapi-core.esm-bundler.js", | ||
"./dist/emnapi-core.cjs.min": { | ||
"types": "./index.d.ts", | ||
"types": "./dist/emnapi-core.d.ts", | ||
"default": "./dist/emnapi-core.cjs.min.js" | ||
@@ -25,0 +25,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1733942
0
1
15
30392